Topic: Test out new Sales Map and other Modules

@braathwaate has been good enough to release a few of his modules.

The FA community is requested to test them out and provide feedback.

Use DownGit to download just the modules you wish to test out.

The modules are:

Sales Map - Interactive map of customers with active sales history
Customer Statement Report - enhanced
Picklist for deliveries - US Packing List
Sales Type Summary Report
Bank GL Inquiry - with memo

Re: Test out new Sales Map and other Modules

Thank you braathwaate, will try out this week

3 (edited by poncho1234 07/05/2018 06:41:12 pm)

Re: Test out new Sales Map and other Modules

I had a problem with:-
Bank GL Inquiry - with memo giving following error:-
Call to undefined function payment_person_name_link() in \modules\bank_gl_inquiry\bank_gl_inquiry.php on line 139
And
Picklist for deliveries keeps stating:-
No sales orders found#
(Sorry didn't have time to investigate further)

[del]I like the Sales Type Summary Report - Should be included in core[/del]

Not so sure of the value of Customer Statement Report - @braathwaate comment welcome please

I need to do a clean install for the Sales Map, will have time later in week.

Re: Test out new Sales Map and other Modules

Replace

label_cell(payment_person_name_link($myrow["person_type_id"],$myrow["person_id"], true, get_post("TransAfterDate"),get_post("TransToDate")));

with

label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"], true));

The delivery picklist will not be useful in its current state because it is hard coded for a current sales type, makes custom numeric calculations, and relies on a checkbox enhancement in the core.

The only change in  the customer statement report is to display the customer check number for a customer payment, given that one enters this in the memo field of the customer payment.    No one will find this useful unless they follow that procedure.

Re: Test out new Sales Map and other Modules

Bank GL Inquiry - with memo now giving the following error:-

Call to undefined function scroll_down() in \modules\bank_gl_inquiry\bank_gl_inquiry.php on line 192

Re: Test out new Sales Map and other Modules

Try removing the scroll_down() call.

Re: Test out new Sales Map and other Modules

The function scroll_down() is defined in @braathwaate's version of includes/ui/ui_controls.inc:

function scroll_down($div)
{
    global $Ajax;

    $js = "
        var objDiv = document.getElementById('" . $div . "');
        objDiv.scrollTop = objDiv.scrollHeight;
    ";
    if (in_ajax()) {
        $Ajax->addScript(true, $js);
    } else
        add_js_source($js);
}

You can include the above function in the bank_gl_inquiry.php file or comment the scroll_down() call as @braathwaate stated.

Re: Test out new Sales Map and other Modules

There was also:-

set_browser_title("bank_account");

On line 193 which needs to be commented out

Re: Test out new Sales Map and other Modules

Other than less info whats the difference between report 304 and Sales Type Summary Report?

Re: Test out new Sales Map and other Modules

Sales Type Summary Report is based on report 309 (Sales Summary Report) but adds the ability to filter on sales type.  It collapses price (one line per item rather than one line per item/price) and sorts by item description rather than item number.  Both reports should always have the same total.

Use the original report if you are interested in seeing sales by price breakdown.   Use Sales Type Summary if you are interested in seeing sales by sales type.

I have defined several sales types (wholesale, retail, ...) in my installation and I have to report these sales separately on government reports.   (Reporting sales by tax group would also be useful).  I am not interested in seeing price breakdowns.

Re: Test out new Sales Map and other Modules

Wiki-ed it.

Re: Test out new Sales Map and other Modules

The Bank GL Inquiry works, just 2 remarks:

1. Not remembering the date (the ajax issue)
2. The delete button takes you to the general Void a Transaction screen. I thought it should take us to that specific transaction for deletion. I dont know how difficult it is to achieve that.

Looks promising.

Re: Test out new Sales Map and other Modules

The delete button is a separate core feature.   To add that, change void_transaction:

+++ b/core/admin/void_transaction.php
@@ -26,10 +26,35 @@ if (user_use_date_picker())
 if ($SysPrefs->use_popup_windows)
        $js .= get_js_open_window(800, 500);
        
+if (isset($_GET['trans_no'])
+    && isset($_GET['filterType'])) {
+    $_POST['FromTransNo'] = $_POST['ToTransNo'] = $_POST['selected_id'] = $_POST['trans_no'] = $_GET['trans_no'];
+}

 page(_($help_context = "Void a Transaction"), false, false, "", $js);

Then if you want control to return back to the inquiry page (in this case, bank g/l inquiry) after the delete, you can add the http referer core feature.  The code for both feature adds is:

@@ -26,10 +26,35 @@ if (user_use_date_picker())
 if ($SysPrefs->use_popup_windows)
        $js .= get_js_open_window(800, 500);
        
+if (isset($_GET['trans_no'])
+    && isset($_GET['filterType'])) {
+    $_POST['FromTransNo'] = $_POST['ToTransNo'] = $_POST['selected_id'] = $_POST['trans_no'] = $_GET['trans_no'];
+}
+
+$referer=parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH);
+if (basename($referer) == "index.php")
+    unset($_SESSION['HTTP_REFERER']);
+else if ($referer != $_SERVER['PHP_SELF'])
+    $_SESSION['HTTP_REFERER'] = $_SERVER['HTTP_REFERER'];
+
 page(_($help_context = "Void a Transaction"), false, false, "", $js);
 
 simple_page_mode(true);
 //----------------------------------------------------------------------------------------
+function returnToReferer($message)
+{
+    $referer=parse_url($_SESSION['HTTP_REFERER'], PHP_URL_PATH);
+    $params = parse_url(htmlspecialchars_decode($_SESSION['HTTP_REFERER']), PHP_URL_QUERY);
+    $params = preg_replace('/&message.*/', '', $params);
+    if (!empty($params))
+        $params .= "&";
+    $params .= "message=$message";
+
+    meta_forward($referer, $params);
+}
+
 function exist_transaction($type, $type_no)
 {
        $void_entry = get_voided_entry($type, $type_no);
@@ -287,6 +312,9 @@ function handle_void_transaction()
 
                if (!$msg) 
                {
+            if (isset($_SESSION['HTTP_REFERER']))
+                returnToReferer("Void Completed");
+
                        display_notification_centered(_("Selected transaction has been voided."));
                        unset($_POST['trans_no']);
                        unset($_POST['memo_']);
@@ -324,6 +352,8 @@ if (isset($_POST['ConfirmVoiding']))
 
 if (isset($_POST['CancelVoiding']))
 {
+    if (isset($_SESSION['HTTP_REFERER']))
+        returnToReferer("Void Canceled");
        $selected_id = -1;
        $Ajax->activate('_page_body');
 }

Re: Test out new Sales Map and other Modules

Hi Braath,
Just testing the first half of the above and it seems its not filtering the transaction type. The txn numbers are correct but the type always defaults to Journal Entry.

Re: Test out new Sales Map and other Modules

Somehow my cut and paste did more cutting than pasting.

@@ -26,10 +26,35 @@ if (user_use_date_picker())
 if ($SysPrefs->use_popup_windows)
     $js .= get_js_open_window(800, 500);
     
+if (isset($_GET['trans_no'])
+    && isset($_GET['filterType'])) {
+    $_POST['FromTransNo'] = $_POST['ToTransNo'] = $_POST['selected_id'] = $_POST['trans_no'] = $_GET['trans_no'];
+    $_POST['filterType'] = $_GET['filterType'];
+    $_POST['ProcessVoiding'] = true;
+}
+
+$referer=parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH);
+if (basename($referer) == "index.php")
+    unset($_SESSION['HTTP_REFERER']);
+else if ($referer != $_SERVER['PHP_SELF'])
+    $_SESSION['HTTP_REFERER'] = $_SERVER['HTTP_REFERER'];
+
 page(_($help_context = "Void a Transaction"), false, false, "", $js);
 
 simple_page_mode(true);
 //----------------------------------------------------------------------------------------
+function returnToReferer($message)
+{
+    $referer=parse_url($_SESSION['HTTP_REFERER'], PHP_URL_PATH);
+    $params = parse_url(htmlspecialchars_decode($_SESSION['HTTP_REFERER']), PHP_URL_QUERY);
+    $params = preg_replace('/&message.*/', '', $params);
+    if (!empty($params))
+        $params .= "&";
+    $params .= "message=$message";
+
+    meta_forward($referer, $params);
+}
+
 function exist_transaction($type, $type_no)
 {
     $void_entry = get_voided_entry($type, $type_no);
@@ -287,6 +312,9 @@ function handle_void_transaction()
 
         if (!$msg) 
         {
+            if (isset($_SESSION['HTTP_REFERER']))
+                returnToReferer("Void Completed");
+
             display_notification_centered(_("Selected transaction has been voided."));
             unset($_POST['trans_no']);
             unset($_POST['memo_']);
@@ -324,6 +352,8 @@ if (isset($_POST['ConfirmVoiding']))
 
 if (isset($_POST['CancelVoiding']))
 {
+    if (isset($_SESSION['HTTP_REFERER']))
+        returnToReferer("Void Canceled");
     $selected_id = -1;
     $Ajax->activate('_page_body');
 }

Re: Test out new Sales Map and other Modules

Yes.. Its working..

Re: Test out new Sales Map and other Modules

@joe: is it worth adding in this core feature?

Re: Test out new Sales Map and other Modules

Hello Guys,

I am not sure, but if there are several of you Senior Members then we should probably implement it into core.

I am overloaded with work at present and I haven't got time to look into this project. Are we talking about an imideate or next major (2.5) release?

Joe

Re: Test out new Sales Map and other Modules

Let us push it for a later release when you have more time as vetting it and it's ramifications are important. At the moment, @brathwaate's fork can be used by those interested.

Re: Test out new Sales Map and other Modules

The Bank GL Inquiry - with memo can stand on it's own as an extension and then as apmuthu states replace the existing Bank Account Inquiry as and when
The Customer Statement Report - enhanced & Sales Type Summary Report are suitable for extensions.

The Sales Map & Picklist for deliveries require further work before they are 'stand-alone' extensions; the picklist needs to be included in the sale map as if your business requires one of these it will probably require the other one as well.

Re: Test out new Sales Map and other Modules

I agree with @poncho1234 for the Bank GL Inquiry to be standalone extension for the time being. I see it being a part of the core very soon ..maybe in the next release if possible. It does give a good view of the Bank GL.

Now been testing this extension.. another 2 Remarks:

1. The screen is cluttered with all GL enteries.. Instead I would  like to have  a button to expand/collapse the entries within a transaction.
2. The (Enter Another Payment) or (Enter A Deposit) button  from the main screen always defaults to the current account even if one has already chosen another account. I would expect it to t go that specific account chosen to begin with.

Re: Test out new Sales Map and other Modules

1.  By design, the Bank GL Inquiry report is cluttered with GL entries.   If you do not want the GL entries, then use the built-in Bank Inquiry report.  Indeed, I don't use the GL report personally, but was requested by accounting staff.

2. The report relies on additional core change to gl_bank.php for this function to work.  It might work if you add something like

if isset($_GET['bank_account'])
    $_POST['bank_account'] = $_GET['bank_account'];

 
All the core changes to that file are:

diff --git a/core/gl/gl_bank.php b/core/gl/gl_bank.php
index 71e2c04..0897a1b 100644
--- a/core/gl/gl_bank.php
+++ b/core/gl/gl_bank.php
@@ -30,6 +30,8 @@ if ($SysPrefs->use_popup_windows)
 if (user_use_date_picker())
     $js .= get_js_date_picker();
 
+set_posts(array("bank_account"));
+
 if (isset($_GET['NewPayment'])) {
     $_SESSION['page_title'] = _($help_context = "Bank Account Payment Entry");
     create_cart(ST_BANKPAYMENT, 0);
@@ -43,6 +45,15 @@ if (isset($_GET['NewPayment'])) {
     $_SESSION['page_title'] = _($help_context = "Modify Bank Deposit Entry")." #".$_GET['trans_no'];
     create_cart(ST_BANKDEPOSIT, $_GET['trans_no']);
 }
+
+if (isset($_SERVER['HTTP_REFERER'])) {
+    $referer=parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH);
+    if (basename($referer) == "index.php")
+        unset($_SESSION['HTTP_REFERER']);
+    else if ($referer != $_SERVER['PHP_SELF'])
+        $_SESSION['HTTP_REFERER'] = $_SERVER['HTTP_REFERER'];
+}
+
 page($_SESSION['page_title'], false, false, '', $js);
 
 //-----------------------------------------------------------------------------------------------
@@ -78,9 +89,9 @@ if (isset($_GET['AddedID']))
 
     display_note(get_gl_view_str($trans_type, $trans_no, _("&View the GL Postings for this Payment")));
 
-    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another &Payment"), "NewPayment=yes");
+    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another &Payment"), "NewPayment=yes&date_=".$_GET['date_']."&bank_account=".$_POST['bank_account']);
 
-    hyperlink_params($_SERVER['PHP_SELF'], _("Enter A &Deposit"), "NewDeposit=yes");
+    hyperlink_params($_SERVER['PHP_SELF'], _("Enter A &Deposit"), "NewDeposit=yes&date_=".$_GET['date_']."&bank_account=".$_POST['bank_account']);
 
     hyperlink_params("$path_to_root/admin/attachments.php", _("Add an Attachment"), "filterType=$trans_type&trans_no=$trans_no");
 
@@ -112,9 +123,9 @@ if (isset($_GET['AddedDep']))
 
     display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Postings for this Deposit")));
 
-    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Deposit"), "NewDeposit=yes");
+    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Deposit"), "NewDeposit=yes&date_=".$_GET['date_']."&bank_account=".$_POST['bank_account']);
 
-    hyperlink_params($_SERVER['PHP_SELF'], _("Enter A Payment"), "NewPayment=yes");
+    hyperlink_params($_SERVER['PHP_SELF'], _("Enter A Payment"), "NewPayment=yes&date_=".$_GET['date_']."&bank_account=".$_POST['bank_account']);
 
     display_footer_exit();
 }
@@ -197,7 +208,10 @@ function create_cart($type, $trans_no)
 
     } else {
         $cart->reference = $Refs->get_next($cart->trans_type, null, $cart->tran_date);
-        $cart->tran_date = new_doc_date();
+            if (isset($_GET['date_']))
+                    $cart->tran_date  = $_GET['date_'];
+                else
+                    $cart->tran_date = new_doc_date();
         if (!is_date_in_fiscalyear($cart->tran_date))
             $cart->tran_date = end_fiscalyear();
     }
@@ -300,6 +314,16 @@ if (isset($_POST['Process']) && !check_trans())
 
     $trans_type = $trans[0];
        $trans_no = $trans[1];
+
+        // retain the reconciled status if desired by user
+        if (isset($_POST['reconciled'])
+            && $_POST['reconciled'] == 1) {
+            $sql = "UPDATE ".TB_PREF."bank_trans SET reconciled=".db_escape($_POST['reconciled_date'])
+                ." WHERE type=" . $trans_type . " AND trans_no=".db_escape($trans_no);
+
+            db_query($sql, "Can't change reconciliation status");
+        }
+
     new_doc_date($_POST['date_']);
 
     $_SESSION['pay_items']->clear_items();
@@ -307,12 +331,27 @@ if (isset($_POST['Process']) && !check_trans())
 
     commit_transaction();
 
-    if ($new)
-        meta_forward($_SERVER['PHP_SELF'], $trans_type==ST_BANKPAYMENT ?
-            "AddedID=$trans_no" : "AddedDep=$trans_no");
-    else
-        meta_forward($_SERVER['PHP_SELF'], $trans_type==ST_BANKPAYMENT ?
-            "UpdatedID=$trans_no" : "UpdatedDep=$trans_no");
+    $params = "";
+    $referer = "";
+    if (!isset($_SESSION['HTTP_REFERER'])) {
+        $referer=$_SERVER['PHP_SELF'];
+        if ($new) {
+            $params .= ($trans_type==ST_BANKPAYMENT ?  "AddedID=" : "AddedDep=");
+            $params .= "$trans_no&date_=".$_POST['date_']."&bank_account=".$_POST['bank_account'];
+        } else
+            $params .= ($trans_type==ST_BANKPAYMENT ?
+                "UpdatedID=$trans_no" : "UpdatedDep=$trans_no");
+    } else {
+        $referer=parse_url($_SESSION['HTTP_REFERER'], PHP_URL_PATH);
+        $params = parse_url(htmlspecialchars_decode($_SESSION['HTTP_REFERER']), PHP_URL_QUERY);
+        $params = preg_replace('/[&]*message.*/', '', $params);
+        if (!empty($params))
+            $params .= "&";
+        $params .= "message=";
+        $params .= ($trans_type==ST_BANKPAYMENT ? "Payment" : "Deposit");
+        $params .= " Completed";
+    }
+    meta_forward($referer, $params);
 
 }
 

Re: Test out new Sales Map and other Modules

Yes it works.. I guess you missed the brackets ..should be like:

if (isset($_GET['bank_account'])) {
    $_POST['bank_account'] = $_GET['bank_account'];
}