<?php
/**********************************************************************
***********************************************************************/
 

function display_item_file_data()
{    
    start_table(TABLESTYLE, "width=95%");    
    $th = array("Item Code", "Item Name", "Long Description", "Part No", "Search Code",
                    "Category", "Item Tax Type", "Item Type", "Units of Measure",
                    "Stock Control Method", "Editable Description", "Exclude from sales", 
                    "High Value Item", "Sample Item", "Purchase From Any Supplier", "Item Category",
                    "Country Of Origin", "Country Of Manufacture", "Local Agent", "Brand",
                    "Item Group", "Sales Account", "Inventory Account", 
                    "C.O.G.S. Account", "C.O.C. Account", "Cost Account",
                    "Inventory Adjustments Account", "Item Assembly Costs Account", "Minimum Price",
                    "Hs Code", "Requester", "Requester Comment",
                    "Use for pos", "Use for restaurant", "Use for laundry", 
                    "Message");  
                                  

    table_header($th);
    
    $result = get_items_data();
     
    $k = 0;
    
    while($row = db_fetch($result)){

        alt_table_row_color($k);
        
        label_cell($row['item_code']);
        label_cell($row['name']);
        label_cell($row['long_description']);
        label_cell($row['part_no']);
        label_cell($row['search_code']);
        label_cell($row['category_name']);
        label_cell($row['item_tax_type_name']);
        label_cell($row['item_type_name']);
        label_cell($row['units_of_measure_name']);
        label_cell($row['stock_control_method']);
        label_cell($row['editable_description']);
        label_cell($row['exclude_from_sales']);
        
        label_cell($row['high_value_item']);
        label_cell($row['sample_item']);
        label_cell($row['any_supplier']);
        label_cell($row['item_category']);
        label_cell($row['country_of_origin']);
        label_cell($row['country_of_manuf']);
        
        label_cell($row['local_agent']);
        label_cell($row['brand']);
        label_cell($row['type']);
        label_cell($row['sales_account']);
        label_cell($row['inventory_account']);
        label_cell($row['cogs_account']);
        label_cell($row['coc_account']);
        label_cell($row['cost_account']);
        
        label_cell($row['inventory_adjustments_account']);
        label_cell($row['item_assembly_costs_account']);
        label_cell($row['minimum_price']);        
                  
        label_cell($row['hs_code']);
        label_cell($row['requester_login_id']);
        label_cell($row['requester_comment']);
        
        label_cell($row['use_for_pos']);
        label_cell($row['use_for_restaurant']);
        label_cell($row['use_for_laundry']);
                  
        if($row['message'] == "Item has been added." || $row['message'] == "Item has been updated."){
            $message = $row['message'];
        }
        else{
            $message = "<font color='red'>".$row['message']."</font>";
        }
     
        label_cell($message);
     
        end_row();
    }
  
    end_table();
}


function read_item_details_import_file_data(&$file_data, $line)
{
    $item_code = str_replace('"', '', $line[0]);
    $item_name = str_replace('"', '', $line[1]);
    $long_description = str_replace('"', '', $line[2]);                    
    $part_no = str_replace('"', '', $line[3]);
    $search_code = str_replace('"', '', $line[4]);
    $category = str_replace('"', '', $line[5]);
    $item_tax_type = str_replace('"', '', $line[6]); 
    $item_type = str_replace('"', '', $line[7]); 
    $units_of_measure = str_replace('"', '', $line[8]); 
    $stock_control_method = str_replace('"', '', $line[9]); 
    $editable_description = str_replace('"', '', $line[10]); 
    $exclude_from_sales = str_replace('"', '', $line[11]); 
    $high_value_item = str_replace('"', '', $line[12]); 
    $sample_item = str_replace('"', '', $line[13]); 
    $purchase_from_any_supplier = str_replace('"', '', $line[14]); 
    $item_category = str_replace('"', '', $line[15]); 
    $country_of_origin = str_replace('"', '', $line[16]); 
    $country_of_manufacture = str_replace('"', '', $line[17]);
    $local_agent = str_replace('"', '', $line[18]); 
    $brand = str_replace('"', '', $line[19]);
    $item_group = str_replace('"', '', $line[20]); 
    $sales_account = str_replace('"', '', $line[21]);
    $inventory_account = str_replace('"', '', $line[22]);
    $cogs_account = str_replace('"', '', $line[23]); 
    $coc_account = str_replace('"', '', $line[24]); 
    $cost_account = str_replace('"', '', $line[25]); 
    $inventory_adjustment_account = str_replace('"', '', $line[26]);
    $item_assembly_cost_account = str_replace('"', '', $line[27]);
    $minimum_price = str_replace('"', '', $line[28]);
    $hs_code = str_replace('"', '', $line[29]);
    $requester_login_id = str_replace('"', '', $line[30]);
    $requester_comment = str_replace('"', '', $line[31]);
    $use_for_pos = str_replace('"', '', $line[32]);
    $use_for_restaurant = str_replace('"', '', $line[33]);
    $use_for_laundry = str_replace('"', '', $line[34]);
    $message = str_replace('"', '', $line[35]);
    
    
    
    save_items($item_code, $item_name, $long_description,
                $part_no, $search_code, $category,
                $item_tax_type, $item_type,
                $units_of_measure, $stock_control_method,
                $editable_description, $exclude_from_sales, 
                $high_value_item, $sample_item,
                $purchase_from_any_supplier, $item_category, $country_of_origin,
                $country_of_manufacture, $local_agent, $brand, $item_group,
                $sales_account, $inventory_account,
                $cogs_account, $coc_account, $cost_account, $inventory_adjustment_account,
                $item_assembly_cost_account, $minimum_price, 
                $hs_code, $requester_login_id, $requester_comment,
                $use_for_pos, $use_for_restaurant,
                $use_for_laundry, $message);

}



?>






















