Create a new Stock item

Parameters

id (optional)

Integer ID for the stock item. If this is provided, the server will try to update the existing stock item instead of creating a new one.

name

String. The human-readable name of the Stock item.

code

String. The stock code for this item.

Codes must be unique, so if you try to create a new stock item with an existing stock code, then the existing item will be updated instead.

nominal (optional)

Integer nominal code for accounting purposes. Defaults to 0 if not supplied.

cost

Float cost of one of the stock item. How much you bought it for.

amount

Integer. How many of the item are you adding to database.

price

Float price of the stock. How much you sell the product for.

description (optional)

String description of the Stock item.

notes (optional)

String notes about the Stock item. You could include details of where it was purchased, any special instructions for working with it, etc.

supplier (optional)

String name of the Supplier. Must match an existing Supplier.

Example

FM_api('Stock_add',
	[
		'name'=>'1kg 1.75mm PLA Filament',
		'code'=>'PLA001',
		'nominal'=>'1',
		'cost'=>'12.99',
		'price'=>'15.99',
		'amount'=>'3',
		'description'=>'PLA filament for 3D printers'
	]
);

Result

{"ok":1,"id":"7"}