Microsoft KB Archive/915509

= How to create a manual payroll check by using the SDK for Accounting Professional 2007 or for Small Business Accounting 2006 =

Article ID: 915509

Article Last Modified on 2/7/2007

-

APPLIES TO


 * Microsoft Office Accounting Professional 2007
 * Microsoft Office Small Business Accounting 2006

-





INTRODUCTION
You can create a manual payroll check by using the Software Development Kit (SDK) for Microsoft Office Accounting Professional 2007 or for Microsoft Office Small Business Accounting 2006.



MORE INFORMATION
To create a manual payroll check by using the SDK, follow these steps:
 * 1) Create an employee bill.

Note The employee bill contains a check property that represents the manual payroll check.
 * 1) In the employee bill, set the following properties:
 * 2) * The employee account
 * 3) * The financial account
 * 4) * The payment method
 * 5) Add the expense lines.

Note The expense lines represent the accounts to which you are posting information when you create the manual payroll check.

The following sample code lets you create a manual payroll check in Fabrikam, Inc. (Fabrikam, Inc. is the sample service company.) The manual payroll check is paid to the Karen Berg account from the Checking account. Then, the manual payroll check 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, &quot;Karen Berg&quot;); // Set the financial account (IFinancialAccount). eb.FinancialAccount = (IFinancialAccount) GetAccountByName(iSbi.FinancialAccounts, &quot;Checking&quot;); // Set the payment method (IPaymentMethod). eb.PaymentMethod = iSbi.PaymentMethods.GetSystemPaymentMethod(SystemPaymentMethod.Checking); eb.InternalComments = &quot;this check was created with the SDK&quot;;

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

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

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

line.SubTotal = 200;

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

try {   eb.Save; }

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

Additional query words: SBA SDK

Keywords: kbhowto kbmbsmigrate KB915509

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.