From abd2759fcc8de3cd492933e4a253808956bc52f9 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Fri, 9 Jan 2009 16:10:27 +0000 Subject: [PATCH] Added Sales kits to Items price list. Company logo can not be deleted. Bug [0000107] and [0000108] --- CHANGELOG.txt | 7 ++++ admin/company_preferences.php | 19 +++++++++- gl/manage/gl_account_types.php | 6 +++ inventory/includes/db/items_codes_db.inc | 2 +- reporting/rep104.php | 48 ++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7c2ce80d..3fdc434e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -22,6 +22,13 @@ $ -> Affected files 09-Jan-2009 Joe Hunt ! Changed $path_to_root in report files and stamped copyright $ All report files ++ Added Sales kits to Items price list. +$ /reporting/rep104.php +# Company logo can not be deleted. +$ /admin/company_preferences.php +# Bug [0000107] and [0000108] +$ /inventory/includes/db/items_codes_db.inc + /gl/manage/gl_account_types.php 08-Jan-2009 Joe Hunt ! Changed attachments to use unique files store instead of blobs diff --git a/admin/company_preferences.php b/admin/company_preferences.php index 5f2b8d6b..2a9e9b5f 100644 --- a/admin/company_preferences.php +++ b/admin/company_preferences.php @@ -77,6 +77,22 @@ if (isset($_POST['update']) && $_POST['update'] != "") display_error(_('Error uploading logo file')); } } + if (check_value('del_coy_logo')) + { + $user_comp = user_company(); + $filename = $comp_path . "/$user_comp/images/".$_POST['coy_logo']; + if (file_exists($filename)) + { + $result = unlink($filename); + if (!$result) + { + display_error(_('The existing image could not be removed')); + $input_error = 1; + } + else + $_POST['coy_logo'] = ""; + } + } if ($input_error != 1) { update_company_setup($_POST['coy_name'], $_POST['coy_no'], $_POST['gst_no'], $_POST['tax_prd'], $_POST['tax_last'], @@ -123,6 +139,7 @@ $_POST['custom2_value'] = $myrow["custom2_value"]; $_POST['custom3_value'] = $myrow["custom3_value"]; $_POST['curr_default'] = $myrow["curr_default"]; $_POST['f_year'] = $myrow["f_year"]; +$_POST['del_coy_logo'] = 0; start_outer_table($table_style2); @@ -148,7 +165,7 @@ table_section(2); fiscalyears_list_row(_("Fiscal Year:"), 'f_year', $_POST['f_year']); label_row(_("Company Logo:"), $_POST['coy_logo']); label_row(_("New Company Logo (.jpg)") . ":", ""); - +check_row(_("Delete Company Logo:"), 'del_coy_logo', $_POST['del_coy_logo']); text_row_ex(_("Domicile:"), 'domicile', 25, 55); number_list_row(_("Use Dimensions:"), 'use_dimension', null, 0, 2); diff --git a/gl/manage/gl_account_types.php b/gl/manage/gl_account_types.php index 94447562..65c0012a 100644 --- a/gl/manage/gl_account_types.php +++ b/gl/manage/gl_account_types.php @@ -26,6 +26,12 @@ function can_process() { global $selected_id; + if (!input_num('id')) + { + display_error( _("The account id must be an integer and cannot be empty.")); + set_focus('id'); + return false; + } if (strlen($_POST['name']) == 0) { display_error( _("The account group name cannot be empty.")); diff --git a/inventory/includes/db/items_codes_db.inc b/inventory/includes/db/items_codes_db.inc index f464545f..9e183cf5 100644 --- a/inventory/includes/db/items_codes_db.inc +++ b/inventory/includes/db/items_codes_db.inc @@ -15,7 +15,7 @@ function update_item_code($id, $item_code, $stock_id, $description, $category, $ WHERE "; if ($id == -1) // update with unknown $id i.e. from items table editor - $sqk .= "item_code = ".db_escape($item_code) + $sql .= "item_code = ".db_escape($item_code) ." AND stock_id = ".db_escape($stock_id); else $sql .= "id = $id"; diff --git a/reporting/rep104.php b/reporting/rep104.php index e34e5937..e127c459 100644 --- a/reporting/rep104.php +++ b/reporting/rep104.php @@ -47,6 +47,22 @@ function fetch_items($category=0) return db_query($sql,"No transactions were returned"); } + +function get_kits($category=0) +{ + $sql = "SELECT i.item_code AS kit_code, i.description AS kit_name, c.category_id AS cat_id, c.description AS cat_name, count(*)>1 AS kit + FROM + ".TB_PREF."item_codes i + LEFT JOIN + ".TB_PREF."stock_category c + ON i.category_id=c.category_id"; + $sql .= " WHERE !i.is_foreign AND i.item_code!=i.stock_id"; + if ($category != 0) + $sql .= " AND c.category_id = '$category'"; + $sql .= " GROUP BY i.item_code"; + return db_query($sql,"No kits were returned"); +} + //---------------------------------------------------------------------------------------------------- function print_price_listing() @@ -156,6 +172,38 @@ function print_price_listing() $rep->NewLine(0, 1); } $rep->Line($rep->row - 4); + + $result = get_kits($category); + + $catgor = ''; + while ($myrow=db_fetch($result)) + { + if ($catgor != $myrow['cat_name']) + { + if ($catgor == '') + { + $rep->NewLine(2); + $rep->fontSize += 2; + $rep->TextCol(0, 3, _("Sales Kits")); + $rep->fontSize -= 2; + } + $rep->Line($rep->row - $rep->lineHeight); + $rep->NewLine(2); + $rep->fontSize += 2; + $rep->TextCol(0, 3, $myrow['cat_id'] . " - " . $myrow['cat_name']); + $catgor = $myrow['cat_name']; + $rep->fontSize -= 2; + $rep->NewLine(); + } + $rep->NewLine(); + $rep->TextCol(0, 1, $myrow['kit_code']); + $rep->TextCol(1, 2, $myrow['kit_name']); + $price = get_kit_price($myrow['kit_code'], $currency, $salestype); + $rep->TextCol(2, 3, number_format2($price, $dec)); + $rep->NewLine(0, 1); + } + $rep->Line($rep->row - 4); + $rep->End(); } -- 2.30.2