2024-08-13 18:54:16.478335
SELECT company_code, CONCAT(company_code, ' - ', company_name) company_name 
            FROM group_companies  ORDER BY default_company DESC

2024-08-13 18:54:16.482023
SELECT db_name FROM group_companies 
                WHERE company_code = 'UKE'

2024-08-13 18:54:16.483371
SELECT employee_code, 
                    CONCAT(employee_code, ' - ', initials, ' ', last_name) name 
            FROM uke_db.0_employee_master  ORDER BY name

2024-08-13 18:54:16.496864
SELECT id, name  FROM 0_petty_cash_floats  ORDER BY name

2024-08-13 18:54:16.499594
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-13 18:54:16.501902
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='I_OWE_YOU'

2024-08-13 18:54:16.503095
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='PETTY_CASH'

2024-08-13 18:54:16.504565
SELECT DISTINCT iou.id iou_id   
            FROM 0_i_owe_you iou 
                JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                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-07-29'
                    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-13 18:54:16.507274
SELECT DISTINCT b.batch_no  
            FROM 0_i_owe_you iou
                JOIN 0_i_owe_you_batches b  
                    ON b.batch_no = iou.batch_no 
                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 b.tran_date >= '1970-01-01' 
                    AND b.tran_date <= '2022-07-29'
                    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-13 18:54:16.510413
SELECT bt.batch_no    
            FROM 0_petty_cash_header pet
                JOIN 0_i_owe_you_batches bt  
                    ON pet.batch_no = bt.batch_no 
                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 
                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-07-29' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id

2024-08-13 18:54:16.512694
SELECT DISTINCT iou.id iou_id   
            FROM 0_i_owe_you iou 
                JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code    
            WHERE iou.batch_no = 0 
                    AND iou.tran_date >= '2022-07-30' 
                    AND iou.tran_date <= '2024-08-13'
                    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-13 18:54:19.175906
SELECT DISTINCT al.id, al.batch_no, al.tran_date, al.amount, al.batch_complete, al.project_name, al.type, al.trans_no, al.pay_date, 
                    al.pay_amount, al.run_id, al.float_name 
                FROM ( (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, p.expense_source type, 
                p.id trans_no, p.payment_date pay_date, p.amount pay_amount, p.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou  
                JOIN 0_i_owe_you_payments p  
                    ON p.iou_id = iou.id 
                        AND p.expense_source = '107' 
                        AND p.paid = 1 
                JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id 
            WHERE iou.approval_status IN (30, 130)
                AND iou.id = '1659'  
                AND iou.batch_no = 0  
                AND p.id > 0   ORDER iou.id ) UNION (SELECT iou.id, iou.batch_no, iou.tran_date, iou.amount, iou.batch_complete, pm.description project_name, bt.type, 
                bt.trans_no, bt.trans_date pay_date, bt.amount*-1 pay_amount, bt.id run_id, ft.name float_name  
            FROM 0_i_owe_you iou  
                JOIN 0_bank_trans bt 
                    ON iou.id = bt.person_id 
                        AND bt.type IN('230', '232')  
                JOIN 0_projects_master pm 
                    ON pm.project_id = iou.project_id
                JOIN 0_list_values dp 
                    ON dp.id = pm.department_id
                JOIN 0_employee_master em 
                    ON em.employee_code = iou.employee_code 
                JOIN 0_petty_cash_floats ft  
                    ON iou.float_id = ft.id     
            WHERE iou.approval_status IN (30, 130)
                AND iou.id = '1659'  
                AND iou.batch_no = 0  
                AND bt.trans_no > 0   ORDER BY iou.id ) ) al 
                WHERE 1 = 1 
                ORDER BY al.id, al.tran_date, al.pay_date, al.run_id, al.trans_no

2024-08-13 18:54:19.177677
rollback

