<?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/fixed_deposits_db.inc");
include_once($path_to_root . "/sales/includes/db/customers_db.inc");
include_once($path_to_root . "/purchasing/includes/db/suppliers_db.inc");
include_once($path_to_root . "/finance/includes/db/company_loans_db.inc");
include_once($path_to_root . "/finance/includes/db/credit_facilities_db.inc");


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

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

//$woid = 0;

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

display_heading("Fix Deposit: " . $fix_deposit_id);

//br(1);


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

$myrow = view_fixed_deposit($fix_deposit_id);
start_row();

label_cells(_("Name"), $myrow['name'], "class='tableheader2'");
end_row();
label_cells(_("Description"), $myrow['description'], "class='tableheader2'");
end_row();
label_cells(_("Bank"), $myrow['bank_name'], "class='tableheader2'");
end_row();
label_cells(_("Branch"), $myrow['branch_name'], "class='tableheader2'");
end_row();
label_cells(_("Bank account"), $myrow['bank_account_name'], "class='tableheader2'");
end_row();
label_cells(_("Amount"), $myrow['amount'], "class='tableheader2'");
end_row();
label_cells(_("Start Date"), sql2date($myrow['start_date']), "class='tableheader2'");
end_row();
label_cells(_("End Date"), sql2date($myrow['end_date']), "class='tableheader2'");
end_row();
label_cells(_("Interest"), number_format($myrow['interest'],2), "class='tableheader2'");
end_row();

global $fixed_deposit_security_type;
    
if($myrow['security_type_id'] > 0){
    label_cells(_("Security Type"), $fixed_deposit_security_type[$myrow['security_type_id']], "class='tableheader2'");
    end_row();
}
    
switch ($myrow['security_type_id']){
    case ST_COMPANY_LOANS:
        $cl = get_company_loan($myrow['security_id']);
        label_cells(_("Company loan"), $cl['description'], "class='tableheader2'");
        end_row();
        break ;
    case ST_CREDIT_FACILITY:
        $cf = get_credit_facility($myrow['security_id']);
        label_cells(_("Credit Facility"), $cf['description'], "class='tableheader2'");
        end_row();
        break ;
    default:
        break;
}

$original_fixed_deposit_id = "";
if($myrow['original_fixed_deposit_id'] > 0){
    $original_fixed_deposit_id = $myrow['original_fixed_deposit_id'];
}
label_cells(_("Original fix deposit"), $original_fixed_deposit_id, "class='tableheader2'");
end_row();


end_page(true, false, false, ST_FIXED_DEPOSIT, $fix_deposit_id);



?>
