<?php

function dashboard_view_new_suppliers($supplier_id, $from_date, $to_date) {

        display_heading('Purchase Orders');    br();
        
        $supplier_name = get_supplier_formatted_name($supplier_id);
        display_heading($supplier_name);    br();
        
        start_table(TABLESTYLE, "width=60%");

            $th = array("Date", "PO #", "Reference", "Project", "PO Total");
                table_header($th);
                
                    $k = $total_amount = $count = 0;
                    $result = view_dashboard_new_suppliers_details($supplier_id, $from_date, $to_date);
                        while($row = db_fetch($result)) {
                            alt_table_row_color($k);
                                label_cell(sql2date($row['ord_date']),"align=center");
                                $grn_link = get_supplier_trans_view_str(ST_PURCHORDER, $row['order_no']);
                                label_cell($grn_link, "align=center");
                                label_cell($row['reference'], "align=center");
                                $project_name = get_project_formatted_name($row['project_id']);
                                label_cell($project_name);
                                
                                $total = $row['total'] + $row['taxes'];
                                amount_cell($total);

                            end_row();

                            $total_amount += $total;
                            $count++;
                        }
                        
                        start_row();
                            label_cell(text_bold("Total"),"align=right colspan=4");
                            label_cell(text_bold(number_format($total_amount, 2)),"align=right");
                            label_cell("");
                        end_row();
                
        end_table(2);
}


?>