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
3.3 KiB

<?php
include "T8_Authorization.php";
echo "採購單";
echo "111";
?>
<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/PURPURCHASEORDER/PostERPData';
headerParam = {
CHI_Authorization: `${validation}`,
};
var body = [{
"name": "purBillOrderMaster",
"rows": [{
"BillNo": "Z004",
"BillDate": 20210420,
"TypeId": "PO",
"OrgId": "1000",
"FOrgId": "1000",
"BizPartnerId": "33709933",
"CurrId": "TWD",
"CurrOAmount": 1.00000,
"CurrLAmount": 1.00000,
"PersonId": "M0122",
"DueToId": "33709933",
"TaxId": "ST005",
// "DebtorOrgId": "1000",
// "DebitorCurrId": "TWD",
// "DebtorCurrOAmount": 1.00000,
// "DebtorCurrLAmount": 1.00000,
"CompId": "1001",
// "DebtorCompId": "1001",
"CurrentState": 2,
"FlowState": 2,
"PermitState": 2,
"Remark":"testtest",
"CreatorId": "M0122",
"IsPriceWithTax":1
}]
},
{
"name": "purBillOrderDetail",
"rows": [{
"DemandOrgId": "1000",
"TaxId": "ST005",
"DeliveryDate": 20210420,
"ReceiveOrgId": "1000",
"DebtorOrgId": "1000",
"ReceiveCompId": "1001",
"DemandCompId": "1001",
"BillNo": "Z004",
"RowCode": 1,
"ItemType": 0,
"MaterialId": "MX23010003",
// "MaterialSpec": "LY-08/紅光/1",
"SQuantity": 1.00000,
"PresentSQty":1,
"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>