2024-08-14 19:54:52.608116
SELECT name, value FROM 0_sys_prefs

2024-08-14 19:54:52.723594
SELECT db_name FROM group_companies 
                WHERE default_company = 1 LIMIT 1

2024-08-14 19:54:52.725245
SELECT * FROM uke_db.0_employee_master WHERE employee_code='KTS016'

2024-08-14 19:54:52.727840
SELECT * FROM 0_fiscal_year WHERE id='17'

2024-08-14 19:54:52.752668
SELECT value FROM 0_sys_prefs WHERE name='website'

2024-08-14 19:54:52.798711
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='I_OWE_YOU'

2024-08-14 19:54:52.801585
SELECT id, value_code, value_name FROM 0_list_values  
		WHERE list_code= 'PETTY_CASH_TYPES' AND value_code='PETTY_CASH'

2024-08-14 19:55:00.130369
SELECT DISTINCT al.employee_code, al.company_code  
                FROM ( (SELECT DISTINCT iou.employee_code, iou.company_code 
            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 >= '2024-02-01' 
                    AND iou.tran_date <= '2024-08-05'
                    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) UNION (SELECT DISTINCT iou.employee_code, iou.company_code 
            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 >= '2024-02-01' 
                    AND b.tran_date <= '2024-08-05'
                    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) UNION (SELECT DISTINCT pet.employee_code, pet.company_code  
            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 >='2024-02-01' AND pet.tran_date <='2024-08-05' AND pet.batch_complete = 0  ORDER BY pet.id, pet.tran_date, p.payment_date, p.id) ) al 
                WHERE 1 = 1 
                ORDER BY al.employee_code

