AR Refund v2

From AutoCount Resource Center
Revision as of 09:50, 18 May 2018 by DanielY (talk | contribs) (Created page with "===Assemblies version 2.0=== {{BaseReferenceAC20}} '''AutoCount.ARAP.dll''' <br /><br /> ===Create new AR Refund=== <syntaxhighlight lang="csharp"> public void CreateNewARRef...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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; }
}

See Also

Go to menu

Go to top
Resources For AutoCount Software Developers