Programmer:Cash Sale with Payment v2

From AutoCount Resource Center

Technical Specification

  1. NetTotal must not be negative amount
  2. Negative Quantity is allowed, if it does not violate the NetTotal rule.

Assemblies version 2.0

AutoCount.Accounting.dll
AutoCount.Accounting.UI.dll
AutoCount.dll
AutoCount.MainEntry.dll
AutoCount.UI.dll
AutoCount.Invoicing.dll
AutoCount.Invoicing.Sales.dll


Cash Sale API Usage

New

public void NewCashSale(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Invoicing.Sales.CashSale.CashSaleCommand cmd =
        AutoCount.Invoicing.Sales.CashSale.CashSaleCommand.Create(userSession, userSession.DBSetting);
    AutoCount.Invoicing.Sales.CashSale.CashSale doc = cmd.AddNew();
    AutoCount.Invoicing.Sales.CashSale.CashSaleDetail dtl;

    doc.DebtorCode = "300-C001";
    doc.DocNo = "CS-00011";
    doc.DocDate = DateTime.Today.Date;

    dtl = doc.AddDetail();
    dtl.ItemCode = "FG00001";
    dtl.Qty = 1;
    dtl.UOM = "UNIT";
    dtl.UnitPrice = 50.20M;

    dtl = doc.AddDetail();
    dtl.ItemCode = "FG00002";
    dtl.Qty = 10;
    dtl.UOM = "UNIT";
    dtl.UnitPrice = 60.20M;
    dtl.Discount = "30%";

    try
    {
        doc.Save();
        //Notify Success
    }
    catch (AutoCount.AppException ex)
    {
        AutoCount.AppMessage.ShowMessage(ex.Message);
    }
}

Edit

public void EditCashSale(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Invoicing.Sales.CashSale.CashSaleCommand cmd =
        AutoCount.Invoicing.Sales.CashSale.CashSaleCommand.Create(userSession, userSession.DBSetting);
    AutoCount.Invoicing.Sales.CashSale.CashSale doc = cmd.Edit("CS-000001");
    AutoCount.Invoicing.Sales.CashSale.CashSaleDetail dtl;

    doc.Description = "CASH SALE";

    if (doc != null)
    {
        doc.ClearDetails();

        dtl = doc.AddDetail();
        dtl.ItemCode = "FG00001";
        dtl.Qty = 2;
        dtl.UOM = "UNIT";
        dtl.UnitPrice = 50M;

        dtl = doc.AddDetail();
        dtl.ItemCode = "FG00003";
        dtl.Qty = 10;
        dtl.UOM = "UNIT";
        dtl.UnitPrice = 6.30M;
        dtl.Discount = "30%";

        try
        {
            doc.Save();
            //Notify Success
        }
        catch (AutoCount.AppException ex)
        {
            AutoCount.AppMessage.ShowMessage(ex.Message);
        }
    }
}

Delete

public void DeleteCashSale(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Invoicing.Sales.CashSale.CashSaleCommand cmd =
        AutoCount.Invoicing.Sales.CashSale.CashSaleCommand.Create(userSession, userSession.DBSetting);

    try
    {
        cmd.Delete("CS-00011");
        //Notify Success
    }
    catch (AutoCount.AppException ex)
    {
        AutoCount.AppMessage.ShowMessage(ex.Message);
    }
}

Void (Cancel)

public void CancelCashSale(AutoCount.Authentication.UserSession userSession)
{
    AutoCount.Invoicing.Sales.CashSale.CashSaleCommand cmd =
        AutoCount.Invoicing.Sales.CashSale.CashSaleCommand.Create(userSession, userSession.DBSetting);

    try
    {
        cmd.CancelDocument("CS-000001", userSession.LoginUserID);
        //Notify Success
    }
    catch (AutoCount.AppException ex)
    {
        AutoCount.AppMessage.ShowMessage(ex.Message);
    }
}


See Also

Go to menu

Go to top
Resources For AutoCount Software Developers