BUSINESS SOFTWARE, INC. (BSI) CONFIDENTIAL AND PROPRIETARY INFORMATION
Note: If the call to ProcessTaxes returns a non-zero EmployeeStatus, a call to CommitDataSource can be made to COMMIT error messages to the database.
Call the calculation function as follows:
C Instructions:
/*
** Calling the Calculation engine
*/
TF9_EMPLOYEE Employee;
TF9_TAX Tax[50];
TF9_GARNISHMENT Garnishment[50];
BSI_CHAR *RunName = "PAYROLL RUN 1";
TF9_SESSION Session;
BSI_SHORT msgn, msgs;
/*
** Session should be defined by call to ConnectToDataSet – see Step 3
*/
printf("ProcessTaxes() error\n");
if (!CommitDataSource(NULL))
printf("Commit data source error\n");
/* Retrieve messages from the Last API call */
if(GetMessages(str, Session, NULL)){
printf("ProcessTaxes() returned messages of:\n");
do{
printf("Message: %s\n", str);
}while(GetMessages(str, Session, NULL));
printf("end of messages\n");
}
}
memset(&Employee, 0, sizeof(TF9_EMPLOYEE));
/*
** Populate the Employee details here
** Employee.NumberOfTaxEntries should match the number of the Tax array elements
** Employee.NumberOfGarnishments should match the number of the Garnishment array
elements
*/
memset(Tax, 0, Employee.NumberOfTaxEntries * sizeof(TF9_TAX));
/*
** Populate the Tax details here
*/
memset(Garnishment, 0, Employee.NumberOfGarnishments * sizeof(TF9_GARNISHMENT));
/*
** Populate the Garnishment details here
*/
if (!ProcessTaxes(&Employee, Tax, Garnishment, RunName, Session, NULL))
printf("ProcessTaxes() error\n");
if (!CommitDataSource(NULL))
printf("Commit data source error\n");
/* Retrieve messages from the Last API call */
if(GetMessages(str, Session, NULL)){
printf("ProcessTaxes() returned messages of:\n");
do{
printf("Message: %s\n", str);
}while(GetMessages(str, Session, NULL));
printf("end of messages\n");
}
COBOL Instructions:
COPY TF9API.
.
.
.
.
.
CALL "PROCESSTAXES" USING
BY REFERENCE TF90-EMPLOYEE
BY REFERENCE TF90-TAX (1)
BY REFERENCE TF90-GARNISHMENT (1)
BY REFERENCE TF90-RUN-ID
BY REFERENCE TF90-SESSION-ID
BY REFERENCE RTN-CODE.
IF TF10-EMPL-EMPLOYEE-STATUS NOT = 0
DISPLAY "EMPLOYEE-STATUS INDICATES MESSAGES"
CALL "COMMITDATASOURCE" USING
BY REFERENCE RTN-CODE
CALL "GETMSGS" USING
BY REFERENCE ERROR-MESSAGE
BY REFERENCE TF10-SESSION-ID
BY REFERENCE RTN-CODE
PERFORM WITH TEST BEFORE UNTIL RTN-STATUS = 0
DISPLAY "TAX MESSAGE; **" ERROR-MESSAGE "**"
CALL "GETMSGS" USING
BY REFERENCE ERROR-MESSAGE
BY REFERENCE TF10-SESSION-ID
BY REFERENCE RTN-CODE
END-PERFORM
ELSE
DISPLAY "EMPLOYEE-STATUS INDICATES SUCCESS"
END-IF.
C# Instructions:
TF90API api = new TF90API();
MTF9_EMPLOYEE Employee = new MTF9_EMPLOYEE();
MTF9_TAX[] Tax = new MTF9_TAX[2];
MTF9_GARNISHMENT[] Garnishment = new MTF9_GARNISHMENT[2];
String RunName = "PROCESSTAXES API TEST";
String[] messages = null;
/*
** Populate the Employee details here
** Employee.NumberOfTaxEntries should match number of Tax array elements
** Employee.NumberOfGarnishments should match number of Garnishment array elements
*/
/* Populate the Tax details here */
/* Populate the Garnishment details here */
/* Calling the Calculation engine */
if (api.processTaxes(ref Employee, Tax, Garnishment, RunName) > 0)
{
System.Console.WriteLine("Successfully called processTaxes()");
for (i = 0; i < Tax.Length; i++)
System.Console.WriteLine(String.Format("Tax result {0}: {1}", i, Tax[i].CalculatedTax));
for (i = 0; i < Garnishment.Length; i++)
System.Console.WriteLine(String.Format("Garnishment result {0}: {1}", i,
Garnishment[i].CalculatedAmount));
}
else
System.Console.WriteLine("processTaxes call failed");
/* commit messages generated by this API */
if (api.commitDataSource() <= 0)
System.Console.WriteLine("commitDataSource call failed");
else
System.Console.WriteLine("Successfully called commitDataSource");
/* retrieve messages generated by this API */
messages = api.getMessages();
if (messages != null)
{
Console.WriteLine("ProcessTaxes() returned messages of:");
foreach (String str in messages)
Console.WriteLine(str);
Console.WriteLine("end of messages");
}
©Copyright 2021 Business Software, Inc
Unpublished - Rights Reserved Under the Copyright Laws of the United States