AR Received Payment: Difference between revisions
Content added Content deleted
mNo edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
</pre> |
</pre> |
||
<syntaxhighlight lang="csharp"> |
|||
public void NewARPayment(ARPaymentSource source, BCE.Data.DBSetting dbSetting) |
|||
{ |
|||
string userID = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID; |
|||
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd = |
|||
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting); |
|||
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity doc = cmd.NewARPayment(); |
|||
doc.DebtorCode = source.DebtorCode; |
|||
doc.DocNo = source.DocumentNo; |
|||
doc.DocNo2 = source.ReceiptNo2; |
|||
doc.DocDate = source.DocumentDate; |
|||
doc.CurrencyCode = source.PaymentCurrencyCode ?? doc.CurrencyCode; |
|||
doc.ToHomeRate = source.PaymentToHomeCurrencyRate ?? doc.ToHomeRate; |
|||
doc.ToDebtorRate = source.PaymentToDebtorCurrencyRate ?? doc.ToDebtorRate; |
|||
doc.ProjNo = source.Project; |
|||
doc.DeptNo = source.Department; |
|||
source.PaymentDetail.ForEach(s => AddARPaymentDetail(s, doc.NewDetail)); |
|||
foreach (ARPaymentKnockoff knockoff in source.PaymentKnockoff) |
|||
{ |
|||
doc.KnockOff(knockoff.DocType, knockoff.DocNo, knockoff.Amount, knockoff.DBDate); |
|||
} |
|||
try |
|||
{ |
|||
cmd.SaveARPayment(doc, userID); |
|||
//BCE.Application.AppMessage.ShowMessage(string.Format("{0} is created.", doc.DocNo)); |
|||
} |
|||
catch (BCE.Application.AppException ex) |
|||
{ |
|||
//BCE.Application.AppMessage.ShowMessage(ex.Message); |
|||
//log error |
|||
} |
|||
} |
|||
private void AddARPaymentDetail(ARPaymentDetailSource source, Func<BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity> addPaymentDetail) |
|||
{ |
|||
BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity dtl = addPaymentDetail(); |
|||
dtl.PaymentMethod = source.PaymentMethod; |
|||
dtl.ChequeNo = source.ChequeNo; |
|||
dtl.PaymentAmt = source.PaymentAmount; |
|||
dtl.BankCharge = source.BankCharge; |
|||
dtl.BankChargeTaxType = source.BankChargeTaxCode; |
|||
dtl.BankChargeTaxRefNo = source.BankChargeBillNoForGst; |
|||
dtl.PaymentBy = source.PaymentBy; |
|||
if (source.ReturnChequeDate.HasValue) |
|||
{ |
|||
dtl.IsRCHQ = true; |
|||
dtl.RCHQDate = source.ReturnChequeDate.Value; |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
<syntaxhighlight lang="csharp"> |
|||
public class ARPaymentSource |
|||
{ |
|||
public string DebtorCode { get; set; } |
|||
public string DocumentNo { get; set; } |
|||
public string ReceiptNo2 { get; set; } |
|||
public DateTime DocumentDate { get; set; } = DateTime.Today.Date; |
|||
public string Description { get; set; } |
|||
public string DepositMethod { get; set; } |
|||
//When not defined (null), system will apply the Debtor Account's default currency code |
|||
public string PaymentCurrencyCode { get; set; } |
|||
public decimal? PaymentToHomeCurrencyRate { get; set; } |
|||
public decimal? PaymentToDebtorCurrencyRate { get; set; } |
|||
public string Project { get; set; } |
|||
public string Department { get; set; } |
|||
public List<ARPaymentDetailSource> PaymentDetail = new List<ARPaymentDetailSource>(); |
|||
public List<ARPaymentKnockoff> PaymentKnockoff = new List<ARPaymentKnockoff>(); |
|||
} |
|||
public class ARPaymentDetailSource |
|||
{ |
|||
public string PaymentMethod { get; set; } |
|||
public string ChequeNo { get; set; } |
|||
public decimal PaymentAmount { 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; } |
|||
} |
|||
public class ARPaymentKnockoff |
|||
{ |
|||
public const string ARInvoiceDocType = BCE.AutoCount.Document.DocumentType.ARInvoice; |
|||
public const string ARDebitNoteDocType = BCE.AutoCount.Document.DocumentType.ARDN; |
|||
public string DocType { get; set; } |
|||
public string DocNo { get; set; } |
|||
public decimal Amount { get; set; } |
|||
public BCE.Data.DBDateTime DBDate { get; set; } = DBNull.Value; |
|||
} |
|||
</syntaxhighlight> |
|||
==See Also== |
==See Also== |
Revision as of 10:16, 21 December 2017
Go to top
|
Resources For AutoCount Software Developers
|
Assemblies version 1.8
BCE.AutoCount.ARAP.dll
public void NewARPayment(ARPaymentSource source, BCE.Data.DBSetting dbSetting)
{
string userID = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd =
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity doc = cmd.NewARPayment();
doc.DebtorCode = source.DebtorCode;
doc.DocNo = source.DocumentNo;
doc.DocNo2 = source.ReceiptNo2;
doc.DocDate = source.DocumentDate;
doc.CurrencyCode = source.PaymentCurrencyCode ?? doc.CurrencyCode;
doc.ToHomeRate = source.PaymentToHomeCurrencyRate ?? doc.ToHomeRate;
doc.ToDebtorRate = source.PaymentToDebtorCurrencyRate ?? doc.ToDebtorRate;
doc.ProjNo = source.Project;
doc.DeptNo = source.Department;
source.PaymentDetail.ForEach(s => AddARPaymentDetail(s, doc.NewDetail));
foreach (ARPaymentKnockoff knockoff in source.PaymentKnockoff)
{
doc.KnockOff(knockoff.DocType, knockoff.DocNo, knockoff.Amount, knockoff.DBDate);
}
try
{
cmd.SaveARPayment(doc, userID);
//BCE.Application.AppMessage.ShowMessage(string.Format("{0} is created.", doc.DocNo));
}
catch (BCE.Application.AppException ex)
{
//BCE.Application.AppMessage.ShowMessage(ex.Message);
//log error
}
}
private void AddARPaymentDetail(ARPaymentDetailSource source, Func<BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity> addPaymentDetail)
{
BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity dtl = addPaymentDetail();
dtl.PaymentMethod = source.PaymentMethod;
dtl.ChequeNo = source.ChequeNo;
dtl.PaymentAmt = source.PaymentAmount;
dtl.BankCharge = source.BankCharge;
dtl.BankChargeTaxType = source.BankChargeTaxCode;
dtl.BankChargeTaxRefNo = source.BankChargeBillNoForGst;
dtl.PaymentBy = source.PaymentBy;
if (source.ReturnChequeDate.HasValue)
{
dtl.IsRCHQ = true;
dtl.RCHQDate = source.ReturnChequeDate.Value;
}
}
public class ARPaymentSource
{
public string DebtorCode { get; set; }
public string DocumentNo { get; set; }
public string ReceiptNo2 { get; set; }
public DateTime DocumentDate { get; set; } = DateTime.Today.Date;
public string Description { get; set; }
public string DepositMethod { get; set; }
//When not defined (null), system will apply the Debtor Account's default currency code
public string PaymentCurrencyCode { get; set; }
public decimal? PaymentToHomeCurrencyRate { get; set; }
public decimal? PaymentToDebtorCurrencyRate { get; set; }
public string Project { get; set; }
public string Department { get; set; }
public List<ARPaymentDetailSource> PaymentDetail = new List<ARPaymentDetailSource>();
public List<ARPaymentKnockoff> PaymentKnockoff = new List<ARPaymentKnockoff>();
}
public class ARPaymentDetailSource
{
public string PaymentMethod { get; set; }
public string ChequeNo { get; set; }
public decimal PaymentAmount { 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; }
}
public class ARPaymentKnockoff
{
public const string ARInvoiceDocType = BCE.AutoCount.Document.DocumentType.ARInvoice;
public const string ARDebitNoteDocType = BCE.AutoCount.Document.DocumentType.ARDN;
public string DocType { get; set; }
public string DocNo { get; set; }
public decimal Amount { get; set; }
public BCE.Data.DBDateTime DBDate { get; set; } = DBNull.Value;
}