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.
 
 
 
 
 
 

103 lines
2.8 KiB

<?php
include "T8_Authorization.php";
echo "ii";
?>
<script>
console.log(<?=$now ?>);
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": "Z004",
"BillDate": 20231030,
"OrgId": "1000",
"TypeId": "OPV",
"IsPriceWithTax":1,
"IsCounteract":1,
"BizPartnerId": "03051501",
"CurrId": "RMB",
"CurrOAmount":1,
"CurrLAmount":4,
"TaxId": "ST101",
"PersonId": "M0012",
"DeptId": "220",
"CompId": "1001",
"CreditAgeDate": 20230930,
"RecBizPartnerId": "03051501"
}]
},
{
"name": "DetailTable",
"rows": [{
"BillNo": "Z004",
"RowCode": 1,
"RowNo": 1,
"ItemType": 0,
"TaxId": "ST101",
"MaterialId": "MX00000001",
"UnitId": "PCS",
"MaterialSpec": "",
"SQuantity":10,
"SPrice":100,
},
// {
// "BillNo": "Z002",
// "RowCode": 2,
// "RowNo": 2,
// "ItemType": 0,
// "MaterialId": "MX00000001",
// "UnitId": "PCS",
// "MaterialSpec": "",
// "SQuantity": 15,
// // "SPrice": 210,
// "OAmountWithTax": 3150,
// // "OTax": 100.84,
// // "OAmountWithTax": 2117.7,
// "TaxId": "ST005"
// }
]
}
// ,
// {
// "name":"apCheckBillInvInfo",
// "rows":[{
// "BillNo":"Z003",
// "RowCode":1,
// "RowNo":1,
// "InvoiceNo":"ap12345678",
// "InvoiceId":25,
// "TaxId":"ST005",
// "LAmountWithTax":105
// }]
// }
];
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>