Managing Inventory

Small businesses that sell products track and manage the inventory. An inventory is comprised of items and each item is used to track merchandise that your business purchases, stocks, and re-sells. Small businesses manage inventory to track:
  • the current number of inventory items in stock
  • cost of goods sold
  • the asset value of the inventory after the purchase and sale of every item
Account

An account is used to record a total monetary amount allocated against a specific use. To manage inventory in QuickBooks, inventory Items needs to be linked to three accounts:

  1. Asset: Inventory type asset account, tracks the value of inventory for quantity on hand.
  • Recording the purchase of an inventory item increases the value of Inventory Asset account on your Balance Sheet report by the cost of the item and increases the Quantity on Hand units for that item.
  • Recording the sale of an inventory item decreases the value of Inventory Asset account by the original cost of the item and decreases the Quantity on Hand units for that item.
  1. Income: Sales Of Product Income account, tracks revenue from the sale of inventory item.
  2. Expense: Cogs of Goods Sold (COGS) account, tracks all of the costs associated with the items small business sell, which allows calculating gross profits accurately. COGS accounts also give the total underlying costs on your Profit & Loss reports.

It is important to look up existing accounts before creating new ones in QuickBooks, to ensure that accounting is done correctly.

Attributes used in this concept Description
Name User recognizable name for the Account. This must be unique across Accounts, so always check if the account exists before creating one.
AccountType A detailed account classification that specifies the use of this account. In this concept, an Income account type is used for the service and discount items. Either AccountType or AccountSubType may be specified in the request.
AccountSubType Further detail for the account classification. In this concept, a subtype is specified for the discount item, to specify its intended purpose as discounts given to customers. Either AccountType or AccountSubType may be specified in the request
Buying Inventory from vendors

A small business purchases the item on a bill or check in QuickBooks from the vendor in order to receive the items and populate the inventory in QuickBooks. Purchasing the inventory records the cost in the Inventory Asset account.

Selling Inventory to Customers

For any small business, invoices or sales receipt are the way to get paid. For creating invoice or sales receipt there must be some item, quantity against which that invoice is created. When the item is sold to a customer, a cost of goods sold is created and the inventory asset amount is reduced. Small business record the sales of an items:

  • Invoice: Using an invoice if customers can pay later. Small business can set up terms to indicate how long the customer has to pay. If they don’t pay within the specified time limit, their invoice is overdue.
  • Sales Receipt: Using a sales receipt when your customer pays you on the spot for goods or services.
Item

Items are things that the business buys, sells, or re-sells, such as products and services. An item is shown as a line on an estimate, invoice or other sales form.

Attributes used in this concept Description
Name Name of the item. This must be unique across items, so it’s important to query for the item before creating it.
IncomeAccountRef Reference to the Income account that records the proceeds from the sale of this item. the account that records the proceeds from the sale of this item. Must be an account with account type of Sales of Product Income.
ExpenseAccountRef Reference to the expense account used to pay the vendor for this item. Must be an account with account type of Cost of Goods Sold.
AssetAccountRef Reference to the Inventory Asset account that tracks the current value of the inventory. If the same account is used for all inventory items, the current balance of this account will represent the current total value of the inventory.
Type Classification that specifies the use of this item. For this concept, the Service type is specified, which is used in transactions to track services that are charged on the purchase. For example, specialized labor, consulting hours, and professional fees. Video: https://quickbooks.intuit.com/tutorials/lessons/add-services-information/
Invoice

An invoice is a document that a business provides to its customers containing a list of goods and services, along with a statement of their cost for payment later. The list is organized as a series of lines. Invoices help businesses to manage their accounts receivable. Accounts receivable is the outstanding balance that is owed to a business by its customers.

qbo/docs/concepts/manageinventory-invoice.jpg https://www.youtube.com/embed/HKFmulAj7tA?rel=0

Create Invoice

October 11, 2017

3:02

Attributes used in this concept Description
CustomerRef The customer or job for which the invoice should be created.
LinkedTxn In this concept, we will link the estimate created previously to this invoice using a LinkedTxn. This will help small businesses keep track of estimates as they become customer invoices.
Invoice Lines

Line items, or simply lines, in an invoice represent individual items of a transaction. Lines are used to provide the customer an itemized description of the services provided and charges associated with it.

Type Description
Sales Item As a general sales line item, it holds information for a sales item, including the amount, description and associated item. We use this type of line in this concept to invoice service sales to the customer.
Managing invoice and automated sales tax

As of November 10, 2017, all new US QuickBooks Online companies manage sales tax calculations via an automated sales tax (AST) engine. Sales tax is computed automatically on the sales transaction based upon the shipping address and the location of the company rather assigning sales tax manually.

Read more about how QuickBooks Online implements automated sales tax here

How to implement

In this tutorial we are going to create Inventory items. Following are high level steps that we are going to perform:

  1. Create 3 Accounts (Income, Expense and Asset)
  • Set Name Type and SubType to reflect appropriate Account.
  1. Create new Item with Type=Inventory
  • Set Income, Expense and Asset Account
  • Set Quantity on Hand value
  • Set Name and Description of the Item
  1. Create an invoice that holds information for the amount charged for this service i.e. Sales Line Item details Invoice

.NET

Java

PHP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//Initialize OAuth2RequestValidator and ServiceContext
ServiceContext serviceContext = base.IntializeContext(realmId);
DataService dataService = new DataService(serviceContext);

//create income account
Account newAccount = new Account{
   Name = "My "+type.ToString()+ random.Next(),
   AccountType = AccountTypeEnum.Income,
   AccountSubType = AccountSubTypeEnum.SalesOfProductIncome.ToString(),
   AccountTypeSpecified = true,
   SubAccountSpecified = true
};
Account addedIncomeAccount = dataService.Add<Account>(newAccount);

//create expense account
newAccount = new Account{
   Name = "My "+type.ToString()+ random.Next(),
   AccountType = AccountTypeEnum.CostofGoodsSold,
   AccountSubType = AccountSubTypeEnum.SuppliesMaterialsCogs.ToString(),
   AccountTypeSpecified = true,
   SubAccountSpecified = true
};
Account addedIncomeAccount = dataService.Add<Account>(newAccount);

//create asset account
Account newAccount = new Account{
   Name = "My "+type.ToString()+ random.Next(),
   AccountType = AccountTypeEnum.OtherAsset,
   AccountSubType = AccountSubTypeEnum.Inventory.ToString(),
   AccountTypeSpecified = true,
   SubAccountSpecified = true
};
Account addedIncomeAccount = dataService.Add<Account>(newAccount);

//create inventory item using income, expense, asset account
Item newItem = new Item{
   Type = ItemTypeEnum.Inventory,
   Name = "My Inventory 15"  +Guid.NewGuid().ToString("N"),
   QtyOnHand = 10,
   InvStartDate = DateTime.Today,
   Description = "New Inventory with quantity 10",
   TrackQtyOnHand = true,
   TypeSpecified = true,
   QtyOnHandSpecified = true,
   TrackQtyOnHandSpecified = true,
   InvStartDateSpecified = true
};
newItem.IncomeAccountRef = new ReferenceType(){Value = incomeAccount.Id};
newItem.ExpenseAccountRef = new ReferenceType(){Value = expenseAccount.Id};
newItem.AssetAccountRef = new ReferenceType(){Value = assetAccount.Id};
Item addedInventory = dataService.Add<Item>(newItem);

//create invoice for the inventory item
Invoice invoice = new Invoice();
invoice.CustomerRef = new ReferenceType(){Value = customer.Id};

List<Line> lineList = new List<Line>();
Line line = new Line();
line.Amount = new Decimal(100.00);
line.AmountSpecified = true;
lineList.Add(line);
invoice.Line = lineList.ToArray();
SalesItemLineDetail salesItemLineDetail = new SalesItemLineDetail();
salesItemLineDetail.Qty = new Decimal(1.0);
salesItemLineDetail.QtySpecified = true;
salesItemLineDetail.ItemRef = new ReferenceType(){Value = addedInventory.Id};
line.AnyIntuitObject = salesItemLineDetail;
ine.DetailType = LineDetailTypeEnum.SalesItemLineDetail;
line.DetailTypeSpecified = true;
Invoice addedInvoice = dataService.Add<Invoice>(invoice);

// Query inventory item - the quantity should be reduced
QueryService<Item> querySvcItem = new QueryService<Item>(serviceContext);
Item queryInventory = querySvcItem.ExecuteIdsQuery("SELECT * FROM Item WHERE Name = '"+addedInventory.Name+"'").FirstOrDefault();

Go here to view the complete code.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//create oauth object
OAuth2Authorizer oauth = new OAuth2Authorizer(accessToken);
//create context
Context context = new Context(oauth, ServiceType.QBO, realmId);
//create DataService
DataService service = new DataService(context);

//create income account
Account account = new Account();
account.setName("Income " + RandomStringUtils.randomAlphabetic(5));
account.setAccountType(AccountTypeEnum.INCOME);
account.setAccountSubType(AccountSubTypeEnum.SALES_OF_PRODUCT_INCOME.value());
Account incomeBankAccount = service.add(account);

//create expense account
account = new Account();
account.setName("Income " + RandomStringUtils.randomAlphabetic(5));
account.setAccountType(AccountTypeEnum.COST_OF_GOODS_SOLD);
account.setAccountSubType(AccountSubTypeEnum.SUPPLIES_MATERIALS_COGS.value());
Account expenseBankAccount = service.add(account);

//create asset account
account = new Account();
account.setName("Income " + RandomStringUtils.randomAlphabetic(5));
account.setAccountType(AccountTypeEnum.OTHER_CURRENT_ASSET);
account.setAccountSubType(AccountSubTypeEnum.INVENTORY.value());
Account assetAccount = service.add(account);

//create inventory item using income, expense, asset account
Item item = new Item();
item.setType(ItemTypeEnum.INVENTORY);
item.setName("Inventory Item " + RandomStringUtils.randomAlphanumeric(5));
item.setInvStartDate(new Date());
item.setQtyOnHand(BigDecimal.valueOf(10));
item.setTrackQtyOnHand(true);
item.setIncomeAccountRef(createRef(incomeBankAccount));
item.setExpenseAccountRef(createRef(expenseBankAccount));
item.setAssetAccountRef(createRef(assetAccount));
Item savedItem = service.add(item);

//create invoice for the inventory item
Invoice invoice = new Invoice();
invoice.setCustomerRef(createRef(customer)); //query or create a customer

List<Line> invLine = new ArrayList<Line>();
Line line = new Line();
line.setAmount(new BigDecimal("100"));
line.setDetailType(LineDetailTypeEnum.SALES_ITEM_LINE_DETAIL);
SalesItemLineDetail silDetails = new SalesItemLineDetail();
silDetails.setQty(BigDecimal.valueOf(1));
silDetails.setItemRef(createRef(savedItem));
line.setSalesItemLineDetail(silDetails);
invLine.add(line);
invoice.setLine(invLine);
service.add(invoice);

// Query inventory item - the quantity should be reduced
Item itemsRemaining = service.findById(savedItem);

Go here to view the complete code.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
//create dataservice
$dataService->updateOAuth2Token($accessToken);

//create income account
 $incomeAccountRequestObj = Account::create([
   "AccountType" => INCOME_ACCOUNT_TYPE,
   "AccountSubType" => INCOME_ACCOUNT_SUBTYPE,
   "Name" => "IncomeAccount" . uniqid()
]);
$incomeAccount = $dataService->Add($incomeAccountRequestObj);

//create expense account
$expenseAccountRequestObj = Account::create([
   "AccountType" => EXPENSE_ACCOUNT_TYPE,
   "AccountSubType" => EXPENSE_ACCOUNT_SUBTYPE,
   "Name" => "ExpenseAccount" . uniqid()
]);
$expenseAccount = $dataService->Add($expenseAccountRequestObj);

//create asset account
$assetAccountRequestObj = Account::create([
   "AccountType" => ASSET_ACCOUNT_TYPE,
   "AccountSubType" => ASSET_ACCOUNT_SUBTYPE,
   "Name" => "AssetAccount-" . uniqid()
]);
$assetAccount = $dataService->Add($assetAccountRequestObj);

//create inventory item using income, expense, asset account
$itemCreateRequestObj = Item::create([
   "Name" => "Inventory Supplier Sample - " . uniqid(),
   "UnitPrice" => 10,
   "IncomeAccountRef" => ["value" => $incomeAccount->Id],
   "ExpenseAccountRef" => ["value" => $expenseAccount>Id],
   "AssetAccountRef" => ["value" => $expenseAccount>Id],
   "Type" => "Inventory",
   "TrackQtyOnHand" => true,
   "QtyOnHand" => 10,
   "InvStartDate" => "2018-04-01"
]);
$itemCreateResponseObj = $dataService->Add($itemCreateRequestObj);

//create invoice for the inventory item
$invoiceCreateRequestObj = Invoice::create([
   "CustomerRef" => ["value" => $customerObj>Id],
        "Line" => [[
           "Amount" => 20.00,
           "DetailType" => "SalesItemLineDetail",
           "SalesItemLineDetail" => ["ItemRef" => ["value" => $itemCreateResponseObj>Id]],
           "UnitPrice" => 10,
           "Qty" => 1
   ]]
]);
$invoiceCreateResponseObj = $dataService->Add($invoiceCreateRequestObj);

// Query inventory item - the quantity should be reduced
$itemReadResponseObj = $dataService->FindbyId('item', $itemCreateResponseObj->Id);
?>

Go here to view the complete code.

What’s next