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.
 
 
 
 
 
 

89 lines
2.5 KiB

<?php
include "T8_Authorization.php";
echo "收貨申請單";
?>
<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/PURRECEIVINGORDER/PostERPData';
headerParam = {
CHI_Authorization: `${validation}`,
};
var body = [
{
"name": "purReceivingOrderMaster",
"rows": [
{
"BillNo": "Z003",
"BillDate": 20210420,
"ReceiveOrgId": "1000",
"OrgId": "1000",
"DemandOrgId": "1000",
"TypeId": "MA",
"FromSourceTag":"PO",
"FromTransId":"Z003",
// "BizPartnerId": "16547907",
// "PersonId": "M0122",
// "CurrId": "TWD",
// "CurrOAmount": 1,
// "CurrLAmount": 1,
// "ReciveDate": 20210420,
// "DueToId": "Z001",
// "TaxId": "ST005",
// "DebtorOrgId": "1000",
// "DebtorCurrOAmount": 1,
// "DebtorCurrLAmount": 1,
// "ReceiveCompId": "1000",
// "DebtorCompId": "1000",
// "DemandCompId": "1000",
"InStoreState":2,
"CurrentState":2
}
]
},
{
"name": "purReceivingOrderDetail",
"rows": [
{
// "TaxId": "ST005",
"FromSourceTag":"PO",
"FromBillNo":"Z003",
"BillNo": "Z002",
"RowCode": "1",
"ItemType": 0,
"MaterialId": "MX01030018",
"ReceivingSQty": 1,
// "SUnitId": "SET",
"SPrice": "100"
}
]
}
]
;
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>