You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

93 lines
2.5 KiB

<?php
include "T8_Authorization.php";
echo "ii";
?>
<script>
get_Auth();
window.addEventListener('message', function(event) {
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) {
var validation = event.data;
console.log("event");
console.log(validation);
// var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'http://60.244.87.101:880/twWebAPI/V1/APCHECKBILL/PostERPData';
headerParam = {
CHI_Authorization: `${validation}`,
};
var body = [{
"name": "MasterTable",
"rows": [{
"BillNo": "Z003",
"BillDate": 20230930,
"OrgId": "1000",
"TypeId": "OPV",
"BizPartnerId": "03051501",
"CurrId": "RMB",
"CurrOAmount":1,
"CurrLAmount":5,
"TaxId": "ST005",
"PersonId": "M0008",
"DeptId": "220",
"CompId": "1001",
"CreditAgeDate": 20230930,
"RecBizPartnerId": "03051501",
"CreatorId":"M0005",
"IsPriceWithTax":1,
"IsCounteract":1
}]
},
{
"name": "DetailTable",
"rows": [{
"BillNo": "Z003",
"RowCode": 1,
"RowNo": 1,
"ItemType": 0,
"MaterialId": "MX00000001",
"UnitId": "PCS",
"MaterialSpec": "",
"SQuantity": 10,
"SPrice": 105,
"OAmount": 1000,
"OTax": 50,
"OAmountWithTax": 1050,
"TaxId": "ST005"
},
{
"BillNo": "Z003",
"RowCode": 2,
"RowNo": 2,
"ItemType": 0,
"MaterialId": "MX00000001",
"UnitId": "PCS",
"MaterialSpec": "",
"SQuantity": 15,
"SPrice": 210,
"OAmount": 3000,
"OTax": 150,
"OAmountWithTax": 3150,
"TaxId": "ST005"
}
]
}
];
var json = JSON.stringify(body);
obj = {
type: 'POST',
// url: `${corsurl}${apiurl}`,
url: `${apiurl}`,
// dataType: 'json',
headers: headerParam,
data: json,
dataType: "json",
success: function(res) {
console.log(res.Status);
console.log(res.ErrorMsg);
console.log(res.Data);
}
};
jQuery.ajax(obj);
}
})
</script>