AR Received Payment: Difference between revisions

no edit summary
mNo edit summary
No edit summary
 
(24 intermediate revisions by the same user not shown)
Line 1:
==Technical Specification==
{{NavigateDeveloper}}
# Payment '''Knockoff Date''' must be equal or greater than the '''Payment Date'''.
{{Warn|Incomplete (new document flow writing)}}
 
==Rules in AR Payment==
# Payment '''Knockoff Date''' must be greater than the '''Payment Date'''.
# Payment net total must be greater than 0.
# Payment net total must be the sum of Payment Amount in '''Payment Detail'''
Line 9 ⟶ 6:
# '''Payment Method''' is created in ''General Maintenance | '''Payment Method Maintenance'''''.
 
==AssembliesReferences inof AutoCount Accounting version 1.8, 1.9==
{{BaseReferenceAC18}}
<pre>
'''BCE.AutoCount.ARAP.dll'''
BCE.AutoCount.CommonAccounting.dll
BCE.AutoCount.MainEntry.dll
BCE.Utils.dll
BCE.Utils.UI.dll
BCE.AutoCount.ARAP.dll
</pre>
 
==AR Payment API Usage==
Line 24 ⟶ 15:
public void NewARPayment(BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDAcmd = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity arPaymentdoc = arPaymentDAcmd.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 doc.DocNo, otherwise, the system will use running number.
// arPayment.DocNo = “TEST-0001″;
arPayment//doc.DebtorCodeDocNo = "300“RC-A001"0001″;
doc.DebtorCode = "300-A001";
 
// Add one payment detail
BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity arPaymentDetailpaymentDetail = arPaymentdoc.NewDetail();
arPaymentDetailpaymentDetail.PaymentMethod = "CASH";
arPaymentDetailpaymentDetail.PaymentAmt = 100;
arPaymentDetailpaymentDetail.ChequeNo = "MBB 123456";
 
arPayment.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, "TEST - 0001", 100);
//Knockoff Invoice
arPaymentDA.SaveARPayment(arPayment, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
//doc.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, "IV-0001", 100);
 
try
{
cmd.SaveARPayment(doc, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
BCE.Application.AppMessage.ShowMessage($"Success: {doc.DocNo}");
}
catch (BCE.Application.AppException ex)
{
BCE.Application.AppMessage.ShowMessage(ex.Message);
}
}
</syntaxhighlight>
Line 43 ⟶ 46:
public void EditARPayment(BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess arPaymentDAcmd = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity arPaymentdoc = arPaymentDAcmd.GetARPayment("TESTRC-0001");
 
// if arPayment == null, it means the AR Payment is not found.
if//If doc (arPayment) ==is null, doc (arPayment) does not exist in AR Payment;
//Then exit this function
if (doc == null)
return;
 
arPaymentdoc.ClearDetails();
BCE.AutoCount.ARAP.ARPayment.ARPaymentDTLEntity arPaymentDetailpaymentDetail = arPaymentdoc.NewDetail();
arPaymentDetailpaymentDetail.PaymentMethod = "CARD";
arPaymentDetailpaymentDetail.PaymentAmt = 600;
arPaymentDAcmd.SaveARPayment(arPaymentdoc, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
}
</syntaxhighlight>
 
===Delete===
===Cancel===
<syntaxhighlight lang="csharp">
private void CancelARPayment(BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
cmd.CancelARPayment("RC-0001", BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
}
</syntaxhighlight>
 
===Delete===
==Sample Code with Data Model for Testing==
<syntaxhighlight lang="csharp">
In this sample code provide the concept of how to create a new AR Payment with tested data.
private void DeleteARPayment(BCE.Data.DBSetting dbSetting)
===Test Sample Result===
{
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>
 
===Test Sample DataKnockoff===
<syntaxhighlight lang="csharp">
doc.KnockOff(knockoff.DocType, knockoff.DocNo, knockoff.Amount, knockoff.Date.Value);
</syntaxhighlight>
See [[AR Received Payment#Create New ARPayment|Example of ARPayment Knockoff]]
<br /><br />
 
==Sample Code with Data for Testing==
This sample code provides the example of creating new AR Payment with tested data.
 
===Source Data Modal (Example for reference Only)===
'''Source Data''' is theimplemented '''DataModel'''to of your sourcehold data that is implemented to updatebe dataupdated tointo AutoCount Accounting.
The Source DataModalData designed here is for reference only.
You may either create your own data source modal, or read from your database and assign value to transaction/document of AutoCount Accounting without source data modal.
 
<syntaxhighlight lang="csharp">
Line 80 ⟶ 104:
public string Description { get; set; }
public string DepositMethod { get; set; }
 
//PaymentCurrencyCode will be the currency code of Debtor's Account.
//Need to define only when PaymentCurrencyCode is different from Debtor's Account Currency
public string PaymentCurrencyCode { get; set; }
 
//Require PaymentToHomeCurrencyRate,
//when PaymentCurrencyCode is in Foreign Currency
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 string Project { get; set; }
public string Department { get; set; }
Line 104 ⟶ 133:
public string BankChargeBillNoForGst { get; set; }
public string PaymentBy { get; set; }
 
//If this cheque is returned/bounced cheque
//Set the returned/bounced date. Otherwise it is null
Line 139 ⟶ 169:
//Get the login user id
string userID = BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID;
 
//Create command object of ARPayment
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd =
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
 
//Create a new ARPayment transaction
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity doc = cmd.NewARPayment();
Line 147 ⟶ 179:
//Assign value to master table
doc.DebtorCode = source.DebtorCode;
doc.DocNo = source.DocumentNo ?? doc.DocNo;
doc.DocNo2 = source.ReceiptNo2 ?? doc.DocNo2;
doc.DocDate = source.DocumentDate;
doc.CurrencyCode = source.PaymentCurrencyCode ?? doc.CurrencyCode;
Line 207 ⟶ 239:
</syntaxhighlight>
 
===Example of AR Payment in Home currency only===
====Test Data Result Screenshot====
[[File:ProgrammerNewARPayment1.PNG|link=]]
====Test Data====
<syntaxhighlight lang="csharp">
public void MainEntry(BCE.Data.DBSetting dbSetting)
{
ARPaymentSource source = new ARPaymentSource()
{
//Home Currency Debtor, payment with home currency
DebtorCode = "300-A001",
Description = "Payment Received",
DocumentDate = new DateTime(2017, 12, 20),
};
 
source.PaymentDetail.Add(new ARPaymentDetailSource()
==See Also==
{
* [[AR Debtor]]
PaymentMethod = "BANK",
* [[AR Invoice]]
ChequeNo = "CHQ00012",
* [[AR Received Payment]]
PaymentAmount = 100,
* [[AR Debit Note]]
BankCharge = 0.50M
* [[AR Credit Note]]
});
* [[AR Refund]]
* [[AR Deposit]]
* [[AR Deposit - Create New or Update with Refund & Forfeit]]
 
//Document type is required for document knockoff
source.PaymentKnockoff.Add(new PaymentKnockoffSource()
{
DocType = PaymentKnockoffSource.ARInvoiceDocType,
DocNo = "I-000002",
Amount = 70
});
source.PaymentKnockoff.Add(new PaymentKnockoffSource()
{
DocType = PaymentKnockoffSource.ARInvoiceDocType,
DocNo = "I-000003",
Amount = 30
});
 
//Create New ARPayment in AutoCount Accounting
NewARPayment(source, dbSetting);
}
</syntaxhighlight>
----
 
===Example of Foreign Customer and payment in customer currency===
====Test Data Result Screenshot====
[[File:ProgrammerNewARPayment2.PNG|link=]]<br/>
A payment of SGD100.00 knockoff 2 outstanding invoices, which both invoices currency rate is 3.2.
 
[[File:ProgrammerNewARPayment3.PNG|link=]]<br />
AutoCount Accounting auto generate Loss in foreign currency transaction.<br />
This is because the currency rate when invoice was issued is 3.2, whereas the payment currency rate is 3.1.
====Test Data====
<syntaxhighlight lang="csharp">
public void MainEntry(BCE.Data.DBSetting dbSetting)
{
ARPaymentSource source = new ARPaymentSource()
{
//Singapore customer, payment in Singapore Dollar
DebtorCode = "300-S001",
Description = "Payment Received - Test Data",
DocumentDate = new DateTime(2017, 12, 21),
 
//If Payment Currency is same as Debtor Currency,
//"PaymentCurrencyCode" can be excluded
PaymentCurrencyCode = "SGD",
PaymentToHomeCurrencyRate = 3.1M,
};
 
source.PaymentDetail.Add(new ARPaymentDetailSource()
{
PaymentMethod = "BANK",
ChequeNo = "SGB0009",
PaymentAmount = 100, //Currency in SGD
});
 
//Document type is required for document knockoff
source.PaymentKnockoff.Add(new PaymentKnockoffSource()
{
DocType = PaymentKnockoffSource.ARInvoiceDocType,
DocNo = "I-000017",
Amount = 70
});
source.PaymentKnockoff.Add(new PaymentKnockoffSource()
{
DocType = PaymentKnockoffSource.ARInvoiceDocType,
DocNo = "I-000018",
Amount = 30
});
 
NewARPayment(source, dbSetting);
}
</syntaxhighlight>
 
<br />
{{SeeAlsoAPIAccount}}
[[Category:Programmer]]
[[Category:API]]
[[Category:Integrate]]
[[Category:Plug-In]]
{{NavigateDeveloper}}