<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_MANUFTRANSVIEW';
$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 . "/jobq/includes/db/jobq_requests_db.inc");

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

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

display_heading("Job Queue Request" . " # " . $tran_no);

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

    if (strlen($myrow[0]) == 0)
    {
    	display_note(_("The jobq resquest sent is not valid."));
    	exit;
    }

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

//	$th = array(_("#"), _("Reference"), _("Card No"), _("Member No"),
//			 _("Member Type"), _("Promotion"), _("Transaction Type"), 
//                        _("Points"), _("Points Balance"), _("Discount"),
//                        _("Date"), _("User"), _("Comment"), );
//
//	table_header($th);
	start_row();        
        label_cells(_("Request Id:"), $myrow["id"], "class='tableheader2'");
        end_row();
        
        global $systypes_array;
        start_row();
        label_cells(_("Type:"), $systypes_array[$myrow["type"]], "class='tableheader2'");
        end_row();start_row();
        label_cells(_("Description:"), $myrow["description"], "class='tableheader2'");
        end_row();start_row();
        label_cells(_("Sumitted User:"), $myrow["submitted_user_name"], "class='tableheader2'");
        end_row();start_row();
        label_cells(_("Submitted On:"), $myrow["submitted_on"], "class='tableheader2'");
        end_row();start_row();
        label_cells(_("Started On:"), $myrow["started_on"], "class='tableheader2'");
        end_row();start_row();
        label_cells(_("Completed On:"), $myrow["completed_on"], "class='tableheader2'");
        end_row();start_row();
        label_cells(_("Document Id:"), $myrow["document_id"], "class='tableheader2'");
        end_row();
        
        global $jobq_request_statues;
        start_row();
        label_cells(_("Status:"), $jobq_request_statues[$myrow["status_id"]], "class='tableheader2'");
        end_row();start_row();
        
        $processor_id = "";
        if($myrow["processor_id"] > 0){
            $processor_id = $myrow["processor_id"];
        }
        label_cells(_("Processor:"), $processor_id, "class='tableheader2'");
        end_row();start_row();
        
        $end = "";
        if($myrow["end"] > 0){
            $end = $myrow["end"];
        }
        label_cells(_("End:"), $end, "class='tableheader2'");
        end_row();start_row();
        label_cells(_("End Requested By:"), sql2date($myrow["end_requested_by"]), "class='tableheader2'");
        end_row();start_row();
        
        $end_requested_on = "";
        if(substr($myrow["end_requested_on"],0,4) != "0000"){
            $end_requested_on = $myrow["end"];
        }
        label_cells(_("End Requested On:"), $end_requested_on, "class='tableheader2'");
        end_row();start_row();
        label_cells(_("Comments:"), $myrow["comments"], "class='tableheader2'");
        end_row();start_row();
        //label_cells(_("Parameters:"), nl2br($myrow["parameters"]), "class='tableheader2'");
        label_cell(nl2br($myrow["parameters"]), "colspan=2");
        end_row();

	end_table();

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

?>
