<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_PETTYCASH_TRANSVIEW';
$path_to_root = "../..";

include_once($path_to_root . "/includes/session.inc");

include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/inventory.inc");
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/petty_cash/includes/db/petty_cash_payments_db.inc");


$js = "";
if ($SysPrefs->use_popup_windows)
	$js .= get_js_open_window(800, 500);
page(_($help_context = "View Petty cash Payment"), true, false, "", $js);

//-------------------------------------------------------------------------------------------------
$woid = 0;
if ($_GET['type_id'] != "")
{
	$type_id = $_GET['type_id'];
}
if ($_GET['trans_no'] != "")
{
	$id = $_GET['trans_no'];
}

global $approval_statuses, $systypes_array;

br();
display_heading($systypes_array[$type_id]." No: " . $id);
br();
$myrow = view_petty_cash_payment($id);

start_table(TABLESTYLE2, "width=50%");

start_row();

if($type_id == ST_I_OWE_YOU_PAYMENT){
    $iou_link = get_petty_cash_trans_view_str(ST_I_OWE_YOU, $myrow['iou_id']);
    label_cells(_($systypes_array[ST_I_OWE_YOU]." No"), $iou_link, "class='tableheader2'");
}
elseif($type_id == ST_PETTY_CASH_PAYMENT){
    $iou_link = get_petty_cash_trans_view_str(ST_PETTY_CASH, $myrow['iou_id']);
    label_cells(_($systypes_array[ST_PETTY_CASH]." No"), $iou_link, "class='tableheader2'");
}
else{
    
}


end_row();
label_cells(_("Float"), $myrow['float_name'], "class='tableheader2'");
end_row();
label_cells(_("Date"), sql2date($myrow['payment_date']), "class='tableheader2'");
end_row();
label_cells(_("Return"), get_yes_no_name($myrow['is_return']), "class='tableheader2'");
end_row();
label_cells(_("Amount"), number_format($myrow['amount'],2), "class='tableheader2'");
end_row();
label_cells(_("Comment"), $myrow['comment'], "class='tableheader2'");
end_row();

label_cells(_("Created By"), $myrow['user_name'], "class='tableheader2'");
end_row();

//label_cells(_("Reimbursed Amount"), $myrow['reimbursed_amount'], "class='tableheader2'");
$link = get_petty_cash_float_reimbursement_details_view_str($type_id, $id, number_format($myrow['reimbursed_amount'],2));
//$link = get_petty_cash_trans_view_str(ST_PETTY_CASH_FLOAT_REIMBUR, $myrow['reimbursed_amount']);
label_cells(_("Reimbursed Amount"), $link, "class='tableheader2'");
end_row();
end_table();

br(2);
end_page(true, false, false, ST_WORKORDER, $woid);

?>
