Programmer:Item Group v2

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 2.0

AutoCount.Accounting.dll
AutoCount.Accounting.UI.dll
AutoCount.dll
AutoCount.MainEntry.dll
AutoCount.UI.dll
AutoCount.StockMaint.dll


Item Group API Usage

New

public void NewItemGroup(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Stock.ItemGroup.ItemGroupCommand cmd =
        AutoCount.Stock.ItemGroup.ItemGroupCommand.Create(userSession, userSession.DBSetting);
    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(userSession);
    itemGroup.CashSalesCode = GetDefaultCashSaleCode(userSession);
    itemGroup.SalesDiscountCode = GetDefaultSalesDiscountCode(userSession);
    itemGroup.SalesReturnCode = GetDefaultSalesReturnCode(userSession);
    itemGroup.PurchaseCode = GetDefaultPurchaseCode(userSession);
    itemGroup.PurchaseDiscountCode = GetDefaultPurchaseDiscountCode(userSession);
    itemGroup.PurchaseReturnCode = GetDefaultPurchaseReturnCode(userSession);
    itemGroup.BalanceStockCode = GetDefaultBalanceStockCode(userSession);

    cmd.SaveItemGroup(itemGroup);
}

Edit

public void EditItemGroup(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Stock.ItemGroup.ItemGroupCommand cmd =
        AutoCount.Stock.ItemGroup.ItemGroupCommand.Create(userSession, userSession.DBSetting);
    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(userSession);
    itemGroup.CashSalesCode = GetDefaultCashSaleCode(userSession);
    itemGroup.SalesDiscountCode = GetDefaultSalesDiscountCode(userSession);
    itemGroup.SalesReturnCode = GetDefaultSalesReturnCode(userSession);
    itemGroup.PurchaseCode = GetDefaultPurchaseCode(userSession);
    itemGroup.PurchaseDiscountCode = GetDefaultPurchaseDiscountCode(userSession);
    itemGroup.PurchaseReturnCode = GetDefaultPurchaseReturnCode(userSession);
    itemGroup.BalanceStockCode = GetDefaultBalanceStockCode(userSession);

    cmd.SaveItemGroup(itemGroup);
}

Delete

public void DeleteItemGroup(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Stock.ItemGroup.ItemGroupCommand cmd =
        AutoCount.Stock.ItemGroup.ItemGroupCommand.Create(userSession, userSession.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(AutoCount.Authentication.UserSession userSession)
{
    string str = AutoCount.Data.DBRegistry.Create(userSession.DBSetting)
        .GetString(new AutoCount.RegistryID.DefaultAccount.SaleAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Cash Sale Code
//Implement in Cash Sale
private string GetDefaultCashSaleCode(AutoCount.Authentication.UserSession userSession)
{
    string str = AutoCount.Data.DBRegistry.Create(userSession.DBSetting)
        .GetString(new 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(AutoCount.Authentication.UserSession userSession)
{
    string str = AutoCount.Data.DBRegistry.Create(userSession.DBSetting)
        .GetString(new AutoCount.RegistryID.DefaultAccount.DiscountAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Sales Return Code
//Implement in Sale Credit Note
private string GetDefaultSalesReturnCode(AutoCount.Authentication.UserSession userSession)
{
    string str = AutoCount.Data.DBRegistry.Create(userSession.DBSetting)
        .GetString(new AutoCount.RegistryID.DefaultAccount.SalesReturnAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Purchase Code
//Implement in Purchase Invoice and Cash Purchase
private string GetDefaultPurchaseCode(AutoCount.Authentication.UserSession userSession)
{
    string str = AutoCount.Data.DBRegistry.Create(userSession.DBSetting)
        .GetString(new AutoCount.RegistryID.DefaultAccount.PurchaseAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Purchase Discount Code
//Implemnt in Purchase Return document
private string GetDefaultPurchaseDiscountCode(AutoCount.Authentication.UserSession userSession)
{
    string str = AutoCount.Data.DBRegistry.Create(userSession.DBSetting)
        .GetString(new AutoCount.RegistryID.DefaultAccount.PurchaseDiscountAccountID());
    return string.IsNullOrEmpty(str) ? null : str;
}
//Default Purchase Return Code
//Implement in Purchase Return document
private string GetDefaultPurchaseReturnCode(AutoCount.Authentication.UserSession userSession)
{
    string str = AutoCount.Data.DBRegistry.Create(userSession.DBSetting)
        .GetString(new 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(AutoCount.Authentication.UserSession userSession)
{
    string str = AutoCount.Data.DBRegistry.Create(userSession.DBSetting)
        .GetString(new 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