<?php
function _get_status_name($id){
	return yes_get_invoice_status_name($id);
}
function _convert_html($text){
	return html_entity_decode($text);
}

$invoices_smarty = new yesSmarty;

$class_id = xtc_db_input($_GET['id']);

$query_raw = sprintf("SELECT invoices_id,invoice_number,recipient_name,status_id,date_added FROM %s WHERE imports_id='%s' ORDER BY date_added DESC",TABLE_INVOICES,$class_id );
$pager = new ADODB_Pager($conn,$query_raw);
$pager->pager_grid_formid = 'invoices'; // WIRD BENOETIGT FUER ALLE MARKIEREN
$pager->index_field = 'invoices_id';
//$pager->hide_columns(array('history_id'));
$pager->set_in_div('snippet_invoices');

$pager->get_row_selector = 'iID';
$pager->gridHeader = array(ENTRY_ID,ENTRY_INVOICE_NUMBER,ENTRY_RECIPIENT,IMAGE_STATUS,TEXT_DATE_CREATED);
$pager->gridHelper = array(
	'status_id'=>'_get_status_name'
);
// KEINE AJAX BOX
$pager->pager_tab_file = false;
// KEINE JAVASCRIPT ROW-ACTION
$pager->javascript_row_click_action = false;

$pager->Render($rows_per_page=MAX_DISPLAY_SEARCH_RESULTS_ADMIN);

$selected_item = $pager->selected_row;

$grid_smarty = new yesSmarty;
$grid_smarty->assign('grid',$pager->getGrid());
$grid = $grid_smarty->fetch(DIR_FS_ADMIN.'templates/pager_grid.tpl');
$invoices_smarty->assign('HEADER',$pager->getHeader());

$grid_smarty->assign('grid',$pager->getGrid());

$grid = $grid_smarty->fetch(DIR_FS_ADMIN.'templates/pager_grid.tpl');

$invoices_smarty->assign('GRID',$grid);
$invoices_smarty->assign('FOOTER',$pager->getFooter());

header('Content-Type: text/html; charset=iso-8859-1');
echo $invoices_smarty->fetch(DIR_FS_ADMIN.'templates/pager.tpl');
