dimuthu wrote:Thanks Mike. I did as you mentioned. Called the record activate method after the Read method.
.Save()
.Read(.RecID)
.ActivateRecord()
But when calling the "ActivateRecord()" , program throws "JiwaFinancials.Jiwa.JiwaApplication.Exceptions.RecordNotFoundException: General Ledger Account Not Found".
Regards
Dimuthu
Dimuthu,
That works for me - my complete code is as follows:
- Code: Select all
JiwaApplication.Manager.Instance.Logon("JiwaMike", "JiwaDemo7115", JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "Admin", "password")
Dim stockTransfer As JiwaStockTransfer.StockTransfer = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaStockTransfer.StockTransfer)(Nothing)
stockTransfer.CreateNew()
stockTransfer.TransferDate = JiwaApplication.Manager.Instance.SysDateTime
Dim line As New JiwaStockTransfer.Line
line.FromInventory.PartNo = "External"
line.ToInventory.ReadRecordFromPartNo("1170")
line.TransferQuantity = 5
line.ToPartExpiryDate = JiwaApplication.Manager.Instance.SysDateTime ' <-- The need for this seems to be a bug, but just setting the expiry date is a workaround - otherwise the Save method fails later.
stockTransfer.Lines.Add(line)
stockTransfer.Save()
stockTransfer.Read(stockTransfer.RecID)
stockTransfer.ActivateRecord()
I'm guessing you've not tried this in the demo data? The above works fine for me in demo data. The message you are getting suggests there is a General Ledger account missing or not defined - it's the journal posting during the activate which requires the GL accounts and that will be what is throwing the exception. The journals associated with a transfer are the inventory value and inventory write on accounts - make sure the inventory items you are using have those accounts set, and if the stock transfer reason is configured to override the write on account that it also is configured to a valid account.
Also, if using warehouse masking then make sure the appropriate inventory value and write on accounts exist for the warehouse you are transferring in on.
Mike