<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_TRANSPORT_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 . "/transport/includes/db/vehicle_running_chart_entry_db.inc");
include_once($path_to_root . "/transport/includes/db/vehicle_allocation_db.inc");
include_once($path_to_root . "/transport/includes/db/vehicle_running_chart_inquiry_db.inc");


$js = "";
if ($SysPrefs->use_popup_windows)
	$js .= get_js_open_window(800, 500);
page(_($help_context = "View Vehicle Running Chart Entry"), true, false, "", $js);

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

display_heading("Vehicle Running Chart Entry: " . $vrc_id);

//br(1);


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

$myrow = view_vehicle_running_chart($vrc_id);

start_row();
label_cells(_("Vehicle Allo. No."), get_transport_trans_view_str(ST_VEHICLE_ALLOCATION, $myrow['vehicle_allocation_id'] > 0 ? $myrow['vehicle_allocation_id'] : '') , "class='tableheader2'");
end_row();
label_cells(_("Project"), $myrow['project_description'], "class='tableheader2'");
end_row();
label_cells(_("Task"), $myrow['task_description'], "class='tableheader2'");
end_row();
label_cells(_("Vehicle Package"), $myrow['package_description'], "class='tableheader2'");
end_row();
label_cells(_("Vehicle"), $myrow['vehicle_description'], "class='tableheader2'");
end_row();
label_cells(_("Plate No"), $myrow['plate_no'], "class='tableheader2'");
end_row();
label_cells(_("Cost"), number_format($myrow['cost'],2), "class='tableheader2'");
end_row();
label_cells(_("From Date Time"), $myrow['start_date_time'], "class='tableheader2'");
end_row();
label_cells(_("To Date Time"), $myrow['end_date_time'], "class='tableheader2'");
end_row();
label_cells(_("Meter Start"), $myrow['meter_start'], "class='tableheader2'");
end_row();
label_cells(_("Meter End"), $myrow['meter_end'], "class='tableheader2'");
end_row();
label_cells(_("Route"), $myrow['route'], "class='tableheader2'");
end_row();
label_cells(_("Passengers"), $myrow['passengers'], "class='tableheader2'");
end_row();
label_cells(_("Supplier"), $myrow['supp_name'], "class='tableheader2'");
end_row();
label_cells(_("Supplier Charge"), number_format($myrow['supplier_charge'],2), "class='tableheader2'");
end_row();

if($myrow['inv_no'] > 0){
    $sti_link = get_transport_trans_view_str(ST_SUPPLIER_TRANSPORT_INVOICES, $myrow['inv_no']);
    label_cells("Supplier Transport Inv. No.", $sti_link,"align=center class='tableheader2'");  
    end_row(); 
}

if($myrow['payment_source_no'] > 0){
    global $petty_cash_float_transaction_types;
    $payment_source_no_link = get_petty_cash_trans_view_str($myrow['payment_source_type'], $myrow['payment_source_no']);
    label_cells(_("Paid By"), $petty_cash_float_transaction_types[$myrow['payment_source_type']]." (".$payment_source_no_link.")", "class='tableheader2'");
    end_row();
    $adance_paid_va = get_vehicle_allocation_record_by_payment_vrc_entry($vrc_id);
    $adance_paid_va_link = get_transport_trans_view_str(ST_VEHICLE_ALLOCATION, $adance_paid_va["id"]);
    label_cells("Advance Paid Vehicle Allo. No.", $adance_paid_va_link,"align=center class='tableheader2'");  
    end_row();    
}

label_cells(_("Batch No"), get_transport_trans_view_str(ST_VEHICLE_RUNNING_CHART_BATCH,$myrow['batch_no'] > 0 ? $myrow['batch_no'] : ''), "class='tableheader2'");
end_row();





end_page(true, false, false, ST_VEHICLE_RUNNING_CHART, $vrc_id);

?>
