<?php

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

        display_heading('Goods Received Notes');    br();
        
        start_table(TABLESTYLE, "width=60%");

            $th = array("GRN Date", "GRN #", "Supplier", "GRN Total<br>(Without Taxes)", "PO #");
                table_header($th);
                
                    $k = $total_amount = $count = 0;
                    $result = view_dashboard_top_suppliers_details($supplier_id, $from_date, $to_date);
                        while($row = db_fetch($result)) {
                            alt_table_row_color($k);
                                label_cell(sql2date($row['delivery_date']),"align=center");
                                $grn_link = get_supplier_trans_view_str(ST_SUPPRECEIVE, $row['grn_no']);
                                label_cell($grn_link, "align=center");
                                $supplier_name = get_supplier_formatted_name($supplier_id);
                                label_cell($supplier_name);
                                
                                $total = $row['grn_total'];
                                amount_cell($total);
                                
                                $link = get_supplier_trans_view_str(ST_PURCHORDER, $row['purch_order_no']);
                                label_cell($link, "align=center");
\
                            end_row();

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


?>