<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_PAYROLLTRANSVIEW';
$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/ui.inc");
include_once($path_to_root . "/includes/data_checks.inc");

include_once($path_to_root . "/payroll/includes/db/salary_deductions_db.inc");
include_once($path_to_root . "/payroll/includes/db/employees_db.inc");

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

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

display_heading("Salary Advance Payment" . " # " . $tran_no);

br(1);
$myrow = get_view_salary_deduction($tran_no);

    if (strlen($myrow[0]) == 0)
    {
    	display_note(_("The salary advance Payment sent is not valid."));
    	exit;
    }
    
    start_table(TABLESTYLE, "width=60%");

    start_row();
    label_cells(_("Reference:"), $tran_no, "class='tableheader2'");
    end_row();start_row();
    label_cells(_("Employee Code:"), $myrow["employee_code"], "class='tableheader2'");
    end_row();start_row();
    label_cells(_("Employee Name:"), $myrow["first_name"]." ".$myrow["middle_name"]." ".$myrow["last_name"], "class='tableheader2'");
    end_row();start_row();
    label_cells(_("Salary Advance Type:"), $myrow["salary_advance_type"], "class='tableheader2'");
    end_row();start_row();
    label_cells(_("Amount:"), $myrow["salary_deduction"], "class='tableheader2'");
    end_row();start_row();
    label_cells(_("Approved On:"), sql2date($myrow["approved_on"]), "class='tableheader2'");
    end_row();start_row();
    label_cells(_("Approved By:"), $myrow["approver_name"], "class='tableheader2'");
    end_row();start_row();
    label_cells(_("Payroll Run:"), $myrow["payroll_run_id"] > 0 ? $myrow["payroll_run_id"]:"", "class='tableheader2'");
    end_row();start_row();
    label_cells(_("Comment:"), $myrow["comments"], "class='tableheader2'");
    end_row();

    end_table();

end_page(true, false, false, ST_POINTSUPDATE, $tran_no);

?>
