Page 1 of 1

Change credit note sales account

PostPosted: Fri Aug 12, 2016 10:19 am
by DannyC
I have an odd request from a customer. Well I reckon it's strange anyway but I sort of see their reasoning.

At the moment when a credit note is created, it uses the same GL posting as an invoice, just reversed. Including the Sales account.
They have a list of about 15 different Credit Reasons, and based on the credit reason, they want the Sales posted to a unique GL account.

First question:
Can I change the dialog screen for Credit Reasons to add a column to select GL account? Failing that, I can easily just pop a sales order custom field and look up the GL account.

2nd Question:
When the credit is processed, how can I change the Sales GL account that gets posted?

3rd Question:
The overarching question - is it even possible?

One more thing, I still prefer VB .Net over C#! The client are on 7.0.149 right now but will be upgrading as soon as the new version is out.

Cheers

Danny

Re: Change credit note sales account  Topic is solved

PostPosted: Wed Nov 09, 2016 5:18 pm
by Mike.Sheen
Hi Danny,

Attached is a plugin which does this (in VB.NET as requested).

It adds a column to the Credit Reason Maintenance form to allow the user to select a GL Account to use instead when processing credit notes using that credit reason.

EDIT: The plugin has a SQL script attached as a document to create the table needed for the plugin - once the plugin is imported, this should be saved to disk and run.

Mike

CreditReason_InventorySalesAccounts.PNG
screenshot
CreditReason_InventorySalesAccounts.PNG (18.97 KiB) Viewed 2308 times

Re: Change credit note sales account

PostPosted: Fri Nov 11, 2016 9:45 am
by DannyC
That is awesome!

In the intervening time since the first post, I have prob spent maybe a full week trying to nut this one out myself.
I managed to get a separate maintenance form running with string columns in the grid for the users to manually type in the reasons and GL accounts.

Now I can see how to add another column to the existing form, it opens up possibilities elsewhere (e.g. I have been asked to add a decimal column to Debtor Class Specific Pricing). Your solution is elegant and the code is easy to understand.

And I also worked out how to change the account when the sales order is processed - in this regard I was pleasantly surprised to see how similar my code was to yours.

Really appreciate your help on this one.

Cheers

Danny

Re: Change credit note sales account

PostPosted: Fri Nov 11, 2016 9:42 pm
by Mike.Sheen
DannyC wrote:In the intervening time since the first post, I have prob spent maybe a full week trying to nut this one out myself.


My apologies for it taking so long. I'm going through the process of addressing unanswered posts from oldest to newest, and hope to get on top of this soon.

Also, I noticed I have an error in my plugin.

In the Save_Ending handler I missed an @ in the INSERT statement:

Code: Select all
Sql = "INSERT INTO CreditReason_InventorySalesAccounts (CreditReasonID, GLLedgerID) VALUES (@CreditReasonID, GLLedgerID)"


Should be:

Code: Select all
Sql = "INSERT INTO CreditReason_InventorySalesAccounts (CreditReasonID, GLLedgerID) VALUES (@CreditReasonID, @GLLedgerID)"


Not sure how I missed that. I obviously failed to test creating a new credit reason, or that error would have been apparent.

I've updated my post to include a revised version of the plugin with the above fix. Also I failed to mention the plugin has a SQL script attached as a document to create the table needed for the plugin - once the plugin is imported, this should be saved to disk and run.