Difference between revisions of "AOTG API: Create AR Invoice"

From AutoCount Resource Center
Jump to navigation Jump to search
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
==<DRAFT>==
 
Incompleted!
 
<br/><br/>
 
 
 
 
==Create AR Invoice==
 
==Create AR Invoice==
 
Add a new AR Invoice to account book
 
Add a new AR Invoice to account book
Line 25: Line 20:
 
url = "http://aotg.cloud:8080/api/public/v1/ARInvoice/CreateARInvoice"
 
url = "http://aotg.cloud:8080/api/public/v1/ARInvoice/CreateARInvoice"
   
payload = "{\r\n \"DebtorCode\": \"300-A001\",\r\n \"Description\": \"AOTG IMPORT TEST A\",\r\n \"DocDate\": \"01-01-2019\",\r\n \"DocNo\": \"AOTG007\",\r\n \"JournalType\": \"SALES\",\r\n \"RefNo2\": \"AOTG Web API\",\r\n \"InclusiveTax\": true,\r\n \"Agent\": \"TOM\",\r\n \"CreditTerm\": \"Net 30 days\",\r\n \"CurrencyCode\": \"MYR\",\r\n \"DetailsLine\": [\r\n {\r\n \"LineState\": 0,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 1\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 350\r\n },\r\n {\r\n \"LineState\": 1,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 2\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 5\r\n }\r\n ]\r\n}"
+
payload = "{\r\n \"DebtorCode\": \"300-A001\",\r\n \"Description\": \"AOTG IMPORT TEST A\",\r\n \"DocDate\": \"01-01-2019\",\r\n \"DocNo\": \"AOTG007\",\r\n \"JournalType\": \"SALES\",\r\n \"RefNo2\": \"AOTG Web API\",\r\n \"InclusiveTax\": true,\r\n \"Agent\": \"TOM\",\r\n \"CreditTerm\": \"Net 30 days\",\r\n \"CurrencyCode\": \"MYR\",\r\n \"DetailsLine\": [\r\n {\r\n \"LineState\": 0,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 1\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 350\r\n },\r\n {\r\n \"LineState\": 0,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 2\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 5\r\n }\r\n ]\r\n}"
 
headers = {
 
headers = {
 
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
 
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
Line 70: Line 65:
 
},
 
},
 
{
 
{
"LineState": 1,
+
"LineState": 0,
 
"AccNo": "500-0000",
 
"AccNo": "500-0000",
 
"Description": "AOTG Sales Detail 2",
 
"Description": "AOTG Sales Detail 2",
Line 94: Line 89:
 
request.AddHeader("Content-Type", "application/json");
 
request.AddHeader("Content-Type", "application/json");
 
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
 
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
request.AddParameter("undefined", "{\r\n \"DebtorCode\": \"300-A001\",\r\n \"Description\": \"AOTG IMPORT TEST A\",\r\n \"DocDate\": \"01-01-2019\",\r\n \"DocNo\": \"AOTG007\",\r\n \"JournalType\": \"SALES\",\r\n \"RefNo2\": \"AOTG Web API\",\r\n \"InclusiveTax\": true,\r\n \"Agent\": \"TOM\",\r\n \"CreditTerm\": \"Net 30 days\",\r\n \"CurrencyCode\": \"MYR\",\r\n \"DetailsLine\": [\r\n {\r\n \"LineState\": 0,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 1\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 350\r\n },\r\n {\r\n \"LineState\": 1,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 2\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 5\r\n }\r\n ]\r\n}", ParameterType.RequestBody);
+
request.AddParameter("undefined", "{\r\n \"DebtorCode\": \"300-A001\",\r\n \"Description\": \"AOTG IMPORT TEST A\",\r\n \"DocDate\": \"01-01-2019\",\r\n \"DocNo\": \"AOTG007\",\r\n \"JournalType\": \"SALES\",\r\n \"RefNo2\": \"AOTG Web API\",\r\n \"InclusiveTax\": true,\r\n \"Agent\": \"TOM\",\r\n \"CreditTerm\": \"Net 30 days\",\r\n \"CurrencyCode\": \"MYR\",\r\n \"DetailsLine\": [\r\n {\r\n \"LineState\": 0,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 1\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 350\r\n },\r\n {\r\n \"LineState\": 0,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 2\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 5\r\n }\r\n ]\r\n}", ParameterType.RequestBody);
 
IRestResponse response = client.Execute(request);
 
IRestResponse response = client.Execute(request);
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 112: Line 107:
 
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 
CURLOPT_CUSTOMREQUEST => "POST",
 
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\r\n \"DebtorCode\": \"300-A001\",\r\n \"Description\": \"AOTG IMPORT TEST A\",\r\n \"DocDate\": \"01-01-2019\",\r\n \"DocNo\": \"AOTG007\",\r\n \"JournalType\": \"SALES\",\r\n \"RefNo2\": \"AOTG Web API\",\r\n \"InclusiveTax\": true,\r\n \"Agent\": \"TOM\",\r\n \"CreditTerm\": \"Net 30 days\",\r\n \"CurrencyCode\": \"MYR\",\r\n \"DetailsLine\": [\r\n {\r\n \"LineState\": 0,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 1\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 350\r\n },\r\n {\r\n \"LineState\": 1,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 2\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 5\r\n }\r\n ]\r\n}",
+
CURLOPT_POSTFIELDS => "{\r\n \"DebtorCode\": \"300-A001\",\r\n \"Description\": \"AOTG IMPORT TEST A\",\r\n \"DocDate\": \"01-01-2019\",\r\n \"DocNo\": \"AOTG007\",\r\n \"JournalType\": \"SALES\",\r\n \"RefNo2\": \"AOTG Web API\",\r\n \"InclusiveTax\": true,\r\n \"Agent\": \"TOM\",\r\n \"CreditTerm\": \"Net 30 days\",\r\n \"CurrencyCode\": \"MYR\",\r\n \"DetailsLine\": [\r\n {\r\n \"LineState\": 0,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 1\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 350\r\n },\r\n {\r\n \"LineState\": 0,\r\n \"AccNo\": \"500-0000\",\r\n \"Description\": \"AOTG Sales Detail 2\",\r\n \"Tax\": \"S-10\",\r\n \"Amount\": 5\r\n }\r\n ]\r\n}",
 
CURLOPT_HTTPHEADER => array(
 
CURLOPT_HTTPHEADER => array(
 
"Content-Type: application/json",
 
"Content-Type: application/json",
Line 238: Line 233:
 
}}
 
}}
   
====Response====
+
====Response Status====
  +
{{AOTGResponseStatus|"def14c1a-cdb5-4aa4-834d-0b9c1faa1532"}}
200 OK
 
=====Completed status=====
 
*'''Completed''' status Indicates that the Create AR Invoice request has been performed and succeeded.
 
<syntaxhighlight lang="json-object">
 
{
 
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
 
"Status": "Completed"
 
}
 
</syntaxhighlight>
 
=====Failed status=====
 
*'''Failed''' status Indicates that the Create AR Invoice request has been performed but has error.
 
<syntaxhighlight lang="json-object">
 
{
 
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
 
"Status": "Failed"
 
}
 
</syntaxhighlight>
 
   
 
<br/>
 
<br/>
  +
 
==Use RESULT method to get the failed reason of Create Debtor request==
 
==Use RESULT method to get the failed reason of Create Debtor request==
 
===Code Snippets===
 
===Code Snippets===
Line 263: Line 243:
 
|Python=
 
|Python=
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
  +
import requests
  +
  +
url = "http://aotg.cloud:8080/api/public/v1/Result/CreateARInvoice/def14c1a-cdb5-4aa4-834d-0b9c1faa1532/result"
  +
  +
payload = ""
  +
headers = {
  +
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
  +
'cache-control': "no-cache"
  +
}
  +
  +
response = requests.request("GET", url, data=payload, headers=headers)
  +
  +
print(response.text)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
|PHPHttp=
 
|PHPHttp=
 
<syntaxhighlight lang="PHP">
 
<syntaxhighlight lang="PHP">
  +
<?php
  +
  +
$request = new HttpRequest();
  +
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Result/CreateARInvoice/def14c1a-cdb5-4aa4-834d-0b9c1faa1532/result');
  +
$request->setMethod(HTTP_METH_GET);
  +
  +
$request->setHeaders(array(
  +
'cache-control' => 'no-cache',
  +
'SOTC_AUTH' => 'SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d'
  +
));
  +
  +
try {
  +
$response = $request->send();
  +
  +
echo $response->getBody();
  +
} catch (HttpException $ex) {
  +
echo $ex;
  +
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
|RestSharp=
 
|RestSharp=
 
<syntaxhighlight lang="C#">
 
<syntaxhighlight lang="C#">
  +
var client = new RestClient("http://aotg.cloud:8080/api/public/v1/Result/CreateARInvoice/def14c1a-cdb5-4aa4-834d-0b9c1faa1532/result");
  +
var request = new RestRequest(Method.GET);
  +
request.AddHeader("cache-control", "no-cache");
  +
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
  +
IRestResponse response = client.Execute(request);
 
</syntaxhighlight>
 
</syntaxhighlight>
 
|PHPcURL=
 
|PHPcURL=
 
<syntaxhighlight lang="PHP">
 
<syntaxhighlight lang="PHP">
  +
<?php
  +
  +
$curl = curl_init();
  +
  +
curl_setopt_array($curl, array(
  +
CURLOPT_PORT => "8080",
  +
CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/Result/CreateARInvoice/def14c1a-cdb5-4aa4-834d-0b9c1faa1532/result",
  +
CURLOPT_RETURNTRANSFER => true,
  +
CURLOPT_ENCODING => "",
  +
CURLOPT_MAXREDIRS => 10,
  +
CURLOPT_TIMEOUT => 30,
  +
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  +
CURLOPT_CUSTOMREQUEST => "GET",
  +
CURLOPT_POSTFIELDS => "",
  +
CURLOPT_HTTPHEADER => array(
  +
"SOTC_AUTH: SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
  +
"cache-control: no-cache"
  +
),
  +
));
  +
  +
$response = curl_exec($curl);
  +
$err = curl_error($curl);
  +
  +
curl_close($curl);
  +
  +
if ($err) {
  +
echo "cURL Error #:" . $err;
  +
} else {
  +
echo $response;
  +
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
}}
 
}}
Line 277: Line 323:
 
====Response Successful from HTTP RESULT====
 
====Response Successful from HTTP RESULT====
 
200 OK
 
200 OK
====Result of Failed reason====
+
====Example Result of Failed reason====
 
=====Debtor record not found=====
 
=====Debtor record not found=====
 
<tabber>
 
<tabber>
Line 283: Line 329:
 
<syntaxhighlight lang="json-object">
 
<syntaxhighlight lang="json-object">
 
{
 
{
"RequestId": "252dacee-59dd-4ac1-85eb-450fc71ef78d",
+
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
 
"RequestName": "CreateARInvoice",
 
"RequestName": "CreateARInvoice",
 
"HostName": "---",
 
"HostName": "---",
Line 313: Line 359:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
</tabber>
 
</tabber>
  +
=====Transaction date 02/05/2020 is not in the maintained Fiscal Year Range...=====
=====Debtor record not found=====
 
 
<tabber>
 
<tabber>
 
Body=
 
Body=
 
<syntaxhighlight lang="json-object">
 
<syntaxhighlight lang="json-object">
 
{
 
{
"RequestId": "252dacee-59dd-4ac1-85eb-450fc71ef78d",
+
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
 
"RequestName": "CreateARInvoice",
 
"RequestName": "CreateARInvoice",
 
"HostName": "---",
 
"HostName": "---",
 
"IPAddress": "---",
 
"IPAddress": "---",
 
"RequestTypeName": null,
 
"RequestTypeName": null,
"ResultJson": "{\"Message\":\"Debtor record not found (AccNo=300-T001).\",\"StackTrace\":\" at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\\r\\n at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\\r\\n at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()\",\"Source\":\"PSW.SOTC.Accounting.Provider.Autocount\"}",
+
"ResultJson": "{\"Message\":\"Transaction date 02/05/2020 is not in the maintained Fiscal Year Range (01/01/2018 to 31/12/2019), if you want to enter transaction date outside the Fiscal Year Range, please go to Tools | Manage Fiscal Year to add new Fiscal Year.\",\"StackTrace\":\" at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\\r\\n at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\\r\\n at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()\",\"Source\":\"PSW.SOTC.Accounting.Provider.Autocount\"}",
 
"RequestParamJson": null,
 
"RequestParamJson": null,
 
"ResultStream": null,
 
"ResultStream": null,
Line 331: Line 377:
 
"AccountBookInfo": "Plug-In 1.9 Test-1.0.9.77",
 
"AccountBookInfo": "Plug-In 1.9 Test-1.0.9.77",
 
"AccountBookDBInfo": "1.0.9.77",
 
"AccountBookDBInfo": "1.0.9.77",
"Timestamp": "2019-03-04T09:03:28.4764315Z",
+
"Timestamp": "2019-03-04T09:35:04.2202143Z",
 
"ResultedTimestamp": null,
 
"ResultedTimestamp": null,
"ProcessingInterval": 0.4542032,
+
"ProcessingInterval": 0.76946949999999992,
 
"InQueueInterval": null,
 
"InQueueInterval": null,
 
"ResultFileURL": null
 
"ResultFileURL": null
Line 342: Line 388:
 
<syntaxhighlight lang="json-object">
 
<syntaxhighlight lang="json-object">
 
{
 
{
  +
"Message": "Transaction date 02/05/2020 is not in the maintained Fiscal Year Range (01/01/2018 to 31/12/2019), if you want to enter transaction date outside the Fiscal Year Range, please go to Tools | Manage Fiscal Year to add new Fiscal Year.",
"Message": "Debtor record not found (AccNo=300-T001).",
 
 
"StackTrace": " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)rn at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)rn at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()",
 
"StackTrace": " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)rn at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)rn at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()",
 
"Source": "PSW.SOTC.Accounting.Provider.Autocount"
 
"Source": "PSW.SOTC.Accounting.Provider.Autocount"
Line 349: Line 395:
 
</tabber>
 
</tabber>
   
  +
=====Unknown Sql Exception...=====
 
  +
'''Unknonw Sql Exception''' is a general sql error. Therefore, the solution can be varied.<br/>
  +
One of the reason this error was thrown is when "CurrencyCode" is not included in the json.<br/>
  +
Below error was fixed after adding '''"CurrencyCode": "MYR"'''.
  +
<tabber>
  +
Body=
  +
<syntaxhighlight lang="json-object">
 
{
 
{
"RequestId": "e6600918-8d9b-4708-9513-c510601efa14",
+
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
 
"RequestName": "CreateARInvoice",
 
"RequestName": "CreateARInvoice",
 
"HostName": "---",
 
"HostName": "---",
 
"IPAddress": "---",
 
"IPAddress": "---",
 
"RequestTypeName": null,
 
"RequestTypeName": null,
"ResultJson": "{\"Message\":\"Transaction date 02/05/2020 is not in the maintained Fiscal Year Range (01/01/2018 to 31/12/2019), if you want to enter transaction date outside the Fiscal Year Range, please go to Tools | Manage Fiscal Year to add new Fiscal Year.\",\"StackTrace\":\" at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\\r\\n at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\\r\\n at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()\",\"Source\":\"PSW.SOTC.Accounting.Provider.Autocount\"}",
+
"ResultJson": "{\"Message\":\"Unknown Sql Exception (Number=8178, Message=The parameterized query '(@p1 nvarchar(4000),@transDate datetime)SELECT A.BankBuyRate, A.' expects the parameter '@p1', which was not supplied.)\",\"StackTrace\":\" at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\\r\\n at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\\r\\n at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()\",\"Source\":\"BCE.Utils\"}",
 
"RequestParamJson": null,
 
"RequestParamJson": null,
 
"ResultStream": null,
 
"ResultStream": null,
Line 364: Line 416:
 
"AccountBookInfo": "Plug-In 1.9 Test-1.0.9.77",
 
"AccountBookInfo": "Plug-In 1.9 Test-1.0.9.77",
 
"AccountBookDBInfo": "1.0.9.77",
 
"AccountBookDBInfo": "1.0.9.77",
"Timestamp": "2019-03-04T09:35:04.2202143Z",
+
"Timestamp": "2019-03-04T07:38:47.2231847Z",
 
"ResultedTimestamp": null,
 
"ResultedTimestamp": null,
"ProcessingInterval": 0.76946949999999992,
+
"ProcessingInterval": 3.1802414,
 
"InQueueInterval": null,
 
"InQueueInterval": null,
 
"ResultFileURL": null
 
"ResultFileURL": null
 
}
 
}
  +
</syntaxhighlight>
  +
|-|
  +
Readable of ResultJson=
  +
<syntaxhighlight lang="json-object">
  +
{
  +
"Message": "Unknown Sql Exception (Number=8178, Message=The parameterized query '(@p1 nvarchar(4000),@transDate datetime)SELECT A.BankBuyRate, A.' expects the parameter '@p1', which was not supplied.)",
  +
"StackTrace": " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)rn at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)rn at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()",
  +
"Source": "BCE.Utils"
  +
}
  +
</syntaxhighlight>
  +
</tabber>
  +
  +
====Result of Successful and Completed====
  +
*'''Id''' in the master data of AR Invoice can be used to retrieve and delete of this AR Invoice.
  +
*:Click ''Readable of ResultJson'' to see the highlight of '''Id'''
  +
*:See [[AOTG API: Get AR Invoice]] to get AR Invoice with '''Id'''
  +
<tabber>
  +
Body=
  +
<syntaxhighlight lang="json-object">
  +
{
  +
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
  +
"RequestName": "CreateARInvoice",
  +
"HostName": "---",
  +
"IPAddress": "---",
  +
"RequestTypeName": "ARInvoice",
  +
"ResultJson": "{\"DebtorCode\":\"300-A001\",\"CompanyName\":\"ABC CUSTOMER\",\"Description\":\"AOTG IMPORT TEST A\",\"DocDate\":\"2019-03-03T00:00:00\",\"JournalType\":\"SALES\",\"DueDate\":\"2019-04-02T00:00:00\",\"DocNo\":\"I-000046\",\"LocalAmount\":0.00,\"TaxableAmount\":322.73,\"OutstandingAmount\":355.00,\"CurrencyCode\":\"MYR\",\"Agent\":\"TOM\",\"SourceType\":\"\",\"SourceKey\":\"\",\"CurrencyRate\":1.000000000000,\"Id\":\"1455\",\"RefNo2\":\"AOTG Web API\",\"CreditTerm\":\"Net 30 days\",\"InclusiveTax\":true,\"Note\":\"\",\"Total\":0.0,\"Amount\":355.00,\"TaxAmount\":32.27,\"DetailsLine\":[{\"Id\":\"1456\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 1\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":350.00,\"TaxRate\":10.000000,\"TaxAmount\":31.82,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":318.18,\"TaxableAmount\":350.00,\"LocalTaxAmount\":31.82,\"LocalSubTotal\":318.18,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":350.00,\"NetAmount\":350.00,\"LocalNetAmount\":350.00},{\"Id\":\"1457\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 2\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":5.00,\"TaxRate\":10.000000,\"TaxAmount\":0.45,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":4.55,\"TaxableAmount\":5.00,\"LocalTaxAmount\":0.45,\"LocalSubTotal\":4.55,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":5.00,\"NetAmount\":5.00,\"LocalNetAmount\":5.00}]}",
  +
"RequestParamJson": null,
  +
"ResultStream": null,
  +
"ResultTypeName": "PSW.SOTC.Accounting.Provider.Models.ARInvoiceEntity",
  +
"Status": "Completed",
  +
"Version": "1.2.19051.12002",
  +
"AccountBookInfo": "Plug-In 1.9 Test;1.0.9.77",
  +
"AccountBookDBInfo": "1.0.9.77",
  +
"Timestamp": "2019-03-05T00:35:51.2088399Z",
  +
"ResultedTimestamp": "2019-03-05T00:35:51.2992057Z",
  +
"ProcessingInterval": 0.922091,
  +
"InQueueInterval": 1.7717965999999998,
  +
"ResultFileURL": null
  +
}
  +
</syntaxhighlight>
  +
|-|
  +
Readable of ResultJson=
  +
<syntaxhighlight lang="json-object" highlight="17">
  +
{
  +
"DebtorCode": "300-A001",
  +
"CompanyName": "ABC CUSTOMER",
  +
"Description": "AOTG IMPORT TEST A",
  +
"DocDate": "2019-03-03T00:00:00",
  +
"JournalType": "SALES",
  +
"DueDate": "2019-04-02T00:00:00",
  +
"DocNo": "I-000046",
  +
"LocalAmount": 0,
  +
"TaxableAmount": 322.73,
  +
"OutstandingAmount": 355,
  +
"CurrencyCode": "MYR",
  +
"Agent": "TOM",
  +
"SourceType": "",
  +
"SourceKey": "",
  +
"CurrencyRate": 1,
  +
"Id": "1455",
  +
"RefNo2": "AOTG Web API",
  +
"CreditTerm": "Net 30 days",
  +
"InclusiveTax": true,
  +
"Note": "",
  +
"Total": 0,
  +
"Amount": 355,
  +
"TaxAmount": 32.27,
  +
"DetailsLine": [
  +
{
  +
"Id": "1456",
  +
"LineState": 0,
  +
"AccNo": "500-0000",
  +
"Description": "AOTG Sales Detail 1",
  +
"Project": "",
  +
"Dept": "",
  +
"Tax": "S-10",
  +
"Amount": 350,
  +
"TaxRate": 10,
  +
"TaxAmount": 31.82,
  +
"TaxAdjustment": 0,
  +
"LocalTaxAdjustment": 0,
  +
"SubTotal": 318.18,
  +
"TaxableAmount": 350,
  +
"LocalTaxAmount": 31.82,
  +
"LocalSubTotal": 318.18,
  +
"ToAccountRate": 1,
  +
"LocalTaxableAmount": 350,
  +
"NetAmount": 350,
  +
"LocalNetAmount": 350
  +
},
  +
{
  +
"Id": "1457",
  +
"LineState": 0,
  +
"AccNo": "500-0000",
  +
"Description": "AOTG Sales Detail 2",
  +
"Project": "",
  +
"Dept": "",
  +
"Tax": "S-10",
  +
"Amount": 5,
  +
"TaxRate": 10,
  +
"TaxAmount": 0.45,
  +
"TaxAdjustment": 0,
  +
"LocalTaxAdjustment": 0,
  +
"SubTotal": 4.55,
  +
"TaxableAmount": 5,
  +
"LocalTaxAmount": 0.45,
  +
"LocalSubTotal": 4.55,
  +
"ToAccountRate": 1,
  +
"LocalTaxableAmount": 5,
  +
"NetAmount": 5,
  +
"LocalNetAmount": 5
  +
}
  +
]
  +
}
  +
</syntaxhighlight>
  +
</tabber>
  +
   
 
<br/>
 
<br/>

Latest revision as of 09:47, 28 March 2019

Create AR Invoice

Add a new AR Invoice to account book

API Method

Http Method: POST
Method: /api/public/v1/ARInvoice/CreateARInvoice
Content-Type: application/json
Parameters: None

API Request Flow

AOTGApiCompleteOrFailFlow.png

  1. Submit CreateARInvoice request to add a new AR Invoice to account book.
  2. Check the successful request status, if the action is Completed or Failed.
  3. To get the failed reason, use RESULT method to retrieve the message of completed or failed.


Code Snippets

  • Add header of "SOTC_AUTH", and assign value of AccessToken.


<?php

$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/ARInvoice/CreateARInvoice');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'Content-Type' => 'application/json',
  'SOTC_AUTH' => 'SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d'
));

$request->setBody('{
  "DebtorCode": "300-A001",
  "Description": "AOTG IMPORT TEST A",
  "DocDate": "01-01-2019",
  "DocNo": "AOTG007",
  "JournalType": "SALES",
  "RefNo2": "AOTG Web API",
  "InclusiveTax": true,
  "Agent": "TOM",
  "CreditTerm": "Net 30 days",
  "CurrencyCode": "MYR",
  "DetailsLine": [
    {
      "LineState": 0,
      "AccNo": "500-0000",
      "Description": "AOTG Sales Detail 1",
      "Tax": "S-10",
      "Amount": 350
    },
    {
      "LineState": 0,
      "AccNo": "500-0000",
      "Description": "AOTG Sales Detail 2",
      "Tax": "S-10",
      "Amount": 5
    }
  ]
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

var client = new RestClient("http://aotg.cloud:8080/api/public/v1/ARInvoice/CreateARInvoice");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
request.AddParameter("undefined", "{\r\n  \"DebtorCode\": \"300-A001\",\r\n  \"Description\": \"AOTG IMPORT TEST A\",\r\n  \"DocDate\": \"01-01-2019\",\r\n  \"DocNo\": \"AOTG007\",\r\n  \"JournalType\": \"SALES\",\r\n  \"RefNo2\": \"AOTG Web API\",\r\n  \"InclusiveTax\": true,\r\n  \"Agent\": \"TOM\",\r\n  \"CreditTerm\": \"Net 30 days\",\r\n  \"CurrencyCode\": \"MYR\",\r\n  \"DetailsLine\": [\r\n    {\r\n      \"LineState\": 0,\r\n      \"AccNo\": \"500-0000\",\r\n      \"Description\": \"AOTG Sales Detail 1\",\r\n      \"Tax\": \"S-10\",\r\n      \"Amount\": 350\r\n    },\r\n    {\r\n      \"LineState\": 0,\r\n      \"AccNo\": \"500-0000\",\r\n      \"Description\": \"AOTG Sales Detail 2\",\r\n      \"Tax\": \"S-10\",\r\n      \"Amount\": 5\r\n    }\r\n  ]\r\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8080",
  CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/ARInvoice/CreateARInvoice",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\r\n  \"DebtorCode\": \"300-A001\",\r\n  \"Description\": \"AOTG IMPORT TEST A\",\r\n  \"DocDate\": \"01-01-2019\",\r\n  \"DocNo\": \"AOTG007\",\r\n  \"JournalType\": \"SALES\",\r\n  \"RefNo2\": \"AOTG Web API\",\r\n  \"InclusiveTax\": true,\r\n  \"Agent\": \"TOM\",\r\n  \"CreditTerm\": \"Net 30 days\",\r\n  \"CurrencyCode\": \"MYR\",\r\n  \"DetailsLine\": [\r\n    {\r\n      \"LineState\": 0,\r\n      \"AccNo\": \"500-0000\",\r\n      \"Description\": \"AOTG Sales Detail 1\",\r\n      \"Tax\": \"S-10\",\r\n      \"Amount\": 350\r\n    },\r\n    {\r\n      \"LineState\": 0,\r\n      \"AccNo\": \"500-0000\",\r\n      \"Description\": \"AOTG Sales Detail 2\",\r\n      \"Tax\": \"S-10\",\r\n      \"Amount\": 5\r\n    }\r\n  ]\r\n}",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json",
    "SOTC_AUTH: SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

import requests

url = "http://aotg.cloud:8080/api/public/v1/ARInvoice/CreateARInvoice"

payload = "{\r\n  \"DebtorCode\": \"300-A001\",\r\n  \"Description\": \"AOTG IMPORT TEST A\",\r\n  \"DocDate\": \"01-01-2019\",\r\n  \"DocNo\": \"AOTG007\",\r\n  \"JournalType\": \"SALES\",\r\n  \"RefNo2\": \"AOTG Web API\",\r\n  \"InclusiveTax\": true,\r\n  \"Agent\": \"TOM\",\r\n  \"CreditTerm\": \"Net 30 days\",\r\n  \"CurrencyCode\": \"MYR\",\r\n  \"DetailsLine\": [\r\n    {\r\n      \"LineState\": 0,\r\n      \"AccNo\": \"500-0000\",\r\n      \"Description\": \"AOTG Sales Detail 1\",\r\n      \"Tax\": \"S-10\",\r\n      \"Amount\": 350\r\n    },\r\n    {\r\n      \"LineState\": 0,\r\n      \"AccNo\": \"500-0000\",\r\n      \"Description\": \"AOTG Sales Detail 2\",\r\n      \"Tax\": \"S-10\",\r\n      \"Amount\": 5\r\n    }\r\n  ]\r\n}"
headers = {
    'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
    'Content-Type': "application/json",
    'cache-control': "no-cache"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)


Response

Response Successful HTTP Request

200 OK

Response Successful Body

  • Id and Name can be used to retrieve the status and reason of the failed status.
{
    "Id": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
    "Name": "CreateARInvoice",
    "StartTimestamp": "2019-03-04T07:43:25.2720622Z",
    "EndTimestamp": "2019-03-04T07:43:25.2720622Z"
}
Tips icons.png AOTG Cloud Server returns successful response when the request has been performed.

But this response does not indicate the status of Create AR Invoice.
Use RESULT method to acquire the status.


Get Status of the Create Debtor

Code Snippets

<?php

$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Result/def14c1a-cdb5-4aa4-834d-0b9c1faa1532');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'SOTC_AUTH' => 'SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

var client = new RestClient("http://aotg.cloud:8080/api/public/v1/Result/def14c1a-cdb5-4aa4-834d-0b9c1faa1532");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
IRestResponse response = client.Execute(request);

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8080",
  CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/Result/def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "SOTC_AUTH: SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

import requests

url = "http://aotg.cloud:8080/api/public/v1/Result/def14c1a-cdb5-4aa4-834d-0b9c1faa1532"

payload = ""
headers = {
    'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
    'cache-control': "no-cache",
    }

response = requests.request("GET", url, data=payload, headers=headers)

print(response.text)


Response Status

4 possible responses from process status.

InQueue status
  • InQueue status Indicates that the requests to AOTG Server is waiting to be processed.
  • Usually this happen when many requests are called to AOTG Web API in within a second.
    Make sure the request in the loop has pause time,
    or use 'batch' method to process multiple records in single request if applicable.
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
"Status": "InQueue"
Processing status
  • Processing status indicates that the request is not complete.
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
"Status": "Processing"
Completed status
  • Completed status Indicates that the request has been performed and succeeded.
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
"Status": "Completed"
Failed status
  • Failed status indicates that the request has been performed but has error.
"RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
"Status": "Failed"


Use RESULT method to get the failed reason of Create Debtor request

Code Snippets

<?php

$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Result/CreateARInvoice/def14c1a-cdb5-4aa4-834d-0b9c1faa1532/result');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'SOTC_AUTH' => 'SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

var client = new RestClient("http://aotg.cloud:8080/api/public/v1/Result/CreateARInvoice/def14c1a-cdb5-4aa4-834d-0b9c1faa1532/result");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
IRestResponse response = client.Execute(request);

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8080",
  CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/Result/CreateARInvoice/def14c1a-cdb5-4aa4-834d-0b9c1faa1532/result",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "SOTC_AUTH: SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

import requests

url = "http://aotg.cloud:8080/api/public/v1/Result/CreateARInvoice/def14c1a-cdb5-4aa4-834d-0b9c1faa1532/result"

payload = ""
headers = {
    'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
    'cache-control': "no-cache"
    }

response = requests.request("GET", url, data=payload, headers=headers)

print(response.text)


Response Successful from HTTP RESULT

200 OK

Example Result of Failed reason

Debtor record not found

{
    "RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
    "RequestName": "CreateARInvoice",
    "HostName": "---",
    "IPAddress": "---",
    "RequestTypeName": null,
    "ResultJson": "{\"Message\":\"Debtor record not found (AccNo=300-T001).\",\"StackTrace\":\"   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\\r\\n   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\\r\\n   at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()\",\"Source\":\"PSW.SOTC.Accounting.Provider.Autocount\"}",
    "RequestParamJson": null,
    "ResultStream": null,
    "ResultTypeName": "PSW.SOTC.Accounting.Provider.Models.ExceptionEntity",
    "Status": "Failed",
    "Version": "1.2.19051.12002",
    "AccountBookInfo": "Plug-In 1.9 Test-1.0.9.77",
    "AccountBookDBInfo": "1.0.9.77",
    "Timestamp": "2019-03-04T09:03:28.4764315Z",
    "ResultedTimestamp": null,
    "ProcessingInterval": 0.4542032,
    "InQueueInterval": null,
    "ResultFileURL": null
}

{
  "Message": "Debtor record not found (AccNo=300-T001).",
  "StackTrace": "   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)rn   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)rn   at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()",
  "Source": "PSW.SOTC.Accounting.Provider.Autocount"
}

Transaction date 02/05/2020 is not in the maintained Fiscal Year Range...

{
    "RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
    "RequestName": "CreateARInvoice",
    "HostName": "---",
    "IPAddress": "---",
    "RequestTypeName": null,
    "ResultJson": "{\"Message\":\"Transaction date 02/05/2020 is not in the maintained Fiscal Year Range (01/01/2018 to 31/12/2019), if you want to enter transaction date outside the Fiscal Year Range, please go to Tools | Manage Fiscal Year to add new Fiscal Year.\",\"StackTrace\":\"   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\\r\\n   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\\r\\n   at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()\",\"Source\":\"PSW.SOTC.Accounting.Provider.Autocount\"}",
    "RequestParamJson": null,
    "ResultStream": null,
    "ResultTypeName": "PSW.SOTC.Accounting.Provider.Models.ExceptionEntity",
    "Status": "Failed",
    "Version": "1.2.19051.12002",
    "AccountBookInfo": "Plug-In 1.9 Test-1.0.9.77",
    "AccountBookDBInfo": "1.0.9.77",
    "Timestamp": "2019-03-04T09:35:04.2202143Z",
    "ResultedTimestamp": null,
    "ProcessingInterval": 0.76946949999999992,
    "InQueueInterval": null,
    "ResultFileURL": null
}

{
  "Message": "Transaction date 02/05/2020 is not in the maintained Fiscal Year Range (01/01/2018 to 31/12/2019), if you want to enter transaction date outside the Fiscal Year Range, please go to Tools | Manage Fiscal Year to add new Fiscal Year.",
  "StackTrace": "   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)rn   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)rn   at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()",
  "Source": "PSW.SOTC.Accounting.Provider.Autocount"
}

Unknown Sql Exception...

Unknonw Sql Exception is a general sql error. Therefore, the solution can be varied.
One of the reason this error was thrown is when "CurrencyCode" is not included in the json.
Below error was fixed after adding "CurrencyCode": "MYR".

{
    "RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
    "RequestName": "CreateARInvoice",
    "HostName": "---",
    "IPAddress": "---",
    "RequestTypeName": null,
    "ResultJson": "{\"Message\":\"Unknown Sql Exception (Number=8178, Message=The parameterized query '(@p1 nvarchar(4000),@transDate datetime)SELECT A.BankBuyRate, A.' expects the parameter '@p1', which was not supplied.)\",\"StackTrace\":\"   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\\r\\n   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)\\r\\n   at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()\",\"Source\":\"BCE.Utils\"}",
    "RequestParamJson": null,
    "ResultStream": null,
    "ResultTypeName": "PSW.SOTC.Accounting.Provider.Models.ExceptionEntity",
    "Status": "Failed",
    "Version": "1.2.19051.12002",
    "AccountBookInfo": "Plug-In 1.9 Test-1.0.9.77",
    "AccountBookDBInfo": "1.0.9.77",
    "Timestamp": "2019-03-04T07:38:47.2231847Z",
    "ResultedTimestamp": null,
    "ProcessingInterval": 3.1802414,
    "InQueueInterval": null,
    "ResultFileURL": null
}

{
  "Message": "Unknown Sql Exception (Number=8178, Message=The parameterized query '(@p1 nvarchar(4000),@transDate datetime)SELECT A.BankBuyRate, A.' expects the parameter '@p1', which was not supplied.)",
  "StackTrace": "   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)rn   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)rn   at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()",
  "Source": "BCE.Utils"
}

Result of Successful and Completed

  • Id in the master data of AR Invoice can be used to retrieve and delete of this AR Invoice.
    Click Readable of ResultJson to see the highlight of Id
    See AOTG API: Get AR Invoice to get AR Invoice with Id

{
    "RequestId": "def14c1a-cdb5-4aa4-834d-0b9c1faa1532",
    "RequestName": "CreateARInvoice",
    "HostName": "---",
    "IPAddress": "---",
    "RequestTypeName": "ARInvoice",
    "ResultJson": "{\"DebtorCode\":\"300-A001\",\"CompanyName\":\"ABC CUSTOMER\",\"Description\":\"AOTG IMPORT TEST A\",\"DocDate\":\"2019-03-03T00:00:00\",\"JournalType\":\"SALES\",\"DueDate\":\"2019-04-02T00:00:00\",\"DocNo\":\"I-000046\",\"LocalAmount\":0.00,\"TaxableAmount\":322.73,\"OutstandingAmount\":355.00,\"CurrencyCode\":\"MYR\",\"Agent\":\"TOM\",\"SourceType\":\"\",\"SourceKey\":\"\",\"CurrencyRate\":1.000000000000,\"Id\":\"1455\",\"RefNo2\":\"AOTG Web API\",\"CreditTerm\":\"Net 30 days\",\"InclusiveTax\":true,\"Note\":\"\",\"Total\":0.0,\"Amount\":355.00,\"TaxAmount\":32.27,\"DetailsLine\":[{\"Id\":\"1456\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 1\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":350.00,\"TaxRate\":10.000000,\"TaxAmount\":31.82,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":318.18,\"TaxableAmount\":350.00,\"LocalTaxAmount\":31.82,\"LocalSubTotal\":318.18,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":350.00,\"NetAmount\":350.00,\"LocalNetAmount\":350.00},{\"Id\":\"1457\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 2\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":5.00,\"TaxRate\":10.000000,\"TaxAmount\":0.45,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":4.55,\"TaxableAmount\":5.00,\"LocalTaxAmount\":0.45,\"LocalSubTotal\":4.55,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":5.00,\"NetAmount\":5.00,\"LocalNetAmount\":5.00}]}",
    "RequestParamJson": null,
    "ResultStream": null,
    "ResultTypeName": "PSW.SOTC.Accounting.Provider.Models.ARInvoiceEntity",
    "Status": "Completed",
    "Version": "1.2.19051.12002",
    "AccountBookInfo": "Plug-In 1.9 Test;1.0.9.77",
    "AccountBookDBInfo": "1.0.9.77",
    "Timestamp": "2019-03-05T00:35:51.2088399Z",
    "ResultedTimestamp": "2019-03-05T00:35:51.2992057Z",
    "ProcessingInterval": 0.922091,
    "InQueueInterval": 1.7717965999999998,
    "ResultFileURL": null
}

{
  "DebtorCode": "300-A001",
  "CompanyName": "ABC CUSTOMER",
  "Description": "AOTG IMPORT TEST A",
  "DocDate": "2019-03-03T00:00:00",
  "JournalType": "SALES",
  "DueDate": "2019-04-02T00:00:00",
  "DocNo": "I-000046",
  "LocalAmount": 0,
  "TaxableAmount": 322.73,
  "OutstandingAmount": 355,
  "CurrencyCode": "MYR",
  "Agent": "TOM",
  "SourceType": "",
  "SourceKey": "",
  "CurrencyRate": 1,
  "Id": "1455",
  "RefNo2": "AOTG Web API",
  "CreditTerm": "Net 30 days",
  "InclusiveTax": true,
  "Note": "",
  "Total": 0,
  "Amount": 355,
  "TaxAmount": 32.27,
  "DetailsLine": [
    {
      "Id": "1456",
      "LineState": 0,
      "AccNo": "500-0000",
      "Description": "AOTG Sales Detail 1",
      "Project": "",
      "Dept": "",
      "Tax": "S-10",
      "Amount": 350,
      "TaxRate": 10,
      "TaxAmount": 31.82,
      "TaxAdjustment": 0,
      "LocalTaxAdjustment": 0,
      "SubTotal": 318.18,
      "TaxableAmount": 350,
      "LocalTaxAmount": 31.82,
      "LocalSubTotal": 318.18,
      "ToAccountRate": 1,
      "LocalTaxableAmount": 350,
      "NetAmount": 350,
      "LocalNetAmount": 350
    },
    {
      "Id": "1457",
      "LineState": 0,
      "AccNo": "500-0000",
      "Description": "AOTG Sales Detail 2",
      "Project": "",
      "Dept": "",
      "Tax": "S-10",
      "Amount": 5,
      "TaxRate": 10,
      "TaxAmount": 0.45,
      "TaxAdjustment": 0,
      "LocalTaxAdjustment": 0,
      "SubTotal": 4.55,
      "TaxableAmount": 5,
      "LocalTaxAmount": 0.45,
      "LocalSubTotal": 4.55,
      "ToAccountRate": 1,
      "LocalTaxableAmount": 5,
      "NetAmount": 5,
      "LocalNetAmount": 5
    }
  ]
}



See Also AOTG API


Go to menu

IconAC81.png Go to top
ProgrammerGo.jpg Resources For AutoCount Software Developers