Page 1 of 1

Adding/removing columns in Purchase Order Generation

PostPosted: Tue Mar 14, 2017 9:07 am
by DannyC
Hi,

I have a client who wants to have a customised Purchase Order Generation screen grid, stuff like columns for the past 6 months of sales plus a total column, and several other custom columns which are not currently in the standard screen.
I know how to modify the underlying stored procedure to pull the data I need.
How complicated is it to change the columns displayed in the grid?

This client is on 7.0.157.
And my preferred language is VB.net

Thanks

Danny

Re: Adding/removing columns in Purchase Order Generation  Topic is solved

PostPosted: Thu Mar 16, 2017 10:43 am
by Mike.Sheen
Hi Danny,

It's a bit clunky because we don't have the right events in place in the business logic.

Adding the columns is easy - just in form setup you add them:

Code: Select all
poGenForm.ProductsJiwaGrid.AddColumn("Test", New JiwaFinancials.Jiwa.JiwaApplication.JiwaManageGrid.JiwaTextCellType, "Test", 5, False, , False, True, 50)


Then add a handler for the button to fetch the results to populate the grid:

Code: Select all
AddHandler poGenForm.GetCandidatesUltraButton.Click, AddressOf GetCandidatesUltraButton_Click


The inefficient part is what comes next - you have to call the stored proc used again, after the business logic has and iterate the results, looking for the row and match that up with the row in the grid, then set the value.

Attached is a plugin which does all this - note: I only added one column "Test" to the grid, and I modified my stored procedure (based on usp_JIWA_Batch_PurchaseOrder_ReplenishToMinimum) to return a column "Test" as well.

Mike

Re: Adding/removing columns in Purchase Order Generation

PostPosted: Tue Mar 28, 2017 10:52 am
by DannyC
That's a fantastic help Mike.
I have been able to add in half a dozen or so extra columns which are great - until saved.
Once saved, all the custom col data disappears. Columns are still there, just empty.

EDIT: 99.9% sure it's because the data isn't getting saved away to PO_BatchPurchaseOrderLines.

Re: Adding/removing columns in Purchase Order Generation

PostPosted: Tue Mar 28, 2017 12:17 pm
by Mike.Sheen
DannyC wrote:Once saved, all the custom col data disappears. Columns are still there, just empty.

EDIT: 99.9% sure it's because the data isn't getting saved away to PO_BatchPurchaseOrderLines.


Correct. If you want to persist that data, best bet is to create a new table with a link to PO_BatchPurchaseOrderLines.RecID - and write away the values on save, and read them back in on read.