Items And Expenses
Items and Expenses
All transaction objects have item lines, and expense transactions have expense lines as well. These are used in the same way that they are used in QuickBooks.
Item lines are used to record the purchase or sale of tangible items or services. Item lines are represented by a collection of array properties. The ItemCount property controls the size of each array, and the Item reference property (i.e., ItemId/ItemName) refers to each item. The quantity is given by ItemQuantity, the total is given by ItemAmount, and the unit cost or rate is given by ItemCost (payment transactions) or ItemRate (transactions with customers).
Other optional properties may be present as well; the list of properties varies slightly with different components, corresponding to the QuickBooks UI.
Example
Transaction1.ItemCount = 2 Transaction1.ItemName(0) = "Wood Door:Exterior" 'must be defined in company file! 'Transaction1.ItemCost(0) = "50.00" 'assign or use QB default Transaction1.ItemQuantity(0) = 4 'if not assigned, assumed to be 1 'Transaction1.ItemAmount(0) = "200.00" 'this will be calculated by QuickBooks 'Transaction1.ItemDescription(0) = "Default" 'may be assigned by QuickBooks Transaction1.ItemName(1) = "Cabinets - Custom" Transaction1.ItemAmount(1) = "164.00" 'simply assign the total amount Transaction1.Add()Expense lines are used to charge an expense to an expense account. Common examples might include rent, gasoline, freight, etc. The number of expenses is controlled with ExpenseCount, and the ExpenseAccount (Name/Id) and ExpenseAmount should be specified for each expense. ExpenseClass (Name/Id), ExpenseCustomer* (Name/Id), and ExpenseMemo are optional.
Example
Transaction1.ExpenseCount = 1 Transaction1.ExpenseAccountName = "Freight & Delivery" Transaction1.ExpenseAmount = "95.00"
All transactions must have at least one item and/or expense line.