AR Received Payment: Difference between revisions

Content added Content deleted
mNo edit summary
No edit summary
Line 24: Line 24:
public void NewARPayment(BCE.Data.DBSetting dbSetting)
public void NewARPayment(BCE.Data.DBSetting dbSetting)
{
{
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDA = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity arPayment = arPaymentDA.NewARPayment();
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity doc = cmd.NewARPayment();
// If you want to set your own Payment No, uncomment the next line, otherwise, the system will use automatic running number.
//If you want to set your own Payment Voucher number, uncomment the next line, otherwise, the system will use running number.
// arPayment.DocNo = “TEST-0001″;
//doc.DocNo = “RC-0001″;
arPayment.DebtorCode = "300-A001";
doc.DebtorCode = "300-A001";


// Add one payment detail
// Add one payment detail
BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity arPaymentDetail = arPayment.NewDetail();
BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity paymentDetail = doc.NewDetail();
arPaymentDetail.PaymentMethod = "CASH";
paymentDetail.PaymentMethod = "CASH";
arPaymentDetail.PaymentAmt = 100;
paymentDetail.PaymentAmt = 100;
arPaymentDetail.ChequeNo = "MBB 123456";
paymentDetail.ChequeNo = "MBB 123456";
//Knockoff Invoice
arPayment.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, "TEST - 0001", 100);
doc.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, "IV-0001", 100);
arPaymentDA.SaveARPayment(arPayment, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);

cmd.SaveARPayment(doc, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
}
}
</syntaxhighlight>
</syntaxhighlight>
Line 43: Line 45:
public void EditARPayment(BCE.Data.DBSetting dbSetting)
public void EditARPayment(BCE.Data.DBSetting dbSetting)
{
{
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDA = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity arPayment = arPaymentDA.GetARPayment("TEST-0001");
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity doc = cmd.GetARPayment("RC-0001");
// if arPayment == null, it means the AR Payment is not found.
//If doc (arPayment) is null, doc (arPayment) does not exist in AR Payment;
//Then exit this function
if (arPayment == null)
if (doc == null)
return;
return;


arPayment.ClearDetails();
doc.ClearDetails();
BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity arPaymentDetail = arPayment.NewDetail();
BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity paymentDetail = doc.NewDetail();
arPaymentDetail.PaymentMethod = "CARD";
paymentDetail.PaymentMethod = "CARD";
arPaymentDetail.PaymentAmt = 600;
paymentDetail.PaymentAmt = 600;
arPaymentDA.SaveARPayment(arPayment, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
cmd.SaveARPayment(doc, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
}
}
</syntaxhighlight>
</syntaxhighlight>
===Delete===
===Delete===
<syntaxhighlight lang="csharp">
private void DeleteARPayment(BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
cmd.DeleteARPayment("RC-0001", BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
}
</syntaxhighlight>
===Cancel===
===Cancel===
<syntaxhighlight lang="csharp">

</syntaxhighlight>



==Sample Code with Data Model for Testing==
==Sample Code with Data Model for Testing==
Line 80: Line 94:
public string Description { get; set; }
public string Description { get; set; }
public string DepositMethod { get; set; }
public string DepositMethod { get; set; }

//PaymentCurrencyCode will be the currency code of Debtor's Account.
//PaymentCurrencyCode will be the currency code of Debtor's Account.
//Need to define only when PaymentCurrencyCode is different from Debtor's Account Currency
//Need to define only when PaymentCurrencyCode is different from Debtor's Account Currency
public string PaymentCurrencyCode { get; set; }
public string PaymentCurrencyCode { get; set; }

//Require PaymentToHomeCurrencyRate,
//Require PaymentToHomeCurrencyRate,
//when PaymentCurrencyCode is in Foreign Currency
//when PaymentCurrencyCode is in Foreign Currency
public decimal? PaymentToHomeCurrencyRate { get; set; }
public decimal? PaymentToHomeCurrencyRate { get; set; }

//Require PaymentToDebtorCurrencyRate, when PaymentCurrencyCode is different from Debtor CurrencyCode
//Require PaymentToDebtorCurrencyRate,
//when PaymentCurrencyCode is different from Debtor CurrencyCode
public decimal? PaymentToDebtorCurrencyRate { get; set; }
public decimal? PaymentToDebtorCurrencyRate { get; set; }

public string Project { get; set; }
public string Project { get; set; }
public string Department { get; set; }
public string Department { get; set; }