UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:09:05";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 00:39:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2024-05-22 00:39:05', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:17:15";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 00:47:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 00:47:15', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:20:06";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 00:50:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 00:50:06', '1', 'add', '156.210.98.235', '', '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 ('ص35جديد','','1','475','485', '560','495', '2024-05-22', '0', '1', '0', '', '0', '0', '0', '0', '0', '475','475','475','475','475','0','2.11','4.21','17.89','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'ص35جديد', productDescription = '', productCatId = '1', productBuyPrice = '475', productSellAllPrice = '485', productSellUnitPrice = '560', productSellHalfPrice = '495', productDate = '2024-05-22', conditions = '0', userId = '1', limitamount = '0', parcode = '01760',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '475',lastbuyprice_withDiscount = '475',meanbuyprice = '475',meanbuyprice_withDiscount = '475' , productbuypricereal = '475' , buypricereal_precentage = '0' , buytotal_precentage = '2.11' , buyhalf_precentage = '4.21' , buypart_precentage = '17.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '1760';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '1760', '1', '2024-05-22', '1', '0','0176001','485','495','560','475');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1760', '1', '44', '1', '2024-05-22');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1760', '1', '44', '0', '1760', 'إضافة منتج', 'productController.php', '0', '44', '1', '2024-05-22','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1760, 1,'2024-05-22 00:50:06',1)
                ON DUPLICATE KEY UPDATE productid = 1760, edited = 1, sysdate = '2024-05-22 00:50:06', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '20900', '20900', '2024-05-22', '1', '0', '0', '2024-05-22 00:50:06','إضافة منتج ص35جديد الكمية 44','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10300', '19', '20900', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '19281415.95', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10300', '7', '20900', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '20039766.75', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'ص35جديد', productDescription = '', productCatId = '1', productBuyPrice = '475.00', productSellAllPrice = '485.00', productSellUnitPrice = '560.00', productSellHalfPrice = '495.00', productDate = '2024-05-22', conditions = '0', userId = '1', limitamount = '0', parcode = '01760',type ='0', expireDate = '0' , dailyentryId = '10300',isService = '0',isOptic = '0',lastbuyprice = '475',lastbuyprice_withDiscount = '475',meanbuyprice = '475',meanbuyprice_withDiscount = '475' , productbuypricereal = '475' , buypricereal_precentage = '0' , buytotal_precentage = '2.11' , buyhalf_precentage = '4.21' , buypart_precentage = '17.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '1760';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:20:08";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 00:50:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 00:50:08', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:25:30";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 00:55:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2024-05-22 00:55:30', '1', 'add', '156.210.98.235', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS insertUniqueOptNum;;

CREATE PROCEDURE insertUniqueOptNum(IN optnum INT,IN storeidfrom INT,IN storeidto INT,IN productid INT,IN transferproductamount DECIMAL(10,2),IN transferproductdate DATE,IN userid INT,IN conditions INT,IN `comment` TEXT,IN deloperationnum INT,IN sizeid INT,IN colorid INT,IN driverid INT,IN drivertimeout INT,IN driverdate datetime,IN delivererid INT,IN deliverdate datetime,OUT inserted_id INT,OUT optnum_used INT)
BEGIN
DECLARE n INT DEFAULT 0;
DECLARE id INT DEFAULT 0;
DECLARE lastopt INT DEFAULT 0;


DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
    ROLLBACK;
    GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
     @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
    SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
    SELECT @full_error;
    ROLLBACK;
END;



START TRANSACTION;


SELECT COUNT(*) FROM storemovement WHERE `operationnum` = optnum INTO n;
SELECT DISTINCT operationnum FROM storemovement WHERE operationnum != 0  ORDER BY operationnum DESC limit 1 INTO lastopt;
set lastopt = lastopt+1;

	IF n > 0 THEN


      INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,comment ,
                lastopt,
                deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),lastopt INTO inserted_id,optnum_used;
ELSE

    INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid,transferproductamount, transferproductdate, userid, conditions ,comment
                ,optnum
                ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),optnum INTO inserted_id,optnum_used;
	END IF;

COMMIT WORK; -- it is mandatory dont wait comit in php.as if sp didnot found comit before reaching the end it will rollback giving no errors at all

End;
;;

;
BEGIN;
CALL insertUniqueOptNum(2051,1,5,1696,15,'2024-05-22',1,0, '' ,0,0,0,0,0,'2024-05-22 00:55:31',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '84', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6147';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1696, 0, 0
                    , 450.00, -15, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 450.00,
                        buyQuantity =buyQuantity+-15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "15*2024-05-22*450.00," WHERE transferproductid = 8674;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1696', '1', '15', '1', '8674', 'تحويل منتجات من المخزن', 'storemovementController.php', '99.00', '84', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1696', '5', '15', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1696, 0, 0
                    , 450.00, 15, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1696', '5', '15', '0', '8674', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '15', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1701', '16', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '-16', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6157';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1701, 0, 0
                    , 1.00, -16, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 1.00,
                        buyQuantity =buyQuantity+-16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "16*2024-05-22*1.00," WHERE transferproductid = 8675;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1701', '1', '16', '1', '8675', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '-16', '1', '2024-05-22','0','0');
UPDATE storedetail SET  productquantity = '18', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6169';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1701, 0, 0
                    , 1.00, 16, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+16, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1701', '5', '16', '0', '8675', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '2.00', '18', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1697', '22', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6148';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1697, 0, 0
                    , 450.00, -22, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 450.00,
                        buyQuantity =buyQuantity+-22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2024-05-22*450.00," WHERE transferproductid = 8676;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1697', '1', '22', '1', '8676', 'تحويل منتجات من المخزن', 'storemovementController.php', '42.00', '20', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1697', '5', '22', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1697, 0, 0
                    , 450.00, 22, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1697', '5', '22', '0', '8676', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '22', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1749', '14', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '102', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6283';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1749, 0, 0
                    , 430.00, -14, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 430.00,
                        buyQuantity =buyQuantity+-14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2024-05-22*430.00," WHERE transferproductid = 8677;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1749', '1', '14', '1', '8677', 'تحويل منتجات من المخزن', 'storemovementController.php', '116.00', '102', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1749', '5', '14', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1749, 0, 0
                    , 430.00, 14, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1749', '5', '14', '0', '8677', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '14', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1755', '22', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '64', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6304';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1755, 0, 0
                    , 410.00, -22, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 410.00,
                        buyQuantity =buyQuantity+-22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "22*2024-05-22*410.00," WHERE transferproductid = 8678;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1755', '1', '22', '1', '8678', 'تحويل منتجات من المخزن', 'storemovementController.php', '86.00', '64', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1755', '5', '22', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1755, 0, 0
                    , 410.00, 22, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+22, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1755', '5', '22', '0', '8678', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '22', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1756', '28', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6305';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1756, 0, 0
                    , 440.00, -28, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 440.00,
                        buyQuantity =buyQuantity+-28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "28*2024-05-22*440.00," WHERE transferproductid = 8679;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1756', '1', '28', '1', '8679', 'تحويل منتجات من المخزن', 'storemovementController.php', '82.00', '54', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1756', '5', '28', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1756, 0, 0
                    , 440.00, 28, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1756', '5', '28', '0', '8679', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '28', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1679', '6', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '10', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6090';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1679, 0, 0
                    , 410.00, -6, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 410.00,
                        buyQuantity =buyQuantity+-6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "6*2024-05-22*410.00," WHERE transferproductid = 8680;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1679', '1', '6', '1', '8680', 'تحويل منتجات من المخزن', 'storemovementController.php', '16.00', '10', '1', '2024-05-22','0','0');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6100';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1679, 0, 0
                    , 410.00, 6, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+6, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1679', '5', '6', '0', '8680', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '9.00', '15', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1729', '27', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '-27', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6238';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1729, 0, 0
                    , 450.00, -27, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 450.00,
                        buyQuantity =buyQuantity+-27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "27*2024-05-22*450.00," WHERE transferproductid = 8681;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1729', '1', '27', '1', '8681', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '-27', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1729', '5', '27', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1729, 0, 0
                    , 450.00, 27, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1729', '5', '27', '0', '8681', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '27', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1577', '30', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '149', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '5614';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1577, 0, 0
                    , 450.00, -30, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 450.00,
                        buyQuantity =buyQuantity+-30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "30*2024-05-22*450.00," WHERE transferproductid = 8682;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1577', '1', '30', '1', '8682', 'تحويل منتجات من المخزن', 'storemovementController.php', '179.00', '149', '1', '2024-05-22','0','0');
UPDATE storedetail SET  productquantity = '35', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '5697';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1577, 0, 0
                    , 450.00, 30, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1577', '5', '30', '0', '8682', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '5.00', '35', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1760', '23', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6322';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1760, 0, 0
                    , 475.00, -23, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 475.00,
                        buyQuantity =buyQuantity+-23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "23*2024-05-22*475.00," WHERE transferproductid = 8683;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1760', '1', '23', '1', '8683', 'تحويل منتجات من المخزن', 'storemovementController.php', '44.00', '21', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1760', '5', '23', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1760, 0, 0
                    , 475.00, 23, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+23, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1760', '5', '23', '0', '8683', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '23', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1282', '22', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '-22', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '4702';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-05-07', 1, 1282, 0, 0
                    , 240.00, 1, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1282, 0, 0
                    , 240.00, -21, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 240.00,
                        buyQuantity =buyQuantity+-21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "1*2023-05-07*240.00,21*2024-05-22*240.00," WHERE transferproductid = 8684;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1282', '1', '22', '1', '8684', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '-22', '1', '2024-05-22','0','0');
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '4810';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2023-05-07', 5, 1282, 0, 0
                    , 240.00, 1, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1282, 0, 0
                    , 240.00, 21, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1282', '5', '22', '0', '8684', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '22', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '353', '18', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '-18', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '353';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 353, 0, 0
                    , 160.00, -18, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "18*2024-05-22*160.00," WHERE transferproductid = 8685;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('353', '1', '18', '1', '8685', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '-18', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('353', '5', '18', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 353, 0, 0
                    , 160.00, 18, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('353', '5', '18', '0', '8685', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '18', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1575', '36', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '5612';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1575, 0, 0
                    , 360.00, -36, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 360.00,
                        buyQuantity =buyQuantity+-36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "36*2024-05-22*360.00," WHERE transferproductid = 8686;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1575', '1', '36', '1', '8686', 'تحويل منتجات من المخزن', 'storemovementController.php', '36.00', '0', '1', '2024-05-22','0','0');
UPDATE storedetail SET  productquantity = '47', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '5692';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1575, 0, 0
                    , 360.00, 36, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1575', '5', '36', '0', '8686', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '11.00', '47', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '5', '1325', '14', '2024-05-22', '1', '0','2051',null,null,'2024-05-22 00:55:31',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '-14', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '4903';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1325, 0, 0
                    , 320.00, -14, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyprice = 320.00,
                        buyQuantity =buyQuantity+-14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2024-05-22*320.00," WHERE transferproductid = 8687;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '1', '14', '1', '8687', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '-14', '1', '2024-05-22','0','0');
UPDATE storedetail SET  productquantity = '14', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '4904';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 5, 1325, 0, 0
                    , 320.00, 14, 0, 0, 1, '2024-05-22 00:55:31')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 00:55:31' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '5', '14', '0', '8687', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0.00', '14', '1', '2024-05-22','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:25:31";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 00:55:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2024-05-22 00:55:31', '1', 'editshow', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:26:54";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 00:56:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2024-05-22 00:56:54', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:30:26";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 01:00:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2024-05-22 01:00:27', '1', 'add', '156.210.98.235', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS insertUniqueOptNum;;

CREATE PROCEDURE insertUniqueOptNum(IN optnum INT,IN storeidfrom INT,IN storeidto INT,IN productid INT,IN transferproductamount DECIMAL(10,2),IN transferproductdate DATE,IN userid INT,IN conditions INT,IN `comment` TEXT,IN deloperationnum INT,IN sizeid INT,IN colorid INT,IN driverid INT,IN drivertimeout INT,IN driverdate datetime,IN delivererid INT,IN deliverdate datetime,OUT inserted_id INT,OUT optnum_used INT)
BEGIN
DECLARE n INT DEFAULT 0;
DECLARE id INT DEFAULT 0;
DECLARE lastopt INT DEFAULT 0;


DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
    ROLLBACK;
    GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
     @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
    SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
    SELECT @full_error;
    ROLLBACK;
END;



START TRANSACTION;


SELECT COUNT(*) FROM storemovement WHERE `operationnum` = optnum INTO n;
SELECT DISTINCT operationnum FROM storemovement WHERE operationnum != 0  ORDER BY operationnum DESC limit 1 INTO lastopt;
set lastopt = lastopt+1;

	IF n > 0 THEN


      INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,comment ,
                lastopt,
                deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),lastopt INTO inserted_id,optnum_used;
ELSE

    INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid,transferproductamount, transferproductdate, userid, conditions ,comment
                ,optnum
                ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),optnum INTO inserted_id,optnum_used;
	END IF;

COMMIT WORK; -- it is mandatory dont wait comit in php.as if sp didnot found comit before reaching the end it will rollback giving no errors at all

End;
;;

;
BEGIN;
CALL insertUniqueOptNum(2052,1,6,1755,10,'2024-05-22',1,0, '' ,0,0,0,0,0,'2024-05-22 01:00:27',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6304';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1755, 0, 0
                    , 410.00, -10, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyprice = 410.00,
                        buyQuantity =buyQuantity+-10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "10*2024-05-22*410.00," WHERE transferproductid = 8688;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1755', '1', '10', '1', '8688', 'تحويل منتجات من المخزن', 'storemovementController.php', '64.00', '54', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1755', '6', '10', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 6, 1755, 0, 0
                    , 410.00, 10, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+10, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1755', '6', '10', '0', '8688', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '10', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '1756', '14', '2024-05-22', '1', '0','2052',null,null,'2024-05-22 01:00:27',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '40', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6305';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1756, 0, 0
                    , 440.00, -14, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyprice = 440.00,
                        buyQuantity =buyQuantity+-14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "14*2024-05-22*440.00," WHERE transferproductid = 8689;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1756', '1', '14', '1', '8689', 'تحويل منتجات من المخزن', 'storemovementController.php', '54.00', '40', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1756', '6', '14', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 6, 1756, 0, 0
                    , 440.00, 14, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+14, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1756', '6', '14', '0', '8689', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '14', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '1729', '20', '2024-05-22', '1', '0','2052',null,null,'2024-05-22 01:00:27',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '-47', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6238';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1729, 0, 0
                    , 450.00, -20, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyprice = 450.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2024-05-22*450.00," WHERE transferproductid = 8690;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1729', '1', '20', '1', '8690', 'تحويل منتجات من المخزن', 'storemovementController.php', '-27.00', '-47', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1729', '6', '20', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 6, 1729, 0, 0
                    , 450.00, 20, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1729', '6', '20', '0', '8690', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '1577', '30', '2024-05-22', '1', '0','2052',null,null,'2024-05-22 01:00:27',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '119', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '5614';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1577, 0, 0
                    , 450.00, -30, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyprice = 450.00,
                        buyQuantity =buyQuantity+-30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "30*2024-05-22*450.00," WHERE transferproductid = 8691;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1577', '1', '30', '1', '8691', 'تحويل منتجات من المخزن', 'storemovementController.php', '149.00', '119', '1', '2024-05-22','0','0');
UPDATE storedetail SET  productquantity = '34', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '5638';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 6, 1577, 0, 0
                    , 450.00, 30, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1577', '6', '30', '0', '8691', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '4.00', '34', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '1760', '21', '2024-05-22', '1', '0','2052',null,null,'2024-05-22 01:00:27',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6322';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1760, 0, 0
                    , 475.00, -21, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyprice = 475.00,
                        buyQuantity =buyQuantity+-21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "21*2024-05-22*475.00," WHERE transferproductid = 8692;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1760', '1', '21', '1', '8692', 'تحويل منتجات من المخزن', 'storemovementController.php', '21.00', '0', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('1760', '6', '21', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 6, 1760, 0, 0
                    , 475.00, 21, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1760', '6', '21', '0', '8692', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '21', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '167', '20', '2024-05-22', '1', '0','2052',null,null,'2024-05-22 01:00:27',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '-20', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '167';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 167, 0, 0
                    , 150.00, -20, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyprice = 150.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2024-05-22*150.00," WHERE transferproductid = 8693;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('167', '1', '20', '1', '8693', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '-20', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('167', '6', '20', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 6, 167, 0, 0
                    , 150.00, 20, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('167', '6', '20', '0', '8693', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2024-05-22','0','0');
INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,operationnum,driverid,drivertimeout,driverdate,delivererid,deliverdate,storetype,priceType,price,sizeid,colorid) VALUES ('1', '6', '165', '20', '2024-05-22', '1', '0','2052',null,null,'2024-05-22 01:00:27',null,'','0','hide','0','0','0');
UPDATE storedetail SET  productquantity = '-20', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '165';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 165, 0, 0
                    , 160.00, -20, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyprice = 160.00,
                        buyQuantity =buyQuantity+-20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2024-05-22*160.00," WHERE transferproductid = 8694;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('165', '1', '20', '1', '8694', 'تحويل منتجات من المخزن', 'storemovementController.php', '0.00', '-20', '1', '2024-05-22','0','0');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('165', '6', '20', '1', '2024-05-22');
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 6, 165, 0, 0
                    , 160.00, 20, 0, 0, 1, '2024-05-22 01:00:27')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 01:00:27' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('165', '6', '20', '0', '8694', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '20', '1', '2024-05-22','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:30:27";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 01:00:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2024-05-22 01:00:27', '1', 'editshow', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:33:09";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 01:03:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 01:03:09', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:33:23";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 01:03:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 01:03:23', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:41:37";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 01:11:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 01:11:37', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:44:20";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 01:14:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 01:14:20', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:44:39";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 01:14:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 01:14:39', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:45:40";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 01:15:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 01:15:40', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-21 21:45:56";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 01:15:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 01:15:56', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 06:05:00";
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 06:16:16";
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 06:27:34";
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 06:28:54";
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 < "2024-05-22 07:27:17";
UPDATE user SET loginip = "197.63.196.30", lastactivetime = "2024-05-22 10:57:17", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 10:57:17', '8', '', '197.63.196.30', '', 'DESKTOP');
UPDATE programsettings SET companyname = 'GT4', address = 'المنصورة', specializtion = 'jh', phone = '01002019235', faxnumber = '0502232923', email = 'mrabozied@gt4it.com', website = 'www.gt4host.com', logo = '471502e62c0be89a8d90663028144a83.jpg', roundnumbers = '0', saveprinting = '1', deptprinting = '0', printingpapersize = '0', userid = '1', showPreviousPrice = '0', parcode = '0', priceing = '0', lastprice = '0', searchvalue = '1', updateproductprice = '0', allowfinsldelete = '0', updateclientprice = '0', `partition` = '0', taxcard = '332', commercialregistration = '3213123312', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '0', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2024-05-22',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 programsettings SET companyname = 'GT4', address = 'المنصورة', specializtion = 'jh', phone = '01002019235', faxnumber = '0502232923', email = 'mrabozied@gt4it.com', website = 'www.gt4host.com', logo = '471502e62c0be89a8d90663028144a83.jpg', roundnumbers = '0', saveprinting = '1', deptprinting = '0', printingpapersize = '0', userid = '1', showPreviousPrice = '0', parcode = '0', priceing = '0', lastprice = '0', searchvalue = '1', updateproductprice = '0', allowfinsldelete = '0', updateclientprice = '0', `partition` = '0', taxcard = '332', commercialregistration = '3213123312', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '0', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2024-05-22',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 < "2024-05-22 07:27: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 < "2024-05-22 07:27:22";
UPDATE user SET loginip = "197.63.196.30", lastactivetime = "2024-05-22 10:57:22", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 10:57:22', '8', 'addsellBill', '197.63.196.30', '', '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 < "2024-05-22 08:58:12";
UPDATE user SET loginip = "156.197.61.193", lastactivetime = "2024-05-22 12:28:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 12:28:12', '4', '', '156.197.61.193', '', 'DESKTOP');
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 08:58:12";
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 < "2024-05-22 08:58:56";
UPDATE user SET loginip = "156.197.61.193", lastactivetime = "2024-05-22 12:28:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 12:28:56', '4', 'addsellBill', '156.197.61.193', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:08:51";
UPDATE user SET loginip = "197.35.246.43", lastactivetime = "2024-05-22 12:38:51", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 12:38:51', '4', '', '197.35.246.43', '', '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 < "2024-05-22 09:08:51";
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 < "2024-05-22 09:08:53";
UPDATE user SET loginip = "197.35.246.43", lastactivetime = "2024-05-22 12:38:54", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 12:38:54', '4', 'addsellBill', '197.35.246.43', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:43:40";
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 < "2024-05-22 09:44:14";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:14:14", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 13:14:14', '7', '', '197.192.202.21', '', '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 < "2024-05-22 09:44: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 < "2024-05-22 09:44:20";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:14:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:14:20', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:54:21";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:24:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 13:24:22', '7', '', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:54:27";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:24:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 13:24:27', '7', '', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:54:41";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:24:42", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 13:24:42', '7', '', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:54:48";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:24:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 13:24:48', '7', '', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:55:14";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:25:14", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 13:25:14', '7', '', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:57:03";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:27:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:27:03', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:57:15";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:27:15", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:27:15', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:57:15";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:27:16", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:27:16', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:57:23";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:27:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:27:23', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:57:36";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:27:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:27:37', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:57:53";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:27:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:27:53', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:58:02";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:28:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:28:02', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:58:20";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:28:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:28:21', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:58:46";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:28:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:28:46', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 7;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 09:59:35";
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:00:39";
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:00:49";
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 < "2024-05-22 10:01:17";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:31:17", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 13:31:17', '7', '', '197.192.202.21', '', '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 < "2024-05-22 10:01:17";
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 < "2024-05-22 10:01:57";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:31:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:31:57', '7', 'addsellBill', '197.192.202.21', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:04:38";
UPDATE user SET loginip = "197.192.202.21", lastactivetime = "2024-05-22 13:34:38", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 13:34:38', '7', 'addsellBill', '197.192.202.21', '', '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 < "2024-05-22 10:46:29";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:16:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 14:16:29', '1', '', '156.210.98.235', '', '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 < "2024-05-22 10:46:29";
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 < "2024-05-22 10:46:45";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:16:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 14:16:45', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:48:17";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:18:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 14:18:17', '1', 'add', '156.210.98.235', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('7','9', '3500', '2024-05-22', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '8003',  userid = '1' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('11503.00','3500', '1', '7', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '707', '8003', '2024-05-22 14:18:17', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '8226965',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8223465.00','3500', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل العميد ] ', '707', '8226965', '2024-05-22 14:18:17', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '3500', '3500', '2024-05-22', '1', '0', '0', '2024-05-22 14:18:17','اضافة تحويل من خزينة محل العميد الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10301', '156', '3500', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8226965', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10301', '141', '3500', '','0');
UPDATE accountstree SET name = 'خزينة محل العميد', customName = 'خزينة محل العميد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-2090649', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '141';
UPDATE transfermoney SET saveidfrom = '7', saveidto = '9', transfermoneyvalue = '3500.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '0' , dailyentryid = '10301' , comment = '' WHERE transfermoneyid = '707';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:48:18";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:18:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 14:18:18', '1', 'sucess', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:48:19";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:18:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 14:18:20', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:48:50";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:18:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 14:18:50', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:48:50";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:18:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 14:18:50', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:49:16";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:19:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 14:19:16', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:50:13";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:20:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 14:20:13', '1', 'showDetail', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 10:50:15";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 14:20:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2024-05-22 14:20:15', '1', 'editprint', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 8;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 11:25:57";
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 < "2024-05-22 11:26:03";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 14:56:03", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 14:56:03', '8', '', '197.63.194.90', '', '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 < "2024-05-22 11:26:03";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 11:26:25";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 14:56:25", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 14:56:25', '8', 'addsellBill', '197.63.194.90', '', '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;
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 < "2024-05-22 11:28:18";
UPDATE user SET loginip = "197.32.231.20", lastactivetime = "2024-05-22 14:58:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 14:58:18', '3', '', '197.32.231.20', '', '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 < "2024-05-22 11:28:18";
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 < "2024-05-22 11:28:23";
UPDATE user SET loginip = "197.32.231.20", lastactivetime = "2024-05-22 14:58:23", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 14:58:23', '3', 'addsellBill', '197.32.231.20', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:05:41";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 15:35:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 15:35:41', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:06:01";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 15:36:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 15:36:01', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:18:35";
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:18:38";
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 < "2024-05-22 12:19:08";
UPDATE user SET loginip = "197.192.192.155", lastactivetime = "2024-05-22 15:49:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 15:49:08', '7', '', '197.192.192.155', '', '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 < "2024-05-22 12:19:08";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:20:01";
UPDATE user SET loginip = "197.192.192.155", lastactivetime = "2024-05-22 15:50:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 15:50:01', '7', 'addsellBill', '197.192.192.155', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:20:51";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 15:50:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2024-05-22 15:50:51', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:23:25";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 15:53:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2024-05-22 15:53:26', '1', 'add', '156.210.98.235', '', '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

;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =25287
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(401,@clientdebt,@clientname);
UPDATE client SET  clientdebt = '62565' , clientdate = '2024-05-22 15:53:26', userid = '1' WHERE clientid = '401';
UPDATE client SET  inUse = 0 where clientid = 401;
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 ('401','72565.00','10000','1','ايصال تحصيل (( قبض من عميل ))','25287', '62565', '2024-05-22 15:50:51', '1', 'clientPayedDeptController.php', '   5000بتاريخ/11/5/2024  و5000بتاريخ 21/5/2024  ليد الشيخ عبد اللطيف', '10000', '0', null, '0', null, null,'', '-1','1','1','1','1');
UPDATE save SET  savecurrentvalue = '377390',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('367390.00','10000', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '25287', '377390', '2024-05-22 15:53:26', '1',  'clientPayedDeptController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '10000', '10000', '2024-05-22', '1', '0', '0', '2024-05-22 15:53:26','اضافة ايصال سداد للعميل سنتر النهار','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10302', '54', '10000', '','0');
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2018-04-21', itemtype2 = '1', theValue = '185084', theOrder = '0', layingOrder = '1221',reportid = '2' WHERE id = '54';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10302', '472', '10000', '','0');
UPDATE accountstree SET name = 'سنتر النهار', customName = 'سنتر النهار', parent = '23', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2024-03-07', itemtype2 = '1', theValue = '-37000', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '472';
UPDATE clientdebtchange SET clientid = '401', clientdebtchangebefore = '72565.00', clientdebtchangeamount = '10000.00', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '25287', clientdebtchangeafter = '62565.00', clientdebtchangedate = '2024-05-22 15:50:51', userid = '1', tablename = 'clientPayedDeptController.php', comment = '   5000بتاريخ/11/5/2024  و5000بتاريخ 21/5/2024  ليد الشيخ عبد اللطيف', totalOperationCost = '10000.00',discount='', reciptid=null, dailyentryid = '10302',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='1',saveConversionFactor='1' WHERE clientdebtchangeid = '25287';
COMMIT;

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:23:26";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 15:53:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2024-05-22 15:53:26', '1', 'sucess', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:23:28";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 15:53:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientPayedDeptController.php', '2024-05-22 15:53:28', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:28:27";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 15:58:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 15:58:27', '1', 'addsellBill', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:31:00";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:01:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:01:00', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:31:20";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:01:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:01:20', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '300', productSellAllPrice = '320.00', productSellUnitPrice = '370.00', productSellHalfPrice = '330.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '290',meanbuyprice_withDiscount = '290' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:02:08',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:02:08', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '300.00', productSellAllPrice = '300', productSellUnitPrice = '300', productSellHalfPrice = '300', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '290.00',meanbuyprice_withDiscount = '290' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:02:14',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:02:14', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '300.00', productSellAllPrice = '300.00', productSellUnitPrice = '300.00', productSellHalfPrice = '310', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '290.00',meanbuyprice_withDiscount = '290' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:02:22',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:02:22', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '300.00', productSellAllPrice = '300.00', productSellUnitPrice = '300', productSellHalfPrice = '310.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '290.00',meanbuyprice_withDiscount = '290' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:05:33',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:05:33', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '340', productSellAllPrice = '300.00', productSellUnitPrice = '300.00', productSellHalfPrice = '310.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '315',meanbuyprice_withDiscount = '315' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:05:40',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:05:40', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '340', productSellUnitPrice = '340', productSellHalfPrice = '340', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:05:45',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:05:45', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '340.00', productSellUnitPrice = '340.00', productSellHalfPrice = '350', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:05:52',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:05:52', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '340.00', productSellUnitPrice = '440', productSellHalfPrice = '350.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:06:30',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:06:30', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:36:43";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:06:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:06:43', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:37:10";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:07:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:07:10', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:38:52";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:08:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:08:53', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '340.00', productSellUnitPrice = '420', productSellHalfPrice = '350.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:09:03',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:09:03', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:39:13";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:09:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:09:14', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '380.00', productSellUnitPrice = '440', productSellHalfPrice = '390.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '340.00',meanbuyprice_withDiscount = '340' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 16:09:34',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 16:09:34', userid = 1;
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '380.00', productSellUnitPrice = '440', productSellHalfPrice = '390.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '340.00',meanbuyprice_withDiscount = '340' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 16:09:41',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 16:09:41', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:40:17";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:10:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 16:10:17', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:41:28";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:11:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 16:11:28', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:42:27";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:12:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 16:12:27', '1', 'add', '156.210.98.235', '', 'DESKTOP');
INSERT INTO impotencetreatmentsuppliersave (typesimpotencetreatmentid, saveid, supplierid, impotencetreatmentsuppliersavetype, impotencetreatmentsuppliersavebefore, impotencetreatmentsuppliersavetamount, impotencetreatmentsuppliersaveafter, impotencetreatmentsuppliersavecomment, conditions, impotencetreatmentsuppliersavedate, userid, tablename) VALUES ('-1', '6', '-1', '0', '26850.00', '170', '27020', '', '0', '2024-05-22 16:12:27', '1', 'settlementsaveController.php');
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor) VALUES ('-1', '', '170', '1', ' خصم معالجة عجز  / ', '568', '-170', '2024-05-22', '1', 'supplierPayedDeptController.php', '', '0','6', '0','1','1','170','1');
UPDATE supplier SET  suppliercurrentDebt = '-170', userid = '1', supplierdate = '2024-05-22'   WHERE supplierid = '-1';
UPDATE supplierdebtchange SET supplierid = '-1', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '170.00', supplierdebtchangetype = '1', processname = ' خصم معالجة عجز  / ', supplierdebtchangemodelid = '568', supplierdebtchangeafter = '-170.00', supplierdebtchangedate = '2024-05-22 00:00:00', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '6',currencyId='1',conversionFactor='1',payedInCurrency='170',saveConversionFactor='1' WHERE supplierdebtchangeid = '943';
UPDATE save SET  savecurrentvalue = '27020',  userid = '1' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('26850.00','170', '0', '6', 'تسوية خزنة بالإضافة', '-1', '27020', '2024-05-22 16:12:28', '1',  'settlementsaveController.php','0','');
UPDATE savedaily SET  savedailymodelid = '28325' WHERE savedailyid = '28325';
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '170', '170', '2024-05-22', '1', '0', '0', '2024-05-22 16:12:28','اضافة معالجة عجز ( بالاضافة )','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10303', '140', '170', '','0');
UPDATE accountstree SET name = 'خزينة محل كفر الدوار', customName = 'خزينة محل كفر الدوار', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-1884432', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '140';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10303', '27', '170', '','0');
UPDATE accountstree SET name = 'معالجة عجز خزنة', customName = 'معالجة عجز خزنة', parent = '3', itemtype = '0', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-06-15', itemtype2 = '1', theValue = '-133135', theOrder = '0', layingOrder = '35',reportid = '1' WHERE id = '27';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:42:28";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:12:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 16:12:28', '1', 'sucess', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:42:30";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:12:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 16:12:30', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:45:15";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:15:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 16:15:15', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:46:07";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:16:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 16:16:07', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:46:07";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:16:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 16:16:07', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:46:19";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:16:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 16:16:19', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:46:41";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:16:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 16:16:41', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:48:36";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 16:18:36", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 16:18:36', '8', '', '197.63.194.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:49:59";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:19:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 16:19:59', '1', 'addsellBill', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:50:15";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 16:20:15", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 16:20:15', '8', 'addsellBill', '197.63.194.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:57:08";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:27:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2024-05-22 16:27:08', '1', '', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:57:38";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:27:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2024-05-22 16:27:38', '1', 'add', '156.210.98.235', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '5662';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1540', '6', '9', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '0', '1', '2024-05-22','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:57:40";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:27:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2024-05-22 16:27:40', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:58:21";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:28:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2024-05-22 16:28:21', '1', 'add', '156.210.98.235', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '5664';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1542', '6', '10', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '-1.00', '9', '1', '2024-05-22','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:58:22";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:28:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2024-05-22 16:28:23', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:58:44";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:28:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2024-05-22 16:28:44', '1', 'add', '156.210.98.235', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '5664';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1542', '6', '1', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '9.00', '8', '1', '2024-05-22','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:58:46";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:28:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2024-05-22 16:28:46', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 12:58:58";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:28:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 16:28:58', '1', 'addsellBill', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 13:01:48";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:31:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:31:48', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 13:01:59";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:31:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:31:59', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '380.00', productSellUnitPrice = '460', productSellHalfPrice = '390.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '340.00',meanbuyprice_withDiscount = '340' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 16:32:24',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 16:32:24', userid = 1;
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '380.00', productSellUnitPrice = '460.00', productSellHalfPrice = '390.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '340.00',meanbuyprice_withDiscount = '340' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 16:32:43',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 16:32:43', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 13:03:02";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:33:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:33:02', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '360', productSellUnitPrice = '360', productSellHalfPrice = '360', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:33:21',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:33:21', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '360.00', productSellUnitPrice = '360.00', productSellHalfPrice = '370', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:33:34',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:33:34', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '340.00', productSellAllPrice = '360.00', productSellUnitPrice = '420', productSellHalfPrice = '370.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 16:34:02',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 16:34:02', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 13:04:11";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:34:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:34:11', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '360', productSellAllPrice = '380.00', productSellUnitPrice = '460.00', productSellHalfPrice = '390.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 16:34:40',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 16:34:40', userid = 1;
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '360.00', productSellAllPrice = '380.00', productSellUnitPrice = '440', productSellHalfPrice = '390.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 16:35:23',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 16:35:23', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 13:05:34";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:35:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:35:34', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE product SET productName = 'ص2', productDescription = '', productCatId = '1', productBuyPrice = '360.00', productSellAllPrice = '370', productSellUnitPrice = '370', productSellHalfPrice = '370', productDate = '2024-02-25', conditions = '0', userId = '1', limitamount = '0', parcode = '01575',type ='0', expireDate = '0' , dailyentryId = '9517',isService = '0',isOptic = '0',lastbuyprice = '360.00',lastbuyprice_withDiscount = '360',meanbuyprice = '360.00',meanbuyprice_withDiscount = '360' , productbuypricereal = '360.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '2.78' , buypart_precentage = '13.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1575';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1575, 1,'2024-05-22 16:35:55',1)
                ON DUPLICATE KEY UPDATE productid = 1575, edited = 1, sysdate = '2024-05-22 16:35:55', userid = 1;
UPDATE product SET productName = 'ص2', productDescription = '', productCatId = '1', productBuyPrice = '360.00', productSellAllPrice = '370.00', productSellUnitPrice = '370.00', productSellHalfPrice = '380', productDate = '2024-02-25', conditions = '0', userId = '1', limitamount = '0', parcode = '01575',type ='0', expireDate = '0' , dailyentryId = '9517',isService = '0',isOptic = '0',lastbuyprice = '360.00',lastbuyprice_withDiscount = '360',meanbuyprice = '360.00',meanbuyprice_withDiscount = '360' , productbuypricereal = '360.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '2.78' , buypart_precentage = '13.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1575';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1575, 1,'2024-05-22 16:36:00',1)
                ON DUPLICATE KEY UPDATE productid = 1575, edited = 1, sysdate = '2024-05-22 16:36:00', userid = 1;
UPDATE product SET productName = 'ص2', productDescription = '', productCatId = '1', productBuyPrice = '360.00', productSellAllPrice = '370.00', productSellUnitPrice = '440', productSellHalfPrice = '380.00', productDate = '2024-02-25', conditions = '0', userId = '1', limitamount = '0', parcode = '01575',type ='0', expireDate = '0' , dailyentryId = '9517',isService = '0',isOptic = '0',lastbuyprice = '360.00',lastbuyprice_withDiscount = '360',meanbuyprice = '360.00',meanbuyprice_withDiscount = '360' , productbuypricereal = '360.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '2.78' , buypart_precentage = '13.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1575';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1575, 1,'2024-05-22 16:36:06',1)
                ON DUPLICATE KEY UPDATE productid = 1575, edited = 1, sysdate = '2024-05-22 16:36:06', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 13:06:20";
UPDATE user SET loginip = "156.210.98.235", lastactivetime = "2024-05-22 16:36:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 16:36:20', '1', 'show', '156.210.98.235', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 13:16:46";
UPDATE user SET loginip = "197.35.246.43", lastactivetime = "2024-05-22 16:46:46", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2024-05-22 16:46:46', '4', '', '197.35.246.43', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 13:16:56";
UPDATE user SET loginip = "197.35.246.43", lastactivetime = "2024-05-22 16:46:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 16:46:56', '4', 'addsellBill', '197.35.246.43', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 8;
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 < "2024-05-22 15:32:40";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:02:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 19:02:40', '1', '', '156.210.111.90', '', '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 < "2024-05-22 15:32:40";
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 < "2024-05-22 16:03:18";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:33:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:33:18', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:03:38";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:33:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:33:38', '1', 'add', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('6','9', '27000', '2024-05-22', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '20',  userid = '1' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('27020.00','27000', '1', '6', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '708', '20', '2024-05-22 19:33:38', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '8253965',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8226965.00','27000', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل كفر الدوار ] ', '708', '8253965', '2024-05-22 19:33:38', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '27000', '27000', '2024-05-22', '1', '0', '0', '2024-05-22 19:33:38','اضافة تحويل من خزينة محل كفر الدوار الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10304', '156', '27000', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8253965', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10304', '140', '27000', '','0');
UPDATE accountstree SET name = 'خزينة محل كفر الدوار', customName = 'خزينة محل كفر الدوار', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-1911432', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '140';
UPDATE transfermoney SET saveidfrom = '6', saveidto = '9', transfermoneyvalue = '27000.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '0' , dailyentryid = '10304' , comment = '' WHERE transfermoneyid = '708';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:03:38";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:33:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:33:38', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:03:40";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:33:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:33:40', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:03:56";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:33:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:33:56', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:04:43";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:34:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('saveController.php', '2024-05-22 19:34:43', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:05:08";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:35:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:35:08', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:05:25";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:35:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 19:35:25', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:05:25";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:35:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 19:35:25', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:06:00";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:36:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 19:36:00', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:10:45";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:40:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:40:45', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:12:12";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:42:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:42:12', '1', 'add', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('5','9', '12950', '2024-05-22', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '3185',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('16135.00','12950', '1', '5', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '709', '3185', '2024-05-22 19:42:12', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '8266915',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8253965.00','12950', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل عبدالله ] ', '709', '8266915', '2024-05-22 19:42:12', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 19:42:12','اضافة تحويل من خزينة محل عبدالله الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10305', '156', '12950', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8266915', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10305', '139', '12950', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3115113', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE transfermoney SET saveidfrom = '5', saveidto = '9', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '0' , dailyentryid = '10305' , comment = '' WHERE transfermoneyid = '709';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:12:13";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:42:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:42:13', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:12:15";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 19:42:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 19:42:15', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:35:24";
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 16:35:27";
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 < "2024-05-22 16:35:50";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 20:05:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 20:05:50', '7', '', '197.192.207.84', '', '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 < "2024-05-22 16:35:50";
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 < "2024-05-22 16:36:16";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 20:06:16", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 20:06:17', '7', 'addsellBill', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 17:29:51";
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 < "2024-05-22 17:29:59";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:00:00", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 21:00:00', '8', '', '197.63.194.90', '', '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 < "2024-05-22 17:30:00";
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 < "2024-05-22 17:30:02";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:00:02", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 21:00:02', '8', 'addsellBill', '197.63.194.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 17:30:26";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:00:26", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 21:00:26', '8', 'addAndRetuen', '197.63.194.90', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0664e32a305c9d
-- ----------------------------------------------------------------------------------------------------

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 ('2024-05-22 21:00:03', '0664e32a305c9d', '1', '0.00', '0', '5', '1', '465', '460', '460', '0', '6', '2024-05-22 21:00:27', '', '8', '0', 'نقدي', '6', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','460','0','','0','0','460','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '8' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','17078', '0', '2024-05-22 21:00:27', '8', 'sellbillController.php', 'اضافة فاتورة مبيعات', '460', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 17327;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('385','01590', '17078', '1', '1590', '1', '465', '465', '0', '', '1', '2024-05-22 21:00:27', '1590', '0.00', '0', '6','0','','','0','0','0','0','0','0','1','0','','17327-1,');
UPDATE sellbilldetail SET  lastbuyprice = 385.00 , meanbuyprice = 385.00, lastbuyprice_withDiscount = 385.00, meanbuyprice_withDiscount = 385.00
                where sellbilldetailid = 50720;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1590, '2024-05-22', 460, 385, 385
                    , 385, 385, 385, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (6, '2024-05-22', 460, 385, 385
                    , 385, 385, 385, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , 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 = '8', storedetaildate = '2024-05-22 21:00:27' WHERE storedetailid = '5809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1590', '6', '1', '1', '17078', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13.00', '12', '8', '2024-05-22 21:00:27','0','0');
UPDATE save SET  savecurrentvalue = '480',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('20.00','460', '0', '6', 'اضافة فاتورة مبيعات', '17078', '480', '2024-05-22 21:00:27', '8',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2024-05-22', 460, 385, 385
                    , 385, 385, 385, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , 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, '2024-05-22', 460, 385, 385
                    , 385, 385, 385, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+460, sellCostBuyPrice =sellCostBuyPrice+385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+385, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , 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, 460, 385, 385
                    , 385, 385, 385, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+460, netSellCostBuyPrice = netSellCostBuyPrice+385
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+385
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+385
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+385
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+385
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 0664e32a305c9d and sellbillId = 17078 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 17:30:27";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:00:27", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 21:00:27', '8', 'addsellBill', '197.63.194.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 17:32:07";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:02:07", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 21:02:07', '8', '', '197.63.194.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 17:32:14";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:02:14", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 21:02:14', '8', 'add', '197.63.194.90', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'فطار', '', '20', '2024-05-22', '8', '0','-1','6','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '460',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('480.00','20', '1', '6', 'إضافة مصروف', '5041', '460', '2024-05-22 21:02:14', '8',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '20', '20', '2024-05-22', '8', '0', '0', '2024-05-22 21:02:14','اضافة اسم مصروف( فطار )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10306', '160', '20', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '1', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-4501400', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10306', '140', '20', '','0');
UPDATE accountstree SET name = 'خزينة محل كفر الدوار', customName = 'خزينة محل كفر الدوار', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-1911452', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '140';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'فطار', expensesdetails = '', expensesValue = '20.00', expensesdate = '2024-05-22', userid = '8', conditions = '0',saveid = '6' , dailyentryid = '10306', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '5041';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 17:32:15";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:02:15", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 21:02:15', '8', 'sucess', '197.63.194.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 17:32:17";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:02:17", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 21:02:17', '8', 'show', '197.63.194.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 17:32:18";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:02:18", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 21:02:18', '8', '', '197.63.194.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 17:32:29";
UPDATE user SET loginip = "197.63.194.90", lastactivetime = "2024-05-22 21:02:29", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 21:02:29', '8', 'addsellBill', '197.63.194.90', '', '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;
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 < "2024-05-22 18:32:55";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:02:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 22:02:55', '3', '', '197.32.176.49', '', '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 < "2024-05-22 18:32:55";
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 < "2024-05-22 18:32:59";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:02:59", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:02:59', '3', 'addsellBill', '197.32.176.49', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:40:17";
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:40:17";
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 < "2024-05-22 18:40:58";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:10:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 22:10:58', '1', '', '156.210.111.90', '', '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 < "2024-05-22 18:40:59";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:42:41";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:12:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 22:12:41', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:42:41";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:12:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 22:12:41', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:46:11";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:16:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 22:16:11', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '280', productSellAllPrice = '360.00', productSellUnitPrice = '420.00', productSellHalfPrice = '370.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '297.5',meanbuyprice_withDiscount = '297.5' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 22:16:37',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 22:16:37', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '280.00', productSellAllPrice = '300', productSellUnitPrice = '300', productSellHalfPrice = '300', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '297.50',meanbuyprice_withDiscount = '297.5' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 22:16:43',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 22:16:43', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '280.00', productSellAllPrice = '300.00', productSellUnitPrice = '300.00', productSellHalfPrice = '310', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '297.50',meanbuyprice_withDiscount = '297.5' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 22:16:50',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 22:16:50', userid = 1;
UPDATE product SET productName = 'ابونور25', productDescription = '', productCatId = '1', productBuyPrice = '280.00', productSellAllPrice = '300.00', productSellUnitPrice = '360', productSellHalfPrice = '310.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01541',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '280.00',lastbuyprice_withDiscount = '280',meanbuyprice = '297.50',meanbuyprice_withDiscount = '297.5' , productbuypricereal = '280.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '14.29' , buyhalf_precentage = '17.86' , buypart_precentage = '32.14',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1541';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1541, 1,'2024-05-22 22:17:09',1)
                ON DUPLICATE KEY UPDATE productid = 1541, edited = 1, sysdate = '2024-05-22 22:17:09', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:47:59";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:17:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 22:18:00', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '360.00', productSellAllPrice = '360', productSellUnitPrice = '360', productSellHalfPrice = '360', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 22:18:37',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 22:18:37', userid = 1;
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '360.00', productSellHalfPrice = '370', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 22:18:42',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 22:18:42', userid = 1;
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '440', productSellHalfPrice = '370.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 22:18:52',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 22:18:52', userid = 1;
UPDATE product SET productName = 'ابونور27', productDescription = '', productCatId = '1', productBuyPrice = '340', productSellAllPrice = '360.00', productSellUnitPrice = '440.00', productSellHalfPrice = '370.00', productDate = '2024-02-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01542',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '345',meanbuyprice_withDiscount = '345' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.76' , buyhalf_precentage = '14.71' , buypart_precentage = '23.53',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1542';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1542, 1,'2024-05-22 22:18:55',1)
                ON DUPLICATE KEY UPDATE productid = 1542, edited = 1, sysdate = '2024-05-22 22:18:55', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:49:07";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:19:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2024-05-22 22:19:07', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:49:58";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:19:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2024-05-22 22:19:59', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:50:58";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:20:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2024-05-22 22:20:58', '1', 'add', '156.210.111.90', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS insertUniqueOptNum;;

CREATE PROCEDURE insertUniqueOptNum(IN optnum INT,IN storeidfrom INT,IN storeidto INT,IN productid INT,IN transferproductamount DECIMAL(10,2),IN transferproductdate DATE,IN userid INT,IN conditions INT,IN `comment` TEXT,IN deloperationnum INT,IN sizeid INT,IN colorid INT,IN driverid INT,IN drivertimeout INT,IN driverdate datetime,IN delivererid INT,IN deliverdate datetime,OUT inserted_id INT,OUT optnum_used INT)
BEGIN
DECLARE n INT DEFAULT 0;
DECLARE id INT DEFAULT 0;
DECLARE lastopt INT DEFAULT 0;


DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
    ROLLBACK;
    GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
     @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
    SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
    SELECT @full_error;
    ROLLBACK;
END;



START TRANSACTION;


SELECT COUNT(*) FROM storemovement WHERE `operationnum` = optnum INTO n;
SELECT DISTINCT operationnum FROM storemovement WHERE operationnum != 0  ORDER BY operationnum DESC limit 1 INTO lastopt;
set lastopt = lastopt+1;

	IF n > 0 THEN


      INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions ,comment ,
                lastopt,
                deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),lastopt INTO inserted_id,optnum_used;
ELSE

    INSERT INTO storemovement (storeidfrom, storeidto, productid, transferproductamount, transferproductdate, userid, conditions,comment,operationnum ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate)
                VALUES (storeidfrom, storeidto, productid,transferproductamount, transferproductdate, userid, conditions ,comment
                ,optnum
                ,deloperationnum,sizeid,colorid,driverid,drivertimeout,driverdate,delivererid,deliverdate);
            SELECT LAST_INSERT_ID(),optnum INTO inserted_id,optnum_used;
	END IF;

COMMIT WORK; -- it is mandatory dont wait comit in php.as if sp didnot found comit before reaching the end it will rollback giving no errors at all

End;
;;

;
BEGIN;
CALL insertUniqueOptNum(2053,6,1,1729,20,'2024-05-22',1,0, '' ,0,0,0,0,0,'2024-05-22 22:20:58',0,'',@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6333';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 6, 1729, 0, 0
                    , 450.00, 20, 0, 0, 1, '2024-05-22 22:20:58')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-20, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2024-05-22 22:20:58' ;
UPDATE storemovement SET  buyPricesHistoryBookData = "20*2024-05-22*450.00," WHERE transferproductid = 8695;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1729', '6', '20', '1', '8695', 'تحويل منتجات من المخزن', 'storemovementController.php', '20.00', '0', '1', '2024-05-22','0','0');
UPDATE storedetail SET  productquantity = '-27', userid = '1', storedetaildate = '2024-05-22' WHERE storedetailid = '6238';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2024-05-22', 1, 1729, 0, 0
                    , 450.00, 20, 0, 0, 1, '2024-05-22 22:20:58')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2024-05-22 22:20:58' ;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1729', '1', '20', '0', '8695', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '-47.00', '-27', '1', '2024-05-22','0','0');
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:50:59";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:20:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storemovementController.php', '2024-05-22 22:20:59', '1', 'editshow', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:54:58";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:24:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 22:24:58', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:55:07";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:25:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 22:25:07', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 18:55:18";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 22:25:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 22:25:18', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:08:25";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:38:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:38:25', '3', 'addAndRetuen', '197.32.176.49', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0664e4163410a9
-- ----------------------------------------------------------------------------------------------------

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 ('2024-05-22 22:02:59', '0664e4163410a9', '1', '0.00', '0', '0', '1', '3000', '3000', '3000', '0', '8', '2024-05-22 22:38:25', '', '3', '0', 'نقدي', '8', '0', '3', '0', 'نقدي', '7' ,'0','','','','','-1','0','0','0','0','0','3000','0','','0','0','3000','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','17079', '0', '2024-05-22 22:38:25', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3000', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 17315;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('390','01593', '17079', '1', '1593', '1', '470', '470', '0', '', '1', '2024-05-22 22:38:25', '1593', '0.00', '0', '8','0','','','0','0','0','0','0','0','1','0','','17315-1,');
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
                where sellbilldetailid = 50721;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1593, '2024-05-22', 470, 390, 390
                    , 390, 390, 390, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , 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 (8, '2024-05-22', 470, 390, 390
                    , 390, 390, 390, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+470, sellCostBuyPrice =sellCostBuyPrice+390
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+390, sellCostMeanBuyPrice = sellCostMeanBuyPrice+390
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+390
                            , 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 = '8', userid = '3', storedetaildate = '2024-05-22 22:38:25' WHERE storedetailid = '5803';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1593', '8', '1', '1', '17079', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9.00', '8', '3', '2024-05-22 22:38:25','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18323;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('350','01721', '17079', '1', '1721', '1', '400', '400', '0', '', '1', '2024-05-22 22:38:25', '1721', '0.00', '0', '8','0','','','0','0','0','0','0','0','1','0','','18323-1,');
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
                where sellbilldetailid = 50722;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1721, '2024-05-22', 400, 350, 350
                    , 350, 350, 350, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+350
                            , 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 (8, '2024-05-22', 400, 350, 350
                    , 350, 350, 350, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+350
                            , 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 = '3', storedetaildate = '2024-05-22 22:38:25' WHERE storedetailid = '6232';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1721', '8', '1', '1', '17079', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14.00', '13', '3', '2024-05-22 22:38:25','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 17097;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('410','01588', '17079', '1', '1588', '1', '440', '440', '0', '', '1', '2024-05-22 22:38:25', '1588', '0.00', '0', '8','0','','','0','0','0','0','0','0','1','0','','17097-1,');
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 385.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 385.00
                where sellbilldetailid = 50723;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1588, '2024-05-22', 440, 360, 410
                    , 385, 410, 385, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , 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 (8, '2024-05-22', 440, 360, 410
                    , 385, 410, 385, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+385
                            , 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 = '22', userid = '3', storedetaildate = '2024-05-22 22:38:25' WHERE storedetailid = '5784';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1588', '8', '1', '1', '17079', 'اضافة فاتورة مبيعات', 'sellbillController.php', '23.00', '22', '3', '2024-05-22 22:38:25','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18741;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('400','01757', '17079', '1', '1757', '1', '450', '450', '0', '', '1', '2024-05-22 22:38:25', '1757', '0.00', '0', '8','0','','','0','0','0','0','0','0','1','0','','18741-1,');
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
                where sellbilldetailid = 50724;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1757, '2024-05-22', 450, 400, 400
                    , 400, 400, 400, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+400
                            , 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 (8, '2024-05-22', 450, 400, 400
                    , 400, 400, 400, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+450, sellCostBuyPrice =sellCostBuyPrice+400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+400
                            , 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 = '11', userid = '3', storedetaildate = '2024-05-22 22:38:25' WHERE storedetailid = '6308';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1757', '8', '1', '1', '17079', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12.00', '11', '3', '2024-05-22 22:38:25','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18669;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('320','01754', '17079', '1', '1754', '1', '400', '400', '0', '', '1', '2024-05-22 22:38:25', '1754', '0.00', '0', '8','0','','','0','0','0','0','0','0','1','0','','18669-1,');
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
                where sellbilldetailid = 50725;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1754, '2024-05-22', 400, 320, 320
                    , 320, 320, 320, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+320
                            , 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 (8, '2024-05-22', 400, 320, 320
                    , 320, 320, 320, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+400, sellCostBuyPrice =sellCostBuyPrice+320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+320
                            , 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 = '20', userid = '3', storedetaildate = '2024-05-22 22:38:25' WHERE storedetailid = '6300';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1754', '8', '1', '1', '17079', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21.00', '20', '3', '2024-05-22 22:38:25','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18728;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('380','01657', '17079', '1', '1657', '1', '430', '430', '0', '', '1', '2024-05-22 22:38:25', '1657', '0.00', '0', '8','0','','','0','0','0','0','0','0','1','0','','18728-1,');
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
                where sellbilldetailid = 50726;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1657, '2024-05-22', 430, 380, 380
                    , 380, 380, 380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+430, sellCostBuyPrice =sellCostBuyPrice+380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (8, '2024-05-22', 430, 380, 380
                    , 380, 380, 380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+430, sellCostBuyPrice =sellCostBuyPrice+380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '18', userid = '3', storedetaildate = '2024-05-22 22:38:25' WHERE storedetailid = '6029';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1657', '8', '1', '1', '17079', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19.00', '18', '3', '2024-05-22 22:38:25','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 17091;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('330','01521', '17079', '1', '1521', '1', '410', '410', '0', '', '1', '2024-05-22 22:38:25', '1521', '0.00', '0', '8','0','','','0','0','0','0','0','0','1','0','','17091-1,');
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 330.00, lastbuyprice_withDiscount = 330.00, meanbuyprice_withDiscount = 330.00
                where sellbilldetailid = 50727;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1521, '2024-05-22', 410, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+410, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (8, '2024-05-22', 410, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+410, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '8', userid = '3', storedetaildate = '2024-05-22 22:38:25' WHERE storedetailid = '5781';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1521', '8', '1', '1', '17079', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9.00', '8', '3', '2024-05-22 22:38:25','0','0');
UPDATE save SET  savecurrentvalue = '16990',  userid = '3' WHERE saveid = '8';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('13990.00','3000', '0', '8', 'اضافة فاتورة مبيعات', '17079', '16990', '2024-05-22 22:38:25', '3',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2024-05-22', 3000, 2530, 2580
                    , 2555, 2580, 2555, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2555
                            , 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, '2024-05-22', 3000, 2530, 2580
                    , 2555, 2580, 2555, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2555
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2555
                            , 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, 3000, 2530, 2580
                    , 2555, 2580, 2555, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3000, netSellCostBuyPrice = netSellCostBuyPrice+2530
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+2580
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+2555
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+2580
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+2555
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 0664e4163410a9 and sellbillId = 17079 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:08:25";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:38:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:38:26', '3', 'addsellBill', '197.32.176.49', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:10:23";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:40:23", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:40:23', '3', 'addAndRetuen', '197.32.176.49', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0664e49b239b2f
-- ----------------------------------------------------------------------------------------------------

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 ('2024-05-22 22:38:26', '0664e49b239b2f', '1', '0.00', '0', '0', '1', '260', '260', '260', '0', '8', '2024-05-22 22:40:23', '', '3', '0', 'نقدي', '8', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','260','0','','0','0','260','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','17080', '0', '2024-05-22 22:40:23', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '260', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18329;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('250','01671', '17080', '1', '1671', '1', '260.00', '260', '0', '', '2', '2024-05-22 22:40:23', '1671', '0.00', '0', '8','0','','','0','0','0','0','0','0','2','0','','18329-1,');
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
                where sellbilldetailid = 50728;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1671, '2024-05-22', 260, 250, 250
                    , 250, 250, 250, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+260, sellCostBuyPrice =sellCostBuyPrice+250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+250
                            , 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 (8, '2024-05-22', 260, 250, 250
                    , 250, 250, 250, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+260, sellCostBuyPrice =sellCostBuyPrice+250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+250
                            , 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 = '16', userid = '3', storedetaildate = '2024-05-22 22:40:23' WHERE storedetailid = '6235';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1671', '8', '1', '1', '17080', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17.00', '16', '3', '2024-05-22 22:40:23','0','0');
UPDATE save SET  savecurrentvalue = '17250',  userid = '3' WHERE saveid = '8';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('16990.00','260', '0', '8', 'اضافة فاتورة مبيعات', '17080', '17250', '2024-05-22 22:40:23', '3',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2024-05-22', 260, 250, 250
                    , 250, 250, 250, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+260, sellCostBuyPrice =sellCostBuyPrice+250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+250
                            , 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, '2024-05-22', 260, 250, 250
                    , 250, 250, 250, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+260, sellCostBuyPrice =sellCostBuyPrice+250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+250
                            , 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, 260, 250, 250
                    , 250, 250, 250, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+260, netSellCostBuyPrice = netSellCostBuyPrice+250
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+250
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+250
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+250
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+250
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 0664e49b239b2f and sellbillId = 17080 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:10:24";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:40:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:40:24', '3', 'addsellBill', '197.32.176.49', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:10:26";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:40:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 22:40:26', '3', '', '197.32.176.49', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:10:36";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:40:36", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:40:36', '3', 'addsellBill', '197.32.176.49', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:10:55";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:40:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:40:55', '3', 'addsellBill', '197.32.176.49', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:11:56";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:41:56", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:41:56', '3', 'addAndRetuen', '197.32.176.49', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0664e4a480234e
-- ----------------------------------------------------------------------------------------------------

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 ('2024-05-22 22:40:56', '0664e4a480234e', '1', '0.00', '0', '0', '1', '760', '760', '-760', '0', '8', '2024-05-22 22:41:56', '', '3', '0', 'نقدي','8', '0', '5', '0', 'نقدي', '2', '0', '', '','','','-1','0','0','0','','0','-760','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','5804', '0', '2024-05-22 22:41:56', '3', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '760', '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 ('350.00', '01564', '5804', '1', '1564', '1', '380.00', '380', '0', '', '0', '0', '1564', '0.00', '0','8','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
                where returnsellbilldetailid = 12563;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1564, '2024-05-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 380, 350, 350, 350
                    , 350, 350, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+380, returnSellCostBuyPrice = returnSellCostBuyPrice+350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+350
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+350
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (8, '2024-05-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 380, 350, 350, 350
                    , 350, 350, 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+380, returnSellCostBuyPrice = returnSellCostBuyPrice+350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+350
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+350
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '1', userid = '3', storedetaildate = '2024-05-22 22:41:56' WHERE storedetailid = '5777';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1564', '8', '1', '0', '5804', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0.00', '1', '3', '2024-05-22 22:41:56','0','0');
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro) VALUES ('350.00', '01561', '5804', '1', '1561', '1', '380', '380', '0', '', '0', '0', '1561', '0.00', '0','8','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
                where returnsellbilldetailid = 12564;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1561, '2024-05-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 380, 350, 350, 350
                    , 350, 350, 0, 0, 1)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+380, returnSellCostBuyPrice = returnSellCostBuyPrice+350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+350
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+350
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (8, '2024-05-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 380, 350, 350, 350
                    , 350, 350, 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+380, returnSellCostBuyPrice = returnSellCostBuyPrice+350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+350
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+350
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '1', userid = '3', storedetaildate = '2024-05-22 22:41:56' WHERE storedetailid = '5776';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1561', '8', '1', '0', '5804', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0.00', '1', '3', '2024-05-22 22:41:56','0','0');
UPDATE save SET  savecurrentvalue = '16490',  userid = '3' WHERE saveid = '8';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('17250.00','760', '1', '8', 'اضافة فاتورة مردوات مبيعات', '5804', '16490', '2024-05-22 22:41:56', '3',  'returnsellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2024-05-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 760, 700, 700, 700
                    , 700, 700, 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+760, returnSellCostBuyPrice = returnSellCostBuyPrice+700, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+700
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+700, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+700
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+700
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2024-05-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 760, 700, 700, 700
                    , 700, 700, 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+760, returnSellCostBuyPrice = returnSellCostBuyPrice+700, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+700
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+700, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+700
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+700
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -760, -700, -700
                    , -700, -700, -700, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-760, netSellCostBuyPrice = netSellCostBuyPrice+-700
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-700
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-700
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-700
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-700
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 0664e4a480234e and sellbillId = 5804 and returnsellbillId = 5804
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:11:57";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:41:57", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:41:57', '3', 'addsellBill', '197.32.176.49', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:12:01";
UPDATE user SET loginip = "197.32.176.49", lastactivetime = "2024-05-22 22:42:01", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 22:42:01', '3', '', '197.32.176.49', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:13:56";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 22:43:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 22:43:56', '7', '', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:14:07";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 22:44:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:44:08', '7', 'addsellBill', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:15:11";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 22:45:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:45:12', '7', 'addAndRetuen', '197.192.207.84', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0664e4b082d1c7
-- ----------------------------------------------------------------------------------------------------

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 ('2024-05-22 22:44:08', '0664e4b082d1c7', '1', '0.00', '0', '0', '1', '350', '350', '350', '0', '5', '2024-05-22 22:45:12', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','350','0','','0','0','350','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','17081', '0', '2024-05-22 22:45:12', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '350', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 17489;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('300','01630', '17081', '1', '1630', '1', '350', '350', '0', '', '1', '2024-05-22 22:45:12', '1630', '0.00', '0', '5','0','','','0','0','0','0','0','0','1','0','','17489-1,');
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
                where sellbilldetailid = 50729;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1630, '2024-05-22', 350, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (5, '2024-05-22', 350, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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 = '16', userid = '7', storedetaildate = '2024-05-22 22:45:12' WHERE storedetailid = '5916';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1630', '5', '1', '1', '17081', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17.00', '16', '7', '2024-05-22 22:45:12','0','0');
UPDATE save SET  savecurrentvalue = '3535',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3185.00','350', '0', '5', 'اضافة فاتورة مبيعات', '17081', '3535', '2024-05-22 22:45:12', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2024-05-22', 350, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, '2024-05-22', 350, 300, 300
                    , 300, 300, 300, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+350, sellCostBuyPrice =sellCostBuyPrice+300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+300
                            , 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, 350, 300, 300
                    , 300, 300, 300, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+350, netSellCostBuyPrice = netSellCostBuyPrice+300
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+300
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+300
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+300
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+300
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 0664e4b082d1c7 and sellbillId = 17081 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:15:13";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 22:45:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:45:13', '7', 'addsellBill', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:15:48";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 22:45:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:45:49', '7', 'addAndRetuen', '197.192.207.84', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0664e4b495c91d
-- ----------------------------------------------------------------------------------------------------

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 ('2024-05-22 22:45:13', '0664e4b495c91d', '1', '0.00', '0', '0', '1', '410', '410', '410', '0', '5', '2024-05-22 22:45:49', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','410','0','','0','0','410','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','17082', '0', '2024-05-22 22:45:49', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '410', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18572;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('330','01521', '17082', '1', '1521', '1', '410', '410', '0', '', '1', '2024-05-22 22:45:49', '1521', '0.00', '0', '5','0','','','0','0','0','0','0','0','1','0','','18572-1,');
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 330.00, lastbuyprice_withDiscount = 330.00, meanbuyprice_withDiscount = 330.00
                where sellbilldetailid = 50730;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1521, '2024-05-22', 410, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+410, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (5, '2024-05-22', 410, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+410, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '9', userid = '7', storedetaildate = '2024-05-22 22:45:49' WHERE storedetailid = '6278';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1521', '5', '1', '1', '17082', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10.00', '9', '7', '2024-05-22 22:45:49','0','0');
UPDATE save SET  savecurrentvalue = '3945',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3535.00','410', '0', '5', 'اضافة فاتورة مبيعات', '17082', '3945', '2024-05-22 22:45:49', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2024-05-22', 410, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+410, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2024-05-22', 410, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+410, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 410, 330, 330
                    , 330, 330, 330, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+410, netSellCostBuyPrice = netSellCostBuyPrice+330
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+330
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+330
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+330
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+330
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 0664e4b495c91d and sellbillId = 17082 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:15:49";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 22:45:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:45:50', '7', 'addsellBill', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:17:04";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 22:47:04", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:47:04', '7', 'addAndRetuen', '197.192.207.84', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0664e4b6e35efd
-- ----------------------------------------------------------------------------------------------------

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 ('2024-05-22 22:45:50', '0664e4b6e35efd', '1', '0.00', '0', '25', '1', '940', '915', '915', '0', '5', '2024-05-22 22:47:04', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '2' ,'0','','','','','-1','0','0','0','0','0','915','0','','0','0','915','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','17083', '0', '2024-05-22 22:47:04', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '915', '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 ('360','01645', '17083', '1', '1645', '1', '410', '410', '0', '', '1', '2024-05-22 22:47:04', '1645', '0.00', '0', '5','0','','','0','0','0','0','0','0','1','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
                where sellbilldetailid = 50731;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1645, '2024-05-22', 399.09574468085, 360, 360
                    , 360, 360, 360, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+399.09574468085, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (5, '2024-05-22', 399.09574468085, 360, 360
                    , 360, 360, 360, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+399.09574468085, sellCostBuyPrice =sellCostBuyPrice+360
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+360, sellCostMeanBuyPrice = sellCostMeanBuyPrice+360
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+360, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+360
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '3', userid = '7', storedetaildate = '2024-05-22 22:47:04' WHERE storedetailid = '5995';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1645', '5', '1', '1', '17083', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4.00', '3', '7', '2024-05-22 22:47:04','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 18877;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('450','01577', '17083', '1', '1577', '1', '530', '530', '0', '', '1', '2024-05-22 22:47:04', '1577', '0.00', '0', '5','0','','','0','0','0','0','0','0','1','0','','18877-1,');
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
                where sellbilldetailid = 50732;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1577, '2024-05-22', 515.90425531915, 450, 450
                    , 450, 450, 450, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+515.90425531915, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (5, '2024-05-22', 515.90425531915, 450, 450
                    , 450, 450, 450, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+515.90425531915, sellCostBuyPrice =sellCostBuyPrice+450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+450
                            , 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 = '34', userid = '7', storedetaildate = '2024-05-22 22:47:04' WHERE storedetailid = '5697';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1577', '5', '1', '1', '17083', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35.00', '34', '7', '2024-05-22 22:47:04','0','0');
UPDATE save SET  savecurrentvalue = '4860',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3945.00','915', '0', '5', 'اضافة فاتورة مبيعات', '17083', '4860', '2024-05-22 22:47:04', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2024-05-22', 915, 810, 810
                    , 810, 810, 810, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+915, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , 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, '2024-05-22', 915, 810, 810
                    , 810, 810, 810, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+915, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , 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, 915, 810, 810
                    , 810, 810, 810, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+915, netSellCostBuyPrice = netSellCostBuyPrice+810
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+810
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+810
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+810
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+810
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 0664e4b6e35efd and sellbillId = 17083 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:17:05";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 22:47:05", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 22:47:05', '7', 'addsellBill', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:22:06";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 22:52:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 22:52:06', '7', '', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:30:40";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:00:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:00:40', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:34:25";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:04:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellBillReportsController.php', '2024-05-22 23:04:25', '1', 'show?do=show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:34:38";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:04:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellBillReportsController.php', '2024-05-22 23:04:38', '1', 'show?do=show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:35:00";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:05:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellBillReportsController.php', '2024-05-22 23:05:00', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:36:14";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:06:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 23:06:14', '1', 'showDetail', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:36:38";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:06:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 23:06:38', '1', 'showDetail', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 3;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:52:09";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:22:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:22:09', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:52:23";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:22:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:22:23', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:54:51";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:24:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:24:51', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:54:53";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:24:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:24:53', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:54:58";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:24:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:24:58', '1', 'tempdelete', '156.210.111.90', '', 'DESKTOP');
UPDATE transfermoney SET  transfermoneydate = '2024-05-22', userid = '1', conditions = '1' WHERE transfermoneyid = '709';
UPDATE save SET  savecurrentvalue = '8253965',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8266915.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '709', '8253965', '2024-05-22 23:24:58', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '17810',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('4860.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '709', '17810', '2024-05-22 23:24:58', '1',  'transfermoneyController.php','0','');
BEGIN;
UPDATE dailyentry SET totalcreditor = '12950.00', totaldebtor = '12950.00', thedate = '2024-05-22', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2024-05-22 19:42:12', entryComment = 'اضافة تحويل من خزينة محل عبدالله الى الشيخ وليد', fromFlag = '1',related='0' WHERE id = '10305';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950.00', '12950.00', '2024-05-22', '1', '0', '10305', '2024-05-22 23:24:58','تم عكس القيد رقم 10305 ','1','0','0');
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10307', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8253965', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10307', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3102163', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:54:58";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:24:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:24:58', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:00";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:25:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:25:00', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:14";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:25:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:25:14', '1', 'delete', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8241015',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8253965.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '710', '8241015', '2024-05-22 23:25:14', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '30760',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('17810.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '710', '30760', '2024-05-22 23:25:14', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:25:14','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10308', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3089213', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10308', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8241015', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10308' , comment = '' WHERE transfermoneyid = '710';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:15";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:25:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:25:15', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:17";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:25:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:25:17', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:31";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:25:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:25:31', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:34";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:25:34", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:25:34', '7', '', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:36";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:25:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 23:25:36', '7', '', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:51";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:25:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 23:25:51', '7', 'add', '197.192.207.84', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('2', 'موفق', '', '2150', '2024-05-22', '7', '0','-1','5','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '28610',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('30760.00','2150', '1', '5', 'إضافة مصروف', '5042', '28610', '2024-05-22 23:25:51', '7',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2150', '2150', '2024-05-22', '7', '0', '0', '2024-05-22 23:25:51','اضافة اسم مصروف( موفق )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10309', '145', '2150', '','0');
UPDATE accountstree SET name = 'مرتبات', customName = 'مرتبات', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '528440', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '145';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10309', '139', '2150', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3091363', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE expenses SET expensestypeid = '2', expensesname = 'موفق', expensesdetails = '', expensesValue = '2150.00', expensesdate = '2024-05-22', userid = '7', conditions = '0',saveid = '5' , dailyentryid = '10309', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '5042';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:52";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:25:52", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 23:25:52', '7', 'sucess', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:54";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:25:54", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 23:25:54', '7', 'show', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:55:57";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:25:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 23:25:57', '7', '', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:05";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:26:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:26:05', '1', 'add', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('5','9', '13100', '2024-05-22', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '15510',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('28610.00','13100', '1', '5', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '711', '15510', '2024-05-22 23:26:05', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '8254115',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8241015.00','13100', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل عبدالله ] ', '711', '8254115', '2024-05-22 23:26:05', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '13100', '13100', '2024-05-22', '1', '0', '0', '2024-05-22 23:26:05','اضافة تحويل من خزينة محل عبدالله الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10310', '156', '13100', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8254115', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10310', '139', '13100', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3104463', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE transfermoney SET saveidfrom = '5', saveidto = '9', transfermoneyvalue = '13100.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '0' , dailyentryid = '10310' , comment = '' WHERE transfermoneyid = '711';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:06";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:26:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:26:06', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:08";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:26:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:26:08', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:11";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:26:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 23:26:11', '7', 'add', '197.192.207.84', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('2', 'عماد مرتب اسبوع', '', '800', '2024-05-22', '7', '0','-1','5','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '14710',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('15510.00','800', '1', '5', 'إضافة مصروف', '5043', '14710', '2024-05-22 23:26:11', '7',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '800', '800', '2024-05-22', '7', '0', '0', '2024-05-22 23:26:11','اضافة اسم مصروف( عماد مرتب اسبوع )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10311', '145', '800', '','0');
UPDATE accountstree SET name = 'مرتبات', customName = 'مرتبات', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '529240', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '145';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10311', '139', '800', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3105263', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE expenses SET expensestypeid = '2', expensesname = 'عماد مرتب اسبوع', expensesdetails = '', expensesValue = '800.00', expensesdate = '2024-05-22', userid = '7', conditions = '0',saveid = '5' , dailyentryid = '10311', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '5043';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:12";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:26:12", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 23:26:12', '7', 'sucess', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:14";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:26:14", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2024-05-22 23:26:14', '7', 'show', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:20";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:26:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 23:26:21', '7', 'addsellBill', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:26";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:26:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:26:26', '7', '', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:34";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:26:34", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:26:34', '7', 'showDetail', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:58";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:26:58", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:26:58', '7', '', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:56:59";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:26:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:26:59', '7', '', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:57:15";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:27:15", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:27:15', '7', 'showDetail', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:57:18";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:27:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2024-05-22 23:27:18', '7', 'addsellBill', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:57:20";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:27:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:27:20', '7', '', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:57:23";
UPDATE user SET loginip = "197.192.207.84", lastactivetime = "2024-05-22 23:27:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:27:23', '7', 'showDetail', '197.192.207.84', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:57:39";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:27:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:27:40', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 19:58:24";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:28:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:28:24', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:01:48";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:31:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:31:48', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:03:33";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:33:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:33:33', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:05:15";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:35:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:35:15', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:05:18";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:35:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:35:18', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:05:37";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:35:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:35:37', '1', 'delete', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8241165',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8254115.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '712', '8241165', '2024-05-22 23:35:37', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '27660',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('14710.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '712', '27660', '2024-05-22 23:35:37', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:35:37','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10312', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3092313', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10312', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8241165', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10312' , comment = '' WHERE transfermoneyid = '712';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:05:38";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:35:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:35:38', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:05:41";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:35:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:35:41', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:05:54";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:35:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:35:54', '1', 'delete', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8228215',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8241165.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '713', '8228215', '2024-05-22 23:35:54', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '40610',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('27660.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '713', '40610', '2024-05-22 23:35:54', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:35:54','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10313', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3079363', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10313', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8228215', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10313' , comment = '' WHERE transfermoneyid = '713';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:05:54";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:35:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:35:54', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:05:56";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:35:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:35:56', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:06:01";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:36:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:36:01', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:06:14";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:36:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:36:15', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:06:35";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:36:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:36:35', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:06:56";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:36:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 23:36:56', '1', '', '156.210.111.90', '', '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 < "2024-05-22 20:06:56";
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 < "2024-05-22 20:07:06";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:37:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:37:06', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:07:15";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:37:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:37:15', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:07:25";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:37:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:37:26', '1', 'edit', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:07:54";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:37:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:37:54', '1', 'update', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8215265',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8228215.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '714', '8215265', '2024-05-22 23:37:54', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '53560',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('40610.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '714', '53560', '2024-05-22 23:37:54', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:37:54','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10314', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3066413', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10314', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8215265', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10314' , comment = '' WHERE transfermoneyid = '714';
COMMIT;
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('5','9', '0', '2024-05-22', '1', '0', '0','');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:07:55";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:37:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:37:55', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:07:57";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:37:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:37:57', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:08:06";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:38:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:38:06', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:08:20";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:38:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:38:20', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:08:22";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:38:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:38:22', '1', 'edit', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:08:49";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:38:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:38:49', '1', 'update', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8202315',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8215265.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '716', '8202315', '2024-05-22 23:38:49', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '66510',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('53560.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '716', '66510', '2024-05-22 23:38:49', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:38:49','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10315', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3053463', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10315', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8202315', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10315' , comment = '' WHERE transfermoneyid = '716';
COMMIT;
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('5','9', '51725', '2024-05-22', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '14785',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('66510.00','51725', '1', '5', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '717', '14785', '2024-05-22 23:38:49', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '8254040',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8202315.00','51725', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل عبدالله ] ', '717', '8254040', '2024-05-22 23:38:49', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '51725', '51725', '2024-05-22', '1', '0', '0', '2024-05-22 23:38:49','اضافة تحويل من خزينة محل عبدالله الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10316', '156', '51725', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8254040', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10316', '139', '51725', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3105188', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE transfermoney SET saveidfrom = '5', saveidto = '9', transfermoneyvalue = '51725.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '0' , dailyentryid = '10316' , comment = '' WHERE transfermoneyid = '717';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:08:49";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:38:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:38:49', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:08:51";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:38:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:38:51', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:09:07";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:39:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:39:07', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:09:26";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:39:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:39:26', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:09:36";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:39:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:39:36', '1', 'edit', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:10:15";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:40:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:40:15', '1', 'update', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8241090',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8254040.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '718', '8241090', '2024-05-22 23:40:15', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '27735',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('14785.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '718', '27735', '2024-05-22 23:40:15', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:40:15','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10317', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3092238', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10317', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8241090', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10317' , comment = '' WHERE transfermoneyid = '718';
COMMIT;
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('5','9', '12950', '2024-05-22', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '14785',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('27735.00','12950', '1', '5', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '719', '14785', '2024-05-22 23:40:15', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '8254040',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8241090.00','12950', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل عبدالله ] ', '719', '8254040', '2024-05-22 23:40:15', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:40:15','اضافة تحويل من خزينة محل عبدالله الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10318', '156', '12950', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8254040', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10318', '139', '12950', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3105188', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE transfermoney SET saveidfrom = '5', saveidto = '9', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '0' , dailyentryid = '10318' , comment = '' WHERE transfermoneyid = '719';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:10:15";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:40:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:40:15', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:10:17";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:40:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:40:17', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:10:23";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:40:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:40:23', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:10:49";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:40:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:40:49', '1', 'add', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('5','9', '12950', '2024-05-22', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '1835',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('14785.00','12950', '1', '5', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '720', '1835', '2024-05-22 23:40:49', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '8266990',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8254040.00','12950', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل عبدالله ] ', '720', '8266990', '2024-05-22 23:40:49', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:40:49','اضافة تحويل من خزينة محل عبدالله الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10319', '156', '12950', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8266990', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10319', '139', '12950', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3118138', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE transfermoney SET saveidfrom = '5', saveidto = '9', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '0' , dailyentryid = '10319' , comment = '' WHERE transfermoneyid = '720';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:10:50";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:40:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:40:50', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:10:52";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:40:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:40:52', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:11:00";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:41:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:41:00', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:11:51";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:41:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 23:41:51', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:12:07";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:42:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 23:42:07', '1', 'add', '156.210.111.90', '', 'DESKTOP');
INSERT INTO impotencetreatmentsuppliersave (typesimpotencetreatmentid, saveid, supplierid, impotencetreatmentsuppliersavetype, impotencetreatmentsuppliersavebefore, impotencetreatmentsuppliersavetamount, impotencetreatmentsuppliersaveafter, impotencetreatmentsuppliersavecomment, conditions, impotencetreatmentsuppliersavedate, userid, tablename) VALUES ('-1', '5', '-1', '0', '1835.00', '70', '1905', '', '0', '2024-05-22 23:42:07', '1', 'settlementsaveController.php');
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor) VALUES ('-1', '', '70', '1', ' خصم معالجة عجز  / ', '569', '-70', '2024-05-22', '1', 'supplierPayedDeptController.php', '', '0','5', '0','1','1','70','1');
UPDATE supplier SET  suppliercurrentDebt = '-70', userid = '1', supplierdate = '2024-05-22'   WHERE supplierid = '-1';
UPDATE supplierdebtchange SET supplierid = '-1', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '70.00', supplierdebtchangetype = '1', processname = ' خصم معالجة عجز  / ', supplierdebtchangemodelid = '569', supplierdebtchangeafter = '-70.00', supplierdebtchangedate = '2024-05-22 00:00:00', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '5',currencyId='1',conversionFactor='1',payedInCurrency='70',saveConversionFactor='1' WHERE supplierdebtchangeid = '944';
UPDATE save SET  savecurrentvalue = '1905',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('1835.00','70', '0', '5', 'تسوية خزنة بالإضافة', '-1', '1905', '2024-05-22 23:42:08', '1',  'settlementsaveController.php','0','');
UPDATE savedaily SET  savedailymodelid = '28362' WHERE savedailyid = '28362';
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '70', '70', '2024-05-22', '1', '0', '0', '2024-05-22 23:42:08','اضافة معالجة عجز ( بالاضافة )','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10320', '139', '70', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3118068', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10320', '27', '70', '','0');
UPDATE accountstree SET name = 'معالجة عجز خزنة', customName = 'معالجة عجز خزنة', parent = '3', itemtype = '0', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-06-15', itemtype2 = '1', theValue = '-133205', theOrder = '0', layingOrder = '35',reportid = '1' WHERE id = '27';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:12:08";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:42:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 23:42:08', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:12:10";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:42:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 23:42:10', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:00";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:00', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:17";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:17', '1', 'tempdelete', '156.210.111.90', '', 'DESKTOP');
UPDATE transfermoney SET  transfermoneydate = '2024-05-22', userid = '1', conditions = '1' WHERE transfermoneyid = '720';
UPDATE save SET  savecurrentvalue = '8254040',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8266990.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '720', '8254040', '2024-05-22 23:44:17', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '14855',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('1905.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '720', '14855', '2024-05-22 23:44:17', '1',  'transfermoneyController.php','0','');
BEGIN;
UPDATE dailyentry SET totalcreditor = '12950.00', totaldebtor = '12950.00', thedate = '2024-05-22', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2024-05-22 23:40:49', entryComment = 'اضافة تحويل من خزينة محل عبدالله الى الشيخ وليد', fromFlag = '1',related='0' WHERE id = '10319';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950.00', '12950.00', '2024-05-22', '1', '0', '10319', '2024-05-22 23:44:17','تم عكس القيد رقم 10319 ','1','0','0');
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10321', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8254040', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10321', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3105118', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:18";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:18', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:20";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:20', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:24";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:24', '1', 'delete', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8241090',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8254040.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '721', '8241090', '2024-05-22 23:44:24', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '27805',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('14855.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '721', '27805', '2024-05-22 23:44:24', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:44:24','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10322', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3092168', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10322', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8241090', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10322' , comment = '' WHERE transfermoneyid = '721';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:24";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:24', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:26";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:26', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:37";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:37', '1', 'delete', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8228140',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8241090.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '722', '8228140', '2024-05-22 23:44:37', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '40755',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('27805.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '722', '40755', '2024-05-22 23:44:37', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:44:37','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10323', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3079218', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10323', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8228140', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10323' , comment = '' WHERE transfermoneyid = '722';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:37";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:37', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:39";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:39', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:46";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:46', '1', 'delete', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8215190',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8228140.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '723', '8215190', '2024-05-22 23:44:46', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '53705',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('40755.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '723', '53705', '2024-05-22 23:44:46', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:44:46','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10324', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3066268', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10324', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8215190', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10324' , comment = '' WHERE transfermoneyid = '723';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:46";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:46', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:48";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:48', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:57";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:57', '1', 'delete', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('9','5', '12950.00', '2024-05-22', '1', '2', '0','');
UPDATE save SET  savecurrentvalue = '8202240',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8215190.00','12950.00', '1', '9', 'تحويل امول الى الخزنة  [ خزينة محل عبدالله ] ', '724', '8202240', '2024-05-22 23:44:57', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '66655',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('53705.00','12950.00', '0', '5', 'تحويل امول من الخزنة  [ الشيخ وليد ] ', '724', '66655', '2024-05-22 23:44:57', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '12950', '12950', '2024-05-22', '1', '0', '0', '2024-05-22 23:44:57','اضافة تحويل من الشيخ وليد الى خزينة محل عبدالله','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10325', '139', '12950.00', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3053318', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10325', '156', '12950.00', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8202240', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
UPDATE transfermoney SET saveidfrom = '9', saveidto = '5', transfermoneyvalue = '12950.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '2' , dailyentryid = '10325' , comment = '' WHERE transfermoneyid = '724';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:57";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:57', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:14:59";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:44:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:44:59', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:15:06";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:45:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:45:07', '1', 'edit', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:15:42";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:45:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:45:42', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:16:46";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:46:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:46:46', '1', 'add', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('5','9', '64820', '2024-05-22', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '1835',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('66655.00','64820', '1', '5', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '725', '1835', '2024-05-22 23:46:46', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '8267060',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8202240.00','64820', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل عبدالله ] ', '725', '8267060', '2024-05-22 23:46:46', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '64820', '64820', '2024-05-22', '1', '0', '0', '2024-05-22 23:46:46','اضافة تحويل من خزينة محل عبدالله الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10326', '156', '64820', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8267060', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10326', '139', '64820', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3118138', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE transfermoney SET saveidfrom = '5', saveidto = '9', transfermoneyvalue = '64820.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '0' , dailyentryid = '10326' , comment = '' WHERE transfermoneyid = '725';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:16:47";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:46:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:46:47', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:16:49";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:46:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:46:49', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:16:56";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:46:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:46:57', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:17:14";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:47:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 23:47:14', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:17:23";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:47:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 23:47:24', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:17:36";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:47:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 23:47:37', '1', 'add', '156.210.111.90', '', 'DESKTOP');
INSERT INTO impotencetreatmentsuppliersave (typesimpotencetreatmentid, saveid, supplierid, impotencetreatmentsuppliersavetype, impotencetreatmentsuppliersavebefore, impotencetreatmentsuppliersavetamount, impotencetreatmentsuppliersaveafter, impotencetreatmentsuppliersavecomment, conditions, impotencetreatmentsuppliersavedate, userid, tablename) VALUES ('-1', '5', '-1', '0', '1835.00', '70', '1905', '', '0', '2024-05-22 23:47:37', '1', 'settlementsaveController.php');
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor) VALUES ('-1', '', '70', '1', ' خصم معالجة عجز  / ', '570', '-70', '2024-05-22', '1', 'supplierPayedDeptController.php', '', '0','5', '0','1','1','70','1');
UPDATE supplier SET  suppliercurrentDebt = '-70', userid = '1', supplierdate = '2024-05-22'   WHERE supplierid = '-1';
UPDATE supplierdebtchange SET supplierid = '-1', supplierdebtchangebefore = '0.00', supplierdebtchangeamount = '70.00', supplierdebtchangetype = '1', processname = ' خصم معالجة عجز  / ', supplierdebtchangemodelid = '570', supplierdebtchangeafter = '-70.00', supplierdebtchangedate = '2024-05-22 00:00:00', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '5',currencyId='1',conversionFactor='1',payedInCurrency='70',saveConversionFactor='1' WHERE supplierdebtchangeid = '945';
UPDATE save SET  savecurrentvalue = '1905',  userid = '1' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('1835.00','70', '0', '5', 'تسوية خزنة بالإضافة', '-1', '1905', '2024-05-22 23:47:37', '1',  'settlementsaveController.php','0','');
UPDATE savedaily SET  savedailymodelid = '28375' WHERE savedailyid = '28375';
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '70', '70', '2024-05-22', '1', '0', '0', '2024-05-22 23:47:37','اضافة معالجة عجز ( بالاضافة )','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10327', '139', '70', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-3118068', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10327', '27', '70', '','0');
UPDATE accountstree SET name = 'معالجة عجز خزنة', customName = 'معالجة عجز خزنة', parent = '3', itemtype = '0', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-06-15', itemtype2 = '1', theValue = '-133275', theOrder = '0', layingOrder = '35',reportid = '1' WHERE id = '27';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:17:37";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:47:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 23:47:37', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:17:39";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:47:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementsaveController.php', '2024-05-22 23:47:40', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:17:46";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:47:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:47:46', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:17:57";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:47:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:47:57', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:18:10";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:48:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:48:10', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:19:44";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:49:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:49:45', '1', 'editprint', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:20:08";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:50:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:50:09', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:20:46";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:50:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:50:46', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:21:24";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:51:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:51:24', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:22:03";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:52:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:52:03', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:22:04";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:52:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:52:04', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:22:14";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:52:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:52:14', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:24:07";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:54:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:54:07', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:24:08";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:54:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:54:08', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:24:23";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:54:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2024-05-22 23:54:23', '1', '', '156.210.111.90', '', '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 < "2024-05-22 20:24:23";
DROP PROCEDURE IF EXISTS clientInUse;;

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

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

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:24:28";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:54:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:54:28', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:25:03";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:55:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:55:03', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:28:18";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:58:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:58:18', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:28:55";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:58:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:58:55', '1', 'add', '156.210.111.90', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('8','9', '16090', '2024-05-22', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '400',  userid = '1' WHERE saveid = '8';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('16490.00','16090', '1', '8', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '726', '400', '2024-05-22 23:58:55', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '8283150',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('8267060.00','16090', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل ابو كريم ] ', '726', '8283150', '2024-05-22 23:58:55', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '16090', '16090', '2024-05-22', '1', '0', '0', '2024-05-22 23:58:55','اضافة تحويل من خزينة محل ابو كريم الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10328', '156', '16090', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '8283150', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('10328', '142', '16090', '','0');
UPDATE accountstree SET name = 'خزينة محل ابو كريم', customName = 'خزينة محل ابو كريم', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-2629091', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '142';
UPDATE transfermoney SET saveidfrom = '8', saveidto = '9', transfermoneyvalue = '16090.00', transfermoneydate = '2024-05-22', userid = '1', conditions = '0' , dailyentryid = '10328' , comment = '' WHERE transfermoneyid = '726';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:28:56";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:58:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:58:56', '1', 'sucess', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:28:57";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:58:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2024-05-22 23:58:58', '1', 'show', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:29:01";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:59:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:59:01', '1', '', '156.210.111.90', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2024-05-22 20:29:11";
UPDATE user SET loginip = "156.210.111.90", lastactivetime = "2024-05-22 23:59:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2024-05-22 23:59:11', '1', 'show', '156.210.111.90', '', 'DESKTOP');
