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


function 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, 
                    $use_for_pos, $use_for_restaurant,
                    $use_for_laundry, $message='')
{
    $sql = "INSERT INTO import_items
                (item_code, name, long_description, 
                    part_no, search_code, category_name,
                    item_tax_type_name, item_type_name, 
                    units_of_measure_name, stock_control_method, 
                    editable_description, exclude_from_sales,
                    high_value_item, sample_item,
                    any_supplier, item_category,
                    country_of_origin, country_of_manuf,
                    local_agent, brand, type,
                    sales_account, inventory_account,
                    cogs_account, coc_account, cost_account, 
                    inventory_adjustments_account,
                    item_assembly_costs_account, minimum_price,
                    use_for_pos, use_for_restaurant,
                    use_for_laundry, message)
            
        VALUES
        (".db_escape($item_code).", ".db_escape($item_name).",
            ".db_escape($long_description).",".db_escape($part_no).",
            ".db_escape($search_code).",".db_escape($category).", 
            ".db_escape($item_tax_type).",".db_escape($item_type).",
            ".db_escape($units_of_measure).",".db_escape($stock_control_method).", 
            ".db_escape($editable_description).",".db_escape($exclude_from_sales).",
            ".db_escape($high_value_item).",".db_escape($sample_item).", 
            ".db_escape($purchase_from_any_supplier).",".db_escape($item_category).",
            ".db_escape($country_of_origin).",".db_escape($country_of_manufacture).", 
            ".db_escape($local_agent).",".db_escape($brand).",
            ".db_escape($item_group).",".db_escape($sales_account).", 
            ".db_escape($inventory_account).",".db_escape($cogs_account).",
            ".db_escape($coc_account).",".db_escape($cost_account).",
            ".db_escape($inventory_adjustment_account).",".db_escape($item_assembly_cost_account).", 
            ".db_escape($minimum_price).",".db_escape($use_for_pos).",
            ".db_escape($use_for_restaurant).",".db_escape($use_for_laundry).",           
            ".db_escape($message).")";
    
    db_query($sql);
    
}


function delete_existing_items()
{
    $sql = "DELETE FROM import_items";
    
    db_query($sql);
    
}


function get_items_data()
{
    $sql = "SELECT *
            FROM import_items
            WHERE 1=1";
    
    return db_query($sql);    
}



?>