<?php
$smarty = new yesSmarty();
$smarty->assign('BUTTON_CLOSE',BUTTON_CLOSE);
$imports = new imports;
$invoice = $invoices->get_invoice($_GET['iID']);
$import = $imports->get_import($_GET['impID']);
$smarty->assign('import_number',$import->data->import_number);
$smarty->assign('invoice_number',$invoice->data->invoice_number);
$smarty->assign('currency',$import->data->currency);
$smarty->assign('form',xtc_draw_form('invoice_costs', FILENAME_INVOICES_EDIT,'action=add_import_costs_save&id='.$_GET['iID'],'post','onsubmit="return check_add_costs_form();"'));
if(is_array($import->data->costs) and sizeOf($import->data->costs)>0){
	$costs_array = array();
	foreach($import->data->costs as $k=>$cost){
		$costs_array[] = array(
			'import_costs_id'=>$cost['import_costs_id'],
			'companies_id'=>$cost['companies_id'],
			'costs'=>$cost['costs'],
			'costs_expensed'=>$cost['costs_expensed'],
			'costs_text'=>$cost['costs_text'],
			'saved'=>$invoices->check_import_costs_id_saved(xtc_db_input($_GET['iID']),$cost['import_costs_id'])
		);
	}
	$smarty->assign('costs',$costs_array);
}
echo $smarty->fetch(DIR_FS_ADMIN.'templates/invoices_choose_import_costs.html');

include('includes/footer.php');
