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


function save_stock_count_details($stock_count_no, $stock_count_sheet_no, $item_code,
                                    $units_of_measure, $quantity, $damaged, $message='')
{
    $sql = "INSERT INTO import_stock_count_details
        (stock_count_no, sheet_no, stock_id, 
            unit_name, 	good_qty, damaged_qty, message)
            
        VALUES
        (".db_escape($stock_count_no).", ".db_escape($stock_count_sheet_no).",
            ".db_escape($item_code).",".db_escape($units_of_measure).",
            ".db_escape($quantity).",".db_escape($damaged).", 
            ".db_escape($message).")";
    
    db_query($sql);
    
}


function delete_existing_stock_count()
{
    $sql = "DELETE FROM import_stock_count_details";
    
    db_query($sql);
    
}


function get_stock_count_data()
{
    $sql = "SELECT *
            FROM import_stock_count_details
            WHERE 1=1";
    
    return db_query($sql, "get_stock_count_data");    
}


function get_importing_stock_counts()
{
    $sql = "SELECT DISTINCT stock_count_no 
            FROM import_stock_count_details
            WHERE 1=1";
    
    return db_query($sql);    
}

?>