Private Sub CreateEntity(Optional ByVal UseSave As Boolean = False)
Dim transKey As Guid
Dim entryNo As String = ""
Dim isProcessed As Boolean = rdProcessed.Checked
'lineData 1
lineData = New EntityFinancialLine.FinancialLineData()
With lineData
.IsProcessed = New EntityFinancialLine.EntityBoolean With {.Value = isProcessed, .IsDirty = True}
.CompanyCode = New EntityFinancialLine.EntityString With {.Value = "001", .IsDirty = True}
.TransactionType = New EntityFinancialLine.EntityInteger With {.Value = 6, .IsDirty = True}
.ProcessLine = New EntityFinancialLine.EntityString With {.Value = " 1", .IsDirty = True}
.TransType = New EntityFinancialLine.EntityString With {.Value = "N", .IsDirty = True}
.TransactionSubType = New EntityFinancialLine.EntityString With {.Value = "Y", .IsDirty = True}
.ProcessLineCode = New EntityFinancialLine.EntityString With {.Value = "A", .IsDirty = True}
.TransactionDate = New EntityFinancialLine.EntityDateTime With {.Value = dtTransDate.Value, .IsDirty = True}
.Creditor = New EntityFinancialLine.EntityString With {.Value = "10004", .IsDirty = True}
.CompanyAccountCode = New EntityFinancialLine.EntityString With {.Value = "1100", .IsDirty = True}
.CurrencyCode = New EntityFinancialLine.EntityString With {.Value = "EUR", .IsDirty = True}
.ForeignCurrencyDebitAmount = New EntityFinancialLine.EntityInteger With {.Value = 0, .IsDirty = True}
.ForeignCurrencyCreditAmount = New EntityFinancialLine.EntityInteger With {.Value = 3800, .IsDirty = True}
.Rate = New EntityFinancialLine.EntityInteger With {.Value = 1, .IsDirty = True}
.OriginOfTransaction = New EntityFinancialLine.EntityString With {.Value = "A", .IsDirty = True}
.OriginOfEntry = New EntityFinancialLine.EntityString With {.Value = "N", .IsDirty = True}
.PaymentMethod = New EntityFinancialLine.EntityString With {.Value = "B", .IsDirty = True}
.ProcessNumber = New EntityFinancialLine.EntityInteger With {.Value = 1, .IsDirty = True}
.JournalPostingNumber = New EntityFinancialLine.EntityInteger With {.Value = 1, .IsDirty = True}
End With
Try
If UseSave Then
lineData = lineClient.Save(lineData)
Else
lineData = lineClient.Create(lineData)
End If
Catch ex As Exception
MessageBox.Show("Financial lineData Entity - Create failed: " & ex.Message)
End Try
transKey = lineData.TransactionKey.Value
'lineData 2
lineData = New EntityFinancialLine.FinancialLineData()
With lineData
.TransactionKey = New EntityFinancialLine.EntityGuid With {.Value = transKey, .IsDirty = True}
.IsProcessed = New EntityFinancialLine.EntityBoolean With {.Value = isProcessed, .IsDirty = True}
.CompanyCode = New EntityFinancialLine.EntityString With {.Value = "001", .IsDirty = True}
.TransactionType = New EntityFinancialLine.EntityInteger With {.Value = 6, .IsDirty = True}
.ProcessLine = New EntityFinancialLine.EntityString With {.Value = " 1", .IsDirty = True}
.TransType = New EntityFinancialLine.EntityString With {.Value = "N", .IsDirty = True}
.TransactionSubType = New EntityFinancialLine.EntityString With {.Value = "T", .IsDirty = True}
.ProcessLineCode = New EntityFinancialLine.EntityString With {.Value = "B", .IsDirty = True}
.TransactionDate = New EntityFinancialLine.EntityDateTime With {.Value = dtTransDate.Value, .IsDirty = True}
.Creditor = New EntityFinancialLine.EntityString With {.Value = "10004", .IsDirty = True}
.CompanyAccountCode = New EntityFinancialLine.EntityString With {.Value = "7000", .IsDirty = True}
.CurrencyCode = New EntityFinancialLine.EntityString With {.Value = "EUR", .IsDirty = True}
.ForeignCurrencyDebitAmount = New EntityFinancialLine.EntityInteger With {.Value = 3800, .IsDirty = True}
.ForeignCurrencyCreditAmount = New EntityFinancialLine.EntityInteger With {.Value = 0, .IsDirty = True}
.Rate = New EntityFinancialLine.EntityInteger With {.Value = 1, .IsDirty = True}
.OriginOfTransaction = New EntityFinancialLine.EntityString With {.Value = "A", .IsDirty = True}
.OriginOfEntry = New EntityFinancialLine.EntityString With {.Value = "N", .IsDirty = True}
.PaymentMethod = New EntityFinancialLine.EntityString With {.Value = "B", .IsDirty = True}
.ProcessNumber = New EntityFinancialLine.EntityInteger With {.Value = 1, .IsDirty = True}
.JournalPostingNumber = New EntityFinancialLine.EntityInteger With {.Value = 1, .IsDirty = True}
End With
Try
If UseSave Then
lineData = lineClient.Save(lineData)
Else
lineData = lineClient.Create(lineData)
End If
Catch ex As Exception
MessageBox.Show("Financial lineData Entity - Create failed: " & ex.Message)
End Try
'Create header
headerData = New EntityFinancialHeader.FinancialHeaderData
With headerData
.TransactionKey = New EntityFinancialHeader.EntityGuid With {.Value = transKey, .IsDirty = True}
.IsProcessed = New EntityFinancialHeader.EntityBoolean With {.Value = isProcessed, .IsDirty = True}
End With
Try
If UseSave Then
headerData = headerClient.Save(headerData)
Else
headerData = headerClient.Create(headerData)
End If
Catch ex As Exception
MessageBox.Show("Financial lineData Entity - Create failed: " & ex.Message)
End Try
End Sub
|