Open main menu

Contents

Technical Specifications

  1. Adjustment Point is to increase or decrease the balance point.
  2. To learn how AutoCount Bonus Point works, click Bonus Point.
  Sale Invoice and Cash Sale are able to update member's Bonus Point, provided MemberNo is assigned.
Programmer:Earn Point with Sale Invoice

Columns Specification

Master Table

Master Table Columns
Column Name Data Type Size Mandatory Remark
DocNo string 20 Yes If apply system running number,
do not assign or assign "<<New>>"
DocDate DateTime Yes Date only, without time
Eg. DateTime.Today.Date
Description string 100 No
RefDocNo string 20 No
Remark1 string 40 No
Remark2 string 40 No
Remark3 string 40 No
Remark4 string 40 No
Note string Max No

Detail Table Columns

Columns Table
Column Name Data Type Size Mandatory Remark
MemberNo string 20 Yes Value must be maintained at Bonus Point > Member Maintenance
Point decimal 19,2 No

Assemblies 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.GeneralMaint.dll
BCE.AutoCount.Invoicing.dll
BCE.AutoCount.Invoicing.Sales


API Usage

New

public void NewBonusPointAdjustment(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand cmd =
        BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand.Create(dbSetting);
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustment doc = cmd.AddNew();
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentDetail dtl;

    //When apply system running number,
    //do not assign or assigned with "<<New>>"
    //doc.DocNo = "<<New>>";
    doc.DocDate = DateTime.Today.Date;
    doc.Description = "API Test Member Point Adjustment";
    doc.RefDocNo = "I-000001";

    //Increase point
    dtl = doc.AddDetail();
    dtl.MemberNo = "M-0001";
    dtl.Point = 5;
    //dtl.Row["Point"] = 5;

    //Decrease point
    dtl = doc.AddDetail();
    dtl.MemberNo = "M-0002";
    dtl.Point = -5;
    //dtl.Row["Point"] = -5;

    try
    {
        doc.Save();
        //Log Success
        BCE.Application.AppMessage.ShowMessage($"Success created '{doc.DocNo}'.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log failure
        BCE.Application.AppMessage.ShowMessage($"Fail to create new Member Point Adjustment.\n{ex.Message}");
    }
}

Update / Edit

public void UpdateBonusPointAdjustment(string docNo, BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand cmd =
        BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand.Create(dbSetting);
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustment doc = cmd.Edit(docNo);
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentDetail dtl;

    if (doc == null)
    {
        //log document not found
        return;
    }

    //Update any necessary data
    //doc.DocDate = DateTime.Today.Date;
    //doc.Description = "API Test Member Point Adjustment";
    //doc.RefDocNo = "I-000002";

    //Clear all details and add all details back
    doc.ClearDetails();

    //Increase point
    dtl = doc.AddDetail();
    dtl.MemberNo = "M-0001";
    dtl.Point = 5;
    //dtl.Row["Point"] = 5;

    //Decrease point
    dtl = doc.AddDetail();
    dtl.MemberNo = "M-0002";
    dtl.Point = -5;
    //dtl.Row["Point"] = -5;

    try
    {
        doc.Save();
        //Log Success
        BCE.Application.AppMessage.ShowMessage($"Success updated '{doc.DocNo}'.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log failure
        BCE.Application.AppMessage.ShowMessage($"Fail to update {doc.DocNo}.\n{ex.Message}");
    }
}

Cancel (Void)

public void CancelDocument(string docNo, BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand cmd
        = BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand.Create(dbSetting);
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustment doc = cmd.View(docNo);

    try
    {
        doc.CancelDocument(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
        //Log success
        BCE.Application.AppMessage.ShowMessage($"'{docNo}' is cancelled.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log Failure
        BCE.Application.AppMessage.ShowMessage($"Fail to cancel {docNo}.\n{ex.Message}");
    }
}

Uncancel (Unvoid)

public void UncancelDocument(string docNo, BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand cmd
        = BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand.Create(dbSetting);
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustment doc = cmd.View(docNo);

    try
    {
        doc.UncancelDocument(BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
        //Log success
        BCE.Application.AppMessage.ShowMessage($"'{docNo}' is uncancelled.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log Failure
        BCE.Application.AppMessage.ShowMessage($"Fail to uncancel {docNo}.\n{ex.Message}");
    }
}

Delete

public void DeleteBonusPointAdjustment(string docNo, BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand cmd =
        BCE.AutoCount.Invoicing.Sales.BonusPointAdjustment.BonusPointAdjustmentCommand.Create(dbSetting);

    //Because BonusPointAdjustmentCommand Delete() method accept only DocKey
    //Programmer needs to find the related DocKey of known DocNo.
    long? docKey = GetDocKeyByDocNo(docNo, dbSetting);

    if (!docKey.HasValue)
    {
        //log document not found
        return;
    }

    try
    {
        cmd.Delete(docKey.Value);
        //Log Success
        BCE.Application.AppMessage.ShowMessage($"'{docNo}' is deleted.");
    }
    catch (BCE.Application.AppException ex)
    {
        //Log failure
        BCE.Application.AppMessage.ShowMessage($"Fail to delete {docNo}.\n{ex.Message}");
    }
}

private long? GetDocKeyByDocNo(string docNo, BCE.Data.DBSetting dbSetting)
{
    object obj = dbSetting.ExecuteScalar("SELECT DocKey FROM BonusPointADJ WHERE DocNo=?", docNo);
    return obj == null ? default(long?) : BCE.Data.Convert.ToInt64(obj);
}


See Also

Maintenance (Master Data)

Transactions

Reporting

  • Member List and Point Balance - [1.8, 1.9] [2.0]

    Go to menu

      Go to top
      Resources For AutoCount Software Developers