How to create a manual paycheck by using the Microsoft Office Small Business Accounting Software Development Kit (915509)



The information in this article applies to:

  • Microsoft Office Small Business Accounting 2006

INTRODUCTION

You can create a manual paycheck by using the Microsoft Office Small Business Accounting Software Development Kit (SDK).

MORE INFORMATION

To create a manual paycheck by using the Small Business Accounting SDK, follow these steps:
  1. Create an employee bill.

    Note The employee bill contains a check property that represents the manual paycheck.
  2. In the employee bill, set the following properties:
    • The employee account
    • The financial account
    • The payment method
  3. Add the expense lines.

    Note The expense lines represent the accounts that are posted when you create the manual paycheck.
The following sample code lets you create a manual paycheck in Fabrikam, Inc. (Fabrikam, Inc. is the sample service company.) The manual paycheck is paid to the Karen Berg account from the Checking account. Then, the manual paycheck is posted to the P/R Expense-Bonus account. The value of the check is $200.
ISmallBusinessInstance iSbi = // Initialize SBA instance.

// Set the hard-coded values that work in the Fabrikam, Inc. company.

// Create an employee bill (IEmployeeBill).
IEmployeeBill eb = iSbi.CreateEmployeeBill();
// Set the employee account (IEmployeeAccount).
eb.EmployeeAccount = (IEmployeeAccount) GetAccountByName(iSbi.EmployeeAccounts, "Karen Berg");
// Set the financial account (IFinancialAccount).
eb.FinancialAccount = (IFinancialAccount) GetAccountByName(iSbi.FinancialAccounts, "Checking");
// Set the payment method (IPaymentMethod).
eb.PaymentMethod = iSbi.PaymentMethods.GetSystemPaymentMethod(SystemPaymentMethod.Checking);
eb.InternalComments = "this check was created with the SDK";

// Identify the check as a manual paycheck.
// Without the code, the check appears as a regular check instead of as a manual paycheck.

IExtendedDocumentPropertyView propView = (IExtendedDocumentPropertyView) eb.PropertyBag;
if (propView.GetItemValue("PayrollCheck") == null)
{
	IExtendedDocumentProperty payrollProperty = propView.CreatePropertyBagItem();
	payrollProperty.ReferenceString = "PayrollCheck";
// Because the propertyBag property must contain a value, set the propertyBag property to a value of 1.
	payrollProperty.PropertyBag = System.Text.Encoding.Unicode.GetBytes("1");
	eb.FriendlyDocumentName = "Payroll Check";
}

// Add an expense line (IExpenseLine).
IExpenseLine line = (IExpenseLine) eb.CreateEmployeeBillLine(DocumentLineType.ContractExpenseLineType);
line.FinancialAccount = iSbi.FinancialAccounts.GetByDisplayNumber("6350");

line.SubTotal = 200;

// The employee bill contains a check property (ICheck).
ICheck check = eb.Check;
check.Memo = "this is the check memo property";
check.CheckNumber = "";
check.UpdateCheck();

try
{
	eb.Save();
}

catch (Exception ex)
{
	// Add code here to handle an exception if it is necessary.
}

Modification Type:MajorLast Reviewed:4/12/2006
Keywords:kbMBSMigrate kbhowto KB915509 kbAudEndUser kbAudKnowledgeWorker