Click or drag to resize

Transaction_2019_01Insert_Transaction Method

Inserts the specified transaction into Epic

Namespace:  ASI.TAM.API.Web.EpicSDK.Transaction
Assembly:  ASI.TAM.API.Web.EpicSDK (in ASI.TAM.API.Web.EpicSDK.dll) Version: 2021.1.0.1
Syntax
int[] Insert_Transaction(
	TransactionV1 TransactionObject
)

Parameters

TransactionObject
Type: ASI.TAM.API.Data.UI.TransactionTransactionV1
The transaction to be inserted

Return Value

Type: Int32
Unique identifiers of the transaction inserts. Multiple IDs will be returned if multiple installments are inserted.
Remarks
Examples
Insert Transaction
  1' Imports SDK2011_01 = [Project Name].schemas.appliedsystems.com.epic.sdk._2011._01
  2' Imports SDK2009_07 = [Project Name].schemas.appliedsystems.com.epic.sdk._2009._07
  3
  4' Constant DATABASE preset to current database name
  5' Constant AUTHENTICATION_KEY set to current authentication key
  6' Constant USER_CODE set to a valid login user code
  7
  8Dim oHeader As New SDK2009_07.MessageHeader ' Instantiate the Header object
  9
 10' Populate the database and authentication key in the Header object
 11
 12'REQUIRED
 13oHeader.DatabaseName = DATABASE
 14oHeader.AuthenticationKey = AUTHENTICATION_KEY
 15'OPTIONAL
 16oHeader.UserCode = USER_CODE
 17oHeader.IntegrationKey = "eaa8b2df-94c0-4bac-a403-1a1b749b8e06" 'In this case we are identifing as the 3rd custom integration
 18
 19' Account_ID can be obtained from Insert_Client or Get_Client when AccountType is 'CUST' (Client).
 20Dim Account_ID As Integer = 65538
 21Dim Policy_ID As Integer = 65536
 22
 23Dim oTransaction As New SDK2011_01._account.Transaction
 24With oTransaction
 25  .AccountID = Account_ID
 26  .TransactionAmount = 37.5D
 27  .AccountTypeCode = "CUST" ' Can be obtained from AccountType lookup.
 28  .TransactionCode = "NEWB" ' Can be obtained from the TransactionCode lookup.
 29  .Description = "Account Current"
 30
 31  .PolicyID = Policy_ID
 32  .AttachToOption = New SDK2009_07._common.OptionType
 33  .AttachToOption.Value = 2 'Policy
 34  .AttachToOption.OptionName = "Policy"
 35  .Description = "Test Transaction"
 36
 37  'Installment information
 38  .BasicInstallmentOption = New SDK2009_07._common.OptionType
 39  .BasicInstallmentOption.Value = 1
 40  .BasicInstallmentOption.OptionName = "Installment"
 41  .InstallmentPlanID = "65537"
 42
 43  .InvoiceValue = New SDK2011_01._account._transaction.Invoice
 44  oTransaction.InvoiceValue.SendInvoiceTos = New SDK2011_01._account._transaction._invoice.SendInvoiceToItems
 45
 46  Dim oInvoiceTo As New SDK2011_01._account._transaction._invoice.SendInvoiceToItem
 47  oInvoiceTo.AccountLookupCode = "ABBOTTJO01"
 48  oInvoiceTo.DeliveryMethod = "Email" 'Can be obtained from the DeliveryMethod lookup.
 49  oInvoiceTo.Email = "Madeup@PlaceHolder.com"
 50  oInvoiceTo.InvoiceToType = "Client"
 51  .InvoiceValue.SendInvoiceTos.Add(oInvoiceTo)
 52
 53  .BillingValue = New SDK2011_01._account._transaction.Billing
 54  .BillingValue.EffectiveDate = New Date(2017, 1, 19)
 55
 56  .BillingValue.GenerateInvoiceDate = New Date(2017, 1, 19)
 57  .BillingValue.GenerateInvoiceDate = Now()
 58  .BillingValue.ARDueDate = New Date(2011, 10, 11)
 59  .BillingValue.ARDueDate = Now()
 60  .BillingValue.AgencyCode = "AG0"
 61  .BillingValue.BranchCode = "BRC"
 62  .BillingValue.ProfitCenterCode = "PFC"
 63
 64  .CommissionsValue = New schemas.appliedsystems.com.epic.sdk._2011._01._account._transaction.Commissions
 65  .CommissionsValue.Splits = New SDK2011_01._account._transaction._commissions.SplitItems
 66
 67  Dim oSplit As New SDK2011_01._account._transaction._commissions.SplitItem
 68  oSplit.AgencyCommissionAmount = 5
 69  oSplit.AgencyCommissionTypeCode = "$"
 70  oSplit.IssuingCompanyLookupCode = "AIG001"
 71  oSplit.PremiumPayableTypeCode = "CA"
 72  oSplit.PremiumPayableLookupCode = "AIG001"
 73  oSplit.PremiumPayableContractID = 65537
 74  oSplit.AgencySplitAmount = 37.5D
 75  .CommissionsValue.Splits.Add(oSplit)
 76
 77End With
 78
 79Dim oService As EpicSDK_2019_01Client = Nothing ' Instantiate the Service object
 80
 81'Use this method to populate the transaction to be inserted with the standard Pr/Br Commissions that would be defaulted in Epic.
 82Try
 83  oService = New EpicSDK_2019_01Client
 84  oTransaction = oService.Get_Transaction_DefaultProducerBrokerCommissions(Me.p_oHeader, oTransaction).Transactions.First
 85  oService.Close() ' Close the service
 86Catch ex As Exception
 87  oService.Abort()
 88  Console.WriteLine("Error: " & ex.Detail.Description)
 89  Console.WriteLine("Press any key to exit...")
 90  Console.ReadLine()
 91  Exit Sub
 92End Try
 93
 94'Additional Pr/BrCommissions can still be added
 95Dim oPrBrCommission As New SDK2011_01._account._transaction._commissionsplititem.ProducerBrokerCommissionItem
 96With oPrBrCommission
 97  .ProducerBrokerCode = "BPAY"
 98  .LookupCode = "BOBTHEB-01"
 99  .CommissionTypeCode = "$"
100  .CommissionAmount = 1D
101  .Flag = SDK2011_01._account._transaction._commissionsplititem._producerbrokercommissionitem.Flags.Insert
102  .ContractID = 65536
103  .PayableDueDate = New Date(2017, 1, 19)
104  .PayableDueDate = Now()
105
106  .OrderNumber = 5
107  .ProductionCredit = 100D
108
109  .ShareRevenueAgencyCode = "AG0"
110  .ShareRevenueBranchCode = "BRC"
111  .ShareRevenueDepartmentCode = "DPT"
112  .ShareRevenueProfitCenterCode = "PFC"
113End With
114oTransaction.CommissionsValue.Splits.First.ProducerBrokerCommissions.Add(oPrBrCommission)
115
116'Installments can also be populated as Epic would. They can be modified or inserted as is.
117Dim eInstallmentType As New SDK2011_01._account.TransactionGetInstallmentType()
118eInstallmentType = SDK2011_01._account.TransactionGetInstallmentType.InstallmentSummary 'Alternatively SplitReceivable
119Try
120  oService = New EpicSDK_2019_01Client
121  oTransaction = oService.Get_Transaction_DefaultInstallments(Me.p_oHeader, oTransaction, eInstallmentType).Transactions.First
122  oService.Close() ' Close the service
123Catch ex As Exception
124  oService.Abort()
125  Console.WriteLine("Error: " & ex.Detail.Description)
126  Console.WriteLine("Press any key to exit...")
127  Console.ReadLine()
128  Exit Sub
129End Try
130
131'Code to view populated installments.
132For Each oInstallmentItem As SDK2011_01._account._transaction.InstallmentItem In oTransaction.InstallmentsValue
133  Console.WriteLine("Installment Description: " & oInstallmentItem.Description & " Installment Number: " & oInstallmentItem.InstallmentNumber &
134                    " AR Due Date: " & oInstallmentItem.ARDueDate & " Invoice Number: " & oInstallmentItem.InvoiceGroupingExistingInvoiceNumber)
135Next
136
137'Insert the desired Transaction.
138Dim lstInsertedTransactionIDs As List(Of Integer)
139Try
140  oService = New EpicSDK_2019_01Client
141  lstInsertedTransactionIDs = oService.Insert_Transaction(oHeader, oTransaction)
142  oService.Close() ' Close the service
143Catch ex As Exception
144  oService.Abort()
145  Console.WriteLine("Error: " & ex.Detail.Description)
146  Console.WriteLine("Press any key to exit...")
147  Console.ReadLine()
148  Exit Sub
149End Try
150
151Console.WriteLine("New Transactions were inserted with IDs: " & String.Join(", ", lstInsertedTransactionIDs))
Examples
Insert Payment Transaction
  1' Imports SDK2011_01 = [Project Name].schemas.appliedsystems.com.epic.sdk._2011._01
  2' Imports SDK2009_07 = [Project Name].schemas.appliedsystems.com.epic.sdk._2009._07
  3
  4' Constant DATABASE preset to current database name
  5' Constant AUTHENTICATION_KEY set to current authentication key
  6' Constant USER_CODE set to a valid login user code
  7
  8Dim oHeader As New SDK2009_07.MessageHeader ' Instantiate the Header object
  9
 10' Populate the database and authentication key in the Header object
 11
 12'REQUIRED
 13oHeader.DatabaseName = DATABASE
 14oHeader.AuthenticationKey = AUTHENTICATION_KEY
 15'OPTIONAL
 16oHeader.UserCode = USER_CODE
 17oHeader.IntegrationKey = "eaa8b2df-94c0-4bac-a403-1a1b749b8e06" 'In this case we are identifing as the 3rd custom integration
 18
 19
 20' Account_ID can be obtained from Insert_Client or Get_Client when AccountType is 'CUST' (Client).
 21Dim Account_ID As Integer = 65538
 22
 23Dim oTransaction As New SDK2011_01._account.Transaction
 24With oTransaction
 25  .AccountID = Account_ID
 26  .AccountTypeCode = "CUST" ' Can be obtained from AccountType lookup.
 27
 28  .AttachToOption = New SDK2009_07._common.OptionType
 29  ' Possible Value and OptionName are 
 30  '         0 and Account
 31  '         1 and Line
 32  '         2 and Policy
 33  .AttachToOption.Value = 1
 34  .AttachToOption.OptionName = "Line"
 35
 36  '' Optional - will get populated automatically if set to 0
 37  '.TransactionAmount = -22.5D
 38
 39  .BasicInstallmentOption = New SDK2009_07._common.OptionType
 40  ' Possible Value and OptionName are 
 41  '         0 and Basic
 42  '         1 and Installment
 43  .BasicInstallmentOption.Value = 0
 44  .BasicInstallmentOption.OptionName = "Basic"
 45
 46  ' BillingValue is instantiated and the only property used for Payment transaction is BillingModeOption
 47  ' For Payment transactions it is always set to AgencyBilled
 48  .BillingValue = New SDK2011_01._account._transaction.Billing
 49  .BillingValue.BillingModeOption = New SDK2009_07._common.OptionType
 50  ' Possible Value and OptionName are 
 51  '         0 and AgencyBilled 
 52  '         1 and DirectBilled
 53  .BillingValue.BillingModeOption.Value = 0
 54  .BillingValue.BillingModeOption.OptionName = "AgencyBilled"
 55
 56  ' BillNumber is set to 0 so that the system can set it properly to the next bill number.
 57  .BillNumber = 0
 58
 59  .Description = "Payment"
 60
 61  .TransactionCode = "PAY1" ' Can be obtained from the TransactionCode lookup.
 62
 63  .InvoicePaymentOption = New SDK2009_07._common.OptionType
 64  ' Possible Value and OptionName are 
 65  ' For Payment transactions it is always set to Payment
 66  '         0 and Invoice 
 67  '         1 and Payment
 68  .InvoicePaymentOption.Value = 1
 69  .InvoicePaymentOption.OptionName = "Payment"
 70
 71  ' PaymentLineID must be included if AttachTo = Line
 72  .PaymentLineID = 65536
 73
 74  .PaymentMethodValue = New SDK2011_01._account._transaction.PaymentMethod
 75  .PaymentMethodValue.AccountLookupCode = "ABBOTTJO01"
 76  .PaymentMethodValue.PaymentOptionID = 100
 77  'Optional 
 78  '   .PaymentMethodValue.ContactID - Automatically Populated
 79  '   .PaymentMethodValue.ContactName - Automatically Populated
 80  '   .PaymentMethodValue.TypeCode - Automatically Populated
 81
 82  oTransaction.PaymentValue = New SDK2011_01._account._transaction.Payment
 83  .PaymentValue.AccountingMonth = "201701"
 84  .PaymentValue.AgencyCode = "A01"
 85  .PaymentValue.BranchCode = "BRC"
 86  .PaymentValue.ProductionMonth = "201701"
 87  'Optional 
 88  '   .PaymentValue.DepartmentCode
 89  '   .PaymentValue.GeneralLedgerCleared - Automatically Populated
 90  '   .PaymentValue.GeneralLedgerReferNumber
 91  '   .PaymentValue.MethodID - Automatically Populated
 92  '   .PaymentValue.PaymentDate 
 93  '   .PaymentValue.PaymentID 
 94  '   .PaymentValue.PaymentReceivedDate
 95  '   .PaymentValue.ProfitCenterCode
 96  '   .PaymentValue.ReceivingAgencyCode 
 97  '   .PaymentValue.ReceivingBranchCode 
 98  '   .PaymentValue.ReversalVoidItemReversalNumber
 99  '   .PaymentValue.ReversalVoidReasonDetails
100  '   .PaymentValue.ReversalVoidReasonID
101  '   .PaymentValue.ReversalVoidReferNumber
102
103
104  .PolicyID = 65536
105  .PolicyTypeCode = "AUTO"
106  .TransactionAmount = -22.5D
107  .TransactionCode = "PAY1"
108
109  .UpdateInstallmentsOption = New SDK2009_07._common.OptionType
110
111End With
112
113Dim iTransactionID As Integer
114Dim oService As New EpicSDK_2019_01Client ' Instantiate the Service object
115Try
116  iTransactionID = oService.Insert_Transaction(oHeader, oTransaction)
117
118  oService.Close() ' Close the service
119Catch ex As Exception
120  oService.Abort()
121  Console.WriteLine("Error:  " & ex.Detail.Description)
122  Console.WriteLine("Press any key to exit...")
123  Console.ReadLine()
124  Exit Sub
125End Try
126
127Console.WriteLine("A new Transaction was inserted with ID: " & iTransactionID.ToString)
Examples
Insert Payment Installments
  1' Imports SDK2011_01 = [Project Name].schemas.appliedsystems.com.epic.sdk._2011._01
  2' Imports SDK2009_07 = [Project Name].schemas.appliedsystems.com.epic.sdk._2009._07
  3
  4' Constant DATABASE preset to current database name
  5' Constant AUTHENTICATION_KEY set to current authentication key
  6' Constant USER_CODE set to a valid login user code
  7
  8Dim oHeader As New SDK2009_07.MessageHeader ' Instantiate the Header object
  9
 10' Populate the database and authentication key in the Header object
 11
 12'REQUIRED
 13oHeader.DatabaseName = DATABASE
 14oHeader.AuthenticationKey = AUTHENTICATION_KEY
 15'OPTIONAL
 16oHeader.UserCode = USER_CODE
 17oHeader.IntegrationKey = "eaa8b2df-94c0-4bac-a403-1a1b749b8e06" 'In this case we are identifing as the 3rd custom integration
 18
 19' Account_ID can be obtained from Insert_Client or Get_Client when AccountType is 'CUST' (Client).
 20Dim Account_ID As Integer = 65538
 21
 22Dim oTransaction As New SDK2011_01._account.Transaction
 23With oTransaction
 24  .AccountID = Account_ID
 25  .AccountTypeCode = "CUST" ' Can be obtained from AccountType lookup.
 26
 27  .AttachToOption = New SDK2009_07._common.OptionType
 28  ' Possible Value and OptionName are 
 29  '         0 and Account
 30  '         1 and Line
 31  '         2 and Policy
 32  .AttachToOption.Value = 1
 33  .AttachToOption.OptionName = "Line"
 34
 35  '' Optional - will get populated automatically if set to 0
 36  .TransactionAmount = -24D
 37
 38  .BasicInstallmentOption = New SDK2009_07._common.OptionType
 39  ' Possible Value and OptionName are 
 40  '         0 and Basic
 41  '         1 and Installment
 42  .BasicInstallmentOption.Value = 1
 43  .BasicInstallmentOption.OptionName = "Installment"
 44
 45  ' BillingValue is instantiated and the only property used for Payment transaction is BillingModeOption
 46  ' For Payment transactions it is always set to AgencyBilled
 47  .BillingValue = New SDK2011_01._account._transaction.Billing
 48  .BillingValue.BillingModeOption = New SDK2009_07._common.OptionType
 49  ' Possible Value and OptionName are 
 50  '         0 and AgencyBilled 
 51  '         1 and DirectBilled
 52  .BillingValue.BillingModeOption.Value = 0
 53  .BillingValue.BillingModeOption.OptionName = "AgencyBilled"
 54
 55  ' BillNumber is set to 0 so that the system can set it properly to the next bill number.
 56  .BillNumber = 0
 57
 58  .Description = "Installment Payments"
 59
 60  .TransactionCode = "PAY1" ' Can be obtained from the TransactionCode lookup.
 61
 62  .InvoicePaymentOption = New SDK2009_07._common.OptionType
 63  ' Possible Value and OptionName are 
 64  ' For Payment transactions it is always set to Payment
 65  '         0 and Invoice 
 66  '         1 and Payment
 67  .InvoicePaymentOption.Value = 1
 68  .InvoicePaymentOption.OptionName = "Payment"
 69
 70  ' PaymentLineID must be included if AttachTo = Line
 71  .PaymentLineID = 65536
 72
 73  .PaymentMethodValue = New SDK2011_01._account._transaction.PaymentMethod
 74  .PaymentMethodValue.AccountLookupCode = "ABBOTTJO01"
 75  .PaymentMethodValue.PaymentOptionID = 100
 76  'Optional 
 77  '   .PaymentMethodValue.ContactID - Automatically Populated
 78  '   .PaymentMethodValue.ContactName - Automatically Populated
 79  '   .PaymentMethodValue.TypeCode - Automatically Populated
 80
 81  oTransaction.PaymentValue = New SDK2011_01._account._transaction.Payment
 82  .PaymentValue.AccountingMonth = "201701"
 83  .PaymentValue.AgencyCode = "A01"
 84  .PaymentValue.BranchCode = "BRC"
 85  .PaymentValue.ProductionMonth = "201701"
 86  .PaymentValue.PaymentDate = Now()
 87  .PaymentValue.PaymentID = "Sample Code Test"
 88  .PaymentValue.PaymentReceivedDate = Now()
 89  'Optional 
 90  '   .PaymentValue.DepartmentCode
 91  '   .PaymentValue.GeneralLedgerCleared - Automatically Populated
 92  '   .PaymentValue.GeneralLedgerReferNumber
 93  '   .PaymentValue.MethodID - Automatically Populated
 94  '   .PaymentValue.ProfitCenterCode
 95  '   .PaymentValue.ReceivingAgencyCode 
 96  '   .PaymentValue.ReceivingBranchCode 
 97  '   .PaymentValue.ReversalVoidItemReversalNumber
 98  '   .PaymentValue.ReversalVoidReasonDetails
 99  '   .PaymentValue.ReversalVoidReasonID
100  '   .PaymentValue.ReversalVoidReferNumber
101
102  .InstallmentPlanID = "65537"
103  oTransaction.PaymentInstallmentItems = New schemas.appliedsystems.com.epic.sdk._2017._02._account._transaction.PaymentInstallmentItems
104  For iInstallments As Integer = 1 To 12
105    Dim oPaymentInstallmentItem As New schemas.appliedsystems.com.epic.sdk._2017._02._account._transaction.PaymentInstallmentItem
106    oPaymentInstallmentItem.Amount = -2D
107    oPaymentInstallmentItem.Description = "Installment " + iInstallments.ToString + " of 12"
108    Dim dDate As DateTime = Now()
109    Dim iNumberOfDays As Integer = (iInstallments - 1) * 30
110    dDate = dDate.AddDays(iNumberOfDays)
111    oPaymentInstallmentItem.PaymentDate = dDate
112    oPaymentInstallmentItem.PaymentReceivedDate = dDate
113    oPaymentInstallmentItem.AccountingMonth = "2017" + iInstallments.ToString("00")
114    oPaymentInstallmentItem.ProductionMonth = "201701"
115    oTransaction.PaymentInstallmentItems.Add(oPaymentInstallmentItem)
116    Console.WriteLine("Payment Installment Description: " + oPaymentInstallmentItem.Description + " Payment Date: " + dDate.ToShortDateString)
117  Next
118
119  .PolicyID = 65536
120  .PolicyTypeCode = "AUTO"
121  .TransactionAmount = -24D
122  .TransactionCode = "PAY1"
123  .InstallmentCycles = 12
124
125  .UpdateInstallmentsOption = New SDK2009_07._common.OptionType
126
127End With
128
129Dim oService As New EpicSDK_2019_01Client ' Instantiate the Service object
130Dim lstInsertedTransactionIDs As List(Of Integer)
131Try
132  lstInsertedTransactionIDs = oService.Insert_Transaction(oHeader, oTransaction)
133
134  oService.Close() ' Close the service
135Catch ex As Exception
136  oService.Abort()
137  Console.WriteLine("Error:  " & ex.Detail.Description)
138  Console.WriteLine("Press any key to exit...")
139  Console.ReadLine()
140  Exit Sub
141End Try
142
143Console.WriteLine("New Transactions were inserted with IDs: " & String.Join(", ", lstInsertedTransactionIDs))
See Also