<?php
require(DIR_WS_CLASSES.'invoices.php');
$id = xtc_db_input($_GET['id']);
$invoices = new invoices();
$invoice = $invoices->get_invoice($id);

switch($_GET['action']){
	case 'delete_confirm':
		$smarty->assign('BOX_TITLE', $invoice->data->name );
		$contents = array();
		$contents[] = array('align'=>'center','text' => DELETE_ENTRY );
		$contents[] = array('align'=>'center','text' => yes_draw_href_button(IMAGE_DELETE,xtc_href_link(FILENAME_INVOICES,xtc_get_all_get_params(array('action')).'action=delete'),$access='func_invoices_delete','width:100px;').'&nbsp;'.yes_draw_href_button(IMAGE_CANCEL,"javascript:ajax_box_action('".$id."','');",$access='invoices','width:100px;') );
		
		break;
	default:
		$smarty->assign('BOX_TITLE', $invoice->data->invoice_number );
		$contents = array();
		$contents[] = array('align'=>'center','text' => yes_draw_href_button(IMAGE_OVERVIEW,xtc_href_link(FILENAME_INVOICES,'id='.$id.'&action=overview'),$access='invoices','width:180px;') );
		$contents[] = array('align'=>'center','text' => yes_draw_href_button(IMAGE_EDIT,xtc_href_link(FILENAME_INVOICES_EDIT,'id='.$id),$access='invoices_edit','width:180px;') );
		$contents[] = array('align'=>'center','text' => yes_draw_href_button(NEW_QUICKNOTE,"javascript:toggleBox('addquicknote');",'notiz','width:180px;').yes_draw_quicknote( xtc_href_link(FILENAME_INVOICES,'id='.$id.'&action=overview') ) );
		$contents[] = array('align'=>'center','text' => yes_draw_href_button(IMAGE_DELETE,"javascript:ajax_box_action('".$id."','delete_confirm');",$access='func_invoices_delete','width:180px;') );
		break;
}

$box = new box;
$smarty->assign('BOX_CONTENT', $box->infoBox($contents) );

