2024-08-12 18:04:45.728489
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:04:45.739551
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:04:45.741483
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:04:45.761919
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:04:45.766533
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 30, 10

2024-08-12 18:04:53.377923
SELECT vopr.*,
                    pm.description project_description,
                    l.location_name,
                    u.real_name 
            FROM 0_vw_outstanding_purchase_requisitions vopr,
                    0_locations l,
                    0_projects_master pm,
                    0_user_data_access_groups as udag,
                    0_users u 
            WHERE po_no = '2650' AND 
                    vopr.location = l.loc_code AND 
                    vopr.project_id = pm.project_id AND 
                    pm.dag_id = udag.dag_id AND 
                    udag.user_id = '212' AND 
                    vopr.created_by = u.id 
            ORDER BY vopr.pr_no

2024-08-12 18:05:00.128295
SELECT * FROM 0_fiscal_year WHERE '2024-08-12' >= begin AND '2024-08-12' <= end AND closed=0

2024-08-12 18:05:00.141731
SELECT po.*, 
                    supp.supp_name,  
                    supp.curr_code, 
                    loc.location_name, 
                    pm.description project_description 
            FROM 0_purch_orders po, 
                    0_suppliers supp, 
                    0_locations loc, 
                    0_projects_master pm 
            WHERE po.supplier_id = supp.supplier_id
            AND loc.loc_code = into_stock_location
            AND pm.project_id = po.project_id    
            AND po.order_no = '2650'

2024-08-12 18:05:00.147664
SELECT t.sequence, t.add_to_price, t.name, t.id as tax_type_id, t.suspended, CONCAT(t.name, ' (', t.rate, '%)') as tax_type_name,t.sales_gl_code,
                t.purchasing_gl_code,
                IF(g.tax_type_id, t.rate, NULL) as rate                 
            FROM 0_tax_types t 
                    LEFT JOIN 0_tax_group_items g ON t.id=g.tax_type_id
                            AND g.tax_group_id='5' WHERE !t.inactive  ORDER BY t.sequence

2024-08-12 18:05:00.152087
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:05:00.154044
SELECT supp.supp_name, supp.curr_code, 0_payment_terms.terms,

		Sum(IFNULL((trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Balance,

		Sum(IF ((TO_DAYS('2024-08-12') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) >= 0,(trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Due,
		Sum(IF ((TO_DAYS('2024-08-12') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) >= 30,(trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Overdue1,
		Sum(IF ((TO_DAYS('2024-08-12') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) >= 60,(trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Overdue2,
		supp.credit_limit - Sum(IFNULL(IF(trans.type=21, -1, 1) 
			* (ov_amount + ov_gst + ov_discount),0)) as cur_credit,
		supp.tax_group_id

		FROM 0_suppliers supp
			 LEFT JOIN 0_supp_trans trans ON supp.supplier_id = trans.supplier_id AND trans.tran_date <= '2024-08-12',
			 0_payment_terms

		WHERE
			 supp.payment_terms = 0_payment_terms.terms_indicator
			 AND supp.supplier_id = 115 GROUP BY
			  supp.supp_name,
			  0_payment_terms.terms,
			  0_payment_terms.days_before_due,
			  0_payment_terms.day_in_following_month

2024-08-12 18:05:00.208444
 SELECT * FROM 0_purchase_requisitions 
                WHERE pr_no = 2244

2024-08-12 18:05:00.210078
SELECT pod.*, 
                    sm.units, sm.stock_control_method,
                    u.name tran_unit_name,
                    ps.description project_site_name,
                    prd.quantity pr_qty,
                    prd.issued_qty pr_issued_qty,
                    prd.id pr_line_id,
                    prd.requisition_id,
                    pr_po.id pr_po_line_id,
                    prd.task_id 
                FROM 0_purch_order_details pod 
                    LEFT JOIN 0_pr_po_details pr_po ON 
                        pod.po_detail_item = pr_po.po_line_id 
                    LEFT JOIN 0_purchase_requisition_details prd ON 
                        pr_po.pr_line_id = prd.id 
                    LEFT JOIN 0_stock_master sm ON 
                        pod.item_code= sm.stock_id 
                    LEFT JOIN 0_item_units u ON 
                        pod.order_unit= u.abbr   
                    LEFT JOIN 0_project_sites ps ON 
                        pod.project_site_id = ps.id   
                WHERE pod.order_no ='2650' AND 
                        (prd.requisition_id = '2244' OR prd.requisition_id IS NULL) ORDER BY pod.po_detail_item

2024-08-12 18:05:00.263477
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '115'
		AND stock_id = '9998'

2024-08-12 18:05:00.267767
SELECT 0_stock_master.*,0_item_tax_types.name AS tax_type_name
		FROM 0_stock_master,0_item_tax_types
		WHERE 0_item_tax_types.id=0_stock_master.tax_type_id
		AND stock_id='9998'

2024-08-12 18:05:00.270972
SELECT SUM(qty_issued) total_issued_qty  
            FROM 0_purchase_requistion_issue_details 
            WHERE pr_line_id = '7823'

2024-08-12 18:05:00.331274
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '115'
		AND stock_id = '9998'

2024-08-12 18:05:00.341815
SELECT 0_stock_master.*,0_item_tax_types.name AS tax_type_name
		FROM 0_stock_master,0_item_tax_types
		WHERE 0_item_tax_types.id=0_stock_master.tax_type_id
		AND stock_id='9998'

2024-08-12 18:05:00.345577
SELECT SUM(qty_issued) total_issued_qty  
            FROM 0_purchase_requistion_issue_details 
            WHERE pr_line_id = '7824'

2024-08-12 18:05:00.359837
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '115'
		AND stock_id = '9998'

2024-08-12 18:05:00.361300
SELECT 0_stock_master.*,0_item_tax_types.name AS tax_type_name
		FROM 0_stock_master,0_item_tax_types
		WHERE 0_item_tax_types.id=0_stock_master.tax_type_id
		AND stock_id='9998'

2024-08-12 18:05:00.362830
SELECT SUM(qty_issued) total_issued_qty  
            FROM 0_purchase_requistion_issue_details 
            WHERE pr_line_id = '7825'

2024-08-12 18:05:00.367512
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '115'
		AND stock_id = '9998'

2024-08-12 18:05:00.379649
SELECT 0_stock_master.*,0_item_tax_types.name AS tax_type_name
		FROM 0_stock_master,0_item_tax_types
		WHERE 0_item_tax_types.id=0_stock_master.tax_type_id
		AND stock_id='9998'

2024-08-12 18:05:00.391204
SELECT SUM(qty_issued) total_issued_qty  
            FROM 0_purchase_requistion_issue_details 
            WHERE pr_line_id = '7822'

2024-08-12 18:05:00.396083
SELECT next_reference FROM 0_sys_types WHERE type_id = '25'

2024-08-12 18:05:00.397503
SELECT project_id  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
            WHERE pm.project_id = '10' AND 
                    udag.user_id ='212'

2024-08-12 18:05:00.399194
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:05:00.401352
SELECT p.* 
            FROM 0_projects_master p 
            WHERE p.project_id ='10'

2024-08-12 18:05:00.402827
SELECT  ap.* 
                FROM 0_project_approval_paths pap, 
                        0_approval_path ap 
                WHERE pap.approval_path_id = ap.approval_path_id AND 
                        pap.project_id = '10' AND 
                        pap.approval_path_type = 'PO'

2024-08-12 18:05:00.415820
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6437

2024-08-12 18:05:00.429019
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6437

2024-08-12 18:05:00.433414
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='9998' LIMIT 1

2024-08-12 18:05:00.445322
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:05:00.447025
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='9998' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:05:00.465407
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '9998' AND au.inactive = 0 ORDER BY name

2024-08-12 18:05:00.478212
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='9998' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:05:00.479934
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6438

2024-08-12 18:05:00.483805
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6438

2024-08-12 18:05:00.487531
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='9998' LIMIT 1

2024-08-12 18:05:00.489525
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:05:00.490968
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='9998' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:05:00.493102
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '9998' AND au.inactive = 0 ORDER BY name

2024-08-12 18:05:00.495387
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='9998' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:05:00.496947
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6439

2024-08-12 18:05:00.505129
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6439

2024-08-12 18:05:00.511726
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='9998' LIMIT 1

2024-08-12 18:05:00.513145
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:05:00.514591
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='9998' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:05:00.516758
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '9998' AND au.inactive = 0 ORDER BY name

2024-08-12 18:05:00.519159
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='9998' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:05:00.520730
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6440

2024-08-12 18:05:00.524717
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6440

2024-08-12 18:05:00.528420
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='9998' LIMIT 1

2024-08-12 18:05:00.529772
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:05:00.531231
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='9998' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:05:00.533352
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '9998' AND au.inactive = 0 ORDER BY name

2024-08-12 18:05:00.535600
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='9998' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:05:00.537338
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='9998'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:05:00.538636
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:05:00.549349
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='9998'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:05:00.553286
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:05:00.554613
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='9998'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:05:00.556006
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:05:00.557347
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='9998'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:05:00.558686
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:05:00.560247
SELECT COUNT(*) FROM 0_supp_trans WHERE po_no = '2650'

2024-08-12 18:05:25.597808
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='9998' 

2024-08-12 18:05:25.600522
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='9998' 

2024-08-12 18:05:25.602482
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='9998' 

2024-08-12 18:05:25.604381
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='9998' 

2024-08-12 18:05:25.606346
SELECT project_id  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
            WHERE pm.project_id = '10' AND 
                    udag.user_id ='212'

2024-08-12 18:05:25.610345
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:05:25.612212
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:05:25.615340
SELECT p.* 
            FROM 0_projects_master p 
            WHERE p.project_id ='10'

2024-08-12 18:05:25.616579
SELECT  ap.* 
                FROM 0_project_approval_paths pap, 
                        0_approval_path ap 
                WHERE pap.approval_path_id = ap.approval_path_id AND 
                        pap.project_id = '10' AND 
                        pap.approval_path_type = 'PO'

2024-08-12 18:05:25.618055
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6437

2024-08-12 18:05:25.667720
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6437

2024-08-12 18:05:25.671656
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='9998' LIMIT 1

2024-08-12 18:05:25.676187
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:05:25.678846
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='9998' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:05:25.680857
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '9998' AND au.inactive = 0 ORDER BY name

2024-08-12 18:05:25.683168
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='9998' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:05:25.684580
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6438

2024-08-12 18:05:25.688191
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6438

2024-08-12 18:05:25.692829
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='9998' LIMIT 1

2024-08-12 18:05:25.694001
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:05:25.695243
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='9998' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:05:25.697147
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '9998' AND au.inactive = 0 ORDER BY name

2024-08-12 18:05:25.699109
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='9998' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:05:25.700433
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6439

2024-08-12 18:05:25.704060
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6439

2024-08-12 18:05:25.707695
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='9998' LIMIT 1

2024-08-12 18:05:25.708764
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:05:25.709928
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='9998' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:05:25.711839
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '9998' AND au.inactive = 0 ORDER BY name

2024-08-12 18:05:25.713827
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='9998' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:05:25.715132
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6440

2024-08-12 18:05:25.718628
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6440

2024-08-12 18:05:25.722156
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='9998' LIMIT 1

2024-08-12 18:05:25.723349
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:05:25.724559
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='9998' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:05:25.726469
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '9998' AND au.inactive = 0 ORDER BY name

2024-08-12 18:05:25.728465
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='9998' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:05:25.729999
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='9998'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:05:25.732610
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:05:25.733830
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='9998'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:05:25.734886
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:05:25.735941
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='9998'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:05:25.736954
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:05:25.738102
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='9998'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:05:25.739115
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:05:25.740407
SELECT COUNT(*) FROM 0_supp_trans WHERE po_no = '2650'

2024-08-12 18:05:33.320361
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='9998' 

2024-08-12 18:05:33.337959
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='9998' 

2024-08-12 18:05:33.362351
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='9998' 

2024-08-12 18:05:33.389946
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='9998' 

2024-08-12 18:05:33.419110
SELECT * FROM 0_fiscal_year WHERE '2024-08-12' >= begin AND '2024-08-12' <= end AND closed=0

2024-08-12 18:05:33.439657
SELECT reference FROM 0_grn_batch 
			LEFT JOIN 0_voided v ON 
				v.type='25' AND 0_grn_batch.id=v.id
			WHERE reference='3568' AND ISNULL(v.id)

2024-08-12 18:05:33.475031
SELECT po_detail_item, item_code, quantity_ordered, quantity_received, qty_invoiced
		FROM 0_purch_order_details
		WHERE order_no='2650' ORDER BY po_detail_item

2024-08-12 18:05:33.496563
 SELECT * FROM 0_purch_orders  
                WHERE order_no = '2650'

2024-08-12 18:05:33.509415
BEGIN

2024-08-12 18:05:33.510620
UPDATE 0_purch_orders 
                SET row_state = 6 
                WHERE order_no = '2650' 
                    AND row_state = '5'

2024-08-12 18:05:33.514812
UPDATE 0_purchase_requisitions
                SET approval_status = '60', row_state = '8' 
                WHERE pr_no = '2244' AND 
                        row_state = '7'

2024-08-12 18:05:33.526803
SELECT curr_code FROM 0_suppliers WHERE supplier_id = '115'

2024-08-12 18:05:33.539289
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:05:33.550774
INSERT INTO 0_grn_batch (
                    purch_order_no, delivery_date, 
                    supplier_id, reference, 
                    loc_code, pr_no,
                    project_id,
                    created_by, created_on)
			VALUES ('2650', '2024-08-12', '115', '3568', 'KATUN', '2244', '10', '212', '2024-08-12 18:05:33')

2024-08-12 18:05:33.564692
SELECT mb_flag, inventory_account, cogs_account,
		adjustment_account, sales_account, assembly_account, dimension_id, dimension2_id FROM
		0_stock_master WHERE stock_id = '9998'

2024-08-12 18:05:33.566062
SELECT stock_id FROM 0_stock_master
		WHERE stock_id='9998' AND mb_flag <> 'D'

2024-08-12 18:05:33.567175
SELECT * FROM 0_suppliers WHERE supplier_id='115'

2024-08-12 18:05:33.568427
SELECT (material_cost + labour_cost + overhead_cost) AS std_cost
		FROM 0_stock_master s WHERE stock_id='9998'

2024-08-12 18:05:33.569589
UPDATE 0_purch_data SET 
                        supplier_description='Marker Pen Black' 
            WHERE stock_id='9998' AND supplier_id='115'

2024-08-12 18:05:33.579557
INSERT INTO 0_grn_items (grn_batch_id, po_detail_item, 
                        item_code, description, qty_recd,
                        tran_unit, tran_qty, convertion_factor,
                        project_site_id, unit_cost,
                        original_tran_qty)
		VALUES ('3569', '6437', '9998', 'Marker Pen Black', '12','Nos', '12', '1','0', '135', '12')

2024-08-12 18:05:33.592124
SELECT SUM(qty_recd) total_quantity_received  
            FROM 0_grn_items   
            WHERE po_detail_item = '6437'

2024-08-12 18:05:33.648254
UPDATE 0_purch_order_details
                SET quantity_received = '12' 
                WHERE po_detail_item = '6437'

2024-08-12 18:05:33.661471
INSERT INTO 0_non_stock_moves (stock_id, trans_no, 
                    type, loc_code,
                    tran_date, person_id, 
                    reference, qty, 
                    standard_cost, visible, 
                    price, discount_percent, 
                    tran_unit, tran_qty, 
                    conversion_factor, task_id,
                    project_site_id, ref_line_id, 
                    item_description, project_id) 
            VALUES ('9998', '3569', '25','KATUN', '2024-08-12', '115', '3568', '12', '0','1', '135', '0','Nos', '12','1', '0', '0', '6437', 'Marker Pen Black', '10')

2024-08-12 18:05:33.681515
SELECT mb_flag, inventory_account, cogs_account,
		adjustment_account, sales_account, assembly_account, dimension_id, dimension2_id FROM
		0_stock_master WHERE stock_id = '9998'

2024-08-12 18:05:33.684301
SELECT stock_id FROM 0_stock_master
		WHERE stock_id='9998' AND mb_flag <> 'D'

2024-08-12 18:05:33.685403
SELECT * FROM 0_suppliers WHERE supplier_id='115'

2024-08-12 18:05:33.696679
SELECT (material_cost + labour_cost + overhead_cost) AS std_cost
		FROM 0_stock_master s WHERE stock_id='9998'

2024-08-12 18:05:33.717105
UPDATE 0_purch_data SET 
                        supplier_description='Clear File A4' 
            WHERE stock_id='9998' AND supplier_id='115'

2024-08-12 18:05:33.737340
INSERT INTO 0_grn_items (grn_batch_id, po_detail_item, 
                        item_code, description, qty_recd,
                        tran_unit, tran_qty, convertion_factor,
                        project_site_id, unit_cost,
                        original_tran_qty)
		VALUES ('3569', '6438', '9998', 'Clear File A4', '8','Nos', '8', '1','0', '135', '8')

2024-08-12 18:05:33.857829
SELECT SUM(qty_recd) total_quantity_received  
            FROM 0_grn_items   
            WHERE po_detail_item = '6438'

2024-08-12 18:05:33.925464
UPDATE 0_purch_order_details
                SET quantity_received = '8' 
                WHERE po_detail_item = '6438'

2024-08-12 18:05:33.958352
INSERT INTO 0_non_stock_moves (stock_id, trans_no, 
                    type, loc_code,
                    tran_date, person_id, 
                    reference, qty, 
                    standard_cost, visible, 
                    price, discount_percent, 
                    tran_unit, tran_qty, 
                    conversion_factor, task_id,
                    project_site_id, ref_line_id, 
                    item_description, project_id) 
            VALUES ('9998', '3569', '25','KATUN', '2024-08-12', '115', '3568', '8', '0','1', '135', '0','Nos', '8','1', '0', '0', '6438', 'Clear File A4', '10')

2024-08-12 18:05:33.970983
SELECT mb_flag, inventory_account, cogs_account,
		adjustment_account, sales_account, assembly_account, dimension_id, dimension2_id FROM
		0_stock_master WHERE stock_id = '9998'

2024-08-12 18:05:33.972209
SELECT stock_id FROM 0_stock_master
		WHERE stock_id='9998' AND mb_flag <> 'D'

2024-08-12 18:05:33.977469
SELECT * FROM 0_suppliers WHERE supplier_id='115'

2024-08-12 18:05:33.989023
SELECT (material_cost + labour_cost + overhead_cost) AS std_cost
		FROM 0_stock_master s WHERE stock_id='9998'

2024-08-12 18:05:34.212
UPDATE 0_purch_data SET 
                        supplier_description='Separators 1-10' 
            WHERE stock_id='9998' AND supplier_id='115'

2024-08-12 18:05:34.22002
INSERT INTO 0_grn_items (grn_batch_id, po_detail_item, 
                        item_code, description, qty_recd,
                        tran_unit, tran_qty, convertion_factor,
                        project_site_id, unit_cost,
                        original_tran_qty)
		VALUES ('3569', '6439', '9998', 'Separators 1-10', '8','Nos', '8', '1','0', '495', '8')

2024-08-12 18:05:34.42888
SELECT SUM(qty_recd) total_quantity_received  
            FROM 0_grn_items   
            WHERE po_detail_item = '6439'

2024-08-12 18:05:34.64864
UPDATE 0_purch_order_details
                SET quantity_received = '8' 
                WHERE po_detail_item = '6439'

2024-08-12 18:05:34.104323
INSERT INTO 0_non_stock_moves (stock_id, trans_no, 
                    type, loc_code,
                    tran_date, person_id, 
                    reference, qty, 
                    standard_cost, visible, 
                    price, discount_percent, 
                    tran_unit, tran_qty, 
                    conversion_factor, task_id,
                    project_site_id, ref_line_id, 
                    item_description, project_id) 
            VALUES ('9998', '3569', '25','KATUN', '2024-08-12', '115', '3568', '8', '0','1', '495', '0','Nos', '8','1', '0', '0', '6439', 'Separators 1-10', '10')

2024-08-12 18:05:34.120930
SELECT mb_flag, inventory_account, cogs_account,
		adjustment_account, sales_account, assembly_account, dimension_id, dimension2_id FROM
		0_stock_master WHERE stock_id = '9998'

2024-08-12 18:05:34.141607
SELECT stock_id FROM 0_stock_master
		WHERE stock_id='9998' AND mb_flag <> 'D'

2024-08-12 18:05:34.162439
SELECT * FROM 0_suppliers WHERE supplier_id='115'

2024-08-12 18:05:34.171732
SELECT (material_cost + labour_cost + overhead_cost) AS std_cost
		FROM 0_stock_master s WHERE stock_id='9998'

2024-08-12 18:05:34.185021
UPDATE 0_purch_data SET 
                        supplier_description='A4 BUNDLE (80gms)' 
            WHERE stock_id='9998' AND supplier_id='115'

2024-08-12 18:05:34.206541
INSERT INTO 0_grn_items (grn_batch_id, po_detail_item, 
                        item_code, description, qty_recd,
                        tran_unit, tran_qty, convertion_factor,
                        project_site_id, unit_cost,
                        original_tran_qty)
		VALUES ('3569', '6440', '9998', 'A4 BUNDLE (80gms)', '10','Nos', '10', '1','0', '1845', '10')

2024-08-12 18:05:34.226507
SELECT SUM(qty_recd) total_quantity_received  
            FROM 0_grn_items   
            WHERE po_detail_item = '6440'

2024-08-12 18:05:34.249024
UPDATE 0_purch_order_details
                SET quantity_received = '10' 
                WHERE po_detail_item = '6440'

2024-08-12 18:05:34.271204
INSERT INTO 0_non_stock_moves (stock_id, trans_no, 
                    type, loc_code,
                    tran_date, person_id, 
                    reference, qty, 
                    standard_cost, visible, 
                    price, discount_percent, 
                    tran_unit, tran_qty, 
                    conversion_factor, task_id,
                    project_site_id, ref_line_id, 
                    item_description, project_id) 
            VALUES ('9998', '3569', '25','KATUN', '2024-08-12', '115', '3568', '10', '0','1', '1845', '0','Nos', '10','1', '0', '0', '6440', 'A4 BUNDLE (80gms)', '10')

2024-08-12 18:05:34.293207
REPLACE 0_refs SET reference='3568', type='25', id='3569'

2024-08-12 18:05:34.316379
SELECT next_reference FROM 0_sys_types WHERE type_id = '25'

2024-08-12 18:05:34.339010
UPDATE 0_sys_types SET next_reference='3569' WHERE type_id = '25'

2024-08-12 18:05:34.340939
INSERT INTO 0_audit_trail (type, trans_no, user, fiscal_year, gl_date, description, gl_seq)
			VALUES('25', '3569',212,17,'2024-08-12','', 0)

2024-08-12 18:05:34.354586
UPDATE 0_audit_trail SET gl_seq = NULL WHERE type='25' AND trans_no='3569' AND id!=77413

2024-08-12 18:05:34.379432
COMMIT

2024-08-12 18:05:38.158534
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:05:39.183677
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:05:43.419847
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:05:57.109502
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:05:57.279851
SELECT DISTINCT 0_grn_batch.*, 0_suppliers.supp_name,0_suppliers.supp_address,  0_suppliers.supp_account_no,0_suppliers.tax_included,0_suppliers.gst_no AS tax_id,
                    0_suppliers.curr_code, 0_suppliers.payment_terms, 0_locations.location_name
                    , 0_locations.delivery_address,
                    0_suppliers.supp_address address, 0_suppliers.contact, 0_suppliers.tax_group_id,0_users.real_name
            FROM 0_grn_batch, 0_suppliers, 0_grn_items, 0_users, 0_locations
            WHERE 0_grn_batch.supplier_id = 0_suppliers.supplier_id
                AND 0_locations.loc_code = 0_grn_batch.loc_code AND  0_grn_items.grn_batch_id= 0_grn_batch.id                
                AND 0_users.id = 0_grn_batch.created_by 
                AND 0_grn_batch.id = '3569'

2024-08-12 18:05:57.297783
SELECT b.*, b.bank_curr_code='LKR' as fall_back FROM 0_bank_accounts b WHERE b.bank_curr_code='LKR' OR b.bank_curr_code='LKR'
		ORDER BY fall_back, dflt_curr_act desc

2024-08-12 18:05:57.312404
SELECT * FROM 0_fiscal_year WHERE id='17'

2024-08-12 18:05:57.314003
SELECT t.*, p.*, r.id as contact_id FROM 0_crm_persons p,0_crm_categories t, 0_crm_contacts r WHERE r.type=t.type AND r.action=t.action AND r.person_id=p.id AND t.type='supplier' AND t.action='order' AND r.entity_id='115' ORDER BY contact_id

2024-08-12 18:05:57.328157
SELECT t.*, p.*, r.id as contact_id FROM 0_crm_persons p,0_crm_categories t, 0_crm_contacts r WHERE r.type=t.type AND r.action=t.action AND r.person_id=p.id AND t.type='supplier' AND t.action='general' AND r.entity_id='115' ORDER BY contact_id

2024-08-12 18:05:57.417032
SELECT 0_grn_items.*, units,pod.order_unit_price,pod.order_unit_price_discount
		FROM 0_grn_items
		LEFT JOIN 0_stock_master
		ON 0_grn_items.item_code=0_stock_master.stock_id
                LEFT JOIN 0_purch_order_details pod ON
                    0_grn_items.po_detail_item=pod.po_detail_item
		WHERE 0_grn_items.grn_batch_id ='3569' 

2024-08-12 18:05:57.430640
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '115'
		AND stock_id = '9998'

2024-08-12 18:05:57.433907
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '115'
		AND stock_id = '9998'

2024-08-12 18:05:57.436853
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '115'
		AND stock_id = '9998'

2024-08-12 18:05:57.439847
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '115'
		AND stock_id = '9998'

2024-08-12 18:05:57.448541
SELECT printer FROM 0_print_profiles WHERE profile='' AND report='250'

2024-08-12 18:05:57.452200
SELECT printer FROM 0_print_profiles WHERE profile='' AND report=''

2024-08-12 18:08:03.673788
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:08:11.367525
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:08:11.387315
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:08:11.417103
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:08:11.446520
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:08:11.462321
SELECT COUNT(DISTINCT porder.order_no) FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12')

2024-08-12 18:08:11.475870
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 0, 10

2024-08-12 18:08:12.231567
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:08:12.247201
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:08:12.260774
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:08:12.276730
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:08:12.297720
SELECT COUNT(DISTINCT porder.order_no) FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12')

2024-08-12 18:08:12.317268
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 0, 10

2024-08-12 18:08:24.517536
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:08:24.519480
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:08:24.521474
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:08:24.533823
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:08:24.535968
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 10, 10

2024-08-12 18:08:27.477567
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:08:27.490823
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:08:27.512469
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:08:27.543581
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:08:27.564266
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 40, 10

2024-08-12 18:08:42.207971
SELECT vopr.*,
                    pm.description project_description,
                    l.location_name,
                    u.real_name 
            FROM 0_vw_outstanding_purchase_requisitions vopr,
                    0_locations l,
                    0_projects_master pm,
                    0_user_data_access_groups as udag,
                    0_users u 
            WHERE po_no = '2654' AND 
                    vopr.location = l.loc_code AND 
                    vopr.project_id = pm.project_id AND 
                    pm.dag_id = udag.dag_id AND 
                    udag.user_id = '212' AND 
                    vopr.created_by = u.id 
            ORDER BY vopr.pr_no

2024-08-12 18:08:45.654506
SELECT * FROM 0_fiscal_year WHERE '2024-08-12' >= begin AND '2024-08-12' <= end AND closed=0

2024-08-12 18:08:45.665903
SELECT po.*, 
                    supp.supp_name,  
                    supp.curr_code, 
                    loc.location_name, 
                    pm.description project_description 
            FROM 0_purch_orders po, 
                    0_suppliers supp, 
                    0_locations loc, 
                    0_projects_master pm 
            WHERE po.supplier_id = supp.supplier_id
            AND loc.loc_code = into_stock_location
            AND pm.project_id = po.project_id    
            AND po.order_no = '2654'

2024-08-12 18:08:45.672249
SELECT t.sequence, t.add_to_price, t.name, t.id as tax_type_id, t.suspended, CONCAT(t.name, ' (', t.rate, '%)') as tax_type_name,t.sales_gl_code,
                t.purchasing_gl_code,
                IF(g.tax_type_id, t.rate, NULL) as rate                 
            FROM 0_tax_types t 
                    LEFT JOIN 0_tax_group_items g ON t.id=g.tax_type_id
                            AND g.tax_group_id='18' WHERE !t.inactive  ORDER BY t.sequence

2024-08-12 18:08:45.692086
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:08:45.695254
SELECT supp.supp_name, supp.curr_code, 0_payment_terms.terms,

		Sum(IFNULL((trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Balance,

		Sum(IF ((TO_DAYS('2024-08-12') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) >= 0,(trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Due,
		Sum(IF ((TO_DAYS('2024-08-12') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) >= 30,(trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Overdue1,
		Sum(IF ((TO_DAYS('2024-08-12') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) >= 60,(trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Overdue2,
		supp.credit_limit - Sum(IFNULL(IF(trans.type=21, -1, 1) 
			* (ov_amount + ov_gst + ov_discount),0)) as cur_credit,
		supp.tax_group_id

		FROM 0_suppliers supp
			 LEFT JOIN 0_supp_trans trans ON supp.supplier_id = trans.supplier_id AND trans.tran_date <= '2024-08-12',
			 0_payment_terms

		WHERE
			 supp.payment_terms = 0_payment_terms.terms_indicator
			 AND supp.supplier_id = 78 GROUP BY
			  supp.supp_name,
			  0_payment_terms.terms,
			  0_payment_terms.days_before_due,
			  0_payment_terms.day_in_following_month

2024-08-12 18:08:45.751898
 SELECT * FROM 0_purchase_requisitions 
                WHERE pr_no = 2175

2024-08-12 18:08:45.753506
SELECT pod.*, 
                    sm.units, sm.stock_control_method,
                    u.name tran_unit_name,
                    ps.description project_site_name,
                    prd.quantity pr_qty,
                    prd.issued_qty pr_issued_qty,
                    prd.id pr_line_id,
                    prd.requisition_id,
                    pr_po.id pr_po_line_id,
                    prd.task_id 
                FROM 0_purch_order_details pod 
                    LEFT JOIN 0_pr_po_details pr_po ON 
                        pod.po_detail_item = pr_po.po_line_id 
                    LEFT JOIN 0_purchase_requisition_details prd ON 
                        pr_po.pr_line_id = prd.id 
                    LEFT JOIN 0_stock_master sm ON 
                        pod.item_code= sm.stock_id 
                    LEFT JOIN 0_item_units u ON 
                        pod.order_unit= u.abbr   
                    LEFT JOIN 0_project_sites ps ON 
                        pod.project_site_id = ps.id   
                WHERE pod.order_no ='2654' AND 
                        (prd.requisition_id = '2175' OR prd.requisition_id IS NULL) ORDER BY pod.po_detail_item

2024-08-12 18:08:45.792602
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '78'
		AND stock_id = '10831'

2024-08-12 18:08:45.807140
SELECT 0_stock_master.*,0_item_tax_types.name AS tax_type_name
		FROM 0_stock_master,0_item_tax_types
		WHERE 0_item_tax_types.id=0_stock_master.tax_type_id
		AND stock_id='10831'

2024-08-12 18:08:45.810904
SELECT SUM(qty_issued) total_issued_qty  
            FROM 0_purchase_requistion_issue_details 
            WHERE pr_line_id = '7630'

2024-08-12 18:08:45.884683
SELECT next_reference FROM 0_sys_types WHERE type_id = '25'

2024-08-12 18:08:45.893231
SELECT project_id  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
            WHERE pm.project_id = '10' AND 
                    udag.user_id ='212'

2024-08-12 18:08:45.895225
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:08:45.897476
SELECT p.* 
            FROM 0_projects_master p 
            WHERE p.project_id ='10'

2024-08-12 18:08:45.899006
SELECT  ap.* 
                FROM 0_project_approval_paths pap, 
                        0_approval_path ap 
                WHERE pap.approval_path_id = ap.approval_path_id AND 
                        pap.project_id = '10' AND 
                        pap.approval_path_type = 'PO'

2024-08-12 18:08:45.904395
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6449

2024-08-12 18:08:45.910187
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6449

2024-08-12 18:08:45.923206
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='10831' LIMIT 1

2024-08-12 18:08:45.931717
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:08:45.948111
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='10831' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:08:45.980572
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '10831' AND au.inactive = 0 ORDER BY name

2024-08-12 18:08:45.983036
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='10831' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:08:45.984703
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='10831'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:08:45.985981
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:08:45.990242
SELECT COUNT(*) FROM 0_supp_trans WHERE po_no = '2654'

2024-08-12 18:08:55.812019
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='10831' 

2024-08-12 18:08:55.814803
SELECT project_id  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
            WHERE pm.project_id = '10' AND 
                    udag.user_id ='212'

2024-08-12 18:08:55.818303
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:08:55.821139
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:08:55.824169
SELECT p.* 
            FROM 0_projects_master p 
            WHERE p.project_id ='10'

2024-08-12 18:08:55.826407
SELECT  ap.* 
                FROM 0_project_approval_paths pap, 
                        0_approval_path ap 
                WHERE pap.approval_path_id = ap.approval_path_id AND 
                        pap.project_id = '10' AND 
                        pap.approval_path_type = 'PO'

2024-08-12 18:08:55.828152
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6449

2024-08-12 18:08:55.851448
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6449

2024-08-12 18:08:55.855689
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='10831' LIMIT 1

2024-08-12 18:08:55.857017
SELECT id, description  FROM 0_project_sites WHERE project_id = '10' ORDER BY description

2024-08-12 18:08:55.858378
SELECT id, alternate_unit, convertion_factor 
            FROM 0_alternate_units 
            WHERE stock_id='10831' AND
                       alternate_unit = 'Nos' 

2024-08-12 18:08:55.860556
SELECT au.alternate_unit, iu.name 
                FROM 0_alternate_units au,
                        0_item_units iu  
                WHERE au.alternate_unit = iu.abbr AND 
                        au.stock_id = '10831' AND au.inactive = 0 ORDER BY name

2024-08-12 18:08:55.862665
SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals, stock_control_method , minimum_price 
		FROM 0_stock_master,0_item_units
		WHERE stock_id='10831' AND 0_stock_master.units=0_item_units.abbr

2024-08-12 18:08:55.864314
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='10831'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:08:55.865553
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:08:55.867094
SELECT COUNT(*) FROM 0_supp_trans WHERE po_no = '2654'

2024-08-12 18:11:49.356813
SELECT convertion_factor 
            FROM 0_alternate_units WHERE alternate_unit='Nos' AND
                            stock_id='10831' 

2024-08-12 18:11:49.369046
SELECT * FROM 0_fiscal_year WHERE '2024-08-12' >= begin AND '2024-08-12' <= end AND closed=0

2024-08-12 18:11:49.371743
SELECT reference FROM 0_grn_batch 
			LEFT JOIN 0_voided v ON 
				v.type='25' AND 0_grn_batch.id=v.id
			WHERE reference='3569' AND ISNULL(v.id)

2024-08-12 18:11:49.387399
SELECT po_detail_item, item_code, quantity_ordered, quantity_received, qty_invoiced
		FROM 0_purch_order_details
		WHERE order_no='2654' ORDER BY po_detail_item

2024-08-12 18:11:49.392283
 SELECT * FROM 0_purch_orders  
                WHERE order_no = '2654'

2024-08-12 18:11:49.396080
BEGIN

2024-08-12 18:11:49.397237
UPDATE 0_purch_orders 
                SET row_state = 6 
                WHERE order_no = '2654' 
                    AND row_state = '5'

2024-08-12 18:11:49.399969
UPDATE 0_purchase_requisitions
                SET approval_status = '60', row_state = '30' 
                WHERE pr_no = '2175' AND 
                        row_state = '29'

2024-08-12 18:11:49.403056
SELECT curr_code FROM 0_suppliers WHERE supplier_id = '78'

2024-08-12 18:11:49.404969
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:11:49.406793
INSERT INTO 0_grn_batch (
                    purch_order_no, delivery_date, 
                    supplier_id, reference, 
                    loc_code, pr_no,
                    project_id,
                    created_by, created_on)
			VALUES ('2654', '2024-08-12', '78', '3569', 'KATUN', '2175', '10', '212', '2024-08-12 18:11:49')

2024-08-12 18:11:49.412569
SELECT mb_flag, inventory_account, cogs_account,
		adjustment_account, sales_account, assembly_account, dimension_id, dimension2_id FROM
		0_stock_master WHERE stock_id = '10831'

2024-08-12 18:11:49.416541
SELECT stock_id FROM 0_stock_master
		WHERE stock_id='10831' AND mb_flag <> 'D'

2024-08-12 18:11:49.417683
SELECT * FROM 0_suppliers WHERE supplier_id='78'

2024-08-12 18:11:49.418904
SELECT stock_id FROM 0_stock_master
		WHERE stock_id='10831' AND mb_flag <> 'D'

2024-08-12 18:11:49.420054
SELECT SUM(qty) FROM 0_stock_moves
            WHERE stock_id='10831'

2024-08-12 18:11:49.482817
SELECT mb_flag, material_cost, labour_cost, overhead_cost FROM 0_stock_master WHERE stock_id='10831'

2024-08-12 18:11:49.484253
SELECT SUM(qty) FROM 0_stock_moves
            WHERE stock_id='10831'

2024-08-12 18:11:49.485736
UPDATE 0_stock_master SET material_cost='63.082237076015'
		WHERE stock_id='10831'

2024-08-12 18:11:49.486832
SELECT (material_cost + labour_cost + overhead_cost) AS std_cost
		FROM 0_stock_master s WHERE stock_id='10831'

2024-08-12 18:11:49.487953
UPDATE 0_purch_data SET 
                        supplier_description='PAPER CUTTER BLADE SET' 
            WHERE stock_id='10831' AND supplier_id='78'

2024-08-12 18:11:49.491072
INSERT INTO 0_grn_items (grn_batch_id, po_detail_item, 
                        item_code, description, qty_recd,
                        tran_unit, tran_qty, convertion_factor,
                        project_site_id, unit_cost,
                        original_tran_qty)
		VALUES ('3570', '6449', '10831', 'PAPER CUTTER BLADE SET', '10','Nos', '10', '1','0', '120', '10')

2024-08-12 18:11:49.495327
SELECT SUM(qty_recd) total_quantity_received  
            FROM 0_grn_items   
            WHERE po_detail_item = '6449'

2024-08-12 18:11:49.535941
UPDATE 0_purch_order_details
                SET quantity_received = '10' 
                WHERE po_detail_item = '6449'

2024-08-12 18:11:49.537726
INSERT INTO 0_stock_moves (stock_id, trans_no, 
                    type, loc_code,
                    tran_date, person_id, 
                    reference, qty, 
                    standard_cost, visible, 
                    price, discount_percent, 
                    tran_unit, tran_qty, 
                    convertion_factor, task_id,
                    project_site_id, ref_line_id,
                    project_id) 
            VALUES ('10831', '3570', '25','KATUN', '2024-08-12', '78', '', '10', '63.082237076015','1', '120', '','Nos', '10','1', '0', '0','6449', '10')

2024-08-12 18:11:49.539823
REPLACE 0_refs SET reference='3569', type='25', id='3570'

2024-08-12 18:11:49.542331
SELECT next_reference FROM 0_sys_types WHERE type_id = '25'

2024-08-12 18:11:49.544963
UPDATE 0_sys_types SET next_reference='3570' WHERE type_id = '25'

2024-08-12 18:11:49.546213
INSERT INTO 0_audit_trail (type, trans_no, user, fiscal_year, gl_date, description, gl_seq)
			VALUES('25', '3570',212,17,'2024-08-12','', 0)

2024-08-12 18:11:49.551257
UPDATE 0_audit_trail SET gl_seq = NULL WHERE type='25' AND trans_no='3570' AND id!=77420

2024-08-12 18:11:49.560675
COMMIT

2024-08-12 18:11:54.824869
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:11:55.828492
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:11:59.821432
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:12:16.472715
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:12:16.522224
SELECT DISTINCT 0_grn_batch.*, 0_suppliers.supp_name,0_suppliers.supp_address,  0_suppliers.supp_account_no,0_suppliers.tax_included,0_suppliers.gst_no AS tax_id,
                    0_suppliers.curr_code, 0_suppliers.payment_terms, 0_locations.location_name
                    , 0_locations.delivery_address,
                    0_suppliers.supp_address address, 0_suppliers.contact, 0_suppliers.tax_group_id,0_users.real_name
            FROM 0_grn_batch, 0_suppliers, 0_grn_items, 0_users, 0_locations
            WHERE 0_grn_batch.supplier_id = 0_suppliers.supplier_id
                AND 0_locations.loc_code = 0_grn_batch.loc_code AND  0_grn_items.grn_batch_id= 0_grn_batch.id                
                AND 0_users.id = 0_grn_batch.created_by 
                AND 0_grn_batch.id = '3570'

2024-08-12 18:12:16.532636
SELECT b.*, b.bank_curr_code='LKR' as fall_back FROM 0_bank_accounts b WHERE b.bank_curr_code='LKR' OR b.bank_curr_code='LKR'
		ORDER BY fall_back, dflt_curr_act desc

2024-08-12 18:12:16.536389
SELECT * FROM 0_fiscal_year WHERE id='17'

2024-08-12 18:12:16.537725
SELECT t.*, p.*, r.id as contact_id FROM 0_crm_persons p,0_crm_categories t, 0_crm_contacts r WHERE r.type=t.type AND r.action=t.action AND r.person_id=p.id AND t.type='supplier' AND t.action='order' AND r.entity_id='78' ORDER BY contact_id

2024-08-12 18:12:16.544136
SELECT t.*, p.*, r.id as contact_id FROM 0_crm_persons p,0_crm_categories t, 0_crm_contacts r WHERE r.type=t.type AND r.action=t.action AND r.person_id=p.id AND t.type='supplier' AND t.action='general' AND r.entity_id='78' ORDER BY contact_id

2024-08-12 18:12:16.576903
SELECT 0_grn_items.*, units,pod.order_unit_price,pod.order_unit_price_discount
		FROM 0_grn_items
		LEFT JOIN 0_stock_master
		ON 0_grn_items.item_code=0_stock_master.stock_id
                LEFT JOIN 0_purch_order_details pod ON
                    0_grn_items.po_detail_item=pod.po_detail_item
		WHERE 0_grn_items.grn_batch_id ='3570' 

2024-08-12 18:12:16.580450
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '78'
		AND stock_id = '10831'

2024-08-12 18:12:16.588982
SELECT printer FROM 0_print_profiles WHERE profile='' AND report='250'

2024-08-12 18:12:16.591500
SELECT printer FROM 0_print_profiles WHERE profile='' AND report=''

2024-08-12 18:12:51.307761
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:12:52.361949
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:12:54.847768
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:12:54.895600
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:12:54.917271
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:12:54.957726
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:12:54.974544
SELECT COUNT(DISTINCT porder.order_no) FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12')

2024-08-12 18:12:55.70077
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 0, 10

2024-08-12 18:12:56.309672
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:12:56.311653
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:12:56.313619
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:12:56.327416
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:12:56.341701
SELECT COUNT(DISTINCT porder.order_no) FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12')

2024-08-12 18:12:56.358351
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 0, 10

2024-08-12 18:13:01.223472
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:13:01.236536
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:13:01.256029
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:13:01.286382
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:13:01.320167
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 40, 10

2024-08-12 18:13:05.111205
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:13:05.123248
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:13:05.134325
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:13:05.158399
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:13:05.181165
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 30, 10

2024-08-12 18:13:19.273045
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:13:19.275929
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:13:19.278133
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:13:19.291183
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:13:19.293352
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 40, 10

2024-08-12 18:14:05.5799
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:14:05.9548
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:14:05.12466
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:14:05.35326
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:14:05.39391
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 30, 10

2024-08-12 18:14:18.603168
SELECT po.*, 
                    supp.supp_name,  
                    supp.curr_code, 
                    loc.location_name, 
                    pm.description project_description 
            FROM 0_purch_orders po, 
                    0_suppliers supp, 
                    0_locations loc, 
                    0_projects_master pm 
            WHERE po.supplier_id = supp.supplier_id
            AND loc.loc_code = into_stock_location
            AND pm.project_id = po.project_id    
            AND po.order_no = '2651'

2024-08-12 18:14:18.612981
SELECT t.sequence, t.add_to_price, t.name, t.id as tax_type_id, t.suspended, CONCAT(t.name, ' (', t.rate, '%)') as tax_type_name,t.sales_gl_code,
                t.purchasing_gl_code,
                IF(g.tax_type_id, t.rate, NULL) as rate                 
            FROM 0_tax_types t 
                    LEFT JOIN 0_tax_group_items g ON t.id=g.tax_type_id
                            AND g.tax_group_id='5' WHERE !t.inactive  ORDER BY t.sequence

2024-08-12 18:14:18.617811
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:14:18.619780
SELECT supp.supp_name, supp.curr_code, 0_payment_terms.terms,

		Sum(IFNULL((trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Balance,

		Sum(IF ((TO_DAYS('2024-08-12') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) >= 0,(trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Due,
		Sum(IF ((TO_DAYS('2024-08-12') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) >= 30,(trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Overdue1,
		Sum(IF ((TO_DAYS('2024-08-12') - TO_DAYS(IF (trans.type=20 OR trans.type=21,trans.due_date,trans.tran_date))) >= 60,(trans.ov_amount + trans.ov_gst + trans.ov_discount),0)) AS Overdue2,
		supp.credit_limit - Sum(IFNULL(IF(trans.type=21, -1, 1) 
			* (ov_amount + ov_gst + ov_discount),0)) as cur_credit,
		supp.tax_group_id

		FROM 0_suppliers supp
			 LEFT JOIN 0_supp_trans trans ON supp.supplier_id = trans.supplier_id AND trans.tran_date <= '2024-08-12',
			 0_payment_terms

		WHERE
			 supp.payment_terms = 0_payment_terms.terms_indicator
			 AND supp.supplier_id = 393 GROUP BY
			  supp.supp_name,
			  0_payment_terms.terms,
			  0_payment_terms.days_before_due,
			  0_payment_terms.day_in_following_month

2024-08-12 18:14:18.635232
SELECT pod.*, 
                    sm.units, sm.stock_control_method,
                    u.name tran_unit_name,
                    ps.description project_site_name,
                    0 pr_qty,
                    0 pr_issued_qty,
                    0 pr_line_id,
                    0 requisition_id,
                    0 pr_po_line_id,
                    0 task_id  
                FROM 0_purch_order_details pod 
                    LEFT JOIN 0_stock_master sm ON 
                        pod.item_code= sm.stock_id 
                    LEFT JOIN 0_item_units u ON 
                        pod.order_unit= u.abbr   
                    LEFT JOIN 0_project_sites ps ON 
                        pod.project_site_id = ps.id   
                WHERE pod.order_no ='2651' ORDER BY pod.po_detail_item

2024-08-12 18:14:18.640365
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '393'
		AND stock_id = '10814'

2024-08-12 18:14:18.643355
SELECT 0_stock_master.*,0_item_tax_types.name AS tax_type_name
		FROM 0_stock_master,0_item_tax_types
		WHERE 0_item_tax_types.id=0_stock_master.tax_type_id
		AND stock_id='10814'

2024-08-12 18:14:18.646481
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '393'
		AND stock_id = '10815'

2024-08-12 18:14:18.647850
SELECT 0_stock_master.*,0_item_tax_types.name AS tax_type_name
		FROM 0_stock_master,0_item_tax_types
		WHERE 0_item_tax_types.id=0_stock_master.tax_type_id
		AND stock_id='10815'

2024-08-12 18:14:18.649423
SELECT * FROM 0_purch_data 
		WHERE supplier_id = '393'
		AND stock_id = '10816'

2024-08-12 18:14:18.650722
SELECT 0_stock_master.*,0_item_tax_types.name AS tax_type_name
		FROM 0_stock_master,0_item_tax_types
		WHERE 0_item_tax_types.id=0_stock_master.tax_type_id
		AND stock_id='10816'

2024-08-12 18:14:18.652247
SELECT project_id  
            FROM 0_projects_master pm 
                    INNER JOIN 0_user_data_access_groups udag ON
                            pm.dag_id = udag.dag_id  
            WHERE pm.project_id = '10' AND 
                    udag.user_id ='212'

2024-08-12 18:14:18.655603
SELECT location_name FROM 0_locations WHERE loc_code='KATUN'

2024-08-12 18:14:18.656848
SELECT * FROM 0_tax_groups WHERE id='5'

2024-08-12 18:14:18.659710
SELECT *, (t.days_before_due=0) AND (t.day_in_following_month=0) as cash_sale
	 FROM 0_payment_terms t WHERE terms_indicator='2'

2024-08-12 18:14:18.661433
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6443

2024-08-12 18:14:18.717199
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6443

2024-08-12 18:14:18.721291
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='10814' LIMIT 1

2024-08-12 18:14:18.722698
SELECT name 
            FROM 0_item_units WHERE abbr='Nos' 

2024-08-12 18:14:18.724244
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6444

2024-08-12 18:14:18.727892
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6444

2024-08-12 18:14:18.731678
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='10815' LIMIT 1

2024-08-12 18:14:18.732975
SELECT name 
            FROM 0_item_units WHERE abbr='Nos' 

2024-08-12 18:14:18.734426
SELECT DISTINCT prd.id, prd.requisition_id 
            FROM 0_pr_po_details pr_po 
                JOIN 0_purchase_requisition_details prd 
                    ON prd.id = pr_po.pr_line_id 
            WHERE pr_po.po_line_id = 6445

2024-08-12 18:14:18.738129
SELECT id allocation_id
            FROM 0_pr_po_details pr_po 
            WHERE 
                po_line_id = 6445

2024-08-12 18:14:18.742155
SELECT decimals FROM 0_item_units,	0_stock_master
		WHERE abbr=units AND stock_id='10816' LIMIT 1

2024-08-12 18:14:18.743486
SELECT name 
            FROM 0_item_units WHERE abbr='Nos' 

2024-08-12 18:14:18.745079
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='10814'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:14:18.746347
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:14:18.749261
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='10815'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:14:18.750717
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:14:18.752068
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='10816'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:14:18.753368
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:14:18.754751
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='10814'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:14:18.756057
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:14:18.757448
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='10815'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:14:18.758859
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:14:18.760301
SELECT 0_item_tax_types.* FROM 0_item_tax_types,0_stock_master WHERE 
		0_stock_master.stock_id='10816'
		AND 0_item_tax_types.id=0_stock_master.tax_type_id

2024-08-12 18:14:18.761629
SELECT * FROM 0_item_tax_type_exemptions WHERE item_tax_type_id='3'

2024-08-12 18:14:18.763103
SELECT * FROM 0_grn_batch WHERE purch_order_no='2651'

2024-08-12 18:14:18.766715
SELECT DISTINCT 0_supp_trans.trans_no, 
                            0_supp_trans.type,
                            ov_amount+ov_discount+ov_gst AS Total,
                            0_supp_trans.tran_date
		FROM 0_supp_trans, 
                0_supp_invoice_items, 
                0_purch_order_details, 
                0_purch_orders
		WHERE 0_supp_invoice_items.supp_trans_no = 0_supp_trans.trans_no
		AND 0_supp_invoice_items.supp_trans_type = 0_supp_trans.type
		AND 0_supp_invoice_items.po_detail_item_id = 0_purch_order_details.po_detail_item
		AND 0_purch_orders.supplier_id = 0_supp_trans.supplier_id
		AND 0_purch_orders.order_no = 0_purch_order_details.order_no
		AND 0_purch_order_details.order_no = '2651'

2024-08-12 18:14:18.770842
SELECT
		trans.type,
		trans.trans_no,
		IF(trans.supp_reference='',trans.reference,trans.supp_reference) as reference,
 		trans.tran_date,
		supplier.supp_name, 
		supplier.curr_code, 
		ov_amount+ov_gst+ov_discount AS Total,
		trans.alloc,
		trans.due_date,
		trans.supplier_id,
		supplier.address,
		amt,
                date_alloc, 
		supp_reference
	 FROM  0_supp_trans as trans,0_suppliers as supplier,0_supp_allocations as alloc
	 WHERE trans.supplier_id=supplier.supplier_id
			AND trans.trans_no = alloc.trans_no_from
			AND trans.type = alloc.trans_type_from  AND alloc.trans_no_to='2651'
		  		  AND alloc.trans_type_to='18' ORDER BY due_date

2024-08-12 18:14:18.795028
SELECT DISTINCT * FROM 0_attachments WHERE type_no='18' AND trans_no='2651'

2024-08-12 18:14:18.798011
SELECT * FROM 0_attachments WHERE type_no='18' AND trans_no='2651' ORDER BY trans_no

2024-08-12 18:14:54.657904
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:14:54.668510
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:14:54.670478
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:14:54.684244
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:14:54.686424
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 20, 10

2024-08-12 18:15:11.564824
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:15:11.566783
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:15:11.568635
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:15:11.580985
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:15:11.583076
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 30, 10

2024-08-12 18:15:18.165114
SELECT l.loc_code, l.location_name, l.inactive
                FROM 0_locations l 
                    LEFT JOIN 0_locations pl ON 
                            l.loc_code = pl.reservation_loc_code 
                WHERE pl.loc_code IS NULL ORDER BY l.location_name

2024-08-12 18:15:18.167033
SELECT name, value FROM 0_sys_prefs

2024-08-12 18:15:18.169005
SELECT supplier_id, supp_ref,  value_name, supp_name, curr_code, s.inactive 
            FROM 0_suppliers s
                    LEFT JOIN 0_list_values lv ON 
                            s.supplier_type = lv.id ORDER BY value_name,supp_ref

2024-08-12 18:15:18.181512
SELECT stock_id, s.description, c.description, s.inactive, s.editable
			FROM 0_stock_master s,0_stock_category c WHERE s.category_id=c.category_id AND s.inactive = 0 AND (stock_id='') ORDER BY c.description,stock_id

2024-08-12 18:15:18.183840
SELECT 
                    porder.order_no, 
                    porder.reference,
                    supplier.supp_name, 

                    location.location_name,
                    porder.requisition_no, 
                    porder.ord_date,
                    supplier.curr_code,
                    Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
                    porder.approval_status,
                    Sum(line.delivery_date < '2024-08-12'
                    AND (line.quantity_ordered > line.quantity_received)) As OverDue,
                    porder.supplier_id 
            FROM 0_purch_orders as porder, 0_purch_order_details as line, 0_suppliers as supplier, 0_locations as location
             WHERE (porder.order_no = line.order_no
                        AND porder.supplier_id = supplier.supplier_id
                        AND location.loc_code = porder.into_stock_location 
                        AND (line.quantity_ordered  * 1.1 > line.quantity_received) 
                        AND porder.approval_status = 30   AND porder.ord_date >= '2024-07-13'  AND porder.ord_date <= '2024-08-12') GROUP BY porder.order_no LIMIT 40, 10

