4 changed files with 152 additions and 98 deletions
@ -1,38 +1,77 @@ |
|||||
<?php |
<?php |
||||
require_once("../connt8.php"); |
$now = gmdate("YmdHis"); |
||||
|
$data = 'M0000.' . $now; |
||||
|
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false); |
||||
|
?> |
||||
|
|
||||
try { |
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script> |
||||
$contractno = 'M0225202300'; |
<script> |
||||
$user_id = 'M0225'; |
var body = [{ |
||||
// $sql = "INSERT INTO comBusinessPartner (BizPartnerId,TaxNo,CreatorId) VALUES('M0225202301','0923373895','$userid')"; |
"name": "salIncomeApplyMaster", |
||||
// $stmt = $connT8->prepare($sql); |
"rows": [{ |
||||
// $stmt->execute(); |
"BillNo": "Z001", |
||||
|
"BillDate": 20160811, |
||||
|
"OrgId": "1000", |
||||
|
"FOrgId": "1000", |
||||
|
"TypeId": "RR", |
||||
|
"BpOrgId": "1000", |
||||
|
"BizPartnerId": "C002", |
||||
|
"CurrId": "RMB", |
||||
|
"CurrOAmount": 1, |
||||
|
"CurrLAmount": 1, |
||||
|
"PersonId": "T001", |
||||
|
"DtOrgId": "1000", |
||||
|
"DueToId": "C002", |
||||
|
"TaxId": "123", |
||||
|
"CompId": "1000" |
||||
|
}] |
||||
|
}, |
||||
|
{ |
||||
|
"name": "salIncomeApplyDetail", |
||||
|
"rows": [{ |
||||
|
"BillNo": "Z001", |
||||
|
"IncomeId": "F203", |
||||
|
"TaxId": "ST003", |
||||
|
"RowCode": 1, |
||||
|
"ItemType": "1", |
||||
|
"SPrice": 50, |
||||
|
"SQuantity": 1, |
||||
|
"FromSourceTag": 0, |
||||
|
"FromBillNo": "123" |
||||
|
}] |
||||
|
} |
||||
|
] |
||||
|
|
||||
$sql = "UPDATE comBusinessPartner SET WorkTelNo = '' WHERE BizPartnerId= 'M0225202301'"; |
var json = JSON.stringify(body); |
||||
$stmt = $connT8->prepare($sql); |
console.log(json); |
||||
$stmt->execute(); |
// obj = { |
||||
|
// type: 'POST', |
||||
echo 'Success'; |
// // url: `${corsurl}${apiurl}`, |
||||
} catch (PDOException $e) { |
// url: `${apiurl}`, |
||||
echo '<script>alert("更新失敗")</script>'; |
// dataType: 'json', |
||||
} |
// headers: headerParam, |
||||
// $sql = "SELECT * FROM comCustomer WHERE BizPartnerId = :BizPartnerId"; |
// data: json, |
||||
// $stmt = $conn->prepare($sql); |
// // dataType: "json", |
||||
// $stmt->bindParam(':BizPartnerId', $contractno); |
// success: function(res) { |
||||
// $stmt->execute(); |
// console.log(res.Status); |
||||
// $result = $stmt->fetch(PDO::FETCH_NUM); |
// console.log(res.ErrorMsg); |
||||
// $arr = array(); |
// console.log(res.Data); |
||||
// if (!empty($result)) { |
// } |
||||
// foreach ($result as $key => $value) { |
// }; |
||||
// $arr[$key] = $value; |
// jQuery.ajax(obj); |
||||
// } |
// // } |
||||
// } |
// }) |
||||
// $count = empty($result) == '' ? 0 : COUNT($result); |
$.ajax({ |
||||
// echo '<pre>'; |
url: 'https://127.0.0.1:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData', |
||||
// print_r($result); |
method: 'POST', |
||||
// echo '</pre>'; |
dataType: 'json', |
||||
// echo '<br/>'; |
// headers: headerParam, |
||||
|
data: body, |
||||
// $createTime = Date('Y-m-sH-i-s'); |
success: function(res) { |
||||
|
console.log('Success'); |
||||
// echo str_replace('-', '', $createTime); |
}, |
||||
|
error: function(err) { |
||||
|
console.log(err); |
||||
|
} |
||||
|
}) |
||||
|
</script> |
Loading…
Reference in new issue