Outstanding AR/AP
Version: 1.2 | Release Date: 07/02/2024
# Scenario
Thanks to the previous campaign, ABC Fruit Company is now one of the most well-known fruit suppliers.
Purchase managers from retail stores can order fruits directly from the online store. Most transactions are done through credit sales.
Purchase managers often inquire about their credit balance to keep track of the payment needed.
The manager of the Sales Department suggested that Chris add a report similar to the Bonus Point.
Chris came up with the following report.
# Refer to the document
To implement this report, Chris used the Get Outstanding AR Invoices.
HTTP Request
GET http://[server]/jsf/rfws/erp/ac/ar/getOsInvoice/{beId}/{uId}/{AIId}/{recregId}/{multiRecId}
Parameters
Name | Type | Description |
---|---|---|
beId | int (Path) | Required. Business entity ID |
uId | int (Path) | Required. User ID |
payRegId | int (Path) | Required. Must input 0 . |
multiPayId | int (Path) | Required. Must input 0 . |
AIId | int (Path) | Required. Debtor ID. ID of the debtor type's records, if debtor type = cus , this field will represent the ID of customer FM. |
AIType | string (Header) | Required. Type of Debtor. Format please refer to request sample, built-in support these types: cus , ven , staff , cnDept , virDept . |
sDate | date (Header) | Required. Transaction Date (From) |
eDate | date (Header) | **Required. **Transaction Date (To) |
sDDate | date (Header) | Required. Due Date (From) |
eDDate | date (Header) | Required. Due Date (To) |
sStaff | string (Header) | Staff Code (From) |
eStaff | string (Header) | Staff Code (To) |
sTranType | string (Header) | Invoice's transaction types. Format please refer to request sample, support types: arIni , arTran and siso . |
loadCrNote | int (Header) | Default is 0 . If 1 , result will include negative AR transactions. |
loadGroupCo | boolean (Header) | Default is false . If true , the result will consider group company data of the customer. |
In this case, AIType
must be cus. AIId
represents the customer’s entity ID. Yes, retrieve the ID using the code again.
The other parameters are straightforward.
Response follows the typical M18 SqlTable style, which maybe confusing to understand. To simplify, please focus only on the values
property.
values:[
{
"tDate":"2017-09-01 00:00:00",
"cpDate":"2017-09-01 00:00:00",
"code":"KC_ART_20170901_001",
"virDeptId":3,
"st_desc":"KC_ART_20170901_001",
"amt":100.0,
"balInvDomAmt":110.0,
"sTranId":396,
"ce01Module":"arTran",
"sTranCode":"KC_ART_20170901_001",
"sTranTypeMess":"arTran",
"curId":1,
"AIType":"cus",
"rate":1.1,
"balAmt":100.0,
"id":396,
"sTranType":"arTran",
"curCode":"R",
"virDeptCode":"SALES01",
"AIId":6,
"invDomAmt":110.0,
"virDeptDesc":"Sales Team 1"
},
{
"tDate":"2017-09-01 00:00:00",
"cpDate":"2017-09-01 00:00:00",
"code":"KC_ART_20170901_002",
"virDeptId":3,
"st_desc":"KC_ART_20170901_002",
"amt":100.0,
"balInvDomAmt":110.0,
"sTranId":397,
"ce01Module":"arTran",
"sTranCode":"KC_ART_20170901_002",
"sTranTypeMess":"arTran",
"curId":1,
"AIType":"cus",
"rate":1.1,
"balAmt":100.0,
"id":397,
"sTranType":"arTran",
"curCode":"R",
"virDeptCode":"SALES01",
},
]
There are two outstanding invoices for this customer.
- KC_ART_20170901_001 with 110 (in domestic currency)
- KC_ART_20170901_002 with 110 (in domestic currency)
With all the above knowledge, we are ready to produce a Credit Balance Report.
Sample request to list Report on Last 60 days
String beId = "19";String uId = "9";
String AIId = "6";
String recregId = "0";
String multiRecId = "0";
String AIType = "cus";
String sDate = "2024-1-15";
String eDate = "2024-3-15";
String sDDate = "1900-01-01";
String eDDate = "9999-12-31";
String sStaff = "";
String eStaff = "";
String loadCrNote = "1";
String sTranType = "arTran";
String loadGroupCo = "false";
String url = "http://" + server + "/jsf/rfws/erp/ac/ar/getOsInvoice/
+ beId + "/"
+ uId + "/"
+ AIId + "/"
+ recregId + "/"
+ multiPayId;"
Request request = new Request.Builder()
.url(url)
.addHeader("client_id", clientID)
.addHeader("authorization", "Bearer " + token)
.addHeader("cache-control", "no-cache")
.addHeader("AIType", AIType)
.addHeader("sDate", sDate)
.addHeader("eDate", eDate)
.addHeader("sDDate", sDDate)
.addHeader("eDDate", eDDate)
.addHeader("sStaff", sStaff)
.addHeader("eStaff", eStaff)
.addHeader("loadCrNote", loadCrNote)
.addHeader("sTranType", sTranType)
.addHeader("loadGroupCo", loadGroupCo)
.build();
OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();
Sample Response
values:[
{
"code": "KC_ART_001",
"tDate": "2024-1-28",
"balInvDomAmt": 2100.00,
},
{
"code": "KC_ART_003",
"tDate": "2024-3-11",
"balInvDomAmt": 100.00,
},
{
"code": "KC_ART_005",
"tDate": "2024-2-18",
"balInvDomAmt": 8641.00,
},
{
"code": "KC_ART_006",
"tDate": "2024-3-15",
"balInvDomAmt": 221.10,
},
]