-
Notifications
You must be signed in to change notification settings - Fork 2
CreateGeneralJournalGetBackTransactionID
Leandro Rowies edited this page Mar 3, 2022
·
4 revisions
Create General Journal
, post it to the transaction table and returns the ID of the newly created transaction, or -1 upon failure.
Warning: You may see the properties Debit
and Credit
for a GeneralJournalLine. Please do not use these as they are no longer in use.
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
journal | GeneralJournal | The general journal to post into the entity. |
out transactionID | Int32 | Unique transaction identifier for the new journal created. |
The overall value of the transaction must be 0. This means that it requires at least two lines balancing each other out.
In each line, either a signed amount should be entered (Line1 = +100, Line2=-100
) or a positive Credit/Debit should be entered (Line1 Credit = 100, Line2 Debit = 100
).
Integration ws = new Integration();
String auth = ws.Login(entityID, partnerKey, userKey);
if( auth != null )
{
GeneralJournal journal = new GeneralJournal
{
ExternalReference = "TEST",
InternalReference = "T000012",
TransactionDate = DateTime.Now.AddDays( 2.0 )
};
journal.Lines = new GeneralJournalLine[]
{
new GeneralJournalLine { GLAccountCode = "1000", Amount = 100.0M, Description = "Description" },
new GeneralJournalLine { GLAccountCode = "2000", Amount = -100.0M, Description = "Description" }
};
int tid = -1;
status = ws.CreateGeneralJournalGetBackTransactionID( auth, journal, out tid );
Assert.AreEqual( OperationStatus.Success, status.Status );
Assert.True( tid != -1 );
}
Dim ws As New Integration_1_1
Dim auth As String = ws.Login(entityID, partnerKey, userKey)
If (Not Me.auth Is Nothing) Then
Dim journal As New GeneralJournal
journal.ExternalReference = "TEST"
journal.InternalReference = "T000012"
journal.TransactionDate = DateTime.Now.AddDays(2)
Dim lines As GeneralJournalLine() = New GeneralJournalLine(0) {}
Dim journal As GeneralJournal = journal
lines = New GeneralJournalLine(2) {}
line = New GeneralJournalLine
line.GLAccountCode = "1000"
line.Amount = 100.0
line.Description = "Description"
lines(0) = line
line = New GeneralJournalLine
line.GLAccountCode = "2000"
line.Amount = -100.0
line.Description = "Description"
lines(1) = line
journal.Lines = lines
int tid = -1;
status = Me.ws.CreateGeneralJournalGetBackTransactionID(Me.auth, journal, out tid)
Assert.AreEqual(Of OperationStatus)(OperationStatus.Success, status.Status)
Assert.True( tid != -1 );
End If