Page 1 of 1

adding a debtor class specific price to the Inventroy

PostPosted: Tue Jun 10, 2014 5:05 pm
by indikad
Jiwa 7 ver 60
I am trying to add few "debtor class specific prices" to the Inventor Master for a New Item
However I am having a bit of trouble finding the correct object method to do so. Any help is appreciated.
below is a sample of code I am trying with

Code: Select all

'---
Dim oInventory As JiwaInventory.Inventory  = DirectCast (sender , JiwaInventory.Inventory )
oInventory.DebtorClassPrices.Add (oDebtClassPrice)   

the below code line works for 6.5.13
InventoryObject.AddDebtorClassPrice( DebtorClassificationID) ' passing a string - I think it needs a object of DebtorClassPrice but I am unsure of how to instantiate it

Re: adding a debtor class specific price to the Inventroy

PostPosted: Tue Jun 10, 2014 9:58 pm
by Mike.Sheen
Hi Indika,

You want to create a new DebtorClassPrice object, then add that to the DebtorClassPrices collection.

This is what we do in the inventory maintenance form when the button is clicked on the grid to add a new debtor classification price, which prompts the user to select a debtor classification using a search window:

Code: Select all
Dim debtorClassPrice As New JiwaInventory.DebtorClassPrice
debtorClassPrice.DebtorClassification.Search(Me)
Inventory.DebtorClassPrices.Add(debtorClassPrice)


If you're not interacting with a user, then instead of doing a .Search, do a .ReadRecord of the classification - if you have the ID:

Code: Select all
Dim debtorClassPrice As New JiwaInventory.DebtorClassPrice
' EDIT: This is erroneous --> debtorClassPrice.ReadRecord("TheDebtorClassificationIDGoesHere")
debtorClassPrice.DebtorClassification.ReadRecord("TheDebtorClassificationIDGoesHere")
Inventory.DebtorClassPrices.Add(debtorClassPrice)


If you don't know the ID, you can choose to use ReadRecordFromDescription or ReadDefaultRecord instead of ReadRecord.

Mike

Re: adding a debtor class specific price to the Inventroy

PostPosted: Thu Jun 12, 2014 11:23 am
by indikad
Hi Mike,

thanks very much for the attention.

I was trying this path before -
Yes I am not interacting with the user so I need to do a ReadRecord.

The issue I am having with that is JiwaInventory.DebtorClassPrice object does not expose a ReadRecord method on the version I am in .60
Is this something later that .60 ?

I see a Read method but that does not take a parameter.
below are 2 codes snippets that I tried with
Code: Select all
While (dr.Read())
       oDebtClassPrice.DebtorClassPrices.ReadRecord(dr("DebtorClassificationID").ToString() )oInventory.DebtorClassPrices.Add (oDebtClassPrice)               
            End While

Re: adding a debtor class specific price to the Inventroy

PostPosted: Thu Jun 12, 2014 11:42 am
by indikad
Hi Mike,

thanks very much for the attention.

I was infact trying this path before -
Yes, I am not interacting with the user so I need to do a ReadRecord.

The issue I am having with that is JiwaInventory.DebtorClassPrice object does not expose a ReadRecord method on the version I am in .60
Is ReadRecord something later that .60 ?

I see a Read method but that does not take a parameter.
below are 2 codes snippets that I tried with
1. This wont compile because there is no readrecord for me
Code: Select all
Dim oDebtClassPrice As New JiwaInventory.DebtorClassPrice
While (dr.Read())
       oDebtClassPrice.DebtorClassPrices.ReadRecord(DebtorClassificationID)     
       oInventory.DebtorClassPrices.Add (oDebtClassPrice)   
End While

2. This compiles - but I get a run time error "debtorclass pricing object not set to an instance of an object " (but I have !!)
Code: Select all
Dim oDebtClassPrice As New JiwaInventory.DebtorClassPrice
While (dr.Read())
     oDebtClassPrice.RecID  = dr("DebtorClassificationID").ToString()
     oDebtClassPrice.DebtorClassPrices.Read()      
     oInventory.DebtorClassPrices.Add (oDebtClassPrice)
End While


Re: adding a debtor class specific price to the Inventroy  Topic is solved

PostPosted: Thu Jun 12, 2014 9:54 pm
by Mike.Sheen
Ok - I see the problem - my guidance was erroneous:

I stated:

Code: Select all
Dim debtorClassPrice As New JiwaInventory.DebtorClassPrice
debtorClassPrice.ReadRecord("TheDebtorClassificationIDGoesHere")
Inventory.DebtorClassPrices.Add(debtorClassPrice)


but it should have been:

Code: Select all
Dim debtorClassPrice As New JiwaInventory.DebtorClassPrice
debtorClassPrice.DebtorClassification.ReadRecord("TheDebtorClassificationIDGoesHere")
Inventory.DebtorClassPrices.Add(debtorClassPrice)


Sorry about that. So, to make your code work - you need this:

Code: Select all
While (dr.Read())
     Dim oDebtClassPrice As New JiwaInventory.DebtorClassPrice
     oDebtClassPrice.DebtorClassification.ReadRecord(dr("DebtorClassificationID").ToString())      
     oInventory.DebtorClassPrices.Add(oDebtClassPrice)
End While


Does the above work for you?

Re: adding a debtor class specific price to the Inventroy

PostPosted: Mon Jun 16, 2014 5:48 pm
by indikad
Hi Mike,

This works very well. Thanks for this.

when you have a chance can you please let me know how I can find the constants such as
DebtorPriceModes

I've used a number and it works well - but would like to use Jiwa constant for programming neatness.
Code: Select all
oDebtClassPrice.Mode = 2' would like to use the constant here instead of the 2

Re: adding a debtor class specific price to the Inventroy

PostPosted: Mon Jun 16, 2014 9:48 pm
by Mike.Sheen
indikad wrote:Hi Mike,

This works very well. Thanks for this.

when you have a chance can you please let me know how I can find the constants such as
DebtorPriceModes

I've used a number and it works well - but would like to use Jiwa constant for programming neatness.
Code: Select all
oDebtClassPrice.Mode = 2' would like to use the constant here instead of the 2


The fully namespaced enumeration is:

JiwaFinancials.Jiwa.JiwaInventory.DebtorPriceCollection.DebtorPriceModes

And so each value would be expressed as:

JiwaFinancials.Jiwa.JiwaInventory.DebtorPriceCollection.DebtorPriceModes.e_DebtorPriceModePercentage
JiwaFinancials.Jiwa.JiwaInventory.DebtorPriceCollection.DebtorPriceModes.e_DebtorPriceModeActual
JiwaFinancials.Jiwa.JiwaInventory.DebtorPriceCollection.DebtorPriceModes.e_DebtorPriceModeNone

I'm yet to check, but I would have thought the intellisense in either Visual Studio or the Plugin editor would have provided some guidance there... so when you type

oDebtClassPrice.Mode =

It should provide a tooltip and/or auto-completion hints - was this not the case?

Hope this helps,

Mike

Re: adding a debtor class specific price to the Inventroy

PostPosted: Wed Jun 18, 2014 12:41 pm
by indikad
Thanks - for this Mike.

yes strangely I could not get the intellisense fired up to show me the constants ( tried hitting ctrl + space too )
may be its the patch I am in PL 60 ?

these 2 lines work - as per your instructions
oDebtClassPrice.Mode =JiwaFinancials.Jiwa.JiwaInventory.DebtorPriceCollection.DebtorPriceModes.e_DebtorPriceModeNone

'below with imports statement of Imports JiwaFinancials.Jiwa.JiwaInventory
oDebtClassPrice.Mode = DebtorPriceCollection.DebtorPriceModes.e_DebtorPriceModeActual


Noting my dim statement is
Dim oDebtClassPrice As New JiwaInventory.DebtorClassPrice

and not - going through JiwaInventory.DebtorPriceCollection
so could that be a cause for the intellisense not to list anything? ( Having said that the job that I am trying to do works as expected - proving my object is correct )

The mouse hover - tooltip on the Mode bit of oDebtClassPrice.Mode tells me I need DebtorPriceMode
It would be handy (when you guys have a chance) if a search functionality is available on the online help so I can search for DebtorPriceMode -