1 (edited by poncho1234 02/03/2018 01:44:22 am)

Topic: No edit in supplier invoice quick entry

Hi,

When creating a quick entry for the following:-

bank deposits,
payments,
journal entries

You have the opportunity to edit or delete the row or rows created

But in supplier invoice there is only the option to delete the row or rows; there is no option to edit?

Is this correct? If so what is the reasoning behind it?

Edit: Is this because the suppier invoice is for items received but not yet invoiced?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: No edit in supplier invoice quick entry

Possibly an edit might confuse the system's average / costing computation. It is easier to revert to the previous cost and then compute anew when entered again.

Re: No edit in supplier invoice quick entry

When would the avg cost be calculated? After the invoice is processed I think?

Also, one of the advantages / functions of quick entries is that you can enter any amount in and the same calculation is completed, so avg cost will fluctuate anyway.

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: No edit in supplier invoice quick entry

@poncho1234

I have followed your request for this "edit" option since I started using FA in April of 2018.  In my research, a similar question was asked in 2010 and 2011.   That is all I could find and no one has expanded on your post of 02/03/2018.

I have a need for this option for the way I use FA for a not for profit organization.   All I desire is to be able to edit the supplier invoice quick entry while creating the "GL Items for this Invoice". I am using quick entries for the individual line items needed to generate the GL items for the supplier invoice.  Note that these Quick Entries are simple single Expense Account assignments to a specific service account number provided without any Tax, surcharge, shipping or anything added in.

The fields that I would like to edit could be one or all of the normal fields available when entering a GL entry into the empty grid;
  Name
  Dimension 1
  Dimension 2
  Amount
  Memo

To see what is changed or added in the database, I made a single quick entry for one supplier and used WinMerge to show all changes.  Since I am not knowledgeable of SQL, I could not see any calculations behind the scenes other than saving exacting what I entered in the lines after clicking "Enter Invoice".  I even compared the changes when entering a different one, "deleting" this Quick Entry and manually entering the data for the correct entry and the database changes were the same. 

Because of this, I could not see any reason why being able to edit a GL line entry before it is "saved" or "posted" is prohibited. I am not asking to be able to pull up an existing processed supplier invoice and change it, I'm only asking to be able to edit the GL items for the new invoice that is currently being created before it is ever saved.

If you need any specifics, please ask and I will explain as much as I can since what I am asking is not proprietary in any way and I think is much needed by current users of FA.

[url=https://vgruk.com/]buy here[/url]

Re: No edit in supplier invoice quick entry

My five minute edit solution (delete the g/l item but then default the fields on the new line) is:

diff --git a/core/purchasing/includes/ui/invoice_ui.inc b/core/purchasing/includes/ui/invoice_ui.inc
index b6d3d4f..53b4f3c 100644
--- a/core/purchasing/includes/ui/invoice_ui.inc
+++ b/core/purchasing/includes/ui/invoice_ui.inc
@@ -199,6 +199,7 @@ function invoice_totals(&$supp_trans)
 function display_gl_controls(&$supp_trans, $k)
 {
        $accs = get_supplier_accounts($supp_trans->supplier_id);
+    if (!isset($_POST['gl_code']))
        $_POST['gl_code'] = $accs['purchase_account'] ? 
                $accs['purchase_account'] : get_company_pref('default_cogs_act');
 
@@ -316,7 +317,8 @@ function display_gl_items(&$supp_trans, $mode=0)
                        {
                                delete_button_cell("Delete2" . $entered_gl_code->Counter, _("Delete"),
                                          _('Remove line from document'));
-                               label_cell("");
+                               edit_button_cell("Edit" . $entered_gl_code->Counter, _("Edit"),
+                                         _('Edit line from document'));
                        }       
                        end_row();
                        if ($mode > 1) {
diff --git a/core/purchasing/supplier_invoice.php b/core/purchasing/supplier_invoice.php
index 3e1bcdc..a0bb0fd 100644
--- a/core/purchasing/supplier_invoice.php
+++ b/core/purchasing/supplier_invoice.php
@@ -352,6 +352,15 @@ if ($id4 != -1)
        $Ajax->activate('gl_items');
 }
 
+$id4 = find_submit('Edit');
+if ($id4 != -1)
+{
+       display_notification($_POST['gl_code']);
+       $_SESSION['supp_trans']->remove_gl_codes_from_trans($id4);
+       reset_tax_input();
+       $Ajax->activate('gl_items');
+}
+
 $id2 = -1;
 if ($_SESSION["wa_current_user"]->can_access('SA_GRNDELETE'))
 {

Use at your own risk.

Re: No edit in supplier invoice quick entry

@joe: is it to be added in the core?

7 (edited by JimmyC 03/18/2019 02:28:36 pm)

Re: No edit in supplier invoice quick entry

@Braath Waate  Thank you very much for for the code snippet from above.  It should completely fulfill my request but I have either made a change wrong or my existing version of FA isn't updated to the correct level.

To begin with, I am using Version 2.4.4 Build 17.03.2018.  When I try Purchases -> Supplier Invoices -> Go to add an entry using the Quick Entry method, I get the entry added correctly but with the "red x" in the next to last right side field and the "Edit Pencil" in the right most field.  To me, that is what I was hoping for but when I press either the "red x" or "Edit Pencil", the line is deleted and all that is left is the original partially empty default line that is there when first entering this input form. 

Also, the "Edit Pencil" not only deletes the Quick Entry line but then displays a light green banner across the top of the form with the Account Number of the default entry centered in the green banner and "Edit line from document" box on the far right side of the form's title line.

I have attached copied code snippets that I changed for both of my files below:

Part 1 of changes to invoice_ui.inc:

//--------------------------------------------------------------------------------------------------
function display_gl_controls(&$supp_trans, $k)
{
    $accs = get_supplier_accounts($supp_trans->supplier_id);
    if (!isset($_POST['gl_code']))
        $_POST['gl_code'] = $accs['purchase_account'] ? 
            $accs['purchase_account'] : get_company_pref('default_cogs_act');

Part 2 of changes to invoice_ui.inc:

            {
                delete_button_cell("Delete2" . $entered_gl_code->Counter, _("Delete"),
                      _('Remove line from document'));
                edit_button_cell("Edit" . $entered_gl_code->Counter, _("Edit"),
                        _('Edit line from document'));            
            }    
            end_row();
            if ($mode > 1) {

1 set of changes in purchasing/supplier_invoice.php:

    $Ajax->activate('gl_items');
}

$id4 = find_submit('Edit');
if ($id4 != -1)
{
       display_notification($_POST['gl_code']);
       $_SESSION['supp_trans']->remove_gl_codes_from_trans($id4);
       reset_tax_input();
       $Ajax->activate('gl_items');
}

$id2 = -1;
if ($_SESSION["wa_current_user"]->can_access('SA_GRNDELETE'))
{

Thank you for all of the help that you have done.  If you or anyone can find what I have done wrong, it will be greatly appreciated.

JimmyC

[url=https://vgruk.com/]buy here[/url]

Re: No edit in supplier invoice quick entry

Sorry.   The supplier_invoice.php changes should have been:

+++ b/core/purchasing/supplier_invoice.php
@@ -352,6 +352,20 @@ if ($id4 != -1)
        $Ajax->activate('gl_items');
 }
 
+$id5 = find_submit('Edit');
+if ($id5 != -1)
+{
+    $_POST['gl_code'] = $_SESSION['supp_trans']->gl_codes[$id5]->gl_code;
+    $_POST['dimension_id'] = $_SESSION['supp_trans']->gl_codes[$id5]->gl_dim;
+    $_POST['dimension2_id'] = $_SESSION['supp_trans']->gl_codes[$id5]->gl_dim2;
+    $_POST['amount'] = $_SESSION['supp_trans']->gl_codes[$id5]->amount;
+    $_POST['memo_'] = $_SESSION['supp_trans']->gl_codes[$id5]->memo_;
+
+       $_SESSION['supp_trans']->remove_gl_codes_from_trans($id5);
+       reset_tax_input();
+       $Ajax->activate('gl_items');
+}
+
 $id2 = -1;
 if ($_SESSION["wa_current_user"]->can_access('SA_GRNDELETE'))
 {

Re: No edit in supplier invoice quick entry

@Braath Waate  Thank you, thank you, thank you very much!   This works perfect! 

I really don't know if it works correctly for manufacturing or normal retail profit businesses because all I have done is Church accounting for the last 10 years.  If anyone else uses this for the above type profit businesses and it doesn't mess up the taxes or other costs, then you wholeheartedly have my vote to get this put into the core for the next release.

Thank you again for your immediate support!

JimmyC

[url=https://vgruk.com/]buy here[/url]

Re: No edit in supplier invoice quick entry

@Braath Waate.

Is this safe to implement in the core now?

Joe

Re: No edit in supplier invoice quick entry

@joe

I really didn't do any testing, but I think it is safe, because the edit just is a copy of the existing delete code, and then just defaults the newline to the edit line values, so it shouldn't cause any harm.

Re: No edit in supplier invoice quick entry

@BraathbWaate.

Ok I will commit it later.

Joe

Committed