<?php //
/**********************************************************************
***********************************************************************/




function view_petty_cash_item_issue_items($type, $trans_no)
{
	$sql = "SELECT sir.*,                 
                        iu.name tran_unit_name,
                        IF(sm.editable=1, sir.item_description, sm.description) display_item_description 
                FROM ".TB_PREF."petty_cash_item_issue_details sir                                          
                        JOIN ".TB_PREF."item_units iu  
                            ON sir.tran_unit = iu.abbr  
                        JOIN ".TB_PREF."stock_master sm   
                            ON sm.stock_id = sir.stock_id  
                            
                WHERE  sir.type=".db_escape($type)." AND               
                        sir.trans_no=".db_escape($trans_no);        
  
	return db_query($sql, "view_petty_cash_item_receive_items");
}



function view_petty_cash_item_issue_header($type_id, $trans_no)
{
	$sql = "SELECT h.*,      
                        l.location_name,
                        pm.description project_description 

                FROM ".TB_PREF."petty_cash_item_issues h                                            
                        JOIN ".TB_PREF."locations l   
                            ON l.loc_code = h.location    
                        JOIN ".TB_PREF."projects_master pm    
                            ON pm.project_id = h.project_id   
                            
                WHERE  h.type=".db_escape($type_id)." AND         
                        h.trans_no=".db_escape($trans_no);
  
	$result = db_query($sql, "view_petty_cash_item_issue_header");
        return db_fetch($result);
}
