Sales Order Lines custom fields for kits  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Sales Order Lines custom fields for kits

Postby DannyC » Fri Mar 04, 2016 4:42 pm

Hi,

version: 7.0.149
Lang: VB .Net

I am using a modified version of viewtopic.php?f=26&t=422 Sales Order Lines custom fields - make read only

This time I need to do basically the same except the difference will be that the custom field is read only for normal lines & kit component lines. In other words, editable for kit header lines only.
I am in a world of pain here - I thought this could be knocked over in an hour & have been struggling for about 6 hours!

I have attached the plugin here - almost identical to the plugin attached in the forum topic above except I am also checking for KitLineType.
No matter how I reprogram the plugin with various changes, I keep getting RowIndex errors similar to:
Error: Invalid Row Index: 3 (must be between 0 and 2)
Module: get_Item

The ultimate goal of the plugin is to make a kit backordered if any one component is on back order. I was going to use a custom line field to indicate the BO Qty of the kit header, then use that value to set the BO qty of all the kit components.

Cheers
Attachments
Plugin Backordered Kits.xml
(31.22 KiB) Downloaded 374 times
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31

Re: Sales Order Lines custom fields for kits  Topic is solved

Postby Mike.Sheen » Sat Mar 12, 2016 12:15 pm

Change
Code: Select all
For lineNumber As Integer = 0 To salesOrderForm.SalesOrder.SalesOrderLines.Count - 1

To
Code: Select all
For lineNumber As Integer = 0 To salesOrderForm.grdLines.ActiveSheet.RowCount - 1


You're getting an error on save as at the end of the save, a read is invoked and as part of that the LineDisplayed event you're handling is being invoked every time a line is added - so when the kit header is first added, the sales order lines collection has ALL the lines, but the grid only has one line - and you were trying to index rows which don't exist yet.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Sales Order Lines custom fields for kits

Postby DannyC » Mon Mar 14, 2016 3:06 pm

That's awesome. No errors!
User avatar
DannyC
Senpai
Senpai
 
Posts: 718
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 31


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests