Page 1 of 1

Change Quantities on a Sales Quote

PostPosted: Tue Jul 05, 2016 4:15 pm
by TomW
Hi,

Some time back I put a plug in together that generates a quote from a Excel spreadsheet. This works fine but, now I have been asked to add another field to the shreadsheet for the quantities. Not all quatities are going to set to more than the default 1 only selected ones. I am currently using the following to add the item:

salesQuoteEntryForm.SalesQuote.SalesQuoteLines.AddInventoryItem(partNoToAdd,JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuoteLineCollection.SalesQuoteLineInventorySeedTypes.e_SalesQuoteLinePartNo,ref newKey, null, 0);


I cannot find any way to alter the quantity throught the plugin. Could you guys point me in the right direction here it would be much appreciated.

Many Thanks

Tom

Re: Change Quantities on a Sales Quote

PostPosted: Sun Jul 31, 2016 12:05 pm
by Mike.Sheen
TomW wrote:Hi,

Some time back I put a plug in together that generates a quote from a Excel spreadsheet. This works fine but, now I have been asked to add another field to the shreadsheet for the quantities. Not all quatities are going to set to more than the default 1 only selected ones. I am currently using the following to add the item:

salesQuoteEntryForm.SalesQuote.SalesQuoteLines.AddInventoryItem(partNoToAdd,JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuoteLineCollection.SalesQuoteLineInventorySeedTypes.e_SalesQuoteLinePartNo,ref newKey, null, 0);


I cannot find any way to alter the quantity throught the plugin. Could you guys point me in the right direction here it would be much appreciated.

Many Thanks

Tom


Hi Tom,

Just set the Quantity property after adding the line to the quote - the AddInventoryItem method returns a newKey by reference, and this is the index to the newly added line - so:
Code: Select all
salesQuoteEntryForm.SalesQuote.SalesQuoteLines[newKey].Quantity = 10;


Mike

Re: Change Quantities on a Sales Quote

PostPosted: Mon Aug 01, 2016 9:14 am
by TomW
Hi Mike

You guys must be a bit busy working on a Sunday, thanks for the reply it a return a couple of issues.

What I tried was
Code: Select all
salesQuoteEntryForm.SalesQuote.SalesQuoteLines.AddInventoryItem(partNoToAdd,JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuoteLineCollection.
SalesQuoteLineInventorySeedTypes.e_SalesQuoteLinePartNo,ref newKey, null, 0);         
salesQuoteEntryForm.SalesQuote.SalesQuoteLines[newKey].Quantity = 10;

The above returned 2 errors

The first one was Argument 1: cannot convert from 'object to int' I fixed that by casting newKey to and int
Code: Select all
lNum = (int)newKey;

now I am left with this next error

Re: Change Quantities on a Sales Quote

PostPosted: Mon Aug 01, 2016 9:17 am
by TomW
Sorry Mike pressed the wrong button

The final error

'JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuoteLine' does not contain a definition for 'Quantity' and no extension method 'Quantity'

This bring me back to the problem I had initially where I could find no reference to the Quantity.

Thanks

Tom

Re: Change Quantities on a Sales Quote  Topic is solved

PostPosted: Sun Aug 07, 2016 4:24 pm
by Mike.Sheen
TomW wrote:Sorry Mike pressed the wrong button

The final error

'JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuoteLine' does not contain a definition for 'Quantity' and no extension method 'Quantity'

This bring me back to the problem I had initially where I could find no reference to the Quantity.

Thanks

Tom


Sorry, Tom - my mistake - it's QuantityOrdered, not Quantity.

Mike