2024-08-12 17:59:58.974091
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 17:59:58.980274
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 17:59:58.981757
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 17:59:58.999122
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 17:59:59.24539
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 17:59:59.27750
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='I_OWE_YOU'

2024-08-12 17:59:59.30831
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='PETTY_CASH'

2024-08-12 17:59:59.49231
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.68311
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '1970-01-01' 
                    AND iou.tran_date <= '2022-11-22'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 17:59:59.71525
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '674'

2024-08-12 17:59:59.74516
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.124759
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '686'

2024-08-12 17:59:59.127025
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.156771
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '758'

2024-08-12 17:59:59.159073
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.188647
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '796'

2024-08-12 17:59:59.190946
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.220531
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '872'

2024-08-12 17:59:59.223496
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.242879
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '873'

2024-08-12 17:59:59.245697
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.276141
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '875'

2024-08-12 17:59:59.289246
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.325028
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '876'

2024-08-12 17:59:59.327426
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.358107
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '877'

2024-08-12 17:59:59.362106
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.393141
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '878'

2024-08-12 17:59:59.418943
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.453626
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '879'

2024-08-12 17:59:59.456146
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.485899
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '896'

2024-08-12 17:59:59.488200
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.517874
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='1970-01-01' AND pet.tran_date <='2022-11-22' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 17:59:59.520924
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.539671
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '2022-11-23' 
                    AND iou.tran_date <= '2022-11-30'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 17:59:59.542729
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '874'

2024-08-12 17:59:59.544852
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.575593
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '884'

2024-08-12 17:59:59.595974
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.630984
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '886'

2024-08-12 17:59:59.633332
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 17:59:59.698977
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='2022-11-23' AND pet.tran_date <='2022-11-30' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:00:20.872286
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 18:00:20.875898
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 18:00:20.877316
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 18:00:20.898987
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 18:00:20.901253
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 18:00:20.911034
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='I_OWE_YOU'

2024-08-12 18:00:20.916738
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='PETTY_CASH'

2024-08-12 18:00:20.919055
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:20.939266
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '1970-01-01' 
                    AND iou.tran_date <= '2022-11-22'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:00:20.943099
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '674'

2024-08-12 18:00:20.945251
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:20.989623
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '686'

2024-08-12 18:00:20.992521
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:21.42788
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '758'

2024-08-12 18:00:21.64532
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:21.124110
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '796'

2024-08-12 18:00:21.127139
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:21.158622
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '872'

2024-08-12 18:00:21.161520
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:21.183918
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '873'

2024-08-12 18:00:21.194277
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:21.238036
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '875'

2024-08-12 18:00:21.240444
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:21.275973
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '876'

2024-08-12 18:00:21.280560
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:21.317160
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '877'

2024-08-12 18:00:21.321902
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:00:28.174785
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '878'

2024-08-12 18:00:29.909063
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:36.937979
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '879'

2024-08-12 18:03:36.953575
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:37.50866
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '896'

2024-08-12 18:03:37.52901
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:37.109326
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='1970-01-01' AND pet.tran_date <='2022-11-22' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:03:37.155740
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:37.175108
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '2022-11-23' 
                    AND iou.tran_date <= '2022-11-30'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:03:37.178180
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '874'

2024-08-12 18:03:37.180099
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:37.218510
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '884'

2024-08-12 18:03:37.220610
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:37.256454
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '886'

2024-08-12 18:03:37.258538
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:37.289755
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='2022-11-23' AND pet.tran_date <='2022-11-30' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:03:47.891315
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 18:03:47.899138
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 18:03:47.900788
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 18:03:47.917171
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 18:03:47.922390
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 18:03:47.925047
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='I_OWE_YOU'

2024-08-12 18:03:47.929011
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='PETTY_CASH'

2024-08-12 18:03:47.931597
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:47.962356
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '1970-01-01' 
                    AND iou.tran_date <= '2022-11-22'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:03:47.967440
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '674'

2024-08-12 18:03:47.971274
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:48.24181
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '686'

2024-08-12 18:03:48.26511
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:48.59032
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '758'

2024-08-12 18:03:48.74071
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:48.119169
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '796'

2024-08-12 18:03:48.125173
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:48.157853
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '872'

2024-08-12 18:03:48.160586
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:48.180732
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '873'

2024-08-12 18:03:48.184107
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:48.215838
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '875'

2024-08-12 18:03:48.218108
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:48.249813
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '876'

2024-08-12 18:03:48.252493
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:48.283451
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '877'

2024-08-12 18:03:48.286714
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:03:52.95868
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '878'

2024-08-12 18:03:52.800674
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:23.338500
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '879'

2024-08-12 18:10:23.344457
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:23.482871
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '896'

2024-08-12 18:10:23.485659
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2022-11-22'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:23.516391
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='1970-01-01' AND pet.tran_date <='2022-11-22' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:10:23.530804
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:23.550677
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '2022-11-23' 
                    AND iou.tran_date <= '2022-11-30'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:10:23.554029
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '874'

2024-08-12 18:10:23.556204
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:23.587137
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '884'

2024-08-12 18:10:23.589679
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:23.624258
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '886'

2024-08-12 18:10:23.627435
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2022-11-23' 
                AND iou.tran_date <= '2022-11-30'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:23.660393
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='2022-11-23' AND pet.tran_date <='2022-11-30' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:10:24.140936
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 18:10:24.144567
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 18:10:24.145881
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 18:10:24.164695
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 18:10:24.167737
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 18:10:33.413872
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 18:10:33.415758
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 18:10:33.417250
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 18:10:33.430069
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 18:10:33.432300
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 18:10:33.864416
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 18:10:33.866396
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 18:10:33.867753
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 18:10:33.880589
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 18:10:33.882773
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 18:10:33.885282
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='I_OWE_YOU'

2024-08-12 18:10:33.890673
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='PETTY_CASH'

2024-08-12 18:10:33.892645
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:33.911976
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '1970-01-01' 
                    AND iou.tran_date <= '2023-12-31'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:10:33.915898
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '674'

2024-08-12 18:10:33.919145
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:33.953032
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '686'

2024-08-12 18:10:33.955256
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:33.985215
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '758'

2024-08-12 18:10:33.987692
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:34.18484
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '796'

2024-08-12 18:10:34.21128
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:34.51424
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '872'

2024-08-12 18:10:34.54646
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:34.74205
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '873'

2024-08-12 18:10:34.76657
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:34.106681
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '874'

2024-08-12 18:10:34.109495
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:34.148384
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '875'

2024-08-12 18:10:34.159931
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:34.204153
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '876'

2024-08-12 18:10:34.214936
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:34.246848
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '877'

2024-08-12 18:10:34.249091
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:38.732259
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '878'

2024-08-12 18:10:38.760021
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:38.810468
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '879'

2024-08-12 18:10:38.822397
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:38.854849
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '884'

2024-08-12 18:10:38.856881
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:38.890288
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '886'

2024-08-12 18:10:38.892365
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:38.922945
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '896'

2024-08-12 18:10:38.944049
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:38.994868
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '903'

2024-08-12 18:10:38.998012
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.29078
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '935'

2024-08-12 18:10:39.68631
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.113588
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '936'

2024-08-12 18:10:39.123043
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.159081
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '951'

2024-08-12 18:10:39.173879
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.210182
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '952'

2024-08-12 18:10:39.216151
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.246679
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '954'

2024-08-12 18:10:39.249609
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.279915
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '968'

2024-08-12 18:10:39.305306
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.348404
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '986'

2024-08-12 18:10:39.366267
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.408172
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1000'

2024-08-12 18:10:39.411024
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.455212
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1019'

2024-08-12 18:10:39.458394
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.489093
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1025'

2024-08-12 18:10:39.492092
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.522751
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1032'

2024-08-12 18:10:39.525171
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.556827
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1035'

2024-08-12 18:10:39.559152
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.590915
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1065'

2024-08-12 18:10:39.593720
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.623977
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1066'

2024-08-12 18:10:39.626222
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.662839
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1073'

2024-08-12 18:10:39.665095
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.695110
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1093'

2024-08-12 18:10:39.699097
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.743670
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1132'

2024-08-12 18:10:39.746172
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.776279
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1139'

2024-08-12 18:10:39.778608
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.809408
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1152'

2024-08-12 18:10:39.812266
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.844021
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1154'

2024-08-12 18:10:39.847062
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.878256
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1163'

2024-08-12 18:10:39.880490
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.910980
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1179'

2024-08-12 18:10:39.913674
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.946430
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1211'

2024-08-12 18:10:39.963706
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:39.999290
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1212'

2024-08-12 18:10:40.2913
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.33811
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1218'

2024-08-12 18:10:40.36835
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.112903
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1236'

2024-08-12 18:10:40.133385
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.165052
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1237'

2024-08-12 18:10:40.180497
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.235215
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1238'

2024-08-12 18:10:40.237764
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.288805
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1239'

2024-08-12 18:10:40.340457
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.434831
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1247'

2024-08-12 18:10:40.437410
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.471958
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1269'

2024-08-12 18:10:40.482240
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.520290
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1270'

2024-08-12 18:10:40.524877
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.558037
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1285'

2024-08-12 18:10:40.567122
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.605639
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1304'

2024-08-12 18:10:40.610285
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.655113
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1305'

2024-08-12 18:10:40.658719
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.689107
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1328'

2024-08-12 18:10:40.696049
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.758398
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1329'

2024-08-12 18:10:40.760645
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.803368
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1368'

2024-08-12 18:10:40.806362
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.844077
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1385'

2024-08-12 18:10:40.856539
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.894388
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1413'

2024-08-12 18:10:40.897080
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:40.931378
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1428'

2024-08-12 18:10:40.934274
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.426
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1429'

2024-08-12 18:10:41.3350
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.47171
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1438'

2024-08-12 18:10:41.49611
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.84887
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1443'

2024-08-12 18:10:41.87613
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.127839
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1446'

2024-08-12 18:10:41.134221
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.170646
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1455'

2024-08-12 18:10:41.181142
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.219270
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1461'

2024-08-12 18:10:41.221405
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.256285
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1471'

2024-08-12 18:10:41.258768
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.307702
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1474'

2024-08-12 18:10:41.316914
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.350485
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1492'

2024-08-12 18:10:41.359450
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.392697
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1498'

2024-08-12 18:10:41.394858
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.429356
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1517'

2024-08-12 18:10:41.431512
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.465593
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1526'

2024-08-12 18:10:41.477512
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.509885
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1540'

2024-08-12 18:10:41.521543
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.552573
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1547'

2024-08-12 18:10:41.555459
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.588602
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1554'

2024-08-12 18:10:41.600215
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.631693
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1560'

2024-08-12 18:10:41.643224
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.676991
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1562'

2024-08-12 18:10:41.688864
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.729776
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1582'

2024-08-12 18:10:41.732462
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.767264
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1583'

2024-08-12 18:10:41.770066
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.801680
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1615'

2024-08-12 18:10:41.811902
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.845879
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1616'

2024-08-12 18:10:41.855869
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.887178
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1625'

2024-08-12 18:10:41.893841
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.935501
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1631'

2024-08-12 18:10:41.938110
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:41.970220
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1632'

2024-08-12 18:10:41.973295
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.12399
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1659'

2024-08-12 18:10:42.22633
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.62274
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1673'

2024-08-12 18:10:42.73399
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.106028
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1678'

2024-08-12 18:10:42.108602
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.140950
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1690'

2024-08-12 18:10:42.143476
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.188087
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1695'

2024-08-12 18:10:42.191244
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.234977
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1702'

2024-08-12 18:10:42.237446
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.278384
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1711'

2024-08-12 18:10:42.289639
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.321266
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1712'

2024-08-12 18:10:42.325912
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.366681
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1728'

2024-08-12 18:10:42.374488
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.406017
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1733'

2024-08-12 18:10:42.409151
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.456765
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1734'

2024-08-12 18:10:42.458887
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.491138
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1747'

2024-08-12 18:10:42.497509
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.537412
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1753'

2024-08-12 18:10:42.547913
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.599154
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1754'

2024-08-12 18:10:42.602289
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.642588
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1763'

2024-08-12 18:10:42.723262
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.790200
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1767'

2024-08-12 18:10:42.869833
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:42.963842
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1775'

2024-08-12 18:10:42.966669
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.77814
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1777'

2024-08-12 18:10:43.80033
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.111827
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1778'

2024-08-12 18:10:43.113975
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.146583
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1781'

2024-08-12 18:10:43.152314
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.220920
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1793'

2024-08-12 18:10:43.223258
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.243820
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1795'

2024-08-12 18:10:43.246299
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.281292
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1796'

2024-08-12 18:10:43.283604
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.320137
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1808'

2024-08-12 18:10:43.347460
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.392825
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1809'

2024-08-12 18:10:43.402120
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.688552
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1830'

2024-08-12 18:10:43.712735
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.833304
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1842'

2024-08-12 18:10:43.839679
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.872925
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1846'

2024-08-12 18:10:43.875182
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.906789
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1854'

2024-08-12 18:10:43.908949
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:43.940556
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1866'

2024-08-12 18:10:43.962248
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.13174
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1883'

2024-08-12 18:10:44.17040
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.48477
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1900'

2024-08-12 18:10:44.63092
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.120652
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1902'

2024-08-12 18:10:44.129839
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.162123
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1918'

2024-08-12 18:10:44.165825
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.211547
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1930'

2024-08-12 18:10:44.213939
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.259686
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1936'

2024-08-12 18:10:44.265303
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.307201
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1952'

2024-08-12 18:10:44.321150
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.355692
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1969'

2024-08-12 18:10:44.380361
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.414125
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1993'

2024-08-12 18:10:44.423265
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.464893
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2022'

2024-08-12 18:10:44.467232
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.500650
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2025'

2024-08-12 18:10:44.520047
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.559852
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2057'

2024-08-12 18:10:44.585871
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.621896
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2098'

2024-08-12 18:10:44.634144
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.678067
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2099'

2024-08-12 18:10:44.682343
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.726548
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2321'

2024-08-12 18:10:44.731403
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.764931
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='1970-01-01' AND pet.tran_date <='2023-12-31' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:10:44.779524
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.824499
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '2024-01-01' 
                    AND iou.tran_date <= '2024-08-12'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:10:44.832708
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2089'

2024-08-12 18:10:44.836151
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.875257
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2107'

2024-08-12 18:10:44.881705
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.918095
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2114'

2024-08-12 18:10:44.921707
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:44.957981
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2127'

2024-08-12 18:10:44.963503
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:45.29189
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2141'

2024-08-12 18:10:45.146463
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:45.263109
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2156'

2024-08-12 18:10:45.285089
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:45.343218
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2158'

2024-08-12 18:10:45.358456
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:45.401421
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2160'

2024-08-12 18:10:45.407381
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:45.463994
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2171'

2024-08-12 18:10:45.485500
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:45.524895
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2179'

2024-08-12 18:10:45.535686
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:45.585173
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2204'

2024-08-12 18:10:45.619609
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:45.663014
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2208'

2024-08-12 18:10:45.674195
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:45.944922
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2240'

2024-08-12 18:10:46.34537
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.94787
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2266'

2024-08-12 18:10:46.163662
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.219442
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2267'

2024-08-12 18:10:46.222935
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.266673
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2268'

2024-08-12 18:10:46.269363
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.305592
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2269'

2024-08-12 18:10:46.308282
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.342397
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2288'

2024-08-12 18:10:46.344681
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.384375
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2289'

2024-08-12 18:10:46.386865
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.420571
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2295'

2024-08-12 18:10:46.422730
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.458298
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2304'

2024-08-12 18:10:46.467472
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.515338
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2320'

2024-08-12 18:10:46.517746
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.553553
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2339'

2024-08-12 18:10:46.562714
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.608748
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2340'

2024-08-12 18:10:46.617251
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.665069
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2360'

2024-08-12 18:10:46.679539
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.719919
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2365'

2024-08-12 18:10:46.722345
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.757413
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2375'

2024-08-12 18:10:46.771330
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.805734
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2377'

2024-08-12 18:10:46.820497
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.866665
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2378'

2024-08-12 18:10:46.893228
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:46.945682
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2387'

2024-08-12 18:10:46.959425
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.26354
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2393'

2024-08-12 18:10:47.90885
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.133928
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2396'

2024-08-12 18:10:47.144194
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.300679
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2411'

2024-08-12 18:10:47.303461
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.350163
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2412'

2024-08-12 18:10:47.363022
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.428202
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2420'

2024-08-12 18:10:47.435272
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.592269
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2438'

2024-08-12 18:10:47.597902
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.637462
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2440'

2024-08-12 18:10:47.639670
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.675868
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2441'

2024-08-12 18:10:47.679162
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.742317
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2452'

2024-08-12 18:10:47.757669
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.810868
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2464'

2024-08-12 18:10:47.815277
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.868621
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2473'

2024-08-12 18:10:47.874937
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.921325
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2476'

2024-08-12 18:10:47.924776
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:47.960132
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2517'

2024-08-12 18:10:47.962323
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:48.2519
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2524'

2024-08-12 18:10:48.4883
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:48.39885
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='2024-01-01' AND pet.tran_date <='2024-08-12' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:10:48.634629
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 18:10:48.638727
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 18:10:48.640222
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 18:10:48.653267
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 18:10:48.655670
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 18:10:48.658266
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='I_OWE_YOU'

2024-08-12 18:10:48.659630
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='PETTY_CASH'

2024-08-12 18:10:48.661744
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:48.681848
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '1970-01-01' 
                    AND iou.tran_date <= '2023-12-31'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:10:48.685219
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '674'

2024-08-12 18:10:48.698731
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:48.992955
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '686'

2024-08-12 18:10:48.996971
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.27405
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '758'

2024-08-12 18:10:49.30339
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.70646
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '796'

2024-08-12 18:10:49.73560
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.104721
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '872'

2024-08-12 18:10:49.107498
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.127787
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '873'

2024-08-12 18:10:49.139043
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.258407
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '874'

2024-08-12 18:10:49.387807
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.431341
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '875'

2024-08-12 18:10:49.446100
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.476400
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '876'

2024-08-12 18:10:49.478812
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.508726
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '877'

2024-08-12 18:10:49.511154
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.540794
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '878'

2024-08-12 18:10:49.543177
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.575319
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '879'

2024-08-12 18:10:49.577712
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.608441
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '884'

2024-08-12 18:10:49.629651
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.673920
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '886'

2024-08-12 18:10:49.676476
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.712725
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '896'

2024-08-12 18:10:49.716733
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.747932
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '903'

2024-08-12 18:10:49.750297
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.780228
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '935'

2024-08-12 18:10:49.782583
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.816618
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '936'

2024-08-12 18:10:49.819181
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.853269
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '951'

2024-08-12 18:10:49.887919
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.918378
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '952'

2024-08-12 18:10:49.920804
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.951191
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '954'

2024-08-12 18:10:49.953654
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:49.983570
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '968'

2024-08-12 18:10:49.986024
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.16998
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '986'

2024-08-12 18:10:50.19673
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.52468
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1000'

2024-08-12 18:10:50.54927
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.90147
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1019'

2024-08-12 18:10:50.101359
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.237840
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1025'

2024-08-12 18:10:50.249810
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.289927
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1032'

2024-08-12 18:10:50.295704
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.343401
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1035'

2024-08-12 18:10:50.364409
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.411946
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1065'

2024-08-12 18:10:50.423291
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.466852
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1066'

2024-08-12 18:10:50.518821
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.564102
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1073'

2024-08-12 18:10:50.586335
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.634986
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1093'

2024-08-12 18:10:50.648415
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.698851
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1132'

2024-08-12 18:10:50.710068
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.746713
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1139'

2024-08-12 18:10:50.751516
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.789213
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1152'

2024-08-12 18:10:50.809907
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.856909
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1154'

2024-08-12 18:10:50.871991
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.914637
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1163'

2024-08-12 18:10:50.939207
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:50.989392
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1179'

2024-08-12 18:10:51.3005
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.47016
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1211'

2024-08-12 18:10:51.63372
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.107627
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1212'

2024-08-12 18:10:51.133252
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.178999
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1218'

2024-08-12 18:10:51.195064
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.242681
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1236'

2024-08-12 18:10:51.258583
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.300395
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1237'

2024-08-12 18:10:51.317501
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.374534
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1238'

2024-08-12 18:10:51.406705
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.445282
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1239'

2024-08-12 18:10:51.459773
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.543653
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1247'

2024-08-12 18:10:51.558322
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.602210
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1269'

2024-08-12 18:10:51.610642
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.645288
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1270'

2024-08-12 18:10:51.647443
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.682525
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1285'

2024-08-12 18:10:51.694911
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.742690
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1304'

2024-08-12 18:10:51.757241
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.798406
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1305'

2024-08-12 18:10:51.820394
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.858881
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1328'

2024-08-12 18:10:51.873118
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.914368
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1329'

2024-08-12 18:10:51.935332
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:51.976612
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1368'

2024-08-12 18:10:51.979275
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.21435
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1385'

2024-08-12 18:10:52.41970
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.83562
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1413'

2024-08-12 18:10:52.96816
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.138313
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1428'

2024-08-12 18:10:52.151309
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.195438
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1429'

2024-08-12 18:10:52.206618
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.377035
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1438'

2024-08-12 18:10:52.389308
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.437742
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1443'

2024-08-12 18:10:52.459520
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.507972
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1446'

2024-08-12 18:10:52.518859
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.560974
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1455'

2024-08-12 18:10:52.580707
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.623244
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1461'

2024-08-12 18:10:52.636191
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.674870
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1471'

2024-08-12 18:10:52.696424
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.745220
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1474'

2024-08-12 18:10:52.764124
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.807370
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1492'

2024-08-12 18:10:52.819661
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.860453
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1498'

2024-08-12 18:10:52.890590
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.925897
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1517'

2024-08-12 18:10:52.947665
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:52.989481
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1526'

2024-08-12 18:10:53.11825
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.54235
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1540'

2024-08-12 18:10:53.77167
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.120936
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1547'

2024-08-12 18:10:53.140126
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.186002
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1554'

2024-08-12 18:10:53.205806
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.259394
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1560'

2024-08-12 18:10:53.282044
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.340158
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1562'

2024-08-12 18:10:53.381115
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.459966
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1582'

2024-08-12 18:10:53.496913
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.570127
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1583'

2024-08-12 18:10:53.601427
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.648852
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1615'

2024-08-12 18:10:53.680482
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.729869
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1616'

2024-08-12 18:10:53.735584
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.776706
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1625'

2024-08-12 18:10:53.783480
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.829589
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1631'

2024-08-12 18:10:53.849616
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.892771
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1632'

2024-08-12 18:10:53.914787
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:53.992909
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1659'

2024-08-12 18:10:54.13716
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.56163
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1673'

2024-08-12 18:10:54.75841
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.118329
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1678'

2024-08-12 18:10:54.131305
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.173753
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1690'

2024-08-12 18:10:54.189262
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.256342
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1695'

2024-08-12 18:10:54.262283
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.395614
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1702'

2024-08-12 18:10:54.421923
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.462482
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1711'

2024-08-12 18:10:54.477121
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.516473
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1712'

2024-08-12 18:10:54.530914
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.585894
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1728'

2024-08-12 18:10:54.609705
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.662925
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1733'

2024-08-12 18:10:54.678866
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.735134
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1734'

2024-08-12 18:10:54.748125
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.798682
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1747'

2024-08-12 18:10:54.811384
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.860817
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1753'

2024-08-12 18:10:54.865400
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.907651
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1754'

2024-08-12 18:10:54.930043
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:54.977958
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1763'

2024-08-12 18:10:54.984328
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.34419
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1767'

2024-08-12 18:10:55.48792
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.75330
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1775'

2024-08-12 18:10:55.87652
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.129942
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1777'

2024-08-12 18:10:55.144026
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.186532
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1778'

2024-08-12 18:10:55.200872
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.244816
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1781'

2024-08-12 18:10:55.259262
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.311134
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1793'

2024-08-12 18:10:55.324153
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.353293
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1795'

2024-08-12 18:10:55.367707
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.406955
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1796'

2024-08-12 18:10:55.421853
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.467029
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1808'

2024-08-12 18:10:55.491807
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.544952
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1809'

2024-08-12 18:10:55.560791
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.604953
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1830'

2024-08-12 18:10:55.653991
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.722585
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1842'

2024-08-12 18:10:55.756405
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.803071
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1846'

2024-08-12 18:10:55.826662
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.870699
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1854'

2024-08-12 18:10:55.889464
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:55.941770
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1866'

2024-08-12 18:10:55.961895
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.4392
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1883'

2024-08-12 18:10:56.24021
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.65236
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1900'

2024-08-12 18:10:56.89419
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.136977
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1902'

2024-08-12 18:10:56.159474
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.216025
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1918'

2024-08-12 18:10:56.218505
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.250865
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1930'

2024-08-12 18:10:56.261127
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.304902
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1936'

2024-08-12 18:10:56.307110
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.338906
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1952'

2024-08-12 18:10:56.341079
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.376157
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1969'

2024-08-12 18:10:56.378336
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.414549
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1993'

2024-08-12 18:10:56.416748
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.458058
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2022'

2024-08-12 18:10:56.460302
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.492318
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2025'

2024-08-12 18:10:56.494533
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.526683
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2057'

2024-08-12 18:10:56.529038
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.561178
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2098'

2024-08-12 18:10:56.563372
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.595560
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2099'

2024-08-12 18:10:56.597675
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.629811
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2321'

2024-08-12 18:10:56.632052
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2023-12-31'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.663415
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='1970-01-01' AND pet.tran_date <='2023-12-31' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:10:56.666633
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.714021
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '2024-01-01' 
                    AND iou.tran_date <= '2024-08-12'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:10:56.717618
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2089'

2024-08-12 18:10:56.719611
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.755248
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2107'

2024-08-12 18:10:56.757957
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.794259
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2114'

2024-08-12 18:10:56.796671
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.832142
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2127'

2024-08-12 18:10:56.834384
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.870458
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2141'

2024-08-12 18:10:56.872658
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.909370
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2156'

2024-08-12 18:10:56.911880
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.948936
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2158'

2024-08-12 18:10:56.951292
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:56.984592
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2160'

2024-08-12 18:10:56.986996
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.25339
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2171'

2024-08-12 18:10:57.27636
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.61509
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2179'

2024-08-12 18:10:57.63806
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.124885
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2204'

2024-08-12 18:10:57.127369
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.161200
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2208'

2024-08-12 18:10:57.163641
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.197561
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2240'

2024-08-12 18:10:57.199767
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.260244
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2266'

2024-08-12 18:10:57.263020
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.297218
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2267'

2024-08-12 18:10:57.299413
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.333502
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2268'

2024-08-12 18:10:57.335715
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.369624
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2269'

2024-08-12 18:10:57.371796
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.405501
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2288'

2024-08-12 18:10:57.407733
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.447760
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2289'

2024-08-12 18:10:57.450105
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.484751
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2295'

2024-08-12 18:10:57.486924
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.520444
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2304'

2024-08-12 18:10:57.522635
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.562540
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2320'

2024-08-12 18:10:57.564751
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.598264
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2339'

2024-08-12 18:10:57.600517
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.634163
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2340'

2024-08-12 18:10:57.638710
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.675877
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2360'

2024-08-12 18:10:57.678527
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.719226
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2365'

2024-08-12 18:10:57.722741
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.758054
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2375'

2024-08-12 18:10:57.764674
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.798604
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2377'

2024-08-12 18:10:57.804237
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.841092
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2378'

2024-08-12 18:10:57.847616
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.883057
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2387'

2024-08-12 18:10:57.889357
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.927469
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2393'

2024-08-12 18:10:57.930635
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:57.966243
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2396'

2024-08-12 18:10:57.971337
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.5761
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2411'

2024-08-12 18:10:58.11006
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.49095
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2412'

2024-08-12 18:10:58.54766
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.88937
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2420'

2024-08-12 18:10:58.94110
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.132034
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2438'

2024-08-12 18:10:58.138196
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.180240
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2440'

2024-08-12 18:10:58.184768
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.227442
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2441'

2024-08-12 18:10:58.230872
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.270052
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2452'

2024-08-12 18:10:58.275880
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.314947
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2464'

2024-08-12 18:10:58.322383
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.374099
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2473'

2024-08-12 18:10:58.381962
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.441027
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2476'

2024-08-12 18:10:58.452012
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.539739
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2517'

2024-08-12 18:10:58.552226
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.617965
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2524'

2024-08-12 18:10:58.623594
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-01' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:10:58.660352
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='2024-01-01' AND pet.tran_date <='2024-08-12' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:16:52.64758
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 18:16:52.68892
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 18:16:52.70200
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 18:16:52.89689
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 18:16:52.93286
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 18:16:52.585696
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 18:16:52.587392
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 18:16:52.588722
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 18:16:52.601472
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 18:16:52.603496
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 18:16:52.605836
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='I_OWE_YOU'

2024-08-12 18:16:52.609832
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='PETTY_CASH'

2024-08-12 18:16:52.611837
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:52.715269
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '1970-01-01' 
                    AND iou.tran_date <= '2024-01-01'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:16:52.718595
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '674'

2024-08-12 18:16:52.722897
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:52.756722
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '686'

2024-08-12 18:16:52.759596
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:52.789730
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '758'

2024-08-12 18:16:52.792061
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:52.837536
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '796'

2024-08-12 18:16:52.840620
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:52.870386
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '872'

2024-08-12 18:16:52.873449
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:52.893121
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '873'

2024-08-12 18:16:52.895866
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:52.925831
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '874'

2024-08-12 18:16:52.928606
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:52.958697
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '875'

2024-08-12 18:16:52.961635
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:52.991455
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '876'

2024-08-12 18:16:52.993678
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.24077
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '877'

2024-08-12 18:16:53.26336
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.56575
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '878'

2024-08-12 18:16:53.59560
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.92363
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '879'

2024-08-12 18:16:53.94544
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.124816
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '884'

2024-08-12 18:16:53.127084
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.160915
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '886'

2024-08-12 18:16:53.163086
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.193491
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '896'

2024-08-12 18:16:53.195733
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.225712
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '903'

2024-08-12 18:16:53.227955
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.259085
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '935'

2024-08-12 18:16:53.261262
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.291424
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '936'

2024-08-12 18:16:53.293597
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.342384
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '951'

2024-08-12 18:16:53.345406
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.376052
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '952'

2024-08-12 18:16:53.379020
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.409230
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '954'

2024-08-12 18:16:53.412206
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.442400
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '968'

2024-08-12 18:16:53.445152
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.474984
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '986'

2024-08-12 18:16:53.477978
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.510957
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1000'

2024-08-12 18:16:53.513282
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.543659
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1019'

2024-08-12 18:16:53.545904
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.575709
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1025'

2024-08-12 18:16:53.594894
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.625832
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1032'

2024-08-12 18:16:53.628132
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.658428
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1035'

2024-08-12 18:16:53.670021
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.700764
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1065'

2024-08-12 18:16:53.711711
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.741695
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1066'

2024-08-12 18:16:53.745791
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.777689
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1073'

2024-08-12 18:16:53.780035
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.826264
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1093'

2024-08-12 18:16:53.837480
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.868185
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1132'

2024-08-12 18:16:53.872197
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.904221
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1139'

2024-08-12 18:16:53.907806
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.938559
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1152'

2024-08-12 18:16:53.941401
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:53.973763
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1154'

2024-08-12 18:16:53.976214
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.7389
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1163'

2024-08-12 18:16:54.10166
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.41152
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1179'

2024-08-12 18:16:54.43543
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.74366
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1211'

2024-08-12 18:16:54.85875
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.117500
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1212'

2024-08-12 18:16:54.119975
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.150690
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1218'

2024-08-12 18:16:54.154138
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.187517
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1236'

2024-08-12 18:16:54.197664
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.229586
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1237'

2024-08-12 18:16:54.238850
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.269118
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1238'

2024-08-12 18:16:54.279239
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.315406
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1239'

2024-08-12 18:16:54.325030
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.355811
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1247'

2024-08-12 18:16:54.365195
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.395759
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1269'

2024-08-12 18:16:54.404912
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.441998
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1270'

2024-08-12 18:16:54.445482
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.485348
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1285'

2024-08-12 18:16:54.495560
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.525949
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1304'

2024-08-12 18:16:54.545350
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.576314
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1305'

2024-08-12 18:16:54.578740
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.609475
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1328'

2024-08-12 18:16:54.623331
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.662441
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1329'

2024-08-12 18:16:54.664666
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.715106
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1368'

2024-08-12 18:16:54.725353
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.768980
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1385'

2024-08-12 18:16:54.780058
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.817979
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1413'

2024-08-12 18:16:54.827037
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.865476
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1428'

2024-08-12 18:16:54.874844
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.906270
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1429'

2024-08-12 18:16:54.908418
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.945288
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1438'

2024-08-12 18:16:54.947419
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:54.981085
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1443'

2024-08-12 18:16:54.983233
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.14912
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1446'

2024-08-12 18:16:55.17058
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.53557
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1455'

2024-08-12 18:16:55.71749
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.112843
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1461'

2024-08-12 18:16:55.128532
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.166559
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1471'

2024-08-12 18:16:55.185919
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.232838
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1474'

2024-08-12 18:16:55.261259
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.317556
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1492'

2024-08-12 18:16:55.337538
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.382343
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1498'

2024-08-12 18:16:55.398512
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.445811
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1517'

2024-08-12 18:16:55.460194
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.509700
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1526'

2024-08-12 18:16:55.530476
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.561663
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1540'

2024-08-12 18:16:55.571307
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.605396
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1547'

2024-08-12 18:16:55.607450
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.638498
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1554'

2024-08-12 18:16:55.640571
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.686703
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1560'

2024-08-12 18:16:55.689049
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.764656
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1562'

2024-08-12 18:16:55.781183
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.832097
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1582'

2024-08-12 18:16:55.860161
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.895569
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1583'

2024-08-12 18:16:55.911566
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:55.954465
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1615'

2024-08-12 18:16:55.975354
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.7011
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1616'

2024-08-12 18:16:56.13780
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.126383
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1625'

2024-08-12 18:16:56.128714
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.171158
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1631'

2024-08-12 18:16:56.183625
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.215708
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1632'

2024-08-12 18:16:56.222953
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.254839
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1659'

2024-08-12 18:16:56.257271
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.291392
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1673'

2024-08-12 18:16:56.306409
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.339336
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1678'

2024-08-12 18:16:56.347839
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.464293
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1690'

2024-08-12 18:16:56.474834
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.573217
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1695'

2024-08-12 18:16:56.588232
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.624285
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1702'

2024-08-12 18:16:56.626508
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.663117
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1711'

2024-08-12 18:16:56.666712
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.698627
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1712'

2024-08-12 18:16:56.718218
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.760807
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1728'

2024-08-12 18:16:56.772483
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.827106
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1733'

2024-08-12 18:16:56.830569
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.872776
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1734'

2024-08-12 18:16:56.881574
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.923489
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1747'

2024-08-12 18:16:56.938846
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:56.981955
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1753'

2024-08-12 18:16:56.984121
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.15678
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1754'

2024-08-12 18:16:57.18147
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.54349
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1763'

2024-08-12 18:16:57.56731
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.99651
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1767'

2024-08-12 18:16:57.102195
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.121533
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1775'

2024-08-12 18:16:57.123787
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.156087
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1777'

2024-08-12 18:16:57.162810
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.195388
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1778'

2024-08-12 18:16:57.197708
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.229520
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1781'

2024-08-12 18:16:57.231907
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.268508
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1793'

2024-08-12 18:16:57.270838
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.291390
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1795'

2024-08-12 18:16:57.293991
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.342289
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1796'

2024-08-12 18:16:57.347826
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.388303
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1808'

2024-08-12 18:16:57.391528
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.446711
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1809'

2024-08-12 18:16:57.459115
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.499848
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1830'

2024-08-12 18:16:57.510101
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.546540
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1842'

2024-08-12 18:16:57.548907
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.581446
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1846'

2024-08-12 18:16:57.583828
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.615701
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1854'

2024-08-12 18:16:57.618077
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.649663
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1866'

2024-08-12 18:16:57.652937
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.694736
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1883'

2024-08-12 18:16:57.707511
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.739843
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1900'

2024-08-12 18:16:57.742200
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.788130
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1902'

2024-08-12 18:16:57.790483
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.839974
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1918'

2024-08-12 18:16:57.842421
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.878941
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1930'

2024-08-12 18:16:57.881755
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.914664
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1936'

2024-08-12 18:16:57.916933
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.953198
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1952'

2024-08-12 18:16:57.955570
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:57.988244
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1969'

2024-08-12 18:16:57.998108
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.30601
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1993'

2024-08-12 18:16:58.43676
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.86252
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2022'

2024-08-12 18:16:58.94401
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.128581
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2025'

2024-08-12 18:16:58.143059
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.182589
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2057'

2024-08-12 18:16:58.185890
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.223673
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2098'

2024-08-12 18:16:58.225913
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.270967
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2099'

2024-08-12 18:16:58.289137
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.340208
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2321'

2024-08-12 18:16:58.350807
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.385952
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='1970-01-01' AND pet.tran_date <='2024-01-01' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:16:58.412061
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.453277
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '2024-01-02' 
                    AND iou.tran_date <= '2024-08-12'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:16:58.456864
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2089'

2024-08-12 18:16:58.458917
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.500599
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2107'

2024-08-12 18:16:58.519057
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.558241
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2114'

2024-08-12 18:16:58.563085
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.600744
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2127'

2024-08-12 18:16:58.606255
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.646304
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2141'

2024-08-12 18:16:58.650462
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.690027
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2156'

2024-08-12 18:16:58.694446
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.729143
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2158'

2024-08-12 18:16:58.741094
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.794904
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2160'

2024-08-12 18:16:58.797707
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.848514
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2171'

2024-08-12 18:16:58.864201
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.908338
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2179'

2024-08-12 18:16:58.911048
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.949360
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2204'

2024-08-12 18:16:58.962544
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:58.997654
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2208'

2024-08-12 18:16:59.7105
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.41728
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2240'

2024-08-12 18:16:59.54852
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.111499
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2266'

2024-08-12 18:16:59.124461
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.169657
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2267'

2024-08-12 18:16:59.172228
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.213133
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2268'

2024-08-12 18:16:59.215733
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.259198
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2269'

2024-08-12 18:16:59.261780
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.302528
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2288'

2024-08-12 18:16:59.318202
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.381239
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2289'

2024-08-12 18:16:59.392139
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.426549
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2295'

2024-08-12 18:16:59.436322
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.486262
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2304'

2024-08-12 18:16:59.497099
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.537422
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2320'

2024-08-12 18:16:59.539809
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.578032
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2339'

2024-08-12 18:16:59.582916
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.617930
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2340'

2024-08-12 18:16:59.626595
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.673794
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2360'

2024-08-12 18:16:59.676132
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.712485
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2365'

2024-08-12 18:16:59.714719
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.754651
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2375'

2024-08-12 18:16:59.757006
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.792188
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2377'

2024-08-12 18:16:59.794465
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.850602
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2378'

2024-08-12 18:16:59.852754
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.888874
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2387'

2024-08-12 18:16:59.900571
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:16:59.948302
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2393'

2024-08-12 18:16:59.961450
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.1659
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2396'

2024-08-12 18:17:00.4380
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.52664
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2411'

2024-08-12 18:17:00.55280
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.96413
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2412'

2024-08-12 18:17:00.98862
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.163476
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2420'

2024-08-12 18:17:00.167438
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.208883
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2438'

2024-08-12 18:17:00.212659
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.252788
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2440'

2024-08-12 18:17:00.256320
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.311500
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2441'

2024-08-12 18:17:00.321562
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.358677
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2452'

2024-08-12 18:17:00.388555
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.426884
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2464'

2024-08-12 18:17:00.436128
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.489611
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2473'

2024-08-12 18:17:00.517665
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.583642
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2476'

2024-08-12 18:17:00.586048
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.644978
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2517'

2024-08-12 18:17:00.647852
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.690335
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2524'

2024-08-12 18:17:00.693078
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:00.728034
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='2024-01-02' AND pet.tran_date <='2024-08-12' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:17:01.221232
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-12 18:17:01.258776
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-12 18:17:01.260610
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-12 18:17:01.274171
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-12 18:17:01.278976
SELECT project_id, project_code, value_name, description, project_name  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
                    LEFT JOIN 0_list_values lv ON 
                            pm.department_id = lv.id 
            WHERE pm.inactive = 0 AND udag.user_id =1 AND (pm.project_id='') ORDER BY value_name,pm.description

2024-08-12 18:17:01.282006
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='I_OWE_YOU'

2024-08-12 18:17:01.283449
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='PETTY_CASH'

2024-08-12 18:17:01.285605
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.311181
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '1970-01-01' 
                    AND iou.tran_date <= '2024-01-01'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:17:01.316232
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '674'

2024-08-12 18:17:01.318483
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '674'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.358961
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '686'

2024-08-12 18:17:01.361531
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '686'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.391762
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '758'

2024-08-12 18:17:01.394240
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '758'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.424274
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '796'

2024-08-12 18:17:01.426728
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.457809
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '872'

2024-08-12 18:17:01.460575
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '872'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.481503
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '873'

2024-08-12 18:17:01.484107
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '873'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.545536
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '874'

2024-08-12 18:17:01.562761
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '874'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.593282
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '875'

2024-08-12 18:17:01.595708
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '875'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.633007
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '876'

2024-08-12 18:17:01.635688
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '876'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.665616
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '877'

2024-08-12 18:17:01.668088
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '877'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.698206
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '878'

2024-08-12 18:17:01.700693
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '878'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.734754
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '879'

2024-08-12 18:17:01.783417
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '879'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.820296
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '884'

2024-08-12 18:17:01.823138
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '884'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.857398
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '886'

2024-08-12 18:17:01.860469
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '886'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.903982
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '896'

2024-08-12 18:17:01.946290
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '896'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:01.979376
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '903'

2024-08-12 18:17:02.38268
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '903'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.69373
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '935'

2024-08-12 18:17:02.72316
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '935'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.104067
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '936'

2024-08-12 18:17:02.107522
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '936'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.140738
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '951'

2024-08-12 18:17:02.148418
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '951'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.261947
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '952'

2024-08-12 18:17:02.275438
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '952'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.311988
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '954'

2024-08-12 18:17:02.314689
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '954'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.345640
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '968'

2024-08-12 18:17:02.348809
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '968'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.378817
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '986'

2024-08-12 18:17:02.381269
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '986'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.413868
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1000'

2024-08-12 18:17:02.416366
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1000'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.448990
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1019'

2024-08-12 18:17:02.461493
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1019'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.491804
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1025'

2024-08-12 18:17:02.494247
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1025'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.524403
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1032'

2024-08-12 18:17:02.526900
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1032'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.557017
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1035'

2024-08-12 18:17:02.559553
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1035'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.590371
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1065'

2024-08-12 18:17:02.592844
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1065'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.623933
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1066'

2024-08-12 18:17:02.637324
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1066'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.676796
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1073'

2024-08-12 18:17:02.679330
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1073'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.709426
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1093'

2024-08-12 18:17:02.711879
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1093'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.743050
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1132'

2024-08-12 18:17:02.745457
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1132'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.776811
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1139'

2024-08-12 18:17:02.779308
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1139'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.816741
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1152'

2024-08-12 18:17:02.819252
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1152'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.876272
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1154'

2024-08-12 18:17:02.879811
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1154'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.912386
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1163'

2024-08-12 18:17:02.915014
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1163'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.945441
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1179'

2024-08-12 18:17:02.947957
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1179'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:02.978177
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1211'

2024-08-12 18:17:02.980684
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1211'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.11733
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1212'

2024-08-12 18:17:03.14277
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1212'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.152158
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1218'

2024-08-12 18:17:03.248607
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1218'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.288604
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1236'

2024-08-12 18:17:03.313144
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1236'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.347023
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1237'

2024-08-12 18:17:03.357993
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1237'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.392436
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1238'

2024-08-12 18:17:03.394957
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1238'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.425247
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1239'

2024-08-12 18:17:03.427667
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1239'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.457867
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1247'

2024-08-12 18:17:03.460439
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1247'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.492239
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1269'

2024-08-12 18:17:03.494727
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1269'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.535503
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1270'

2024-08-12 18:17:03.548398
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1270'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.580209
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1285'

2024-08-12 18:17:03.582705
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1285'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.613087
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1304'

2024-08-12 18:17:03.615599
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1304'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.647692
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1305'

2024-08-12 18:17:03.652649
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1305'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.688174
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1328'

2024-08-12 18:17:03.691653
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1328'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.722896
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1329'

2024-08-12 18:17:03.736839
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1329'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.785063
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1368'

2024-08-12 18:17:03.798123
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1368'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.843640
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1385'

2024-08-12 18:17:03.856213
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1385'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.896769
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1413'

2024-08-12 18:17:03.909596
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1413'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:03.952474
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1428'

2024-08-12 18:17:03.991495
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1428'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.22898
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1429'

2024-08-12 18:17:04.25373
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1429'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.59342
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1438'

2024-08-12 18:17:04.61864
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1438'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.93945
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1443'

2024-08-12 18:17:04.119204
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1443'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.153541
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1446'

2024-08-12 18:17:04.191498
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1446'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.222423
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1455'

2024-08-12 18:17:04.224829
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1455'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.256565
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1461'

2024-08-12 18:17:04.259007
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1461'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.309543
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1471'

2024-08-12 18:17:04.321893
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1471'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.355309
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1474'

2024-08-12 18:17:04.357719
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1474'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.388686
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1492'

2024-08-12 18:17:04.391098
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1492'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.422066
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1498'

2024-08-12 18:17:04.424467
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1498'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.458342
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1517'

2024-08-12 18:17:04.460733
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1517'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.491381
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1526'

2024-08-12 18:17:04.493722
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1526'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.588836
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1540'

2024-08-12 18:17:04.603948
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1540'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.635221
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1547'

2024-08-12 18:17:04.637674
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1547'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.669411
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1554'

2024-08-12 18:17:04.671826
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1554'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.702766
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1560'

2024-08-12 18:17:04.705219
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1560'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.748524
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1562'

2024-08-12 18:17:04.750911
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1562'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.796145
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1582'

2024-08-12 18:17:04.799350
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1582'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.841580
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1583'

2024-08-12 18:17:04.843976
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1583'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.879308
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1615'

2024-08-12 18:17:04.881768
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1615'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.915902
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1616'

2024-08-12 18:17:04.918916
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1616'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:04.952401
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1625'

2024-08-12 18:17:04.973020
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1625'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.17130
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1631'

2024-08-12 18:17:05.19573
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1631'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.51098
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1632'

2024-08-12 18:17:05.53976
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1632'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.85196
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1659'

2024-08-12 18:17:05.88288
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1659'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.119451
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1673'

2024-08-12 18:17:05.121866
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1673'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.154303
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1678'

2024-08-12 18:17:05.167651
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1678'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.206766
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1690'

2024-08-12 18:17:05.212018
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1690'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.247424
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1695'

2024-08-12 18:17:05.249768
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1695'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.280825
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1702'

2024-08-12 18:17:05.283244
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1702'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.321339
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1711'

2024-08-12 18:17:05.324420
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1711'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.355661
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1712'

2024-08-12 18:17:05.358097
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1712'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.396234
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1728'

2024-08-12 18:17:05.398697
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1728'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.429875
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1733'

2024-08-12 18:17:05.432294
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1733'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.470827
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1734'

2024-08-12 18:17:05.473366
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1734'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.504783
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1747'

2024-08-12 18:17:05.507250
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1747'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.542684
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1753'

2024-08-12 18:17:05.545208
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1753'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.578151
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1754'

2024-08-12 18:17:05.580535
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1754'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.611728
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1763'

2024-08-12 18:17:05.628911
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1763'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.695856
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1767'

2024-08-12 18:17:05.698380
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1767'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.719451
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1775'

2024-08-12 18:17:05.721935
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1775'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.754984
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1777'

2024-08-12 18:17:05.757476
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1777'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.790604
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1778'

2024-08-12 18:17:05.808725
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1778'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.841989
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1781'

2024-08-12 18:17:05.867173
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1781'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.901178
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1793'

2024-08-12 18:17:05.907030
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1793'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.930381
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1795'

2024-08-12 18:17:05.932794
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1795'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.964002
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1796'

2024-08-12 18:17:05.966488
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1796'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:05.998717
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1808'

2024-08-12 18:17:06.1201
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1808'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.32876
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1809'

2024-08-12 18:17:06.36597
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1809'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.142009
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1830'

2024-08-12 18:17:06.145696
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1830'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.177147
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1842'

2024-08-12 18:17:06.179602
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1842'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.231773
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1846'

2024-08-12 18:17:06.235348
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1846'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.282431
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1854'

2024-08-12 18:17:06.284823
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1854'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.322795
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1866'

2024-08-12 18:17:06.325182
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1866'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.423663
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1883'

2024-08-12 18:17:06.480629
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1883'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.518295
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1900'

2024-08-12 18:17:06.523934
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1900'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.588406
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1902'

2024-08-12 18:17:06.591169
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1902'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.623274
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1918'

2024-08-12 18:17:06.625974
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1918'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.657719
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1930'

2024-08-12 18:17:06.660224
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1930'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.881172
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1936'

2024-08-12 18:17:06.899100
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1936'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.935459
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1952'

2024-08-12 18:17:06.937962
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1952'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:06.969816
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1969'

2024-08-12 18:17:06.972282
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1969'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.4312
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '1993'

2024-08-12 18:17:07.6774
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '1993'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.52983
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2022'

2024-08-12 18:17:07.66147
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2022'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.99090
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2025'

2024-08-12 18:17:07.102076
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2025'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.145577
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2057'

2024-08-12 18:17:07.148120
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2057'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.180918
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2098'

2024-08-12 18:17:07.183419
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2098'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.215752
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2099'

2024-08-12 18:17:07.218267
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2099'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.250723
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2321'

2024-08-12 18:17:07.253418
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '1970-01-01' 
                AND iou.tran_date <= '2024-01-01'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2321'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.285360
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='1970-01-01' AND pet.tran_date <='2024-01-01' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-12 18:17:07.289538
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no = 0   ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.344581
SELECT DISTINCT iou.batch_no  
            FROM 0_i_owe_you iou
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no > 0 
                    AND iou.tran_date >= '2024-01-02' 
                    AND iou.tran_date <= '2024-08-12'
                    AND iou.approval_status IN (30,130) AND iou.batch_complete = 0  AND iou.employee_code = 'KTS016' AND iou.type = '951' ORDER BY iou.batch_no

2024-08-12 18:17:07.351785
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2089'

2024-08-12 18:17:07.363585
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2089'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.399673
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2107'

2024-08-12 18:17:07.402316
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2107'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.439660
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2114'

2024-08-12 18:17:07.442388
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2114'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.478835
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2127'

2024-08-12 18:17:07.481497
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2127'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.607392
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2141'

2024-08-12 18:17:07.618150
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2141'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.686261
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2156'

2024-08-12 18:17:07.721535
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2156'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.771050
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2158'

2024-08-12 18:17:07.792049
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2158'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.842992
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2160'

2024-08-12 18:17:07.856337
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2160'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.906319
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2171'

2024-08-12 18:17:07.927223
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2171'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:07.977994
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2179'

2024-08-12 18:17:07.989319
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2179'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.38259
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2204'

2024-08-12 18:17:08.49256
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2204'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.85795
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2208'

2024-08-12 18:17:08.89146
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2208'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.127034
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2240'

2024-08-12 18:17:08.141385
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2240'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.207058
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2266'

2024-08-12 18:17:08.220991
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2266'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.264905
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2267'

2024-08-12 18:17:08.278556
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2267'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.325989
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2268'

2024-08-12 18:17:08.341765
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2268'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.383978
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2269'

2024-08-12 18:17:08.391217
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2269'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.431779
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2288'

2024-08-12 18:17:08.447295
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2288'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.494350
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2289'

2024-08-12 18:17:08.508444
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2289'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.548831
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2295'

2024-08-12 18:17:08.563365
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2295'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.613564
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2304'

2024-08-12 18:17:08.628179
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2304'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.677543
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2320'

2024-08-12 18:17:08.679834
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2320'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.713090
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2339'

2024-08-12 18:17:08.715311
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2339'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.749188
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2340'

2024-08-12 18:17:08.751434
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2340'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.910990
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2360'

2024-08-12 18:17:08.936420
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2360'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:08.983879
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2365'

2024-08-12 18:17:09.1504
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2365'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.52051
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2375'

2024-08-12 18:17:09.71692
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2375'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.134254
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2377'

2024-08-12 18:17:09.161997
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2377'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.228881
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2378'

2024-08-12 18:17:09.252475
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2378'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.324306
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2387'

2024-08-12 18:17:09.360924
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2387'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.405914
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2393'

2024-08-12 18:17:09.426569
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2393'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.477724
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2396'

2024-08-12 18:17:09.488084
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2396'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.529843
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2411'

2024-08-12 18:17:09.544491
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2411'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.606170
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2412'

2024-08-12 18:17:09.609440
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2412'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.645446
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2420'

2024-08-12 18:17:09.649655
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2420'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.693411
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2438'

2024-08-12 18:17:09.716992
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2438'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.761891
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2440'

2024-08-12 18:17:09.775777
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2440'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.823363
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2441'

2024-08-12 18:17:09.843890
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2441'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.885395
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2452'

2024-08-12 18:17:09.891146
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2452'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.935391
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2464'

2024-08-12 18:17:09.947910
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2464'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:09.997239
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2473'

2024-08-12 18:17:10.8754
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2473'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:10.62948
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2476'

2024-08-12 18:17:10.74023
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2476'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:10.119390
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2517'

2024-08-12 18:17:10.143304
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2517'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:10.200358
SELECT * 
            FROM 0_i_owe_you_batches 
            WHERE batch_no = '2524'

2024-08-12 18:17:10.221623
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, 0 type, 
                0 trans_no, '' pay_date, 0 pay_amount, 0 run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id IS NULL AND bt.trans_no IS NULL  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND p.id > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou 
                LEFT JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                LEFT JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                LEFT JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                LEFT JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status = '30' 
                AND iou.tran_date >= '2024-01-02' 
                AND iou.tran_date <= '2024-08-12'
                AND iou.approval_status IN (30, 130)
                AND bt.trans_no > 0  AND iou.batch_complete = 0  AND iou.employee_code ='KTS016' AND iou.type ='951' AND iou.batch_no > 0 AND iou.batch_no = '2524'  ORDER BY iou.batch_no, iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-12 18:17:10.263062
SELECT pet.*, bt.amount batch_total, bt.approval_status, bt.complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, ft.name float_name   
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                LEFT JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = pet.id 
                    AND p.expense_source = '168' 
                    AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = pet.project_id 
                LEFT JOIN 0_petty_cash_floats ft  
                    ON pet.float_id = ft.id 
            WHERE pet.employee_code = 'KTS016'         
                AND pet.type = '950'            
                AND pet.tran_date >='2024-01-02' AND pet.tran_date <='2024-08-12' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

