diff --git a/wms/contract-repair/api/bpmAPI.php b/wms/contract-repair/api/bpmAPI.php index b6b686be..a6d9d76e 100644 --- a/wms/contract-repair/api/bpmAPI.php +++ b/wms/contract-repair/api/bpmAPI.php @@ -1,4 +1,6 @@ execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); // echo '
'; -// print_r(json_encode($result)); +// print_r($result); // echo ''; -return json_encode($result); +echo json_encode($result, JSON_UNESCAPED_UNICODE); diff --git a/wms/contract/api/T8salIncomeApply.php b/wms/contract/api/T8salIncomeApply.php index b0f4e018..96246a7c 100644 --- a/wms/contract/api/T8salIncomeApply.php +++ b/wms/contract/api/T8salIncomeApply.php @@ -39,3 +39,35 @@ function T8API($data) curl_close($ch); } // T8API($data); + +function pending($user_id, $token) +{ + $api_url = 'localhost:3000/wms/frame/api_getdata'; + $data = [ + 'p' => 'pending', + 'token' => $token + ]; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + // curl_setopt($ch, CURLOPT_HTTPHEADER, $header); + curl_setopt($ch, CURLOPT_POST, 1); // 使用 POST + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); + $response = curl_exec($ch); + if ($response === false) { + echo 'Curl error: ' . curl_error($ch); + } else { + $result = json_decode($response, true); + // 若 API 傳入失敗。 + if ($result['Status'] == 'Erroe') { + echo 'API傳入失敗,' . $result['ErrorMsg']; + return $result; + } else { + echo '
'; + print_r($result); + echo ''; + return $result; + } + } +} diff --git a/wms/contract/api/postContractData.php b/wms/contract/api/postContractData.php index 3b00d2a9..d9b9f8b8 100644 --- a/wms/contract/api/postContractData.php +++ b/wms/contract/api/postContractData.php @@ -524,29 +524,34 @@ function T8insert($data, $facilityno) // 分期代碼計算 $IncomeId = [ - 'A40006' => 1, - 'A40007' => 4, - 'A40003' => 12, - 'A40004' => 6, - 'A40005' => 2 + 'A40006' => 1, //年繳 + 'A40007' => 4, //季繳 + 'A40003' => 12, //月繳 + 'A40004' => 6, //雙月繳 + 'A40005' => 2 //半年繳 ]; //分幾期 => 總共保養月 / 分期月 $SQuantity = $elevator['maintain_months'] / $IncomeId[$payType]; // 依每台電梯去加入各個的付款項 - for ($i = 1; $i <= $IncomeId[$payType]; $i++) { + for ($i = 0; $i < $IncomeId[$payType]; $i++) { + // 計算分期款的收款月份 + $paymonth = $i * $SQuantity; + $payday = date('Y-m-d', strtotime("$date_1 + $paymonth months")); + $rows_data = [ "BillNo" => "$contractno", "IncomeId" => "$payType", "TaxId" => "ST005", - "RowCode" => $i, - "RowNo" => $i, + "RowCode" => $i + 1, + "RowNo" => $i + 1, "ItemType" => 1, "SPrice" => $elevator['sold_price'], "SQuantity" => $SQuantity, "ProjectId" => "$contractno", "FromSourceTag" => 0, - "CU_MaterialId" => "$facilityno[$index]" + "CU_MaterialId" => "$facilityno[$index]", + "CU_EstPayDate" => "$payday" ]; $salIncomeApplyDetail_rows[] = $rows_data; } diff --git a/wms/contract/api/testT8API.php b/wms/contract/api/testT8API.php index d9481e16..3718df5d 100644 --- a/wms/contract/api/testT8API.php +++ b/wms/contract/api/testT8API.php @@ -1,109 +1,14 @@ - - -
- | - | - | ||||||||||||||||||||||||
- | - | - | ||||||||||||||||||||||||
- | - | - | ||||||||||||||||||||||||
-
-
-
-
-
|
- - | - | ||||||||||||||||||||||||
-
|
- - | - |
'; // print_r($sql_get); // echo ''; - + // exit; $result = mysqli_query($link, $sql_get); if ($result == false) { die(mysqli_error($link)); @@ -93,6 +93,7 @@ if (!empty($res_get)) { $data = mysqli_query($link, $sql); $para = "function_name=pricereview&" . $token_link; + ?>