How to programmatically determine whether a Small Business Accounting item is taxable (920197)



The information in this article applies to:

  • Microsoft Office Small Business Accounting 2006 Software Development Kit 1.2
  • Microsoft Office Small Business Accounting 2006
  • Microsoft Office Small Business Management Edition 2006

Notice

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

INTRODUCTION

You can determine whether an item in Microsoft Office Small Business Accounting is taxable by using the software development kit (SDK).

MORE INFORMATION

You can determine whether any Small Business Accounting type that implements the ITaxGroup interface is taxable. To do this, examine the value of the object's AutoIncludeAllTaxCodes property.

The following code sample prints the value of the AutoIncludeAllTaxCodes property for an item in the Northwind Traders company. Northwind Traders is a fictitious company that is used for demonstration in Small Business Accounting. The code sample retrieves an item from the database and then prints the item's name and the item's status as taxable or not taxable.
// Declare the ISmallBusinessInstance iSbi variable.
ISmallBusinessInstance iSbi;

// iSbi must be instantiated before continuing.

IInventoryItemAccount item = (IInventoryItemAccount) GetAccountByName(iSbi.ItemAccounts, "Fishing Line");
Console.WriteLine("\nItem Name:\t{0}\nTaxable:\t{1}\n", item.Name, item.ItemTaxGroup.AutoIncludeAllTaxCodes);
Console.ReadLine();

static IAccount GetAccountByName(IBaseMasterView view, string acctName)
{
	IAccount account = null;
	DataRow row = null;

	if (view != null)
	{
		DataView dv = view.DataView;

		dv.RowFilter = String.Format("Name='{0}'", acctName);            
		dv.Sort = "ModifiedDateTime DESC";
    
		// In case there is more than one row, we retrieve the latest one.
		if (dv.Count > 0)
		{
			row = dv[0].Row;
		}
	}

	if (row != null)
	{
		account = (IAccount) view.GetByDataRow(row);
	}

	return account;
}

Modification Type:MajorLast Reviewed:7/24/2006
Keywords:kbExpertiseAdvanced kbhowto KB920197 kbAudDeveloper