<?php
/**********************************************************************
***********************************************************************/
  
function display_row($name, $value)
{
    start_row();        
    label_cells($name, $value, "width=70px class='tableheader2'", "width=60px");
    end_row();
    
}


function view_purchase_requisition_line_allocations($pr_line_id)
{
  
//    global $systypes_array;


    br(2);

    display_heading('Purchase Requisition Item');


    $prd = view_pr_line_details($pr_line_id);

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



    display_row("PR No:",get_supplier_trans_view_str(ST_PURCH_REQ,$prd["requisition_id"], $prd["requisition_id"]));
    //    display_row("PR No:",$myrow["pr_no"]);
    //display_row("Order No:",get_trans_view_str(ST_MANUF_REQUEST,$myrow["id"]));
    display_row("Project :",$prd["project_description"]);
    display_row("Item code",$prd["item_code"]);
    display_row("Item Description",$prd["item_description"]);
    display_row("Qty",number_format($prd["requested_unit_qty"],2));
    display_row("Unit",$prd["requested_unit"]);
    display_row("Required Date",sql2date($prd["required_date"]));
    display_row("PR Line Id",$prd["id"]);




    end_row();

    end_table(1);



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

    display_heading('Purchase Requisition Allocations');

    $th = array(_("#"),_("Supplier"),_("Address"),_("Location"),_("Item Code"),_("Item Description"), _("Unit"), _("Quantity"),_("Unit Price"), _("Discount"), _("PO No."));
    table_header($th);


    $data = view_pr_line_allocations($pr_line_id);

    while($myrow=db_fetch($data))
    {

    //$data = get_pr_allocation_details($pr_line_id);
    //while($pr_allo_lines=db_fetch($data))
    //{
    //    label_cell($pr_allo_lines['requisition_id'],"align=left");    
        label_cell($myrow['id'],"align=left");
        label_cell($myrow['supplier'],"align=left");
        label_cell($myrow['supp_address'],"align=left");
        label_cell($myrow['location_name'],"align=left");
        label_cell($myrow['item_code'],"align=left");
        label_cell($myrow['description'],"align=left");
        label_cell($myrow['order_unit'],"align=left");
        amount_cell($myrow['order_quantity']/$myrow['order_unit_conversion_factor'],"align=right");
        amount_cell($myrow['order_unit_price'],"align=right");
        amount_cell($myrow['order_unit_price_discount'],"align=right");
    //    label_cell($pr_allo_lines['order_no'],"align=left");
        if($myrow['po_no'] == null)
        {
            $po_no = '';
             label_cell($po_no,"align=left");
        }
        else
        {
            $po_no = $myrow['po_no'];
            label_cell(get_supplier_trans_view_str(ST_PURCHORDER,$po_no, $po_no),"align=center");
        }
    //    label_cell(get_trans_view_str(ST_PURCH_REQ,$mr_req["pr_no"]), "align=center");

        end_row();
    }

    //}

    end_row();

    end_table(1);
}
?>