AR Refund v2

From AutoCount Resource Center
Revision as of 07:15, 28 May 2018 by DanielY (talk | contribs)

Assemblies version 2.0

AutoCount.Accounting.dll
AutoCount.Accounting.UI.dll
AutoCount.dll
AutoCount.MainEntry.dll
AutoCount.UI.dll
AutoCount.ARAP.dll



Create new AR Refund

public void CreateNewARRefund(AutoCount.Authentication.UserSession userSession, RefundSource source)
{
    string userID = userSession.LoginUserID;
    AutoCount.ARAP.ARRefund.ARRefundDataAccess cmd =
        AutoCount.ARAP.ARRefund.ARRefundDataAccess.Create(userSession, userSession.DBSetting);
    AutoCount.ARAP.ARRefund.ARRefundEntity doc = cmd.NewARRefund();

    doc.DocNo = source.DocNo;
    doc.DocDate = source.Date;
    doc.Description = source.Description;

    AutoCount.ARAP.ARRefund.ARRefundDTLEntity dtl = doc.NewDetail();
    dtl.PaymentMethod = "CASH";
    dtl.PaymentAmt = source.RefundAmount;
    dtl.BankCharge = source.BankCharge;

    //Only ARPayment & ARCreditNote allowed to knockoff by ARRefund
    doc.KnockOff(AutoCount.Document.DocumentType.ARPayment, source.PaymentToRefund, source.RefundAmount);

    try
    {
        cmd.SaveARRefund(doc, userID);
    }
    catch (AutoCount.AppException ex)
    {
        AutoCount.AppMessage.ShowMessage(ex.Message);
    }
}

Class of source data

public class RefundSource
{
    public string DocNo { get; set; }
    public DateTime Date { get; set; }
    public string Description { get; set; }
    public decimal RefundAmount { get; set; }
    public decimal BankCharge { get; set; }
    public string PaymentToRefund { get; set; }
}

Template:SeeAlsoAccountV2

Go to menu

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