From c6147603044ff0981ed4fa4de419ae77fd3f1ef7 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Thu, 11 Dec 2008 12:36:29 +0000 Subject: [PATCH] Two new fields in company table, accumulate_shipping and logal_text Accumulat shipping is for accumulating shipping on batch invoice Legal text is a last line legal info on sales invoices. --- CHANGELOG.txt | 10 ++++++++++ admin/db/company_db.inc | 4 ++++ admin/gl_setup.php | 23 ++++++++++++++++------- purchasing/includes/ui/invoice_ui.inc | 2 +- reporting/includes/header2.inc | 6 ++++++ sales/customer_invoice.php | 27 +++++++++++++++++++++++++++ sql/alter2.1.sql | 6 ++++++ 7 files changed, 70 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2dde7660..d72a3c8c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,16 @@ Legend: ! -> Note $ -> Affected files +11-Dec-2008 Joe Hunt ++ Two new fields in company table, accumulate_shipping and logal_text + Accumulat shipping is for accumulating shipping on batch invoice + Legal text is a last line legal info on sales invoices. +$ /sql/alter2.1.sql + /admin/db/company_db.inc + /admin/gl_setup.php + /reporting/includes/header2.inc + /sales/customer_invoice.php + 10-Dec-2008 Janusz Dobrowolski # File and line was not displayed for devel error messages. $ /includes/errors.inc diff --git a/admin/db/company_db.inc b/admin/db/company_db.inc index 817b5d19..ba56c4b9 100644 --- a/admin/db/company_db.inc +++ b/admin/db/company_db.inc @@ -23,6 +23,8 @@ function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act $allow_negative_stock, $po_over_receive, $po_over_charge, + $accumulate_shipping, + $legal_text, $past_due_days, $default_credit_limit, $default_workorder_required, @@ -44,6 +46,8 @@ function update_company_gl_setup($debtors_act, $pyt_discount_act, $creditors_act allow_negative_stock=$allow_negative_stock, po_over_receive=$po_over_receive, po_over_charge=$po_over_charge, + accumulate_shipping=$accumulate_shipping, + legal_text=".db_escape($legal_text).", past_due_days=$past_due_days, default_credit_limit=$default_credit_limit, default_workorder_required=$default_workorder_required, diff --git a/admin/gl_setup.php b/admin/gl_setup.php index 9a05784f..cbb2cc82 100644 --- a/admin/gl_setup.php +++ b/admin/gl_setup.php @@ -66,6 +66,8 @@ if (isset($_POST['submit']) && can_process()) check_value('allow_negative_stock'), input_num('po_over_receive'), input_num('po_over_charge'), + check_value('accumulate_shipping'), + $_POST['legal_text'], $_POST['past_due_days'], $_POST['default_credit_limit'], $_POST['default_workorder_required'], @@ -109,6 +111,8 @@ $_POST['po_over_charge'] = percent_format($myrow['po_over_charge']); $_POST['past_due_days'] = $myrow['past_due_days']; $_POST['default_credit_limit'] = $myrow['default_credit_limit']; +$_POST['legal_text'] = $myrow['legal_text']; +$_POST['accumulate_shipping'] = $myrow['accumulate_shipping']; $_POST['default_workorder_required'] = $myrow['default_workorder_required']; $_POST['default_dim_required'] = $myrow['default_dim_required']; @@ -133,6 +137,10 @@ table_section_title(_("Customers and Sales")); text_row(_("Default Credit Limit:"), 'default_credit_limit', $_POST['default_credit_limit'], 12, 12); +check_row(_("Accumulate batch shipping:"), 'accumulate_shipping', null); + +textarea_row(_("Legal Text on Invoice:"), 'legal_text', $_POST['legal_text'], 32, 3); + gl_all_accounts_list_row(_("Shipping Charged Account:"), 'freight_act', $_POST['freight_act']); //--------------- @@ -148,20 +156,26 @@ gl_all_accounts_list_row(_("Sales Discount Account:"), 'default_sales_discount_a gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'default_prompt_payment_act'); +//---------------- + +table_section_title(_("Dimension Defaults")); + +text_row(_("Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, '', "", _("days")); //--------------- +table_section(2); + table_section_title(_("Suppliers and Purchasing")); percent_row(_("Delivery Over-Receive Allowance:"), 'po_over_receive'); percent_row(_("Invoice Over-Charge Allowance:"), 'po_over_charge'); + // Not used in FA2.0. //gl_all_accounts_list_row(_("Purchases Exchange Variances Account:"), 'purch_exchange_diff_act', $_POST['purch_exchange_diff_act']); // Not used in FA2.0. //gl_all_accounts_list_row(_("Goods Received Clearing Account:"), 'grn_act', $_POST['grn_act']); -//--------------- -table_section(2); table_section_title(_("Suppliers and Purchasing Defaults")); gl_all_accounts_list_row(_("Payable Account:"), 'creditors_act', $_POST['creditors_act']); @@ -189,11 +203,6 @@ table_section_title(_("Manufacturing Defaults")); text_row(_("Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, '', "", _("days")); -//---------------- - -table_section_title(_("Dimension Defaults")); - -text_row(_("Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, '', "", _("days")); //---------------- diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index d0bd3fa6..a5944816 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -395,7 +395,7 @@ function display_grn_items(&$supp_trans, $mode=0) //br(); display_note($heading2, 0, 0, "class='overduefg'"); } - echo ""; + echo ""; submit('InvGRNAll', _("Add All Items"), true, false,true); } diff --git a/reporting/includes/header2.inc b/reporting/includes/header2.inc index 9ee5b813..f1cadabb 100644 --- a/reporting/includes/header2.inc +++ b/reporting/includes/header2.inc @@ -248,6 +248,12 @@ $this->TextWrap($ccol, $this->row, $right - $ccol, $this->params['comments'], 'C'); $this->NewLine(); } + $legal = get_company_pref('legal_text'); + if ($doctype == 10 && $legal != "") + { + $this->TextWrap($ccol, $this->row, $right - $ccol, $legal, 'C'); + $this->NewLine(); + } $this->Font(); $temp = $iline6 - $this->lineHeight - 2; ?> \ No newline at end of file diff --git a/sales/customer_invoice.php b/sales/customer_invoice.php index e795a30f..af67283b 100644 --- a/sales/customer_invoice.php +++ b/sales/customer_invoice.php @@ -77,6 +77,10 @@ if (isset($_GET['AddedID'])) { } } unset($line); + + // Remove also src_doc delivery note + $sources = &$_SESSION['Items']->src_docs; + unset($sources[$_GET['RemoveDN']]); } //----------------------------------------------------------------------------- @@ -178,6 +182,24 @@ function check_quantities() return $ok; } +function set_delivery_shipping_sum($delivery_notes) +{ + + $shipping = 0; + + foreach($delivery_notes as $delivery_num) + { + $myrow = get_customer_trans($delivery_num, 13); + //$branch = get_branch($myrow["branch_code"]); + //$sales_order = get_sales_order_header($myrow["order_"]); + + //$shipping += $sales_order['freight_cost']; + $shipping += $myrow['ov_freight']; + } + $_POST['ChargeFreightCost'] = price_format($shipping); +} + + function copy_to_cart() { $cart = &$_SESSION['Items']; @@ -297,6 +319,7 @@ $dspans[] = $spanlen; //----------------------------------------------------------------------------- $is_batch_invoice = count($_SESSION['Items']->src_docs) > 1; + $is_edition = $_SESSION['Items']->trans_type == 10 && $_SESSION['Items']->trans_no != 0; start_form(false, true); @@ -430,6 +453,10 @@ if (!isset($_POST['ChargeFreightCost']) || $_POST['ChargeFreightCost'] == "") { } } +$accumulate_shipping = get_company_pref('accumulate_shipping'); +if ($is_batch_invoice && $accumulate_shipping) + set_delivery_shipping_sum(array_keys($_SESSION['Items']->src_docs)); + start_row(); small_amount_cells(_("Shipping Cost"), 'ChargeFreightCost', null, "colspan=9 align=right"); diff --git a/sql/alter2.1.sql b/sql/alter2.1.sql index d29d00c0..80f7de19 100644 --- a/sql/alter2.1.sql +++ b/sql/alter2.1.sql @@ -187,6 +187,12 @@ CREATE TABLE `0_item_codes` ( ALTER TABLE `0_company` DROP COLUMN `foreign_codes`; ALTER TABLE `0_company` ADD `foreign_codes` TINYINT(1) NOT NULL DEFAULT '0'; +ALTER TABLE `0_company` DROP COLUMN `accumulate_shipping`; +ALTER TABLE `0_company` ADD `accumulate_shipping` TINYINT(1) NOT NULL DEFAULT '0'; + +ALTER TABLE `0_company` DROP COLUMN `legal_text`; +ALTER TABLE `0_company` ADD `legal_text` tinytext NOT NULL DEFAULT ''; + ALTER TABLE `0_suppliers` DROP COLUMN `supp_address`; ALTER TABLE `0_suppliers` ADD `supp_address` tinytext NOT NULL DEFAULT '' AFTER `address`; -- 2.30.2