<?php

function dashboard_view_item_purchase_price_variance($item_code, $from_date, $to_date) {

        $item_name = get_stock_item_formatted_name($item_code);
        display_heading($item_name);    br();
        
        $txt = "Purchase Order Details From ".sql2date($from_date)." To ". sql2date($to_date);
        display_heading2($txt);    br();
        
        start_table(TABLESTYLE, "width=90%");

            $th = array("Delivery Date", "PO #",  "Supplier", "Item", "Unit", "Quantity", "Price", "Discount", "Project");
                table_header($th);
                
                    $k = $total_amount = $count = 0;
                    $result = dashboard_view_item_purchase_price_variance_details($item_code, $from_date, $to_date);
                        while($row = db_fetch($result)) {
                            alt_table_row_color($k);
                                label_cell(sql2date($row['delivery_date']),"align=center");
                                $po_link = get_supplier_trans_view_str(ST_PURCHORDER, $row['order_no']);
                                label_cell($po_link, "align=center");
                                
                                $supplier_name = get_supplier_formatted_name($row['supplier_id']);
                                label_cell($supplier_name);
                                
                                label_cell("[".$row['item_code']."] - ".$row['description']);
                                
                                label_cell($row['unit_name'], "align=center");

                                amount_cell($row['order_unit_qty']);
                                
                                amount_cell($row['order_unit_price']);
                                
                                amount_cell($row['order_unit_price_discount']);
                                
                                $project_name = get_project_formatted_name($row['project_id']);
                                label_cell($project_name);

                            end_row();


                        }
                        
//                        start_row();
//                            label_cell(text_bold("Total (Without Taxes)"),"align=right colspan=5");
//                            label_cell(text_bold(number_format($total_amount, 2)),"align=right");
//                            label_cell("", "colspan=2");
//                        end_row();
                
        end_table(2);
}


?>