AR Deposit: Difference between revisions

From AutoCount Resource Center
Content added Content deleted
No edit summary
mNo edit summary
Line 65: Line 65:
</syntaxhighlight>
</syntaxhighlight>


===Get Deposit Payment Method===
====Get Deposit Payment Method====


<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">

Revision as of 03:29, 18 December 2017

Go to menu

Go to top
Resources For AutoCount Software Developers


Rules in AR Deposit

Assemblies version 1.8

BCE.AutoCount.ARAP.dll

Create new AR Deposit

public void NewARDeposit(ARDepositSource source, BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.ARAP.ARDeposit.ARDepositCommand cmd = BCE.AutoCount.ARAP.ARDeposit.ARDepositCommand.Create(dbSetting);
    BCE.AutoCount.ARAP.ARDeposit.ARDeposit doc = cmd.AddNew();

    doc.DocNo = source.DocumentNo;
    doc.DocDate = source.DocumentDate;
    doc.Description = source.Description;
    doc.DepositPaymentMethod = source.DepositMethod;
    doc.CurrencyCode = source.CurrencyCode;
    doc.DebtorCode = source.CustomerAccount;
    doc.DebtorName = source.CustomerName;
    doc.Attention = source.Attention;
    doc.Phone1 = source.Phone;
    doc.Fax1 = source.Fax;
    doc.ProjNo = source.Project;
    doc.DeptNo = source.Department;

    source.Detail.ForEach(s => AddARDepositDetail(s, doc.AddDetail));

    try
    {
        doc.Save();
        BCE.Application.AppMessage.ShowMessage(string.Format("{0} is Created.", doc.DocNo));
    }
    catch (BCE.Application.AppException ex)
    {
        BCE.Application.AppMessage.ShowErrorMessage(ex.Message);
    }
}

public void AddARDepositDetail(ARDepositDetailSource source , Func<BCE.AutoCount.ARAP.ARDeposit.ARDepositDetail> addDepositDetail)
{
    BCE.AutoCount.ARAP.ARDeposit.ARDepositDetail dtl = addDepositDetail();
    dtl.PaymentMethod = source.PaymentMethod;
    dtl.ChequeNo = source.ChequeNo;
    dtl.PaymentAmt = source.DepositAmount;
    dtl.BankCharge = source.BankCharge;
    dtl.BankChargeTaxType = source.BankChargeTaxCode;
    dtl.BankChargeTaxRefNo = source.BankChargeBillNoForGst;
    dtl.PaymentBy = source.PaymentBy;
            
    //Returned Cheque
    if (source.ReturnChequeDate.HasValue)
    {
        dtl.IsRCHQ = true;
        dtl.RCHQDate = source.ReturnChequeDate.Value;
    }
    else
    {
        dtl.IsRCHQ = false;
    }
}

Get Deposit Payment Method

private DataTable GetDepositPaymentMethod(BCE.Data.DBSetting dbSetting)
{
    BCE.AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder depositBuilder =
        new BCE.AutoCount.XtraUtils.LookupEditBuilder.DepositPaymentMethodLookupEditBuilder();

    return depositBuilder.BuildDataTable(dbSetting);
}



Classes of Source

public class ARDepositSource
{
    public string DocumentNo { get; set; }
    public DateTime DocumentDate { get; set; } = DateTime.Today.Date;
    public string Description { get; set; }
    public string DepositMethod { get; set; }
    /// <summary>
    /// Currency Code that is used to pay the deposit
    /// </summary>
    public string CurrencyCode { get; set; }
    public string CustomerAccount { get; set; }
    public string CustomerName { get; set; }
    public string Attention { get; set; }
    public string Phone { get; set; }
    public string Fax { get; set; }
    public string Project { get; set; }
    public string Department { get; set; }
    /// <summary>
    /// IsSecurityDeposit is to decide whether this deposit is subject to GST
    /// </summary>
    public bool IsSecurityDeposit { get; set; }

    public List<ARDepositDetailSource> Detail = new List<ARDepositDetailSource>();
}

public class ARDepositDetailSource
{
    public string PaymentMethod { get; set; }
    public string ChequeNo { get; set; }
    public decimal DepositAmount { get; set; }
    public decimal BankCharge { get; set; }
    public string BankChargeTaxCode { get; set; }
    public string BankChargeBillNoForGst { get; set; }
    public string PaymentBy { get; set; }
    /// <summary>
    /// If this cheque is returned/bounced cheque
    /// Set the returned/bounced date. Otherwise it is null
    /// </summary>
    public DateTime? ReturnChequeDate { get; set; }
}


See Also