|
@ -1,29 +1,82 @@ |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
include "T8_Authorization.php"; |
|
|
include "T8_Authorization.php"; |
|
|
|
|
|
echo "ii"; |
|
|
?> |
|
|
?> |
|
|
<script> |
|
|
<script> |
|
|
get_Auth(); |
|
|
get_Auth(); |
|
|
window.addEventListener('message', function(event) { |
|
|
window.addEventListener('message', function(event) { |
|
|
if (event.origin === "http://127.0.0.1" && (typeof event.data === "string")) { |
|
|
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { |
|
|
var validation = event.data; |
|
|
var validation = event.data; |
|
|
console.log("event"); |
|
|
console.log("event"); |
|
|
console.log(validation); |
|
|
console.log(validation); |
|
|
|
|
|
|
|
|
var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
|
|
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; |
|
|
var apiurl = 'http://60.244.87.101:880//twWebAPI/V1/SALSALESORDER/GetERPData?pkValue=T23080088'; |
|
|
var apiurl = 'http://60.244.87.101:880/twWebAPI/V1/APCHECKBILL/PostERPData'; |
|
|
headerParam = { |
|
|
headerParam = { |
|
|
CHI_Authorization: `${validation}`, |
|
|
CHI_Authorization: `${validation}`, |
|
|
}; |
|
|
}; |
|
|
// var json = JSON.stringify(body); |
|
|
var body = [{ |
|
|
|
|
|
"name": "MasterTable", |
|
|
|
|
|
"rows": [{ |
|
|
|
|
|
"BillNo": "Z001", |
|
|
|
|
|
"BillDate": 20230930, |
|
|
|
|
|
"OrgId": "1000", |
|
|
|
|
|
"TypeId": "OPV", |
|
|
|
|
|
"BizPartnerId": "03051501", |
|
|
|
|
|
"CurrId": "RMB", |
|
|
|
|
|
"CurrLAmount":5, |
|
|
|
|
|
"TaxId": "ST005", |
|
|
|
|
|
"PersonId": "M0006", |
|
|
|
|
|
"DeptId": "220", |
|
|
|
|
|
"CompId": "1001", |
|
|
|
|
|
"CreditAgeDate": 20230930, |
|
|
|
|
|
"RecBizPartnerId": "03051501" |
|
|
|
|
|
}] |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"name": "DetailTable", |
|
|
|
|
|
"rows": [{ |
|
|
|
|
|
"BillNo": "Z001", |
|
|
|
|
|
"RowCode": 1, |
|
|
|
|
|
"RowNo": 1, |
|
|
|
|
|
"ItemType": 0, |
|
|
|
|
|
"MaterialId": "MX00000001", |
|
|
|
|
|
"UnitId": "PCS", |
|
|
|
|
|
"MaterialSpec": "", |
|
|
|
|
|
"SQuantity": 10, |
|
|
|
|
|
"SPrice": 141.18, |
|
|
|
|
|
"OAmount": 1344.57, |
|
|
|
|
|
"OTax": 67.23, |
|
|
|
|
|
"OAmountWithTax": 1411.8, |
|
|
|
|
|
"TaxId": "ST005" |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
"BillNo": "Z001", |
|
|
|
|
|
"RowCode": 2, |
|
|
|
|
|
"RowNo": 2, |
|
|
|
|
|
"ItemType": 0, |
|
|
|
|
|
"MaterialId": "MX00000001", |
|
|
|
|
|
"UnitId": "PCS", |
|
|
|
|
|
"MaterialSpec": "", |
|
|
|
|
|
"SQuantity": 15, |
|
|
|
|
|
"SPrice": 141.18, |
|
|
|
|
|
"OAmount": 2016.86, |
|
|
|
|
|
"OTax": 100.84, |
|
|
|
|
|
"OAmountWithTax": 2117.7, |
|
|
|
|
|
"TaxId": "ST005" |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
]; |
|
|
|
|
|
var json = JSON.stringify(body); |
|
|
obj = { |
|
|
obj = { |
|
|
type: 'GET', |
|
|
type: 'POST', |
|
|
url: `${corsurl}${apiurl}`, |
|
|
// url: `${corsurl}${apiurl}`, |
|
|
// url: `${apiurl}`, |
|
|
url: `${apiurl}`, |
|
|
// dataType: 'json', |
|
|
// dataType: 'json', |
|
|
headers: headerParam, |
|
|
headers: headerParam, |
|
|
// data: json, |
|
|
data: json, |
|
|
// dataType: "json", |
|
|
dataType: "json", |
|
|
success: function(res) { |
|
|
success: function(res) { |
|
|
console.log(res.Status); |
|
|
console.log(res.Status); |
|
|
console.log(res.ErrorMsg); |
|
|
console.log(res.ErrorMsg); |
|
|