Split Customer Entries

MagnoMagno Member Posts: 168
Hi,

I need to make an adjustment for sales invoices, so that in some special cases, the customer entry that will be created will be split in 3 entries with different due dates.

In codeunit 21, specific when posting customer ledger, I did my checks, created a GenJnlLine2 which is a copy of GenJnlLine.
And made the PostCust with this data and the second. And again with the original amount - amounts from first 2 entries.

First time I got an error stating that the Invoice No X already exists (Customer entry check before creating again, which is not executed when recurring method is set)
I added some more checks to skip this test, but the next error leaves me a bit wondering how to solve it:

Microsoft Dynamics NAV Classic
The transaction cannot be completed because it will cause inconsistencies in the G/L Entry table.

Check where and how the CONSISTENT function is used in the transaction to find the reason for the error.

Contact your system administrator.

Tables can be marked as inconsistent during comprehensive tasks, such as posting. This prevents data from being updated incorrectly.

OK

Any ideas/tips/hints?
There are no bugs, only random undocumented features...
---
My Blog: http://NAV-Magno.be

Comments

  • udayrmerudayrmer Member Posts: 171
    Hi,

    This error occurred because while completing transaction, its Debit part & Credit part has some difference, that means if Debit part is 400.35 then Credit must be 400.35
    Uday Mer | MS Dynamics NAV Techno-Functional Consultant
  • ppavukppavuk Member Posts: 334
    I would say that this is very bad design, and even if you will be able to implement this - this will lead to many issues in future.

    As per NAV architecture you always should have 1 customer/vendor entry per sales/purchase document.

    If you need to have more than one entry - you have to deal not with posting routines, but split your data before posting, e.g create separate documents from your initial invoice.
  • udayrmerudayrmer Member Posts: 171
    Yes you are right, this is not a good design

    Will suggest you to handle such spiting before posting e.g. in Gen. Journal or Cash Receipt Journal, where you can add a button Split Lines which creates multiple Lines from one line with your some predefined conditions.
    Uday Mer | MS Dynamics NAV Techno-Functional Consultant
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Isn't this standard for NAV in countries like Italy?

    I've done it before in the past, it is not that difficult, as long as you program it on top of codeunit 80, using the General Journal.

    Basically what you do is design a transaction that can be executed on top of a posted sales invoice as if you would divide the entries manually. This way you are always "safe".
Sign In or Register to comment.