Issue in Windows 2012 server (64 bit)

Discussions relating to breakout scripting, .NET and COM programming with Jiwa objects.

Re: Issue in Windows 2012 server (64 bit)

Postby senthil » Wed Jan 27, 2016 8:01 pm

Hi Mike,

We are getting Error(Unable to cast object of type ''System.String'' to type ''JiwaFinancials.Jiwa.JiwaCRBatchTX.CRBatchTranLine') in the JIWA 7 in "CreditorBatchTrans" module.
we follow the existing (Jiwa 3) code to write the new code for jiwa 7 in the "CreditorBatchTrans" module
kindly advice .

The existing Jiwa 3 Code

oBatchTx = New JiwaCRBatchTX.clsCreditorBatchTrans()
With oBatchTx
.Database = jwDatabase
.BatchType = 1 'Creditor Purchase
.SetUp()
.ReadyNewBatch()
.BatchDate = jwDatabase.SysDate

iNum = 1
oTranLine = New clsTranLine


For Each oTranLine In g_TranLines

sSQL = "SELECT AccountNo FROM CR_MAIN WHERE AccountNo = " & jwDatabase.FormatChar(oTranLine.AccountNo)
If jwDatabase.ExecuteSelect(hwndRead, sSQL) = True Then
If jwDatabase.FetchRow(hwndRead) = True Then
bNewCreditor = False
Else
bNewCreditor = True
End If
End If
jwDatabase.StatementRenew(hwndRead)

If bNewCreditor = False Then

If .AddTranLine(oTranLine.AccountNo, 1) = False Then

LogMessage(AccountNo, " Line No:" & iNum & "- AddTranLine() " & .ErrorString)

Else
.TransLines(.TransLines.Count).HomeTransAmount = oTranLine.Amount + oTranLine.GST
.TransLines(.TransLines.Count).RemitNo = oTranLine.InvoiceNo
.TransLines(.TransLines.Count).Dispersals(1).Remark = oTranLine.InvoiceRef
.TransLines(.TransLines.Count).Dispersals(1).HomeDispersedAmount = oTranLine.Amount
.TransLines(.TransLines.Count).Dispersals(1).TaxAmount = oTranLine.GST

End If

End If

iNum = iNum + 1
Next oTranLine

.SaveRecord()

If .ErrorString <> "" Then
'g_ErrCollection.Add("Line No:" & iNum & "- " & .ErrorString)
End If
.CleanUp()
oTranLine = Nothing
End With

The current Jiwa 7 Code which we are getting the Error the error which we are getting the line highlighting in red


oBatchTx = New JiwaCRBatchTX.CreditorBatchTrans()
With oBatchTx

'$ssn
'.Database = jwDatabase
.BatchType = 1 'Creditor Purchase
.Setup()

'$ssn
' .ReadyNewBatch()
.CreateNew()
.BatchDate = jwDatabase.SysDateTime

iNum = 1
oTranLine = New clsTranLine


For Each oTranLine In g_TranLines

sSQL = "SELECT AccountNo FROM CR_MAIN WHERE AccountNo = " & jwDatabase.FormatChar(oTranLine.AccountNo)
If jwDatabase.ExecuteSelect(hwndRead, sSQL) = True Then
If jwDatabase.FetchRow(hwndRead) = True Then
bNewCreditor = False
Else
bNewCreditor = True
End If
End If
jwDatabase.StatementRenew(hwndRead)

If bNewCreditor = False Then

.TransLines.Add(oTranLine.AccountNo)
If .TransLines.IsAdding() = False Then

Else
.TransLines(.TransLines.Count).HomeTransAmount = oTranLine.Amount + oTranLine.GST
.TransLines(.TransLines.Count).RemitNo = oTranLine.InvoiceNo
.TransLines(.TransLines.Count).Dispersals(1).Remark = oTranLine.InvoiceRef
.TransLines(.TransLines.Count).Dispersals(1).HomeDispersedAmount = oTranLine.Amount
.TransLines(.TransLines.Count).Dispersals(1).TaxAmount = oTranLine.GST

End If
End If

iNum = iNum + 1
Next oTranLine
.Save()


.CleanUp()
oTranLine = Nothing
End With

Thanks & Regards
Senthilnathan
senthil
Occasional Contributor
Occasional Contributor
 
Posts: 17
Joined: Thu Sep 18, 2014 7:57 pm

Re: Issue in Windows 2012 server (64 bit)

Postby Mike.Sheen » Fri Jan 29, 2016 2:09 pm

You should really post this as a new question in the Jiwa 7 Forum, as this is not related to the original post, and it's now a version 7 question.

Anyway, this should get you started... I couldn't make sense of what you were trying to do, so I've just given you some code to create the business logic, create a new purchase and add a transaction to it for a given creditor.

Code: Select all
oBatchTx= JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaCRBatchTX.CreditorBatchTrans)(Nothing)
oBatchTx.BatchType = JiwaCRBatchTX.CreditorBatchTrans.CreditorBatchTypes.Creditor_Purchase

oBatchTx.CreateNew()

' Add a new transaction for creditor with account no '5001'
    Dim transaction As New JiwaCRBatchTX.CRBatchTranLine
    transaction.Creditor.ReadRecordFromAccountNo("5001")
    oBatchTx.TransLines.Add(transaction)

    transaction.RemitNo = "123"
    transaction.HomeTransAmount = 450.56
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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Issue in Windows 2012 server (64 bit)

Postby senthil » Thu Feb 11, 2016 3:23 pm

Hi Mike,

Thanks for the input

I have follow your input and i wrote the code and it is working fine.

and i found that there is one small issue in the Creditos section.i am not sure wheter JIWA automatically added or not.

I have added only line item in the creditor section.but when we view from JIWA application it shows 2 rows with Disp Amount

Please find attached the Sample :

Creditor 00CAP01 with Invoice No "GBFDFPEJHIKDB" the line Item added only that first Row(Trans Amount: 63 Disp Amount 57.27) which is correct.but second row automatically added (Trans Amount:Null and Disp Amount -5.73)

Please find below my Code

sSQL = "SELECT AccountNo FROM CR_MAIN WHERE AccountNo = " & jwDatabase.FormatChar(oTranLine.AccountNo)
If jwDatabase.ExecuteSelect(hwndRead, sSQL) = True Then
If jwDatabase.FetchRow(hwndRead) = True Then
bNewCreditor = False
Else
bNewCreditor = True
End If
End If
jwDatabase.StatementRenew(hwndRead)

If bNewCreditor = False Then
Dim transaction As New JiwaCRBatchTX.CRBatchTranLine

transaction.Creditor.ReadRecordFromAccountNo(oTranLine.AccountNo)
oBatchTx.TransLines.Add(transaction)


transaction.RemitNo = oTranLine.InvoiceNo
transaction.HomeTransAmount = oTranLine.Amount + oTranLine.GST

Dim dispersal As New JiwaFinancials.Jiwa.JiwaCRBatchTX.CRBatchDispersal()
dispersal.Remark = oTranLine.InvoiceRef
dispersal.HomeDispersedAmount = oTranLine.Amount
dispersal.TaxAmount = oTranLine.GST
transaction.Dispersals.Add(dispersal)


End If

iNum = iNum + 1


kinldy advice

Thanks & Regards
Senthilnathan
Attachments
JIWA .png
senthil
Occasional Contributor
Occasional Contributor
 
Posts: 17
Joined: Thu Sep 18, 2014 7:57 pm

Re: Issue in Windows 2012 server (64 bit)

Postby senthil » Fri May 20, 2016 8:02 pm

Hi Mike,

I found that there is one small issue in the Creditos section.i am not sure wheter JIWA automatically added or not.

I have added only line item in the creditor section.but when we view from JIWA application it shows 2 rows with Disp Amount

Please find attached the Sample :

Creditor 00CAP01 with Invoice No "GBFDFPEJHIKDB" the line Item added only that first Row(Trans Amount: 63 Disp Amount 57.27) which is correct.but second row automatically added (Trans Amount:Null and Disp Amount -5.73)

Please find below my Code

sSQL = "SELECT AccountNo FROM CR_MAIN WHERE AccountNo = " & jwDatabase.FormatChar(oTranLine.AccountNo)
If jwDatabase.ExecuteSelect(hwndRead, sSQL) = True Then
If jwDatabase.FetchRow(hwndRead) = True Then
bNewCreditor = False
Else
bNewCreditor = True
End If
End If
jwDatabase.StatementRenew(hwndRead)

If bNewCreditor = False Then
Dim transaction As New JiwaCRBatchTX.CRBatchTranLine

transaction.Creditor.ReadRecordFromAccountNo(oTranLine.AccountNo)
oBatchTx.TransLines.Add(transaction)


transaction.RemitNo = oTranLine.InvoiceNo
transaction.HomeTransAmount = oTranLine.Amount + oTranLine.GST

Dim dispersal As New JiwaFinancials.Jiwa.JiwaCRBatchTX.CRBatchDispersal()
dispersal.Remark = oTranLine.InvoiceRef
dispersal.HomeDispersedAmount = oTranLine.Amount
dispersal.TaxAmount = oTranLine.GST
transaction.Dispersals.Add(dispersal)

End If

iNum = iNum + 1


kinldy advice

Thanks & Regards
Senthilnathan
Attachments
JIWA .png
JIWA .png (151.16 KiB) Viewed 4073 times
senthil
Occasional Contributor
Occasional Contributor
 
Posts: 17
Joined: Thu Sep 18, 2014 7:57 pm

Re: Issue in Windows 2012 server (64 bit)

Postby senthil » Fri May 20, 2016 9:11 pm

Hi Mike,

I have one more clarification in the Payment section.Please find attached the screen shot (Payment_Initiate Date.jpg)
in the screen shot ,the payment section we have passed only payment date ( 10/02/2016)
but in the top there is a column called "Initiated Date" which is showing 09/02/2016 .may i know where it is coming from .actually the payment date should be a "Initiated Date"
kindly advice how we can match the "Initiated Date" as "payment date"

Thanks & Regards
Senthilnathan
Attachments
Payment_Initiate Date.jpg
Payment_Initiate Date.jpg (59.82 KiB) Viewed 4073 times
senthil
Occasional Contributor
Occasional Contributor
 
Posts: 17
Joined: Thu Sep 18, 2014 7:57 pm

Previous

Return to Technical / Programming

Who is online

Users browsing this forum: Google [Bot] and 1 guest