Browse Source

Merge branch 'main' into gary

# Conflicts:
#	wms/contract_b-index.php
gary
IA2301\IA_2301 1 year ago
parent
commit
cd675438ee
  1. 12
      wms/T8_Authorization_from_bpm.php
  2. BIN
      wms/account-receivable-contract.xlsx
  3. 83
      wms/account-receivable-excel.php
  4. BIN
      wms/account-receivable-facility.xlsx
  5. 755
      wms/account-receivable-new-index.php
  6. 47
      wms/account-receivable-renovate-index.php
  7. BIN
      wms/account-receivable-renovate.xlsx
  8. 44
      wms/account-receivable-repair-index.php
  9. BIN
      wms/account-receivable-repair.xlsx
  10. 2
      wms/account-receivable.txt
  11. 111
      wms/bonus/api/postStatus.php
  12. 158
      wms/bonus/bonus.php
  13. 199
      wms/bonus/bonus_check.php
  14. 34
      wms/bonus/bonus_detail.php
  15. 218
      wms/bonus/elevator_new/elevator_new_deal_bonus.php
  16. 36
      wms/bonus/other/maintenance_contract_bonus_v2_1.php
  17. 417
      wms/bonus/other/maintenance_contract_bonus_v2_1_examination.php
  18. 22
      wms/contract-repair/contract-renovate-input.php
  19. 51
      wms/contract-repair/js/alpine.js
  20. 2
      wms/contract-repair/styles/style.css
  21. 2
      wms/contract-repair/styles/style.scss
  22. 11
      wms/contract/api/T8salIncomeApply.php
  23. 47
      wms/contract/api/getComboNo.php
  24. 87
      wms/contract/api/getContractData.php
  25. 276
      wms/contract/api/postContractData.php
  26. 318
      wms/contract/api/postNewContractData.php
  27. 55
      wms/contract/api/testT8API.php
  28. 2
      wms/contract/conn.php
  29. 106
      wms/contract/contract-input.php
  30. 10
      wms/contract/contract-new-apply.php
  31. 185
      wms/contract/contract-newelevator-input.php
  32. 101
      wms/contract/js/alpine.js
  33. 1
      wms/contract_b-index.php
  34. 2
      wms/crm/crmm02-index.php
  35. 8
      wms/crm/crmm03-edit.php
  36. 22
      wms/crm/crmm04-edit.php
  37. 2
      wms/fun_global.php
  38. 553
      wms/mkt/assets/js/pricereviewAlpine.js
  39. 188
      wms/mkt/css/pricereview.css
  40. 11
      wms/mkt/css/pricereview.css.map
  41. 309
      wms/mkt/css/pricereview.scss
  42. 195
      wms/mkt/pricereviewMaintainCreate.php

12
wms/T8_Authorization_from_bpm.php

@ -3,10 +3,7 @@
// $user_id = "M0000";
// $user_password = "M012290493119";
$user_id = "M0117";
$user_password = "90493119";
echo $validation = get_Auth($user_id, $user_password);
// echo $validation = get_Auth($user_id, $user_password);
function get_Auth($user_id = "M0000", $user_password = "M012290493119")
{
@ -16,8 +13,9 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119")
// $now = gmdate("YmdHis");
$now = gmdate("YmdHis", strtotime("-2 minutes"));
$data = "$user_id." . $now;
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
$sign = hash_hmac('SHA256', $data, 'A21181F1EE4966D3', false);
// echo $sign;
// $apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth';
$apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
@ -30,7 +28,7 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119")
"Pwd: $user_password",
"TimestampUTC: $now",
"Sign: $sign",
"GroupId: TEST"
"GroupId:TEST"
];
$ch = curl_init();
@ -53,4 +51,4 @@ function get_Auth($user_id = "M0000", $user_password = "M012290493119")
curl_close($ch);
}
// $data = [];
get_Auth();
// get_Auth();

BIN
wms/account-receivable-contract.xlsx

Binary file not shown.

83
wms/account-receivable-excel.php

@ -12,19 +12,54 @@ $array_data = array();
$Bill = json_decode(file_get_contents("php://input"), true);
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
// file_put_contents('account-receivable.txt', json_encode($Bill));
if ($type == 'facility') {
if ($type == 'newContract') {
$colomnHeader = [
'合約號', '客戶名稱', '營業員', '合約金額', '台數', '作番狀態', '催收金額', '催收次數', '訂金催收金額', '訂金催收次數', '二次款催收金額', '二次款催收次數',
'貨抵工地款催收金額', '貨抵工地款催收次數',
'安裝款催收金額', '安裝款催收次數',
'試車款催收金額', '試車款催收次數',
'官檢驗收催收金額', '官檢驗收催收次數',
'交車款催收金額', '交車款催收次數',
'尾款催收金額', '尾款催收次數'
];
file_put_contents('account-receivable.txt', json_encode($Bill, JSON_UNESCAPED_UNICODE));
$sheet->fromArray($colomnHeader, NULL, 'A1');
$rowIndex = 2;
foreach ($Bill as $key => $value) {
$sheet->fromArray($value, NULL, 'A' . $rowIndex);
$column = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y'
];
foreach ($column as $col) {
if ($col == 'F') {
$sheet->getColumnDimension('F')->setWidth(35);
$sheet->getStyle('F')->getAlignment()->setWrapText(true);
} else {
// $sheet->getColumnDimension($col)->setAutoSize(true);
$sheet->getColumnDimension($col)->setWidth(10);
$sheet->getStyle($col)->getAlignment()->setWrapText(true);
}
}
$rowIndex++;
}
$writer = new Xlsx($spreadsheet);
$excelFileName = 'account-receivable-contract.xlsx';
$writer->save($excelFileName);
} elseif ($type == 'facility') {
$colomnHeader = [
'T8單據日期','作番號', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭',
'訂金名稱', '訂金合約金額', '訂金應收日期', '訂金目前應收金額','訂金已開金額','訂金未開金額', '訂金已收金額', '訂金催收金額', '訂金催收次數',
'二次款名稱', '二次款合約金額', '二次款應收日期', '二次款目前應收金額','二次款已開金額','二次款未開金額', '二次款已收金額', '二次款催收金額', '二次款催收次數',
'貨抵工地款名稱', '貨抵工地款合約金額', '貨抵工地款應收日期', '貨抵工地款目前應收金額','貨抵工地款已開金額','貨抵工地款未開金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款催收次數',
'安裝款名稱', '安裝款合約金額', '安裝款應收日期', '安裝款目前應收金額','安裝款已開金額','安裝款未開金額', '安裝款已收金額', '安裝款催收金額', '安裝款催收次數',
'試車款名稱', '試車款合約金額', '試車款應收日期', '試車款目前應收金額','試車款已開金額','試車款未開金額', '試車款已收金額', '試車款催收金額', '試車款催收次數',
'官檢款名稱', '官檢款合約金額', '官檢款應收日期', '官檢款目前應收金額','官檢款已開金額','官檢款未開金額', '官檢款已收金額', '官檢款催收金額', '官檢款催收次數',
'交車款名稱', '交車款合約金額', '交車款應收日期', '交車款目前應收金額','交車款已開金額','交車款未開金額', '交車款已收金額', '交車款催收金額', '交車款催收次數',
'尾款名稱', '尾款金額', '尾款應收日期', '尾款應收金額','尾款已開金額','尾款未開金額', '尾款已收金額', '尾款催收金額', '尾款催收次數',
'作番狀態', '合約-設備金額','合約-安裝金額','作番合約總金額', '作番總應收金額'
'T8單據日期', '作番號', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭',
'訂金名稱', '訂金合約金額', '訂金應收日期', '訂金目前應收金額', '訂金已開金額', '訂金未開金額', '訂金已收金額', '訂金催收金額', '訂金催收次數',
'二次款名稱', '二次款合約金額', '二次款應收日期', '二次款目前應收金額', '二次款已開金額', '二次款未開金額', '二次款已收金額', '二次款催收金額', '二次款催收次數',
'貨抵工地款名稱', '貨抵工地款合約金額', '貨抵工地款應收日期', '貨抵工地款目前應收金額', '貨抵工地款已開金額', '貨抵工地款未開金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款催收次數',
'安裝款名稱', '安裝款合約金額', '安裝款應收日期', '安裝款目前應收金額', '安裝款已開金額', '安裝款未開金額', '安裝款已收金額', '安裝款催收金額', '安裝款催收次數',
'試車款名稱', '試車款合約金額', '試車款應收日期', '試車款目前應收金額', '試車款已開金額', '試車款未開金額', '試車款已收金額', '試車款催收金額', '試車款催收次數',
'官檢款名稱', '官檢款合約金額', '官檢款應收日期', '官檢款目前應收金額', '官檢款已開金額', '官檢款未開金額', '官檢款已收金額', '官檢款催收金額', '官檢款催收次數',
'交車款名稱', '交車款合約金額', '交車款應收日期', '交車款目前應收金額', '交車款已開金額', '交車款未開金額', '交車款已收金額', '交車款催收金額', '交車款催收次數',
'尾款名稱', '尾款金額', '尾款應收日期', '尾款應收金額', '尾款已開金額', '尾款未開金額', '尾款已收金額', '尾款催收金額', '尾款催收次數',
'作番狀態', '合約-設備金額', '合約-安裝金額', '作番合約總金額', '作番總應收金額'
];
$sheet->fromArray($colomnHeader, NULL, 'A1');
$rowIndex = 2;
@ -34,7 +69,7 @@ if ($type == 'facility') {
$column = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ',
'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP','BQ','BR','BK'
'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BK'
];
foreach ($column as $col) {
$sheet->getColumnDimension($col)->setAutoSize(true);
@ -47,16 +82,16 @@ if ($type == 'facility') {
$writer->save($excelFileName);
} else {
$colomnHeader = [
'T8單據日期','合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭',
'訂金', '訂金目前應收', '訂金已開票金額','訂金未開票金額', '訂金已收金額', '訂金催收金額', '訂金最大催收次數', '訂金最小催收次數',
'二次款', '二次款目前應收', '二次款已開票金額','二次款未開票金額', '二次款已收金額', '二次款催收金額', '二次款最大催收次數', '二次款最小催收次數',
'貨抵工地款', '貨抵工地款目前應收', '貨抵工地款已開票金額','貨抵工地款未開票金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款最大催收次數', '貨抵工地款最小催收次數',
'安裝款', '安裝款目前應收', '安裝款已開票金額','安裝款未開票金額', '安裝款已收金額', '安裝款催收金額', '安裝款最大催收次數', '安裝款最小催收次數',
'試車款', '試車款目前應收', '試車款已開票金額','試車款未開票金額', '試車款已收金額', '試車款催收金額', '試車款最大催收次數', '試車款最小催收次數',
'官檢款', '官檢款目前應收', '官檢款已開票金額','官檢款未開票金額', '官檢款已收金額', '官檢款催收金額', '官檢款最大催收次數', '官檢款最小催收次數',
'交車款', '交車款目前應收', '交車款已開票金額','交車款未開票金額', '交車款已收金額', '交車款催收金額', '交車款最大催收次數', '交車款最小催收次數',
'尾款', '尾款目前應收', '尾款已開票金額','尾款未開票金額', '尾款已收金額', '尾款催收金額', '尾款最大催收次數', '尾款最小催收次數',
'合約設備金額','合約安裝金額','合約總金額', '目前應收', '已開發票金額', '已收金額', '作番總數', '作番狀態'
'T8單據日期', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭',
'訂金', '訂金目前應收', '訂金已開票金額', '訂金未開票金額', '訂金已收金額', '訂金催收金額', '訂金最大催收次數', '訂金最小催收次數',
'二次款', '二次款目前應收', '二次款已開票金額', '二次款未開票金額', '二次款已收金額', '二次款催收金額', '二次款最大催收次數', '二次款最小催收次數',
'貨抵工地款', '貨抵工地款目前應收', '貨抵工地款已開票金額', '貨抵工地款未開票金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款最大催收次數', '貨抵工地款最小催收次數',
'安裝款', '安裝款目前應收', '安裝款已開票金額', '安裝款未開票金額', '安裝款已收金額', '安裝款催收金額', '安裝款最大催收次數', '安裝款最小催收次數',
'試車款', '試車款目前應收', '試車款已開票金額', '試車款未開票金額', '試車款已收金額', '試車款催收金額', '試車款最大催收次數', '試車款最小催收次數',
'官檢款', '官檢款目前應收', '官檢款已開票金額', '官檢款未開票金額', '官檢款已收金額', '官檢款催收金額', '官檢款最大催收次數', '官檢款最小催收次數',
'交車款', '交車款目前應收', '交車款已開票金額', '交車款未開票金額', '交車款已收金額', '交車款催收金額', '交車款最大催收次數', '交車款最小催收次數',
'尾款', '尾款目前應收', '尾款已開票金額', '尾款未開票金額', '尾款已收金額', '尾款催收金額', '尾款最大催收次數', '尾款最小催收次數',
'合約設備金額', '合約安裝金額', '合約總金額', '目前應收', '已開發票金額', '已收金額', '作番總數', '作番狀態'
];
$sheet->fromArray($colomnHeader, NULL, 'A1');
@ -67,7 +102,7 @@ if ($type == 'facility') {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ',
'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ',
'CA','CB','CC','CD'
'CA', 'CB', 'CC', 'CD'
];
foreach ($column as $col) {
if ($col == 'CC') {

BIN
wms/account-receivable-facility.xlsx

Binary file not shown.

755
wms/account-receivable-new-index.php

@ -7,11 +7,12 @@ $sum_contract = 0;
$sum_A40001 = 0;
$sum_A40008 = 0;
$sum_total_budget = 0;
$average_budget = 0;
$average_facility_budget = 0;
$average_A40001 = 0;
$average_A40008 = 0;
$sum_invoice_budget = 0;
$sum_received_budget = 0;
$sum_receivable_budget = 0;
$sum_collect_budget = 0;
// 主要array
@ -122,6 +123,7 @@ if ((in_array($user_id, array('M0060', 'M0175'))) || (in_array(accountidToDepart
$sql_all_contract .= ")";
};
}
$sql_all_contract .= " ORDER BY MainAll.PersonId ASC ";
$str_numbers = "";
$query_all_contract = $conn->query($sql_all_contract);
if (is_iterable($query_all_contract)) {
@ -147,11 +149,13 @@ if (is_iterable($query_all_contract)) {
$arrayData[$contract_numbers['BillNo']]['collect_budget'] = 0;
$arrayData[$contract_numbers['BillNo']]['A40001'] = 0;
$arrayData[$contract_numbers['BillNo']]['A40008'] = 0;
$arrayData[$contract_numbers['BillNo']]['collect_month'] = 0;
$arrayData[$contract_numbers['BillNo']]['facility_status'] = "";
$arrayData[$contract_numbers['BillNo']]['facility'] = array();
$arrayData[$contract_numbers['BillNo']]['facility_num'] = 0;
$arrayData[$contract_numbers['BillNo']]['total_budget'] = $contract_numbers['OAmountWithTax'];
$sum_total_budget += $contract_numbers['OAmountWithTax'];
$sum_contract +=1;
$sum_contract += 1;
}
}
$str_numbers .= "('" . implode("','", $contractNumbers) . "')";
@ -176,18 +180,17 @@ foreach ($query_contract_budget as $contract_budget) {
$arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']]['total_budget'] = $contract_budget['OAmountWithTax'];
$arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']][$contract_budget['MaterialId']] = $contract_budget['OAmountWithTax'];
$arrayData[$contract_budget['BillNo']]['facility'][$contract_budget['CU_MaterialId']]['status'] = "";
$sum_facility +=1;
$sum_facility += 1;
$arrayData[$contract_budget['BillNo']]['facility_num'] += 1;
}
switch($contract_budget['CU_MaterialId']){
switch ($contract_budget['MaterialId']) {
case "A40001":
$sum_A40001 += $contract_budget['OAmountWithTax'];
break;
case "A40008":
$sum_A40008 += $contract_budget['OAmountWithTax'];
break;
}
}
}
@ -215,6 +218,7 @@ foreach ($query_PayStage as $PayStage) {
$arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['PayStage'] = $PayStage['PayStage'];
$arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['PlanPayAmt'] = $PayStage['PlanPayAmt'];
$arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['PlanPayDate'] = $PayStage['PlanPayDate'];
$arrayData[$PayStage['BillNo']]['PayStage'][$PayStage['RowNo']]['stage'] = '';
if (isset($arrayData[$PayStage['BillNo']]['facility']) && is_iterable($arrayData[$PayStage['BillNo']]['facility'])) {
foreach ($arrayData[$PayStage['BillNo']]['facility'] as $key => &$value) {
$tmpkey = $key . $PayStage['RowNo'];
@ -323,11 +327,11 @@ foreach ($PayStage_array as $key => &$value) {
case '寶佳出貨前30天':
$payvalue['stage'] = '訂金';
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) {
$estimate_time = strtotime($wip['real_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']);
$signtime = $estimate_time - (30 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) {
$estimate_time = strtotime($wip['real_contract_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']);
$signtime = $estimate_time - (30 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
@ -337,7 +341,7 @@ foreach ($PayStage_array as $key => &$value) {
case '寶佳出貨後10天':
$payvalue['stage'] = '二次款';
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) {
$estimate_time = strtotime($wip['real_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']);
$signtime = $estimate_time + (10 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
@ -347,7 +351,7 @@ foreach ($PayStage_array as $key => &$value) {
case '貨抵工地後90天':
$payvalue['stage'] = '貨抵工地款';
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) {
$estimate_time = strtotime($wip['real_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']);
$signtime = $estimate_time + (90 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
@ -357,7 +361,7 @@ foreach ($PayStage_array as $key => &$value) {
case '安裝試車後90天':
$payvalue['stage'] = '試車款';
if ($wip_array[$payvalue['facilityno']]['tryrun_end_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['tryrun_end_date'])) {
$estimate_time = strtotime($wip['tryrun_end_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']);
$signtime = $estimate_time + (90 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
@ -367,43 +371,53 @@ foreach ($PayStage_array as $key => &$value) {
case '交車後270天':
$payvalue['stage'] = '尾款';
if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) {
$estimate_time = strtotime($wip['delivery_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['delivery_date']);
$signtime = $estimate_time + (270 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
$payvalue['PlanPayDate'] = NULL;
}
break;
case '交車後180天':
$payvalue['stage'] = '尾款';
if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) {
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['delivery_date']);
$signtime = $estimate_time + (180 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
$payvalue['PlanPayDate'] = NULL;
}
break;
case (in_array($payvalue['PayStage'], $arrival)):
$payvalue['stage'] = '貨抵工地款';
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) {
$estimate_time = strtotime($wip['real_arrival_date']);
$signtime = $estimate_time + (10 * 86400);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']);
$signtime = $estimate_time;
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
$payvalue['PlanPayDate'] = NULL;
$payvalue['PlanPayDate'] = 'NULL';
}
break;
case '二次款':
$payvalue['stage'] = '二次款';
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) {
$estimate_time = strtotime($wip['real_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']);
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time);
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) {
$estimate_time = strtotime($wip['real_contract_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']);
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time);
} else {
$payvalue['PlanPayDate'] = NULL;
}
break;
case (stristr($payvalue['PayStage'], '出貨前30') || stristr($payvalue['PayStage'], '簽約(出貨前30天)') ||stristr($payvalue['PayStage'], '建照核發時')):
case (stristr($payvalue['PayStage'], '出貨前30') || stristr($payvalue['PayStage'], '簽約(出貨前30天)') || stristr($payvalue['PayStage'], '建照核發時')):
$payvalue['stage'] = '二次款';
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) {
$estimate_time = strtotime($wip['real_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']);
$signtime = $estimate_time - (30 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) {
$estimate_time = strtotime($wip['real_contract_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']);
$signtime = $estimate_time - (30 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
@ -413,11 +427,11 @@ foreach ($PayStage_array as $key => &$value) {
case (stristr($payvalue['PayStage'], '出貨前60')):
$payvalue['stage'] = '二次款';
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) {
$estimate_time = strtotime($wip['real_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']);
$signtime = $estimate_time - (60 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) {
$estimate_time = strtotime($wip['real_contract_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']);
$signtime = $estimate_time - (60 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
@ -427,11 +441,11 @@ foreach ($PayStage_array as $key => &$value) {
case (stristr($payvalue['PayStage'], '出貨前90')):
$payvalue['stage'] = '二次款';
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) {
$estimate_time = strtotime($wip['real_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']);
$signtime = $estimate_time - (90 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) {
$estimate_time = strtotime($wip['real_contract_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']);
$signtime = $estimate_time - (90 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
@ -441,11 +455,11 @@ foreach ($PayStage_array as $key => &$value) {
case (stristr($payvalue['PayStage'], '出貨前120')):
$payvalue['stage'] = '二次款';
if ($wip_array[$payvalue['facilityno']]['real_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_arrival_date'])) {
$estimate_time = strtotime($wip['real_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_arrival_date']);
$signtime = $estimate_time - (120 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} elseif ($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['real_contract_arrival_date'])) {
$estimate_time = strtotime($wip['real_contract_arrival_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['real_contract_arrival_date']);
$signtime = $estimate_time - (120 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $signtime);
} else {
@ -490,7 +504,7 @@ foreach ($PayStage_array as $key => &$value) {
case (stristr($payvalue['PayStage'], '試車')):
$payvalue['stage'] = '試車款';
if ($wip_array[$payvalue['facilityno']]['tryrun_end_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['tryrun_end_date'])) {
$estimate_time = strtotime($wip['tryrun_end_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['tryrun_end_date']);
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time);
} else {
$payvalue['PlanPayDate'] = NULL;
@ -499,7 +513,7 @@ foreach ($PayStage_array as $key => &$value) {
case (stristr($payvalue['PayStage'], '安裝') || stristr($payvalue['PayStage'], '貨抵工地且完工')):
$payvalue['stage'] = '安裝款';
if ($wip_array[$payvalue['facilityno']]['install_end_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['install_end_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['install_end_date'])) {
$estimate_time = strtotime($wip['install_end_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['install_end_date']);
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time);
} else {
$payvalue['PlanPayDate'] = NULL;
@ -508,7 +522,7 @@ foreach ($PayStage_array as $key => &$value) {
case (in_array($payvalue['PayStage'], $final6)):
$payvalue['stage'] = '尾款';
if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) {
$estimate_time = strtotime($wip['delivery_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['delivery_date']);
$estimate_time = $estimate_time + (180 * 86400);
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time);
} else {
@ -518,7 +532,7 @@ foreach ($PayStage_array as $key => &$value) {
case (stristr($payvalue['PayStage'], '合格') || stristr($payvalue['PayStage'], '驗收') || stristr($payvalue['PayStage'], '驗收')):
$payvalue['stage'] = '官檢驗收款';
if ($wip_array[$payvalue['facilityno']]['official_check_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['official_check_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['official_check_date'])) {
$estimate_time = strtotime($wip['official_check_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['official_check_date']);
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time);
} else {
$payvalue['PlanPayDate'] = NULL;
@ -527,7 +541,7 @@ foreach ($PayStage_array as $key => &$value) {
case (stristr($payvalue['PayStage'], '交車') || stristr($payvalue['PayStage'], '移交') || stristr($payvalue['PayStage'], '完工') || stristr($payvalue['PayStage'], '許可') || stristr($payvalue['PayStage'], '核可')):
$payvalue['stage'] = '交車款';
if ($wip_array[$payvalue['facilityno']]['delivery_date'] !== null && strtotime($wip_array[$payvalue['facilityno']]['delivery_date']) > 975686400 && !empty($wip_array[$payvalue['facilityno']]['delivery_date'])) {
$estimate_time = strtotime($wip['delivery_date']);
$estimate_time = strtotime($wip_array[$payvalue['facilityno']]['delivery_date']);
$payvalue['PlanPayDate'] = date('Y-m-d', $estimate_time);
} else {
$payvalue['PlanPayDate'] = NULL;
@ -596,6 +610,18 @@ foreach ($query_invoice as $invoice) {
}
}
//未在T8的收款資料
$sql_wms = "SELECT * FROM account_received WHERE type='M' AND BillNo IN $str_numbers";
$query_wms = mysqli_query($link, $sql_wms);
foreach ($query_wms as $wms) {
if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['invoice_budget'])) {
$arrayData[$wms['BillNo']]['invoice_budget'] += $wms['invoice_budget'];
}
if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['received_budget'])) {
$arrayData[$wms['BillNo']]['received_budget'] += $wms['received_budget'];
}
}
// 核銷資訊
$sql_received = "SELECT
CheckDetail.OrderBillNo,
@ -636,7 +662,6 @@ foreach ($final_paystage as $key => &$value) {
$collect_month = collect_month(strtotime($value[$sequenceNumber]['PlanPayDate']));
if ($today > strtotime($value[$sequenceNumber]['PlanPayDate'])) {
$value[$sequenceNumber]['hadtopay'] = 'V';
$arrayData[$key]['receivable_budget'] += $value[$sequenceNumber]['PlanPayAmt'];
} else {
$value[$sequenceNumber]['hadtopay'] = '--';
}
@ -644,9 +669,9 @@ foreach ($final_paystage as $key => &$value) {
$collect_month = 0;
$value[$sequenceNumber]['hadtopay'] = '--';
}
if ($tmpinvoice >= $value[$sequenceNumber]['PlanPayAmt']) {
if ($tmpinvoice > $value[$sequenceNumber]['PlanPayAmt']) {
$value[$sequenceNumber]['invoice_budget'] = $value[$sequenceNumber]['PlanPayAmt'];
$tmpinvoice -= $value[$sequenceNumber]['invoice_budget'];
$tmpinvoice = $tmpinvoice - $value[$sequenceNumber]['invoice_budget'];
} elseif ($tmpinvoice > 0) {
$value[$sequenceNumber]['invoice_budget'] = $tmpinvoice;
$tmpinvoice = 0;
@ -655,7 +680,7 @@ foreach ($final_paystage as $key => &$value) {
}
if ($tmpreceived > $value[$sequenceNumber]['PlanPayAmt']) {
$value[$sequenceNumber]['received_budget'] = $value[$sequenceNumber]['PlanPayAmt'];
$tmpinvoice -= $value[$sequenceNumber]['received_budget'];
$tmpreceived -= $value[$sequenceNumber]['received_budget'];
} elseif ($tmpreceived > 0) {
$value[$sequenceNumber]['received_budget'] = $tmpreceived;
$tmpreceived = 0;
@ -670,17 +695,9 @@ foreach ($final_paystage as $key => &$value) {
}
}
// foreach($final_paystage as $key => $value) {
// echo $key."<br>";
// echo "---------------------<br>";
// foreach($value as $key2 => $value2) {
// echo $key2."<br>";
// print_r($value2);
// echo "<br>";
// }
// echo "<br>==================<br>";
// }
// exit();
//合約資料填回arrayData
foreach ($final_paystage as $key => $value) {
for ($sequence = 1; $sequence <= count($value); $sequence++) {
if (isset($arrayData[$key]) && isset($arrayData[$key]['facility']) && isset($arrayData[$key]['facility'][$value[$sequence]['facilityno']]) && isset($arrayData[$key]['facility'][$value[$sequence]['facilityno']]['PayStage'])) {
@ -688,18 +705,37 @@ foreach ($final_paystage as $key => $value) {
foreach ($arrayData[$key]['PayStage'] as $arkey => &$arvalue) {
if ($arvalue['PayStage'] == $value[$sequence]['PayStage']) {
if (isset($arvalue['receivable_budget']) && isset($arvalue['received_budget']) && isset($arvalue['invoice_budget'])) {
$arvalue['receivable_budget'] += $value[$sequence]['PlanPayAmt'];
$arvalue['received_budget'] += $value[$sequence]['received_budget'];
$arvalue['invoice_budget'] += $value[$sequence]['invoice_budget'];
if ($value[$sequence]['hadtopay'] == 'V') {
$arvalue['receivable_budget'] += $value[$sequence]['PlanPayAmt'];
$arrayData[$key]['receivable_budget'] += $value[$sequence]['PlanPayAmt'];
} else {
$arvalue['receivable_budget'] = 0;
}
if ($arvalue['collect_month'] < $value[$sequence]['collect_month']) {
$arvalue['collect_month'] = $value[$sequence]['collect_month'];
}
$sum_receivable_budget += $value[$sequence]['PlanPayAmt'];
$sum_received_budget += $value[$sequence]['received_budget'];
$sum_invoice_budget += $value[$sequence]['invoice_budget'];
} else {
$arvalue['stage'] = $value[$sequence]['stage'];
if ($value[$sequence]['hadtopay'] == 'V') {
$arvalue['receivable_budget'] = $value[$sequence]['PlanPayAmt'];
$arrayData[$key]['receivable_budget'] += $value[$sequence]['PlanPayAmt'];
} else {
$arvalue['receivable_budget'] = 0;
}
$arvalue['received_budget'] = $value[$sequence]['received_budget'];
$arvalue['invoice_budget'] = $value[$sequence]['invoice_budget'];
$arvalue['collect_month'] = $value[$sequence]['collect_month'];
$sum_receivable_budget += $value[$sequence]['PlanPayAmt'];
$sum_received_budget += $value[$sequence]['received_budget'];
$sum_invoice_budget += $value[$sequence]['invoice_budget'];
}
if ($value[$sequence]['collect_month'] > $arrayData[$key]['collect_month']) {
$arrayData[$key]['collect_month'] = $value[$sequence]['collect_month'];
}
}
}
@ -707,15 +743,620 @@ foreach ($final_paystage as $key => $value) {
}
}
// 存進excel_array
$excel_array = array();
$average_A40001 = $sum_A40001 / $sum_facility;
$average_A40008 = $sum_A40008 / $sum_facility;
$average_facility_budget = $sum_total_budget / $sum_facility;
$average_contract_budget = $sum_total_budget / $sum_contract;
$average_contract_facility = $sum_facility / $sum_contract;
// excel 結果
// 0 合約號; 1 單據日期; 2 客戶編號; 3 客戶名稱; 4 客戶地址; 5 部門ID; 6 部門名稱; 7 營業員工號; 8 營業員名稱; 9 部門主管工號; 10 部門主管名稱;
// 11 合約總金額; 12 A40001總金額; 13 A40008總金額; 14 目前應收金額; 15 已開發票金額; 16 已收金額; 17 催收金額; 18 催收次數; 19 作番總數; 20 作番狀態
// 21 訂金名稱; 22 訂金金額; 23 應收金額; 24 已開發票金額; 25 已收金額; 26 催收金額; 27 催收次數;
// 28 二次款名稱; 29 二次款金額; 30 應收金額; 31 已開發票金額; 32 已收金額; 33 催收金額; 34 催收次數;
$excel_contract_array = array();
$excel_contract_all_array = array();
$excel_contract_boga_array = array();
$excel_contract_noboga_array = array();
$excel_facility_array = array();
foreach ($arrayData as $key => $value) {
echo $key . "<br>********************<br>";
print_r($value);
// foreach($value['facility'] as $key2 => $value2) {
// echo $key2."<br>";
// print_r($value2['PayStage']);
// echo "<br>";
// }
echo "<br>-------------------------------<br>";
$excel_contract_array[$key] = array_fill(0, 76, '');
$excel_contract_array[$key][0] = (isset($value['BillNo']) && !is_null($value['BillNo'])) ? $value['BillNo'] : '';
$excel_contract_array[$key][1] = (isset($value['BillDate']) && !is_null($value['BillDate'])) ? $value['BillDate'] : '';
$excel_contract_array[$key][2] = (isset($value['CustomerId']) && !is_null($value['CustomerId'])) ? $value['CustomerId'] : '';
$excel_contract_array[$key][3] = (isset($value['CustomerName']) && !is_null($value['CustomerName'])) ? $value['CustomerName'] : '';
$excel_contract_array[$key][4] = (isset($value['CustomerAddress']) && !is_null($value['CustomerAddress'])) ? $value['CustomerAddress'] : '';
$excel_contract_array[$key][5] = (isset($value['DeptId']) && !is_null($value['DeptId'])) ? $value['DeptId'] : '';
$excel_contract_array[$key][6] = (isset($value['DeptName']) && !is_null($value['DeptName'])) ? $value['DeptName'] : '';
$excel_contract_array[$key][7] = (isset($value['PersonId']) && !is_null($value['PersonId'])) ? $value['PersonId'] : '';
$excel_contract_array[$key][8] = (isset($value['PersonName']) && !is_null($value['PersonName'])) ? $value['PersonName'] : '';
$excel_contract_array[$key][9] = (isset($value['ManagerId']) && !is_null($value['ManagerId'])) ? $value['ManagerId'] : '';
$excel_contract_array[$key][10] = (isset($value['ManagerName']) && !is_null($value['ManagerName'])) ? $value['ManagerName'] : '';
$excel_contract_array[$key][11] = (isset($value['OAmountWithTax']) && !is_null($value['OAmountWithTax'])) ? number_format(round($value['OAmountWithTax'])) : '0';
$excel_contract_array[$key][12] = (isset($value['A40001']) && !is_null($value['A40001'])) ? number_format(round($value['A40001'])) : '0';
$excel_contract_array[$key][13] = (isset($value['A40008']) && !is_null($value['A40008'])) ? number_format(round($value['A40008'])) : '0';
$excel_contract_array[$key][14] = (isset($value['receivable_budget']) && !is_null($value['receivable_budget'])) ? $value['receivable_budget'] : 0;
$excel_contract_array[$key][15] = (isset($value['invoice_budget']) && !is_null($value['invoice_budget'])) ? number_format(round($value['invoice_budget'])) : '0';
$excel_contract_array[$key][16] = (isset($value['received_budget']) && !is_null($value['received_budget'])) ? $value['received_budget'] : 0;
$excel_contract_array[$key][17] = number_format(round($excel_contract_array[$key][14] - $excel_contract_array[$key][16]));
$excel_contract_array[$key][18] = (isset($value['collect_month']) && !is_null($value['collect_month'])) ? number_format(round($value['collect_month'])) : '0';
$excel_contract_array[$key][19] = (isset($value['facility_num']) && !is_null($value['facility_num'])) ? number_format(round($value['facility_num'])) : '0';
$excel_contract_array[$key][20] = (isset($value['facility_status']) && !is_null($value['facility_status'])) ? $value['facility_status'] : '--';
$excel_contract_array[$key][14] = number_format(round($excel_contract_array[$key][14]));
$excel_contract_array[$key][16] = number_format(round($excel_contract_array[$key][16]));
if ($excel_contract_array[$key][17] > 1 && isset($value['PayStage']) && is_iterable($value['PayStage'])) {
$excel_contract_all_array[$key] = array_fill(0, 24, 0);
$excel_contract_all_array[$key][0] = $excel_contract_array[$key][0];
$excel_contract_all_array[$key][1] = $excel_contract_array[$key][3];
$excel_contract_all_array[$key][2] = $excel_contract_array[$key][8];
$excel_contract_all_array[$key][3] = $excel_contract_array[$key][11];
$excel_contract_all_array[$key][4] = $excel_contract_array[$key][19];
$excel_contract_all_array[$key][5] = $excel_contract_array[$key][20];
$excel_contract_all_array[$key][6] = $excel_contract_array[$key][17];
$excel_contract_all_array[$key][7] = $excel_contract_array[$key][18];
$isBoga = 0;
if (stristr($value['PayStage'][1]['PayStage'], '寶佳')) {
$isBoga = 1;
$excel_contract_boga_array[$key] = array_fill(0, 24, '');
$excel_contract_boga_array[$key][0] = $excel_contract_array[$key][0];
$excel_contract_boga_array[$key][1] = $excel_contract_array[$key][3];
$excel_contract_boga_array[$key][2] = $excel_contract_array[$key][8];
$excel_contract_boga_array[$key][3] = $excel_contract_array[$key][11];
$excel_contract_boga_array[$key][4] = $excel_contract_array[$key][19];
$excel_contract_boga_array[$key][5] = $excel_contract_array[$key][20];
$excel_contract_boga_array[$key][6] = $excel_contract_array[$key][17];
$excel_contract_boga_array[$key][7] = $excel_contract_array[$key][18];
} else {
$excel_contract_noboga_array[$key] = array_fill(0, 24, '');
$excel_contract_noboga_array[$key][0] = $excel_contract_array[$key][0];
$excel_contract_noboga_array[$key][1] = $excel_contract_array[$key][3];
$excel_contract_noboga_array[$key][2] = $excel_contract_array[$key][8];
$excel_contract_noboga_array[$key][3] = $excel_contract_array[$key][11];
$excel_contract_noboga_array[$key][4] = $excel_contract_array[$key][19];
$excel_contract_noboga_array[$key][5] = $excel_contract_array[$key][20];
$excel_contract_noboga_array[$key][6] = $excel_contract_array[$key][17];
$excel_contract_noboga_array[$key][7] = $excel_contract_array[$key][18];
}
foreach ($value['PayStage'] as $paykey => $payvalue) {
switch ($payvalue['stage']) {
case "訂金":
$excel_contract_array[$key][21] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][22] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_array[$key][23] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_array[$key][24] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_array[$key][25] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][26] = number_format(round($excel_contract_array[$key][23] - $excel_contract_array[$key][25]));
$excel_contract_array[$key][27] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][8] = number_format(round($excel_contract_array[$key][23] - $excel_contract_array[$key][25]));
$excel_contract_all_array[$key][9] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][8] = $excel_contract_all_array[$key][8];
$excel_contract_boga_array[$key][9] = $excel_contract_all_array[$key][9];
} else {
$excel_contract_noboga_array[$key][8] = $excel_contract_all_array[$key][8];
$excel_contract_noboga_array[$key][9] = $excel_contract_all_array[$key][9];
}
}
$excel_contract_array[$key][23] = number_format(round($excel_contract_array[$key][23]));
$excel_contract_array[$key][25] = number_format(round($excel_contract_array[$key][25]));
break;
case "二次款":
$excel_contract_array[$key][28] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][29] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_array[$key][30] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_array[$key][31] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_array[$key][32] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][33] = number_format(round($excel_contract_array[$key][30] - $excel_contract_array[$key][32]));
$excel_contract_array[$key][34] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][10] = number_format(round($excel_contract_array[$key][30] - $excel_contract_array[$key][32]));
$excel_contract_all_array[$key][11] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][10] = $excel_contract_all_array[$key][10];
$excel_contract_boga_array[$key][11] = $excel_contract_all_array[$key][11];
} else {
$excel_contract_noboga_array[$key][10] = $excel_contract_all_array[$key][10];
$excel_contract_noboga_array[$key][11] = $excel_contract_all_array[$key][11];
}
}
$excel_contract_array[$key][30] = number_format(round($excel_contract_array[$key][30]));
$excel_contract_array[$key][32] = number_format(round($excel_contract_array[$key][32]));
break;
case "貨抵工地款":
$excel_contract_array[$key][35] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][36] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_array[$key][37] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_array[$key][38] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_array[$key][39] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][40] = number_format(round($excel_contract_array[$key][37] - $excel_contract_array[$key][39]));
$excel_contract_array[$key][41] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][12] = number_format(round($excel_contract_array[$key][37] - $excel_contract_array[$key][39]));
$excel_contract_all_array[$key][13] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][12] = $excel_contract_all_array[$key][12];
$excel_contract_boga_array[$key][13] = $excel_contract_all_array[$key][13];
} else {
$excel_contract_noboga_array[$key][12] = $excel_contract_all_array[$key][12];
$excel_contract_noboga_array[$key][13] = $excel_contract_all_array[$key][13];
}
}
$excel_contract_array[$key][37] = number_format(round($excel_contract_array[$key][37]));
$excel_contract_array[$key][39] = number_format(round($excel_contract_array[$key][39]));
break;
case "安裝款":
$excel_contract_array[$key][42] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][43] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_array[$key][44] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_array[$key][45] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_array[$key][46] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][47] = number_format(round($excel_contract_array[$key][44] - $excel_contract_array[$key][46]));
$excel_contract_array[$key][48] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][14] = number_format(round($excel_contract_array[$key][44] - $excel_contract_array[$key][46]));
$excel_contract_all_array[$key][15] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][14] = $excel_contract_all_array[$key][14];
$excel_contract_noboga_array[$key][15] = $excel_contract_all_array[$key][15];
}
$excel_contract_array[$key][44] = number_format(round($excel_contract_array[$key][44]));
$excel_contract_array[$key][46] = number_format(round($excel_contract_array[$key][46]));
break;
case "試車款":
$excel_contract_array[$key][49] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][50] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_array[$key][51] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_array[$key][52] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_array[$key][53] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][54] = number_format(round($excel_contract_array[$key][51] - $excel_contract_array[$key][53]));
$excel_contract_array[$key][55] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][16] = number_format(round($excel_contract_array[$key][51] - $excel_contract_array[$key][53]));
$excel_contract_all_array[$key][17] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][16] = $excel_contract_all_array[$key][16];
$excel_contract_boga_array[$key][17] = $excel_contract_all_array[$key][17];
} else {
$excel_contract_noboga_array[$key][16] = $excel_contract_all_array[$key][16];
$excel_contract_noboga_array[$key][17] = $excel_contract_all_array[$key][17];
}
}
$excel_contract_array[$key][51] = number_format(round($excel_contract_array[$key][51]));
$excel_contract_array[$key][53] = number_format(round($excel_contract_array[$key][53]));
break;
case "官檢驗收款":
$excel_contract_array[$key][56] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][57] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_array[$key][58] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_array[$key][59] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_array[$key][60] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][61] = number_format(round($excel_contract_array[$key][58] - $excel_contract_array[$key][60]));
$excel_contract_array[$key][62] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][18] = number_format(round($excel_contract_array[$key][58] - $excel_contract_array[$key][60]));
$excel_contract_all_array[$key][19] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][18] = $excel_contract_all_array[$key][18];
$excel_contract_noboga_array[$key][19] = $excel_contract_all_array[$key][19];
}
$excel_contract_array[$key][58] = number_format(round($excel_contract_array[$key][58]));
$excel_contract_array[$key][60] = number_format(round($excel_contract_array[$key][60]));
break;
case "交車款":
$excel_contract_array[$key][63] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][64] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_array[$key][65] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_array[$key][66] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_array[$key][67] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][68] = number_format(round($excel_contract_array[$key][65] - $excel_contract_array[$key][67]));
$excel_contract_array[$key][69] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][20] = number_format(round($excel_contract_array[$key][65] - $excel_contract_array[$key][67]));
$excel_contract_all_array[$key][21] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
$excel_contract_noboga_array[$key][20] = $excel_contract_all_array[$key][20];
$excel_contract_noboga_array[$key][21] = $excel_contract_all_array[$key][21];
}
$excel_contract_array[$key][65] = number_format(round($excel_contract_array[$key][65]));
$excel_contract_array[$key][67] = number_format(round($excel_contract_array[$key][67]));
break;
case "尾款":
$excel_contract_array[$key][70] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][71] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0';
$excel_contract_array[$key][72] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0;
$excel_contract_array[$key][73] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0';
$excel_contract_array[$key][74] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0;
$excel_contract_array[$key][75] = number_format(round($excel_contract_array[$key][72] - $excel_contract_array[$key][74]));
$excel_contract_array[$key][76] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][22] = number_format(round($excel_contract_array[$key][72] - $excel_contract_array[$key][74]));
$excel_contract_all_array[$key][23] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0';
if ($isBoga == 1) {
$excel_contract_boga_array[$key][22] = $excel_contract_all_array[$key][22];
$excel_contract_boga_array[$key][23] = $excel_contract_all_array[$key][23];
} else {
$excel_contract_noboga_array[$key][22] = $excel_contract_all_array[$key][22];
$excel_contract_noboga_array[$key][23] = $excel_contract_all_array[$key][23];
}
}
$excel_contract_array[$key][72] = number_format(round($excel_contract_array[$key][72]));
$excel_contract_array[$key][74] = number_format(round($excel_contract_array[$key][74]));
break;
}
}
}
// 0 作番號; 1 合約號; 2 合約單據日期; 3 客戶編號; 4 客戶名稱; 5 客戶地址; 6 部門ID; 7 部門名稱; 8 營業員工號; 9 營業員名稱; 10 部門主管工號; 11 部門主管名稱;
// 12 作番總金額; 13 A40001 金額; 14 A40008 金額; 15 目前應收金額; 16 已開發票金額; 17 已收金額; 18 催收金額; 19 催收次數; 20 作番狀態
if (isset($value['facility']) && is_iterable($value['facility'])) {
foreach ($value['facility'] as $fkey => $fvalue) {
$excel_facility_array[$fkey] = [$fkey, $key, $value['BillDate']];
$excel_facility_array[$key][2] = (isset($value['CustomerId']) && !is_null($value['CustomerId'])) ? $value['CustomerId'] : '';
$excel_facility_array[$key][3] = (isset($value['CustomerName']) && !is_null($value['CustomerName'])) ? $value['CustomerName'] : '';
$excel_facility_array[$key][4] = (isset($value['CustomerAddress']) && !is_null($value['CustomerAddress'])) ? $value['CustomerAddress'] : '';
$excel_facility_array[$key][5] = (isset($value['DeptId']) && !is_null($value['DeptId'])) ? $value['DeptId'] : '';
$excel_facility_array[$key][6] = (isset($value['DeptName']) && !is_null($value['DeptName'])) ? $value['DeptName'] : '';
$excel_facility_array[$key][7] = (isset($value['PersonId']) && !is_null($value['PersonId'])) ? $value['PersonId'] : '';
$excel_facility_array[$key][8] = (isset($value['PersonName']) && !is_null($value['PersonName'])) ? $value['PersonName'] : '';
$excel_facility_array[$key][9] = (isset($value['ManagerId']) && !is_null($value['ManagerId'])) ? $value['ManagerId'] : '';
}
}
}
$total_data = json_encode($excel_contract_all_array);
$boga_data = json_encode($excel_contract_boga_array);
$noboga_data = json_encode($excel_contract_noboga_array);
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
th {
text-align: center;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<div style="width: 98%;margin: 1%;">
<div class="btn-group btn-group-md " style="padding:10 px; width: 100%;">
<button type="button" style="width: 12%;" onclick="downloadData('all')" class="btn btn-success">全部<span class="glyphicon glyphicon-download-alt"></span></button>
<button type="button" style="width: 12%;" onclick="downloadData('noboga')" class="btn btn-info">不含寶佳<span class="glyphicon glyphicon-download-alt"></span></button>
<button type="button" style="width: 12%;" onclick="downloadData('boga')" class="btn btn-warning">寶佳<span class="glyphicon glyphicon-download-alt"></span></button>
</div>
</div>
<div class="container">
<div class="text-center" style="margin-bottom: 20px;">
<h3><strong>合約 (新梯)統整資訊</strong></h3>
</div>
<form class="form-horizontal">
<div class="form-group">
<div class="col-md-3">
<label for="sum_total_budget">合約總金額</label>
<input type="text" class="form-control" id="sum_total_budget" name="sum_total_budget" value="<?= number_format($sum_total_budget) ?>" disabled>
</div>
<div class="col-md-3">
<label for="sum_A40001">合約設備總金額</label>
<input type="text" class="form-control" id="sum_A40001" name="sum_A40001" value="<?= number_format($sum_A40001) ?>" disabled>
</div>
<div class="col-md-3">
<label for="sum_A40008">合約安裝總金額</label>
<input type="text" class="form-control" id="sum_A40008" name="sum_A40008" value="<?= number_format($sum_A40008) ?>" disabled>
</div>
<div class="col-md-3">
<label for="sum_facility">總台數</label>
<input type="text" class="form-control" id="sum_facility" name="sum_facility" value="<?= number_format($sum_facility) ?>" disabled>
</div>
</div>
<div class="form-group">
<div class="col-md-3">
<label for="average_facility_budget">作番平均金額 (元/台)</label>
<input type="text" class="form-control" id="average_facility_budget" name="average_facility_budget" value="<?= number_format($average_facility_budget) ?>" disabled>
</div>
<div class="col-md-3">
<label for="average_A40001">設備平均金額 (元/台)</label>
<input type="text" class="form-control" id="average_A40001" name="average_A40001" value="<?= number_format($average_A40001) ?>" disabled>
</div>
<div class="col-md-3">
<label for="average_A40008">安裝平均金額 (元/台)</label>
<input type="text" class="form-control" id="average_A40008" name="average_A40008" value="<?= number_format($average_A40008) ?>" disabled>
</div>
<div class="col-md-3">
<label for="average_contract_facility">平均台數 (台/合約)</label>
<input type="text" class="form-control" id="average_contract_facility" name="average_contract_facility" value="<?= number_format($average_contract_facility) ?>" disabled>
</div>
</div>
</form>
<form class="form-horizontal" id='myForm' method='post' action='account-receivable-new-index.php?<?= $token_link ?>'>
<table class="table table-striped table-bordered" style='width:98%;text-align:center;margin:0 auto'>
<tbody>
<tr>
<th class="text-center" style="vertical-align: middle;">合約日期</th>
<td colspan="2">
<input type="date" class='form-control' id='date_start' name='date_start' style='width:40%;display:inline;'>
<input type="date" class='form-control' id='date_end' name='date_end' style='width:40%;display:inline;'>
<button type="submit" class="btn btn-primary btn-sm">搜尋</button>
</td>
</tr>
<tr>
<th class="text-center" style="vertical-align: middle;">合約催收次數</th>
<td colspan="2">
<input type="text" class='form-control' id='collect_time_start' name='collect_time_start' style='width:10%;display:inline;' oninput="searchFront('collect_time_start')">
≤ 催收次數 ≤
<input type="text" class='form-control' id='collect_time_end' name='collect_time_end' style='width:10%;display:inline;'>
<!-- <button type="submit" class="btn btn-primary btn-sm">搜尋</button> -->
</td>
</tr>
</tbody>
</table>
</form>
</div>
<?php
include "./footer.php";
?>
<div style="width:98%;margin:1% ;overflow-x: auto;">
<table id="table_index" class="table table-striped table-bordered" style="width:100%;">
<thead>
<tr>
<th style="width: 120px;">合約號</th>
<th style="width: 120px;">部門</th>
<th style="width: 120px;">主管</th>
<th style="width: 120px;">營業員</th>
<th style="width: 180px;">客戶</th>
<th style="width: 300px;">作番狀態</th>
<th style="width: 150px;">合約-設備金額</th>
<th style="width: 150px;">合約-安裝金額</th>
<th style="width: 150px;">合約總金額</th>
<th style="width: 150px;">合約目前應收</th>
<th style="width: 150px;">已開發票金額</th>
<th style="width: 150px;">已收金額金額</th>
<th style="width: 150px;">催收金額金額</th>
<th style="width: 100px;">催收次數</th>
<th style="width: 100px;">作番數量</th>
<th style="width: 120px;">訂金 <br>名稱</th>
<th style="width: 120px;">訂金<br>合約金額</th>
<th style="width: 120px;">訂金<br>應收金額</th>
<th style="width: 120px;">訂金<br>已開金額</th>
<th style="width: 120px;">訂金<br>已收金額</th>
<th style="width: 120px;">訂金<br>催收金額</th>
<th style="width: 100px;">訂金<br>催收次數</th>
<th style="width: 120px;">二次款 <br>名稱</th>
<th style="width: 120px;">二次款<br>合約金額</th>
<th style="width: 120px;">二次款<br>應收金額</th>
<th style="width: 120px;">二次款<br>已開金額</th>
<th style="width: 120px;">二次款<br>已收金額</th>
<th style="width: 120px;">二次款<br>催收金額</th>
<th style="width: 100px;">二次款<br>催收次數</th>
<th style="width: 120px;">貨抵工地款 <br>名稱</th>
<th style="width: 120px;">貨抵工地款<br>合約金額</th>
<th style="width: 120px;">貨抵工地款<br>應收金額</th>
<th style="width: 120px;">貨抵工地款<br>已開金額</th>
<th style="width: 120px;">貨抵工地款<br>已收金額</th>
<th style="width: 120px;">貨抵工地款<br>催收金額</th>
<th style="width: 100px;">貨抵工地款<br>催收次數</th>
<th style="width: 120px;">安裝款 <br>名稱</th>
<th style="width: 120px;">安裝款<br>合約金額</th>
<th style="width: 120px;">安裝款<br>應收金額</th>
<th style="width: 120px;">安裝款<br>已開金額</th>
<th style="width: 120px;">安裝款<br>已收金額</th>
<th style="width: 120px;">安裝款<br>催收金額</th>
<th style="width: 100px;">安裝款<br>催收次數</th>
<th style="width: 120px;">試車款 <br>名稱</th>
<th style="width: 120px;">試車款<br>合約金額</th>
<th style="width: 120px;">試車款<br>應收金額</th>
<th style="width: 120px;">試車款<br>已開金額</th>
<th style="width: 120px;">試車款<br>已收金額</th>
<th style="width: 120px;">試車款<br>催收金額</th>
<th style="width: 100px;">試車款<br>催收次數</th>
<th style="width: 120px;">官檢驗收款 <br>名稱</th>
<th style="width: 120px;">官檢驗收款<br>合約金額</th>
<th style="width: 120px;">官檢驗收款<br>應收金額</th>
<th style="width: 120px;">官檢驗收款<br>已開金額</th>
<th style="width: 120px;">官檢驗收款<br>已收金額</th>
<th style="width: 120px;">官檢驗收款<br>催收金額</th>
<th style="width: 100px;">官檢驗收款<br>催收次數</th>
<th style="width: 120px;">交車款 <br>名稱</th>
<th style="width: 120px;">交車款<br>合約金額</th>
<th style="width: 120px;">交車款<br>應收金額</th>
<th style="width: 120px;">交車款<br>已開金額</th>
<th style="width: 120px;">交車款<br>已收金額</th>
<th style="width: 120px;">交車款<br>催收金額</th>
<th style="width: 100px;">交車款<br>催收次數</th>
<th style="width: 120px;">尾款 <br>名稱</th>
<th style="width: 120px;">尾款<br>合約金額</th>
<th style="width: 120px;">尾款<br>應收金額</th>
<th style="width: 120px;">尾款<br>已開金額</th>
<th style="width: 120px;">尾款<br>已收金額</th>
<th style="width: 120px;">尾款<br>催收金額</th>
<th style="width: 100px;">尾款<br>催收次數</th>
</tr>
</thead>
<tbody>
<?php
foreach ($arrayData as $key => $value) {
?>
<tr>
<th><?= $key ?></th>
<td style="text-align: center;"><?= $value['DeptId'] . "<br>" . $value['DeptName'] ?></td>
<td style="text-align: center;"><?= $value['ManagerId'] . "<br>" . $value['ManagerName'] ?></td>
<td style="text-align: center;"><?= $value['PersonId'] . "<br>" . $value['PersonName'] ?></td>
<td style="text-align: center;"><?= $value['CustomerId'] . "<br>" . $value['CustomerName'] ?></td>
<td style="text-align: end;"><?= $value['facility_status'] ?></td>
<td style="text-align: end;"><?= number_format(round($value['A40001'])) ?></td>
<td style="text-align: end;"><?= number_format(round($value['A40008'])) ?></td>
<td style="text-align: end;"><?= number_format(round($value['total_budget'])) ?></td>
<td style="text-align: end;"><?= number_format(round($value['receivable_budget'])) ?></td>
<td style="text-align: end;"><?= number_format(round($value['invoice_budget'])) ?></td>
<td style="text-align: end;"><?= number_format(round($value['received_budget'])) ?></td>
<td style="text-align: end;"><?= number_format(round($value['collect_budget'])) ?></td>
<td style="text-align: end;"><?= $value['collect_month'] ?></td>
<td style="text-align: end;"><?= $value['facility_num'] ?></td>
<td style="text-align: center;"><?= $excel_contract_array[$key][21] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][22] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][23] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][24] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][25] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][26] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][27] ?></td>
<td style="text-align: center;"><?= $excel_contract_array[$key][28] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][29] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][30] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][31] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][32] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][33] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][34] ?></td>
<td style="text-align: center;"><?= $excel_contract_array[$key][35] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][36] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][37] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][38] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][39] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][40] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][41] ?></td>
<td style="text-align: center;"><?= $excel_contract_array[$key][42] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][43] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][44] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][45] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][46] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][47] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][48] ?></td>
<td style="text-align: center;"><?= $excel_contract_array[$key][49] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][50] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][51] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][52] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][53] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][54] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][55] ?></td>
<td style="text-align: center;"><?= $excel_contract_array[$key][56] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][57] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][58] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][59] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][60] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][61] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][62] ?></td>
<td style="text-align: center;"><?= $excel_contract_array[$key][63] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][64] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][65] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][66] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][67] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][68] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][69] ?></td>
<td style="text-align: center;"><?= $excel_contract_array[$key][70] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][71] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][72] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][73] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][74] ?></td>
<td style="text-align: end;"><?= $excel_contract_array[$key][75] ?></td>
<td style="text-align: end;"><?= isset($excel_contract_array[$key][76]) ? $excel_contract_array[$key][76] : 0 ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<script>
function downloadData(content) {
if (content == 'all') {
var BillData = <?= $total_data ?>;
var filename = "全部應收帳款" + "<?= date('Ymd-Hm') ?>" + ".xlsx";
} else if (content == 'noboga') {
var BillData = <?= $noboga_data ?>;
var filename = "不含寶佳應收帳款" + "<?= date('Ymd-Hm') ?>" + ".xlsx";
} else if (content == 'boga') {
var BillData = <?= $boga_data ?>;
var filename = "寶佳應收帳款" + "<?= date('Ymd-Hm') ?>" + ".xlsx";
}
var xhr = new XMLHttpRequest();
var url = window.location.origin + "/wms/account-receivable-excel.php?type=newContract&<?= $token_link ?>";
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var link = document.createElement('a');
link.setAttribute('href', window.location.origin + "/wms/account-receivable-contract.xlsx");
link.setAttribute('download', filename);
link.style.display = 'none';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
}
xhr.send(JSON.stringify({
Bill: BillData
}));
}
</script>

47
wms/account-receivable-renovate-index.php

@ -9,11 +9,14 @@ $sum_A40002 = 0;
$sum_A40009 = 0;
// 安裝
$sum_A40010 = 0;
// M4
$sum_A40019 = 0;
$sum_total_budget = 0;
$average_budget = 0;
$average_A40002 = 0;
$average_A40009 = 0;
$average_A40010 = 0;
$average_A40019 = 0;
$start_date = empty($_POST['date_start']) ? null : $_POST['date_start'];
$end_date = empty($_POST['date_end']) ? null : $_POST['date_end'];
@ -116,11 +119,6 @@ FROM arWriteOffBillDetail
WHERE CheckDetail.ModeId = 'T'";
// 期初收款資訊
$sql_opening = "
SELECT * FROM account_received ";
$contractNumbers = array();
$query_contract_number = $conn->query($sql_contractNumber);
foreach ($query_contract_number as $contract_numbers) {
@ -258,7 +256,7 @@ foreach ($contract as $cont) {
$arrayData[$BillNo]['invoice'] = array();
$arrayData[$BillNo]['received_budget'] = 0;
$arrayData[$BillNo]['invoice_budget'] = 0;
$arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] = 0;
$arrayData[$BillNo]['A40002'] = $arrayData[$BillNo]['A40009'] = $arrayData[$BillNo]['A40010'] = $arrayData[$BillNo]['A40019'] = 0;
$arrayData[$BillNo]['total_facility_num'] = 0;
}
$arrayData[$BillNo]['PayStage'][$RowNo]['type'] = 0;
@ -280,7 +278,6 @@ foreach ($contract as $cont) {
}
}
$received_array = $conn->query($sql_received);
$opening_data = mysqli_query($link, $sql_opening);
$invoice_data = $conn->query($sql_invoice);
$contract_budget_data = $conn->query($sql_contract_budget);
@ -312,7 +309,7 @@ foreach ($contract_budget_data as $cont) {
} else {
$arrayData[$BillNo]['total_facility_num'] += 1;
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['total_budget'] = $cont['OAmountWithTax'];
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40002'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40009'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40010'] = 0;
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40002'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40009'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40010'] = $arrayData[$BillNo]['facility'][$cont['CU_MaterialId']]['A40019'] = 0;
$arrayData[$BillNo]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax'];
}
}
@ -335,6 +332,7 @@ foreach ($contract_budget_data as $cont) {
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40002'] = 0;
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40009'] = 0;
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40010'] = 0;
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']]['A40019'] = 0;
$contract_budget[$cont['BillNo']]['facility'][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax'];
};
}
@ -428,6 +426,7 @@ foreach ($wipwhole_array as $wip) {
$arrayData[$billno]['facility'][$wip['facilityno']]['A40002'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40002']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40002'])) ? $contract_budget[$billno][$wip['facilityno']]['A40002'] : 0;
$arrayData[$billno]['facility'][$wip['facilityno']]['A40008'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40008']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40008'])) ? $contract_budget[$billno][$wip['facilityno']]['A40008'] : 0;
$arrayData[$billno]['facility'][$wip['facilityno']]['A40010'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40010']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40010'])) ? $contract_budget[$billno][$wip['facilityno']]['A40010'] : 0;
$arrayData[$billno]['facility'][$wip['facilityno']]['A40019'] = (isset($contract_budget[$billno][$wip['facilityno']]['A40019']) && !is_null($contract_budget[$billno][$wip['facilityno']]['A40019'])) ? $contract_budget[$billno][$wip['facilityno']]['A40019'] : 0;
}
$wipwhole_status[$wip['facilityno']] = $wip;
}
@ -596,6 +595,18 @@ foreach ($received_array as $received) {
// }
}
}
//未在T8的收款資料
$sql_wms = "SELECT * FROM account_received WHERE type='T' ";
$query_wms = mysqli_query($link, $sql_wms);
foreach ($query_wms as $wms) {
if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['invoice_budget'])) {
$arrayData[$wms['BillNo']]['invoice_budget'] += $wms['invoice_budget'];
$arrayData[$wms['BillNo']]['invoice'][$wms['invoice_no']] = [date("Y-m-d", strtotime($wms['invoice_date'])), $wms['invoice_budget'], 1];
}
if (isset($arrayData[$wms['BillNo']]) && isset($arrayData[$wms['BillNo']]['received_budget'])) {
$arrayData[$wms['BillNo']]['received_budget'] += $wms['received_budget'];
}
}
// $final_paystage ['type'] ['PlanPayDate'] ['PayAmount'] ['facilityno'] ['sequenceNumber'] ['name'] ['InvoiceAmount'] ['receivedAmount']
foreach ($final_paystage as $key => &$payStage) {
if (isset($arrayData[$key]['invoice_budget']) && isset($arrayData[$key]['received_budget'])) {
@ -635,6 +646,7 @@ foreach ($final_paystage as $key => &$payStage) {
// 0 合約號 1 作番號 2 部門id 3 部門名稱 4 經理名稱 5 營業員id 6 營業員名稱 7 客戶名稱 8 抬頭 9 統編 10 通訊地址
// 11 收款階段名稱 12 應收日期 13 收款金額 14 已開金額 15 已收金額 16 催收次數
$excel_aray = array();
$print_array = array();
$today = strtotime(date('Ymt'));
foreach ($arrayData as $key => $value) {
if (isset($final_paystage[$key])) {
@ -659,6 +671,17 @@ foreach ($arrayData as $key => $value) {
$unReceivedAmount = 0;
break;
}
if ($havetopay == "V" && $unReceivedAmount > 1) {
$print_array[$keyname] = [
$value[10], $thisPayStage['facilityno'], $value[0], $value[1], $value[11], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8],
$thisPayStage['name'], $thisPayStage['PlanPayDate'], $havetopay,
number_format(round($final_paystage[$key][$sequence]['PayAmount'])),
number_format(round($final_paystage[$key][$sequence]['InvoiceAmount'])), number_format(round($unInvoiceAmount)),
number_format(round($final_paystage[$key][$sequence]['receivedAmount'])), number_format(round($unReceivedAmount)),
number_format(round($final_paystage[$key][$sequence]['collect_month']))
];
}
$excel_aray[$keyname] = [
$value[10], $thisPayStage['facilityno'], $value[0], $value[1], $value[11], $value[2], $value[3], $value[4], $value[5], $value[6], $value[7], $value[8],
$thisPayStage['name'], $thisPayStage['PlanPayDate'], $havetopay,
@ -671,7 +694,7 @@ foreach ($arrayData as $key => $value) {
}
}
}
$total_data = json_encode($excel_aray);
$total_data = json_encode($print_array);
?>
<style>
@ -772,7 +795,11 @@ include "./footer.php";
<td><?= $row[13]; ?></td>
<td><?= $row[14]; ?></td>
<td><?= $row[15]; ?></td>
<td><?php if($row[14] == 'V' && $row[19]>0){echo $row[15];}else{echo '0';} ?></td>
<td><?php if ($row[14] == 'V' && $row[19] > 0) {
echo $row[15];
} else {
echo '0';
} ?></td>
<td><?= $row[16]; ?></td>
<td><?= $row[17]; ?></td>
<td><?= $row[18]; ?></td>

BIN
wms/account-receivable-renovate.xlsx

Binary file not shown.

44
wms/account-receivable-repair-index.php

@ -203,6 +203,21 @@ foreach ($received_array as $received) {
$arrayData[$received['OrderBillNo']]['received_budget'] += $received['CurrStandOffOAmount'];
}
}
//未在T8的收款資料
$sql_wms = "SELECT * FROM account_received WHERE type='Z' ";
$query_wms = mysqli_query($link, $sql_wms);
foreach ($query_wms as $wms) {
if (isset($arrayData[$wms['BillNo']]) && isset($wms['invoice_budget']) && isset($wms['invoice_no']) && isset($arrayData[$wms['BillNo']]['invoice_budget'])) {
$arrayData[$wms['BillNo']]['invoice_budget'] += $wms['invoice_budget'];
if (isset($arrayData[$wms['BillNo']]['invoice'][$wms['invoice_no']])) {
$arrayData[$wms['BillNo']]['invoice'][$wms['invoice_no']] += $wms['invoice_budget'];
}
}
if (isset($arrayData[$wms['BillNo']]) && isset($wms['received_budget']) && isset($arrayData[$wms['BillNo']]['received_budget'])) {
$arrayData[$wms['BillNo']]['received_budget'] += $wms['received_budget'];
}
}
foreach ($arrayData as $key => &$value) {
@ -239,10 +254,12 @@ foreach ($arrayData as $key => &$value) {
}
$excel_aray = array();
$print_array = array();
foreach ($arrayData as $key => $value) {
$uninvoice_budget = $value['OAmountWithTax'] - $value['invoice_budget'];
$unreceive_budget = $value['receivable_budget'] - $value['received_budget'];
$collect_month = $value['month']==0? '0':$value['month'];
$excel_aray[$key] = [
$value['BillNo'], date('Y-m-d', strtotime($value['BillDate'])), $value['CustomerId'], $value['CustomerName'],
@ -250,11 +267,22 @@ foreach ($arrayData as $key => $value) {
$value['ManagerId'], $value['ManagerName'],
number_format(round($value['OAmountWithTax'])), number_format(round($value['receivable_budget'])),
number_format(round($value['invoice_budget'])), number_format(round($uninvoice_budget)),
number_format(round($value['received_budget'])), $unreceive_budget, $value['month']
number_format(round($value['received_budget'])), $unreceive_budget, $collect_month
];
if ($excel_aray[$key][14] > 1) {
$print_array[$key] = [
$value['BillNo'], date('Y-m-d', strtotime($value['BillDate'])), $value['CustomerId'], $value['CustomerName'],
$value['DeptName'], $value['PersonId'], $value['PersonName'],
$value['ManagerId'], $value['ManagerName'],
number_format(round($value['OAmountWithTax'])), number_format(round($value['receivable_budget'])),
number_format(round($value['invoice_budget'])), number_format(round($uninvoice_budget)),
number_format(round($value['received_budget'])), $unreceive_budget, $collect_month
];
}
}
$total_data = json_encode($excel_aray);
$total_data = json_encode($print_array);
?>
<style>
@ -385,11 +413,12 @@ include "./footer.php";
<tr>
<th style='text-align:center;vertical-align: middle;width:140px'>合約號</th>
<th style='text-align:center;vertical-align: middle;width:100px'>合約日期</th>
<th style='text-align:center;vertical-align: middle;'>客戶編號</th>
<th style='text-align:center;vertical-align: middle;width:140px'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;width:110px'>部門</th>
<th style='text-align:center;vertical-align: middle;'>主管</th>
<th style='text-align:center;vertical-align: middle;'>契約員</th>
<th style='text-align:center;vertical-align: middle;'>保養員</th>
<th style='text-align:center;vertical-align: middle;'>客戶編號</th>
<th style='text-align:center;vertical-align: middle;width:140px'>客戶名稱</th>
<th style='text-align:center;vertical-align: middle;'>合約總金額</th>
<th style='text-align:center;vertical-align: middle;'>應收金額</th>
<th style='text-align:center;vertical-align: middle;'>已開金額</th>
@ -405,11 +434,12 @@ include "./footer.php";
<tr class="data-row" style="display: '';" id="<?= $key; ?>">
<td style='text-align:center;vertical-align: middle;' class="contract"><?= $row[0]; ?></td>
<td style='text-align:center;vertical-align: middle;' class="contractdate"><?= $row[1]; ?></td>
<td style='text-align:center;vertical-align: middle;' class="customerid"><?= $row[2] ?></td>
<td style='text-align:center;vertical-align: middle;' class="customername"><?= $row[3] ?></td>
<td style='text-align:center;vertical-align: middle;' class="department"><?= $row[4] ?></td>
<td style='text-align:center;vertical-align: middle;' class="manager"><?= $row[7] . "<br>" . $row[8]; ?></td>
<td style='text-align:center;vertical-align: middle;' class="personId"><?= $row[5] . "<br>" . $row[6]; ?></td>
<td style='text-align:center;vertical-align: middle;' class="customerid"><?= $row[2] ?></td>
<td style='text-align:center;vertical-align: middle;' class="customername"><?= $row[3] ?></td>
<td style='text-align:end;vertical-align: middle;' class="total_budget"><?= $row[9]; ?></td>
<td style='text-align:end;vertical-align: middle;' class="receivable_budget"><?= $row[10]; ?></td>
<td style='text-align:end;vertical-align: middle;' class="invoice_budget"><?= $row[11]; ?></td>

BIN
wms/account-receivable-repair.xlsx

Binary file not shown.

2
wms/account-receivable.txt

File diff suppressed because one or more lines are too long

111
wms/bonus/api/postStatus.php

@ -0,0 +1,111 @@
<?php
require_once("../../contract/conn.php");
if (!empty($_POST['id']) && !empty($_POST['postType']) && $_POST['postType'] == 'a') {
try {
$id = empty($_POST['id']) ? '' : $_POST['id'];
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id'];
$amount = empty($_POST['amount']) ? '' : $_POST['amount'];
$pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day'];
$review_at = date("Y-m-d H:i:s");
$sql = "UPDATE bonus SET status = 2 ,bonus_actual='$amount',review_hr = '$user_id' ,review_at = '$review_at',pay_day ='$pay_day',update_id='$user_id',update_at='$review_at' WHERE id = $id";
$stmt = $conn->prepare($sql);
$stmt->execute();
header("HTTP/1.1 200 success!");
echo 'Success';
} catch (PDOException $e) {
header("HTTP/1.1 404 failed!");
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
}
// 獎金確認發放,並更新獎金 OR 實際發放時間
if (!empty($_POST['postType']) && $_POST['postType'] == 'b') {
try {
$id = empty($_POST['id']) ? '' : $_POST['id'];
$pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day'];
$bonus_actual = empty($_POST['bonus_actual']) ? '' : $_POST['bonus_actual'];
$note = empty($_POST['note']) ? '' : $_POST['note'];
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id'];
$review_at = date("Y-m-d H:i:s");
if ($pay_day != '' && $bonus_actual != '') {
$sql = "UPDATE bonus SET status = 2,review_hr='$user_id',review_at='$review_at',bonus_actual='$bonus_actual',pay_day='$pay_day',note='$note' WHERE id = $id";
$stmt = $conn->prepare($sql);
$stmt->execute();
header("HTTP/1.1 200 success!");
} else {
header("HTTP/1.1 400");
echo '請填寫發放時間和實發獎金';
}
} catch (PDOException $e) {
header("HTTP/1.1 404 failed!");
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
}
// 獎金暫不發放
if (!empty($_POST['postType']) && $_POST['postType'] == 'c') {
// echo 'cccccc';
try {
$id = empty($_POST['id']) ? '' : $_POST['id'];
$pay_day = empty($_POST['pay_day']) ? '' : $_POST['pay_day'];
$bonus_actual = empty($_POST['bonus_issue']) ? '' : $_POST['bonus_issue'];
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id'];
$note = empty($_POST['note']) ? '' : $_POST['note'];
$review_at = date("Y-m-d H:i:s");
if ($note != '') {
$sql = "UPDATE bonus SET status = 4,review_hr='$user_id',review_at='$review_at',pay_day='$pay_day',note='$note' WHERE id = $id";
echo $sql;
$stmt = $conn->prepare($sql);
$stmt->execute();
header("HTTP/1.1 200 success!");
} else {
echo '請填寫備註!!';
header("HTTP/1.1 400!");
}
} catch (PDOException $e) {
header("HTTP/1.1 404 failed!");
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
}
if (!empty($_POST['postType']) && $_POST['postType'] == 'd') {
try {
$id = empty($_POST['id']) ? '' : $_POST['id'];
$review_at = date("Y-m-d H:i:s");
$user_id = empty($_POST['user_id']) ? '' : $_POST['user_id'];
$sql = "SELECT * FROM bonus WHERE id IN ($id)";
$stmt = $conn->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$conn->beginTransaction();
foreach ($results as $result) {
// echo '<pre>';
// print_r($result);
// echo '</pre>';
// exit();
$amount = $result['amount'];
$id = $result['id'];
$pay_day = $result['pay_day_due'];
$sql = "UPDATE bonus SET status = 5 ,bonus_actual='$amount',review_hr = '$user_id' ,review_at = '$review_at',pay_day ='$pay_day' WHERE id = $id";
$stmt = $conn->prepare($sql);
$stmt->execute();
}
$conn->commit();
header("HTTP/1.1 200 success!");
} catch (PDOException $e) {
$conn->rollBack();
header("HTTP/1.1 404 failed!");
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
// echo 'ddddd';
}

158
wms/bonus/bonus.php

@ -2,7 +2,7 @@
include_once("../header.php");
// require_once('./connT8.php');
require("../contract/conn.php");
$now = date("Y-m-d");
$contract_type = [
'1' => '新梯',
@ -15,18 +15,32 @@ $bonus_type = [
'2' => '區經理獎金',
'3' => '專任契約經理獎金'
];
$bonus_status = [
'1' => '未確認',
'2' => '應發已確認',
'3' => '應發未確認',
'4' => '暫不發放',
'5' => '人事審核確認'
];
$clause = '';
if ($user_id != 'M0225') {
$clause .= "AND receiver == '$user_id'";
}
if (!empty($_GET['check'])) {
if ($_GET['check'] == 1) {
$clause .= "AND pay_day > DATE_SUB(NOW(), INTERVAL 1 MONTH)";
// 人事發放作業,應為一個月內
if ($_GET['check'] == 4) {
$oneMonthAgo = date("Y-m-d", strtotime("$now +1 months"));
// $clause .= "AND pay_day_due >= '$now' AND pay_day_due <= '$oneMonthAgo' AND status IN (1,2,5)";
$clause .= "AND status IN (1,2,5)";
} else if ($_GET['check'] == 2) {
$clause .= "AND status = 1";
} else if ($_GET['check'] == 3) {
$clause .= "AND status = 2";
$clause .= "AND status IN (2,5)";
}
}
$sql = "SELECT * FROM bonus WHERE 1=1 $clause LIMIT 50";
$sql = "SELECT * FROM bonus WHERE 1=1 $clause";
$stmt = $conn->prepare($sql);
$stmt->execute();
$datas = $stmt->fetchAll(PDO::FETCH_ASSOC);
@ -35,6 +49,13 @@ $datas = $stmt->fetchAll(PDO::FETCH_ASSOC);
$now = new DateTime();
$oneMonthAgo = $now->modify('+1 month');
$id = [];
foreach ($datas as $data) {
$id[] = $data['id'];
}
$id_str = implode(',', $id);
// 查看 T8 是否有收款明細
// require("./api/get.php");
function isPay($contract_no, $connT8)
@ -98,19 +119,23 @@ function isPay($contract_no, $connT8)
<script src="../contract-repair/js/axios/axios.min.js"></script>
<!-- <script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script> -->
<script src="../contract-repair/semantic/dist/semantic.min.js"></script>
<div class="bonus_index">
<!-- <input type="button" hidden x-ref="initbtn" @click="isPay()" /> -->
<div class="bonus_index" x-data="bonusIndexTest">
<div class="form" method="post" id="form" enctype="multipart/form-data">
<div style="overflow-x:auto;margin-top:12px">
<a href="bonus_index1.php?function_name=bonus&token=<?php echo $token; ?>" class="btn btn-info btn-sm">
<!-- <a href="bonus_index1.php?function_name=bonus&token=<?php echo $token; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
</a> -->
<a href="/wms/bonus/bonus.php?function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (!isset($_GET['check'])) ? "btn btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 所有獎金</a>
<a href="/wms/bonus/bonus.php?check=1&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 1) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 應發獎金</a>
<!-- <a href="/wms/bonus/bonus.php?check=1&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 1) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 應發獎金</a> -->
<a href="/wms/bonus/bonus.php?check=2&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 2) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 未發獎金</a>
<a href="/wms/bonus/bonus.php?check=3&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 3) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 已發獎金</a>
<a href="/wms/bonus/bonus.php?check=4&function_name=bonus&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 4) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 人事發放作業</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<?php if (!empty($_GET['check']) && $_GET['check'] == '4') { ?>
<button class="btn btn-primary float-end" style="float: right;" onclick="All('<?= $id_str ?>')">鎖定並發放</button>
<?php } ?>
<thead>
<tr>
<th>項次</th>
@ -119,15 +144,24 @@ function isPay($contract_no, $connT8)
<th>作番號</th>
<th>獎金類別</th>
<th>獎金版本</th>
<th>作番總價</th>
<th>作番金額(月)</th>
<th>牌價</th>
<th>服務費</th>
<th>應發人員</th>
<th>預計發放時間</th>
<th>獎金水庫</th>
<!-- <th>是否發放</th> -->
<th>應發獎金水庫</th>
<th>實發金額</th>
<th>狀態</th>
<th>檢視/發放</th>
<?php
if (!empty($_GET['check']) && $_GET['check'] == '4') {
?>
<th>實際發放時間</th>
<th>發放 / 詳情</th>
<?php } else { ?>
<th>詳情</th>
<?php
} ?>
</tr>
</thead>
<tbody>
@ -136,11 +170,10 @@ function isPay($contract_no, $connT8)
$contract_no = $data['contract_no'];
$json = json_decode($data['bonus_json']);
$total = empty($json->total) ? 0 : $json->total;
$fee_per_st = empty($json->fee_per_st) ? 0 : $json->fee_per_st;
$commission_fee = empty($json->commission_fee) ? 0 : $json->commission_fee;
$isPay = isPay($data['contract_no'], $connT8);
// $isPay = isPay($data['contract_no'], $connT8);
?>
<tr>
@ -150,33 +183,45 @@ function isPay($contract_no, $connT8)
<td><?= $data['facility_no'] ?></td>
<td><?= $bonus_type[$data['bonus_type']] ?></td>
<td><?= $data['bonus_verson'] ?></td>
<td><?= $total ?></td>
<td><?= $fee_per_st ?></td>
<td><?= $total ?></td>
<td><?= $commission_fee ?></td>
<td><?= $data['receiver'] ?></td>
<td><?= $data['pay_day'] ?></td>
<td><?= $data['pay_day_due'] ?></td>
<td><?= $data['amount'] ?></td>
<!-- <td><?= ($data['status'] == 1) ? '未發放' : '已發放' ?></td> -->
<td><?= $data['bonus_actual'] ?></td>
<td>
<!-- <input type="text" x-model="isPays[<?php echo $key; ?>]" /> -->
<span><?= ($isPay == 1) ? '已收款' : '未收款' ?></span>
<?= $bonus_status[$data['status']] ?>
<!-- <span><?= ($isPay == 1) ? '已收款' : '未收款' ?></span> -->
</td>
<?php if (!empty($_GET['check']) && $_GET['check'] == '4') {
if ($data['status'] == '3' || $data['status'] == '1') { ?>
<td> -- </td>
<td>
<?php
// 判斷時間是否為一個月內
$payday = new DateTime($data['pay_day']);
if ($isPay == 1) {
// if ($isPay == 1) {
?>
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtn" style="">發放獎金</a>
<button onclick="issue(<?= $data['id'] ?>,'<?= $user_id ?>','<?= $data['pay_day_due'] ?>','<?= $data['amount'] ?>')" type="button" class="btn applybtn" name='issuePay'>發放獎金</button>
<?php
} else if ($payday < $oneMonthAgo) {
// } else if ($payday < $oneMonthAgo) {
?>
<a href="bonus_detail.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a>
<?php
}
// }
?>
</td>
<!-- <td><input type="date" value="<?= $data['pay_day'] ?>"></td> -->
<?php } else { ?>
<td><?= $data['pay_day'] ?></td>
<td><a href="bonus_check.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a></td>
<?php }
} else { ?>
<td><a href="bonus_check.php?id=<?= $data['id'] ?>&token=<?php echo $token; ?>" class="applybtncheck">查看詳情</a></td>
<?php } ?>
</tr>
<?php
endforeach;
@ -184,9 +229,10 @@ function isPay($contract_no, $connT8)
</tbody>
</table>
</div>
</div>
</div>
<!-- </div> -->
<style>
<style>
table {
table-layout: fixed;
width: 100%;
@ -196,7 +242,7 @@ function isPay($contract_no, $connT8)
word-wrap: break-word;
}
.width_style_1 {
.width_st yle_1 {
width: 125px;
}
@ -237,13 +283,13 @@ function isPay($contract_no, $connT8)
background-color: #1484c4;
/* display: block; */
border-radius: 5px;
padding: 5px 2px;
/* padding: 5px 2px; */
font-size: 13px;
line-height: 1;
display: grid;
place-items: center;
/* 水平和垂直居中 */
height: 2%vh;
/* height: 2%vh; */
/* 100%视窗高度,可根据需要调整 */
}
@ -271,11 +317,51 @@ function isPay($contract_no, $connT8)
background-color: #1494f9;
color: #fff;
}
</style>
</style>
<script>
<script>
const datas = <?php echo json_encode($datas); ?>;
function issue(id, user_id, pay_day, amount) {
// console.log(id);
const form = new FormData();
form.append('id', id)
form.append('user_id', user_id);
form.append('pay_day', pay_day)
form.append('amount', amount);
form.append('postType', 'a');
axios.post('./api/postStatus.php', form).then((res) => {
if (res.data == 'Success') {
alert('更新成功');
location.reload();
}
}).catch((err) => {
})
}
function All(data) {
let arr = data.split(",");
const form = new FormData();
form.append('id', arr);
form.append('user_id', '<?= $user_id ?>')
form.append('postType', 'd');
if (confirm('是否發放全部獎金')) {
axios.post('./api/postStatus.php', form).then((res) => {
if (res.status == 200) {
alert('更新成功');
location.reload();
}
}).catch((err) => {
});
}
}
// $(function() {
// $("button[name=issuePay]").click(function() {
// console.log(123);
// })
// })
// function init() {
// this.isPay();
@ -298,4 +384,4 @@ function isPay($contract_no, $connT8)
// }
// }
// }
</script>
</script>

199
wms/bonus/bonus_check.php

@ -0,0 +1,199 @@
<?php
include('../header.php');
require_once('../contract-repair/conn.php');
$sql = "SELECT * FROM bonus WHERE id = :id";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':id', $_GET['id']);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// echo '<pre>';
// print_r($result['bonus_json']);
// echo '</pre>';
$bonus_json = json_decode($result['bonus_json']);
$paykind = [
'monthly' => '月繳',
'bimonthly' => '雙月繳',
'quarterly' => '季繳',
'semiannually' => '半年繳',
'annually' => '年繳'
];
$maintain_type = [
'new' => '新簽約',
'free_to_charge' => '免保轉有費',
'renew_priceissue' => '續簽約'
];
?>
<link rel="stylesheet" href="../contract-repair/styles/style.css">
<link rel="stylesheet" href="../contract-repair/semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="../contract-repair/js/alpine.js"></script>
<script defer src="../contract-repair/js/alpinejs/cdn.min.js"></script>
<script src="../contract-repair/js/axios/axios.min.js"></script>
<script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script>
<script src="../contract-repair/semantic/dist/semantic.min.js"></script>
<div class="bonuns_index" x-data="bonunsIndex">
<div class="form" method="post" id="form" enctype="multipart/form-data">
<input type="hidden" name="form_name" value="main_form">
<div>
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
<thead>
<tr>
<td colspan="8">
<h3 style='text-align:center'>獎金計算</h3>
</td>
</tr>
</thead>
<template x-if="step==1">
<tbody style="font-weight: bolder;margin-bottom:20px">
<tr>
<td colspan="7" style="vertical-align:middle;border-right:0px">
<h4>獎金確認項</h4>
</td>
<td class="text-right" style="border: left 0px;">
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button>
</td>
</tr>
<tr>
<td style="vertical-align:middle">合約號</td>
<td>
<input type="text" x-model="data.contract_no" disabled="disabled">
</td>
<td style="vertical-align:middle">合約類別</td>
<td>
<select id="contract_type" x-model="data.contract_type" disabled="disabled">
<option value="">--請選擇--</option>
<option value="1">新梯</option>
<option value="2">汰改</option>
<option value="3">保養</option>
</select>
<p class="alerttext" x-show="data.contract_type==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align:middle">作番號</td>
<td>
<input type="text" x-model="data.facility_no" disabled="disabled">
</td>
<td style="vertical-align:middle">獎金適用版本</td>
<td>
<input type="text" x-model="data.bonus_verson" disabled="disabled">
</td>
</tr>
<tr>
<td style="vertical-align:middle">保養類別</td>
<td>
<input type="text" x-model="data.maintain_type" disabled>
</td>
<td style="vertical-align:middle">付款方式</td>
<td>
<input type="text" x-model="data.pay_kind" disabled>
</td>
<td style="vertical-align:middle">合約付款日</td>
<td>
<input type="text" x-model="data.receivable_date_due" disabled>
</td>
<td style="vertical-align:middle">應發獎金</td>
<td>
<input type="text" x-model="data.maintain_price_total" disabled>
</td>
</tr>
<tr>
<td style="vertical-align:middle">作番總價</td>
<td>
<input type="text" x-model="data.total" disabled>
</td>
<td style="vertical-align:middle">牌價</td>
<td>
<input type="text" x-model="data.fee_per_st" disabled>
</td>
<td style="vertical-align:middle">服務費</td>
<td>
<input type="text" x-model="data.commission_fee" disabled>
</td>
<td style="vertical-align:middle">價率</td>
<td>
<input type="text" x-model="data.discount" disabled>
</td>
</tr>
<tr>
<td style="vertical-align:middle">實發獎金</td>
<td>
<input type="text" x-model="data.bonus_actual" disabled>
</td>
<td style="vertical-align:middle">實發時間</td>
<td> <input class="form-control disabled_select" type="date" x-model="data.payDay" disabled>
</td>
<td style="vertical-align:middle">備註</td>
<td><input type="text" x-model='data.note' disabled></td>
<td></td>
<td></td>
</tr>
</tbody>
</template>
</table>
<!-- <button x-show=" step==1" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>確認</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
<button x-show=" step==1" @click="stop()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>暫不發放</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button> -->
<!-- <button x-show="step<=2" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<template x-if="!isLoading">
<span>下一步</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
<button x-show="step>1" @click="preStepFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>上一步</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button> -->
</div>
</div>
</div>
<script>
const user_id = '<?= $user_id ?>';
const id = '<?= $_GET['id'] ?>';
const contract_no = '<?= $result['contract_no'] ?>';
const facility_no = '<?= $result['facility_no'] ?>';
const bonus_verson = '<?= $result['bonus_verson'] ?>';
const receiver = '<?= $result['receiver'] ?>';
const payDaydue = '<?= $result['pay_day'] ?>';
const maintain_price_total = '<?= $result['amount'] ?>';
const contract_type = '<?= $result['contract_type'] ?>';
// const bonus_verson = '<?= $result['bonus_verson'] ?>';
const maintain_type = '<?= $maintain_type[$bonus_json->contract_type] ?>';
const pay_kind = '<?= $paykind[$bonus_json->paykind] ?>';
const receivable_date_due = '<?= $bonus_json->receivable_date_due ?>';
const total = '<?= $bonus_json->total ?>';
const fee_per_st = '<?= $bonus_json->fee_per_st ?>';
const commission_fee = '<?= $bonus_json->commission_fee ?>';
const discount = '<?= $bonus_json->discount ?>'
const bonus_actual = '<?= $result['bonus_actual'] ?>';
const payDay = '<?= $result['pay_day'] ?>';
const note = '<?= $result['note'] ?>'
</script>

34
wms/bonus/bonus_detail.php

@ -48,17 +48,6 @@ $maintain_type = [
</td>
</tr>
</thead>
<!-- <template x-if="step==1">
<tbody style="font-weight: bolder;margin: botton 20px;">
<tr>
<td style="vertical-align: middle;">合約號</td>
<td colspan="5">
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contract_no" x-model="data.contract_no">
</td>
<td colspan="2" style="vertical-align:middle"></td>
</tr>
</tbody>
</template> -->
<template x-if="step==1">
<tbody style="font-weight: bolder;margin-bottom:20px">
@ -111,7 +100,7 @@ $maintain_type = [
</td>
<td style="vertical-align:middle">應發獎金</td>
<td>
<input type="text" x-model="data.maintain_price_total" disabled>
<input type="text" x-model="data.maintain_price_total">
</td>
</tr>
<tr>
@ -133,6 +122,17 @@ $maintain_type = [
</td>
</tr>
<tr>
<td style="vertical-align:middle">實發獎金</td>
<td>
<input type="text" x-model="data.bonus_actual">
</td>
<td style="vertical-align:middle">實發時間</td>
<td> <input class="form-control disabled_select" type="date" x-model="data.payDay">
</td>
<td style="vertical-align:middle">備註</td>
<td><input type="text" x-model='data.note'></td>
</tr>
</tbody>
</template>
</table>
@ -145,6 +145,14 @@ $maintain_type = [
<div class="loader"></div>
</template>
</button>
<button x-show=" step==1" @click="stop()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>暫不發放</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
<!-- <button x-show="step<=2" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<template x-if="!isLoading">
<span>下一步</span>
@ -176,7 +184,7 @@ $maintain_type = [
const maintain_price_total = '<?= $result['amount'] ?>';
const contract_type = '<?= $result['contract_type'] ?>';
// const bonus_verson = '<?= $result['bonus_verson'] ?>';
const maintain_type = '<?= $maintain_type[$bonus_json->maintain_type] ?>';
const maintain_type = '<?= $maintain_type[$bonus_json->contract_type] ?>';
const pay_kind = '<?= $paykind[$bonus_json->paykind] ?>';
const receivable_date_due = '<?= $bonus_json->receivable_date_due ?>';
const total = '<?= $bonus_json->total ?>';

218
wms/bonus/elevator_new/elevator_new_deal_bonus.php

@ -0,0 +1,218 @@
<?php
function elevator_new_deal_bonus_v2_0($ver, $contract_type, $elevator_type, $elevator_list_price, $elevator_knockdown_price, $sales_id, $region_manger_id)
{
$bonus_array = [];
if ($ver == "2.0") {
$discount = round($elevator_knockdown_price / $elevator_list_price, 3); #銷售點數,取到小數點第三位。
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer)
switch ($contract_type) {
case "strategy_customer":
#契約員獎金($sales_bonus)
$sales_bonus = $elevator_knockdown_price * 0.007;
#地區經理提成獎金($region_manager_bonus)
$region_manager_bonus = 400;
break;
case "general_customer":
switch ($elevator_type) {
#客梯(passenger)、貨梯(cargo)
case ($elevator_type == "passenger" or $elevator_type == "cargo"):
switch ($discount) {
case ($discount >= 1.0):
$sales_bonus = $elevator_knockdown_price * 0.02;
break;
case ($discount >= 0.9 and $discount < 1.0):
$sales_bonus = $elevator_knockdown_price * 0.018;
break;
case ($discount >= 0.75 and $discount < 0.9):
$sales_bonus = $elevator_knockdown_price * 0.015;
break;
case ($discount < 0.75):
$sales_bonus = $elevator_knockdown_price * 0.008;
break;
};
break;
#小電梯(dumbwaiter)、平台梯(flatbase)、強驅(positive_drive)
case ($elevator_type == "dumbwaiter" or $elevator_type == "flatbase" or $elevator_type == "positive_drive"):
switch ($discount) {
case ($discount >= 1.0):
$sales_bonus = $elevator_knockdown_price * 0.02;
break;
case ($discount >= 0.9 and $discount < 1.0):
$sales_bonus = $elevator_knockdown_price * 0.018;
break;
case ($discount >= 0.72 and $discount < 0.9):
$sales_bonus = $elevator_knockdown_price * 0.015;
break;
case ($discount < 0.72):
$sales_bonus = $elevator_knockdown_price * 0.008;
break;
};
break;
};
#區域經理提成獎金($region_manager_bonus)
$region_manager_bonus = 600;
break;
};
#營銷人員銷售獎金水庫-----訂金已收款20%,發放總獎金20%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.2), #金額
"payment_schedul_due" => "deposit", #訂金已收款20%
"payment_schedul_regulation" => "訂金已收款20%,發放總獎金20%" #發放規定
]);
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.5), #金額
"payment_schedul_due" => "shipping", #訂金已收款20%
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%" #發放規定
]);
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.3), #金額
"payment_schedul_due" => "acceptance", #訂金已收款20%
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%" #發放規定
]);
#區域經理提成獎金水庫-----訂金已收款100%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus * 0.5), #金額
"payment_schedul_due" => "deposit", #訂金已收款100%
"payment_schedul_regulation" => "訂金已收款100%,發放總獎金50%" #發放規定
]);
#區域經理獎金水庫-----貨到工地款(含)之前所有款項已收款100%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-貨到工地款段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus * 0.5), #金額
"payment_schedul_due" => "deliveried", #貨到工地款(含)之前所有款項已收款100%
"payment_schedul_regulation" => "貨到工地款(含)之前所有款項已收款100%,發放總獎金50%" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "success", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
} else {
array_push($bonus_array, [
"bonus_type" => "error", #獎金名稱
"bonus_receiver" => "error", #發放人員
"bonus_amount" => 0, #金額
"payment_schedul_due" => "9999-1-1", #預計發放時間
"payment_schedul_regulation" => "error" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "error", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
};
return $result_array;
};
function elevator_new_deal_bonus_v1_0($ver, $contract_type, $elevator_knockdown_price, $sales_id, $region_manger_id)
{
$bonus_array = [];
if ($ver == "1.0") {
#合約總類($contract_type):戰略客戶(strategy_customer)、一般客戶(general_customer)
switch ($contract_type) {
case "strategy_customer":
#契約員獎金($sales_bonus)
$sales_bonus = $elevator_knockdown_price * 0.007;
#地區經理經理獎金($region_manager_bonus)
$region_manager_bonus = 400;
break;
case "general_customer":
#契約員獎金($sales_bonus)
$sales_bonus = $elevator_knockdown_price * 0.015;
#區域經理獎金($region_manager_bonus)
$region_manager_bonus = 600;
break;
};
#營銷人員銷售獎金水庫-----訂金已收款20%,發放總獎金20%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-訂金段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.2), #金額
"payment_schedul_due" => "deposit", #訂金已收款20%
"payment_schedul_regulation" => "訂金已收款20%,發放總獎金20%" #發放規定
]);
#營銷人員銷售獎金水庫-----出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-出貨款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.5), #金額
"payment_schedul_due" => "shipping", #訂金已收款20%
"payment_schedul_regulation" => "出貨前期所有款項已收齊,且出貨款已收款50%,發放總獎金50%" #發放規定
]);
#營銷人員銷售獎金水庫-----驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%
array_push($bonus_array, [
"bonus_type" => "營銷人員銷售獎金-驗收款段", #獎金名稱
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus * 0.3), #金額
"payment_schedul_due" => "acceptance", #訂金已收款20%
"payment_schedul_regulation" => "驗收前期所有款項已收齊,且驗收款已收款30%,發放總獎金30%" #發放規定
]);
#區域經理獎金水庫-----訂金已收款100%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-訂金段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus * 0.5), #金額
"payment_schedul_due" => "deposit", #訂金已收款100%
"payment_schedul_regulation" => "訂金已收款100%,發放總獎金50%" #發放規定
]);
#區域經理獎金水庫-----貨到工地款(含)之前所有款項已收款100%,發放總獎金50%
array_push($bonus_array, [
"bonus_type" => "區域經理提成獎金-貨到工地款段", #獎金名稱
"bonus_receiver" => $region_manger_id, #發放人員
"bonus_amount" => round($region_manager_bonus * 0.5), #金額
"payment_schedul_due" => "deliveried", #貨到工地款(含)之前所有款項已收款100%
"payment_schedul_regulation" => "貨到工地款(含)之前所有款項已收款100%,發放總獎金50%" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "success", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
} else {
array_push($bonus_array, [
"bonus_type" => "error", #獎金名稱
"bonus_receiver" => "error", #發放人員
"bonus_amount" => 0, #金額
"payment_schedul_due" => "9999-1-1", #預計發放時間
"payment_schedul_regulation" => "error" #發放規定
]);
$result_array = [
"ver" => $ver, #獎金版本
"result_status" => "error", #計算結果
"bonus_array" => $bonus_array #獎金水庫
];
};
return $result_array;
};

36
wms/bonus/other/maintenance_contract_bonus_v2_1.php

@ -41,7 +41,7 @@ result_array[
function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id)
function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id = '')
{
$bonus_array = [];
if ($ver == "2.1") {
@ -54,13 +54,13 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
switch ($discount) {
case ($discount >= 0.8):
switch ($fee_per_st) {
case ($fee_per_st < 3000):
case ($fee_per_st <= 3000):
$sales_bonus = ($fee_per_st - $commission_fee) * 0.6;
break;
case ($fee_per_st >= 3000 and $fee_per_st < 3500):
case ($fee_per_st >= 3001 and $fee_per_st <= 3499):
$sales_bonus = ($fee_per_st - $commission_fee) * 0.7;
break;
case ($fee_per_st >= 3500 and $fee_per_st < 4000):
case ($fee_per_st >= 3500 and $fee_per_st <= 3999):
$sales_bonus = ($fee_per_st - $commission_fee) * 0.8;
break;
case ($fee_per_st >= 4000):
@ -157,19 +157,19 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $region_director_id, #發放人員
"bonus_amount" => round($region_director_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "第1次款項收回後,次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "第1次款項收回後,次月發放" #發放規定
]);
#專任契約經理獎金
if ($regular_contract_manger_id != '') {
array_push($bonus_array, [
"bonus_type" => "3", #獎金名稱
"bonus_receiver" => $regular_contract_manger_id, #發放人員
"bonus_amount" => round($regular_contract_manger_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "第1次款項收回後,次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "第1次款項收回後,次月發放" #發放規定
]);
}
#契約員獎金
switch ($payment_period) {
@ -180,9 +180,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($sales_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +1 months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
break;
@ -201,9 +199,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
@ -223,9 +219,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
@ -245,9 +239,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;
@ -267,9 +259,7 @@ function maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period,
"bonus_receiver" => $sales_id, #發放人員
"bonus_amount" => round($current_bonus), #金額
"pay_day_due" => date("Y-m-d", strtotime("$receivable_date_due +$payday_due_array[$i] months")), #預計發放時間
"bonus_regulation" => "每月收款後,按收款比率次月發放", #發放規定
'discount' => $discount //折扣率
"bonus_regulation" => "每月收款後,按收款比率次月發放" #發放規定
]);
}
break;

417
wms/bonus/other/maintenance_contract_bonus_v2_1_examination.php

@ -48,219 +48,236 @@ require_once("maintenance_contract_bonus_v2_1.php");
#獎金測試
$examination_array = [
#錯誤版本
["1.0","new","one",0.8,4000,333, "2014-07-01", "M0001", "M0002", "M0003"],
// ["1.0", "new", "one", 0.8, 4000, 333, "2014-07-01", "M0001", "M0002", "M0003"],
#新簽約
#月繳(monthly)
["2.1","new","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","new","monthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","new","monthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","new","monthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","new","monthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","new","monthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","new","monthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","new","monthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","new","monthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","new","monthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","new","monthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","new","monthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "new", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", ''], #新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "new", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "new", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "new", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "new", "monthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "new", "monthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "new", "monthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "new", "monthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "new", "monthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "new", "monthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "new", "monthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "new", "monthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#2月1次繳(bimonthly)
["2.1","new","bimonthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","new","bimonthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","new","bimonthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","new","bimonthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","new","bimonthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","new","bimonthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","new","bimonthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","new","bimonthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","new","bimonthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","new","bimonthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","new","bimonthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","new","bimonthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "new", "bimonthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "new", "bimonthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "new", "bimonthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "new", "bimonthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "new", "bimonthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "new", "bimonthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "new", "bimonthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "new", "bimonthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "new", "bimonthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "new", "bimonthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "new", "bimonthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "new", "bimonthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#季付(quarterly)
["2.1","new","quarterly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","new","quarterly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","new","quarterly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","new","quarterly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","new","quarterly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","new","quarterly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","new","quarterly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","new","quarterly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","new","quarterly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","new","quarterly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","new","quarterly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","new","quarterly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "new", "quarterly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "new", "quarterly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "new", "quarterly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "new", "quarterly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "new", "quarterly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "new", "quarterly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "new", "quarterly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "new", "quarterly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "new", "quarterly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "new", "quarterly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "new", "quarterly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "new", "quarterly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#半年付(semiannually)
["2.1","new","semiannually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","new","semiannually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","new","semiannually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","new","semiannually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","new","semiannually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","new","semiannually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","new","semiannually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","new","semiannually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","new","semiannually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","new","semiannually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","new","semiannually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","new","semiannually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "new", "semiannually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "new", "semiannually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "new", "semiannually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "new", "semiannually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "new", "semiannually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "new", "semiannually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "new", "semiannually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "new", "semiannually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "new", "semiannually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "new", "semiannually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "new", "semiannually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "new", "semiannually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#年付(annually)
["2.1","new","annually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","new","annually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","new","annually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","new","annually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","new","annually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","new","annually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","new","annually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","new","annually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","new","annually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","new","annually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","new","annually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","new","annually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "new", "annually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "new", "annually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "new", "annually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "new", "annually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "new", "annually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "new", "annually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "new", "annually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "new", "annually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "new", "annually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "new", "annually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "new", "annually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "new", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #新簽約、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#免保轉有費(free_to_charge)
#月繳(monthly)
["2.1","free_to_charge","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","free_to_charge","monthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","free_to_charge","monthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","free_to_charge","monthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","free_to_charge","monthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","free_to_charge","monthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","free_to_charge","monthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","free_to_charge","monthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","free_to_charge","monthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","free_to_charge","monthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","free_to_charge","monthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","free_to_charge","monthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "free_to_charge", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "free_to_charge", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "free_to_charge", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "free_to_charge", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "free_to_charge", "monthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "free_to_charge", "monthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "free_to_charge", "monthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "free_to_charge", "monthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "free_to_charge", "monthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "free_to_charge", "monthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "free_to_charge", "monthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "free_to_charge", "monthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#2月1次繳(bimonthly)
["2.1","free_to_charge","bimonthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","free_to_charge","bimonthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","free_to_charge","bimonthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","free_to_charge","bimonthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","free_to_charge","bimonthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","free_to_charge","bimonthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","free_to_charge","bimonthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","free_to_charge","bimonthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","free_to_charge","bimonthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","free_to_charge","bimonthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","free_to_charge","bimonthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","free_to_charge","bimonthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "free_to_charge", "bimonthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "free_to_charge", "bimonthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "free_to_charge", "bimonthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "free_to_charge", "bimonthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "free_to_charge", "bimonthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "free_to_charge", "bimonthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "free_to_charge", "bimonthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "free_to_charge", "bimonthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "free_to_charge", "bimonthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "free_to_charge", "bimonthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "free_to_charge", "bimonthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "free_to_charge", "bimonthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#季付(quarterly)
["2.1","free_to_charge","quarterly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","free_to_charge","quarterly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","free_to_charge","quarterly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","free_to_charge","quarterly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","free_to_charge","quarterly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","free_to_charge","quarterly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","free_to_charge","quarterly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","free_to_charge","quarterly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","free_to_charge","quarterly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","free_to_charge","quarterly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","free_to_charge","quarterly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","free_to_charge","quarterly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "free_to_charge", "quarterly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "free_to_charge", "quarterly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "free_to_charge", "quarterly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "free_to_charge", "quarterly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "free_to_charge", "quarterly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "free_to_charge", "quarterly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "free_to_charge", "quarterly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "free_to_charge", "quarterly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "free_to_charge", "quarterly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "free_to_charge", "quarterly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "free_to_charge", "quarterly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "free_to_charge", "quarterly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#半年付(semiannually)
["2.1","free_to_charge","semiannually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","free_to_charge","semiannually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","free_to_charge","semiannually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","free_to_charge","semiannually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","free_to_charge","semiannually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","free_to_charge","semiannually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","free_to_charge","semiannually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","free_to_charge","semiannually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","free_to_charge","semiannually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","free_to_charge","semiannually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","free_to_charge","semiannually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","free_to_charge","semiannually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "free_to_charge", "semiannually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "free_to_charge", "semiannually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "free_to_charge", "semiannually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "free_to_charge", "semiannually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "free_to_charge", "semiannually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "free_to_charge", "semiannually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "free_to_charge", "semiannually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "free_to_charge", "semiannually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "free_to_charge", "semiannually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "free_to_charge", "semiannually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "free_to_charge", "semiannually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "free_to_charge", "semiannually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#年付(annually)
["2.1","free_to_charge","annually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","free_to_charge","annually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","free_to_charge","annually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","free_to_charge","annually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","free_to_charge","annually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","free_to_charge","annually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","free_to_charge","annually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","free_to_charge","annually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","free_to_charge","annually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","free_to_charge","annually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","free_to_charge","annually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","free_to_charge","annually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "free_to_charge", "annually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "free_to_charge", "annually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "free_to_charge", "annually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "free_to_charge", "annually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "free_to_charge", "annually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "free_to_charge", "annually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "free_to_charge", "annually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "free_to_charge", "annually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "free_to_charge", "annually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "free_to_charge", "annually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "free_to_charge", "annually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "free_to_charge", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #免保轉有費、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#續簽約(原價或僅契約金額異動)(renew_priceissue)
#月繳(monthly)
["2.1","renew_priceissue","monthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","renew_priceissue","monthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","renew_priceissue","monthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","renew_priceissue","monthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","renew_priceissue","monthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","renew_priceissue","monthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","renew_priceissue","monthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","renew_priceissue","monthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","renew_priceissue","monthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","renew_priceissue","monthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","renew_priceissue","monthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","renew_priceissue","monthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "renew_priceissue", "monthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "renew_priceissue", "monthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "renew_priceissue", "monthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "renew_priceissue", "monthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "renew_priceissue", "monthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "renew_priceissue", "monthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "renew_priceissue", "monthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "renew_priceissue", "monthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "renew_priceissue", "monthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "renew_priceissue", "monthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "renew_priceissue", "monthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "renew_priceissue", "monthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、月繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#2月1次繳(bimonthly)
["2.1","renew_priceissue","bimonthly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","renew_priceissue","bimonthly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","renew_priceissue","bimonthly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","renew_priceissue","bimonthly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","renew_priceissue","bimonthly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","renew_priceissue","bimonthly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","renew_priceissue","bimonthly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","renew_priceissue","bimonthly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","renew_priceissue","bimonthly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","renew_priceissue","bimonthly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","renew_priceissue","bimonthly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","renew_priceissue","bimonthly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "renew_priceissue", "bimonthly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "renew_priceissue", "bimonthly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "renew_priceissue", "bimonthly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "renew_priceissue", "bimonthly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "renew_priceissue", "bimonthly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "renew_priceissue", "bimonthly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "renew_priceissue", "bimonthly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "renew_priceissue", "bimonthly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "renew_priceissue", "bimonthly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "renew_priceissue", "bimonthly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "renew_priceissue", "bimonthly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "renew_priceissue", "bimonthly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、2月1次繳、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#季付(quarterly)
["2.1","renew_priceissue","quarterly",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","renew_priceissue","quarterly",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","renew_priceissue","quarterly",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","renew_priceissue","quarterly",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","renew_priceissue","quarterly",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","renew_priceissue","quarterly",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","renew_priceissue","quarterly",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","renew_priceissue","quarterly",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","renew_priceissue","quarterly",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","renew_priceissue","quarterly",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","renew_priceissue","quarterly",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","renew_priceissue","quarterly",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "renew_priceissue", "quarterly", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "renew_priceissue", "quarterly", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "renew_priceissue", "quarterly", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "renew_priceissue", "quarterly", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "renew_priceissue", "quarterly", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "renew_priceissue", "quarterly", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "renew_priceissue", "quarterly", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "renew_priceissue", "quarterly", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "renew_priceissue", "quarterly", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "renew_priceissue", "quarterly", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "renew_priceissue", "quarterly", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "renew_priceissue", "quarterly", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、季付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#半年付(semiannually)
["2.1","renew_priceissue","semiannually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","renew_priceissue","semiannually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","renew_priceissue","semiannually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","renew_priceissue","semiannually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","renew_priceissue","semiannually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","renew_priceissue","semiannually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","renew_priceissue","semiannually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","renew_priceissue","semiannually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","renew_priceissue","semiannually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","renew_priceissue","semiannually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","renew_priceissue","semiannually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","renew_priceissue","semiannually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "renew_priceissue", "semiannually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "renew_priceissue", "semiannually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "renew_priceissue", "semiannually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "renew_priceissue", "semiannually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "renew_priceissue", "semiannually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "renew_priceissue", "semiannually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "renew_priceissue", "semiannually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "renew_priceissue", "semiannually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "renew_priceissue", "semiannually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "renew_priceissue", "semiannually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "renew_priceissue", "semiannually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "renew_priceissue", "semiannually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、半年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
#年付(annually)
["2.1","renew_priceissue","annually",3000,3000,600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1","renew_priceissue","annually",3000,3001,601,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1","renew_priceissue","annually",3000,3500,1100,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1","renew_priceissue","annually",3000,4000,1600,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1","renew_priceissue","annually",3000,3000,1200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1","renew_priceissue","annually",3000,3001,1201,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1","renew_priceissue","annually",3000,3500,1700,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1","renew_priceissue","annually",3000,4000,2200,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1","renew_priceissue","annually",3000,3000,1230,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1","renew_priceissue","annually",3000,3001,1231,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1","renew_priceissue","annually",3000,3500,1730,"2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1","renew_priceissue","annually",3000,4000,2230,"2014-07-01", "M0001", "M0002", "M0003"] #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
["2.1", "renew_priceissue", "annually", 3000, 3000, 600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
["2.1", "renew_priceissue", "annually", 3000, 3001, 601, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費601元(折扣率0.8)
["2.1", "renew_priceissue", "annually", 3000, 3500, 1100, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1100元(折扣率0.8)
["2.1", "renew_priceissue", "annually", 3000, 4000, 1600, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費1600元(折扣率0.8)
["2.1", "renew_priceissue", "annually", 3000, 3000, 1200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1200元(折扣率0.6)
["2.1", "renew_priceissue", "annually", 3000, 3001, 1201, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1201元(折扣率0.6)
["2.1", "renew_priceissue", "annually", 3000, 3500, 1700, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1700元(折扣率0.6)
["2.1", "renew_priceissue", "annually", 3000, 4000, 2200, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2200元(折扣率0.6)
["2.1", "renew_priceissue", "annually", 3000, 3000, 1230, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3000元、服務費1230元(折扣率0.59)
["2.1", "renew_priceissue", "annually", 3000, 3001, 1231, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3001元、服務費1231元(折扣率0.59)
["2.1", "renew_priceissue", "annually", 3000, 3500, 1730, "2014-07-01", "M0001", "M0002", "M0003"], #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價3500元、服務費1730元(折扣率0.59)
["2.1", "renew_priceissue", "annually", 3000, 4000, 2230, "2014-07-01", "M0001", "M0002", "M0003"] #續簽約(原價或僅契約金額異動)、年付、牌價3000、簽約價4000元、服務費2230元(折扣率0.59)
];
// echo '1、契約總類($contract_type):新簽約(new)、免保轉有費(free_to_charge)、續簽約(原價或僅契約金額異動)(renew_priceissue)</br>';
// echo '6、付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually)</br>';
// echo '2、作番契約金額($fee_per_st):3000元/月以下、3001-3499元/月、3500-3999元/月、4000元/月以上</br>';
// echo '3、牌價($elevator_list_price):該電梯的合約發佈(標準)價+Option價格+與其他電梯共同分擔的費用貨價格</br>';
// echo '4、該作番所佔的服務費金額($commission_fee)</br>';
// echo '5、合約折扣率($discount):大於80%以上(含)(above_80)、60-79%(含)以上(60_to_79)、折扣率59% (含)以下(below_59) ; 契約折扣率=(簽約價格-服務費)/牌價</br>';
// echo '7、第一筆保養款項應收回日($receivable_date_due, array)</br>';
// echo '8、契約員員工號($sales_id)</br>';
// echo '9、地區處長員工號($region_director_id)</br>';
// echo '10、專任契約經理員工號($regular_contract_manger_id)</br>';
for ($i = 0; $i < count($examination_array); $i++) {
$fee_per_st = $examination_array[$i][3];
$commission_fee = $examination_array[$i][5];
$elevator_list_price = $examination_array[$i][4];
$discount = round(($fee_per_st - $commission_fee) / $elevator_list_price, 2);
for($i = 0; $i<count($examination_array); $i++){
// echo "$fee_per_st - $commission_fee / $elevator_list_price ";
// $discount = round(($examination_array[$i][4] - $examination_array[$i][6]) / $examination_array[$i][5], 2);
$examination_array[$i][9] = $examination_array[$i][9] == '' ? '' : $examination_array[$i][9];
$result = maintenance_contract_bonus_v2_1(
$examination_array[$i][0],
$examination_array[$i][1],
@ -273,19 +290,39 @@ for($i = 0; $i<count($examination_array); $i++){
$examination_array[$i][8],
$examination_array[$i][9]
);
#新簽約、月繳、牌價3000、簽約價3000元、服務費600元(折扣率0.8)
$contract_type = [
'new' => '新簽約',
'free_to_charge' => '免保轉有費',
'renew_priceissue' => '續簽約(原價或僅契約金額異動)'
];
// 付款方式$payment_period: 每月支付(monthly), 2月1次(bimonthly), 季付(quarterly), 半年付(semiannually), 年付(annually)
$pay_kind = [
'monthly' => '月繳',
'bimonthly' => '雙月繳',
'quarterly' => '季繳',
'semiannually' => '半年繳',
'annually' => '年繳'
];
//
$bonus_type = [
'1' => '契約員獎金',
'2' => '區經理獎金',
'3' => '契約經理獎金'
];
echo "獎金版本:" . $result["ver"] . "<br>";
echo "計算結果:" . $result["result_status"] . "<br>";
echo "傳入參數說明:" . $contract_type[$examination_array[$i][1]] . "、" . $pay_kind[$examination_array[$i][2]] . "、牌價" . $examination_array[$i][3] . "元、簽約價" . $examination_array[$i][4] . "元、服務費600元(折扣率" . $discount . ")、契約人員 : " . $examination_array[$i][7] . "、區經理 : " . $examination_array[$i][8] . " 、契約經理 : " . $examination_array[$i][9] . "<br>";
echo "輸入參數:" . $examination_array[$i][1] . " " . $examination_array[$i][2] . " " . $examination_array[$i][3] . " " . $examination_array[$i][4] . " "
. $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7]. " " . $examination_array[$i][8] . " "
. $examination_array[$i][5] . " " . $examination_array[$i][6] . " " . $examination_array[$i][7] . " " . $examination_array[$i][8] . " "
. $examination_array[$i][9] . "<br>";
for($j = 0; $j<count($result["bonus_array"]); $j++){
echo "輸出結果:" . $result["bonus_array"][$j]["bonus_type"] . " " . $result["bonus_array"][$j]["bonus_receiver"] . " "
. $result["bonus_array"][$j]["bonus_amount"] . " " . $result["bonus_array"][$j]["pay_day_due"] . " "
for ($j = 0; $j < count($result["bonus_array"]); $j++) {
echo "輸出結果:" . $bonus_type[$result["bonus_array"][$j]["bonus_type"]] . " ,發放人員 : " . $result["bonus_array"][$j]["bonus_receiver"] . " ,發放金額 : "
. $result["bonus_array"][$j]["bonus_amount"] . " ,預計發放時間 : " . $result["bonus_array"][$j]["pay_day_due"] . " ,說明 : "
. $result["bonus_array"][$j]["bonus_regulation"] . "<br>";
};
echo "-------------------------" . "<br>";
};
?>

22
wms/contract-repair/contract-renovate-input.php

@ -92,7 +92,7 @@ $contractSalesman = $stmt->fetchAll(PDO::FETCH_ASSOC);
<tr>
<td rowspan="4">材料</td>
<td rowspan="3">材料</td>
<td>1、訂金</td>
<td>
<input type="text">
@ -143,23 +143,7 @@ $contractSalesman = $stmt->fetchAll(PDO::FETCH_ASSOC);
</select>
</td>
</tr>
<!-- <tr>
<td>4、其他</td>
<td>
<input type="text">
</td>
<td colspan="2">
<input type="text">
</td>
<td>
<select x-model=data.paykind[3] @change="totalFn()">
<template x-for="pay in data.payarr" :key="pay">
<!-- <option value=""></option> -->
<option x-text="pay"></option>
</template>
</select>
</td>
</tr> -->
<tr>
<td rowspan="3">安裝</td>
@ -259,5 +243,5 @@ $contractSalesman = $stmt->fetchAll(PDO::FETCH_ASSOC);
</template>
</button>
</div>
</div>
</div>
</div>

51
wms/contract-repair/js/alpine.js

@ -900,7 +900,13 @@ const bonunsIndex = () => {
total: total,
fee_per_st: fee_per_st,
commission_fee: commission_fee,
discount: discount
discount: discount,
bonus_actual: '',
note: '',
id: id,
// bonus_actual: bonus_actual,
// payDay: payDay,
// note: note
},
step: 1,
@ -929,6 +935,9 @@ const bonunsIndex = () => {
this.step = 3; s
}
},
issue() {
console.log(1233);
},
getContractData() {
axios.get('./api/get.php?contract_no=' + this.data.contract_no).then(res => {
if (!res.data) {
@ -965,7 +974,39 @@ const bonunsIndex = () => {
},
save() {
if (this.step == 1) {
window.history.back();
// window.history.back();
const form = new FormData();
form.append('id', this.data.id);
form.append('bonus_actual', this.data.bonus_actual);
form.append('pay_day', this.data.payDay);
form.append('note', this.data.note);
form.append('user_id', this.data.user_id);
form.append('postType', 'b');
axios.post('./api/postStatus.php', form).then((res) => {
alert('更新成功');
window.history.go(-1);
}).catch((err) => {
// alert('更新失敗');
alert('更新失敗' + err.response.data);
})
}
},
stop() {
if (this.step == 1) {
const form = new FormData();
form.append('id', this.data.id);
form.append('bonus_actual', this.data.bonus_actual);
form.append('pay_day', this.data.payDay);
form.append('note', this.data.note);
form.append('postType', 'c');
axios.post('./api/postStatus.php', form).then((res) => {
console.log(res);
alert('更新成功');
window.history.go(-1);
}).catch((err) => {
alert(err.response.data);
})
}
},
calBons() {
@ -1001,7 +1042,7 @@ const bonunsIndex = () => {
}
}
const bonunsIndexTest = () => {
const bonusIndexTest = () => {
return {
data: {
bonus_verson: '2.1',
@ -1028,8 +1069,8 @@ const bonunsIndexTest = () => {
step: 1,
isLoading: false,
fail_arr: [],
test() {
console.log(this.data.paykind);
issue() {
console.log('123');
},
nextStepFn() {
if (this.step == 1) {

2
wms/contract-repair/styles/style.css

@ -654,7 +654,7 @@ main table th {
align-items: center;
width: 70px;
height: 45px;
font-size: 15px;
font-size: 10px;
}
.contract-input-component .form table .fixed,
.contract-management .form table .fixed,

2
wms/contract-repair/styles/style.scss

@ -707,7 +707,7 @@ main {
align-items: center;
width: 70px;
height: 45px;
font-size: 15px;
font-size: 10px;
}
table {

11
wms/contract/api/T8salIncomeApply.php

@ -3,14 +3,15 @@ require_once("../../T8_Authorization_from_bpm.php");
function T8API($data)
{
// echo '<pre>';
// print_r(json_encode($data));
// echo '</pre>';
$api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData';
$validation = get_Auth();
echo '<pre>';
print_r(json_encode($data));
echo '</pre>';
$header = [
"CHI_Authorization :" . $validation
"CHI_Authorization :" . $validation,
"GroupId:TEST"
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL
@ -20,6 +21,7 @@ function T8API($data)
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 {
@ -32,6 +34,7 @@ function T8API($data)
// print_r($result);
return $result;
}
return $result;
}
curl_close($ch);

47
wms/contract/api/getComboNo.php

@ -1,32 +1,35 @@
<?php
class CreateComboNo{
class CreateComboNo
{
private $comboarr = [
'week'=>'BW002',
'month'=>'EM002',
'quarter'=>'EQ002',
'half'=>'HY002',
'year'=>'EY002'
'week' => 'BW002',
'month' => 'EM002',
'quarter' => 'EQ002',
'half' => 'HY002',
'year' => 'EY002'
];
private $bwarr = [
'week','month','week','month','week','quarter',
'week','month','week','month','week','half',
'week','month','week','month','week','quarter',
'week','month','week','month','week','year'
'week', 'month', 'week', 'month', 'week', 'quarter',
'week', 'month', 'week', 'month', 'week', 'half',
'week', 'month', 'week', 'month', 'week', 'quarter',
'week', 'month', 'week', 'month', 'week', 'year'
];
private $emarr = [
'month','month','quarter','month','month','half',
'month','month','quarter','month','month','year'
'month', 'month', 'quarter', 'month', 'month', 'half',
'month', 'month', 'quarter', 'month', 'month', 'year'
];
private $combo;
private $startdate;
private $enddate;
public function __construct($combo, $startdate, $enddate){
public function __construct($combo, $startdate, $enddate)
{
$this->combo = $combo;
$this->startdate = $startdate;
$this->enddate = $enddate;
}
public function getComboNo(){
public function getComboNo()
{
$comboarr = (array) $this->combo === 'bw' ? $this->bwarr : $this->emarr;
$startdate = new DateTime($this->startdate);
@ -35,22 +38,22 @@ class CreateComboNo{
$interval = date_diff($startdate, $enddate);
$months = $interval->y * 12 + $interval->m;
$months = $this->combo === 'bw' ? $months*2 : $months;
$months = $this->combo === 'bw' ? $months * 2 : $months;
$newarr = [];
$idx = 0;
$ori_first_month = date('m', strtotime($this->startdate));
$first_day = date('Y-m-d', strtotime($this->startdate. ' + 3 days'));
$first_day = date('Y-m-d', strtotime($this->startdate . ' + 3 days'));
$new_first_month = date('m', strtotime($first_day));
if($ori_first_month != $new_first_month){
$first_day = date('Y-m-t', strtotime($this->startdate));
if ($ori_first_month != $new_first_month) {
$first_day = date('Y-m-d', strtotime($this->startdate));
}
$scheduleDate = new DateTime($first_day);
for ($i = 0; $i < $months; $i++){
for ($i = 0; $i <= $months; $i++) {
$newarr[] = [$this->comboarr[$comboarr[$idx]], $scheduleDate->format("Y-m-d")];
$idx ++;
$scheduleDate = $startdate->modify("+1 month");
if($idx >= count($comboarr)){
$idx++;
$scheduleDate = $scheduleDate->modify("+1 month");
if ($idx >= count($comboarr)) {
$idx = 0;
}
}

87
wms/contract/api/getContractData.php

@ -1,7 +1,7 @@
<?php
require_once('../conn.php');
if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contracttype']) && $_GET['contracttype']=='b'){
try{
if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'b') {
try {
$contractno = $_GET['contractno'];
$sql_str = "SELECT con_maintance_examine_apply.*, con_maintance_examine_clear.* FROM con_maintance_examine_apply
JOIN con_maintance_examine_clear on con_maintance_examine_apply.apply_key=con_maintance_examine_clear.apply_key
@ -10,9 +10,9 @@ if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contrac
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $contractno);
$stmt->execute();
$contract= $stmt->fetch(PDO::FETCH_ASSOC);
$contract = $stmt->fetch(PDO::FETCH_ASSOC);
if(empty($contract)){
if (empty($contract)) {
echo false;
exit;
}
@ -21,8 +21,12 @@ if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contrac
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':apply_key', $apply_key);
$stmt->execute();
$elevators= $stmt->fetchAll(PDO::FETCH_ASSOC);
$elevators = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = COUNT($elevators);
// foreach ($elevators as $key => $elevator) {
// $elevator['discount'] = ($elevator['sold_price'] / $elevator['stand_price']) * 100;
// }
$contract['elevators'] = $elevators;
$contract['num'] = $count;
@ -34,29 +38,82 @@ if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contrac
// 將 JSON 回應返回給客戶端
echo $contractResponse;
// echo json_encode($contractResponse);
}catch (PDOException $e ){
die("ERROR!!!: ". $e->getMessage());
} catch (PDOException $e) {
die("ERROR!!!: " . $e->getMessage());
}
}
if(isset($_GET['contractno']) && $_GET['contractno']!='' && isset($_GET['contracttype']) && $_GET['contracttype']=='m'){
try{
if (isset($_GET['contractno']) && $_GET['contractno'] != '' && isset($_GET['contracttype']) && $_GET['contracttype'] == 'm') {
try {
$contractno = $_GET['contractno'];
$sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no ORDER BY created_at DESC";
$sql_str = "SELECT a.*,b.lm_tel,b.uscc,b.manager,b.linkman FROM pricereview_main AS a
LEFT JOIN hope_elevator_customer AS b ON a.contractno = b.vol_no
WHERE a.contractno = :contractno AND a.status != 'YN' ";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $contractno);
$stmt->bindParam(':contractno', $contractno);
$stmt->execute();
$contract= $stmt->fetch(PDO::FETCH_ASSOC);
$contractResponse = json_encode($contract);
$contract = $stmt->fetch(PDO::FETCH_ASSOC);
$salesman = $contract['person'];
$sql = "SELECT * FROM account WHERE accountid = :accountid ";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':accountid', $salesman);
$stmt->execute();
$account_detail = $stmt->fetch(PDO::FETCH_ASSOC);
$contract['manager'] = $account_detail['manager'];
$contract['salesman_departno'] = $account_detail['department_id'];
$mid = $contract['id'];
$sql = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'A' ";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':mid', $mid);
$stmt->execute();
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$elevators_detail_arr = [];
foreach ($results as $keys => $result) {
$note = explode(',', $result['note']);
$result['spec'] = $note[0]; //型號
$result['person'] = $note[1]; // 人承
$result['floor'] = $note[2]; // 樓層
$result['speed'] = $note[3]; // 速度
for ($i = 0; $i < $result['item_qty']; $i++) {
$result['item_no'] = $i + 1;
array_push($elevators_detail_arr, $result);
}
}
$count = COUNT($elevators_detail_arr);
$contract['elevators'] = $results;
$contract['elevators_detail_arr'] = $elevators_detail_arr;
$contract['nums'] = $count;
// echo '<pre>';
// print_r($contract);
// echo '</pre>';
// exit;
$contractResponse = json_encode($contract);
// 設定回應標頭為 JSON
header('Content-Type: application/json');
// 將 JSON 回應返回給客戶端
echo $contractResponse;
}catch (PDOException $e ){
die("ERROR!!!: ". $e->getMessage());
} catch (PDOException $e) {
die("ERROR!!!: " . $e->getMessage());
}
}
if (!empty($_GET['contracttype']) && $_GET['contracttype'] == 'accountManger' && !empty($_GET['salesman'])) {
try {
$salesman = $_GET['salesman'];
$sql = "SELECT manager FROM account WHERE accountid = :accountid";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':accountid', $salesman);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
header('Content-Type:application/json');
echo json_encode($result);
} catch (PDOException $e) {
die("ERROR!!!:" . $e->getMessage());
}
}

276
wms/contract/api/postContractData.php

@ -18,7 +18,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$phone = !empty($_POST['phone']) ? $_POST['phone'] : null;
$email = !empty($_POST['email']) ? $_POST['email'] : null;
$mworker = !empty($_POST['mworker']) ? $_POST['mworker'] : null;
$mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null;
// $mcycle = !empty($_POST['mcycle']) ? $_POST['mcycle'] : null;
$salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
$contract_begin_date = !empty($_POST['contract_begin_date']) ? $_POST['contract_begin_date'] : null;
$contract_end_date = !empty($_POST['contract_end_date']) ? $_POST['contract_end_date'] : null;
@ -35,17 +35,53 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : [];
$payType = !empty($_POST['payType']) ? $_POST['payType'] : null;
$sql = "SELECT * FROM account WHERE accountid = '$salesman'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$accountData = $stmt->fetch(PDO::FETCH_ASSOC);
$depId = $accountData['department_id'];
// validate
//create facility table
$createFacilityNo = new CreateFacilityNo();
$dailyNecessities = [
'MAE100' => 'X',
'MAM200' => 'W',
'MAH100' => 'H',
'MAQ100' => 'Z',
'MAF100' => 'F',
'MAZ100' => 'B',
];
$maintain_times = [
'1' => 'em', //月保
'2' => 'bw' // 雙周保
];
$facility_arr = [];
foreach ($elevators as $elevator) {
$facility_arr[] = $dailyNecessities[$elevator['spec']];
}
echo json_encode($facility_arr);
// 電梯做番號
$facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
// if ($user_id == 'M0225') {
// echo '<pre>';
// print_r($facilityno);
// echo '</pre>';
// exit();
// }
echo json_encode($facilityno);
/// 獎金計算
$fail_arr = [];
if ($contractno === '') return $fail_arr[] = '合約號為必填';
if ($total_price == '') $fail_arr[] = '合約總價為必填';
if ($vat == '') $fail_arr[] = '統一編號為必填';
if ($mtype == '') $fail_arr[] = '維修型態為必填';
if ($phone == '') $fail_arr[] = '客戶電話為必填';
if ($email == '') $fail_arr[] = 'Email為必填';
// if ($email == '') $fail_arr[] = 'Email為必填';
if ($mworker == '') $fail_arr[] = '保養員為必填';
if ($mcycle == '') $fail_arr[] = '保養頻率為必填';
// if ($mcycle == '') $fail_arr[] = '保養頻率為必填';
if ($salesman == '') $fail_arr[] = '營業員為必填';
if ($contract_begin_date == '') $fail_arr[] = '合約開始時間為必填';
if ($contract_end_date == '') $fail_arr[] = '合約結束時間為必填';
@ -63,7 +99,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
echo json_encode($fail_arr);
exit();
}
T8insert($_POST, $facilityno, $depId);
bonusCreate($_POST, $facilityno, $conn);
//create account table
$accounttype = "A";
$accountid = $vat;
@ -75,6 +112,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$create_at = date('Y-m-d H:i:s');
$conn->beginTransaction();
// bonusCreate($_POST, $facilityno, $conn);
// exit();
$sql_str = "INSERT INTO account (accounttype, accountid, pwd, name, tel, address, email, repairerid, creater, create_at) VALUES (:accounttype, :accountid, :pwd, :name, :tel, :address, :email, :repairerid, :creater, :create_at)";
$stmt = $conn->prepare($sql_str);
@ -127,30 +166,35 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->execute();
//create facility table
$createFacilityNo = new CreateFacilityNo();
$dailyNecessities = [
'MAE100' => 'X',
'MAM200' => 'W',
'MAH100' => 'H',
'MAQ100' => 'Z',
'MAF100' => 'F',
'MAZ100' => 'B',
];
$facility_arr = [];
foreach ($elevators as $elevator) {
$facility_arr[] = $dailyNecessities[$elevator['spec']];
}
echo json_encode($facility_arr);
// 電梯做番號
$facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
// if ($user_id == 'M0225') {
// echo '<pre>';
// print_r($facilityno);
// echo '</pre>';
// exit();
// $createFacilityNo = new CreateFacilityNo();
// $dailyNecessities = [
// 'MAE100' => 'X',
// 'MAM200' => 'W',
// 'MAH100' => 'H',
// 'MAQ100' => 'Z',
// 'MAF100' => 'F',
// 'MAZ100' => 'B',
// ];
// $maintain_times = [
// '1' => 'em', //月保
// '2' => 'bw' // 雙周保
// ];
// $facility_arr = [];
// foreach ($elevators as $elevator) {
// $facility_arr[] = $dailyNecessities[$elevator['spec']];
// }
echo json_encode($facilityno);
echo '-------';
// echo json_encode($facility_arr);
// // 電梯做番號
// $facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num);
// // if ($user_id == 'M0225') {
// // echo '<pre>';
// // print_r($facilityno);
// // echo '</pre>';
// // exit();
// // }
// echo json_encode($facilityno);
// echo '-------';
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':accountid', $mworker);
@ -162,6 +206,12 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$repairerid = $mworker;
$repairername = $worker['name'];
foreach ($elevators as $idx => $elevator) {
// 民國年轉換西元年
$ROCuseful_date = $elevator['useful_date'];
$click = explode("-", $ROCuseful_date);
$click[0] = intval($click[0]) + 1911;
$ADuseful_date = implode("-", $click);
$sql_str = "INSERT INTO facility (contractno, define, facilityno, latitude, longitude, customerid, weight, numberofpassenger, numberofstop, numberoffloor, opentype, speed, repairtype, maintainance, facility_kind, address, repairerid, repairername, creater, create_at, area, takecertificatedate, licensedate)
VALUES (:contractno, :define, :facilityno, :latitude, :longitude, :customerid, :weight, :numberofpassenger, :numberofstop, :numberoffloor, :opentype, :speed, :repairtype, :maintainance, :facility_kind, :address, :repairerid, :repairername, :creater, :create_at, :area, :takecertificatedate, :licensedate)";
$stmt = $conn->prepare($sql_str);
@ -187,15 +237,17 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->bindParam(':create_at', $create_at);
$stmt->bindParam(':area', $area);
$stmt->bindParam(':takecertificatedate', $elevator['takecertificatedate']);
$stmt->bindParam(':licensedate', $elevator['useful_date']);
$stmt->bindParam(':licensedate', $ADuseful_date);
$result = $stmt->execute();
}
//create schedule table
$comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date);
$comboArr = json_decode($comboNo->getComboNo(), true);
// $comboNo = new CreateComboNo($mcycle, $contract_begin_date, $contract_end_date);
// $comboArr = json_decode($comboNo->getComboNo(), true);
foreach ($facilityno as $no) {
$comboNo = new CreateComboNo($maintain_times[$elevator['maintain_times']], $contract_begin_date, $contract_end_date);
$comboArr = json_decode($comboNo->getComboNo(), true);
foreach ($comboArr as $combo) {
$sql_str = 'INSERT INTO schedule (contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES (:contractno, :facilityno, :combono, :repairerid, :repairername, :duedate, :creater, :create_at)';
$stmt = $conn->prepare($sql_str);
@ -218,7 +270,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$customer_phone = $phone;
$customer_email = $email;
$repairman = $mworker;
$cycle = $mcycle;
// $cycle = $mcycle;
$contact_person = $partyA;
$contact_address = $partyAaddress;
$contact_phone = $partyAphone;
@ -285,8 +337,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
} else {
$files = null;
}
$sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price,payType, customer_phone, customer_email, repairman, cycle, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by)
VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :payType ,:customer_phone, :customer_email, :repairman, :cycle, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)";
$sql_str = "INSERT INTO contract_b_signed_back (contract_no, contract_type, company, customer_no, salesperson, contract_start_date, contract_end_date, total_price,payType, customer_phone, customer_email, repairman, contact_person, contact_address, contact_phone, contact_email, elevators_number, area, address, files_id, bonus, max_bonus, created_at, created_by)
VALUES (:contract_no, :contract_type, :company, :customer_no, :salesperson, :contract_start_date, :contract_end_date, :total_price, :payType ,:customer_phone, :customer_email, :repairman, :contact_person, :contact_address, :contact_phone, :contact_email, :elevators_number, :area, :address, :files_id, :bonus, :max_bonus, :created_at, :created_by)";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(":contract_no", $contractno);
$stmt->bindParam(":contract_type", $contract_type);
@ -299,7 +351,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->bindParam(":customer_phone", $customer_phone);
$stmt->bindParam(":customer_email", $customer_email);
$stmt->bindParam(":repairman", $repairman);
$stmt->bindParam(":cycle", $cycle);
// $stmt->bindParam(":cycle", $cycle); // 保養頻率在做番上,這邊不 insert。
$stmt->bindParam(":contact_person", $contact_person);
$stmt->bindParam(":contact_address", $contact_address);
$stmt->bindParam(":contact_phone", $contact_phone);
@ -316,20 +368,9 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->execute();
// $date = date('Y-m-sH-s-i');
// $createTime = str_replace("-", '', $date);
// $sql = "INSERT INTO comCustomer(BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)VALUES(:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)";
// $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':BizPartnerId', $contractno);
// $stmt->bindParam(':PersonId', $salesman);
// $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':InvoiceAddress', $address);
// $stmt->bindParam(':CreateTime', $createTime);
// $stmt->execute();
T8insert($_POST, $facilityno);
// T8insert($_POST, $facilityno);
header('Content-Type: application/json');
// header('Content-Type: application/json');
$jsonData = json_encode($files);
$conn->commit();
@ -341,7 +382,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
}
};
function T8insert($data, $facilityno)
function T8insert($data, $facilityno, $depId)
{
require_once("../connt8.php");
// 引入 T8 API 連線
@ -362,7 +403,6 @@ function T8insert($data, $facilityno)
$elevators = !empty($data['elevators']) ? json_decode($data['elevators'], true) : []; //電梯
$area = !empty($data['area']) ? $data['area'] : null; //縣市 Ex. A->台北 , B-> ..。
$payType = !empty($data['payType']) ? $data['payType'] : null;
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
@ -372,9 +412,9 @@ function T8insert($data, $facilityno)
$stmt = $conn->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$date = date('Y-m-sH-s-i');
$date_1 = date('Y-m-s');
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$date = date('Y-m-dH-s-i');
$date_1 = date('Y-m-d');
$createTime = str_replace("-", '', $date);
$insertTime = str_replace('-', '', $date_1);
$beginDate = str_replace("-", '', $contract_begin_date);
@ -493,12 +533,12 @@ function T8insert($data, $facilityno)
// echo '<pre>';
// print_r($elevator);
// echo '</pre>';
$facility_no = $facilityno[$index];
$sql = "INSERT INTO comMaterial
(FOrgid,MaterialId,MaterialTypeId,MaterialCategoryId,CreatorId,CreateTime)
VALUES ('1000',:MaterialId,'10','E',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':MaterialId', $facilityno[$index]);
$stmt->bindParam(':MaterialId', $facility_no);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
@ -507,7 +547,7 @@ function T8insert($data, $facilityno)
(MaterialTypeId,MaterialId,MaterialName,MaterialCategoryId,IsInUsed,UnitId,CreatorId,CreateTime)
VALUES ('10',:MaterialId,:MaterialName,'E',1,'SET',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':MaterialId', $facilityno[$index]);
$stmt->bindParam(':MaterialId', $facility_no);
$stmt->bindParam(':MaterialName', $customer);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
@ -517,7 +557,7 @@ function T8insert($data, $facilityno)
(Orgid,MaterialTypeId,MaterialId,CurrId,SUnitId,TaxId,CreatorId,CreateTime)
VALUES ('1000','10',:MaterialId,'TWD','SET','ST005',:CreatorId,:CreateTime)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':MaterialId', $facilityno[$index]);
$stmt->bindParam(':MaterialId', $facility_no);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
@ -533,6 +573,9 @@ function T8insert($data, $facilityno)
//分幾期 => 總共保養月 / 分期月
$SQuantity = $elevator['maintain_months'] / $IncomeId[$payType];
$date_1 = getNext25thDate($contract_begin_date);
// 依每台電梯去加入各個的付款項
for ($i = 0; $i < $IncomeId[$payType]; $i++) {
$row++;
@ -547,14 +590,16 @@ function T8insert($data, $facilityno)
"RowCode" => $row,
"RowNo" => $row,
"ItemType" => 1,
"SPrice" => $elevator['sold_price'],
"SPrice" => intval($elevator['sold_price']),
"SQuantity" => $SQuantity,
"ProjectId" => "$contractno",
"FromSourceTag" => 0,
"CU_MaterialId" => "$facilityno[$index]",
"CU_EstPayDate" => "$payDay"
"CU_MaterialId" => "$facility_no",
"CU_EstPayDate" => intval($payDay)
];
$salIncomeApplyDetail_rows[] = $rows_data;
// echo '<pre>';
// print_r($salIncomeApplyDetail_rows);
// echo '</pre>';
}
}
@ -564,7 +609,7 @@ function T8insert($data, $facilityno)
// $insertime = settype($insertTime, 'integer');
$salIncomeApplyMaster_rows = [
"BillNo" => "$contractno",
"BillDate" => $insertTime,
"BillDate" => intval($insertTime),
"OrgId" => "1000",
"FOrgId" => "1000",
"TypeId" => "RAS",
@ -578,7 +623,10 @@ function T8insert($data, $facilityno)
"DueToId" => "$contractno",
"TaxId" => "ST005",
"CompId" => "1001",
"CreatorId" => "$user_id"
"CreatorId" => "$user_id",
"CreateTime" => intval($insertTime),
"DeptId" => "$depId",
"IsPriceWithTax" => 1
];
$salIncomeApplyMaster = [
@ -593,6 +641,9 @@ function T8insert($data, $facilityno)
$API_body[] = $salIncomeApplyMaster;
$API_body[] = $salIncomeApplyDetail;
// 呼叫 API
// echo '<pre>';
// print_r($API_body);
// echo '</pre>';
$result = T8API($API_body);
if ($result['Status'] == 'Error' || $result['Status'] == 'Fails') {
@ -601,3 +652,102 @@ function T8insert($data, $facilityno)
die('Error!:' . $result['ErrorMsg']);
}
}
function bonusCreate($data, $facilityno, $conn)
{
try {
require_once("../../bonus/other/maintenance_contract_bonus_v2_1.php");
$elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : [];
$contract_begin_date = !empty($data['contract_begin_date']) ? $data['contract_begin_date'] : '';
$salesman = !empty($data['salesman']) ? $data['salesman'] : '';
$payType = !empty($data['payType']) ? $data['payType'] : '';
$status = 1;
$bonus_json = [];
$create_id = $data['user_id'];
$create_at = date('Y-m-d');
$contract_no = !empty($data['contractno']) ? $data['contractno'] : '';
$contract_kind = 3;
$payment = [
'A40006' => 'annually', //年繳
'A40007' => 'quarterly', //季繳
'A40004' => 'bimonthly', // 雙月繳
'A40005' => 'semiannually', // 半年繳
'A40003' => 'monthly' //月繳
];
$payDay = getNext25thDate($contract_begin_date);
foreach ($elevators as $key => $elevator) {
// print_r($payDay);
// echo '<pre>';
// print_r($elevator);
// echo '</pre>';
// exit;
$facility_no = $facilityno[$key];
$ver = $elevator['bonus_verson']; //獎金版本
$contract_type = $elevator['contract_type']; //合約類別
$payment_period = $payment[$payType]; //付款方式
$elevator_list_price = intval($elevator['stand_price']); //牌價
$fee_per_st = $elevator['contract_price']; //作翻契約金額
$commission_fee = $elevator['service_expense']; //服務費(月)
$receivable_date_due = $payDay; //第一筆保養款項收回日
$sales_id = $salesman; //營業人員
$discount = $elevator['discount'];
$region_director_id = $elevator['manager'];
$regular_contract_manger_id = !empty($elevator['regular_contract_manger_id']) ? $elevator['regular_contract_manger_id'] : '';
$results = maintenance_contract_bonus_v2_1($ver, $contract_type, $payment_period, $elevator_list_price, $fee_per_st, $commission_fee, $receivable_date_due, $sales_id, $region_director_id, $regular_contract_manger_id);
$bonus_json = [
'contract_type' => $contract_type,
'total' => $elevator_list_price,
'fee_per_st' => $fee_per_st,
'commission_fee' => $commission_fee,
'paykind' => $payment_period,
'receivable_date_due' => $receivable_date_due,
'discount' => $discount
];
if ($results['result_status'] != 'error') {
foreach ($results['bonus_array'] as $i => $result) {
$bonus_type = $result['bonus_type'];
$pay_day = $result['pay_day_due'];
$amount = $result['bonus_amount'];
$receiver = $result['bonus_receiver'];
$a = json_encode($bonus_json);
$sql = "INSERT INTO bonus
(bonus_type,bonus_verson,contract_no,contract_type,facility_no,amount,receiver,pay_day_due,status,bonus_json,create_id,create_at) VALUES
($bonus_type,'$ver','$contract_no',$contract_kind,'$facility_no',$amount,'$receiver','$pay_day',$status,'$a','$create_id','$create_at')";
$stmt = $conn->prepare($sql);
$stmt->execute();
}
}
}
// exit();
} catch (PDOException $e) {
http_response_code(404);
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
}
// 計算保養開始日期的當月25號
function getNext25thDate($dateString)
{
// 將傳入的日期字串轉換成 Unix 時間戳記
$timestamp = strtotime($dateString);
// 取得該日期的日期
$day = date('d', $timestamp);
// 如果日期大於 25,則回傳下個月的 25 號日期
if ($day > 25) {
// 增加一個月
$timestamp = strtotime('+1 month', $timestamp);
}
// 設定日期為 25 號
$targetDate = date('Y-m-25', $timestamp);
return $targetDate;
}

318
wms/contract/api/postNewContractData.php

@ -3,14 +3,14 @@ require_once("../conn.php");
include_once("./getFacilityNo.php");
include_once("./getComboNo.php");
include_once("./upload_chk.php");
ini_set ( 'date.timezone' , 'Asia/Taipei' );
ini_set('date.timezone', 'Asia/Taipei');
if($_SERVER['REQUEST_METHOD'] != 'POST'){
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
exit();
}
//新梯簽回
if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'm') {
try{
if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'm') {
try {
$created_at = date('Y-m-d H:i:s');
$created_by = $_POST["user_id"];
$contractno = $_POST["contractno"];
@ -24,42 +24,69 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$salesman = $_POST["salesman"];
$qc = $_POST["qc"];
$contracttype = $_POST["contracttype"];
$elevators_nums = $_POST['nums'];
$elevators = json_decode($_POST['elevators'], true);
$elevators_detail_arr = json_decode($_POST['elevators_detail_arr'], true);
BounsCount($_POST, $conn);
// echo '<pre>';
// print_r($elevators);
// echo '</pre>';
// exit;
$files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$files_id = null;
$fail_arr = [];
if(empty($contractno)) $fail_arr[] = '合約號為必填';
if(empty($customer)) $fail_arr[] = '客戶名稱為必填';
if(empty($manager)) $fail_arr[] = '負責人為必填';
if(empty($vat)) $fail_arr[] = '統編/身分證為必填';
if(empty($case_name)) $fail_arr[] = '案名為必填';
if(empty($linkman)) $fail_arr[] = '聯絡人為必填';
if(empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填';
if(empty($address)) $fail_arr[] = '地址為必填';
if(empty($salesman)) $fail_arr[] = '營業員為必填';
if(empty($qc)) $fail_arr[] = '請選擇QC或官檢';
if(count($fail_arr) > 0) {
if (empty($contractno)) $fail_arr[] = '合約號為必填';
if (empty($customer)) $fail_arr[] = '客戶名稱為必填';
if (empty($manager)) $fail_arr[] = '負責人為必填';
if (empty($vat)) $fail_arr[] = '統編/身分證為必填';
if (empty($case_name)) $fail_arr[] = '案名為必填';
if (empty($linkman)) $fail_arr[] = '聯絡人為必填';
if (empty($lm_tel)) $fail_arr[] = '聯絡人電話為必填';
if (empty($address)) $fail_arr[] = '地址為必填';
if (empty($salesman)) $fail_arr[] = '營業員為必填';
if (empty($qc)) $fail_arr[] = '請選擇QC或官檢';
if (count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr);
exit();
}
//create facility table
$createFacilityNo = new CreateFacilityNo();
$dailyNecessities = [
'MAE100' => 'X',
'MAM200' => 'W',
'MAH100' => 'H',
'MAQ100' => 'Z',
'MAF100' => 'F',
'MAZ100' => 'B',
];
$arr = [];
// 建立作番號
foreach ($elevators_detail_arr as $elevator) {
// $spec = explode('-', $elevator['item_spec']);
$arr[] = $dailyNecessities[$elevator['spec']];
}
$facilityno = $createFacilityNo->makeMFacilityNo('M', $arr, intval($elevators_nums));
echo '<pre>';
print_r($facilityno);
echo '</pre>';
exit();
$conn->beginTransaction();
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid ORDER BY create_at DESC";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(":accountid",$salesman);
$stmt -> execute();
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(":accountid", $salesman);
$stmt->execute();
$saleman = $stmt->fetch(PDO::FETCH_ASSOC);
$salesman_name = $saleman['name'];
if(!empty($files)){
if (!empty($files)) {
$englisharr = range('a', 'z');
$files = $_FILES['files'];
$newfiles = [];
foreach( $files as $file ){
foreach ($files as $file) {
$i = 0; //新陣列的索引編號
foreach( $file as $key => $val ){
foreach ($file as $key => $val) {
$newfiles[$i]['name'] = $files['name'][$key];
$newfiles[$i]['type'] = $files['type'][$key];
$newfiles[$i]['tmp_name'] = $files['tmp_name'][$key];
@ -68,72 +95,231 @@ if(isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['co
$i++;
} //foreach 第2層 end
}
$max_size = 4096*4096; //設定允許上傳檔案容量的最大值(1M)
$allow_ext = array('jpeg', 'jpg', 'png','JPG','JPEG','PNG','GIF'); //設定允許上傳檔案的類型
$max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M)
$allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型
$path = '../images/contracts/';
if (!file_exists($path)) { mkdir($path); }
if (!file_exists($path)) {
mkdir($path);
}
$msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
$datetime = (string)date('YmdHis');
$files_id = 'm' . $datetime; // 保養=>b + 日期時間
foreach( $newfiles as $key => $file ){
$randNum = rand(1000,9999);
$randEnglish = $englisharr[rand(0,25)];
$file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum.$file['name'];
$msg = upload_chk( $file,$path, $max_size, $allow_ext, $file_name );
if($msg==1){
foreach ($newfiles as $key => $file) {
$randNum = rand(1000, 9999);
$randEnglish = $englisharr[rand(0, 25)];
$file_name = 'm' . (string)date('YmdHis') . $randNum . $randEnglish . $randNum . $file['name'];
$msg = upload_chk($file, $path, $max_size, $allow_ext, $file_name);
if ($msg == 1) {
$msg = '檔案傳送成功!';
$sql_str = "INSERT INTO contract_back_files (files_id, file_name, file_mime, file_size, created_at, created_by) VALUES (:files_id, :file_name, :file_mime, :file_size, :created_at, :created_by)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(':files_id' ,$files_id);
$stmt -> bindParam(':file_name' ,$file_name);
$stmt -> bindParam(':file_mime' ,$file['type']);
$stmt -> bindParam(':file_size' ,$file['size']);
$stmt -> bindParam(':created_at' ,$created_at);
$stmt -> bindParam(':created_by' ,$created_by);
$stmt ->execute();
}else{
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':files_id', $files_id);
$stmt->bindParam(':file_name', $file_name);
$stmt->bindParam(':file_mime', $file['type']);
$stmt->bindParam(':file_size', $file['size']);
$stmt->bindParam(':created_at', $created_at);
$stmt->bindParam(':created_by', $created_by);
$stmt->execute();
} else {
throw new PDOException('檔案上傳失敗:' . $msg);
}
$msg_result .= '第' . ($key+1) . '個上傳檔案的結果:' . $msg . '<br/>';
$src_name = $path.$file['name'];
if( file_exists($src_name) ){
$msg_result .= '第' . ($key + 1) . '個上傳檔案的結果:' . $msg . '<br/>';
$src_name = $path . $file['name'];
if (file_exists($src_name)) {
//副檔名
$extname = pathinfo($src_name, PATHINFO_EXTENSION);
//主檔名
$basename = basename($src_name, '.'.$extname);
$basename = basename($src_name, '.' . $extname);
}
}
}else{
} else {
$files = null;
}
$sql_str = "INSERT INTO contract_m_signed_back (contract_no, customer, manager, vat, case_name, linkman, lm_tel, address, salesman, salesman_name, files_id, created_at, created_by, qc_official_type) VALUES (:contract_no, :customer, :manager, :vat, :case_name, :linkman, :lm_tel, :address, :salesman, :salesman_name, :files_id, :created_at, :created_by, :qc)";
$stmt = $conn -> prepare($sql_str);
$stmt -> bindParam(":contract_no",$contractno);
$stmt -> bindParam(":customer",$customer);
$stmt -> bindParam(":manager",$manager);
$stmt -> bindParam(":vat",$vat);
$stmt -> bindParam(":case_name",$case_name);
$stmt -> bindParam(":linkman",$linkman);
$stmt -> bindParam(":lm_tel",$lm_tel);
$stmt -> bindParam(":address",$address);
$stmt -> bindParam(":salesman",$salesman);
$stmt -> bindParam(":salesman_name",$salesman_name);
$stmt -> bindParam(":files_id",$files_id);
$stmt -> bindParam(":created_at",$created_at);
$stmt -> bindParam(":created_by",$created_by);
$stmt -> bindParam(":qc",$qc);
$stmt -> execute();
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(":contract_no", $contractno);
$stmt->bindParam(":customer", $customer);
$stmt->bindParam(":manager", $manager);
$stmt->bindParam(":vat", $vat);
$stmt->bindParam(":case_name", $case_name);
$stmt->bindParam(":linkman", $linkman);
$stmt->bindParam(":lm_tel", $lm_tel);
$stmt->bindParam(":address", $address);
$stmt->bindParam(":salesman", $salesman);
$stmt->bindParam(":salesman_name", $salesman_name);
$stmt->bindParam(":files_id", $files_id);
$stmt->bindParam(":created_at", $created_at);
$stmt->bindParam(":created_by", $created_by);
$stmt->bindParam(":qc", $qc);
$stmt->execute();
$result = $conn->commit();
if($result){
if ($result) {
header("HTTP/1.1 201 Created");
}
}catch(PDOException $e){
} catch (PDOException $e) {
$conn->rollback();
header("HTTP/1.1 500 Internal Server Error");
die('Error!:'.$e->getMessage());
die('Error!:' . $e->getMessage());
}
}
function T8Insert($data)
{
require_once("../connt8.php");
$contractno = $data['contractno'];
$partyA = $data['customer'];
$phone = $data['lm_tel'];
$vat = $data['vat'];
$partyAaddress = $data['address'];
$user_id = $data['user_id'];
$salesman = $data['salesman'];
$createAt = date("Y-m-dH-i-s");
$elevators[] = $data['elevators'];
$createTime = str_replace('-', '', $createAt);
$connT8->beginTransaction();
$sql = "SELECT * FROM comCustomer WHERE BizPartnerId = :BizPartnerId";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// 新增客戶 table
if (empty($result)) {
// 若 客戶資料為空,新增一筆到 comCustomer
// 新增客戶資料
$sql = "INSERT INTO comBusinessPartner
(BizPartnerId,BizPartnerName,BusinessAttr,CountryId,WorkTelNo,BizToDate,TaxNo,EnterpriseName,ContactAddress,EMail,CreatorId,CreateTime,BizPartnerTypeId)
VALUES(:BizPartnerId,:BizPartnerName,1,'TW',:WorkTelNo,99999999,:TaxNo,:EnterpriseName,:ContactAddress,:EMail,:CreatorId,:CreateTime,'10')";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->bindParam(':BizPartnerName', $partyA); //客戶名稱
$stmt->bindParam(':WorkTelNo', $phone);
$stmt->bindParam(':TaxNo', $vat);
// $stmt->bindParam(':EnterpriseName', $customer); //企業名稱
$stmt->bindParam(':ContactAddress', $partyAaddress);
$stmt->bindParam(':EMail', $email);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
$sql = "INSERT INTO comCustomer
(OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime,InvoiceId)
VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime,'35')";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->bindParam(':PersonId', $salesman);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':InvoiceAddress', $address);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
} else {
// // 若客戶資料不為空,更新該客戶資訊。
$sql = "UPDATE comCustomer SET
PersonId=:PersonId,
InvoiceAddress=:InvoiceAddress,
LastOperatorId=:LastOperatorId,
LastOperateTime=:LastOperateTime
WHERE BizPartnerId=:BizPartnerId
";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':PersonId', $salesman);
$stmt->bindParam(':InvoiceAddress', $address);
$stmt->bindParam(':LastOperatorId', $user_id);
$stmt->bindParam(':LastOperateTime', $createTime);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
$sql = "UPDATE comBusinessPartner SET
BizPartnerName=:BizPartnerName,
WorkTelNo=:WorkTelNo,
TaxNo=:TaxNo,
EnterpriseName=:EnterpriseName,
ContactAddress=:ContactAddress,
EMail=:EMail,
LastOperatorId=:LastOperatorId,
LastOperateTime=:LastOperateTime
WHERE BizPartnerId = :BizPartnerId
";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerName', $partyA);
$stmt->bindParam(':WorkTelNo', $phone);
$stmt->bindParam(':TaxNo', $vat);
$stmt->bindParam(':EnterpriseName', $customer);
$stmt->bindParam(':ContactAddress', $partyAaddress);
$stmt->bindParam(':EMail', $email);
$stmt->bindParam(':LastOperatorId', $user_id);
$stmt->bindParam(':LastOperateTime', $createTime);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
}
$sql = "SELECT * FROM comProject WHERE ProjectId = :ProjectId";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':ProjectId', $contractno);
$stmt->execute();
$resultProject = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (empty($resultProject)) {
//新增於 comProject。合約 table
$sql = "INSERT INTO comProject(ProjectId,ProjectName,TypeId,CreateTime,CreatorId,IsInUsed)
VALUES(:ProjectId,:ProjectName,'C0',:CreateTime,:CreatorId,1)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':ProjectId', $contractno);
$stmt->bindParam(':ProjectName', $customer);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->execute();
}
}
function BounsCount($data, $conn)
{
// echo '<pre>';
// print_r($data);
// echo '</pre>';
// exit;
require_once("../../bonus/elevator_new/elevator_new_deal_bonus.php");
$signing_date = $data['signing_date'];
$bonus_v1_0_date = '2024-01-02';
$bonus_v2_0_date = '2024-01-03';
$contractType = [
'1' => 'strategy_customer',
'2' => 'general_customer'
];
$contract_type = $data['contract_type'];
$type = $contractType[$contract_type]; //戰略客戶 or 一般客戶
$elevator_knockdown_price = $data['price_total']; //受價總額
$salesman = $data['salesman'];
$manager = $data['manager'];
$result_bonus = [];
if ($signing_date <= $bonus_v1_0_date) {
$ver = '1.0';
$result_bonus = elevator_new_deal_bonus_v1_0($ver, $type, $elevator_knockdown_price, $salesman, $manager);
} else if ($signing_date >= $bonus_v2_0_date) {
$ver = '2.0';
// $result_bonus = elevator_new_deal_bonus_v2_0($ver,$contract_type,);
}
echo '<pre>';
print_r($result_bonus);
echo '</pre>';
exit();
try {
} catch (PDOException $e) {
header("HTTP/1.1 500 Internal Server Error");
die('Error!:' . $e->getMessage());
}
}

55
wms/contract/api/testT8API.php

@ -1,21 +1,36 @@
<?php
$date = Date('Y-m-d');
$date1 = Date('Y-m-d', strtotime("$date +1 months"));
// $paymonth = $i * $SQuantity;
// $countDay = date('Y-m-d', strtotime("$date + $paymonth months"));
// $payDay = str_replace('-', '', $countDay);
// $countDay = date('Ymd', strtotime("$date1 + 1 months"));
// echo '<pre>';
// print_r($countDay);
// echo '</pre>';
// exit();
$SQuantity = 2;
// $b = 24 / $a;
for ($i = 0; $i < 12; $i++) {
$paymonth = $i * $SQuantity;
$countDay = date('Y-m-d', strtotime("$date + $paymonth months"));
$payDay = str_replace('-', '', $countDay);
echo '<pre>';
print_r($payDay);
echo '</pre>';
}
?>
<head>
<title>地址轉經緯度</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<h1>輸入地址以獲取經緯度</h1>
<form id="addressForm" method="post">
<input type="text" id="addressInput" name="address" placeholder="輸入地址">
<button type="submit">查詢</button>
</form>
<div id="map"></div>
<script>
// 使用AJAX提交表單
$(document).ready(function() {
$("#addressForm").submit(function(event) {
event.preventDefault();
var address = $("#addressInput").val();
$.ajax({
url: "get_lat_lng.php",
type: "POST",
data: {
address: address
},
success: function(data) {
$("#map").html(data);
}
});
});
});
</script>
</body>

2
wms/contract/conn.php

@ -34,7 +34,7 @@ try {
//設定主動以警告的形式報錯
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8masada", "M0225", "IFFBU1E=");
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8TEST", "M0225", "IFFBU1E=");
if ($connT8) {
$connT8->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}

106
wms/contract/contract-input.php

@ -136,7 +136,7 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
</select>
<p class="alerttext" x-show="data.mworker==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">保養頻率</td>
<!-- <td style="vertical-align: middle">保養頻率</td>
<td>
<select class="ui search dropdown" name="repairer_name" x-model="data.mcycle">
<option value="">選擇保養頻率</option>
@ -144,6 +144,18 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<option value="em">月保</option>
</select>
<p class="alerttext" x-show="data.mcycle==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> -->
<td style="vertical-align: middle">分期方式</td>
<td>
<select class="ui search dropdown" x-model="data.payType">
<option value="">選擇付款方式</option>
<option value="A40006">年繳</option>
<option value="A40007">季繳</option>
<option value="A40003">月繳</option>
<option value="A40004">雙月繳</option>
<option value="A40005">半年繳</option>
</select>
<p class="alerttext" x-show="data.payType==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
@ -184,21 +196,13 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<input type="text" x-model="data.address" />
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">分期方式</td>
<td style="vertical-align: middle">附件</td>
<td colspan="2">
<select class="ui search dropdown" x-model="data.payType">
<option value="">選擇付款方式</option>
<option value="A40006">年繳</option>
<option value="A40007">季繳</option>
<option value="A40003">月繳</option>
<option value="A40004">雙月繳</option>
<option value="A40005">半年繳</option>
</select>
<p class="alerttext" x-show="data.payType==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
</td>
</tr>
<tr>
<!-- <tr>
<td></td>
<td></td>
<td></td>
@ -208,7 +212,7 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<td colspan="2">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
</td>
</tr>
</tr> -->
</tbody>
</template>
<template x-if="step==3">
@ -307,19 +311,28 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
</select>
<p class="alerttext" x-show="data.elevators[idx].maintainance=='' || !data.elevators[idx].maintainance"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">竣檢日</td>
<td style="vertical-align: middle">竣檢日(民國年分)</td>
<td>
<input class="form-control disabled_select" type="date" x-model="data.elevators[idx].takecertificatedate">
<input class="form-control disabled_select" type="text" x-model="data.elevators[idx].takecertificatedate">
<p class="alerttext" x-show="data.elevators[idx].takecertificatedate=='' || !data.elevators[idx].takecertificatedate"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">許可證有效時間</td>
<td style="vertical-align: middle">許可證有效日期<br>(民國年-月-日。Ex.113-01-01)</td>
<td>
<input class="form-control disabled_select" type="date" x-model="data.elevators[idx].useful_date">
<input class="form-control disabled_select" type="text" x-model="data.elevators[idx].useful_date">
<p class="alerttext" x-show="data.elevators[idx].useful_date=='' || !data.elevators[idx].useful_date"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">保養頻率</td>
<td>
<select class="ui search dropdown" name="repairer_name" x-model="data.elevators[idx].maintain_times">
<option value="">選擇保養頻率</option>
<option value="2">雙週保</option>
<option value="1">月保</option>
</select>
<p class="alerttext" x-show="data.maintain_times==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td></td>
@ -334,10 +347,65 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
</tbody>
</template>
</template>
<template x-if="step==4">
<template x-for="(elevator, idx) in data.elevators" :key="elevator.apply_key + elevator.register_code">
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==4">
<tr>
<td colspan=8>
<p x-text="'獎金計算 : 電梯' + Number(idx+1)"></p>
</td>
</tr>
<tr>
<td style="vertical-align:middle">契約人員</td>
<td><input type="text" x-model="data.salesman"></td>
<td style="vertical-align:middle">保養月份</td>
<td>
<input type="text" x-model="elevator.maintain_months">
</td>
<td style="vertical-align:middle">合約類別</td>
<td>
<select name="" id="" x-model="elevator.contract_type">
<option value="">請選擇</option>
<option value="new">新簽約</option>
<option value="free_to_charge">免保轉有費</option>
<option value="renew_priceissue">續簽約</option>
</select>
</td>
<td style="vertical-align:middle">獎金適用版本</td>
<td>
<input type="text" x-model="elevator.bonus_verson" disabled="disabled">
</td>
</tr>
<tr>
<td style="vertical-align:middle">作番契約金額(月)</td>
<td><input type="text" x-model="elevator.sold_price" disabled></td>
<td style="vertical-align:middle">牌價(標準價)</td>
<td>
<input type="text" x-model="elevator.stand_price" disabled>
<p>標準價+Option價格+與其他電梯共同分擔的費用貨價格</p>
</td>
<td style="vertical-align:middle">服務費</td>
<td>
<input type="text" x-model="elevator.service_expense" disabled>
</td>
<td style="vertical-align:middle">折扣率(%)</td>
<td><input type="text" x-model='elevator.discount' disabled></td>
</tr>
<tr>
<td style="vertical-align:middle">地區處長員工號</td>
<td><input type="text" x-model="elevator.manager" disabled></td>
<td style="vertical-align:middle">專任契約經理員工號</td>
<td><input type="text" x-model="elevator.regular_contract_manger_id"></td>
</tr>
</tbody>
</template>
</template>
</table>
<button x-show="step==3" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<button x-show=" step==4" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>存檔</span>
</template>
@ -345,7 +413,7 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<div class="loader"></div>
</template>
</button>
<button x-show="step<=2" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<button x-show="step<=3" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<template x-if="!isLoading">
<span>下一步</span>
</template>

10
wms/contract/contract-new-apply.php

@ -495,7 +495,7 @@ $para = "function_name=pricereview&" . $token_link;
<td>結果</td>
<td colspan=2>意見</td>
<td>時間</td>
<td colspan=2><?php if (($user_id === "M0174" || $user_id === "M0107" || $user_id === "M0060" || $user_id == "TEST02" || $user_id == "TEST03") && $status == 1) : ?>審核意見<?php endif; ?></td>
<td colspan=2><?php if (($user_id === "M0174" || $user_id === "M0175" || $user_id === "M0060" || $user_id == "TEST02" || $user_id == "TEST03") && $status == 1) : ?>審核意見<?php endif; ?></td>
</tr>
<tr>
<td>營業員</td>
@ -508,7 +508,7 @@ $para = "function_name=pricereview&" . $token_link;
<td colspan=2>---</td>
<td><?php echo ($contract['submit_date']) ?? "---"; ?> </td>
<td colspan=2 rowspan="3">
<?php if (($user_id === "M0174" || $user_id === "M0107" || $user_id === "M0060" || $user_id == "TEST02" || $user_id == "TEST03") && $status == 1) : ?>
<?php if (($user_id === "M0174" || $user_id === "M0175" || $user_id === "M0060" || $user_id == "TEST02" || $user_id == "TEST03") && $status == 1) : ?>
<textarea class="form-control opinion" x-model="data.review_comment"></textarea>
<?php endif; ?>
</td>
@ -572,14 +572,14 @@ $para = "function_name=pricereview&" . $token_link;
</template>
</button>
<?php endif; ?>
<?php if ($status == 1 && ((($user_id == "M0107" || $user_id == "TEST02") && $contract['progress'] <= 1) || (($user_id == "M0060" || $user_id == "TEST03") && $contract['progress'] == 2) || $user_id == "M0174")) : ?>
<?php if ($status == 1 && ((($user_id == "M0175" || $user_id == "TEST02") && $contract['progress'] <= 1) || (($user_id == "M0060" || $user_id == "TEST03") && $contract['progress'] == 2) || $user_id == "M0174")) : ?>
<button x-show="true" x-on:click="agree()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>
<?php
if (($user_id === "M0107" || $user_id == "TEST02") && $contract['progress'] <= 1) {
if (($user_id === "M0175" || $user_id == "TEST02") && $contract['progress'] <= 1) {
echo "同意(上呈)";
// } elseif (($user_id === "M0060" || $user_id == "TEST03") && $contract['progress'] == 2) {
} elseif (($user_id === "M0060" || $user_id == "TEST03") && $contract['progress'] == 2) {
echo "同意(結案)";
}
?>

185
wms/contract/contract-newelevator-input.php

@ -2,16 +2,16 @@
include_once("../header.php");
require_once("./conn.php");
$accounttype = "M";
$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype";
$sql_str = "SELECT accountid, name FROM account WHERE accounttype = :accounttype ORDER BY accountid";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(":accounttype", $accounttype);
$stmt -> execute();
$stmt->execute();
$persons = $stmt->fetchAll(PDO::FETCH_ASSOC);
$persons = array_map(function($person){
$persons = array_map(function ($person) {
return [
'view'=>$person['accountid'] .'-'. $person['name'],
'value'=>$person['accountid'],
'name'=>$person['name']
'view' => $person['name'] . '-' . $person['accountid'],
'value' => $person['accountid'],
'name' => $person['name']
];
}, $persons);
?>
@ -21,7 +21,7 @@ $persons = array_map(function($person){
<script src="./js/axios/axios.min.js"></script>
<div class="contract-input-component" x-data="contractNewInput">
<div class="form" method="post" id="form" enctype="multipart/form-data" >
<div class="form" method="post" id="form" enctype="multipart/form-data">
<input type="hidden" name='form_name' value="main_form" />
<div>
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
@ -37,7 +37,7 @@ $persons = array_map(function($person){
<tr>
<td style="vertical-align: middle">合約號</td>
<td colspan=5>
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contractno" x-model="data.contractno" >
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contractno" x-model="data.contractno">
</td>
<td colspan="2" style="vertical-align: middle">
<label for="customize">
@ -62,17 +62,22 @@ $persons = array_map(function($person){
<tr>
<td style="vertical-align: middle">客戶名稱</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.customer" >
<input class="form-control disabled_select" type="text" name="" x-model="data.customer">
<p class="alerttext" x-show="data.customer==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">負責人</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.manager" >
<select class="manager" id="manager" x-model="data.manager">
<option value="">請選擇營業員</option>
<?php foreach ($persons as $person) : ?>
<option value="<?php echo $person['value']; ?>"><?php echo $person['view']; ?></option>
<?php endforeach ?>
</select>
<p class="alerttext" x-show="data.manager==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">統一編號/身分證</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.vat" >
<input class="form-control disabled_select" type="text" name="" x-model="data.vat">
<p class="alerttext" x-show="data.vat==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">營業員</td>
@ -80,7 +85,7 @@ $persons = array_map(function($person){
<div class="ui form">
<select class="salesman" id="salesman" x-model="data.salesman">
<option value="">請選擇營業員</option>
<?php foreach($persons as $person): ?>
<?php foreach ($persons as $person) : ?>
<option value="<?php echo $person['value']; ?>"><?php echo $person['view']; ?></option>
<?php endforeach ?>
</select>
@ -88,17 +93,98 @@ $persons = array_map(function($person){
<p class="alerttext" x-show="data.salesman==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<tr>\
<td style="vertical-align:middle">電梯數量</td>
<td>
<input type="text" class="form-control disabled_select" name="num" x-model="data.nums" disabled>
</td>
<td style="vertical-align: middle">聯繫人</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.linkman" >
<input class="form-control disabled_select" type="text" name="" x-model="data.linkman">
<p class="alerttext" x-show="data.linkman==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">聯繫人電話</td>
<td>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.lm_tel" >
<input class="form-control disabled_select" type="text" name="" x-model="data.lm_tel">
<p class="alerttext" x-show="data.lm_tel==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">案件名稱</td>
<td>
<input class="form-control disabled_select" type="text" name="" x-model="data.case_name">
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">合約簽訂日期</td>
<td>
<input class="form-control disabled_select" type="date" name="" x-model="data.signing_date">
<p class="alerttext" x-show="data.signing_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">客戶類型</td>
<td>
<select name="contract_type" id="contract_type" x-model="data.contract_type">
<option value="">請選擇</option>
<option value="1">戰略客戶</option>
<option value="2">一般客戶</option>
</select>
</td>
<td style="vertical-align: middle">附件上傳</td>
<td colspan="3">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
</td>
</tr>
<tr>
</tr>
</tbody>
</template>
<template x-if="step == 3">
<template x-for="(elevator, idx) in data.elevators_detail_arr" :key="idx">
<tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==3">
<tr>
<td colspan=8>
<p x-text="'電梯' + Number(idx+1)"></p>
</td>
</tr>
<tr>
<td style="vertical-align: middle">電梯型號</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.spec" disabled>
</td>
<td style="vertical-align: middle">開門方式</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.item_op" disabled>
</td>
<td style="vertical-align: middle">電梯載重</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.item_weight" disabled>
</td>
<td style="vertical-align: middle">電梯人乘</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.person" disabled>
</td>
</tr>
<tr>
<td style="vertical-align: middle">電梯速度</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.person" disabled>
</td>
<td style="vertical-align: middle">電梯樓停</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.floor" disabled>
</td>
<td style="vertical-align: middle">電梯樓層</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.floor">
</td>
<td style="vertical-align: middle">合約交期(到工地)</td>
<td>
<input class="form-control disabled_select" type="date" x-model="elevator.contract_arrival_date">
</td>
</tr>
<tr>
<td style="vertical-align: middle">QC和官檢</td>
<td>
<select class="" id="qc" x-model="data.qc">
@ -109,28 +195,69 @@ $persons = array_map(function($person){
</select>
<p class="alerttext" x-show="data.qc==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">案件名稱</td>
<td >
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.case_name" >
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<td style="vertical-align: middle">工地負責人</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.manage">
</td>
<td style="vertical-align: middle">工務部門負責人</td>
<td style="vertical-align: middle">
<select class="form-control " id="warehouseid" name="warehouseid" x-model="elevator.warehouseid">
<option value="">未選擇</option>
<optgroup label="北區">
<option value="M0041">張潘榮(桃竹以北)</option>
<option value="M0150">羅盛騰(桃竹)</option>
<option value="M0040">吳宗紘</option>
</optgroup>
<optgroup label="中區">
<option value="M0198">廖堉勝</option>
<option value="M0158">劉子睿(新梯)</option>
<option value="M0161">鄭永典(汰改)</option>
<option value="M0159">孫仲凱</option>
<option value="M0202">徐錦潤</option>
<option value="M0113">林瑋隆</option>
</optgroup>
<optgroup label="南區">
<option value="M0078">許益連</option>
<option value="M0102">鄭存邑(高屏、台東)</option>
<option value="M0187">田祖豪(台南、嘉義)</option>
<option value="M0077">鍾玉龍</option>
</optgroup>
<optgroup label="宜蘭">
<option value="M0087">高培軒</option>
</optgroup>
</select>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td style="vertical-align: middle">地址</td>
<td colspan=3>
<input class="form-control disabled_select" type="text" name="uscc" x-model="data.address" >
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
<td style="vertical-align: middle">附件上傳</td>
<td style="vertical-align: middle">現場地址</td>
<td colspan="3">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
<input class="form-control disabled_select" type="text" x-model="data.address">
</td>
<td style="vertical-align: middle">經度</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.latitude">
</td>
<td style="vertical-align: middle">緯度</td>
<td>
<input class="form-control disabled_select" type="text" x-model="elevator.longitude">
</td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</template>
</template>
<template x-if="step == 4">
<template>
</template>
</template>
</table>
<button x-show="step==2" x-on:click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<button x-show="step==3" x-on:click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>存檔</span>
</template>
@ -138,7 +265,7 @@ $persons = array_map(function($person){
<div class="loader"></div>
</template>
</button>
<button x-show="step<=1" x-on:click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<button x-show="step<=3" x-on:click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<template x-if="!isLoading">
<span>下一步</span>
</template>

101
wms/contract/js/alpine.js

@ -810,7 +810,7 @@ const contractNewInput = () => {
return {
init() { },
data: {
contractno: '',
contractno: 'M23110004',
customer: '',
manager: '',
vat: '',
@ -821,7 +821,13 @@ const contractNewInput = () => {
salesman: '',
qc: '',
qc: '',
price_total: '', //合約總價
files: [],
contract_type: '1',
signing_date: '', //合約簽訂日期
elevators: [], // 電梯種類 Array
elevators_detail_arr: [], // 電梯台數 Array
nums: '', //電梯數量
},
step: 1,
isLoading: false,
@ -831,6 +837,10 @@ const contractNewInput = () => {
this.isLoading = true
if (this.step == 1) {
this.getContractDate();
} else if (this.step == 2) {
this.getElevatorsData();
} else if (this.step == 3) {
this.getElevatorsData();
}
},
nextStepKeyupFn(e) {
@ -843,10 +853,34 @@ const contractNewInput = () => {
preStepFn() {
if (this.step == 2) {
this.step = 1
} else if (this.step == 3) {
this.step = 2
}
},
getElevatorsData() {
if (this.step == 2) {
for (let i = 0; i < this.data.nums; i++) {
// console.log(this.data.elevators_detail_arr[i]);
this.data.elevators_detail_arr[i].warehouseid = ''; // 公務部門負責人
this.data.elevators_detail_arr[i].latitude = ''; // 經度
this.data.elevators_detail_arr[i].longitude = ''; // 緯度
this.data.elevators_detail_arr[i].manage = ''; // 工地負責人
this.data.elevators_detail_arr[i].qc = ''; // QC和官檢
this.data.elevators_detail_arr[i].contract_arrival_date = ''; //合約交期(到工地)
}
this.step = 3;
this.isLoading = false;
} else if (this.step == 3) {
console.log(this.data.elevators_detail_arr);
this.step = 4;
this.isLoading = false;
}
},
getContractDate() {
axios.get('./api/getContractData.php?contracttype=m&contractno=' + this.data.contractno).then(res => {
console.log(res);
if (!res.data) {
this.step = 2
this.isLoading = false
@ -854,15 +888,19 @@ const contractNewInput = () => {
}
if (!this.customize) {
console.log(res.data);
this.data.customer = res.data.customer
this.data.customer = res.data.company
this.data.manager = res.data.manager
this.data.vat = res.data.uscc
this.data.case_name = res.data.case_name
this.data.linkman = res.data.linkman
this.data.lm_tel = res.data.lm_tel
this.data.address = res.data.address
this.data.salesman = res.data.salesman
this.data.qc = res.data.qc
this.data.salesman = res.data.person
this.data.qc = res.data.qc;
this.data.price_total = res.data.price_total;
this.data.elevators = res.data.elevators;
this.data.elevators_detail_arr = res.data.elevators_detail_arr;
this.data.nums = res.data.nums;
}
this.step = 2
this.isLoading = false
@ -884,6 +922,12 @@ const contractNewInput = () => {
form.append('address', this.data.address);
form.append('salesman', this.data.salesman);
form.append('qc', this.data.qc);
form.append('signing_date', this.data.signing_date);
form.append('nums', this.data.nums);
form.append('price_total', this.data.price_total);
form.append('contract_type', this.data.contract_type);
form.append('elevators_detail_arr', JSON.stringify(this.data.elevators_detail_arr));
form.append('elevators', JSON.stringify(this.data.elevators));
form.append('contracttype', 'm');
form.append('user_id', user_id);
for (var i = 0; i < this.data.files.length; i++) {
@ -971,7 +1015,11 @@ const contractInput = () => {
num: '', //電梯數量
disabled: false, //資料庫是否有電梯數量資料
elevators: [], //機種、載重、人乘、樓停、樓層、速度、緯度、經度、開門方式、保養別、廠牌、竣檢日、許可證日期
payType: '' //付款方式
payType: '', //付款方式
// bonus_verson: 2.1,
// manager: '',
// regular_contract_manger_id: '',
// bonus: [],
},
customize: false,
step: 1,
@ -988,6 +1036,26 @@ const contractInput = () => {
this.createElevator();
}
this.step = 3
} else if (this.step == 3) {
this.getManager();
this.step = 4;
// console.log(this.step);
}
},
getBonusVerson(data) {
// 目前獎金版本為 2.1,若之後要依辦法建立時間來判斷在這邊修改
data.bonus_verson = 2.1;
},
getManager() {
for (let i = 0; i < this.data.elevators.length; i++) {
this.getBonusVerson(this.data.elevators[i]);
axios.get('./api/getContractData.php?contracttype=accountManger&salesman=' + this.data.salesman).then(res => {
this.data.elevators[i].manager = res.data.manager;
console.log(this.data.elevators[i]);
}).catch(err => {
})
}
},
nextStepKeyupFn(e) {
@ -1017,6 +1085,12 @@ const contractInput = () => {
maintainance: '', //保養別
takecertificatedate: '', //竣檢日
useful_date: '', //許可證有效日期
maintain_times: '', //保養頻率
discount: '', //折價率
contract_type: '',
manager: '',
regular_contract_manger_id: '',
bonus_verson: ''
})
}
},
@ -1028,9 +1102,15 @@ const contractInput = () => {
return
}
if (!this.customize) {
this.data.elevators = res.data.elevators;
for (let i = 0; i < res.data.elevators.length; i++) {
// 合約總價格。
this.data.total_price = Number(res.data.elevators[i].sold_price) + Number(this.data.total_price);
console.log(this.data.total_price);
// 服務費 (以單筆合約記,但計算獎金須傳入單月服務費)
this.data.elevators[i].service_expense = Math.round(this.data.elevators[i].service_expense / 12);
// 折扣率
this.data.elevators[i].discount = Math.round(((res.data.elevators[i].sold_price / res.data.elevators[i].stand_price) + this.data.elevators[i].service_expense) * 100);
}
this.data.total_price = Number(res.data.elevators[0].maintain_months) * this.data.total_price;
this.data.salesman = res.data.salesman
@ -1040,9 +1120,10 @@ const contractInput = () => {
this.data.customer = res.data.customer
this.data.partyA = res.data.customer
this.data.partyAaddress = res.data.address
this.data.num = res.data.num
this.data.num = res.data.num;
this.data.payType = res.data.payment_kind
this.data.disabled = (res.data.num > 0) ? true : false;
this.data.elevators = res.data.elevators
let cityIndex = this.data.address.indexOf('市');
// console.log(cityIndex);
if (cityIndex == -1) {
@ -1094,6 +1175,8 @@ const contractInput = () => {
}
} else if (this.step == 3) {
this.step = 2
} else if (this.step == 4) {
this.step = 3
}
},
save() {
@ -1106,7 +1189,7 @@ const contractInput = () => {
form.append('phone', this.data.phone);
form.append('email', this.data.email);
form.append('mworker', this.data.mworker);
form.append('mcycle', this.data.mcycle);
// form.append('mcycle', this.data.mcycle);
form.append('salesman', this.data.salesman);
form.append('contract_begin_date', this.data.contract_begin_date);
form.append('contract_end_date', this.data.contract_end_date);

1
wms/contract_b-index.php

@ -306,4 +306,5 @@ endif;
mysqli_close($link);
include "footer.php";
?>

2
wms/crm/crmm02-index.php

@ -170,7 +170,7 @@ if ($data) :
<span class="glyphicon glyphicon-pencil"></span>
</a>
<?php if ($user_name === $row['salesman'] || $user_id = 'M0225') : ?>
<a href="https://bpm.masada.com.tw/km/review/km_review_main/kmReviewMain.do?method=add&fdTemplateId=18cf68c8bc2a8ec3c80950e4e2389f0a&s_css=default&vol_no=<?= $row['vol_no'] ?>" class="btn btn-info btn-sm">
<a href="../mkt/pricereviewMaintainCreate.php?function_name=customer&token=<?= $token_link ?>&vol_no=<?= $row['vol_no'] ?>" class="btn btn-info btn-sm">
轉價審
</a>
<?php endif ?>

8
wms/crm/crmm03-edit.php

@ -348,7 +348,7 @@ function get_sequnece_no($seq_name = '', $p_yyyymm = '')
<textarea class='form-control textarea' id="progress_status" name="progress_status" value='' rows='6'></textarea>
</div>
</div>
<div id="elevator_list_area" class="row ">
<!-- <div id="elevator_list_area" class="row ">
<div class="col-12 form_row_header ">
<b>電梯規格信息</b>
</div>
@ -398,8 +398,8 @@ function get_sequnece_no($seq_name = '', $p_yyyymm = '')
</tbody>
</table>
</div>
<div id="option_list_area" class="row ">
</div> -->
<!-- <div id="option_list_area" class="row ">
<div class="col-12 form_row_header ">
<b>Option報價</b>
</div>
@ -452,7 +452,7 @@ function get_sequnece_no($seq_name = '', $p_yyyymm = '')
</tbody>
</table>
</div>
</div> -->
<button style='margin:20px auto;width:50px' type="submit" class="btn btn-primary btn-sm">保存</button>
</div>

22
wms/crm/crmm04-edit.php

@ -98,7 +98,7 @@ $hope_project_elevator_spec_columm = [
//'weight' => ['label' => "載重(KG)", "tag" => 'number', 'attr' => ['name' => 'weight[]', 'gt=0', 'min=0', 'required', 'class' => 'form-control form-control-sm']],
'stop' => ['label' => "停數", "tag" => 'number', 'attr' => ['name' => 'stop[]', 'min=0', 'class' => 'form-control form-control-sm']],
'open' => ['label' => "開門方式", "tag" => 'select', 'attr' => ['colspan' => 2, 'name' => 'open[]', 'class' => 'form-control form-control-sm'], 'options' => $open_kind_opt],
'speed' => ['label' => "速度(m/min)", "tag" => 'select', 'attr' => ['name' => 'speed[]', 'class' => 'form-control form-control-sm'],'options' => $speed_opt],
'speed' => ['label' => "速度(m/min)", "tag" => 'select', 'attr' => ['name' => 'speed[]', 'class' => 'form-control form-control-sm'], 'options' => $speed_opt],
'spec_num' => ['label' => "數量", "tag" => 'digits', 'attr' => ['name' => 'spec_num[]', 'min=0', 'class' => 'form-control form-control-sm']],
'spec_price' => ['label' => "單價", "tag" => 'number', 'attr' => ['name' => 'spec_price[]', 'min=0', 'class' => 'form-control form-control-sm']],
@ -204,14 +204,14 @@ function base_url($url)
"indent | alignleft center alignright justify | undo redo | "
});
$('#cmecTbody').on('click', 'input[name^=spec_num]', function(){
$(this).unbind().keyup(function(){
$('#cmecTbody').on('click', 'input[name^=spec_num]', function() {
$(this).unbind().keyup(function() {
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
sumNum();
});
});
$('#is_renovation').change(function(){
$('#is_renovation').change(function() {
console.log($(this).val());
});
@ -220,8 +220,8 @@ function base_url($url)
});
sumNum = function() {
var numAll = 0;
$("input[name^=spec_num]").each(function(){
numAll += Number($(this).val().replace(/[,]+/g,""));
$("input[name^=spec_num]").each(function() {
numAll += Number($(this).val().replace(/[,]+/g, ""));
});
$('#num').val(numAll);
}
@ -333,7 +333,7 @@ function base_url($url)
<div class=" form container-fluid pt-5">
<div class="row form_head ">
<div class=" col-12 form_head_title ">
<h4> 有望客戶(<?php echo ($hope_elevator_customer[0]["is_renovation"]=="Y")?"汰改":"新梯"; ?>)訂正</h4>
<h4> 有望客戶(<?php echo ($hope_elevator_customer[0]["is_renovation"] == "Y") ? "汰改" : "新梯"; ?>)訂正</h4>
</div>
</div>
@ -381,7 +381,7 @@ function base_url($url)
</div>
</div>
<div id="elevator_list_area" class="row ">
<!-- <div id="elevator_list_area" class="row ">
<div class="col-12 form_row_header ">
<b>電梯規格信息</b>
</div>
@ -431,8 +431,8 @@ function base_url($url)
</tbody>
</table>
</div>
<div id="option_list_area" class="row ">
</div> -->
<!-- <div id="option_list_area" class="row ">
<div class="col-12 form_row_header ">
<b>Option報價</b>
</div>
@ -486,7 +486,7 @@ function base_url($url)
</tbody>
</table>
</div>
</div> -->
<button style='margin:20px auto;width:50px' type="submit" class="btn btn-primary btn-sm">保存</button>
</div>

2
wms/fun_global.php

@ -14,7 +14,7 @@ function sql_myself($user_id, $column = "creater")
global $link;
$follower_arr = []; // 下屬列表
if($user_id == 'M0105'){
if ($user_id == 'M0105') {
$user_id = "M0137";
}
$sql_cmd = "where ($column = '$user_id'";

553
wms/mkt/assets/js/pricereviewAlpine.js

@ -1,22 +1,22 @@
const pricereviewCreate = ()=>{
const pricereviewCreate = () => {
return {
init(){
init() {
this.elevators = elevators;
console.log(this.elevators);
console.log(this.total_spec);
},
openFn:{
4:'2U',
5:"4PCO",
7:"6PCO",
8:"2S",
9:"CO"
openFn: {
4: '2U',
5: "4PCO",
7: "6PCO",
8: "2S",
9: "CO"
},
optionalArr: {
1:'標配',
2:'選配',
3:'選配',
1: '標配',
2: '選配',
3: '選配',
},
total_spec: total_spec,
options: options,
@ -26,41 +26,41 @@ const pricereviewCreate = ()=>{
subkind: 1,
buttons: [],
modalSelectedOptions: {},
selectedOptions:[],
selectedOptions: [],
elevators: [],
toElevators:[],
toElevators: [],
toElevatorNo: '',
currentOptionKey: '',
currentOtherOptionKey: '',
currentMaintainOptionKey: '',
optionKey:0,
otherOptionKey:0,
maintainOptionKey:0,
modalElevatorInfo:{
spec:'',
person:'',
stop:'',
speed:'',
open:'CO',
optionKey: 0,
otherOptionKey: 0,
maintainOptionKey: 0,
modalElevatorInfo: {
spec: '',
person: '',
stop: '',
speed: '',
open: 'CO',
num: 1,
price:'',
sale_price:'',
price: '',
sale_price: '',
facility_id: '',
},
otherOptions: [],
modalOtherOptionInfo:{
pr_no:"",
name:"",
modalOtherOptionInfo: {
pr_no: "",
name: "",
price: 0,
num:"",
num: "",
},
maintainOptions:[],
modalMaintainInfo:{
price:0,
num:"",
memo:"",
maintainOptions: [],
modalMaintainInfo: {
price: 0,
num: "",
memo: "",
},
paymentRatio:[
paymentRatio: [
{
scale: 20,
ticket: 30,
@ -90,41 +90,40 @@ const pricereviewCreate = ()=>{
ticket: '',
},
],
serviceFee:0,
serviceFee: 0,
transactionDate: pre_order_date,
shippingDate:'',
remark:'',
async getElevatorPrice(idx){
shippingDate: '',
remark: '',
async getElevatorPrice(idx) {
const spec = this.elevators[idx].specifications
const person = this.elevators[idx].person
const stop = this.elevators[idx].stop
const open_converted = this.elevators[idx].open_converted
const speed = this.elevators[idx].speed
const model = spec + '-' + person + '*' + stop + '-' + open_converted + speed;
try{
const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model}})
console.log(model);
try {
const res = await axios.get("./api/getElevatorPrice.php", { params: { model: model } })
console.log(res.data);
if(res.data.id == null || res.data.id == ""){
if (res.data == null || res.data == "") {
console.log("公司並無提供此規格!!");
}
this.elevators[idx].price = res.data.price
this.elevators[idx].facility_id = res.data.id
}catch (error) {
this.elevators[idx].price = res.data
} catch (error) {
console.error("Error fetching elevator price:", error);
}
},
async getModalElevatorPrice(){
async getModalElevatorPrice() {
let model = this.modalElevatorInfo.spec + '-' + this.modalElevatorInfo.person + '*' + this.modalElevatorInfo.stop + '-' + this.modalElevatorInfo.open + this.modalElevatorInfo.speed;
try{
const res = await axios.get("./api/getElevatorPrice.php", {params: {model: model}})
try {
const res = await axios.get("./api/getElevatorPrice.php", { params: { model: model } })
console.log(res.data);
if(res.data.id == null || res.data.id == ""){
if (res.data == null || res.data == "") {
console.log("公司並無提供此規格!!");
}
this.modalElevatorInfo.price = res.data.price
this.modalElevatorInfo.facility_id = res.data.id
}catch (error) {
this.modalElevatorInfo.price = res.data
} catch (error) {
console.error("Error fetching elevator price:", error);
}
},
@ -168,147 +167,101 @@ const pricereviewCreate = ()=>{
}
},
optionSubCategory: 1,
initOptinos(){
this.options.forEach(option=>{
initOptinos() {
this.options.forEach(option => {
option.isShow = 1;
})
},
searchOptions(kind=this.kind, subkind=this.subkind){
if(kind!=null) this.kind = kind;
if(subkind!=null) this.subkind = subkind;
searchOptions(kind = this.kind, subkind = this.subkind) {
if (kind != null) this.kind = kind;
if (subkind != null) this.subkind = subkind;
this.initOptinos();
this.initButtons(kind);
this.options.forEach(option=>{
if(option.kind != this.kind && this.kind != 1){
this.options.forEach(option => {
if (option.kind != this.kind && this.kind != 1) {
option.isShow = 0;
}else{
if(option.subkind != this.subkind && this.subkind != 1){
} else {
if (option.subkind != this.subkind && this.subkind != 1) {
option.isShow = 0;
}
}
if(option.isShow == 1){
if(option.group_name == null) option.group_name = ''
if(option.spec == null) option.spec = ''
if(option.memo == null) option.memo = ''
if(option.price == null) option.price = 0
if(option.unit == null) option.unit = ''
if(String(option.id).includes(this.searchtext) || option.group_name.includes(this.searchtext) || option.memo.toLowerCase().includes(this.searchtext) || option.spec.toLowerCase().includes(this.searchtext) || option.unit.includes(this.searchtext) || String(option.price).includes(this.searchtext)){
if (option.isShow == 1) {
if (option.group_name == null) option.group_name = ''
if (option.spec == null) option.spec = ''
if (option.memo == null) option.memo = ''
if (option.price == null) option.price = 0
if (option.unit == null) option.unit = ''
if (String(option.id).includes(this.searchtext) || option.group_name.includes(this.searchtext) || option.memo.toLowerCase().includes(this.searchtext) || option.spec.toLowerCase().includes(this.searchtext) || option.unit.includes(this.searchtext) || String(option.price).includes(this.searchtext)) {
option.isShow = 1
}else{
} else {
option.isShow = 0
}
}
})
},
selectOption(idx, id, name, price, memo){
this.options[idx].selected = this.options[idx].selected==1 ? 0 : 1;
selectOption(idx, id, name, price, memo) {
this.options[idx].selected = this.options[idx].selected == 1 ? 0 : 1;
if(this.modalSelectedOptions.hasOwnProperty(idx)){
if (this.modalSelectedOptions.hasOwnProperty(idx)) {
delete this.modalSelectedOptions[idx];
}else{
} else {
//this.optionKey => 已選option 流水號, idx:option表內的流水號, id:option 資料庫的ID
this.modalSelectedOptions[idx] = {key:this.optionKey, 'idx':idx, 'id': id, 'name': name, 'price': price, qty:1, 'memo': memo, 'toElevator':[] }
this.modalSelectedOptions[idx] = { key: this.optionKey, 'idx': idx, 'id': id, 'name': name, 'price': price, qty: 1, 'memo': memo, 'toElevator': [] }
}
this.optionKey ++;
this.optionKey++;
},
initModalSelectedOptions(){
initModalSelectedOptions() {
this.modalSelectedOptions = {}
this.options.forEach(option=>{
this.options.forEach(option => {
option.selected = 0
})
this.$refs.optionsModal.style.display = "block"
body.style.overflow = 'hidden'
},
chkOptions(){
Object.keys(this.modalSelectedOptions).forEach(option=>{
chkOptions() {
Object.keys(this.modalSelectedOptions).forEach(option => {
this.selectedOptions.push(this.modalSelectedOptions[option])
})
console.log(this.modalSelectedOptions);
console.log(this.selectedOptions);
this.hideOptionsModal();
},
hideOptionsModal(){
hideOptionsModal() {
this.$refs.optionsModal.style.display = 'none';
body.style.overflow = 'auto'
},
hideToElevatorModal(){
this.$refs.toElevatorModal.style.display = 'none';
body.style.overflow = 'auto'
},
hideToOtherOptionElevatorModal(){
this.$refs.toOtherOptionElevatorModal.style.display = 'none';
body.style.overflow = 'auto'
},
hideToMaintainOptionElevatorModal(){
this.$refs.toMaintainOptionElevatorModal.style.display = 'none';
body.style.overflow = 'auto'
},
hideCreateElevatorModal(){
this.$refs.createElevatorModal.style.display = 'none';
body.style.overflow = 'auto'
this.modalElevatorInfo = {
spec:'',
person:'',
stop:'',
speed:'',
open:'CO',
num: 1,
price:'',
sale_price:'',
};
},
hideCreateOtherOptionModal(){
this.$refs.createOtherOptionModal.style.display = 'none';
body.style.overflow = 'auto'
},
hideCreateMaintainModal(){
this.$refs.createMaintainModal.style.display = 'none';
body.style.overflow = 'auto'
},
openCreateElevatorModal(){
this.$refs.createElevatorModal.style.display = 'block';
body.style.overflow = 'hidden'
},
openCreateOtherOptionFn(){
this.$refs.createOtherOptionModal.style.display = 'block';
body.style.overflow = 'hidden'
},
openCreateMaintainModal(){
this.$refs.createMaintainModal.style.display = 'block';
body.style.overflow = 'hidden'
},
totalElevatorsPrice(){
totalElevatorsPrice() {
return this.elevators.reduce((total, elevator) => {
return total + (elevator.spec_num * elevator.price);
}, 0);
},
totalElevatorsNum(){
totalElevatorsNum() {
return this.elevators.reduce((total, elevator) => {
return total + Number(elevator.spec_num);
}, 0)
},
totalElevatorsSalePrice(){
totalElevatorsSalePrice() {
return this.elevators.reduce((total, elevator) => {
return total + (elevator.spec_num * elevator.spec_price);
}, 0);
},
totalOptionsPrice(){
totalOptionsPrice() {
return this.selectedOptions.reduce((total, option) => {
return total + (option.qty * option.price);
}, 0);
},
openAddElevatorFn(){
openAddElevatorFn() {
},
createElevatorFn(){
if(this.modalElevatorInfo.spec == '') return alert("請選擇電梯規格");
if(this.modalElevatorInfo.stop == '') return alert("請填入停數");
if(this.modalElevatorInfo.speed == '') return alert("請選擇速度");
if(this.modalElevatorInfo.open == '') return alert("請選擇開梯方式");
if(this.modalElevatorInfo.person == '') return alert("請填入人乘/載重");
if(this.modalElevatorInfo.num == '') return alert("請填入數量");
if(this.modalElevatorInfo.sale_price == '') return alert("請填入售價");
this.total_spec ++;
createElevatorFn() {
if (this.modalElevatorInfo.spec == '') return alert("請選擇電梯規格");
if (this.modalElevatorInfo.stop == '') return alert("請填入停數");
if (this.modalElevatorInfo.speed == '') return alert("請選擇速度");
if (this.modalElevatorInfo.open == '') return alert("請選擇開梯方式");
if (this.modalElevatorInfo.person == '') return alert("請填入人乘/載重");
if (this.modalElevatorInfo.num == '') return alert("請填入數量");
if (this.modalElevatorInfo.sale_price == '') return alert("請填入售價");
this.total_spec++;
this.elevators.push({
id: this.total_spec,
specifications: this.modalElevatorInfo.spec,
@ -318,14 +271,22 @@ const pricereviewCreate = ()=>{
open_converted: this.modalElevatorInfo.open,
spec_price: this.modalElevatorInfo.sale_price,
price: this.modalElevatorInfo.price,
open:'',
open: '',
spec_num: this.modalElevatorInfo.num,
facility_id: this.modalElevatorInfo.facility_id,
});
console.log(this.elevators);
this.hideCreateElevatorModal();
this.modalElevatorInfo = {
spec: '',
person: '',
stop: '',
speed: '',
open: 'CO',
num: 1,
price: '',
sale_price: '',
};
this.$refs.closeCreateElevatorModalBtn.click();
},
copyElevator(idx){
copyElevator(idx) {
const spec = this.elevators[idx].specifications
const person = this.elevators[idx].person
const stop = this.elevators[idx].stop
@ -337,7 +298,7 @@ const pricereviewCreate = ()=>{
const price = this.elevators[idx].price
const facility_id = this.elevators[idx].facility_id
this.total_spec ++;
this.total_spec++;
this.elevators.push({
id: this.total_spec,
specifications: spec,
@ -353,44 +314,44 @@ const pricereviewCreate = ()=>{
});
console.log(this.elevators);
},
addOptionToElevator(key){
addOptionToElevator(key) {
this.currentOptionKey = key;
this.toElevators = [];
this.toElevatorNo = "";
const matchElevators = this.selectedOptions.filter(option=> option.key == key)[0].toElevator.map(elevator=> elevator.id)
const matchElevators = this.selectedOptions.filter(option => option.key == key)[0].toElevator.map(elevator => elevator.id)
console.log(matchElevators);
this.toElevatorNo = matchElevators[0]
this.elevators.forEach(elevator=>{
if(elevator.price > 0){
this.elevators.forEach(elevator => {
if (elevator.price > 0) {
this.toElevators.push({
id: elevator.id,
model: elevator.specifications + '-' + elevator.person + '*' + elevator.stop + '-' + elevator.open_converted + elevator.speed,
checked: matchElevators.includes(elevator.id) ? 1: 0,
checked: matchElevators.includes(elevator.id) ? 1 : 0,
})
}
})
this.$refs.toElevatorModal.style.display = 'block';
body.style.overflow = 'hidden'
},
addOtherOptionToElevator(id){
addOtherOptionToElevator(id) {
this.currentOtherOptionKey = id;
this.toElevators = [];
this.toElevatorNo = "";
const matchElevators = this.otherOptions.filter(option=> option.id == id)[0].toElevator.map(elevator=> elevator.id)
const matchElevators = this.otherOptions.filter(option => option.id == id)[0].toElevator.map(elevator => elevator.id)
this.toElevatorNo = matchElevators[0]
this.elevators.forEach(elevator=>{
if(elevator.price > 0){
this.elevators.forEach(elevator => {
if (elevator.price > 0) {
this.toElevators.push({
id: elevator.id,
model: elevator.specifications + '-' + elevator.person + '*' + elevator.stop + '-' + elevator.open_converted + elevator.speed,
checked: matchElevators.includes(elevator.id) ? 1: 0,
checked: matchElevators.includes(elevator.id) ? 1 : 0,
})
}
})
this.$refs.toOtherOptionElevatorModal.style.display = 'block';
body.style.overflow = 'hidden'
},
chkOptionToElevators(){
chkOptionToElevators() {
const checkedOptions = [];
// this.toElevators.forEach(elevator=>{
// if(elevator.checked){
@ -400,13 +361,13 @@ const pricereviewCreate = ()=>{
// });
// }
// })
const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0]
const matchElevators = this.elevators.filter(elevator => elevator.id == this.toElevatorNo)[0]
checkedOptions.push({
id: this.toElevatorNo,
model: matchElevators['specifications'] + '-' + matchElevators['person'] + '*' + matchElevators['stop'] + '-' + matchElevators['open_converted'] + matchElevators['speed'],
})
this.selectedOptions.forEach(option=>{
if(option.key == this.currentOptionKey){
this.selectedOptions.forEach(option => {
if (option.key == this.currentOptionKey) {
option.toElevator = [];
option.toElevator.push(...checkedOptions)
}
@ -414,7 +375,7 @@ const pricereviewCreate = ()=>{
this.currentOptionKey = ''
this.hideToElevatorModal();
},
chkOtherOptionToElevators(){
chkOtherOptionToElevators() {
const checkedOptions = [];
// this.toElevators.forEach(elevator=>{
// if(elevator.checked){
@ -424,13 +385,13 @@ const pricereviewCreate = ()=>{
// });
// }
// })
const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0]
const matchElevators = this.elevators.filter(elevator => elevator.id == this.toElevatorNo)[0]
checkedOptions.push({
id: this.toElevatorNo,
model: matchElevators['specifications'] + '-' + matchElevators['person'] + '*' + matchElevators['stop'] + '-' + matchElevators['open_converted'] + matchElevators['speed'],
})
this.otherOptions.forEach(option=>{
if(option.id == this.currentOtherOptionKey){
this.otherOptions.forEach(option => {
if (option.id == this.currentOtherOptionKey) {
option.toElevator = [];
option.toElevator.push(...checkedOptions)
}
@ -440,36 +401,36 @@ const pricereviewCreate = ()=>{
this.hideToOtherOptionElevatorModal();
},
removeElevator(id){
if(!confirm("確定刪除嗎?")) return;
this.elevators = this.elevators.filter(elevator=> elevator.id != id)
removeElevator(id) {
if (!confirm("確定刪除嗎?")) return;
this.elevators = this.elevators.filter(elevator => elevator.id != id)
const issetElevators = [];
this.elevators.forEach(elevator=>{
this.elevators.forEach(elevator => {
issetElevators.push(elevator.id);
})
this.selectedOptions.forEach(option=>{
option.toElevator = option.toElevator.filter(el=>{
this.selectedOptions.forEach(option => {
option.toElevator = option.toElevator.filter(el => {
return issetElevators.includes(el.id)
})
})
console.log(this.selectedOptions);
},
removeOption(key){
removeOption(key) {
console.log(this.selectedOptions);
this.selectedOptions = this.selectedOptions.filter(option=> option.key != key)
this.selectedOptions = this.selectedOptions.filter(option => option.key != key)
},
removeOtherOption(id){
this.otherOptions = this.otherOptions.filter(option=> option.id != id)
removeOtherOption(id) {
this.otherOptions = this.otherOptions.filter(option => option.id != id)
},
createOtherOptionFn(){
createOtherOptionFn() {
this.otherOptions.push({
id: this.otherOptionKey,
pr_no: this.modalOtherOptionInfo.pr_no,
name: this.modalOtherOptionInfo.name,
price: this.modalOtherOptionInfo.price,
num: this.modalOtherOptionInfo.num,
toElevator:[],
toElevator: [],
})
this.modalOtherOptionInfo = {
pr_no: '',
@ -477,46 +438,47 @@ const pricereviewCreate = ()=>{
price: 0,
num: '',
}
this.otherOptionKey ++;
this.hideCreateOtherOptionModal();
this.otherOptionKey++;
console.log(this.otherOptions);
this.$refs.closeCreateOtherOptionModalBtn.click();
},
totalOtherOptionsPrice(){
totalOtherOptionsPrice() {
return this.otherOptions.reduce((total, option) => {
return total + (Number(option.num) * Number(option.price));
}, 0);
},
totalOtherOptionsNum(){
totalOtherOptionsNum() {
return this.otherOptions.reduce((total, option) => {
return total + Number(option.num);
}, 0);
},
createMaintainOptionFn(){
createMaintainOptionFn() {
this.maintainOptions.push({
id: this.maintainOptionKey,
price: this.modalMaintainInfo.price,
num: this.modalMaintainInfo.num,
memo: this.modalMaintainInfo.memo,
toElevator:[],
toElevator: [],
})
this.modalMaintainInfo = {
price:0,
num:"",
memo:"",
price: 0,
num: "",
memo: "",
}
this.maintainOptionKey ++;
this.hideCreateMaintainModal();
this.maintainOptionKey++;
this.$refs.closeCreateMaintainOptionModalBtn.click();
},
totalMaintainOptionsPrice(){
totalMaintainOptionsPrice() {
return this.maintainOptions.reduce((total, option) => {
return total + (Number(option.num) * Number(option.price));
}, 0);
},
totalMaintainOptionsNum(){
totalMaintainOptionsNum() {
return this.maintainOptions.reduce((total, option) => {
return total + Number(option.num);
}, 0);
},
chkMaintainOptionToElevators(){
chkMaintainOptionToElevators() {
const checkedOptions = [];
// this.toElevators.forEach(elevator=>{
// if(elevator.checked){
@ -526,13 +488,13 @@ const pricereviewCreate = ()=>{
// });
// }
// })
const matchElevators = this.elevators.filter(elevator=> elevator.id == this.toElevatorNo)[0]
const matchElevators = this.elevators.filter(elevator => elevator.id == this.toElevatorNo)[0]
checkedOptions.push({
id: this.toElevatorNo,
model: matchElevators['specifications'] + '-' + matchElevators['person'] + '*' + matchElevators['stop'] + '-' + matchElevators['open_converted'] + matchElevators['speed'],
})
this.maintainOptions.forEach(option=>{
if(option.id == this.currentMaintainOptionKey){
this.maintainOptions.forEach(option => {
if (option.id == this.currentMaintainOptionKey) {
option.toElevator = [];
option.toElevator.push(...checkedOptions)
}
@ -540,18 +502,18 @@ const pricereviewCreate = ()=>{
this.currentMaintainOptionKey = ''
this.hideToMaintainOptionElevatorModal();
},
addMaintainOptionToElevator(id){
addMaintainOptionToElevator(id) {
this.currentMaintainOptionKey = id;
this.toElevators = [];
this.toElevatorNo = "";
const matchElevators = this.maintainOptions.filter(option=> option.id == id)[0].toElevator.map(elevator=> elevator.id)
const matchElevators = this.maintainOptions.filter(option => option.id == id)[0].toElevator.map(elevator => elevator.id)
this.toElevatorNo = matchElevators[0]
this.elevators.forEach(elevator=>{
if(elevator.price > 0){
this.elevators.forEach(elevator => {
if (elevator.price > 0) {
this.toElevators.push({
id: elevator.id,
model: elevator.specifications + '-' + elevator.person + '*' + elevator.stop + '-' + elevator.open_converted + elevator.speed,
checked: matchElevators.includes(elevator.id) ? 1: 0,
checked: matchElevators.includes(elevator.id) ? 1 : 0,
})
}
})
@ -559,32 +521,32 @@ const pricereviewCreate = ()=>{
this.$refs.toMaintainOptionElevatorModal.style.display = 'block';
body.style.overflow = 'hidden'
},
removeMaintainOption(id){
this.maintainOptions = this.maintainOptions.filter(option=> option.id != id)
removeMaintainOption(id) {
this.maintainOptions = this.maintainOptions.filter(option => option.id != id)
},
totalPrice(){
totalPrice() {
return this.totalElevatorsPrice() + this.totalOptionsPrice() + this.totalOtherOptionsPrice() + this.totalMaintainOptionsPrice();
},
totalSalePrice(){
totalSalePrice() {
return this.elevators.reduce((total, elevator) => {
return total + (elevator.spec_num * elevator.spec_price);
}, 0);
},
scalePrice(scale){
if(scale === '') return 0;
scalePrice(scale) {
if (scale === '') return 0;
return this.totalSalePrice() * scale / 100;
},
totalScale(){
totalScale() {
let total = 0;
Object.keys(this.paymentRatio).forEach(pay=>{
if(this.paymentRatio[pay].scale != '' && this.paymentRatio[pay].scale > 0){
Object.keys(this.paymentRatio).forEach(pay => {
if (this.paymentRatio[pay].scale != '' && this.paymentRatio[pay].scale > 0) {
total += Number(this.paymentRatio[pay].scale)
}
})
return total;
},
customerInfo:{
customerInfo: {
contractno: contractno,
company: customer,
manager: manager,
@ -593,52 +555,11 @@ const pricereviewCreate = ()=>{
uscc: uscc,
person: salesman,
},
penalty:"",
deposit_rate:0,
keep_rate:0,
warranty_rate:0,
error: [],
submit(){
this.error = []
for(let i=0;i<this.elevators.length;i++){
if(this.elevators[i].specifications =='') this.error.push("整機單價:規格不能為空");
if(this.elevators[i].person =='') this.error.push("整機單價:人數不能為空");
if(this.elevators[i].stop =='') this.error.push("整機單價:梯數不能為空");
if(this.elevators[i].speed =='') this.error.push("整機單價:速度不能為空");
if(this.elevators[i].open_converted =='') this.error.push("整機單價:開梯方式不能為空");
if(this.elevators[i].price =='') this.error.push("整機單價:公司發布價無此規格");
if(this.elevators[i].spec_price <= 0) this.error.push("整機單價:售價需大於0");
if(this.elevators[i].spec_num <= 0) this.error.push("整機單價:電梯數量需大於0");
}
for(let i=0;i<this.selectedOptions.length;i++){
if(this.selectedOptions[i].qty =='' ) this.error.push("Option:數量需大於0")
if(this.selectedOptions[i].toElevator.length <= 0) this.error.push("Option:需配對至電梯")
}
for(let i=0;i<this.otherOptions.length;i++){
if(this.otherOptions[i].name == '' ) this.error.push("除外項目:名稱不得為空");
if(this.otherOptions[i].price == '' ) this.error.push("除外項目:價錢需大於0");
if(this.otherOptions[i].num == '' ) this.error.push("除外項目:數量需大於0");
if(this.otherOptions[i].toElevator.length <= 0) this.error.push("除外項目:需配對至電梯")
}
for(let i=0;i<this.maintainOptions.length;i++){
if(this.maintainOptions[i].price == '' ) this.error.push("保固延長:價錢需大於0");
if(this.maintainOptions[i].num == '' ) this.error.push("保固延長:數量需大於0");
if(this.maintainOptions[i].toElevator.length <= 0) this.error.push("保固延長:需配對至電梯")
}
if(this.totalScale() != 100) this.error.push('付款辦法比例需等於100%')
if(this.transactionDate == '') this.error.push('預定成交日不得為空')
if(this.shippingDate == '') this.error.push('預定出貨日不得為空')
if(this.error.length > 0){
let errortext = '';
this.error.forEach(err=>{
errortext += err+'\n';
})
alert(errortext)
return;
}
penalty: "",
deposit_rate: 0,
keep_rate: 0,
warranty_rate: 0,
submit() {
const form = new FormData();
form.append('contractno', contractno);
form.append('ekind', "新梯");
@ -648,7 +569,7 @@ const pricereviewCreate = ()=>{
form.append('address', this.customerInfo.address);
form.append('price_lowest', this.totalPrice());
form.append('price_total', this.totalSalePrice());
form.append('price_rate', Math.round(this.totalSalePrice() / this.totalPrice() * 100 *10) / 10);
form.append('price_rate', Math.round(this.totalSalePrice() / this.totalPrice() * 100 * 10) / 10);
form.append('special_fee', this.serviceFee);
form.append('predeal_date', this.transactionDate);
form.append('facilitok_date', this.shippingDate);
@ -670,26 +591,24 @@ const pricereviewCreate = ()=>{
form.append('paymentRatio', JSON.stringify(this.paymentRatio));
axios.post('./api/postNewElevatorPricereview.php', form).then(res=>{
axios.post('./api/postNewElevatorPricereview.php', form).then(res => {
console.log(res.data);
if(res.data == "success"){
if (res.data == "success") {
alert("送審成功!");
window.location.href = './pricereview-index.php?' + token_link;
}
}).catch(err=>{
}).catch(err => {
console.error(err);
})
},
}
}
const pricereviewCheck = ()=>{
const pricereviewCheck = () => {
return {
init(){
this.elevators = items.filter(item=> item.item_group =='A');
this.elevators.forEach(el=>{
init() {
this.elevators = items.filter(item => item.item_group == 'A');
this.elevators.forEach(el => {
el.options = []
el.optionsTotalPrice = 0;
el.otherOptions = []
@ -698,18 +617,18 @@ const pricereviewCheck = ()=>{
el.maintainOptionsTotalPrice = 0;
})
this.options = options;
this.otherOptions = items.filter(item=> item.item_group =='E');
this.maintainOptions = items.filter(item=> item.item_group =='D');
this.otherOptions = items.filter(item => item.item_group == 'E');
this.maintainOptions = items.filter(item => item.item_group == 'D');
console.log(this.options);
this.elevators.forEach((elevator, idx)=>{
this.elevators.forEach((elevator, idx) => {
this.options.forEach(option=>{
if(option.option_relate_spec == elevator.item_no){
this.options.forEach(option => {
if (option.option_relate_spec == elevator.item_no) {
elevator.optionsTotalPrice += option.option_mi * option.item_qty
this.elevators[idx].options.push({
'id': option.id, //&amp;lt;br&amp;gt;()
'item_spec': option.item_spec.trim().replaceAll('&amp;', '').replaceAll('lt;', '').replaceAll('br', '').replaceAll('gt;', '').replaceAll('()', ''),
'id': option.id,
'item_spec': option.item_spec.trim(),
'item_unit_price': option.item_unit_price,
'item_qty': option.item_qty,
'mi': Math.round(option.option_mi),
@ -717,8 +636,8 @@ const pricereviewCheck = ()=>{
}
})
this.otherOptions.forEach(option=>{
if(option.option_relate_spec == elevator.item_no){
this.otherOptions.forEach(option => {
if (option.option_relate_spec == elevator.item_no) {
elevator.otherOptionsTotalPrice += option.item_unit_price * option.item_qty
this.elevators[idx].otherOptions.push({
'id': option.id,
@ -730,8 +649,8 @@ const pricereviewCheck = ()=>{
}
})
this.maintainOptions.forEach(option=>{
if(option.option_relate_spec == elevator.item_no){
this.maintainOptions.forEach(option => {
if (option.option_relate_spec == elevator.item_no) {
elevator.maintainOptionsTotalPrice += option.item_unit_price * option.item_qty
this.elevators[idx].maintainOptions.push({
'id': option.id,
@ -751,8 +670,8 @@ const pricereviewCheck = ()=>{
let stop = model.split('-')[1].split('*')[1].split('-')[0];
let open = model.split('-')[2];
let speed = '';
for(let i=0;i<this.openFn.length;i++){
if(open.includes(this.openFn[i])){
for (let i = 0; i < this.openFn.length; i++) {
if (open.includes(this.openFn[i])) {
speed = open.replace(this.openFn[i], '')
open = this.openFn[i];
break;
@ -761,29 +680,26 @@ const pricereviewCheck = ()=>{
this.getElevatorMi(idx, spec, person, stop, open, speed, elevator.item_weight)
});
this.sign1 = this.getUsername(sign1)
this.sign2 = this.getUsername(sign2)
this.sign3 = this.getUsername(sign3)
this.sign4 = this.getUsername(sign4)
})
},
async getElevatorMi(idx, spec, person, stop, open, speed, item_weight){
try{
const res = await axios.get('./api/getElevatorMi.php', {params: {
async getElevatorMi(idx, spec, person, stop, open, speed, item_weight) {
try {
const res = await axios.get('./api/getElevatorMi.php', {
params: {
spec: spec,
person: person,
stop: stop,
open: open,
speed: speed,
weight: item_weight
}})
console.log('---->',res.data);
if(res.data){
}
})
console.log('---->', res.data);
if (res.data) {
this.elevators[idx].mi = res.data
this.elevators[idx].totalMi = res.data['equipment_fee'] + res.data['customs_shipping_fee'] + res.data['free1y_fee'] + res.data['install_fee'] + res.data['other_fee'] + res.data['transport_site_fee'] + res.data['unloading_fee'];
}else{
} else {
this.isNotfoundMi = true;
this.elevators[idx].mi = {
'equipment_fee': 0,
@ -799,18 +715,18 @@ const pricereviewCheck = ()=>{
console.log(this.elevators[idx]);
}catch (error) {
} catch (error) {
console.error("Error fetching elevator price:", error);
}
},
isNotfoundMi:false,
openFn:[
isNotfoundMi: false,
openFn: [
'CO', '2S', '2U', '4PCO', '6PCO'
],
sign1:'',
sign2:'',
sign3:'',
sign4:'',
sign1: '',
sign2: '',
sign3: '',
sign4: '',
is_renovate: false,
elevators_total_price: 0,
contractno: contractno,
@ -830,53 +746,68 @@ const pricereviewCheck = ()=>{
memo: memo,
qty: 0,
pays: pays,
elevators:[],
elevators: [],
options: [],
otherOptions: [],
maintainOptions: [],
mid: mid,
user_id: user_id,
reviewcomment:'',
optionsTotalPrice(){
optionsTotalPrice() {
return this.options.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
}, 0);
},
otherOptionsTotalPrice(){
otherOptionsTotalPrice() {
return this.otherOptions.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
}, 0);
},
maintainOptionsTotalPrice(){
maintainOptionsTotalPrice() {
return this.maintainOptions.reduce((total, option) => {
return total + (option.item_qty * option.item_unit_price);
}, 0);
},
totalScale(){
totalScale() {
return this.pays.reduce((total, option) => {
return total + Number(option.pay_scale );
return total + Number(option.pay_scale);
}, 0);
},
check(sign, status){
check(sign, status) {
console.log(sign);
const form = new FormData();
form.append('sign', sign);
form.append('mid', this.mid);
form.append('result', status);
form.append('user_id', this.user_id);
form.append('reviewcomment', this.reviewcomment);
axios.post('./api/postPricereviewSign.php', form).then(res=>{
axios.post('./api/postPricereviewSign.php', form).then(res => {
console.log(res.data);
if(res.data == 1){
if (res.data == 1) {
alert("簽核成功!");
window.location.reload()
}
})
},
async getUsername(user_id){
if(user_id == '') return '---'
const res = await axios.get('./api/getUsername.php', {params: {user_id: user_id}})
return res.data ;
agree(sign) {
console.log(sign);
},
closeCase(sign) {
console.log(sign);
},
}
}
const pricereviewMaintainCreate = () => {
return {
init() {
// this.elevators = elevator;
},
elevator: [],
async getElevatorPrice(idx) {
const spec = this.elevator[idx].specifications;
const person = this.elevators[idx].person;
},
}
}

188
wms/mkt/css/pricereview.css

@ -1,34 +1,58 @@
#pricereviewCreate input[type=text], #pricereviewCreate input[type=number], #pricereviewCreate select {
#pricereviewCreate input[type=text],
#pricereviewCreate input[type=number],
#pricereviewCreate select {
margin: 1px;
}
#pricereviewCreate textarea {
resize: vertical;
}
#pricereviewCreate > .modal {
#pricereviewCreate>.modal {
padding: 20px;
}
#pricereviewCreate > .modal table, #pricereviewCreate > .modal th, #pricereviewCreate > .modal td {
#pricereviewCreate>.modal table,
#pricereviewCreate>.modal th,
#pricereviewCreate>.modal td {
border: 1px #ccc solid;
}
#pricereviewCreate > .modal table > thead tr th {
#pricereviewCreate>.modal table>thead tr th {
color: #A52A2A;
}
#pricereviewCreate > .modal table > tbody .selected {
#pricereviewCreate>.modal table>tbody .selected {
background-color: #E7FEFB;
}
#pricereviewCreate .container table, #pricereviewCreate .container th, #pricereviewCreate .container td {
#pricereviewCreate .container table,
#pricereviewCreate .container th,
#pricereviewCreate .container td {
border: 1px #ccc solid;
padding: 15px;
}
#pricereviewCreate .container table.noborder, #pricereviewCreate .container table .noborder th, #pricereviewCreate .container table .noborder td, #pricereviewCreate .container th.noborder, #pricereviewCreate .container th .noborder th, #pricereviewCreate .container th .noborder td, #pricereviewCreate .container td.noborder, #pricereviewCreate .container td .noborder th, #pricereviewCreate .container td .noborder td {
#pricereviewCreate .container table.noborder,
#pricereviewCreate .container table .noborder th,
#pricereviewCreate .container table .noborder td,
#pricereviewCreate .container th.noborder,
#pricereviewCreate .container th .noborder th,
#pricereviewCreate .container th .noborder td,
#pricereviewCreate .container td.noborder,
#pricereviewCreate .container td .noborder th,
#pricereviewCreate .container td .noborder td {
border: none;
}
#pricereviewCreate .container table thead th {
background-color: #6D9EEB;
}
#pricereviewCreate .container table tbody td input {
font-size: 14px;
}
#pricereviewCreate .container table tbody th {
background-color: #CCE4F8;
font-size: 14px;
@ -36,15 +60,18 @@
min-width: 100px;
text-align: center;
}
#pricereviewCreate .container table input {
font-size: 13px;
}
#pricereviewCreate .container .pricreviewmain {
background-color: #F2F2F2;
padding: 20px;
border-radius: 6px;
margin: 30px 0;
}
#pricereviewCreate .container .pricreviewmain button {
color: #fff;
width: 55px;
@ -53,56 +80,81 @@
margin-left: 10px;
font-size: 13px;
}
#pricereviewCreate .container .pricreviewmain button.addbtn {
background-color: #337AB7;
width: 30px;
}
#pricereviewCreate .container .pricreviewmain button.deleteBtn {
background-color: #D9534F;
color: #fff;
font-size: 12px;
width: 30px;
}
#pricereviewCreate .container .pricreviewmain button.selectElevator {
background-color: #D9534F;
color: #fff;
}
#pricereviewCreate .container .pricreviewmain > .divitem {
#pricereviewCreate .container .pricreviewmain>.divitem {
border: 1px #ccc solid;
padding: 10px;
border-radius: 4px;
}
#pricereviewCreate .container .pricreviewmain > .divitem .title {
#pricereviewCreate .container .pricreviewmain>.divitem .title {
display: flex;
align-items: center;
border-bottom: 1px #ccc solid;
padding: 10px 0;
margin-bottom: 10px;
}
#pricereviewCreate .container .pricreviewmain > .divitem .title h6 {
#pricereviewCreate .container .pricreviewmain>.divitem .title h6 {
font-weight: 600;
}
#pricereviewCreate .container .pricreviewmain > .divitem table, #pricereviewCreate .container .pricreviewmain > .divitem th, #pricereviewCreate .container .pricreviewmain > .divitem td {
#pricereviewCreate .container .pricreviewmain>.divitem table,
#pricereviewCreate .container .pricreviewmain>.divitem th,
#pricereviewCreate .container .pricreviewmain>.divitem td {
font-size: 14px;
background-color: transparent;
}
#pricereviewCreate .container .pricreviewmain > .divitem table input, #pricereviewCreate .container .pricreviewmain > .divitem table select, #pricereviewCreate .container .pricreviewmain > .divitem table textarea, #pricereviewCreate .container .pricreviewmain > .divitem th input, #pricereviewCreate .container .pricreviewmain > .divitem th select, #pricereviewCreate .container .pricreviewmain > .divitem th textarea, #pricereviewCreate .container .pricreviewmain > .divitem td input, #pricereviewCreate .container .pricreviewmain > .divitem td select, #pricereviewCreate .container .pricreviewmain > .divitem td textarea {
#pricereviewCreate .container .pricreviewmain>.divitem table input,
#pricereviewCreate .container .pricreviewmain>.divitem table select,
#pricereviewCreate .container .pricreviewmain>.divitem table textarea,
#pricereviewCreate .container .pricreviewmain>.divitem th input,
#pricereviewCreate .container .pricreviewmain>.divitem th select,
#pricereviewCreate .container .pricreviewmain>.divitem th textarea,
#pricereviewCreate .container .pricreviewmain>.divitem td input,
#pricereviewCreate .container .pricreviewmain>.divitem td select,
#pricereviewCreate .container .pricreviewmain>.divitem td textarea {
font-size: 13px;
}
#pricereviewCreate .container .pricreviewmain > .divitem table input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain > .divitem table input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .container .pricreviewmain > .divitem th input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain > .divitem th input[type=number]::-webkit-inner-spin-button, #pricereviewCreate .container .pricreviewmain > .divitem td input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain > .divitem td input[type=number]::-webkit-inner-spin-button {
#pricereviewCreate .container .pricreviewmain>.divitem table input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem table input[type=number]::-webkit-inner-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem th input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem th input[type=number]::-webkit-inner-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem td input[type=number]::-webkit-outer-spin-button,
#pricereviewCreate .container .pricreviewmain>.divitem td input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
#pricereviewCreate .container .pricreviewmain > .divitem table tr:hover .deleteBtn, #pricereviewCreate .container .pricreviewmain > .divitem table tr:hover .copyBtn {
#pricereviewCreate .container .pricreviewmain>.divitem table tr:hover .deleteBtn,
#pricereviewCreate .container .pricreviewmain>.divitem table tr:hover .copyBtn {
opacity: 1;
}
#pricereviewCreate .container .pricreviewmain > .divitem table .saletd {
#pricereviewCreate .container .pricreviewmain>.divitem table .saletd {
position: relative;
}
#pricereviewCreate .container .pricreviewmain > .divitem table .saletd > .deleteBtn {
#pricereviewCreate .container .pricreviewmain>.divitem table .saletd>.deleteBtn {
position: absolute;
top: 50%;
transform: translateY(-50%);
@ -110,7 +162,8 @@
opacity: 0;
transition: 0.3s;
}
#pricereviewCreate .container .pricreviewmain > .divitem table .saletd > .copyBtn {
#pricereviewCreate .container .pricreviewmain>.divitem table .saletd>.copyBtn {
position: absolute;
top: 50%;
transform: translateY(-50%);
@ -120,29 +173,35 @@
width: 30px;
height: 30px;
}
#pricereviewCreate .container .pricreviewmain > .divitem table textarea {
#pricereviewCreate .container .pricreviewmain>.divitem table textarea {
height: auto;
min-height: 50px;
}
#pricereviewCreate .container .pricreviewmain > .filediv {
#pricereviewCreate .container .pricreviewmain>.filediv {
display: flex;
flex-direction: column;
margin-top: 20px;
}
#pricereviewCreate .container .pricreviewmain > .filediv label {
#pricereviewCreate .container .pricreviewmain>.filediv label {
display: flex;
align-items: center;
margin: 10px 0;
}
#pricereviewCreate .container .pricreviewmain > .filediv label p {
#pricereviewCreate .container .pricreviewmain>.filediv label p {
width: 100px;
font-size: 15px;
font-weight: 600;
}
#pricereviewCreate .container .pricreviewmain > .filediv label input[type=file] {
#pricereviewCreate .container .pricreviewmain>.filediv label input[type=file] {
width: 400px;
}
#pricereviewCreate .container .pricreviewmain > .filediv label button {
#pricereviewCreate .container .pricreviewmain>.filediv label button {
width: 90px;
height: 35px;
margin: 0;
@ -150,14 +209,19 @@
margin-top: 20px;
}
.container-fluid, .container {
.container-fluid,
.container {
max-width: 1400px !important;
width: 100%;
}
.container-fluid h4, .container h4 {
.container-fluid h4,
.container h4 {
font-weight: 600;
}
.container-fluid .btn-secondary, .container .btn-secondary {
.container-fluid .btn-secondary,
.container .btn-secondary {
background-color: #6C757D;
}
@ -172,39 +236,51 @@
padding: 20px;
display: none;
}
@keyframes fade-in {
0% {
transform: translate(-50%, -60%);
opacity: 0;
}
100% {
transform: translate(-50%, -55%);
opacity: 1;
}
}
.window-modal table, .window-modal th, .window-modal td {
.window-modal table,
.window-modal th,
.window-modal td {
border: 1px #ccc solid;
}
.window-modal table > thead tr th {
.window-modal table>thead tr th {
color: #A52A2A;
}
.window-modal table > tbody .selected {
.window-modal table>tbody .selected {
background-color: #E7FEFB;
}
.window-modal#optionModal .window-modal-content {
max-height: 80vh;
}
.window-modal#optionModal .window-modal-content .window-modal-body {
height: 400px;
overflow-y: scroll;
}
.window-modal#toElevatorModal .window-modal-content {
min-height: 270px;
height: auto;
}
.window-modal#toElevatorModal .window-modal-content .window-modal-body {
height: auto;
}
.window-modal .window-modal-content {
z-index: 9;
background-color: #fff;
@ -218,19 +294,24 @@
box-shadow: 0 5px 5px #222;
animation: fade-in 0.2s linear;
}
.window-modal .window-modal-content.modal-xl {
width: 1200px;
}
.window-modal .window-modal-content.modal-lg {
width: 800px;
}
.window-modal .window-modal-content.modal-m {
width: 450px;
}
.window-modal .window-modal-content .window-modal-header {
display: flex;
flex-direction: column;
}
.window-modal .window-modal-content .window-modal-header button.btn-close {
position: absolute;
top: 10px;
@ -240,9 +321,11 @@
outline: none;
border-radius: 50%;
}
.window-modal .window-modal-content .window-modal-header > div > input {
.window-modal .window-modal-content .window-modal-header>div>input {
width: 250px;
}
.window-modal .window-back {
position: absolute;
top: 0;
@ -252,45 +335,60 @@
background-color: transparent;
}
#pricereviewCheck > .container {
#pricereviewCheck>.container {
background-color: #F2F2F2;
border-radius: 15px;
padding: 20px;
}
#pricereviewCheck > .container textarea {
#pricereviewCheck>.container textarea {
resize: vertical;
}
#pricereviewCheck > .container table, #pricereviewCheck > .container th, #pricereviewCheck > .container td {
#pricereviewCheck>.container table,
#pricereviewCheck>.container th,
#pricereviewCheck>.container td {
border: 1px #ccc solid;
}
#pricereviewCheck > .container table.noborder {
#pricereviewCheck>.container table.noborder {
border: none !important;
}
#pricereviewCheck > .container table.noborder th, #pricereviewCheck > .container table.noborder td {
#pricereviewCheck>.container table.noborder th,
#pricereviewCheck>.container table.noborder td {
border: none !important;
}
#pricereviewCheck > .container .customerinfo-table input {
#pricereviewCheck>.container .customerinfo-table input {
background-color: #EEE5E5;
}
#pricereviewCheck > .container .mi-table th {
#pricereviewCheck>.container .mi-table th {
font-weight: 600;
}
#pricereviewCheck > .container .mi-table input[type=text] {
#pricereviewCheck>.container .mi-table input[type=text] {
background-color: #EEEEEE;
cursor: not-allowed;
padding: 6px 12px;
font-size: 14px;
}
#pricereviewCheck > .container .mi-table .mi-info {
#pricereviewCheck>.container .mi-table .mi-info {
font-size: 14px;
}
#pricereviewCheck > .container .mi-table .mi-info span {
#pricereviewCheck>.container .mi-table .mi-info span {
font-size: 15px;
font-weight: 600;
}
#pricereviewCheck > .container .mi-table .mi-info .line {
#pricereviewCheck>.container .mi-table .mi-info .line {
width: 100%;
height: 0.5px;
margin: 30px 0;
background-color: #ccc;
}/*# sourceMappingURL=pricereview.css.map */
}
/*# sourceMappingURL=pricereview.css.map */

11
wms/mkt/css/pricereview.css.map

@ -1 +1,10 @@
{"version":3,"sources":["pricereview.scss","pricereview.css"],"names":[],"mappings":"AACI;EACI,WAAA;ACAR;ADEI;EACI,gBAAA;ACAR;ADEI;EACI,aAAA;ACAR;ADCQ;EACI,sBAAA;ACCZ;ADCQ;EACI,cAAA;ACCZ;ADCQ;EACI,yBAAA;ACCZ;ADKQ;EACI,sBAAA;EACA,aAAA;ACHZ;ADIY;EACI,YAAA;ACFhB;ADMY;EACI,yBAAA;ACJhB;ADOgB;EACI,eAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACLpB;ADQY;EACI,eAAA;ACNhB;ADSQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ACPZ;ADQY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACNhB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADSY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACPhB;ADQgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACNpB;ADOoB;EACI,gBAAA;ACLxB;ADSgB;EACI,eAAA;EACA,6BAAA;ACPpB;ADQoB;EACI,eAAA;ACNxB;ADQoB;;;;EAEA,wBAAA;EACA,SAAA;ACJpB;ADQoB;EACI,UAAA;ACNxB;ADQoB;EACI,kBAAA;ACNxB;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACL5B;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ACL5B;ADQoB;EACI,YAAA;EACA,gBAAA;ACNxB;ADUY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ACRhB;ADSgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ACPpB;ADQoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ACNxB;ADQoB;EACI,YAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ACNxB;;ADcA;EACI,4BAAA;EACA,WAAA;ACXJ;ADYI;EACI,gBAAA;ACVR;ADYI;EACI,yBAAA;ACVR;;ADcA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;ACXJ;ADYI;EACI;IACI,gCAAA;IACA,UAAA;ECVV;EDYM;IACI,gCAAA;IACA,UAAA;ECVV;AACF;ADYI;EACI,sBAAA;ACVR;ADYI;EACI,cAAA;ACVR;ADYI;EACI,yBAAA;ACVR;ADYI;EACI,gBAAA;ACVR;ADWQ;EACI,aAAA;EACA,kBAAA;ACTZ;ADYI;EACI,iBAAA;EACA,YAAA;ACVR;ADWQ;EACI,YAAA;ACTZ;ADYI;EACI,UAAA;EACA,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,aAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,8BAAA;ACVR;ADWQ;EACI,aAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,aAAA;EACA,sBAAA;ACTZ;ADUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ACRhB;ADUY;EACI,YAAA;ACRhB;ADYI;EACI,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,6BAAA;ACVR;;ADeI;EACI,yBAAA;EACA,mBAAA;EACA,aAAA;ACZR;ADaQ;EACI,gBAAA;ACXZ;ADaQ;EACI,sBAAA;ACXZ;ADaQ;EACI,uBAAA;ACXZ;ADYY;EACI,uBAAA;ACVhB;ADcY;EACI,yBAAA;ACZhB;ADgBY;EACI,gBAAA;ACdhB;ADgBY;EACI,yBAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACdhB;ADgBY;EACI,eAAA;ACdhB;ADegB;EACI,eAAA;EACA,gBAAA;ACbpB;ADegB;EACI,WAAA;EACA,aAAA;EACA,cAAA;EACA,sBAAA;ACbpB","file":"pricereview.css"}
{
"version": 3,
"sources": [
"pricereview.scss",
"pricereview.css"
],
"names": [],
"mappings": "AACI;EACI,WAAA;ACAR;ADEI;EACI,gBAAA;ACAR;ADEI;EACI,aAAA;ACAR;ADCQ;EACI,sBAAA;ACCZ;ADCQ;EACI,cAAA;ACCZ;ADCQ;EACI,yBAAA;ACCZ;ADKQ;EACI,sBAAA;EACA,aAAA;ACHZ;ADIY;EACI,YAAA;ACFhB;ADMY;EACI,yBAAA;ACJhB;ADOgB;EACI,eAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,eAAA;EACA,iBAAA;EACA,gBAAA;EACA,kBAAA;ACLpB;ADQY;EACI,eAAA;ACNhB;ADSQ;EACI,yBAAA;EACA,aAAA;EACA,kBAAA;EACA,cAAA;ACPZ;ADQY;EACI,WAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,iBAAA;EACA,eAAA;ACNhB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;EACA,eAAA;EACA,WAAA;ACLpB;ADOgB;EACI,yBAAA;EACA,WAAA;ACLpB;ADSY;EACI,sBAAA;EACA,aAAA;EACA,kBAAA;ACPhB;ADQgB;EACI,aAAA;EACA,mBAAA;EACA,6BAAA;EACA,eAAA;EACA,mBAAA;ACNpB;ADOoB;EACI,gBAAA;ACLxB;ADSgB;EACI,eAAA;EACA,6BAAA;ACPpB;ADQoB;EACI,eAAA;ACNxB;ADQoB;;;;EAEA,wBAAA;EACA,SAAA;ACJpB;ADQoB;EACI,UAAA;ACNxB;ADQoB;EACI,kBAAA;ACNxB;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,UAAA;EACA,UAAA;EACA,gBAAA;ACL5B;ADOwB;EACI,kBAAA;EACA,QAAA;EACA,2BAAA;EACA,WAAA;EACA,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;ACL5B;ADQoB;EACI,YAAA;EACA,gBAAA;ACNxB;ADUY;EACI,aAAA;EACA,sBAAA;EACA,gBAAA;ACRhB;ADSgB;EACI,aAAA;EACA,mBAAA;EACA,cAAA;ACPpB;ADQoB;EACI,YAAA;EACA,eAAA;EACA,gBAAA;ACNxB;ADQoB;EACI,YAAA;ACNxB;ADQoB;EACI,WAAA;EACA,YAAA;EACA,SAAA;EACA,kBAAA;EACA,gBAAA;ACNxB;;ADcA;EACI,4BAAA;EACA,WAAA;ACXJ;ADYI;EACI,gBAAA;ACVR;ADYI;EACI,yBAAA;ACVR;;ADcA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,aAAA;EACA,oCAAA;EACA,UAAA;EACA,aAAA;EACA,aAAA;ACXJ;ADYI;EACI;IACI,gCAAA;IACA,UAAA;ECVV;EDYM;IACI,gCAAA;IACA,UAAA;ECVV;AACF;ADYI;EACI,sBAAA;ACVR;ADYI;EACI,cAAA;ACVR;ADYI;EACI,yBAAA;ACVR;ADYI;EACI,gBAAA;ACVR;ADWQ;EACI,aAAA;EACA,kBAAA;ACTZ;ADYI;EACI,iBAAA;EACA,YAAA;ACVR;ADWQ;EACI,YAAA;ACTZ;ADYI;EACI,UAAA;EACA,sBAAA;EACA,mBAAA;EACA,kBAAA;EACA,aAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,gCAAA;EACA,0BAAA;EACA,8BAAA;ACVR;ADWQ;EACI,aAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,YAAA;ACTZ;ADWQ;EACI,aAAA;EACA,sBAAA;ACTZ;ADUY;EACI,kBAAA;EACA,SAAA;EACA,WAAA;EACA,6BAAA;EACA,YAAA;EACA,aAAA;EACA,kBAAA;ACRhB;ADUY;EACI,YAAA;ACRhB;ADYI;EACI,kBAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,6BAAA;ACVR;;ADeI;EACI,yBAAA;EACA,mBAAA;EACA,aAAA;ACZR;ADaQ;EACI,gBAAA;ACXZ;ADaQ;EACI,sBAAA;ACXZ;ADaQ;EACI,uBAAA;ACXZ;ADYY;EACI,uBAAA;ACVhB;ADcY;EACI,yBAAA;ACZhB;ADgBY;EACI,gBAAA;ACdhB;ADgBY;EACI,yBAAA;EACA,mBAAA;EACA,iBAAA;EACA,eAAA;ACdhB;ADgBY;EACI,eAAA;ACdhB;ADegB;EACI,eAAA;EACA,gBAAA;ACbpB;ADegB;EACI,WAAA;EACA,aAAA;EACA,cAAA;EACA,sBAAA;ACbpB",
"file": "pricereview.css"
}

309
wms/mkt/css/pricereview.scss

@ -1,41 +1,61 @@
#pricereviewCreate{
input[type='text'], input[type='number'], select{
#pricereviewCreate {
input[type='text'],
input[type='number'],
select {
margin: 1px;
}
textarea{
textarea {
resize: vertical;
}
>.modal{
>.modal {
padding: 20px;
table, th, td{
border:1px #ccc solid;
table,
th,
td {
border: 1px #ccc solid;
}
table > thead tr th{
color:#A52A2A;
table>thead tr th {
color: #A52A2A;
}
table > tbody .selected{
table>tbody .selected {
background-color: #E7FEFB;
}
table > tbody .selected td{
}
table>tbody .selected td {}
}
.container{
table, th, td{
border:1px #ccc solid;
.container {
table,
th,
td {
border: 1px #ccc solid;
padding: 15px;
&.noborder, .noborder th, .noborder td{
border:none;
&.noborder,
.noborder th,
.noborder td {
border: none;
}
}
table{
thead th{
table {
thead th {
background-color: #6D9EEB;
}
tbody {
td input{
td input {
font-size: 14px;
}
th{
th {
background-color: #CCE4F8;
font-size: 14px;
padding: 15px 2px;
@ -43,116 +63,143 @@
text-align: center;
}
}
input{
input {
font-size: 13px;
}
}
.pricreviewmain{
.pricreviewmain {
background-color: #F2F2F2;
padding: 20px;
border-radius: 6px ;
margin:30px 0;
button{
color:#fff;
border-radius: 6px;
margin: 30px 0;
button {
color: #fff;
width: 55px;
height: 30px;
padding: 0;
margin-left: 10px;
font-size: 13px;
&.addbtn{
&.addbtn {
background-color: #337AB7;
width: 30px;
}
&.deleteBtn{
&.deleteBtn {
background-color: #D9534F;
color:#fff;
color: #fff;
font-size: 12px;
width: 30px;
}
&.selectElevator{
&.selectElevator {
background-color: #D9534F;
color:#fff;
color: #fff;
}
}
>.divitem{
border:1px #ccc solid;
>.divitem {
border: 1px #ccc solid;
padding: 10px;
border-radius: 4px ;
.title{
border-radius: 4px;
.title {
display: flex;
align-items: center;
border-bottom: 1px #ccc solid;
padding: 10px 0;
margin-bottom: 10px;
h6{
h6 {
font-weight: 600;
}
}
table, th, td{
table,
th,
td {
font-size: 14px;
background-color: transparent;
input, select, textarea{
input,
select,
textarea {
font-size: 13px;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
}
table {
tr:hover .deleteBtn ,tr:hover .copyBtn{
tr:hover .deleteBtn,
tr:hover .copyBtn {
opacity: 1;
}
.saletd{
.saletd {
position: relative;
>.deleteBtn{
>.deleteBtn {
position: absolute;
top: 50%;
transform: translateY(-50%);
right:2px;
right: 2px;
opacity: 0;
transition: .3s;
}
>.copyBtn{
>.copyBtn {
position: absolute;
top: 50%;
transform: translateY(-50%);
right:38px;
right: 38px;
opacity: 0;
transition: .3s;
width: 30px;
height: 30px;
}
}
textarea{
textarea {
height: auto;
min-height: 50px;
}
}
}
>.filediv{
>.filediv {
display: flex;
flex-direction: column;
margin-top: 20px;
label{
label {
display: flex;
align-items: center;
margin:10px 0;
p{
width:100px;
margin: 10px 0;
p {
width: 100px;
font-size: 15px;
font-weight: 600;
}
input[type="file"]{
width:400px
input[type="file"] {
width: 400px
}
button{
width:90px;
button {
width: 90px;
height: 35px;
margin:0;
margin: 0;
margin-right: 15px;
margin-top: 20px;
}
@ -162,150 +209,162 @@
}
}
.container-fluid, .container{
max-width:1400px !important;
.container-fluid,
.container {
max-width: 1400px !important;
width: 100%;
h4{
h4 {
font-weight: 600;
}
.btn-secondary{
.btn-secondary {
background-color: #6C757D;
}
}
.window-modal{
.window-modal {
position: fixed;
top: 0;
left:0;
left: 0;
width: 100%;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9;
padding: 20px;
display: none;
@keyframes fade-in {
0%{
transform: translate(-50%, -60%);
0% {
transform: translate(-50%, -55%);
opacity: 0;
}
100%{
transform: translate(-50%, -55%);
100% {
transform: translate(-50%, -50%);
opacity: 1;
}
}
table, th, td{
border:1px #ccc solid;
table,
th,
td {
border: 1px #ccc solid;
}
table > thead tr th{
color:#A52A2A;
table>thead tr th {
color: #A52A2A;
}
table > tbody .selected{
table>tbody .selected {
background-color: #E7FEFB;
}
&#optionModal .window-modal-content{
max-height: 80vh;
.window-modal-body{
height: 400px;
overflow-y: scroll;
}
}
&#toElevatorModal .window-modal-content{
min-height: 270px;
height: auto;
.window-modal-body{
height: auto;
}
}
.window-modal-content{
z-index: 9;
.window-modal-content {
background-color: #fff;
border-radius: 10px;
position: absolute;
width:1200px;
width: 1200px;
padding: 30px;
top: 50%;
left:50%;
transform: translate(-50%, -55%);
left: 50%;
transform: translate(-50%, -50%);
box-shadow: 0 5px 5px #222;
animation: fade-in .2s linear;
&.modal-xl{
width:1200px;
&.modal-xl {
width: 1200px;
}
&.modal-lg{
width:800px;
&.modal-lg {
width: 800px;
}
&.modal-m{
width:450px;
&.modal-m {
width: 400px;
}
.window-modal-header{
.window-modal-header {
display: flex;
flex-direction: column;
button.btn-close{
button.btn-close {
position: absolute;
top: 10px;
right:10px;
right: 10px;
background-color: transparent;
border:none;
border: none;
outline: none;
border-radius: 50%;
}
>div > input{
>div>input {
width: 250px;
}
}
.window-modal-body {
overflow-y: scroll;
height: 400px;
}
.window-back{
position: absolute;
top: 0;
left:0;
width: 100%;
height: 100%;
background-color: transparent;
}
}
#pricereviewCheck{
>.container{
#pricereviewCheck {
>.container {
background-color: #F2F2F2;
border-radius: 15px;
padding: 20px;
textarea{
textarea {
resize: vertical;
}
table, th, td{
border:1px #ccc solid;
table,
th,
td {
border: 1px #ccc solid;
}
table.noborder{
border:none !important;
th ,td{
border:none !important;
table.noborder {
border: none !important;
th,
td {
border: none !important;
}
}
.customerinfo-table{
input{
.customerinfo-table {
input {
background-color: #EEE5E5;
}
}
.mi-table{
th{
.mi-table {
th {
font-weight: 600;
}
input[type=text]{
input[type=text] {
background-color: #EEEEEE;
cursor: not-allowed;
padding: 6px 12px;
font-size: 14px;
}
.mi-info{
.mi-info {
font-size: 14px;
span{
span {
font-size: 15px;
font-weight: 600;
}
.line{
.line {
width: 100%;
height: .5px;
margin:30px 0;
margin: 30px 0;
background-color: #ccc;
}
}

195
wms/mkt/pricereviewMaintainCreate.php

@ -0,0 +1,195 @@
<?php
include_once('../header.php');
require_once('./conn.php');
$vol_no = empty($_GET['vol_no']) ? '' : $_GET['vol_no'];
// 有望客戶
$sql = "SELECT a.*,b.content FROM hope_contract_customer AS a
LEFT JOIN code AS b ON a.source = b.code_name
WHERE a.vol_no = '$vol_no' AND b.field_name = 'customer_source'
";
$stmt = $conn->prepare($sql);
// $stmt->bindParam(':vol_no', $vol_no);
$stmt->execute();
$hope_contract = $stmt->fetch(PDO::FETCH_ASSOC);
$hope_customer_status = [
'A' => '有望簽約(已報價)',
'B' => '觀望考慮(等待時機報價)',
'C' => '在途合約',
'D' => '已簽約',
'N' => '無望簽約',
];
$salename = $hope_contract['salesman'];
$sql = "SELECT * FROM account WHERE accountid = :salename";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':salename', $salename);
$stmt->execute();
$salename = $stmt->fetch(PDO::FETCH_ASSOC);
// echo '<pre>';
// print_r($hope_customer_status);
// echo '</pre>';
?>
<link rel="stylesheet" href="./css/pricereview.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.5.0/axios.min.js" integrity="sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script defer src="./assets/js/alpinejs/cdn.min.js"></script>
<script src="./assets/js/pricereviewAlpine.js"></script>
<div id="pricereviewMaintainCreate" x-data=pricereviewMaintainCreate()>
<div class="container">
<table class="table" border="1">
<thead>
<tr class=""></tr>
<th scope="col" class="text-center" colspan=8>有望客戶基本資料</th>
</thead>
<tbody>
<tr>
<th>卷號</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['vol_no'] ?>"></td>
<th>客戶名稱</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['customer'] ?>"></td>
<th>負責人</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['manager'] ?>"></td>
<th>客戶來源</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['content'] ?>"></td>
</tr>
<tr>
<th>地址</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['address'] ?>"></td>
<th>案件名稱</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['customer'] ?>"></td>
<th>市話 / 手機</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['tel'] ?>"></td>
<th>業主方聯繫人</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['linkman'] ?>"></td>
</tr>
<tr>
<th>營業員</th>
<td><input type="text" class="form-control" disabled value="<?= $salename['name'] ?>"></td>
<th>台數</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['num'] ?>"></td>
<th>預定成交日</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_contract['pre_order_date'] ?>"></td>
<th>有望客戶狀態</th>
<td><input type="text" class="form-control" disabled value="<?= $hope_customer_status[$hope_contract['status']] ?>"></td>
</tr>
<tr>
<th>有望客戶狀態</th>
<td><input type="text" class="form-control" disabled value=""></td>
</tr>
</tbody>
</table>
<table class="table" border="1">
<thead>
<tr class=""></tr>
<th scope="col" class="text-center" colspan="8">洽商進度</th>
</thead>
<tbody>
<td colspan=8>
<textarea name="progress" class="form-control" id="progress" cols="20" rows="5" disabled><?= $hope_contract['progress_status'] ?></textarea>
</td>
</tbody>
</table>
<div class="pricreviewmain container">
<div class="divitem">
<div class="title">
<h4>整機單價</h4>
<button class="addbtn btn" x-ref="addElevatorBtn" data-bs-toggle="modal" data-bs-target="#createElevatorModal">+</button>
</div>
<table class="table" border=1>
<thead>
<tr>
<td>項次</td>
<td>電梯</td>
<td>人乘/<br>載重</td>
<td>停數</td>
<td>速度(m/min)</td>
<td>保養月數</td>
<td>保養次數(月)</td>
<td>保養方式</td>
<td>公司發布價(月)</td>
<td>數量</td>
<td>公司發布價(總價)</td>
<td>售價(月)</td>
<td>售價(總價)</td>
</tr>
</thead>
<tbody>
<template x-for="(elevator, idx) in elevator" :key="elevator.id">
<tr>
<td x-text="elevator.id"></td>
<td>
<select name="" id="" class="form-control" x-model="elevator.specifications" @change="getElevatorPrice(idx)">
<option value="">請選擇</option>
<option value="MAE100">MAE100有機房</option>
<option value="MAM200">MAM200無機房</option>
<option value="MAH100">MAH100小電梯</option>
<option value="MAF100">MAE100貨梯(有機房)</option>
<option value="MAQ100">MAQ100強趨梯</option>
<option value="MAP100">MAP100平台梯</option>
</select>
</td>
<td>
<select name="" id="" class="form-control" x-model=elevator.person" @change="getElevatorPrice(idx)">
<option value="">請選擇</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="15">15</option>
<option value="17">17</option>
<option value="20">20</option>
<option value="24">24</option>
</select>
</td>
<td>
<input type="number" class="form-control" style="width: 83px;" x-model="elevator.stop" @keyup="getElevatorPrice(idx)" ">
</td>
<td>
<select name="" id="" class=" form-control" x-model="elevator.speed" @change="getElevatorPrice(idx)"></select>
<option value="">請選擇</option>
<option value="9">9</option>
<option value="24">24</option>
<option value="30">30</option>
<option value="45">45</option>
<option value="60">60</option>
<option value="90">90</option>
<option value="105">105</option>
<option value="120">120</option>
<option value="150">150</option>
</td>
<td>
<input type="number" class="form-control" style="width: 63px;" x-model="maintain_month" @keyup="getElevatorPrice(idx)">
</td>
<td>
<input type="number" class="form-control" style="width: 63px;" x-model="maintain_times" @keyup="getElevatorPrice(idx)">
</td>
<td>
<select name="" id="" class="form-control" style="width: 63px" x-model="maintain_kind" @change="getElevatorPrice(idx)">
<option value="">請選擇</option>
<option value="2">半包</option>
<option value="3">全包</option>
<option value="4">清包</option>
</select>
</td>
</tr>
</template>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
const body = document.querySelector('body');
// const elevator = [...<?= json_encode($hope_elevator) ?>];
</script>
Loading…
Cancel
Save