From bfbb9d80ca13ed98b04240c7c03c03acb1998eaa Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Sun, 25 Jan 2009 16:26:31 +0000 Subject: [PATCH] Added one Post option to Post options in Quick Entry Lines (amount without decrease or increase). Minor bug fixes. --- CHANGELOG.txt | 8 +++++ gl/manage/gl_quick_entries.php | 28 ++++++++++------- includes/types.inc | 5 +-- includes/ui/ui_view.inc | 27 +++++++++------- sql/alter2.1.sql | 57 +++++++++++++++++++++++++++++++--- 5 files changed, 97 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2144b3fe..cc186c72 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,14 @@ Legend: ! -> Note $ -> Affected files +26-Jan-2009 Joe Hunt ++ Added one Post option to Post options in Quick Entry Lines (amount without decrease or increase). Minor bug fixes. +$ /gl/manage/gl_quick_entries.php + /includes/types.inc + /includes/ui/ui_view.inc ++ Added 'inactive' field in most 'catalog' tables. +$ /sql/alter2.1.sql + 24-Jan-2009 Janusz Dobrowolski ! Set maximum width for select to avoid broken layout in two column layout. $ /themes/aqua/default.css diff --git a/gl/manage/gl_quick_entries.php b/gl/manage/gl_quick_entries.php index e797cc8c..9c011f09 100644 --- a/gl/manage/gl_quick_entries.php +++ b/gl/manage/gl_quick_entries.php @@ -199,7 +199,7 @@ if ($selected_id != -1) $_POST['id'] = $myrow["id"]; $_POST['description'] = $myrow["description"]; - $_POST['deposit'] = $myrow["type"]; + $_POST['type'] = $myrow["type"]; $_POST['base_desc'] = $myrow["base_desc"]; $_POST['base_amount'] = price_format($myrow["base_amount"]); hidden('selected_id', $selected_id); @@ -245,15 +245,17 @@ if ($selected_id != -1) $act_type = strtolower(substr($myrow['action'], 0, 1)); - if ($act_type == 't') { + if ($act_type == 't') + { label_cells($myrow['tax_name'], ''); - } else { + } + else + { label_cell($myrow['dest_id'].' '.$myrow['account_name']); if ($act_type == '=') label_cell(''); - else - if ($act_type == '%') - percent_cell($myrow['amount']); + elseif ($act_type == '%') + label_cell(number_format2($myrow['amount'], user_exrate_dec()), "nowrap align=right "); else amount_cell($myrow['amount']); } @@ -298,13 +300,17 @@ if ($selected_id != -1) $actn = strtolower(substr($_POST['actn'],0,1)); - if ($actn == 't') { + if ($actn == 't') + { item_tax_types_list_row(_("Item Tax Type").":",'dest_id', null); - } else { + } + else + { gl_all_accounts_list_row(_("Account").":", 'dest_id', null); - if ($actn != '=') { - if ($actn = '%') - percent_row(_("Part").":", 'amount', percent_format(0)); + if ($actn != '=') + { + if ($actn == '%') + small_amount_row(_("Part").":", 'amount', price_format(0), null, "%", user_exrate_dec()); else amount_row(_("Amount").":", 'amount', price_format(0)); } diff --git a/includes/types.inc b/includes/types.inc index 68696cd6..8162736e 100644 --- a/includes/types.inc +++ b/includes/types.inc @@ -302,8 +302,9 @@ class wo_types $quick_actions = array( '=' => _('Remainder'), // post current base amount to GL account - '-' => _('Amount, reduce base'), // post amount to GL account and reduce base - '+' => _('Amount, increase base'), // post amount to GL account and increase base + 'a' => _('Amount'), // post amount to GL account + 'a+' => _('Amount, increase base'), // post amount to GL account and increase base + 'a-' => _('Amount, reduce base'), // post amount to GL account and reduce base '%' => _('% amount of base'), // store acc*amount% to GL account '%+' => _('% amount of base, increase base'), // ditto & increase base amount '%-' => _('% amount of base, reduce base'), // ditto & reduce base amount diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index 0de82dfe..b7271786 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -576,12 +576,15 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='') case "=": // post current base amount to GL account $part = $base; break; - case "-": // post amount to GL account and reduce base - $part = $qe_line['amount']; $base -= $part; + case "a": // post amount to GL account and reduce base + $part = $qe_line['amount']; break; - case "+": // post amount to GL account and increase base + case "a+": // post amount to GL account and increase base $part = $qe_line['amount']; $base += $part; break; + case "a-": // post amount to GL account and reduce base + $part = $qe_line['amount']; $base -= $part; + break; case "%": // store acc*amount% to GL account $part = round2($base * $qe_line['amount'] / 100, user_price_dec()); break; @@ -600,10 +603,10 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='') $tax_total = 0; foreach ($taxes as $index => $item_tax) { if(substr($qe_line['action'],0,1) != 'T') - $tax = round($base * $item_tax['rate'] + $tax = round2($base * $item_tax['rate'] / ($item_tax['rate'] + 100), user_price_dec()); else - $tax = round($base * $item_tax['rate'] / 100, user_price_dec()); + $tax = round2($base * $item_tax['rate'] / 100, user_price_dec()); $gl_code = $type != QE_DEPOSIT ? $item_tax['purchasing_gl_code'] : $item_tax['sales_gl_code']; @@ -612,7 +615,8 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='') $cart->add_gl_item($gl_code, $qe_line['dimension_id'], $qe_line['dimension2_id'], $tax, $qe['description']); - else { + else + { $acc_name = get_gl_account_name($gl_code); $cart->add_gl_codes_to_trans($gl_code, $acc_name, $qe_line['dimension_id'], @@ -628,11 +632,12 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='') if ($type != QE_SUPPINV) $cart->add_gl_item($qe_line['dest_id'], $qe_line['dimension_id'], $qe_line['dimension2_id'], $part, $qe['description']); - else { - $acc_name = get_gl_account_name($qe_line['dest_id']); - $cart->add_gl_codes_to_trans($qe_line['dest_id'], - $acc_name, $qe_line['dimension_id'], - $qe_line['dimension2_id'], $part, $qe['description']); + else + { + $acc_name = get_gl_account_name($qe_line['dest_id']); + $cart->add_gl_codes_to_trans($qe_line['dest_id'], + $acc_name, $qe_line['dimension_id'], + $qe_line['dimension2_id'], $part, $qe['description']); } } } diff --git a/sql/alter2.1.sql b/sql/alter2.1.sql index 8e5b45f1..20ddffc8 100644 --- a/sql/alter2.1.sql +++ b/sql/alter2.1.sql @@ -32,13 +32,14 @@ DROP TABLE IF EXISTS `0_groups`; CREATE TABLE `0_groups` ( `id` smallint(6) UNSIGNED NOT NULL auto_increment, `description` varchar(60) NOT NULL default '', + `inactive` tinyint(1) NOT NULL default 0, PRIMARY KEY (`id`), UNIQUE KEY `description` (`description`) ) TYPE=MyISAM AUTO_INCREMENT=1 ; -INSERT INTO `0_groups` VALUES ('1', 'Small'); -INSERT INTO `0_groups` VALUES ('2', 'Medium'); -INSERT INTO `0_groups` VALUES ('3', 'Large'); +INSERT INTO `0_groups` VALUES ('1', 'Small', '0'); +INSERT INTO `0_groups` VALUES ('2', 'Medium', '0'); +INSERT INTO `0_groups` VALUES ('3', 'Large', '0'); DROP TABLE IF EXISTS `0_recurrent_invoices`; @@ -91,11 +92,12 @@ CREATE TABLE `0_sales_pos` ( `credit_sale` tinyint(1) NOT NULL, `pos_location` varchar(5) NOT NULL, `pos_account` smallint(6) UNSIGNED NOT NULL, + `inactive` tinyint(1) NOT NULL default 0, PRIMARY KEY (`id`), UNIQUE KEY(`pos_name`) ) TYPE=MyISAM AUTO_INCREMENT=1; -INSERT INTO `0_sales_pos` VALUES ('1', 'Default', '1', '1', 'DEF', '1'); +INSERT INTO `0_sales_pos` VALUES ('1', 'Default', '1', '1', 'DEF', '1', '0'); ALTER TABLE `0_users` DROP COLUMN `pos`; ALTER TABLE `0_users` ADD `pos` SMALLINT(6) DEFAULT '1'; @@ -187,6 +189,7 @@ CREATE TABLE `0_item_codes` ( `category_id` smallint(6) UNSIGNED NOT NULL, `quantity` double NOT NULL default '1', `is_foreign` tinyint(1) NOT NULL default 0, + `inactive` tinyint(1) NOT NULL default 0, PRIMARY KEY (`id`), UNIQUE KEY(`stock_id`, `item_code`) ) TYPE=MyISAM AUTO_INCREMENT=1; @@ -239,3 +242,49 @@ CREATE TABLE IF NOT EXISTS `0_sql_trail` ( PRIMARY KEY (`id`) ) TYPE = MyISAM; +ALTER TABLE `0_tax_types` DROP COLUMN `out`; + +ALTER TABLE `0_chart_master` DROP COLUMN `inactive`; +ALTER TABLE `0_chart_master` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_currencies` DROP COLUMN `inactive`; +ALTER TABLE `0_currencies` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_bank_accounts` DROP COLUMN `inactive`; +ALTER TABLE `0_bank_accounts` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_stock_master` DROP COLUMN `inactive`; +ALTER TABLE `0_stock_master` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_workcentres` DROP COLUMN `inactive`; +ALTER TABLE `0_workcentres` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_locations` DROP COLUMN `inactive`; +ALTER TABLE `0_locations` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_sales_types` DROP COLUMN `inactive`; +ALTER TABLE `0_sales_types` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_areas` DROP COLUMN `inactive`; +ALTER TABLE `0_areas` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_salesman` DROP COLUMN `inactive`; +ALTER TABLE `0_salesman` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_shippers` DROP COLUMN `inactive`; +ALTER TABLE `0_shippers` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_credit_status` DROP COLUMN `inactive`; +ALTER TABLE `0_credit_status` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_payment_terms` DROP COLUMN `inactive`; +ALTER TABLE `0_payment_terms` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_suppliers` DROP COLUMN `inactive`; +ALTER TABLE `0_suppliers` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_stock_category` DROP COLUMN `inactive`; +ALTER TABLE `0_stock_category` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_item_units` DROP COLUMN `inactive`; +ALTER TABLE `0_item_units` ADD `inactive` tinyint(1) NOT NULL DEFAULT '0'; -- 2.30.2