Programmer:Item Group

From AutoCount Resource Center
Jump to navigation Jump to search

Technical Specification

  1. Default ItemGroup size = 8
  2. Not allow to delete Item Group when it is being referred in Stock Item.

References of AutoCount Accounting version 1.8, 1.9

BCE.AutoCount.dll
BCE.AutoCount.CommonAccounting.dll
BCE.AutoCount.MainEntry.dll
BCE.Utils.dll
BCE.Utils.UI.dll
BCE.AutoCount.StockMaint.dll


Item Group API Usage

New

public void NewItemGroup(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Stock.ItemGroup.ItemGroupCommand cmd = BCE.AutoCount.Stock.ItemGroup.ItemGroupCommand.Create(dbSetting);
    BCE.AutoCount.Stock.ItemGroup.ItemGroupEntity itemGroup = cmd.NewItemGroup();

    itemGroup.ItemGroup = "FINISHED";
    itemGroup.Description = "Finished Goods";
            
    //Assign account code with default account code respectively
    itemGroup.SalesCode = GetDefaultSalesCode(dbSetting);
    itemGroup.CashSalesCode = GetDefaultCashSaleCode(dbSetting);
    itemGroup.SalesDiscountCode = GetDefaultSalesDiscountCode(dbSetting);
    itemGroup.SalesReturnCode = GetDefaultSalesReturnCode(dbSetting);
    itemGroup.PurchaseCode = GetDefaultPurchaseCode(dbSetting);
    itemGroup.PurchaseDiscountCode = GetDefaultPurchaseDiscountCode(dbSetting);
    itemGroup.PurchaseReturnCode = GetDefaultPurchaseReturnCode(dbSetting);
    itemGroup.BalanceStockCode = GetDefaultBalanceStockCode(dbSetting);

    cmd.SaveItemGroup(itemGroup);
}

Edit

public void EditItemGroup(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Stock.ItemGroup.ItemGroupCommand cmd = BCE.AutoCount.Stock.ItemGroup.ItemGroupCommand.Create(dbSetting);
    BCE.AutoCount.Stock.ItemGroup.ItemGroupEntity itemGroup = cmd.GetItemGroup("FINISHED");

    //ItemGroup allows rename using ItemGroupCommand
    //ItemCode that is referring to this ItemGroup will be updated to the new ItemGroup
    itemGroup.ItemGroup = "FINISH1";
    itemGroup.Description = "Finished Goods";

    //Assign account code with default account code respectively
    itemGroup.SalesCode = GetDefaultSalesCode(dbSetting);
    itemGroup.CashSalesCode = GetDefaultCashSaleCode(dbSetting);
    itemGroup.SalesDiscountCode = GetDefaultSalesDiscountCode(dbSetting);
    itemGroup.SalesReturnCode = GetDefaultSalesReturnCode(dbSetting);
    itemGroup.PurchaseCode = GetDefaultPurchaseCode(dbSetting);
    itemGroup.PurchaseDiscountCode = GetDefaultPurchaseDiscountCode(dbSetting);
    itemGroup.PurchaseReturnCode = GetDefaultPurchaseReturnCode(dbSetting);
    itemGroup.BalanceStockCode = GetDefaultBalanceStockCode(dbSetting);

    cmd.SaveItemGroup(itemGroup);
}

Delete

public void DeleteItemGroup(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Stock.ItemGroup.ItemGroupCommand cmd = BCE.AutoCount.Stock.ItemGroup.ItemGroupCommand.Create(dbSetting);
    cmd.DeleteItemGroup("FINISHED");
}

Default Accounts

  • Default accounts are maintained in Tools | Options, under G/L | Default Accounts, where Default Sale Account, Purchase Account and etc are maintained.
  • Below methods are to obtain default accounts value.
//Default Sale Account Code
//Implement in Sale Invoice
private string GetDefaultSalesCode(BCE.Data.DBSetting dbSetting)
{
    string str = BCE.Data.DBRegistry.Create(dbSetting)
        .GetString(new BCE.AutoCount.RegistryID.DefaultAccount.SaleAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Cash Sale Code
//Implement in Cash Sale
private string GetDefaultCashSaleCode(BCE.Data.DBSetting dbSetting)
{
    string str = BCE.Data.DBRegistry.Create(dbSetting)
        .GetString(new BCE.AutoCount.RegistryID.DefaultAccount.CashSaleAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Sales Discount Code
//Implement in Sale Credit Note, Sale Invoice, Cash Sale
private string GetDefaultSalesDiscountCode(BCE.Data.DBSetting dbSetting)
{
    string str = BCE.Data.DBRegistry.Create(dbSetting)
        .GetString(new BCE.AutoCount.RegistryID.DefaultAccount.DiscountAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Sales Return Code
//Implement in Sale Credit Note
private string GetDefaultSalesReturnCode(BCE.Data.DBSetting dbSetting)
{
    string str = BCE.Data.DBRegistry.Create(dbSetting)
        .GetString(new BCE.AutoCount.RegistryID.DefaultAccount.SalesReturnAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Purchase Code
//Implement in Purchase Invoice and Cash Purchase
private string GetDefaultPurchaseCode(BCE.Data.DBSetting dbSetting)
{
    string str = BCE.Data.DBRegistry.Create(dbSetting)
        .GetString(new BCE.AutoCount.RegistryID.DefaultAccount.PurchaseAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Purchase Discount Code
//Implemnt in Purchase Return document
private string GetDefaultPurchaseDiscountCode(BCE.Data.DBSetting dbSetting)
{
    string str = BCE.Data.DBRegistry.Create(dbSetting)
        .GetString(new BCE.AutoCount.RegistryID.DefaultAccount.PurchaseDiscountAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Purchase Return Code
//Implement in Purchase Return document
private string GetDefaultPurchaseReturnCode(BCE.Data.DBSetting dbSetting)
{
    string str = BCE.Data.DBRegistry.Create(dbSetting)
        .GetString(new BCE.AutoCount.RegistryID.DefaultAccount.PurchaseReturnAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Stock Balance Code
//Implement in "Live Stock Update" for Financial Reports
private string GetDefaultBalanceStockCode(BCE.Data.DBSetting dbSetting)
{
    string str = BCE.Data.DBRegistry.Create(dbSetting)
        .GetString(new BCE.AutoCount.RegistryID.DefaultAccount.BalanceStockAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}

See Also

Go to menu

IconAC81.png Go to top
ProgrammerGo.jpg Resources For AutoCount Software Developers