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

include_once($path_to_root . "/sales/includes/db/customers_db.inc");
include_once($path_to_root . "/purchasing/includes/db/suppliers_db.inc");

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

//-------------------------------------------------------------------------------------------------

//$woid = 0;

if ($_GET['trans_no'] != "")
{
    $bond_id = $_GET['trans_no'];
}

display_heading("Bond ID: " . $bond_id);

//br(1);


echo "<br>";
start_table(TABLESTYLE2, "width=60%");

$myrow = view_bonds($bond_id);
start_row();

label_cells(_("Name"), $myrow['name'], "class='tableheader2'");
end_row();
label_cells(_("Description"), $myrow['description'], "class='tableheader2'");
end_row();
label_cells(_("Type"), $myrow['type'], "class='tableheader2'");
end_row();

if($myrow['payable'] == 0){
    $payable = "No";
}else{
    $payable = "Yes";
}

label_cells(_("Payable"), $payable, "class='tableheader2'");
end_row();
if($myrow['payable'] == 0){
    $supplier_name = get_supplier_name($myrow['supplier_id']);
    label_cells(_("Guarantor"), $supplier_name, "class='tableheader2'");
}
else{
    $customer_name = get_customer_name($myrow['customer_id']);
    label_cells(_("Beneficiary"), $customer_name, "class='tableheader2'");
}
end_row();
label_cells(_("Bank Name"), $myrow['bank_name'], "class='tableheader2'");
end_row();
label_cells(_("Bank Branch"), $myrow['branch_name'], "class='tableheader2'");
end_row();
label_cells(_("Project"), $myrow['project_name'], "class='tableheader2'");
end_row();
label_cells(_("Bond Value"), number_format($myrow['value'],2), "class='tableheader2'");
end_row();
label_cells(_("Bank Charge"), number_format($myrow['bank_charge'],2), "class='tableheader2'");
end_row();
label_cells(_("Effective Time"), sql2date($myrow['start_date']), "class='tableheader2'");
end_row();
label_cells(_("Expiry Time"), sql2date($myrow['expiry_date']), "class='tableheader2'");
end_row();
label_cells(_("Comment"), $myrow['comments'], "class='tableheader2'");
end_row();


end_page(true, false, false, ST_BONDS, $bond_id);


?>
