Recurring invoices result in no dimensions on gl_trans. Fixed by company flag option.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 16 May 2020 13:29:39 +0000 (15:29 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 16 May 2020 13:29:39 +0000 (15:29 +0200)
admin/company_preferences.php
sales/create_recurrent_invoices.php

index f4e7f9264b7b5a8ed1f500ba5f24807a5f123ea0..8090d18e33ac7a8164be9082f2ea8d2d6f6f1268 100644 (file)
@@ -136,8 +136,8 @@ if (isset($_POST['update']) && $_POST['update'] != "")
                        get_post( array('coy_name','coy_no','gst_no','tax_prd','tax_last',
                                'postal_address','phone', 'fax', 'email', 'coy_logo', 'domicile',
                                'use_dimension', 'curr_default', 'f_year', 'shortname_name_in_list',
-                               'no_item_list' => 0, 'no_customer_list' => 0, 
-                               'no_supplier_list' =>0, 'base_sales', 'ref_no_auto_increase' => 0,
+                               'no_item_list' => 0, 'no_customer_list' => 0, 'no_supplier_list' => 0, 
+                               'base_sales', 'ref_no_auto_increase' => 0, 'dim_on_recurrent_invoice' => 0,
                                'time_zone' => 0, 'company_logo_report' => 0, 'barcodes_on_stock' => 0, 'print_dialog_direct' => 0, 
                                'add_pct', 'round_to', 'login_tout', 'auto_curr_reval', 'bcc_email', 'alternative_tax_include_on_docs', 
                                'suppress_tax_rates', 'use_manufacturing', 'use_fixed_assets'))
@@ -203,6 +203,12 @@ if (!isset($myrow["print_dialog_direct"]))
        $myrow["print_dialog_direct"] = get_company_pref("print_dialog_direct");
 }
 $_POST['print_dialog_direct']  = $myrow["print_dialog_direct"];
+if (!isset($myrow["dim_on_recurrent_invoice"]))
+{
+       set_company_pref("dim_on_recurrent_invoice", "setup.company", "tinyint", 1, '0');
+       $myrow["dim_on_recurrent_invoice"] = get_company_pref("dim_on_recurrent_invoice");
+}
+$_POST['dim_on_recurrent_invoice']  = $myrow["dim_on_recurrent_invoice"];
 $_POST['version_id']  = $myrow["version_id"];
 $_POST['add_pct'] = $myrow['add_pct'];
 $_POST['login_tout'] = $myrow['login_tout'];
@@ -240,11 +246,11 @@ label_row(_("Company Logo:"), $_POST['coy_logo']);
 file_row(_("New Company Logo (.jpg)") . ":", 'pic', 'pic');
 check_row(_("Delete Company Logo:"), 'del_coy_logo', $_POST['del_coy_logo']);
 
-check_row(_("Automatic Revaluation Currency Accounts"), 'auto_curr_reval', $_POST['auto_curr_reval']);
 check_row(_("Time Zone on Reports"), 'time_zone', $_POST['time_zone']);
 check_row(_("Company Logo on Reports"), 'company_logo_report', $_POST['company_logo_report']);
 check_row(_("Use Barcodes on Stocks"), 'barcodes_on_stock', $_POST['barcodes_on_stock']);
 check_row(_("Auto Increase of Document References"), 'ref_no_auto_increase', $_POST['ref_no_auto_increase']);
+check_row(_("Use Dimensions on Recurrent Invoices"), 'dim_on_recurrent_invoice', $_POST['dim_on_recurrent_invoice']);
 label_row(_("Database Scheme Version"), $_POST['version_id']);
 
 table_section(2);
@@ -255,6 +261,7 @@ text_row_ex(_("Tax Periods:"), 'tax_prd', 10, 10, '', null, null, _('Months.'));
 text_row_ex(_("Tax Last Period:"), 'tax_last', 10, 10, '', null, null, _('Months back.'));
 check_row(_("Put alternative Tax Include on Docs"), 'alternative_tax_include_on_docs', null);
 check_row(_("Suppress Tax Rates on Docs"), 'suppress_tax_rates', null);
+check_row(_("Automatic Revaluation Currency Accounts"), 'auto_curr_reval', $_POST['auto_curr_reval']);
 
 table_section_title(_("Sales Pricing"));
 sales_types_list_row(_("Base for auto price calculations:"), 'base_sales', $_POST['base_sales'], false,
index 3f359f8cd0a0bf5093f51d681cd1a881e0bbe130..ea71fd3a903d421d8f51a7739ae6e1c3555afa09 100644 (file)
@@ -27,12 +27,15 @@ page(_($help_context = "Create and Print Recurrent Invoices"), false, false, "",
 
 function create_recurrent_invoices($customer_id, $branch_id, $order_no, $tmpl_no, $date, $from, $to, $memo)
 {
-       global $Refs;
+       global $Refs, $SysPrefs;
 
        update_last_sent_recurrent_invoice($tmpl_no, $to);
 
        $doc = new Cart(ST_SALESORDER, array($order_no));
-
+       
+       if (!empty($SysPrefs->prefs['dim_on_recurrent_invoice']))
+               $doc->trans_type = ST_SALESINVOICE;
+       
        get_customer_details_to_order($doc, $customer_id, $branch_id);
 
        $doc->trans_type = ST_SALESORDER;