AR Received Payment: Difference between revisions

no edit summary
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1:
==Technical Specification==
==Rules in AR Payment==
# Payment '''Knockoff Date''' must be equal or 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 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 23 ⟶ 17:
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity doc = cmd.NewARPayment();
 
//If you want to set your own Payment Voucher number, uncomment the next line, otherwise, the system will use running number.
//If you want to set your own Payment Voucher number, uncomment doc.DocNo, otherwise, the system will use running number.
//doc.DocNo = “RC-0001″;
doc.DebtorCode = "300-A001";
Line 32 ⟶ 27:
paymentDetail.PaymentAmt = 100;
paymentDetail.ChequeNo = "MBB 123456";
 
//Knockoff Invoice
//doc.KnockOff(BCE.AutoCount.Document.DocumentType.ARInvoice, "IV-0001", 100);
 
try
cmd.SaveARPayment(doc, BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
{
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 44 ⟶ 48:
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
BCE.AutoCount.ARAP.ARPayment.ARPaymentEntity doc = cmd.GetARPayment("RC-0001");
 
//If doc (arPayment) is null, doc (arPayment) does not exist in AR Payment;
//Then exit this function
Line 56 ⟶ 61:
}
</syntaxhighlight>
 
===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===
<syntaxhighlight lang="csharp">
Line 73 ⟶ 71:
</syntaxhighlight>
 
===Delete===
 
==Sample Code with Data for Testing==
This sample code provides the example of creating new AR Payment with tested data.
 
===Home currency only sample===
====Test Data Result Screenshot====
[[File:ProgrammerNewARPayment1.PNG|link=]]
====Test Data====
<syntaxhighlight lang="csharp">
publicprivate void MainEntryDeleteARPayment(BCE.Data.DBSetting dbSetting)
{
BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess cmd = BCE.AutoCount.ARAP.ARPayment.ARPaymentDataAccess.Create(dbSetting);
ARPaymentSource source = new ARPaymentSource()
cmd.DeleteARPayment("RC-0001", BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(dbSetting).LoginUserID);
{
//Home Currency Debtor, payment with home currency
DebtorCode = "300-A001",
Description = "Payment Received",
DocumentDate = new DateTime(2017, 12, 20),
};
 
source.PaymentDetail.Add(new ARPaymentDetailSource()
{
PaymentMethod = "BANK",
ChequeNo = "CHQ00012",
PaymentAmount = 100,
BankCharge = 0.50M
});
 
//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>
----
===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.
 
===Knockoff===
[[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">
doc.KnockOff(knockoff.DocType, knockoff.DocNo, knockoff.Amount, knockoff.Date.Value);
public void MainEntry(BCE.Data.DBSetting dbSetting)
</syntaxhighlight>
{
See [[AR Received Payment#Create New ARPayment|Example of ARPayment Knockoff]]
ARPaymentSource source = new ARPaymentSource()
<br /><br />
{
//Singapore customer, payment in Singapore Dollar
DebtorCode = "300-S001",
Description = "Payment Received - Test Data",
DocumentDate = new DateTime(2017, 12, 21),
 
==Sample Code with Data for Testing==
//If Payment Currency is same as Debtor Currency,
This sample code provides the example of creating new AR Payment with tested data.
//"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>
 
===Source Data (Example for reference Only)===
'''Source Data''' is theimplemented to sourcehold data that is implemented to updatebe dataupdated tointo AutoCount Accounting.
The Source Data designed here is for reference only.
You may either create your own data source, or read from your database and assign value to transaction/document of AutoCount Accounting without source data.
Line 204 ⟶ 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 239 ⟶ 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 307 ⟶ 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]]
//Document type is required for document knockoff
* [[AR Deposit - Create New or Update with Refund & Forfeit]]
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]]