Two new fields in company table, accumulate_shipping and logal_text
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 11 Dec 2008 12:36:29 +0000 (12:36 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 11 Dec 2008 12:36:29 +0000 (12:36 +0000)
 Accumulat shipping is for accumulating shipping on batch invoice
 Legal text is a last line legal info on sales invoices.

CHANGELOG.txt
admin/db/company_db.inc
admin/gl_setup.php
purchasing/includes/ui/invoice_ui.inc
reporting/includes/header2.inc
sales/customer_invoice.php
sql/alter2.1.sql

index 2dde7660e998f0c03f24d2f92b95c7e213d640a3..d72a3c8c46507d85f3a3d194bc8d69c30a5a1e2d 100644 (file)
@@ -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
index 817b5d19b0c0eec69fc4a2b638a6624202f22ce2..ba56c4b905d8c55e3549566488ca8ec708145afd 100644 (file)
@@ -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,
index 9a05784ffcc014bce34fd0efa70d6a2cd739f15f..cbb2cc825da411a75d4d0438bd15ab3bd6cb3e3d 100644 (file)
@@ -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"));
 
 //----------------
 
index d0bd3fa65226334b9a8981283ab010251d84648f..a5944816176b822aab497b4a16c13df6a4032113 100644 (file)
@@ -395,7 +395,7 @@ function display_grn_items(&$supp_trans, $mode=0)
                        //br();
                        display_note($heading2, 0, 0, "class='overduefg'");
                }       
-               echo "</td><td align='right'>";
+               echo "</td><td width=10% align='right'>";
                submit('InvGRNAll', _("Add All Items"), true, false,true);
        }       
 
index 9ee5b8136533adfcb9df7d9c911c5729518685ed..f1cadabb2becb31115a859647b389fbb7d2aabd4 100644 (file)
                        $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
index e795a30f4dc2b3e33f30490dd4ab7f140f0e90b5..af67283bfcf9eb03a60046a02538d2fc11c51a92 100644 (file)
@@ -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");
index d29d00c076fe794b1c7ca413a81a187a17c2dc9c..80f7de1975916a0afa6796714f89e1d726b5968e 100644 (file)
@@ -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`;