Item Class
Properties Methods Events Configuration Settings Errors
The Item component is used to add any of eight types of items to QuickBooks's item list. It may also get item data, and in some cases, may modify it as well.
Class Name
InQB_Item
Procedural Interface
inqb_item_open(); inqb_item_close($res); inqb_item_register_callback($res, $id, $function); inqb_item_get_last_error($res); inqb_item_get_last_error_code($res); inqb_item_set($res, $id, $index, $value); inqb_item_get($res, $id, $index); inqb_item_do_add($res); inqb_item_do_checkrequeststatus($res, $requestid); inqb_item_do_closeqbconnection($res); inqb_item_do_config($res, $configurationstring); inqb_item_do_delete($res); inqb_item_do_get($res, $id); inqb_item_do_getbyname($res, $fullname); inqb_item_do_getcustomfield($res, $fieldname); inqb_item_do_importqbxml($res, $xmldata); inqb_item_do_openqbconnection($res); inqb_item_do_reset($res); inqb_item_do_setcustomfield($res, $fieldname, $fieldvalue); inqb_item_do_update($res);
Remarks
The Item component may be used to add or retrieve any of the following types of items: service, inventory, non-inventory, sales tax, discount, payment, subtotal, or other charge. To add an item to QuickBooks, first set the ItemType property to the appropriate value as well as ItemName. Then, you may set a variety of other properties and special fields, which differ depending on the type of item.
Service, Non-Inventory, and Other Charge Items
These types of items may be purchased from vendors, sold to customers, or both.
In case the item is purchased but not sold, or sold but not purchased, the Description, Price, PricePercent, and Account properties are used. The Account property is the only one required; it should specify an income account if the item is sold, or an expense account if the item is purchased.
Equivalently, you may specify PurchaseExpenseAccount, PurchaseCost, and PurchaseDescription. This will have the same effect, because QuickBooks does not distinguish between items that are purchased only and items that are sold only. However, QuickBooks data will always be returned in Description, Price, and Account.
In case the item is both sold and purchased, you should specify Description, Price, PricePercent, and Account for sales, and PurchaseDescription, PurchaseCost, PurchasePreferredVendor, and PurchaseExpenseAccount for purchase transactions. This will cause different default rates to appear on sales transactions (such as invoices) and purchase transactions (such as bills).
Example (Adding a service item)
Item1.ItemType = itService '1 Item1.ItemName = "Accounting Services" Item1.Description = "General accounting services" Item1.Price = "70.00" '$70.00 per hour Item1.AccountName = "Accounting:Labor" Item1.Add()Inventory Items
Inventory items are always both sold and purchased, so the interface is similar to that for non-inventory items that are sold and purchased. Set Description, Price, and Account for sales, and PurchaseDescription, PurchaseCost, and PurchasePreferredVendor for purchases. Instead of setting PurchaseExpenseAccount you must instead set two separate accounts: PurchaseCOGSAccount refers to your Cost Of Goods Sold account, and PurchaseAssetAccount refers to your Inventory Assets account.
Other details are also available as special fields: See Config for details on how to set or query the quantity on hand and on order, reorder point, and the inventory date.
Example
Item1.ItemType = itInventory '2 Item1.ItemName = "French Door" Item1.Description = "Glass French Door" 'this will appear on invoices Item1.Price = "245.00" 'Charge $245.00 to customers Item1.AccountName = "Construction:Materials" Item1.PurchaseDesciption = "Glass French Door" 'this will appear on bills Item1.PurchaseCost = "160.00" Item1.PurchasePreferredVendorName = "Joe's Doors, Inc." Item1.PurchaseCOGSAccountName = "Cost Of Goods Sold" Item1.PurchaseAssetAccountName = "Inventory Asset" Item1.Add()Other Items
Other types of items are considerably less complex.
To add a discount item to QuickBooks, set ItemName and the SalesTaxCode, as well as the Description, Price or PricePercent (here these properties refer to the rate of discount), as well as an Account.
To add a payment item to QuickBooks, set ItemName, Description, Account, and the PaymentMethod special field.
To add a sales tax item to QuickBooks, set ItemName, Description, and the TaxRate and TaxVendor special fields.
To add a subtotal item to QuickBooks, set ItemName and Description.
Example (Adding a sales tax item) Item1.ItemType = itSalesTax '6 Item1.ItemName = "San Jose, CA" Item1.Config("TaxRate=6.75") Item1.Config("TaxVendorName=San Jose Board of Taxation") Item1.Add()
Modifying Items
This functionality requires QuickBooks 2003. You must first set QBXMLVersion to "2.0" or higher before you may modify items.
Update functionality is limited to service, inventory, and non-inventory items. You may update the name, sales tax code, description(s), and price(s). However, with the exception of inventory, you may not change any of the accounts associated with items, nor can you convert items into other types of items.
In the case of inventory items, you may modify PurchaseCOGSAccount and PurchaseAssetAccount, but not the sales income account.
Getting Items
You may also use the class to get items from QuickBooks using their RefId or ItemName: simply call Get or GetByName.
It is not necessary to set ItemType before getting items from QuickBooks. Both Get and GetByName will get any type of item from QuickBooks, and will populate ItemType automatically. In case ItemType is itUnknown the SpecialItemType special field will contain QuickBooks's description of the type of item. In some cases (such as for inventory assembly items) properties such as Description, Account, etc. may contain relevant information.
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
AccountId | An account for this item. |
AccountName | An account for this item. |
DateSold | Indicates Date asset was sold. |
Description | A description for the item. |
InventoryQuantityOnHand | The quantity in stock for this inventory item. |
InventoryReorderPoint | The reorder point for this inventory item. |
InventoryTotalValue | The total value of this inventory item. |
ItemName | Name of the item. |
ItemType | The type of item. |
LineItemCount | The number of records in the LineItem arrays. |
LineItemId | Id of the Line Item. |
LineItemName | Name of the Line Item. |
LineItemQuantity | Quantity of the Line Item indicated by ItemName or ItemId . |
ParentId | Reference to parent Item . |
ParentName | Reference to parent Item . |
Price | The price for this item. |
PricePercent | A price percent for this item. |
PurchaseAssetAccountId | The inventory asset account for this item. |
PurchaseAssetAccountName | The inventory asset account for this item. |
PurchaseCOGSAccountId | The Cost Of Goods Sold account for this item. |
PurchaseCOGSAccountName | The Cost Of Goods Sold account for this item. |
PurchaseCost | The purchase cost for this item. |
PurchaseDate | Indicates Date asset was purchased. |
PurchaseDescription | The purchase description for this item. |
PurchaseExpenseAccountId | The expense account charged when this item is purchased. |
PurchaseExpenseAccountName | The expense account charged when this item is purchased. |
PurchasePreferredVendorId | The preferred vendor for this item. |
PurchasePreferredVendorName | The preferred vendor for this item. |
QBConnectionString | An aggregate consisting of various QuickBooks connection properties. |
QBRequestAggregate | The request aggregate. |
QBRequestId | The Id of the next message to be sent to QuickBooks. |
QBRequestMode | Defines whether the request is made online or stored offline. |
QBResponseAggregate | The last QBXML response aggregate received from QuickBooks. |
QBXMLVersion | The version of QBXML used in the outgoing message. |
RefId | An alphanumerical identifier generated by the server. |
SalesTaxCodeId | Whether or not this item is taxable. |
SalesTaxCodeName | Whether or not this item is taxable. |
SalesTaxItemCount | The number of records in the SalesTaxItem arrays. |
SalesTaxItemId | Used to calculate sales tax. |
SalesTaxItemName | Used to calculate sales tax. |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
Add | Adds the record into QuickBooks. |
CheckRequestStatus | Checks whether or not the specified request was processed by QuickBooks. |
CloseQBConnection | Closes a persistent connection to QuickBooks. |
Config | Sets or retrieves a configuration setting . |
Delete | Deletes the record from QuickBooks. |
Get | Gets a single record from QuickBooks. |
GetByName | Gets a single record from QuickBooks. |
GetCustomField | Gets a custom field value from QuickBooks. |
ImportQBXML | Imports a QBXML response aggregate. |
OpenQBConnection | Opens a persistent connection to QuickBooks. |
Reset | Resets all properties to their defaults. |
SetCustomField | Sets a custom field value within QuickBooks. |
Update | Updates the item in QuickBooks. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
Error | Information about errors during data delivery. |
SSLServerAuthentication | Fired after the server presents its certificate to the client. |
SSLStatus | Shows the progress of the secure connection. |
Status | Shows the progress of the QuickBooks connection. |
Warning | Fired when a warning occurs. |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
SendRawXML | Sends specified XML to quickbooks without modification. |
TimeCreated | The time the object was created. |
TimeModified | The time the object was created. |
EditSequence | An identifier for this copy of the object. |
FullName | The name of the Item. |
Sublevel | The number of ancestors this Item has. |
PartNumber | The Manufacturer's Part Number for the Item. |
InventoryAverageCost | The average purchase cost for this inventory item. |
InventoryQuantityOnOrder | The number of these items that have been ordered from vendors, but not received. |
InventoryQuantityOnSalesOrder | The number of these items that have been ordered by customers, but not delivered. |
InventoryDate | The date when the item was converted into an inventory item. |
PaymentMethodName | The method of payment, i.e., 'Check', 'Credit Card', etc. |
PaymentMethodId | The method of payment, i.e., 'Check', 'Credit Card', etc. |
TaxRate | The percentage rate of tax. |
TaxVendorName | The VENDOR or tax agency to whom taxes are due. |
TaxVendorId | The VENDOR or tax agency to whom taxes are due. |
IsActive | Indicates whether the object is currently enabled for use by QuickBooks. |
SpecialItemType | The type of the item when ItemType is Unknown. |
AssetAcquiredAs | Indicates whether this item was new or used when the business acquired it. |
VendorOrPayeeName | Name of the vendor from whom this asset was purchased. |
SalesExpense | Any expenses that were incurred during the sale of a fixed asset. |
AssetDescription | Description of the asset. |
AssetLocation | Where the asset is located or has been placed into service. |
AssetPONumber | The purchase order number associated with this asset. |
AssetSerialNumber | The serial number of the asset. |
AssetWarrantyExpires | The date when the warranty for this asset expires. |
AssetNotes | Additional information about the asset. |
AssetNumber | The number used by the QuickBooks Fixed Asset Manager to identify this asset. |
AssetCostBasis | The total cost of the fixed asset. |
AssetDepreciation | The amount the fixed asset has lost in value since it was purchased, as of the end of the year. |
AssetBookValue | A reasonable estimate of the sales value of the fixed asset, as of the end of the year. |
UnitOfMeasureName | Name of the units that the item is measured in. |
UnitOfMeasureId | Id of the units that the item is measured in. |
StopOnError | Specifies how QuickBooks is to proceed if an error occurs in processing of the current request. |
SSLAcceptServerCert | The SSL certificate being used by the Remote Connector. |
SSLAcceptServerCertFile | The SSL certificate file being used by the Remote Connector. |
EnforceMaxLength | Indicates whether to enforce max lengths for QB Fields. |
AuthFlags | Connection Flags (use for QuickBooks Simple Start). |
GetHighestVersion | Highest QBXMLVersion supported by the installed instance of QuickBooks. |
GetSupportedVersions | Returns a list of QBXMLVersions that are supported by QuickBooks. |
GetRequestProcessorDLLVersion | Returns the version of the QB Request Processor that is installed on your system. |
IsReadOnly | This causes the QuickBooks authorization dialog to display text informing the user that its access will be read-only. |
UnattendedModePref | Whether connecting while QuickBooks is closed is required or optional for the user. |
PersonalDataPref | Whether the connecting application will require access to personal data such as SSN or credit card information. |
QBOpenCompanyFile | The file currently open in QuickBooks. |
QBConnectionMode | The mode of connection to QuickBooks. |
QBFileStatus | The status of the company file as it pertains to accepting connections. |
WarningCodes | A comma-separated list of QuickBooks warning codes that should not result in an exception. |
CodePage | The system code page used for Unicode to Multibyte translations. |