Programmer:Stock Item: Difference between revisions
Content added Content deleted
mNo edit summary |
mNo edit summary |
||
Line 3: | Line 3: | ||
# Item must have at least one UOM |
# Item must have at least one UOM |
||
# Must have base UOM, which the UOM rate is 1. |
# Must have base UOM, which the UOM rate is 1. |
||
# Though AutoCount Accounting supports more than one UOM with the rate of 1, there can only one '''base uom'''. |
# Though AutoCount Accounting supports more than one UOM with the rate of 1, there can only be one '''base uom'''. |
||
# '''Rename''' ItemCode at ItemDataAccess or when Edit the item is not allow. |
# '''Rename''' ItemCode at ItemDataAccess or when Edit the item is not allow. |
||
#*Must Implement '''Change Item Code''' to rename the ItemCode |
#*Must Implement '''Change Item Code''' to rename the ItemCode |
Revision as of 09:00, 18 January 2018
Rules in Stock Item
- Default ItemCode size = 30
- Item must have at least one UOM
- Must have base UOM, which the UOM rate is 1.
- Though AutoCount Accounting supports more than one UOM with the rate of 1, there can only be one base uom.
- Rename ItemCode at ItemDataAccess or when Edit the item is not allow.
- Must Implement Change Item Code to rename the ItemCode
- Item cannot be deleted, when the item is used in documents.
References of AutoCount Accounting version 1.8
BCE.AutoCount.dll BCE.AutoCount.CommonAccounting.dll BCE.AutoCount.MainEntry.dll BCE.Utils.dll BCE.Utils.UI.dll BCE.AutoCount.StockMaint.dll
Stock Item API Usage
New
- It is advisable that Item Group is assigned to an item. Refer to Item Group.
public void NewStockItem(BCE.Data.DBSetting dbSetting)
{
//If true, cost of this item will be recalculated upon saving
//Since this is a new item, so there is no transactions to be recalculated.
bool recalculate = false;
BCE.AutoCount.Stock.Item.ItemDataAccess cmd = BCE.AutoCount.Stock.Item.ItemDataAccess.Create(dbSetting);
BCE.AutoCount.Stock.Item.ItemEntity itemEntity = cmd.NewItem();
BCE.AutoCount.Stock.Item.ItemUomEntity uomEntity;
itemEntity.ItemCode = "FG001";
itemEntity.ItemGroup = "FINISHED"; //ItemGroup must already exist in "Item Group Maintenance"
itemEntity.Description = "Finished Goods 001";
//0 : Fixed Cost
//1 : Weighted Average
//2 : FIFO
//3 : LIFO
//If not assign, default Costing method will be auto assigned
itemEntity.CostingMethod = 1;
//Sale Tax and Purchase Tax can be bound to this item
itemEntity.TaxType = "SR-S";
itemEntity.PurchaseTaxType = "TX-S";
//Add one UOM
//The first UOM that is rate 1 will be auto assign to BaseUOM of this item
uomEntity = itemEntity.NewUom("UNIT", 1);
uomEntity.StandardCost = 50;
uomEntity.StandardSellingPrice = 100;
cmd.SaveData(itemEntity, ref recalculate);
}
Edit
public void ChangeStockItemPricing(BCE.Data.DBSetting dbSetting)
{
//If true, cost of this item will be recalculated upon saving
bool recalculate = true;
BCE.AutoCount.Stock.Item.ItemDataAccess cmd = BCE.AutoCount.Stock.Item.ItemDataAccess.Create(dbSetting);
BCE.AutoCount.Stock.Item.ItemEntity itemEntity;
BCE.AutoCount.Stock.Item.ItemUomEntity uomEntity;
itemEntity = cmd.LoadItem("FG001", BCE.AutoCount.Stock.Item.ItemEntryAction.Edit);
//Load the UOM of this Item, where Cost and Price are stored
uomEntity = itemEntity.GetUomByName("UNIT");
uomEntity.StandardCost = 45;
//Calculate Standard Selling Price base on Standard Cost
//Eg. Set the Selling Price at 80% of the cost
uomEntity.StandardSellingPrice = uomEntity.StandardCost * 1.8M;
cmd.SaveData(itemEntity, ref recalculate);
}
Delete
public void DeleteStock(string itemCode, BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.Stock.Item.ItemDataAccess cmd = BCE.AutoCount.Stock.Item.ItemDataAccess.Create(dbSetting);
cmd.Delete(itemCode);
}
Discontinue an Item
public void SetItemDiscontinue(bool discontinue, BCE.Data.DBSetting dbSetting)
{
//If true, cost of this item will be recalculated upon saving
bool recalculate = false;
BCE.AutoCount.Stock.Item.ItemDataAccess cmd = BCE.AutoCount.Stock.Item.ItemDataAccess.Create(dbSetting);
BCE.AutoCount.Stock.Item.ItemEntity itemEntity = cmd.LoadItem("FG001", BCE.AutoCount.Stock.Item.ItemEntryAction.Edit);
//Discontinued = true, this item no longer can be selected in purchase documents
itemEntity.Discontinued = discontinue;
cmd.SaveData(itemEntity, ref recalculate);
}
Inactive an Item
public void SetItemActive(bool active, BCE.Data.DBSetting dbSetting)
{
//If true, cost of this item will be recalculated upon saving
bool recalculate = false;
BCE.AutoCount.Stock.Item.ItemDataAccess cmd = BCE.AutoCount.Stock.Item.ItemDataAccess.Create(dbSetting);
BCE.AutoCount.Stock.Item.ItemEntity itemEntity = cmd.LoadItem("FG001", BCE.AutoCount.Stock.Item.ItemEntryAction.Edit);
//IsActive = false, this item no longer can be selected at all entry form
itemEntity.IsActive = active;
cmd.SaveData(itemEntity, ref recalculate);
}
Auto Generate ItemCode for New Item with ItemCodeHelper
- Auto generate item code depends on a valid Item Code Format setting.
- Item Code Format is maintained in Tools | Options, go to Stock | General Stock Setting.
- One of the 3 methods below can be used when generates item code.
- Get an auto generate item code with the short code of Item Group
- Get an auto generate item code with the short code of Item Type
- Get an auto generate item code with the short code of both Item Group and Item Type
public string GetAutoItemCodeByItemGroup(string itemGroup, BCE.Data.DBSetting dbSetting)
{
string itemCodeFormat = GetDefaultItemCodeFormat(dbSetting);
BCE.AutoCount.Stock.Item.ItemCodeHelper itemHelper = BCE.AutoCount.Stock.Item.ItemCodeHelper.Create(dbSetting);
return itemHelper.GenerateItemCode(itemGroup, null, itemCodeFormat);
}
public string GetAutoItemCodeByItemType(string itemType, BCE.Data.DBSetting dbSetting)
{
string itemCodeFormat = GetDefaultItemCodeFormat(dbSetting);
BCE.AutoCount.Stock.Item.ItemCodeHelper itemHelper = BCE.AutoCount.Stock.Item.ItemCodeHelper.Create(dbSetting);
return itemHelper.GenerateItemCode(null, itemType, itemCodeFormat);
}
public string GetAutoItemCodeByItemGroupAndItemType(string itemGroup, string itemType, BCE.Data.DBSetting dbSetting)
{
string itemCodeFormat = GetDefaultItemCodeFormat(dbSetting);
BCE.AutoCount.Stock.Item.ItemCodeHelper itemHelper = BCE.AutoCount.Stock.Item.ItemCodeHelper.Create(dbSetting);
return itemHelper.GenerateItemCode(itemGroup, itemType, itemCodeFormat);
}
Default Item Code Format
private string GetDefaultItemCodeFormat(BCE.Data.DBSetting dbSetting)
{
return BCE.Data.DBRegistry.Create(dbSetting)
.GetString(new BCE.AutoCount.RegistryID.ItemCodeFormat());
}
See Also
- Item Group
- Stock Item (Item Maintenance)
- Stock Adjustment
- Stock Transfer
- Stock Assembly
- Stock Balance with Costing - [1.8, 1.9] [2.0]
- Item Opening Balance Maintenance - [1.8, 1.9] [2.0]
Go to top
|
Resources For AutoCount Software Developers
|