Browse Source

Merge branch 'main' into gary

# Conflicts:
#	wms/schedule-index.php
gary
gary_chen\gary_chen 1 year ago
parent
commit
aa2b339ae4
  1. 44
      mkt/pricereview-create.php
  2. 2
      prv/pricereview-record-submit.php
  3. 75
      wms/T8_APItest.php
  4. 7
      wms/T8_Authorization.php
  5. 72804
      wms/account-receivable-bill.txt
  6. 119
      wms/account-receivable-excel.php
  7. BIN
      wms/account-receivable-facility.xlsx
  8. 896
      wms/account-receivable-index-ing.php
  9. 462
      wms/account-receivable-index.php
  10. 54
      wms/account-receivable-test.php
  11. BIN
      wms/account-receivable-test.xlsx
  12. 31815
      wms/account_receivable_sql_file.sql
  13. 6
      wms/cont/sign_list.php
  14. 167
      wms/contract-repair/api/putContractData.php
  15. 41
      wms/contract-repair/contract-download.php
  16. 37
      wms/contract-repair/js/alpine.js
  17. 237
      wms/contract/api/postContractData.php
  18. 48
      wms/contract/api/postContractNewApplyData.php
  19. 77
      wms/contract/api/testT8API.php
  20. 3
      wms/contract/conn.php
  21. 15
      wms/contract/connt8.php
  22. 39
      wms/contract/contract-input.php
  23. 128
      wms/contract/contract-new-apply.php
  24. 7
      wms/contract/insertData.php
  25. 65
      wms/contract/js/alpine.js
  26. 8
      wms/contract/styles/style.css
  27. 2
      wms/contract/styles/style.css.map
  28. 8
      wms/contract/styles/style.scss
  29. BIN
      wms/facility-price.xlsx
  30. 18
      wms/fun_global.php
  31. 2
      wms/header.php
  32. 101
      wms/mkt/assets/js/alpine.js
  33. 365
      wms/mkt/price_normal-index.php
  34. 20
      wms/mkt/pricereview-check.php
  35. 393
      wms/mkt/pricereview-create.php
  36. 7
      wms/mkt/pricereview-edit.php
  37. 36
      wms/mkt/pricereview-index.php
  38. 9
      wms/mkt/pricereview-record-submit.php
  39. 2
      wms/mkt/pricereview-record-update.php
  40. 4
      wms/mkt/pricereview_mi-api.php
  41. 37
      wms/mkt/pricereview_renovate-check.php
  42. 335
      wms/mkt/pricereview_renovate-create.php
  43. 6
      wms/mkt/pricereview_renovate-edit.php
  44. 40
      wms/mkt/pricereview_renovate-index.php
  45. 2
      wms/mkt/pricereview_renovate-record-submit.php
  46. 60
      wms/rib-invoice-check.php
  47. 20
      wms/rib02-create.php
  48. 19
      wms/rib02-edit.php
  49. 9
      wms/rib02-submit.php
  50. 2
      wms/schedule-index.php
  51. 8
      wms/sign/list.php

44
mkt/pricereview-create.php

@ -167,9 +167,15 @@ $(function(){
}); });
}); });
$('#deposit_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); $('#deposit_rate').keyup(function() {
$('#keep_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1'));
$('#warranty_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); });
$('#keep_rate').keyup(function() {
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1'));
});
$('#warranty_rate').keyup(function() {
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1'));
});
/* /*
// for 動態表格的作法:event delegation // for 動態表格的作法:event delegation
$('#tb1').on('click', $("input[name='item_qty']"), function(){ $('#tb1').on('click', $("input[name='item_qty']"), function(){
@ -257,28 +263,44 @@ $(function(){
}); });
$('#submit').click(function() { $('#submit').click(function() {
var itemFpidArr = []; var itemFpidArr = [];
$("input[name='fp_id']").each(function(){ itemFpidArr.push($(this).val()); }) $("input[name='fp_id']").each(function() {
itemFpidArr.push($(this).val());
})
$('#fp_id_all').val(itemFpidArr); $('#fp_id_all').val(itemFpidArr);
var itemSpecArr = []; var itemSpecArr = [];
$("input[name='item_spec']").each(function(){ itemSpecArr.push($(this).val()); }) $("input[name='item_spec']").each(function() {
itemSpecArr.push($(this).val());
})
$('#item_spec_all').val(itemSpecArr); $('#item_spec_all').val(itemSpecArr);
var itemGroupArr = []; var itemGroupArr = [];
$("input[name='item_group']").each(function(){ itemGroupArr.push($(this).val()); }) $("input[name='item_group']").each(function() {
itemGroupArr.push($(this).val());
})
$('#item_group_all').val(itemGroupArr); $('#item_group_all').val(itemGroupArr);
var itemQtyArr = []; var itemQtyArr = [];
$("input[name='item_qty']").each(function(){ itemQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_qty']").each(function() {
itemQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_qty_all').val(itemQtyArr); $('#item_qty_all').val(itemQtyArr);
var itemPriceBpArr = []; var itemPriceBpArr = [];
$("input[name='item_price_bp']").each(function(){ itemPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_price_bp']").each(function() {
itemPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_bp_all').val(itemPriceBpArr); $('#item_price_bp_all').val(itemPriceBpArr);
var itemPriceArr = []; var itemPriceArr = [];
$("input[name='item_price']").each(function(){ itemPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_price']").each(function() {
itemPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_all').val(itemPriceArr); $('#item_price_all').val(itemPriceArr);
var pvRateArr = []; var pvRateArr = [];
$("input[name='pv_rate']").each(function(){ pvRateArr.push($(this).val()); }) $("input[name='pv_rate']").each(function() {
pvRateArr.push($(this).val());
})
$('#pv_rate_all').val(pvRateArr); $('#pv_rate_all').val(pvRateArr);
var noteArr = []; var noteArr = [];
$("input[name='note']").each(function(){ noteArr.push($(this).val()); }) $("input[name='note']").each(function() {
noteArr.push($(this).val());
})
$('#note_all').val(noteArr); $('#note_all').val(noteArr);
//console.log(itemNameArr); //console.log(itemNameArr);
//return false; //return false;

2
prv/pricereview-record-submit.php

@ -1,3 +1,5 @@
<?php <?php
require_once "database.php"; require_once "database.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {

75
wms/T8_APItest.php

@ -12,72 +12,53 @@ echo "ii";
console.log(validation); console.log(validation);
// var corsurl = 'http://cors-anywhere.herokuapp.com/'; // var corsurl = 'http://cors-anywhere.herokuapp.com/';
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALDISPATCHLIST/GetERPData?pkValue=SS20230825001'; var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData';
headerParam = { headerParam = {
CHI_Authorization: `${validation}`, CHI_Authorization: `${validation}`,
}; };
var body = [{ var body = [{
"name": "MasterTable", "name": "salIncomeApplyMaster",
"rows": [{ "rows": [{
"BillNo": "Z001", "BillNo": "B23100061",
"BillDate": 20230930, "BillDate": 20231220,
"OrgId": "1000", "OrgId": "1000",
"TypeId": "OPV", "FOrgId": "1000",
"BizPartnerId": "03051501", "TypeId": "RAS",
"CurrId": "RMB", "BpOrgId": "1000",
"CurrLAmount":5, "BizPartnerId": "B23100061",
"CurrId": "TWD",
"CurrOAmount": 1,
"CurrLAmount": 1,
"PersonId": "M0065",
"DtOrgId": "1000",
"DueToId": "B23100061",
"TaxId": "ST005", "TaxId": "ST005",
"PersonId": "M0012", "CompId": "1001"
"DeptId": "220",
"CompId": "1001",
"CreditAgeDate": 20230930,
"RecBizPartnerId": "03051501",
}] }]
}, },
{ {
"name": "DetailTable", "name": "salIncomeApplyDetail",
"rows": [{ "rows": [{
"BillNo": "Z001", "BillNo": "B23100061",
"IncomeId": "A40004",
"TaxId": "ST005",
"RowCode": 1, "RowCode": 1,
"RowNo": 1, "ItemType": "1",
"ItemType": 0, "SPrice": 10000,
"MaterialId": "MX00000001", "SQuantity": 0,
"UnitId": "PCS", "FromSourceTag": 0,
"MaterialSpec": "", "FromBillNo": ""
"SQuantity": 10, }]
"SPrice": 141.18,
"OAmount": 1344.57,
"OTax": 67.23,
"OAmountWithTax": 1411.8,
"TaxId": "ST005"
},
{
"BillNo": "Z001",
"RowCode": 2,
"RowNo": 2,
"ItemType": 0,
"MaterialId": "MX00000001",
"UnitId": "PCS",
"MaterialSpec": "",
"SQuantity": 15,
"SPrice": 141.18,
"OAmount": 2016.86,
"OTax": 100.84,
"OAmountWithTax": 2117.7,
"TaxId": "ST005"
}
]
} }
]; ];
var json = JSON.stringify(body); var json = JSON.stringify(body);
obj = { obj = {
type: 'GET', type: 'POST',
// url: `${corsurl}${apiurl}`, // url: `${corsurl}${apiurl}`,
url: `${apiurl}`, url: `${apiurl}`,
// dataType: 'json', dataType: 'json',
headers: headerParam, headers: headerParam,
// data: json, data: json,
// dataType: "json", // dataType: "json",
success: function(res) { success: function(res) {
console.log(res.Status); console.log(res.Status);

7
wms/T8_Authorization.php

@ -1,7 +1,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<?php <?php
$now = gmdate("YmdHis"); $now = gmdate("YmdHis");
$data = 'M0000.' . $now; $data = 'admin.' . $now;
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false); $sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
?> ?>
@ -14,8 +14,8 @@ $sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
// var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth'; // var apiurl = 'http://60.244.87.101:880//twWebAPI/GetAuth';
var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth' var apiurl = 'https://erp.masada.com.tw:780/twWebAPI/GetAuth'
headerParam = { headerParam = {
UserId: 'M0000', UserId: 'admin',
Pwd: 'M012290493119', Pwd: 'chi',
TimestampUTC: <?= $now ?>, TimestampUTC: <?= $now ?>,
Sign: '<?= $sign ?>' Sign: '<?= $sign ?>'
}; };
@ -33,5 +33,6 @@ $sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
} }
}; };
jQuery.ajax(obj); jQuery.ajax(obj);
} }
</script> </script>

72804
wms/account-receivable-bill.txt

File diff suppressed because it is too large

119
wms/account-receivable-excel.php

@ -5,93 +5,71 @@ require_once dirname(__DIR__) . '/common/composer/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
header('Content-Type: application/json'); header('Content-Type: application/json');
// $Bill = file_get_contents('php://input'); $type = $_GET['type'];
// $Bill = $_POST['Bill'];
$array_data = array(); $array_data = array();
$Bill = json_decode(file_get_contents("php://input"), true); $Bill = json_decode(file_get_contents("php://input"), true);
// $Bill = json_decode($Bill, true); $spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
// 檢查是否有 POST 資料
// if ($_SERVER["REQUEST_METHOD"] == "POST") {
// // 獲取 POST 資料
// // $postData = $_POST['Bill'];
// // 指定儲存資料的檔案路徑
// $filePath = 'Bill.txt';
// // 寫入檔案
// // 使用 FILE_APPEND 選項,以便將資料附加到檔案的末尾而不是覆寫檔案
// file_put_contents($filePath, $Bill . PHP_EOL, FILE_APPEND);
// echo '資料已成功寫入檔案。'; if ($type == 'facility') {
// } else { $colomnHeader = [
// echo '請透過正確的方式訪問此頁面。'; '作番號','合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭',
// } '訂金名稱', '訂金合約金額', '訂金應收日期', '訂金目前應收金額', '訂金已收金額', '訂金催收金額', '訂金催收次數',
// exit(); '二次款名稱', '二次款合約金額', '二次款應收日期', '二次款目前應收金額', '二次款已收金額', '二次款催收金額', '二次款催收次數',
// print_r($Bill); '貨抵工地款名稱', '貨抵工地款合約金額', '貨抵工地款應收日期', '貨抵工地款目前應收金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款催收次數',
// foreach ($Bill as $key => $value) { '安裝款名稱', '安裝款合約金額', '安裝款應收日期', '安裝款目前應收金額', '安裝款已收金額', '安裝款催收金額', '安裝款催收次數',
// $value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0; '試車款名稱', '試車款合約金額', '試車款應收日期', '試車款目前應收金額', '試車款已收金額', '試車款催收金額', '試車款催收次數',
// $value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0; '官檢款名稱', '官檢款合約金額', '官檢款應收日期', '官檢款目前應收金額', '官檢款已收金額', '官檢款催收金額', '官檢款催收次數',
// $value['arrive'][3] = (isset($value['arrive'][3])) ? $value['arrive'][3] : 0; '交車款名稱', '交車款合約金額', '交車款應收日期', '交車款目前應收金額', '交車款已收金額', '交車款催收金額', '交車款催收次數',
// $value['install'][3] = (isset($value['install'][3])) ? $value['install'][3] : 0; '尾款名稱', '尾款金額', '尾款應收日期', '尾款應收金額', '尾款已收金額', '尾款催收金額', '尾款催收次數',
// $value['tryrun'][3] = (isset($value['tryrun'][3])) ? $value['tryrun'][3] : 0; '作番狀態', '作番合約總金額', '作番總應收金額'
// $value['check'][3] = (isset($value['check'][3])) ? $value['check'][3] : 0; ];
// $value['delivery'][3] = (isset($value['delivery'][3])) ? $value['delivery'][3] : 0; $sheet->fromArray($colomnHeader, NULL, 'A1');
// $value['final'][3] = (isset($value['final'][3])) ? $value['final'][3] : 0; $rowIndex = 2;
foreach ($Bill as $key => $value) {
// $array_data[$key] = [ $sheet->fromArray($value, NULL, 'A' . $rowIndex,true);
// $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], $column = [
// $value['sign'][1], $value['sign'][3], $value['sign']['max'], $value['sign']['min'], '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',
// $value['second'][1], $value['second'][3], $value['second']['max'], $value['second']['min'], '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',
// $value['arrive'][1], $value['arrive'][3], $value['arrive']['max'], $value['arrive']['min'], 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP'
// $value['install'][1], $value['install'][3], $value['install']['max'], $value['install']['min'], ];
// $value['tryrun'][1], $value['tryrun'][3], $value['tryrun']['max'], $value['tryrun']['min'], foreach ($column as $col) {
// $value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], $sheet->getColumnDimension($col)->setAutoSize(true);
// $value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], }
// $value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'],
// $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('<br>', '; ', $value['facilities'])
// ]; $rowIndex++;
// $array_data[$key] = [ }
// $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], $writer = new Xlsx($spreadsheet);
// $value['sign'][1], $value['second'][1], $value['arrive'][1], $value['install'][1], $value['tryrun'][1], $value['check'][1], $value['delivery'][1], $value['final'][1], $excelFileName = 'account-receivable-facility.xlsx';
// $value['sign'][3], $value['second'][3], $value['arrive'][3], $value['install'][3], $value['tryrun'][3], $value['check'][3], $value['delivery'][3], $value['final'][3], $writer->save($excelFileName);
// $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('<br>', '; ', $value['facilities']) } else {
// ];
// }
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$colomnHeader = [ $colomnHeader = [
'合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭',
'簽約款', '簽約款目前應收', '簽約最大催收次數', '簽約最小應收次數', '訂金', '訂金目前應收', '訂金最大催收次數', '訂金最小催收次數',
'二次款', '二次款目前應收', '二次最大催收次數', '二次最小應收次數', '二次款', '二次款目前應收', '二次款最大催收次數', '二次款最小催收次數',
'貨抵工地款', '貨抵工地款目前應收', '貨抵工地最小催收次數', '貨抵工地最小應收次數', '貨抵工地款', '貨抵工地款目前應收', '貨抵工地款最小催收次數', '貨抵工地款最小催收次數',
'安裝款', '安裝款目前應收', '安裝最大催收次數', '安裝最小應收次數', '安裝款', '安裝款目前應收', '安裝款最大催收次數', '安裝款最小催收次數',
'試車款', '試車款目前應收', '試車最大催收次數', '試車最小應收次數', '試車款', '試車款目前應收', '試車款最大催收次數', '試車款最小催收次數',
'官檢款', '官檢款目前應收', '官檢最大催收次數', '官檢最小應收次數', '官檢款', '官檢款目前應收', '官檢款最大催收次數', '官檢款最小催收次數',
'交車款', '交車款目前應收', '交車最大催收次數', '交車最小應收次數', '交車款', '交車款目前應收', '交車款最大催收次數', '交車款最小催收次數',
'尾款', '尾款目前應收', '尾款最大催收次數', '尾款最小收次數', '尾款', '尾款目前應收', '尾款最大催收次數', '尾款最小收次數',
'合約總金額', '目前應收', '已開發票金額', '已收金額', '作番狀態' '合約總金額', '目前應收', '已開發票金額', '已收金額', '作番總數', '作番狀態'
]; ];
// $colomnHeader = [
// '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭',
// '簽約款', '二次款', '貨抵工地款', '安裝款', '試車款', '官檢款', '交車款', '尾款',
// '目前應收簽約款', '目前應收二次款', '目前應收貨抵工地款', '目前應收安裝款', '目前應收試車款', '目前應收官檢款', '目前應收交車款', '目前應收尾款',
// '合約總金額', '目前應收', '已開發票金額', '已收金額', '作番狀態'
// ];
$sheet->fromArray($colomnHeader, NULL, 'A1'); $sheet->fromArray($colomnHeader, NULL, 'A1');
$rowIndex = 2; $rowIndex = 2;
foreach ($Bill as $key => $value) { foreach ($Bill as $key => $value) {
$sheet->fromArray($value, NULL, 'A' . $rowIndex); $sheet->fromArray($value, NULL, 'A' . $rowIndex);
$column = [ $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', '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' 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT'
]; ];
foreach ($column as $col) { foreach ($column as $col) {
if ($col == 'AS') { if ($col == 'AT') {
$sheet->getStyle('AS' . $rowIndex)->getAlignment()->setWrapText(true); $sheet->getStyle('AT' . $rowIndex)->getAlignment()->setWrapText(true);
} else { } else {
$sheet->getColumnDimension($col)->setAutoSize(true); $sheet->getColumnDimension($col)->setAutoSize(true);
} }
@ -102,6 +80,7 @@ foreach ($Bill as $key => $value) {
$writer = new Xlsx($spreadsheet); $writer = new Xlsx($spreadsheet);
$excelFileName = 'account-receivable-test.xlsx'; $excelFileName = 'account-receivable-test.xlsx';
$writer->save($excelFileName); $writer->save($excelFileName);
}
echo $excelFileName; echo $excelFileName;
?> ?>
<!-- <script> <!-- <script>

BIN
wms/account-receivable-facility.xlsx

Binary file not shown.

896
wms/account-receivable-index-ing.php

File diff suppressed because it is too large

462
wms/account-receivable-index.php

@ -39,6 +39,45 @@ LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo
LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) ";
//作番大日程
$sql = "SELECT
tmp2.*,
d.name AS depart_name
FROM(
SELECT
a.manager,
a2.name as manager_name,
a.name,
a.department_id,
w.salesid,
w.contractno,
w.facilityno,
w.estimated_shipping_date,
w.real_contract_arrival_date,
w.actual_tofactory_date,
w.real_arrival_date,
w.install_end_date,
w.tryrun_end_date,
w.official_check_date,
w.delivery_date
from wipwholestatus AS w
left join account AS a
ON w.salesid = a.accountid
left join account AS a2
ON a2.accountid = a.manager
where w.status = '1' AND w.contract_type='A'
)AS tmp2
left join (
SELECT DISTINCT
department_id,
name
FROM department
) AS d
ON d.department_id = tmp2.department_id ";
//ORDER BY contractno
// 期初收款資訊 // 期初收款資訊
$sql_opening = " $sql_opening = "
SELECT * FROM account_received "; SELECT * FROM account_received ";
@ -46,20 +85,25 @@ SELECT * FROM account_received ";
// 設定權限:看到自己的/下屬的,資訊處跟財會處可以看全部的 // 設定權限:看到自己的/下屬的,資訊處跟財會處可以看全部的
if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) {
$sql_contract .= "AND (s.PersonId = '$user_id'"; $sql_contract .= "AND (s.PersonId = '$user_id'";
$sql_received .= " AND (PersonId = '$user_id'"; // $sql_received .= " AND (PersonId = '$user_id'";
$sql_opening .= " OR person_id = '$user_id'"; $sql_opening .= " OR person_id = '$user_id'";
$sql .= " WHERE salesid = '$user_id'";
if (count($follower) > 0) { if (count($follower) > 0) {
$column_str = "('$user_id'" . ",'"; $column_str = "('$user_id'" . ",'";
$column_str .= implode("','", $follower); $column_str .= implode("','", $follower);
$column_str .= "')"; $column_str .= "')";
$sql_contract .= " OR s.PersonId IN $column_str)"; $sql_contract .= " OR s.PersonId IN $column_str)";
$sql_received .= " OR PersonId IN $column_str)"; // $sql_received .= " OR PersonId IN $column_str)";
$sql_opening .= " OR person_id IN $column_str)"; $sql_opening .= " OR person_id IN $column_str)";
$sql .= " OR salesid IN $column_str ORDER BY contractno";
} else { } else {
$sql_contract .= ")"; $sql_contract .= ")";
$sql_received .= ")"; // $sql_received .= ")";
$sql_opening .= ")"; $sql_opening .= ")";
$sql .= " ORDER BY contractno";
}; };
}else{
$sql .= " ORDER BY contractno";
} }
$contract = $conn->query($sql_contract); $contract = $conn->query($sql_contract);
@ -91,6 +135,7 @@ foreach ($contract as $cont) {
$ContactAddress = $cont['ContactAddress']; $ContactAddress = $cont['ContactAddress'];
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期 //['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期
//['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期 //['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期
//['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數
if (!(isset($arrayData[$BillNo]))) { if (!(isset($arrayData[$BillNo]))) {
// 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 // 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0]; $arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0];
@ -182,43 +227,11 @@ foreach ($contract as $cont) {
//取作番大日程作番與時程 //取作番大日程作番與時程
// real_contract_arrival_date 預計出貨日 // real_contract_arrival_date 預計出貨日
// real_arrival_date 實際出貨日 // real_arrival_date 實際出貨日
$sql = "SELECT
tmp2.*,
d.name AS depart_name
FROM(
SELECT
a.manager,
a2.name as manager_name,
a.name,
a.department_id,
w.salesid,
w.contractno,
w.facilityno,
w.estimated_shipping_date,
w.real_contract_arrival_date,
w.actual_tofactory_date,
w.real_arrival_date,
w.install_end_date,
w.tryrun_end_date,
w.official_check_date,
w.delivery_date
from wipwholestatus AS w
left join account AS a
ON w.salesid = a.accountid
left join account AS a2
ON a2.accountid = a.manager
where w.status = '1' AND w.contract_type='A'
)AS tmp2
left join (
SELECT DISTINCT
department_id,
name
FROM department
) AS d
ON d.department_id = tmp2.department_id ORDER BY contractno";
$wipwhole_array = mysqli_query($link, $sql); $wipwhole_array = mysqli_query($link, $sql);
foreach ($wipwhole_array as $wip) { foreach ($wipwhole_array as $wip) {
$today = strtotime(date('Ymd'));
//[合約號]['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數
if (isset($arrayData[$wip['contractno']])) { if (isset($arrayData[$wip['contractno']])) {
// 整理合約資料 // 整理合約資料
$arrayData[$wip['contractno']][0] = $wip['department_id'];; $arrayData[$wip['contractno']][0] = $wip['department_id'];;
@ -228,14 +241,19 @@ foreach ($wipwhole_array as $wip) {
$arrayData[$wip['contractno']][4] = $wip['name']; $arrayData[$wip['contractno']][4] = $wip['name'];
$arrayData[$wip['contractno']][10] = $wip['contractno']; $arrayData[$wip['contractno']][10] = $wip['contractno'];
$arrayData[$wip['contractno']]['total_facility_num'] += 1; $arrayData[$wip['contractno']]['total_facility_num'] += 1;
// [合約號][作番號]['no'] // [合約號]['facility'][作番號]['no']
$arrayData[$wip['contractno']][$wip['facilityno']]['no'] = $wip['facilityno']; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['no'] = $wip['facilityno'];
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = "";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['total_budget'] = 0;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['receivable_budget'] = 0;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['collect_budget'] = 0;
// [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] // [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期]
// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] // [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期]
// [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期] // [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期]
$contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); $contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final');
foreach ($contractstage as $i) { foreach ($contractstage as $i) {
$arrayData[$wip['contractno']][$wip['facilityno']][$i] = ['', 0, '', 0, 0, 0, 0];
$arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['date'] = ""; $arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['date'] = "";
$arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['budget'] = 0; $arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['budget'] = 0;
$arrayData[$wip['contractno']][$wip['facilityno']][$i]['rec']['date'] = ""; $arrayData[$wip['contractno']][$wip['facilityno']][$i]['rec']['date'] = "";
@ -284,6 +302,16 @@ foreach ($wipwhole_array as $wip) {
array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime)));
array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime)));
} }
} elseif (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前120天')) {
if (empty($wip['real_contract_arrival_date'])) {
} else {
$estimate_delivery_time = strtotime($wip['real_contract_arrival_date']);
$secondtime = $estimate_delivery_time - (120 * 86400);
$secondtime = date('Ymd', $secondtime);
$arrayData[$wip['contractno']]['second'][2] = strval($secondtime);
array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime)));
array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime)));
}
} elseif (isset($arrayData[$wip['contractno']]['second'][0]) && $arrayData[$wip['contractno']]['second'][0] == '寶佳出貨後10天') { } elseif (isset($arrayData[$wip['contractno']]['second'][0]) && $arrayData[$wip['contractno']]['second'][0] == '寶佳出貨後10天') {
if ($wip['real_arrival_date'] != NULL) { if ($wip['real_arrival_date'] != NULL) {
@ -306,39 +334,64 @@ foreach ($wipwhole_array as $wip) {
// real_contract_arrival_date 預計出貨日=預計到貨日=預計貨抵工地 // real_contract_arrival_date 預計出貨日=預計到貨日=預計貨抵工地
// real_arrival_date 實際出貨日=實際到貨日=實際貨抵工地 // real_arrival_date 實際出貨日=實際到貨日=實際貨抵工地
//----------------------------------------寶佳的另外處理--------------------------------------------------- //----------------------------------------寶佳的另外處理---------------------------------------------------
if ($arrayData[$wip['contractno']]['sign'][0] == "寶佳出貨前30天") { if ($arrayData[$wip['contractno']]['sign'][0] == "寶佳出貨前30天") {
$facility_status = ""; $facility_status = "";
// if ($arrayData[$wip['contractno']]['sign'][2]) // if ($arrayData[$wip['contractno']]['sign'][2])
$today = strtotime(date('Ymd')); $today = strtotime(date('Ymd'));
$contractday = strtotime($arrayData[$wip['contractno']]['sign'][2]); $contractday = strtotime($arrayData[$wip['contractno']]['sign'][2]);
$month = collect_month($contractday);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][2] = $arrayData[$wip['contractno']]['sign'][2];
if ($today > $contractday) { if ($today > $contractday) {
$arrayData[$wip['contractno']]['sign_num'] += 1; $arrayData[$wip['contractno']]['sign_num'] += 1;
$facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "已過) <br>"; $facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "已過) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status;
//二次款
$contractday = strtotime($arrayData[$wip['contractno']]['second'][2]); $contractday = strtotime($arrayData[$wip['contractno']]['second'][2]);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][2] = $arrayData[$wip['contractno']]['second'][2];
$month = collect_month($contractday);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][6] = $month;
if ($today > $contractday) { if ($today > $contractday) {
$arrayData[$wip['contractno']]['second_num'] += 1; $arrayData[$wip['contractno']]['second_num'] += 1;
$facility_status = $wip['facilityno'] . " (出貨後10天" . $arrayData[$wip['contractno']]['second'][2] . "已過) <br>"; $facility_status = $wip['facilityno'] . " (出貨後10天" . $arrayData[$wip['contractno']]['second'][2] . "已過) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status;
//貨抵工地款
if ($wip['real_arrival_date'] != NULL) { if ($wip['real_arrival_date'] != NULL) {
$estimate_time = strtotime($wip['real_arrival_date']); $estimate_time = strtotime($wip['real_arrival_date']);
$contractday = $estimate_time + (90 * 86400); $contractday = $estimate_time + (90 * 86400);
$month = collect_month($contractday);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $contractday));
if ($today > $contractday) { if ($today > $contractday) {
$arrayData[$wip['contractno']]['arrive_num'] += 1; $arrayData[$wip['contractno']]['arrive_num'] += 1;
$arrayData[$wip['contractno']]['arrive'][2] = strval(date('Y-m-d', $contractday)); $arrayData[$wip['contractno']]['arrive'][2] = strval(date('Y-m-d', $contractday));
$facility_status = $wip['facilityno'] . " (貨抵工地後90天" . $arrayData[$wip['contractno']]['arrive'][2] . "已過) <br>"; $facility_status = $wip['facilityno'] . " (貨抵工地後90天" . $arrayData[$wip['contractno']]['arrive'][2] . "已過) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status;
//試車款
if ($wip['tryrun_end_date'] != NULL) { if ($wip['tryrun_end_date'] != NULL) {
$estimate_time = strtotime($wip['tryrun_end_date']); $estimate_time = strtotime($wip['tryrun_end_date']);
$contractday = $estimate_time + (90 * 86400); $contractday = $estimate_time + (90 * 86400);
$month = collect_month($contractday);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $contractday));
if ($today > $contractday) { if ($today > $contractday) {
$arrayData[$wip['contractno']]['tryrun_num'] += 1; $arrayData[$wip['contractno']]['tryrun_num'] += 1;
$arrayData[$wip['contractno']]['tryrun'][2] = strval(date('Y-m-d', $contractday)); $arrayData[$wip['contractno']]['tryrun'][2] = strval(date('Y-m-d', $contractday));
$facility_status = $wip['facilityno'] . " (試車後90天" . $arrayData[$wip['contractno']]['tryrun'][2] . "已過) <br>"; $facility_status = $wip['facilityno'] . " (試車後90天" . $arrayData[$wip['contractno']]['tryrun'][2] . "已過) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status;
//交車款
if ($wip['delivery_date'] != NULL) { if ($wip['delivery_date'] != NULL) {
$estimate_time = strtotime($wip['delivery_date']); $estimate_time = strtotime($wip['delivery_date']);
$contractday = $estimate_time + (270 * 86400); $contractday = $estimate_time + (270 * 86400);
$month = collect_month($contractday);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][2] = strval(date('Ymd', $contractday));
if ($today > $contractday) { if ($today > $contractday) {
$arrayData[$wip['contractno']]['delivery_num'] += 1; $arrayData[$wip['contractno']]['delivery_num'] += 1;
$arrayData[$wip['contractno']]['delivery'][2] = strval(date('Y-m-d', $contractday)); $arrayData[$wip['contractno']]['delivery'][2] = strval(date('Y-m-d', $contractday));
$facility_status = $wip['facilityno'] . " (交車後270天" . $arrayData[$wip['contractno']]['delivery'][2] . "已過) <br>"; $facility_status = $wip['facilityno'] . " (交車後270天" . $arrayData[$wip['contractno']]['delivery'][2] . "已過) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status;
} }
} }
} }
@ -348,11 +401,23 @@ foreach ($wipwhole_array as $wip) {
} }
} else { } else {
$facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "未到) <br>"; $facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "未到) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status;
} }
$arrayData[$wip['contractno']]['facilities'] .= $facility_status; $arrayData[$wip['contractno']]['facilities'] .= $facility_status;
} else { } else {
$signtime = strtotime($arrayData[$wip['contractno']]['sign'][2]);
$month = collect_month($signtime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][2] = strval(date('Ymd', $signtime));
if (isset($arrayData[$wip['contractno']]['second'][2]) && ($arrayData[$wip['contractno']]['second'][2] !== NULL)) {
$secondtime = strtotime($arrayData[$wip['contractno']]['second'][2]);
$month = collect_month($secondtime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][2] = strval(date('Ymd', $secondtime));
}
if ($wip['delivery_date'] != NULL) { if ($wip['delivery_date'] != NULL) {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>";
$arrayData[$wip['contractno']]['tryrun_num'] += 1; $arrayData[$wip['contractno']]['tryrun_num'] += 1;
$arrayData[$wip['contractno']]['install_num'] += 1; $arrayData[$wip['contractno']]['install_num'] += 1;
$arrayData[$wip['contractno']]['arrive_num'] += 1; $arrayData[$wip['contractno']]['arrive_num'] += 1;
@ -362,7 +427,13 @@ foreach ($wipwhole_array as $wip) {
if ($arrayData[$wip['contractno']]['delivery'][0] == "交車後270天") { if ($arrayData[$wip['contractno']]['delivery'][0] == "交車後270天") {
$estimate_delivery_time = strtotime($wip['delivery_date']); $estimate_delivery_time = strtotime($wip['delivery_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400); $arrivetime = $estimate_delivery_time + (90 * 86400);
$arrivetime = date('Ymd', $secondtime); $month = collect_month($arrivetime);
if ($today > $arrivetime) {
$arrayData[$wip['contractno']]['delivery_num'] += 1;
}
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][2] = strval(date('Ymd', $arrivetime));
$arrivetime = date('Ymd', $arrivetime);
$arrayData[$wip['contractno']]['delivery'][2] = strval($secondtime); $arrayData[$wip['contractno']]['delivery'][2] = strval($secondtime);
array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($arrivetime)));
array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($arrivetime)));
@ -370,60 +441,74 @@ foreach ($wipwhole_array as $wip) {
$arrayData[$wip['contractno']]['delivery_num'] += 1; $arrayData[$wip['contractno']]['delivery_num'] += 1;
$arrayData[$wip['contractno']]['check_num'] += 1; $arrayData[$wip['contractno']]['check_num'] += 1;
$arrayData[$wip['contractno']]['delivery'][2] = strval($wip['delivery_date']); $arrayData[$wip['contractno']]['delivery'][2] = strval($wip['delivery_date']);
$deliverytime = strtotime($wip['delivery_date']);
$month = collect_month($deliverytime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][2] = strval(date('Ymd', $deliverytime));
array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($wip['delivery_date']))); array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($wip['delivery_date'])));
array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($wip['delivery_date']))); array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($wip['delivery_date'])));
} }
if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) {
array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date']))); array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date'])));
array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date'])));
$checktime = strtotime($wip['official_check_date']);
$month = collect_month($checktime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['check'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['check'][2] = strval(date('Ymd', $checktime));
} }
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) {
if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") {
$estimate_delivery_time = strtotime($wip['tryrun_end_date']); $estimate_delivery_time = strtotime($wip['tryrun_end_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400); $tryruntime = $estimate_delivery_time + (90 * 86400);
$arrivetime = date('Ymd', $secondtime); $tryruntime = date('Ymd', $secondtime);
$arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); $arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime);
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($tryruntime)));
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($tryruntime)));
$month = collect_month($tryruntime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $tryruntime));
} else { } else {
$arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); $arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']);
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date'])));
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date'])));
$tryruntime = strtotime($wip['tryrun_end_date']);
$month = collect_month($tryruntime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $tryruntime));
} }
} }
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) {
array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date'])));
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date'])));
$installtime = strtotime($wip['install_end_date']);
$month = collect_month($installtime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][2] = strval(date('Ymd', $installtime));
} }
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) {
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") {
$estimate_delivery_time = strtotime($wip['real_arrival_date']); $estimate_delivery_time = strtotime($wip['real_arrival_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400); $arrivetime = $estimate_delivery_time + (90 * 86400);
$month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
$arrivetime = date('Ymd', $secondtime); $arrivetime = date('Ymd', $secondtime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime)));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime)));
} else { } else {
$arrivetime = strtotime($wip['real_arrival_date']);
$month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date'])));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date'])));
} }
} else {
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") {
$estimate_delivery_time = strtotime($wip['real_contract_arrival_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400);
$arrivetime = date('Ymd', $secondtime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime)));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime)));
} else {
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date'])));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date'])));
}
} }
} elseif ($wip['official_check_date'] != NULL) { } elseif ($wip['official_check_date'] != NULL) {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>";
$arrayData[$wip['contractno']]['check_num'] += 1; $arrayData[$wip['contractno']]['check_num'] += 1;
$arrayData[$wip['contractno']]['tryrun_num'] += 1; $arrayData[$wip['contractno']]['tryrun_num'] += 1;
$arrayData[$wip['contractno']]['install_num'] += 1; $arrayData[$wip['contractno']]['install_num'] += 1;
@ -433,30 +518,48 @@ foreach ($wipwhole_array as $wip) {
if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) {
array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date']))); array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date'])));
array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date'])));
$checktime = strtotime($wip['official_check_date']);
$month = collect_month($checktime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['check'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['check'][2] = strval(date('Ymd', $checktime));
} }
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) {
if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { if (isset($arrayData[$wip['contractno']]['tryrun'][0]) && $arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") {
$estimate_delivery_time = strtotime($wip['tryrun_end_date']); $estimate_delivery_time = strtotime($wip['tryrun_end_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400); $tryruntime = $estimate_delivery_time + (90 * 86400);
$arrivetime = date('Ymd', $secondtime); $month = collect_month($tryruntime);
$tryruntime = date('Ymd', $tryruntime);
$arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); $arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime);
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($tryruntime)));
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($tryruntime)));
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval($tryruntime);
} else { } else {
$tryruntime = strtotime($wip['tryrun_end_date']);
$month = collect_month($tryruntime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $tryruntime));
$arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); $arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']);
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date'])));
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date'])));
} }
} }
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) {
$installtime = strtotime($wip['install_end_date']);
$month = collect_month($installtime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][2] = strval(date('Ymd', $installtime));
array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date'])));
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date'])));
} }
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) {
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { if (isset($arrayData[$wip['contractno']]['arrive'][0]) && $arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") {
$estimate_delivery_time = strtotime($wip['real_arrival_date']); $estimate_delivery_time = strtotime($wip['real_arrival_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400); $arrivetime = $estimate_delivery_time + (90 * 86400);
$month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
$arrivetime = date('Ymd', $secondtime); $arrivetime = date('Ymd', $secondtime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); $arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime)));
@ -465,6 +568,10 @@ foreach ($wipwhole_array as $wip) {
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date'])));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date'])));
$arrivetime = strtotime($wip['real_arrival_date']);
$month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
} }
} else { } else {
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") {
@ -482,6 +589,7 @@ foreach ($wipwhole_array as $wip) {
} }
} elseif ($wip['tryrun_end_date'] != NULL) { } elseif ($wip['tryrun_end_date'] != NULL) {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>";
$arrayData[$wip['contractno']]['tryrun_num'] += 1; $arrayData[$wip['contractno']]['tryrun_num'] += 1;
$arrayData[$wip['contractno']]['install_num'] += 1; $arrayData[$wip['contractno']]['install_num'] += 1;
$arrayData[$wip['contractno']]['arrive_num'] += 1; $arrayData[$wip['contractno']]['arrive_num'] += 1;
@ -490,20 +598,35 @@ foreach ($wipwhole_array as $wip) {
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) {
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date'])));
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date'])));
$tryruntime = strtotime($wip['tryrun_end_date']);
$month = collect_month($tryruntime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $tryruntime));
} }
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) {
array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date'])));
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date'])));
$installtime = strtotime($wip['install_end_date']);
$month = collect_month($installtime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][2] = strval(date('Ymd', $installtime));
} }
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) {
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") {
$estimate_delivery_time = strtotime($wip['real_arrival_date']); $estimate_delivery_time = strtotime($wip['real_arrival_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400); $arrivetime = $estimate_delivery_time + (90 * 86400);
$arrivetime = date('Ymd', $secondtime); $month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
$arrivetime = date('Ymd', $arrivetime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($arrivetime);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime)));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime)));
} else { } else {
$arrivetime = strtotime($wip['real_arrival_date']);
$month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date'])));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date'])));
@ -512,8 +635,8 @@ foreach ($wipwhole_array as $wip) {
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") {
$estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); $estimate_delivery_time = strtotime($wip['real_contract_arrival_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400); $arrivetime = $estimate_delivery_time + (90 * 86400);
$arrivetime = date('Ymd', $secondtime); $arrivetime = date('Ymd', $arrivetime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); $arrayData[$wip['contractno']]['arrive'][2] = strval($arrivetime);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime)));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime)));
} else { } else {
@ -524,11 +647,16 @@ foreach ($wipwhole_array as $wip) {
} }
} elseif ($wip['install_end_date'] != NULL) { } elseif ($wip['install_end_date'] != NULL) {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>";
$arrayData[$wip['contractno']]['install_num'] += 1; $arrayData[$wip['contractno']]['install_num'] += 1;
$arrayData[$wip['contractno']]['arrive_num'] += 1; $arrayData[$wip['contractno']]['arrive_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1; $arrayData[$wip['contractno']]['second_num'] += 1;
$arrayData[$wip['contractno']]['sign_num'] += 1; $arrayData[$wip['contractno']]['sign_num'] += 1;
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) {
$installtime = strtotime($wip['install_end_date']);
$month = collect_month($installtime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][2] = strval(date('Ymd', $installtime));
array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date'])));
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strtotime(strval($wip['install_end_date'])))); array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strtotime(strval($wip['install_end_date']))));
} }
@ -536,11 +664,18 @@ foreach ($wipwhole_array as $wip) {
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") {
$estimate_delivery_time = strtotime($wip['real_arrival_date']); $estimate_delivery_time = strtotime($wip['real_arrival_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400); $arrivetime = $estimate_delivery_time + (90 * 86400);
$arrivetime = date('Ymd', $secondtime); $month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
$arrivetime = date('Ymd', $arrivetime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($arrivetime);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime)));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime)));
} else { } else {
$arrivetime = strtotime($wip['real_arrival_date']);
$month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date'])));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date'])));
@ -561,6 +696,7 @@ foreach ($wipwhole_array as $wip) {
} }
} elseif ($wip['real_arrival_date'] != NULL) { } elseif ($wip['real_arrival_date'] != NULL) {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>";
$arrayData[$wip['contractno']]['arrive_num'] += 1; $arrayData[$wip['contractno']]['arrive_num'] += 1;
$arrayData[$wip['contractno']]['second_num'] += 1; $arrayData[$wip['contractno']]['second_num'] += 1;
$arrayData[$wip['contractno']]['sign_num'] += 1; $arrayData[$wip['contractno']]['sign_num'] += 1;
@ -568,28 +704,42 @@ foreach ($wipwhole_array as $wip) {
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") {
$estimate_delivery_time = strtotime($wip['real_arrival_date']); $estimate_delivery_time = strtotime($wip['real_arrival_date']);
$arrivetime = $estimate_delivery_time + (90 * 86400); $arrivetime = $estimate_delivery_time + (90 * 86400);
$arrivetime = date('Ymd', $secondtime); $month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
$arrivetime = date('Ymd', $arrivetime);
$arrayData[$wip['contractno']]['arrive'][2] = strval($arrivetime);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime)));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime)));
} else { } else {
$arrivetime = strtotime($wip['real_arrival_date']);
$month = collect_month($arrivetime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime));
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); $arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']);
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date'])));
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date'])));
} }
} elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) { } elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) {
$secondtime = strtotime($arrayData[$wip['contractno']]['second'][2]);
$month = collect_month($secondtime);
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][6] = $month;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][2] = strval(date('Ymd', $secondtime));
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (已達二次款收款條件) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (已達二次款收款條件) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (已達二次款收款條件) <br>";
$arrayData[$wip['contractno']]['second_num'] += 1; $arrayData[$wip['contractno']]['second_num'] += 1;
$arrayData[$wip['contractno']]['sign_num'] += 1; $arrayData[$wip['contractno']]['sign_num'] += 1;
} else { } else {
$arrayData[$wip['contractno']]['sign_num'] += 1; $arrayData[$wip['contractno']]['sign_num'] += 1;
if ($wip['real_contract_arrival_date'] != NULL) { if ($wip['real_contract_arrival_date'] != NULL) {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日) <br>";
} elseif ($wip['estimated_shipping_date'] != NULL) { } elseif ($wip['estimated_shipping_date'] != NULL) {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出港日) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出港日) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出港日) <br>";
} else { } else {
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計出港日待確認) <br>"; $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計出港日待確認) <br>";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (預計出港日待確認) <br>";
} }
} }
} }
@ -598,6 +748,7 @@ foreach ($wipwhole_array as $wip) {
// 計算每個合約的應收款、作番總數 // 計算每個合約的應收款、作番總數
$today_date = new DateTime(date('Y-m-d', strtotime('-1 month', strtotime(date('Y-m-d'))))); $today_date = new DateTime(date('Y-m-d', strtotime('-1 month', strtotime(date('Y-m-d')))));
$contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final');
foreach ($arrayData as &$value) { foreach ($arrayData as &$value) {
if ($value['total_facility_num'] > 0) { if ($value['total_facility_num'] > 0) {
$value['receivable_budget'] = $value['sign'][1] * ($value['sign_num'] / $value['total_facility_num']) + ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) + $value['receivable_budget'] = $value['sign'][1] * ($value['sign_num'] / $value['total_facility_num']) + ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) +
@ -613,9 +764,24 @@ foreach ($arrayData as &$value) {
$value['delivery'][3] = $value['delivery'][1] * ($value['delivery_num'] / $value['total_facility_num']); $value['delivery'][3] = $value['delivery'][1] * ($value['delivery_num'] / $value['total_facility_num']);
$value['final'][3] = $value['final'][1] * ($value['delivery_num'] / $value['total_facility_num']); $value['final'][3] = $value['final'][1] * ($value['delivery_num'] / $value['total_facility_num']);
} }
// 計算最大催收次數與最小催收次數
$contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final');
// 計算每台作番金額與各階段應收金額
foreach ($value['facility'] as &$val) {
foreach ($contractstage as $stage) {
if (isset($value[$stage][0]) && !empty($value[$stage][0])) {
$val[$stage][0] = $value[$stage][0];
$val[$stage][1] = $value[$stage][1] / $value['total_facility_num'];
$val[$stage][3] = (!(isset($val[$stage][6])) || $val[$stage][6] == 0) ? 0 : $val[$stage][1];
$val['total_budget'] += $val[$stage][1];
$val['receivable_budget'] += $val[$stage][3];
}
}
}
// 計算最大催收次數與最小催收次數
foreach ($contractstage as $i) { foreach ($contractstage as $i) {
if (!empty($value[$i]['min']) && count($value[$i]['min']) > 0) { if (!empty($value[$i]['min']) && count($value[$i]['min']) > 0) {
$latest_timestamp = max($value[$i]['min']); $latest_timestamp = max($value[$i]['min']);
@ -689,6 +855,9 @@ foreach ($received_array as $received) {
$excel_aray = array(); $excel_aray = array();
$boga_array = array(); $boga_array = array();
$exclude_boga_array = array(); $exclude_boga_array = array();
$facility_array = array();
$facility_boga_array = array();
$facility_exclude_boga_array = array();
foreach ($arrayData as $key => $value) { foreach ($arrayData as $key => $value) {
$value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0; $value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0;
$value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0; $value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0;
@ -700,11 +869,10 @@ foreach ($arrayData as $key => $value) {
$value['final'][3] = (isset($value['final'][3])) ? $value['final'][3] : 0; $value['final'][3] = (isset($value['final'][3])) ? $value['final'][3] : 0;
$contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); $contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final');
foreach ($contractstage as $i) { foreach ($contractstage as $i) {
$value[$i]['max'] = (empty($value[$i]['max']) || !isset($value[$i]['max'])) ? 0 : $value[$i]['max']; $value[$i]['max'] = (empty($value[$i]['max']) || is_null($value[$i]['max'])) ? 0 : $value[$i]['max'];
$value[$i]['min'] = (empty($value[$i]['min']) || !isset($value[$i]['min'])) ? 0 : $value[$i]['min']; $value[$i]['min'] = (empty($value[$i]['min']) || is_null($value[$i]['min'])) ? 0 : $value[$i]['min'];
}; };
if ($value['sign'][0] == "寶佳出貨前30天") { if ($value['sign'][0] == "寶佳出貨前30天") {
$boga_array[$key] = [ $boga_array[$key] = [
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
@ -716,7 +884,7 @@ foreach ($arrayData as $key => $value) {
$value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], $value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'],
$value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], $value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'],
$value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], $value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'],
$value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('<br>', '; ', $value['facilities']) $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities'])
]; ];
} else { } else {
$exclude_boga_array[$key] = [ $exclude_boga_array[$key] = [
@ -729,7 +897,7 @@ foreach ($arrayData as $key => $value) {
$value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], $value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'],
$value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], $value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'],
$value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], $value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'],
$value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('<br>', '; ', $value['facilities']) $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities'])
]; ];
} }
@ -745,13 +913,69 @@ foreach ($arrayData as $key => $value) {
$value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], $value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'],
$value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], $value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'],
$value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], $value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'],
$value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], str_replace('<br>', '; ', $value['facilities']) $value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities'])
];
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份
//[合約號]['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數
foreach ($value['facility'] as $valkey => $val) {
foreach ($contractstage as $stage) {
$val[$stage][0] = (!(isset($val[$stage][0])) || is_null($val[$stage][0])) ? "-" : $val[$stage][0];
$val[$stage][1] = (!(isset($val[$stage][1])) || is_null($val[$stage][1])) ? 0 : $val[$stage][1];
$val[$stage][2] = (!(isset($val[$stage][2])) || is_null($val[$stage][2])) ? "-" : $val[$stage][2];
$val[$stage][3] = (!(isset($val[$stage][3])) || is_null($val[$stage][3])) ? 0 : $val[$stage][3];
$val[$stage][4] = (!(isset($val[$stage][4])) || is_null($val[$stage][4])) ? 0 : $val[$stage][4];
$val[$stage][5] = (!(isset($val[$stage][5])) || is_null($val[$stage][5])) ? 0 : $val[$stage][5];
$val[$stage][6] = (!(isset($val[$stage][6])) || is_null($val[$stage][6])) ? 0 : $val[$stage][6];
}
$facility_array[$valkey] = [
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][6],
$val['second'][0], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][6],
$val['arrive'][0], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][6],
$val['install'][0], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][6],
$val['tryrun'][0], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][6],
$val['check'][0], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][6],
$val['delivery'][0], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][6],
$val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6],
str_replace('<br>', '; ', $val['status']), $val['total_budget'], $val['receivable_budget']
]; ];
if ($value['sign'][0] == "寶佳出貨前30天") {
$facility_boga_array[$valkey] = [
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][6],
$val['second'][0], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][6],
$val['arrive'][0], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][6],
$val['install'][0], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][6],
$val['tryrun'][0], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][6],
$val['check'][0], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][6],
$val['delivery'][0], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][6],
$val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6],
str_replace('<br>', '; ', $val['status']), $val['total_budget'], $val['receivable_budget']
];
} else {
$facility_exclude_boga_array[$valkey] = [
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][6],
$val['second'][0], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][6],
$val['arrive'][0], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][6],
$val['install'][0], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][6],
$val['tryrun'][0], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][6],
$val['check'][0], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][6],
$val['delivery'][0], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][6],
$val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6],
str_replace('<br>', '; ', $val['status']), $val['total_budget'], $val['receivable_budget']
];
}
}
} }
$data = json_encode($excel_aray); $data = json_encode($excel_aray);
$boga_data = json_encode($boga_array); $boga_data = json_encode($boga_array);
$exclude_boga_data = json_encode($exclude_boga_array); $exclude_boga_data = json_encode($exclude_boga_array);
$facility_data = json_encode($facility_array);
$facility_boga_data = json_encode($facility_boga_array);
$facility_exclude_boga_data = json_encode($facility_exclude_boga_array);
?> ?>
<style> <style>
@ -791,16 +1015,23 @@ $exclude_boga_data = json_encode($exclude_boga_array);
} }
</style> </style>
<button type="button" onclick="downloadData()" class="btn btn-success btn-lg pull-right">全部<span class="glyphicon glyphicon-download-alt"></span></button>
<button type="button" onclick="exclude_bogaData()" class="btn btn-info btn-lg pull-right">不含寶佳<span class="glyphicon glyphicon-download-alt"></span></button> <div style="width: 98%;margin: 1%;">
<button type="button" onclick="bogaData()" class="btn btn-warning btn-lg pull-right">寶佳<span class="glyphicon glyphicon-download-alt"></span></button> <div class="btn-group btn-group-md " style="padding:10 px; width: 100%;">
<?php <button type="button" style="width: 12%;" onclick="downloadData()" class="btn btn-success">全部<span class="glyphicon glyphicon-download-alt"></span></button>
if (in_array(accountidToDepartId($user_id), array('220', '210')) || $user_id == 'M0060') { <button type="button" style="width: 12%;" onclick="exclude_bogaData()" class="btn btn-info">不含寶佳<span class="glyphicon glyphicon-download-alt"></span></button>
?> <button type="button" style="width: 12%;" onclick="bogaData()" class="btn btn-warning">寶佳<span class="glyphicon glyphicon-download-alt"></span></button>
<a href="facility-price.php?<?= $token_link ?>" class="btn btn-primary btn-lg pull-right">合約作番明細</span></a> </div>
<?php </div>
} <div style="width: 98%;margin: 1%;">
?> <div class="btn-group btn-group-md" style="width: 100%;">
<button type="button" style="width: 12%;" onclick="downloadFacilityData('AllData')" class="btn btn-success btn-md">作番收款明細<span class="glyphicon glyphicon-download-alt"></span></button>
<button type="button" style="width: 12%;" onclick="downloadFacilityData('ExcludeData')" class="btn btn-info btn-md">不含寶佳作番收款明細<span class="glyphicon glyphicon-download-alt"></span></button>
<button type="button" style="width: 12%;" onclick="downloadFacilityData('BogaData')" class="btn btn-warning btn-md">寶佳作番收款明細<span class="glyphicon glyphicon-download-alt"></span></button>
</div>
</div>
<div style="width:98%;margin:1% ;overflow-x: auto;"> <div style="width:98%;margin:1% ;overflow-x: auto;">
<table id="table_index" class="table table-striped table-bordered" style="width:100%;"> <table id="table_index" class="table table-striped table-bordered" style="width:100%;">
<thead> <thead>
@ -914,10 +1145,10 @@ if (in_array(accountidToDepartId($user_id), array('220', '210')) || $user_id ==
} }
function test() { function test() {
var BillData = <?= $data ?>; var BillData = <?= $boga_data ?>;
var form = document.createElement("form"); var form = document.createElement("form");
form.method = 'POST'; form.method = 'POST';
form.action = "account-receivable-excel.php?<?= $token_link ?>"; form.action = "account-receivable-excel.php?type=facility&<?= $token_link ?>";
var input = document.createElement("input"); var input = document.createElement("input");
input.type = "hidden"; input.type = "hidden";
input.name = "Bill"; input.name = "Bill";
@ -930,14 +1161,14 @@ if (in_array(accountidToDepartId($user_id), array('220', '210')) || $user_id ==
function downloadData() { function downloadData() {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
var url = window.location.origin + "/wms/account-receivable-excel.php?<?= $token_link ?>"; var url = window.location.origin + "/wms/account-receivable-excel.php?type=all&<?= $token_link ?>";
xhr.open('POST', url, true); xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) { if (xhr.readyState === 4 && xhr.status === 200) {
var file_path = xhr.responseText; var file_path = xhr.responseText;
var link = document.createElement('a'); var link = document.createElement('a');
var name = "應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; var name = "全部應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx";
link.setAttribute('href', window.location.origin + "/wms/account-receivable-test.xlsx"); link.setAttribute('href', window.location.origin + "/wms/account-receivable-test.xlsx");
link.setAttribute('download', name); link.setAttribute('download', name);
link.style.display = 'none'; link.style.display = 'none';
@ -959,14 +1190,14 @@ if (in_array(accountidToDepartId($user_id), array('220', '210')) || $user_id ==
function bogaData() { function bogaData() {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
var url = window.location.origin + "/wms/account-receivable-excel.php?<?= $token_link ?>"; var url = window.location.origin + "/wms/account-receivable-excel.php?type=boga&<?= $token_link ?>";
xhr.open('POST', url, true); xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) { if (xhr.readyState === 4 && xhr.status === 200) {
var file_path = xhr.responseText; var file_path = xhr.responseText;
var link = document.createElement('a'); var link = document.createElement('a');
var name = "應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; var name = "寶佳應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx";
link.setAttribute('href', window.location.origin + "/wms/account-receivable-test.xlsx"); link.setAttribute('href', window.location.origin + "/wms/account-receivable-test.xlsx");
link.setAttribute('download', name); link.setAttribute('download', name);
link.style.display = 'none'; link.style.display = 'none';
@ -981,17 +1212,52 @@ if (in_array(accountidToDepartId($user_id), array('220', '210')) || $user_id ==
} }
function downloadFacilityData(content) {
if (content == 'AllData') {
var BillData = <?= $facility_data ?>;
var filename = "作番應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx";
}
else if(content == 'ExcludeData') {
var BillData = <?= $facility_exclude_boga_data ?>;
var filename = "不含寶佳作番應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx";
}
else if(content == 'BogaData'){
var BillData = <?= $facility_boga_data ?>;
var filename = "寶佳作番應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx";
}
var xhr = new XMLHttpRequest();
var url = window.location.origin + "/wms/account-receivable-excel.php?type=facility&<?= $token_link ?>";
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var file_path = xhr.responseText;
var link = document.createElement('a');
link.setAttribute('href', window.location.origin + "/wms/account-receivable-facility.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
}));
}
function exclude_bogaData() { function exclude_bogaData() {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
var url = window.location.origin + "/wms/account-receivable-excel.php?<?= $token_link ?>"; var url = window.location.origin + "/wms/account-receivable-excel.php?type=exclude_boga&<?= $token_link ?>";
xhr.open('POST', url, true); xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) { if (xhr.readyState === 4 && xhr.status === 200) {
var file_path = xhr.responseText; var file_path = xhr.responseText;
var link = document.createElement('a'); var link = document.createElement('a');
var name = "應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; var name = "不含寶佳應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx";
link.setAttribute('href', window.location.origin + "/wms/account-receivable-test.xlsx"); link.setAttribute('href', window.location.origin + "/wms/account-receivable-test.xlsx");
link.setAttribute('download', name); link.setAttribute('download', name);
link.style.display = 'none'; link.style.display = 'none';

54
wms/account-receivable-test.php

@ -9,24 +9,36 @@
// echo $test; // echo $test;
include './header.php'; include './header.php';
$sql = "SELECT // $sql = "SELECT
salOrderStagePay.BillNo, // salOrderStagePay.BillNo,
salOrderStagePay.PayStage // salOrderStagePay.PayStage
FROM salOrderStagePay // FROM salOrderStagePay
LEFT JOIN salSalesOrder // LEFT JOIN salSalesOrder
ON salSalesOrder.BillNo = salOrderStagePay.BillNo WHERE salSalesOrder.ModeId = 'M' AND (salSalesOrder.CurrentState=2 OR salSalesOrder.CurrentState=4) "; // ON salSalesOrder.BillNo = salOrderStagePay.BillNo WHERE salSalesOrder.ModeId = 'M' AND (salSalesOrder.CurrentState=2 OR salSalesOrder.CurrentState=4) ";
$query = $conn->query($sql); // $query = $conn->query($sql);
$contracts = array(); // $contracts = array();
foreach ($query as $row) { // foreach ($query as $row) {
if (!array_key_exists($row['BillNo'], $contracts)) { // if (!array_key_exists($row['BillNo'], $contracts)) {
$contracts[$row['BillNo']] = [$row['BillNo'], $row['PayStage']]; // $contracts[$row['BillNo']] = [$row['BillNo'], $row['PayStage']];
}else{ // }else{
array_push($contracts[$row['BillNo']], $row['PayStage']); // array_push($contracts[$row['BillNo']], $row['PayStage']);
} // }
} // }
foreach($contracts as $contract){ // foreach($contracts as $contract){
foreach($contract as $con){ // foreach($contract as $con){
echo $con.";"; // echo $con.";";
} // }
echo "<br>"; // echo "<br>";
} // }
//只有一個作番的銷售訂單
// $sql = "select salSalesOrderDetail.BillNo,count(salSalesOrderDetail.MaterialId) AS number from salSalesOrderDetail
// LEFT JOIN salSalesOrder ON salSalesOrder.BillNo=salSalesOrderDetail.BillNo
// where salSalesOrderDetail.ItemType=0 AND salSalesOrder.ModeId='M'
// group by salSalesOrderDetail.BillNo ORDER BY number";
// $query = $conn->query($sql);
// foreach($query as $row){
// if($row['number']==1){
// echo $row['BillNo']."<br>";
// }
// }

BIN
wms/account-receivable-test.xlsx

Binary file not shown.

31815
wms/account_receivable_sql_file.sql

File diff suppressed because it is too large

6
wms/cont/sign_list.php

@ -75,8 +75,10 @@ form_key,
status, status,
f_return_content('payment_kind',payment_kind ) payment_kind FROM $table f_return_content('payment_kind',payment_kind ) payment_kind FROM $table
where 1=1 $where ORDER BY vol_no"; where 1=1 $where ORDER BY vol_no";
// echo $sql;
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
// echo '<pre>';
// print_r($sql);
// echo '</pre>';
?> ?>
@ -225,7 +227,7 @@ if ($data) :
$oneself = ($row['salesman'] == $user_id) ? 1 : 0; $oneself = ($row['salesman'] == $user_id) ? 1 : 0;
?> ?>
<tr> <tr>
<td><?php echo $row['apply_key'] ?></td> <td><a href="query_form.php?apply_key=<?= $row['apply_key'] ?>&token=<?= $_GET['token'] ?>"><?= $row['apply_key'] ?></a></td>
<td><?php echo $row['vol_no'] ?></td> <td><?php echo $row['vol_no'] ?></td>
<td><?php echo $row['address'] ?></td> <td><?php echo $row['address'] ?></td>
<td><?php echo $row['case_name'] ?></td> <td><?php echo $row['case_name'] ?></td>

167
wms/contract-repair/api/putContractData.php

@ -6,7 +6,7 @@ ini_set('date.timezone', 'Asia/Taipei');
if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_POST["id"]) && $_POST['id'] != "") { if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_POST["id"]) && $_POST['id'] != "") {
try { try {
$create_date = date('Y-m-d H:i:s'); $create_date = date('Y-m-d H:i:s');
$repair_no = !empty($POST['repair_no']) ? $_POST['repair_no'] : null; $repair_no = !empty($_POST['repair_no']) ? $_POST['repair_no'] : null;
$contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null; $contractno = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
$company = !empty($_POST['company']) ? $_POST['company'] : null; $company = !empty($_POST['company']) ? $_POST['company'] : null;
$taxid = !empty($_POST['taxid']) ? $_POST['taxid'] : null; $taxid = !empty($_POST['taxid']) ? $_POST['taxid'] : null;
@ -21,7 +21,7 @@ if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_PO
$fail_arr = []; $fail_arr = [];
// if (empty($repair_no)) $fail_arr[] = '號為必填'; // if (empty($repair_no)) $fail_arr[] = '號為必填';
if (empty($contractno)) $fail_arr[] = '合約號為必填'; // if (empty($contractno)) $fail_arr[] = '合約號為必填';
if (empty($company)) $fail_arr[] = '客戶名稱為必填'; if (empty($company)) $fail_arr[] = '客戶名稱為必填';
if (empty($taxid)) $fail_arr[] = '統一編號為必填'; if (empty($taxid)) $fail_arr[] = '統一編號為必填';
if (empty($facilityno)) $fail_arr[] = '電梯號為必填'; if (empty($facilityno)) $fail_arr[] = '電梯號為必填';
@ -35,7 +35,7 @@ if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_PO
echo json_encode($fail_arr); echo json_encode($fail_arr);
exit(); exit();
} }
// $conn->beginTransaction(); $conn->beginTransaction();
$sql = "UPDATE contract_r_signed_back SET $sql = "UPDATE contract_r_signed_back SET
repaireid = :repaireid,facilityno= :facilityno, invoice=:invoice, taxid=:taxid, address=:address,type=:type,contract_status=:contract_status,update_user=:update_user,update_date=:update_date repaireid = :repaireid,facilityno= :facilityno, invoice=:invoice, taxid=:taxid, address=:address,type=:type,contract_status=:contract_status,update_user=:update_user,update_date=:update_date
@ -56,135 +56,60 @@ if (isset($_POST['contracttype']) && $_POST['contracttype'] == 'r' && isset($_PO
// echo json_encode($sql); // echo json_encode($sql);
// exit; // exit;
$stmt->execute(); $stmt->execute();
t8Insert($_POST);
// header("HTTP/1.1 204 NO Content"); // header("HTTP/1.1 204 NO Content");
// $conn->commit(); $conn->commit();
} catch (PDOException $e) { } catch (PDOException $e) {
// $conn->rollback(); // $conn->rollback();
header("HTTPP/1.1 500 Internal Server Error"); header("HTTPP/1.1 500 Internal Server Error");
die('Error!:' . $e->getMessage()); die('Error!:' . $e->getMessage());
} }
} }
// if (isset($_POST['contractno']) && $_POST['contractno'] != "" && isset($_POST["id"]) && $_POST['id'] != "") {
// try {
// $created_at = date('Y-m-d H:i:s');
// $created_by = $_POST['user_id'];
// $id = $_POST["id"];
// $contract_no = !empty($_POST['contractno']) ? $_POST['contractno'] : null;
// $customer = !empty($_POST['customer']) ? $_POST['customer'] : null;
// $manager = !empty($_POST['manager']) ? $_POST['manager'] : null;
// $vat = !empty($_POST['vat']) ? $_POST['vat'] : null;
// $case_name = !empty($_POST['case_name']) ? $_POST['case_name'] : null;
// $linkman = !empty($_POST['linkman']) ? $_POST['linkman'] : null;
// $lm_tel = !empty($_POST['lm_tel']) ? $_POST['lm_tel'] : null;
// $address = !empty($_POST['address']) ? $_POST['address'] : null;
// $salesman = !empty($_POST['salesman']) ? $_POST['salesman'] : null;
// $qc = !empty($_POST['qc']) ? $_POST['qc'] : null;
// $deletefiles = !empty($_POST['deletefiles']) ? $_POST['deletefiles'] : null;
// $files_id = !empty($_POST['files_id']) ? $_POST['files_id'] : null;
// $files = !empty($_FILES['files']) ? $_FILES['files'] : null;
// $deletefilesArr = explode(',', $_POST['deletefiles']); function t8Insert($data)
{
require_once('../../contract/connt8.php');
$create_date = date('Y-m-dH-i-s');
$repair_no = !empty($data['repair_no']) ? $data['repair_no'] : null; // 報價單號
$company = !empty($data['company']) ? $data['company'] : null; //立約人
$repaireid = !empty($data['repaireid']) ? $data['repaireid'] : null; //維保人員
$facilityno = !empty($data['facilityno']) ? $data['facilityno'] : null; // 電梯編號
$type = !empty($data['type']) ? $data['type'] : null; //工程進度
$sign_date = !empty($data['sign_date']) ? $data['sign_date'] : null; //簽訂時間
$invoice = !empty($data['invoice']) ? $data['invoice'] : null; // 發票抬頭
$taxid = !empty($data['taxid']) ? $data['taxid'] : null; //統編
$address = !empty($data['address']) ? $data['address'] : null; //工程地址
$contract_status = !empty($data['contract_status']) ? $data['contract_status'] : null;
$user_id = !empty($_data['user_id']) ? $data['user_id'] : null;
// $fail_arr = []; $sign = str_replace("-", '', $sign_date);
// if (empty($contract_no)) $fail_arr[] = '合約號為必填'; $create = str_replace('-', '', $create_date);
// 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();
// }
// $conn->beginTransaction(); $sql = "INSERT INTO comBusinessPartner
(BizPartnerId,BizPartnerName,BusinessAttr,CountryId,BizToDate,TaxNo,ContactAddress,CreatorId,CreateTime,BizPartnerTypeId)
VALUES(:BizPartnerId,:BizPartnerName,1,'TW',99999999,:TaxNo,:ContactAddress,:CreatorId,:CreateTime,'10')";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':BizPartnerId', $repair_no); //報價單編號
$stmt->bindParam(':BizPartnerName', $company);
$stmt->bindParam(':TaxNo', $taxid);
$stmt->bindParam(':ContactAddress', $address);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $create);
$stmt->execute();
// $sql_str = "UPDATE contract_m_signed_back SET contract_no=:contract_no, customer=:customer, manager=:manager, vat=:vat, case_name=:case_name, linkman=:linkman, lm_tel=:lm_tel, address=:address, salesman=:salesman, qc_official_type=:qc WHERE id = :id"; $sql = "INSERT INTO comCustomer
// $stmt = $conn->prepare($sql_str); (OrgId,BizPartnerTypeId,CurrId,BizPartnerId,PersonId,CreatorId,IsInUsed,InvoiceAddress,CreateTime)
// $stmt->bindParam(':contract_no', $contract_no); VALUES('1000','10','TWD',:BizPartnerId,:PersonId,:CreatorId,1,:InvoiceAddress,:CreateTime)";
// $stmt->bindParam(':customer', $customer); $stmt = $connT8->prepare($sql);
// $stmt->bindParam(':manager', $manager); $stmt->bindParam(':BizPartnerId', $repair_no);
// $stmt->bindParam(':vat', $vat); $stmt->bindParam(':PersonId', $salesman);
// $stmt->bindParam(':case_name', $case_name); $stmt->bindParam(':CreatorId', $user_id);
// $stmt->bindParam(':linkman', $linkman); $stmt->bindParam(':InvoiceAddress', $address);
// $stmt->bindParam(':lm_tel', $lm_tel); $stmt->bindParam(':CreateTime', $create);
// $stmt->bindParam(':address', $address); $stmt->execute();
// $stmt->bindParam(':salesman', $salesman);
// $stmt->bindParam(':qc', $qc);
// $stmt->bindParam(':id', $id);
// $stmt->execute();
// if (!empty($deletefiles)) {
// $sql_str = "DELETE FROM contract_back_files WHERE id IN ($deletefiles)";
// $stmt = $conn->prepare($sql_str);
// $stmt->execute();
// }
// if (!empty($files)) { $sql = "INSERT INTO ";
// $englisharr = range('a', 'z');
// $files = $_FILES['files'];
// $newfiles = [];
// foreach ($files as $file) {
// $i = 0; //新陣列的索引編號
// 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];
// $newfiles[$i]['error'] = $files['error'][$key];
// $newfiles[$i]['size'] = $files['size'][$key];
// $i++;
// } //foreach 第2層 end
// }
// $max_size = 4096 * 4096; //設定允許上傳檔案容量的最大值(1M)
// $allow_ext = array('jpeg', 'jpg', 'png', 'JPG', 'JPEG', 'PNG', 'GIF'); //設定允許上傳檔案的類型
// $path = '../images/contracts/';
// if (!file_exists($path)) {
// mkdir($path);
// }
// $msg_result = ''; //負責接收所有檔案檢測後的回傳訊息
// $datetime = (string)date('YmdHis');
// $files_id = ($files_id !== null) ? $files_id : 'm' . $datetime; // 新梯=>m + 日期時間
// 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 {
// throw new PDOException('檔案上傳失敗:' . $msg);
// }
// $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);
// }
// }
// } else {
// $files = null;
// }
// $conn->commit(); $connT8->commit();
// } catch (PDOException $e) { }
// $conn->rollback();
// header("HTTP/1.1 500 Internal Server Error");
// die('Error!:' . $e->getMessage());
// }
// }

41
wms/contract-repair/contract-download.php

@ -70,22 +70,17 @@ if (!empty($_GET['apply_key'])) {
$noteArr = array(1, 1, 1, 1, 1); $noteArr = array(1, 1, 1, 1, 1);
$qty = $contract_maintance[0]['num']; $qty = $contract_maintance[0]['num'];
// echo $qty; // echo $qty;
// foreach ($contract_maintance as $idx => $amount) { foreach ($contract_maintance as $idx => $amount) {
// $isset = false; $isset = false;
// if ($amount['payment_kind'] == 5 || $amount['payment_kind'] == 6) {
// if ($amount['pay_scale'] >= 0) { if ($amount['pay_kind'] == 1 || $amount['pay_kind'] == 2 || $amount['pay_kind'] == 3) {
// $install_total_price = $install_total_price + $amount['pay_amount']; if ($amount['pay_scale'] > 0) {
// $installArr[] = ['installment' => $amount['pay_kind'], 'scale' => $amount['pay_scale'], 'amount' => $amount['pay_amount'], 'pay_period' => $amount['pay_period']]; $buy_total_price = $buy_total_price + $amount['pay_amount'];
// } foreach ($buyArr as $buy) {
// } if ($buy['installment'] == $amount['pay_kind']) {
// if ($amount['pay_kind'] == 1 || $amount['pay_kind'] == 2 || $amount['pay_kind'] == 3) { $isset = true;
// if ($amount['pay_scale'] > 0) { }
// $buy_total_price = $buy_total_price + $amount['pay_amount']; }
// foreach ($buyArr as $buy) {
// if ($buy['installment'] == $amount['pay_kind']) {
// $isset = true;
// }
// }
// if (!$isset) { { // if (!$isset) { {
// $buyArr[] = ['installment' => $amount['pay_kind'], 'scale' => $amount['pay_scale'], 'amount' => $amount['pay_amount'], 'pay_period' => $amount['pay_period']]; // $buyArr[] = ['installment' => $amount['pay_kind'], 'scale' => $amount['pay_scale'], 'amount' => $amount['pay_amount'], 'pay_period' => $amount['pay_period']];
// } // }
@ -93,9 +88,9 @@ if (!empty($_GET['apply_key'])) {
// $buyNo2Pay = true; // $buyNo2Pay = true;
// } // }
// } // }
// } }
// } }
// } }
$sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL"; $sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL";
$sql_str = "SELECT contract_apply_files.*, contract_new_apply.id as apply_id FROM contract_apply_files LEFT JOIN contract_new_apply ON contract_apply_files.contract_id = contract_new_apply.id WHERE contract_new_apply.mid = :mid AND contract_apply_files.deleted_at IS NULL"; $sql_str = "SELECT contract_apply_files.*, contract_new_apply.id as apply_id FROM contract_apply_files LEFT JOIN contract_new_apply ON contract_apply_files.contract_id = contract_new_apply.id WHERE contract_new_apply.mid = :mid AND contract_apply_files.deleted_at IS NULL";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
@ -119,7 +114,7 @@ if (!empty($_GET['apply_key'])) {
<ul> <ul>
<button :class="isbuyShow ? 'active' : ''" @click="isbuyShow = true">電梯買賣合約書</button> <button :class="isbuyShow ? 'active' : ''" @click="isbuyShow = true">電梯買賣合約書</button>
<button :class="!isbuyShow ?'active' : ''" @click="isbuyShow = false">電梯安裝合約書</button> <button :class="!isbuyShow ?'active' : ''" @click="isbuyShow = false">電梯安裝合約書</button>
<a href="..wms/cont/sign_list.php?function_name=pricereview&<?php echo $token_link; ?>">回列表</a> <a href="../cont/sign_list.php?function_name=sign_list&<?php echo $token_link; ?>">回列表</a>
</ul> </ul>
</div> </div>
<div class="inputDiv" x-show="isbuyShow && isBuyInputIng"> <div class="inputDiv" x-show="isbuyShow && isBuyInputIng">
@ -453,11 +448,11 @@ if (!empty($_GET['apply_key'])) {
const totalInstallPrice = <?php echo $install_total_price; ?>; const totalInstallPrice = <?php echo $install_total_price; ?>;
const totalBuyPrice = <?php echo $buy_total_price; ?>; const totalBuyPrice = <?php echo $buy_total_price; ?>;
// const secondPayDeadline = <?php echo $contract['secondPayDeadline']; ?>; // const secondPayDeadline = <?php echo $contract['secondPayDeadline']; ?>;
// const buyfill1 = <?php echo $contract['tradedeadline']; ?>; const buyfill1 = <?php echo $contract['pre_oreder_date']; ?>;
// const installfill1 = "<?php echo $contract_maintance['test_time']; ?>"; // const installfill1 = "<?php echo $contract_maintance['test_time']; ?>";
// const installfill2 = "<?php echo $contract_maintance['freedeadline']; ?>"; // const installfill2 = "<?php echo $contract_maintance['freedeadline']; ?>";
// const buyArr = [...<?php echo json_encode($buyArr); ?>]; const buyArr = [...<?php echo json_encode($buyArr); ?>];
// const installArr = [...<?php echo json_encode($installArr); ?>]; const installArr = [...<?php echo json_encode($installArr); ?>];
let install_pay_text = '付款方式:<br> '; let install_pay_text = '付款方式:<br> ';
let buy_pay_text = '' let buy_pay_text = ''
const chineseArr = ['零', '一', '二', '三', '四', '五', '六', '七'] const chineseArr = ['零', '一', '二', '三', '四', '五', '六', '七']

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

@ -6,6 +6,8 @@ const contractDownload = () => {
this.buystandarData = this.deepClone(this.buydata); this.buystandarData = this.deepClone(this.buydata);
this.buyonstandardViewData = this.deepClone(this.buydata); this.buyonstandardViewData = this.deepClone(this.buydata);
}, },
buyfill1: buyfill1,
css: `table { background - color: #fff; border: none; margin - top: 30px; font - family: '標楷體'; width: 600px; } table tr: nth - child(even), table tr: nth - child(odd) { background - color: #fff; } table tr { font - size: 12pt; width: 100 %; } table tr h2 { font - size: 18pt; } table tr td { width: 100 %; height: 100 %; line - height: 2; display: flex; } table tr td.center { display: flex; justify - content: center; align - items: center; } table tr td.list { width: 100 %; height: 100 %; white - space: nowrap; display: flex; } table tr td.list span { width: 60px; min - height: 100 %; display: block; } table tr td.list > p { display: block; text - align: justify; } table tr td.list div { max - width: calc(100 % - 60px); white - space: normal; } table tr td.list div.text - justify { display: flex; width: 100 %; justify - content: space - between; } table tr.date td > div { width: 100 %; text - align: right; } table tr.date td > div.text - justify { display: flex; justify - content: space - between; } table td, table th { padding: 8px; }`, css: `table { background - color: #fff; border: none; margin - top: 30px; font - family: '標楷體'; width: 600px; } table tr: nth - child(even), table tr: nth - child(odd) { background - color: #fff; } table tr { font - size: 12pt; width: 100 %; } table tr h2 { font - size: 18pt; } table tr td { width: 100 %; height: 100 %; line - height: 2; display: flex; } table tr td.center { display: flex; justify - content: center; align - items: center; } table tr td.list { width: 100 %; height: 100 %; white - space: nowrap; display: flex; } table tr td.list span { width: 60px; min - height: 100 %; display: block; } table tr td.list > p { display: block; text - align: justify; } table tr td.list div { max - width: calc(100 % - 60px); white - space: normal; } table tr td.list div.text - justify { display: flex; width: 100 %; justify - content: space - between; } table tr.date td > div { width: 100 %; text - align: right; } table tr.date td > div.text - justify { display: flex; justify - content: space - between; } table td, table th { padding: 8px; }`,
data: { data: {
illustrate: { illustrate: {
@ -45,6 +47,22 @@ const contractDownload = () => {
] ]
} }
}, },
deepClone: function (obj) {
let clone = Array.isArray(obj) ? [] : {};
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === 'object' && obj[key] !== null) {
clone[key] = this.deepClone(obj[key]);
if (clone[key].text != undefined) {
} else {
clone[key] = obj[key];
}
}
}
}
return clone;
},
buydata: { buydata: {
}, },
@ -129,7 +147,22 @@ const contractDownload = () => {
return; return;
} }
},
isBuyShow: true,
sendBuyInputFn() {
if (this.buyfilt1 == '') {
alert('請輸入交貨期限');
return;
}
if (this.buyfilt1 < 1) {
alert('交貨日期不得低於1日');
return;
}
if (buyArr[1].installment == 2) {
} }
},
isBuyInputIng: true,
} }
}; };
@ -295,7 +328,7 @@ const contractRepair = () => {
nextStepFn() { nextStepFn() {
if (this.data.contractno == '') return alert('合約號為必填') if (this.data.repair_no == '') return alert('合約號為必填')
this.isLoading = true this.isLoading = true
if (this.step == 1) { if (this.step == 1) {
this.getContractDate(); this.getContractDate();
@ -470,7 +503,7 @@ const contractInput = () => {
fail_arr: [], fail_arr: [],
nextStepFn() { nextStepFn() {
if (this.step == 1) { if (this.step == 1) {
if (this.data.repair_no == '') return alert('請輸入合約號'); if (this.data.contractno == '') return alert('請輸入合約號');
this.isLoading = true this.isLoading = true
this.getContractDate(); this.getContractDate();
} else if (this.step == 2) { } else if (this.step == 2) {

237
wms/contract/api/postContractData.php

@ -1,8 +1,10 @@
<?php <?php
require_once("../conn.php"); require_once("../conn.php");
// require_once("../connt8.php");
include_once("./getFacilityNo.php"); include_once("./getFacilityNo.php");
include_once("./getComboNo.php"); include_once("./getComboNo.php");
include_once("./upload_chk.php"); include_once("./upload_chk.php");
ini_set('date.timezone', 'Asia/Taipei'); ini_set('date.timezone', 'Asia/Taipei');
//保養簽回 //保養簽回
if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'b') { if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['contracttype']) && $_POST['contracttype'] == 'b') {
@ -32,6 +34,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$num = !empty($_POST['num']) ? $_POST['num'] : null; $num = !empty($_POST['num']) ? $_POST['num'] : null;
$files = !empty($_FILES['files']) ? $_FILES['files'] : null; $files = !empty($_FILES['files']) ? $_FILES['files'] : null;
$elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : []; $elevators = !empty($_POST['elevators']) ? json_decode($_POST['elevators'], true) : [];
$payType = !empty($_POST['payType']) ? $_POST['payType'] : null;
// validate // validate
$fail_arr = []; $fail_arr = [];
if ($contractno === '') return $fail_arr[] = '合約號為必填'; if ($contractno === '') return $fail_arr[] = '合約號為必填';
@ -54,6 +57,7 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
if ($partyAphone == '') $fail_arr[] = '業務聯繫人電話為必填'; if ($partyAphone == '') $fail_arr[] = '業務聯繫人電話為必填';
if ($partyAemail == '') $fail_arr[] = '業務聯繫人Email為必填'; if ($partyAemail == '') $fail_arr[] = '業務聯繫人Email為必填';
if ($num == '') $fail_arr[] = '電梯數量為必填'; if ($num == '') $fail_arr[] = '電梯數量為必填';
if ($payType == '') $fail_arr[] = '付款方式為必填';
if (count($fail_arr) > 0) { if (count($fail_arr) > 0) {
header("HTTP/1.1 422 Unprocessable Entity"); header("HTTP/1.1 422 Unprocessable Entity");
echo json_encode($fail_arr); echo json_encode($fail_arr);
@ -137,7 +141,14 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$facility_arr[] = $dailyNecessities[$elevator['spec']]; $facility_arr[] = $dailyNecessities[$elevator['spec']];
} }
echo json_encode($facility_arr); echo json_encode($facility_arr);
// 電梯做番號
$facilityno = $createFacilityNo->makeBFacilityNo("T", $facility_arr, (int)$num); $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 json_encode($facilityno);
echo '-------'; echo '-------';
$sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid"; $sql_str = "SELECT accountid, name FROM account WHERE accountid = :accountid";
@ -274,8 +285,8 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
} else { } else {
$files = null; $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, 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, 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, :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)";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(":contract_no", $contractno); $stmt->bindParam(":contract_no", $contractno);
$stmt->bindParam(":contract_type", $contract_type); $stmt->bindParam(":contract_type", $contract_type);
@ -301,9 +312,23 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
$stmt->bindParam(":max_bonus", $max_bonus); $stmt->bindParam(":max_bonus", $max_bonus);
$stmt->bindParam(":created_at", $created_at); $stmt->bindParam(":created_at", $created_at);
$stmt->bindParam(":created_by", $user_id); $stmt->bindParam(":created_by", $user_id);
$stmt->bindParam(':payType', $payType);
$stmt->execute(); $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);
header('Content-Type: application/json'); header('Content-Type: application/json');
$jsonData = json_encode($files); $jsonData = json_encode($files);
@ -314,4 +339,212 @@ if (isset($_POST["contractno"]) && $_POST["contractno"] != "" && isset($_POST['c
echo $e->getMessage(); echo $e->getMessage();
die('Error!:' . $e->getMessage()); die('Error!:' . $e->getMessage());
} }
};
function T8insert($data, $facilityno)
{
require_once("../connt8.php");
// include "../../T8_Authorization.php";
$contractno = !empty($data['contractno']) ? $data['contractno'] : null; // 合約號
$address = !empty($data['address']) ? $data['address'] : null; // 客戶地址
$customer = !empty($data['customer']) ? $data['customer'] : null; //企業名稱
$phone = !empty($data['phone']) ? $data['phone'] : null; //客戶電話
$vat = !empty($data['vat']) ? $data['vat'] : null; //統編
$email = !empty($data['email']) ? $data['email'] : null;
$salesman = !empty($data['salesman']) ? $data['salesman'] : null; // 銷售人員
$partyA = !empty($data['partyA']) ? $data['partyA'] : null; //客戶名稱 / 業務聯絡人
$partyAaddress = !empty($data['partyAaddress']) ? $data['partyAaddress'] : null; // 業務聯絡人地址
$contract_begin_date = !empty($data['contract_begin_date']) ? $data['contract_begin_date'] : null;
$contract_end_date = !empty($data['contract_end_date']) ? $data['contract_end_date'] : null;
$num = !empty($data['num']) ? $data['num'] : null; // 電梯數量
$elevators = !empty($data['elevators']) ? json_decode($data['elevators'], true) : []; //電梯
$area = !empty($data['area']) ? $data['area'] : null; //縣市 Ex. A->台北 , B-> ..。
$user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
$connT8->beginTransaction();
$sql = "SELECT * FROM comCustomer WHERE BizPartnerId = :BizPartnerId";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':BizPartnerId', $contractno);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$date = date('Y-m-sH-s-i');
$createTime = str_replace("-", '', $date);
$beginDate = str_replace("-", '', $contract_begin_date);
$endDate = str_replace("-", '', $contract_end_date);
if ($contractno == '') {
echo 'Error';
exit;
}
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)
VALUES('1000','10','TWD',: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();
} 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();
}
// echo '<pre>';
// print_r($elevators['maintainance']);
// echo '</pre>';
foreach ($elevators as $index => $elevator) {
$type[] = $elevator['maintainance'];
if ($type[$index] == 'A') {
$type = 'C3';
} else if ($type[$index] == 'B') {
$type = 'C4';
} else if ($type[$index] == 'C') {
$type = 'C5';
}
}
// echo '<pre>';
// print_r($type);
// echo '</pre>';
// //新增於 comProject。合約 table
$sql = "INSERT INTO comProject(ProjectId,ProjectName,TypeId,ValidityFromDate,ValidityToDate,CreateTime,CreatorId,IsInUsed)
VALUES(:ProjectId,:ProjectName,:TypeId,:ValidityFromDate,:ValidityToDate,:CreateTime,:CreatorId,1)";
$stmt = $connT8->prepare($sql);
$stmt->bindParam(':ProjectId', $contractno);
$stmt->bindParam(':ProjectName', $customer);
$stmt->bindParam(':TypeId', $type);
$stmt->bindParam(':ValidityFromDate', $beginDate);
$stmt->bindParam(':ValidityToDate', $endDate);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->execute();
// // 新增電梯數
foreach ($elevators as $index => $elevator) {
// echo '<pre>';
// print_r($elevator);
// echo '</pre>';
$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(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
$sql = "INSERT INTO comMaterialGroup
(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(':MaterialName', $customer);
$stmt->bindParam(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
$sql = "INSERT INTO comMaterialPurchases
(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(':CreatorId', $user_id);
$stmt->bindParam(':CreateTime', $createTime);
$stmt->execute();
}
?>
<!-- <script src="./js/axios/axios.min.js"></script>
<script>
const form = new FormData();
form.append('BillNo', <?php echo $contractno ?>);
form.append('BillDate', );
form.append('');
form.append('');
form.append('');
form.append('');
form.append('');
axios.post('https://127.0.0.1:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData', form).then(res => {
console.log(res.status);
if (res.status == 200) {
alert('成功');
}
}).catch(err => {
console.log(err);
let code = err.response.data;
if (code == 422) {
console.log(err);
}
if (code == 500) {
alert('儲存失敗!可能為下載錯誤:\n' + error.response.data);
}
})
</script> -->
<?php
$connT8->commit();
} }

48
wms/contract/api/postContractNewApplyData.php

@ -9,7 +9,7 @@ if ($_SERVER['REQUEST_METHOD'] != 'POST') {
exit(); exit();
} }
//暫存、送審 //暫存、送審
if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0 || $_POST['status'] == 1)) { if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 0 || $_POST['status'] == 1) && $_POST['progress'] <= 1) {
if ($_POST['regulations'] < 10) { if ($_POST['regulations'] < 10) {
header("HTTP/1.1 500 傳送失敗!!試車時間不得低於10天"); header("HTTP/1.1 500 傳送失敗!!試車時間不得低於10天");
exit; exit;
@ -31,12 +31,14 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$contact_address = $_POST['address']; $contact_address = $_POST['address'];
$workdeadline_a = $_POST['workdeadline_a']; $workdeadline_a = $_POST['workdeadline_a'];
$workdeadline_b = $_POST['workdeadline_b']; $workdeadline_b = $_POST['workdeadline_b'];
$workdeadline_note = $_POST['workdeadline_note'];
$test_time = $_POST['regulations']; $test_time = $_POST['regulations'];
$freedeadline = $_POST['freedeadline']; $freedeadline = $_POST['freedeadline'];
$trade_address = $_POST['tradeaddress']; $trade_address = $_POST['tradeaddress'];
$tradedeadline = $_POST['tradedeadline']; $tradedeadline = $_POST['tradedeadline'];
$secondPayDeadline = $_POST['secondPayDeadline']; $secondPayDeadline = $_POST['secondPayDeadline'];
$pays = $_POST['pays']; $pays = $_POST['pays'];
$description = $_POST['description'];
$status = $_POST['status']; // 0:暫存 1:送審 2:退回 3:完成 $status = $_POST['status']; // 0:暫存 1:送審 2:退回 3:完成
$pays = json_decode($pays, true); $pays = json_decode($pays, true);
@ -55,7 +57,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$conn->beginTransaction(); $conn->beginTransaction();
try { try {
if ($isFirst == 1) { if ($isFirst == 1) {
$sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, total_items, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, secondPayDeadline, progress, status, person, personname, submit_date, created_at, created_by) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :total_items, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :secondPayDeadline, :progress, :status, :person, :personname, :submit_date, :created_at, :created_by)"; $sql_str = "INSERT INTO contract_new_apply (mid, contractno, sales_man, apply_date, apply_type, case_name, customer, manager, vat, total_price, total_items, buy_fee, install_fee, contact_address, workdeadline_a, workdeadline_b, test_time, freedeadline, trade_address, tradedeadline, secondPayDeadline, progress, status, person, personname, submit_date, created_at, created_by, description) VALUES (:mid, :contractno, :sales_man, :apply_date, :apply_type, :case_name, :customer, :manager, :vat, :total_price, :total_items, :buy_fee, :install_fee, :contact_address, :workdeadline_a, :workdeadline_b, :test_time, :freedeadline, :trade_address, :tradedeadline, :secondPayDeadline, :progress, :status, :person, :personname, :submit_date, :created_at, :created_by, :description)";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $mid); $stmt->bindParam(':mid', $mid);
$stmt->bindParam(':contractno', $vol_no); $stmt->bindParam(':contractno', $vol_no);
@ -85,6 +87,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$stmt->bindParam(':submit_date', $submit_date); $stmt->bindParam(':submit_date', $submit_date);
$stmt->bindParam(':created_at', $created_at); $stmt->bindParam(':created_at', $created_at);
$stmt->bindParam(':created_by', $created_by); $stmt->bindParam(':created_by', $created_by);
$stmt->bindParam(':description', $description);
$stmt->execute(); $stmt->execute();
$contract_apply_id = $conn->lastInsertId(); $contract_apply_id = $conn->lastInsertId();
foreach ($pays as $idx => $pay) { foreach ($pays as $idx => $pay) {
@ -160,7 +163,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
header("HTTP/1.1 201 success!"); header("HTTP/1.1 201 success!");
$conn->commit(); $conn->commit();
} else { } else {
$sql_str = "UPDATE contract_new_apply SET status = :status, apply_date=:apply_date, apply_type=:apply_type, case_name=:case_name, customer=:customer, manager=:manager, vat=:vat, total_price=:total_price, total_items=:total_items, buy_fee=:buy_fee, install_fee=:install_fee, contact_address=:contact_address, trade_address=:trade_address, workdeadline_a=:workdeadline_a, workdeadline_b=:workdeadline_b, test_time=:test_time, freedeadline=:freedeadline, trade_address=:trade_address, trade_address=:trade_address, tradedeadline=:tradedeadline, secondPayDeadline=:secondPayDeadline, progress=:progress, person=:person, personname=:personname, submit_date=:submit_date, updated_at=:updated_at, updated_by=:updated_by WHERE mid = :mid"; $sql_str = "UPDATE contract_new_apply SET status = :status, apply_date=:apply_date, apply_type=:apply_type, case_name=:case_name, customer=:customer, manager=:manager, vat=:vat, total_price=:total_price, total_items=:total_items, buy_fee=:buy_fee, install_fee=:install_fee, contact_address=:contact_address, trade_address=:trade_address, workdeadline_a=:workdeadline_a, workdeadline_b=:workdeadline_b, workdeadline_note=:workdeadline_note, test_time=:test_time, freedeadline=:freedeadline, trade_address=:trade_address, trade_address=:trade_address, tradedeadline=:tradedeadline, secondPayDeadline=:secondPayDeadline, progress=:progress, person=:person, personname=:personname, submit_date=:submit_date, updated_at=:updated_at, updated_by=:updated_by, description=:description WHERE mid = :mid";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $mid); $stmt->bindParam(':mid', $mid);
$stmt->bindParam(':status', $status); $stmt->bindParam(':status', $status);
@ -177,6 +180,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$stmt->bindParam(':contact_address', $contact_address); $stmt->bindParam(':contact_address', $contact_address);
$stmt->bindParam(':workdeadline_a', $workdeadline_a); $stmt->bindParam(':workdeadline_a', $workdeadline_a);
$stmt->bindParam(':workdeadline_b', $workdeadline_b); $stmt->bindParam(':workdeadline_b', $workdeadline_b);
$stmt->bindParam(':workdeadline_note', $workdeadline_note);
$stmt->bindParam(':test_time', $test_time); $stmt->bindParam(':test_time', $test_time);
$stmt->bindParam(':freedeadline', $freedeadline); $stmt->bindParam(':freedeadline', $freedeadline);
$stmt->bindParam(':trade_address', $trade_address); $stmt->bindParam(':trade_address', $trade_address);
@ -188,6 +192,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$stmt->bindParam(':submit_date', $submit_date); $stmt->bindParam(':submit_date', $submit_date);
$stmt->bindParam(':updated_at', $updated_at); $stmt->bindParam(':updated_at', $updated_at);
$stmt->bindParam(':updated_by', $updated_by); $stmt->bindParam(':updated_by', $updated_by);
$stmt->bindParam(':description', $description);
$stmt->execute(); $stmt->execute();
foreach ($pays as $idx => $pay) { foreach ($pays as $idx => $pay) {
@ -205,7 +210,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$stmt->execute(); $stmt->execute();
} }
$deleted_at = date("Y-m-d H:i:s"); $deleted_at = date("Y-m-d H:i:s");
$removefiles = json_decode($_POST['removefiles'], true); $removefiles = isset($_POST['removefiles']) ? json_decode($_POST['removefiles'], true) : [];
print_r($removefiles); print_r($removefiles);
if(count($removefiles) > 0){ if(count($removefiles) > 0){
foreach($removefiles as $file){ foreach($removefiles as $file){
@ -216,10 +221,6 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$stmt ->execute(); $stmt ->execute();
} }
} }
header("HTTP/1.1 201 success!"); header("HTTP/1.1 201 success!");
$conn->commit(); $conn->commit();
} }
@ -230,6 +231,35 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
die('Error!:' . $e->getMessage()); die('Error!:' . $e->getMessage());
} }
} }
//業務部承辦人同意
if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 1) && $_POST['progress'] == 2) {
$status = $_POST['status'];
$vol_no = $_POST['vol_no'];
$contract_new_apply_id = $_POST['contract_new_apply_id'];
$progress = $_POST['progress'];
$review_comment = $_POST['review_comment'];
$user_id = $_POST['review_person_id'];
$review_date = date('Y-m-d H:i:s');
$conn->beginTransaction();
try {
$sql_str = "UPDATE contract_new_apply SET status = :status, progress = :progress, review_comment=:review_comment, review_person_id=:review_person_id, review_date=:review_date WHERE id = :contract_new_apply_id";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':status', $status);
$stmt->bindParam(':progress', $progress);
$stmt->bindParam(':contract_new_apply_id', $contract_new_apply_id);
$stmt->bindParam(':review_comment', $review_comment);
$stmt->bindParam(':review_person_id', $user_id);
$stmt->bindParam(':review_date', $review_date);
$stmt->execute();
header("HTTP/1.1 200 success!");
$conn->commit();
} catch (PDOException $e) {
$conn->rollback();
header("HTTP/1.1 500 failed!");
echo $e->getMessage();
die('Error!:' . $e->getMessage());
}
}
//結案同意 //結案同意
if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 3)) { if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] == 3)) {
$status = $_POST['status']; $status = $_POST['status'];
@ -241,7 +271,7 @@ if (isset($_POST['vol_no']) && !empty($_POST['vol_no']) && ($_POST['status'] ==
$review_date = date('Y-m-d H:i:s'); $review_date = date('Y-m-d H:i:s');
$conn->beginTransaction(); $conn->beginTransaction();
try { try {
$sql_str = "UPDATE contract_new_apply SET status = :status, progress = :progress, review_comment=:review_comment, review_person_id=:review_person_id, review_date=:review_date WHERE id = :contract_new_apply_id"; $sql_str = "UPDATE contract_new_apply SET status = :status, progress = :progress, review_final_comment=:review_comment, review_final_person_id=:review_person_id, review_final_date=:review_date WHERE id = :contract_new_apply_id";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':status', $status); $stmt->bindParam(':status', $status);
$stmt->bindParam(':progress', $progress); $stmt->bindParam(':progress', $progress);

77
wms/contract/api/testT8API.php

@ -0,0 +1,77 @@
<?php
$now = gmdate("YmdHis");
$data = 'M0000.' . $now;
$sign = hash_hmac('SHA256', $data, 'B2D6395D2883E26C', false);
?>
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<script>
var body = [{
"name": "salIncomeApplyMaster",
"rows": [{
"BillNo": "Z001",
"BillDate": 20160811,
"OrgId": "1000",
"FOrgId": "1000",
"TypeId": "RR",
"BpOrgId": "1000",
"BizPartnerId": "C002",
"CurrId": "RMB",
"CurrOAmount": 1,
"CurrLAmount": 1,
"PersonId": "T001",
"DtOrgId": "1000",
"DueToId": "C002",
"TaxId": "123",
"CompId": "1000"
}]
},
{
"name": "salIncomeApplyDetail",
"rows": [{
"BillNo": "Z001",
"IncomeId": "F203",
"TaxId": "ST003",
"RowCode": 1,
"ItemType": "1",
"SPrice": 50,
"SQuantity": 1,
"FromSourceTag": 0,
"FromBillNo": "123"
}]
}
]
var json = JSON.stringify(body);
console.log(json);
// obj = {
// type: 'POST',
// // url: `${corsurl}${apiurl}`,
// url: `${apiurl}`,
// dataType: 'json',
// headers: headerParam,
// data: json,
// // dataType: "json",
// success: function(res) {
// console.log(res.Status);
// console.log(res.ErrorMsg);
// console.log(res.Data);
// }
// };
// jQuery.ajax(obj);
// // }
// })
$.ajax({
url: 'https://127.0.0.1:780/twWebAPI/V1/SALINCOMEAPPLY/PostERPData',
method: 'POST',
dataType: 'json',
// headers: headerParam,
data: body,
success: function(res) {
console.log('Success');
},
error: function(err) {
console.log(err);
}
})
</script>

3
wms/contract/conn.php

@ -34,8 +34,7 @@ try{
//設定主動以警告的形式報錯 //設定主動以警告的形式報錯
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//如果連接錯誤,將抛出一個PDOException異常對象 //如果連接錯誤,將抛出一個PDOException異常對象
} } catch (PDOException $e) {
catch ( PDOException $e ){
//如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作 //如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作
die("ERROR!!!: " . $e->getMessage()); die("ERROR!!!: " . $e->getMessage());
} }

15
wms/contract/connt8.php

@ -0,0 +1,15 @@
<?php
require_once dirname(__FILE__) . "/../../mkt/database.php";
include "/Users/LO_2342/Desktop/httpdocs/wms/fun_global.php";
// phpinfo();
// exit();
try {
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8TEST", "M0225", "IFFBU1E=");
if ($connT8) {
$connT8->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
} catch (PDOException $e) {
// echo "fail";
// echo $e->getMessage();
die("ERROR!!!: " . $e->getMessage());
}

39
wms/contract/contract-input.php

@ -109,8 +109,11 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
</select> </select>
<p class="alerttext" x-show="data.mtype==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.mtype==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td></td> <td style="vertical-align: middle">契約成交價</td>
<td></td> <td>
<input class="form-control disabled_select" type="text" name="tel" x-model="data.total_price" :disabled="data.disabled">
<p class="alerttext" x-show="data.total_price==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td>
</tr> </tr>
<tr> <tr>
<td style="vertical-align: middle">客戶電話</td> <td style="vertical-align: middle">客戶電話</td>
@ -181,14 +184,30 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<input type="text" x-model="data.address" /> <input type="text" x-model="data.address" />
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle">附件</td> <td style="vertical-align: middle">分期方式</td>
<td colspan="2"> <td colspan="2">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" /> <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> </td>
</tr> </tr>
<tr> <tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="vertical-align: middle">附件</td>
<td colspan="2">
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
</td>
</tr> </tr>
</tbody> </tbody>
</template> </template>
@ -196,7 +215,9 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<template x-for="(elevator, idx) in data.elevators" :key="elevator.apply_key + elevator.register_code"> <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==3"> <tbody style="font-weight: bolder;margin-bottom: 20px" x-show="step==3">
<tr> <tr>
<td colspan=8><p x-text="'電梯' + Number(idx+1)"></p></td> <td colspan=8>
<p x-text="'電梯' + Number(idx+1)"></p>
</td>
</tr> </tr>
<tr> <tr>
<td style="vertical-align: middle">機種</td> <td style="vertical-align: middle">機種</td>
@ -300,14 +321,16 @@ $contractpersons = $stmt->fetchAll(PDO::FETCH_ASSOC);
<p class="alerttext" x-show="data.elevators[idx].useful_date=='' || !data.elevators[idx].useful_date"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <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>
</tr> </tr>
<tr><td></td> <tr>
<td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td></tr> <td></td>
</tr>
</tbody> </tbody>
</template> </template>
</template> </template>

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

@ -9,9 +9,10 @@ if(!(isset($_GET['id']) && !empty($_GET['id']))){
} }
$id = $_GET["id"]; $id = $_GET["id"];
$sql_str = "SELECT contract_new_apply.*, account.name as review_person_name $sql_str = "SELECT contract_new_apply.*, person_account.name AS review_person_name, person_final_account.name AS review_final_person_name
FROM contract_new_apply FROM contract_new_apply
LEFT JOIN account ON contract_new_apply.review_person_id = account.accountid LEFT JOIN account AS person_account ON contract_new_apply.review_person_id = person_account.accountid
LEFT JOIN account AS person_final_account ON contract_new_apply.review_final_person_id = person_final_account.accountid
WHERE contract_new_apply.mid = :mid"; WHERE contract_new_apply.mid = :mid";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid',$id); $stmt->bindParam(':mid',$id);
@ -101,6 +102,7 @@ if(empty($contract_new_apply)){
} }
$secondPayDeadline = $contract['secondPayDeadline'] ?? 0; $secondPayDeadline = $contract['secondPayDeadline'] ?? 0;
$status = isset($contract['status']) ? $contract['status'] : -1; $status = isset($contract['status']) ? $contract['status'] : -1;
$progress = isset($contract['progress']) ? $contract['progress'] : 0;
$person = $contract['person']; $person = $contract['person'];
?> ?>
@ -138,14 +140,14 @@ $person = $contract['person'];
<!-- <input class="form-control disabled_select" type="text" x-model="data.vol_no" > --> <!-- <input class="form-control disabled_select" type="text" x-model="data.vol_no" > -->
<!-- <p class="alerttext" x-show="data.vol_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> --> <!-- <p class="alerttext" x-show="data.vol_no==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> -->
</td> </td>
<td style="vertical-align: middle">統一編號</td> <td style="vertical-align: middle">統一編號/身分證字號</td>
<td> <td>
<input class="form-control disabled_select" type="text" x-model="data.vat" > <input class="form-control disabled_select" type="text" x-model="data.vat" disabled >
<p class="alerttext" x-show="data.vat==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.vat==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle">合約書申請日期</td> <td style="vertical-align: middle">合約書申請日期</td>
<td> <td>
<input class="form-control disabled_select" type="date" x-model="data.apply_date" > <input class="form-control disabled_select" type="date" x-model="data.apply_date" disabled>
<p class="alerttext" x-show="data.apply_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.apply_date==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle">申請類別</td> <td style="vertical-align: middle">申請類別</td>
@ -159,17 +161,17 @@ $person = $contract['person'];
<tr> <tr>
<td style="vertical-align: middle">案件名稱</td> <td style="vertical-align: middle">案件名稱</td>
<td style="vertical-align: middle" colspan="3"> <td style="vertical-align: middle" colspan="3">
<input class="form-control disabled_select" type="text" x-model="data.case_name" > <input class="form-control disabled_select" type="text" x-model="data.case_name" disabled >
<p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.case_name==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle">立約人</td> <td style="vertical-align: middle">立約人</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<input class="form-control disabled_select" type="text" x-model="data.company" > <input class="form-control disabled_select" type="text" x-model="data.company" disabled>
<p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.company==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle">負責人</td> <td style="vertical-align: middle">負責人</td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<input class="form-control disabled_select" type="text" x-model="data.manager" > <input class="form-control disabled_select" type="text" x-model="data.manager" disabled >
<p class="alerttext" x-show="data.manager==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.manager==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
</tr> </tr>
@ -193,30 +195,23 @@ $person = $contract['person'];
<tr> <tr>
<td style="vertical-align: middle">聯絡地址</td> <td style="vertical-align: middle">聯絡地址</td>
<td style="vertical-align: middle" colspan=3> <td style="vertical-align: middle" colspan=3>
<input class="form-control disabled_select" type="text" x-model="data.address" > <input class="form-control disabled_select" type="text" x-model="data.address" disabled>
<p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.address==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle">完工期限</td> <td style="vertical-align: middle">免保期限</td>
<td style="vertical-align: middle" colspan=3> <td style="vertical-align: middle" colspan=3>
<div class="ui labeled input"> <div class="ui labeled input">
<input type="text" placeholder="18" style="width:45px;padding:0 12px;" x-model="data.freedeadline">
<div class="ui label"> <div class="ui label">
貨抵工地 個月
</div>
<input type="text" placeholder="30" style="width:45px;padding:0 12px;" x-model="data.workdeadline_a">
<div class="ui label">
天內安裝完成,甲方應於貨底工地前
</div>
<input type="text" placeholder="7" style="width:45px;padding:0 12px;" x-model="data.workdeadline_b">
<div class="ui label">
天完成並整理完善。
</div> </div>
</div> </div>
<!-- <input class="form-control disabled_select" type="text" x-model="data.deadline" > --> <p class="alerttext" x-show="data.freedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
<p class="alerttext" x-show="data.deadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="vertical-align: middle">附則</td> <!-- <td style="vertical-align: middle">附則</td>
<td style="vertical-align: middle" colspan=3> <td style="vertical-align: middle" colspan=3>
<div class="ui labeled input"> <div class="ui labeled input">
<div class="ui label"> <div class="ui label">
@ -228,16 +223,21 @@ $person = $contract['person'];
</div> </div>
</div> </div>
<p class="alerttext" x-show="data.regulations==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.regulations==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td> -->
<td style="vertical-align: middle">免保期限</td> <td style="vertical-align: middle">完工期限</td>
<td style="vertical-align: middle" colspan=3> <td style="vertical-align: middle" colspan=7>
<div class="ui labeled input"> <div class="ui labeled input">
<input type="text" placeholder="18" style="width:45px;padding:0 12px;" x-model="data.freedeadline">
<div class="ui label"> <div class="ui label">
個月 乙方應於貨抵工地後每台
</div> </div>
<input type="text" placeholder="30" style="width:45px;padding:0 12px;" x-model="data.workdeadline_a">
<div class="ui label">
日內安裝完成
</div> </div>
<p class="alerttext" x-show="data.freedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <div class="note label" x-show="data.workdeadline_note && data.workdeadline_note != 'null'" style="font-size:14px;color:#BD0606" x-text="'說明:' + data.workdeadline_note"></div>
</div>
<!-- <input class="form-control disabled_select" type="text" x-model="data.deadline" > -->
<p class="alerttext" x-show="data.deadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
</tr> </tr>
@ -253,7 +253,7 @@ $person = $contract['person'];
<div class="ui label"> <div class="ui label">
圖色確認第 圖色確認第
</div> </div>
<input type="text" placeholder="90" style="width:45px;padding:0 12px;" x-model="data.tradedeadline"> <input type="text" placeholder="180" style="width:60px;padding:0 12px;" x-model="data.tradedeadline">
<div class="ui label"> <div class="ui label">
天出貨 天出貨
</div> </div>
@ -286,15 +286,14 @@ $person = $contract['person'];
<td style="vertical-align: middle"><p x-text="idx+1"></p></td> <td style="vertical-align: middle"><p x-text="idx+1"></p></td>
<td colspan="3" style="vertical-align: middle"> <td colspan="3" style="vertical-align: middle">
<input class="form-control disabled_select lock" type="text" x-model="item.item_spec" > <input class="form-control disabled_select lock" type="text" x-model="item.item_spec" >
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.item_spec==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td style="vertical-align: middle"> <td style="vertical-align: middle">
<span x-text="item.item_qty + '台'" style="padding:0 20px"></span> <span x-text="item.item_qty + '台'" style="padding:0 20px"></span>
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
<td colspan="3" style="vertical-align: middle"> <td colspan="3" style="vertical-align: middle">
<input class="form-control disabled_select lock" type="number" x-model="item.item_price_ct" > <input class="form-control disabled_select lock" type="number" x-model="item.item_price_ct" >
<p class="alerttext" x-show="data.tradedeadline==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p> <p class="alerttext" x-show="data.item_price_ct==''"><i class="fa-solid fa-circle-xmark"></i>未填寫</p>
</td> </td>
</tr> </tr>
</template> </template>
@ -407,7 +406,7 @@ $person = $contract['person'];
</td> </td>
<td> <td>
<div class="ui labeled input"> <div class="ui labeled input">
<input type="number" placeholder="90" style="width:65px;padding:0 12px;" x-model="pays[<?php echo $pay['pay_kind'];?>].condition_date"> <input type="number" placeholder="90" style="width:65px;padding:0 12px;" x-model="pays[<?php echo $pay['pay_kind'];?>].condition_date" disabled >
<div class="ui label"> <div class="ui label">
</div> </div>
@ -415,7 +414,7 @@ $person = $contract['person'];
</td> </td>
<td> <td>
<div class="ui labeled input"> <div class="ui labeled input">
<input type="number" placeholder="90" style="width:65px;padding:0 12px;" x-model="pays[<?php echo $pay['pay_kind'];?>].pay_period" > <input type="number" placeholder="90" style="width:65px;padding:0 12px;" x-model="pays[<?php echo $pay['pay_kind'];?>].pay_period" disabled >
<div class="ui label"> <div class="ui label">
</div> </div>
@ -448,13 +447,17 @@ $person = $contract['person'];
<thead style="font-weight: bolder;margin-bottom: 20px;"> <thead style="font-weight: bolder;margin-bottom: 20px;">
<tr> <tr>
<td colspan=8> <td colspan=8>
<h4 style='text-align:center;font-weight: bolder'>附件上傳</h4> <h4 style='text-align:center;font-weight: bolder'>其他</h4>
</td> </td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td colspan="4">附件上傳</td> <td colspan="1">說明</td>
<td colspan="2">
<textarea name="description" x-model="data.description"></textarea>
</td>
<td colspan="1">附件上傳</td>
<td colspan="4"> <td colspan="4">
<?php if($status < 1): ?> <?php if($status < 1): ?>
<input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" /> <input type="file" name="file[]" multiple draggable="true" @change="uploadFiles($event)" />
@ -463,7 +466,9 @@ $person = $contract['person'];
<template x-if="file"> <template x-if="file">
<div> <div>
<a :href="'./images/contracts_new_files/' + file.file_name" download x-text="file.file_name" ></a> <a :href="'./images/contracts_new_files/' + file.file_name" download x-text="file.file_name" ></a>
<?php if($status <= 0): ?>
<span @click="removeFile(file.id)" style="margin-left:10px;cursor:pointer;color:#f019">X</span> <span @click="removeFile(file.id)" style="margin-left:10px;cursor:pointer;color:#f019">X</span>
<?php endif; ?>
</div> </div>
</template> </template>
</template> </template>
@ -487,7 +492,7 @@ $person = $contract['person'];
<td>結果</td> <td>結果</td>
<td colspan=2>意見</td> <td colspan=2>意見</td>
<td>時間</td> <td>時間</td>
<td colspan=2><?php if($user_id === "M0174" && $status == 1): ?>審核意見<?php endif; ?></td> <td colspan=2><?php if(($user_id === "M0174" || $user_id === "M0107" || $user_id === "M0060") && $status == 1): ?>審核意見<?php endif; ?></td>
</tr> </tr>
<tr> <tr>
<td>營業員</td> <td>營業員</td>
@ -499,8 +504,8 @@ $person = $contract['person'];
</td> </td>
<td colspan=2>---</td> <td colspan=2>---</td>
<td><?php echo ($contract['submit_date']) ?? "---"; ?> </td> <td><?php echo ($contract['submit_date']) ?? "---"; ?> </td>
<td colspan=2 rowspan="2"> <td colspan=2 rowspan="3">
<?php if($user_id === "M0174" && $status == 1): ?> <?php if(($user_id === "M0174" || $user_id === "M0107" || $user_id === "M0060") && $status == 1): ?>
<textarea class="form-control opinion" x-model="data.review_comment"></textarea> <textarea class="form-control opinion" x-model="data.review_comment"></textarea>
<?php endif; ?> <?php endif; ?>
</td> </td>
@ -509,13 +514,24 @@ $person = $contract['person'];
<td>業務承辦人</td> <td>業務承辦人</td>
<td><span><?php echo (!isset($contract['review_person_name']) || empty($contract['review_person_name'])) ? "---" : $contract['review_person_name'] ."(".$contract['review_person_id'].")"; ?></span></td> <td><span><?php echo (!isset($contract['review_person_name']) || empty($contract['review_person_name'])) ? "---" : $contract['review_person_name'] ."(".$contract['review_person_id'].")"; ?></span></td>
<td> <td>
<?php if($status == 3): ?><span class="successtext">結案同意</span><?php endif; ?> <?php if(($status == 1 || $status == 3) && $progress >= 2): ?><span class="successtext">同意</span><?php endif; ?>
<?php if($status == 2): ?><span class="failtext">結案不同意</span><?php endif; ?> <?php if($status == 2): ?><span class="failtext">結案不同意</span><?php endif; ?>
<?php if($status < 2): ?><span>---</span><?php endif; ?> <?php if($status < 2 && $progress < 2): ?><span>---</span><?php endif; ?>
</td> </td>
<td colspan=2><?php echo $contract['review_comment'] ?? "---"; ?></td> <td colspan=2><?php echo $contract['review_comment'] ?? "---"; ?></td>
<td><?php echo $contract['review_date'] ?? "---"; ?></td> <td><?php echo $contract['review_date'] ?? "---"; ?></td>
</tr> </tr>
<tr>
<td>業務部協理</td>
<td><span><?php echo (!isset($contract['review_final_person_name']) || empty($contract['review_final_person_name'])) ? "---" : $contract['review_final_person_name'] ."(".$contract['review_final_person_id'].")"; ?></span></td>
<td>
<?php if($status == 3): ?><span class="successtext">結案同意</span><?php endif; ?>
<?php if($status == 2): ?><span class="failtext">結案不同意</span><?php endif; ?>
<?php if($status < 2): ?><span>---</span><?php endif; ?>
</td>
<td colspan=2><?php echo $contract['review_final_comment'] ?? "---"; ?></td>
<td><?php echo $contract['review_final_date'] ?? "---"; ?></td>
</tr>
<!-- <tr> <!-- <tr>
<td colspan="2" style="font-weight:bold">業務部承辦人</td> <td colspan="2" style="font-weight:bold">業務部承辦人</td>
<td colspan="2"> <td colspan="2">
@ -553,10 +569,18 @@ $person = $contract['person'];
</template> </template>
</button> </button>
<?php endif; ?> <?php endif; ?>
<?php if($status == 1 && ($user_id == "M0107" || $user_id == "M0060" || $user_id == "M0174")): ?> <?php if($status == 1 && (($user_id == "M0107" && $contract['progress'] <= 1 ) || ($user_id == "M0060" && $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"> <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"> <template x-if="!isLoading">
<span>同意(結案)</span> <span>
<?php
if($user_id === "M0107" && $contract['progress'] <= 1 ){
echo "同意(上呈)";
}elseif($user_id === "M0060" && $contract['progress'] == 2){
echo "同意(結案)";
}
?>
</span>
</template> </template>
<template x-if="isLoading"> <template x-if="isLoading">
<div class="loader"></div> <div class="loader"></div>
@ -606,13 +630,18 @@ $person = $contract['person'];
const pays = [...<?php echo json_encode($pays) ?? []; ?>]; const pays = [...<?php echo json_encode($pays) ?? []; ?>];
const secondPayDeadline = ''; const secondPayDeadline = '';
const tradeaddress = '<?php echo $contract['address'] ?? ''; ?>'; const tradeaddress = '<?php echo $contract['address'] ?? ''; ?>';
const tradedeadline = 90 const tradedeadline = 180
const freedeadline = 18; const freedeadline = 18;
const regulations = 10; const regulations = 10;
const workdeadline_a = 60; const workdeadline_a = 60;
const workdeadline_b = 7; const workdeadline_b = 7;
const workdeadline_note = '';
const total_items = <?php echo $total_items ?? ''; ?>; const total_items = <?php echo $total_items ?? ''; ?>;
const isFirst = <?php echo $isFirst; ?>; const isFirst = <?php echo $isFirst; ?>;
const originfiles = [];
const description = '';
const contractstatus = null;
const progress = 0;
</script> </script>
<?php else: ?> <?php else: ?>
<script> <script>
@ -639,13 +668,16 @@ $person = $contract['person'];
const regulations = '<?php echo $contract['test_time'] ?? ''; ?>'; const regulations = '<?php echo $contract['test_time'] ?? ''; ?>';
const workdeadline_a = '<?php echo $contract['workdeadline_a'] ?? ''; ?>'; const workdeadline_a = '<?php echo $contract['workdeadline_a'] ?? ''; ?>';
const workdeadline_b = '<?php echo $contract['workdeadline_b'] ?? ''; ?>'; const workdeadline_b = '<?php echo $contract['workdeadline_b'] ?? ''; ?>';
const workdeadline_note = '<?php echo $contract['workdeadline_note'] ?? ''; ?>';
const secondPayDeadline = <?php echo $secondPayDeadline ?? ''; ?>; const secondPayDeadline = <?php echo $secondPayDeadline ?? ''; ?>;
const total_items = <?php echo $contract['total_items'] ?? ''; ?>; const total_items = <?php echo $contract['total_items'] ?? ''; ?>;
const contract_new_apply_id = <?php echo $contract_new_apply_id; ?>; const contract_new_apply_id = <?php echo $contract_new_apply_id; ?>;
const originfiles = [...<?php echo json_encode($files); ?>]; const originfiles = [...<?php echo json_encode($files) ?? []; ?>];
const description = '<?php echo $contract['description']; ?>';
const contractstatus = <?php echo $contract['status']; ?>;
const progress = <?php echo $contract['progress']; ?>;
</script> </script>
<?php endif; ?> <?php endif; ?>
<?php if($status > 0 ||( $person != $user_id && $user_id != "M0174")): ?> <?php if($status > 0 ||( $person != $user_id && $user_id != "M0174")): ?>
<script> <script>
@ -653,12 +685,16 @@ $person = $contract['person'];
const input = document.querySelectorAll('input'); const input = document.querySelectorAll('input');
const alerttext = document.querySelectorAll('p.alerttext'); const alerttext = document.querySelectorAll('p.alerttext');
const select = document.querySelectorAll('select'); const select = document.querySelectorAll('select');
const textarea = document.querySelectorAll('textarea');
for(let i=0;i<input.length;i++){ for(let i=0;i<input.length;i++){
input[i].disabled = true input[i].disabled = true
} }
for(let i=0;i<select.length;i++){ for(let i=0;i<select.length;i++){
select[i].disabled = true select[i].disabled = true
} }
for(let i=0;i<textarea.length;i++){
textarea[i].disabled = true
}
for(let i=0;i<alerttext.length;i++){ for(let i=0;i<alerttext.length;i++){
alerttext[i].style.display = "none" alerttext[i].style.display = "none"
} }

7
wms/contract/insertData.php

@ -46,10 +46,13 @@ foreach ($sheet->getRowIterator() as $key => $row) {
$memo = $cell->getValue(); $memo = $cell->getValue();
echo $memo; echo $memo;
} elseif ($idx == 'E') { } elseif ($idx == 'E') {
$optional = '';
if ($cell->getValue() == "標配") { if ($cell->getValue() == "標配") {
$optional = 1; $optional = 1;
} else { } else if($cell->getValue() == "選配") {
$optional = 2; $optional = 2;
}else if($cell->getValue() == "加價") {
$optional = 3;
} }
echo $optional; echo $optional;
} elseif ($idx == 'F') { } elseif ($idx == 'F') {
@ -137,7 +140,7 @@ foreach ($sheet->getRowIterator() as $key => $row) {
$option_price_id = $last_id; $option_price_id = $last_id;
$option_price = $cost; $option_price = $cost;
$quotation_no = 'Q2311001'; $quotation_no = 'Q2401001';
foreach ($open_kind_arr as $kind) { foreach ($open_kind_arr as $kind) {
$min_weight = 1; $min_weight = 1;
$max_weight = 1600; $max_weight = 1600;

65
wms/contract/js/alpine.js

@ -964,6 +964,7 @@ const contractInput = () => {
num: '', //電梯數量 num: '', //電梯數量
disabled: false, //資料庫是否有電梯數量資料 disabled: false, //資料庫是否有電梯數量資料
elevators: [], //機種、載重、人乘、樓停、樓層、速度、緯度、經度、開門方式、保養別、廠牌、竣檢日、許可證日期 elevators: [], //機種、載重、人乘、樓停、樓層、速度、緯度、經度、開門方式、保養別、廠牌、竣檢日、許可證日期
payType: ''
}, },
customize: false, customize: false,
step: 1, step: 1,
@ -1020,8 +1021,11 @@ const contractInput = () => {
return return
} }
if (!this.customize) { if (!this.customize) {
console.log(res.data); for (let i = 0; i < res.data.elevators.length; i++) {
this.data.total_price = res.data.sold_price this.data.total_price = Number(res.data.elevators[i].sold_price) + Number(this.data.total_price);
console.log(this.data.total_price);
}
this.data.total_price = Number(res.data.elevators[0].maintain_months) * this.data.total_price;
this.data.salesman = res.data.salesman this.data.salesman = res.data.salesman
this.data.contract_begin_date = res.data.contract_begin_date this.data.contract_begin_date = res.data.contract_begin_date
this.data.contract_end_date = res.data.contract_end_date this.data.contract_end_date = res.data.contract_end_date
@ -1035,7 +1039,7 @@ const contractInput = () => {
let cityIndex = this.data.address.indexOf('市'); let cityIndex = this.data.address.indexOf('市');
console.log(cityIndex); console.log(cityIndex);
if (cityIndex == -1) { if (cityIndex == -1) {
cityIndex = this.data.address.indexOf('縣'); // cityIndex = this.data.address.indexOf('縣');
} }
if (cityIndex > 1) { if (cityIndex > 1) {
// 獲取''市''前面的兩個字 // 獲取''市''前面的兩個字
@ -1111,13 +1115,14 @@ const contractInput = () => {
form.append('num', this.data.num); form.append('num', this.data.num);
form.append('elevators', JSON.stringify(this.data.elevators)); form.append('elevators', JSON.stringify(this.data.elevators));
form.append('contracttype', 'b'); form.append('contracttype', 'b');
form.append('payType', this.data.payType)
// 如果有附件檔案,可以逐一加入 // 如果有附件檔案,可以逐一加入
for (var i = 0; i < this.data.files.length; i++) { for (var i = 0; i < this.data.files.length; i++) {
form.append('files[]', this.data.files[i]); form.append('files[]', this.data.files[i]);
} }
axios.post('./api/postContractData.php', form).then(res => { axios.post('./api/postContractData.php', form).then(res => {
console.log(res.status); console.log(res);
if (res.status === 200) { if (res.status === 200) {
alert('儲存成功'); alert('儲存成功');
this.step = 1 this.step = 1
@ -1144,6 +1149,7 @@ const contractInput = () => {
this.data.zip = '' this.data.zip = ''
this.data.partyAphone = '' this.data.partyAphone = ''
this.data.partyAemail = '' this.data.partyAemail = ''
this.data.payType = ''
} }
this.isLoading = false this.isLoading = false
}).catch(error => { }).catch(error => {
@ -1202,6 +1208,7 @@ const contractNewApply = () => {
address: address, address: address,
workdeadline_a: workdeadline_a, //完工期限: 幾天內安裝完成,預設30 workdeadline_a: workdeadline_a, //完工期限: 幾天內安裝完成,預設30
workdeadline_b: workdeadline_b, //完工期限: 幾天內整理完善,預設7 workdeadline_b: workdeadline_b, //完工期限: 幾天內整理完善,預設7
workdeadline_note: workdeadline_note,
regulations: regulations, //附則 regulations: regulations, //附則
freedeadline: freedeadline, //免保期限(月) freedeadline: freedeadline, //免保期限(月)
tradeaddress: tradeaddress, //交貨地點 tradeaddress: tradeaddress, //交貨地點
@ -1214,7 +1221,10 @@ const contractNewApply = () => {
files: [], files: [],
removefiles: [], removefiles: [],
originfiles: originfiles, originfiles: originfiles,
description: description,
}, },
status: contractstatus,
progress: progress,
pays: { pays: {
1: { 1: {
condition_date: 0, condition_date: 0,
@ -1267,10 +1277,7 @@ const contractNewApply = () => {
alert('試車時間不能低於10天') alert('試車時間不能低於10天')
return; return;
} }
if (this.data.workdeadline_a < 30) {
alert('安裝時間不能低於30天')
return;
}
this.isLoading = true this.isLoading = true
const form = new FormData(); const form = new FormData();
form.append('mid', this.data.mid); form.append('mid', this.data.mid);
@ -1290,6 +1297,7 @@ const contractNewApply = () => {
form.append('address', this.data.address); form.append('address', this.data.address);
form.append('workdeadline_a', this.data.workdeadline_a); form.append('workdeadline_a', this.data.workdeadline_a);
form.append('workdeadline_b', this.data.workdeadline_b); form.append('workdeadline_b', this.data.workdeadline_b);
form.append('workdeadline_note', this.data.workdeadline_note);
form.append('regulations', this.data.regulations); form.append('regulations', this.data.regulations);
form.append('freedeadline', this.data.freedeadline); form.append('freedeadline', this.data.freedeadline);
form.append('tradeaddress', this.data.tradeaddress); form.append('tradeaddress', this.data.tradeaddress);
@ -1301,6 +1309,7 @@ const contractNewApply = () => {
form.append('status', 0); form.append('status', 0);
form.append('removefiles', JSON.stringify(this.data.removefiles)) form.append('removefiles', JSON.stringify(this.data.removefiles))
form.append('salesman_comment', this.data.salesman_comment); form.append('salesman_comment', this.data.salesman_comment);
form.append('description', this.data.description);
for (var i = 0; i < this.data.files.length; i++) { for (var i = 0; i < this.data.files.length; i++) {
form.append('files[]', this.data.files[i]); form.append('files[]', this.data.files[i]);
} }
@ -1329,8 +1338,10 @@ const contractNewApply = () => {
return; return;
} }
if (this.data.workdeadline_a < 30) { if (this.data.workdeadline_a < 30) {
alert('安裝時間不能低於30天') while (this.data.workdeadline_note == '') {
return; this.data.workdeadline_note = prompt('安裝時間需低於30天,請說明原因')
}
} }
this.isLoading = true this.isLoading = true
const form = new FormData(); const form = new FormData();
@ -1351,6 +1362,7 @@ const contractNewApply = () => {
form.append('address', this.data.address); form.append('address', this.data.address);
form.append('workdeadline_a', this.data.workdeadline_a); form.append('workdeadline_a', this.data.workdeadline_a);
form.append('workdeadline_b', this.data.workdeadline_b); form.append('workdeadline_b', this.data.workdeadline_b);
form.append('workdeadline_note', this.data.workdeadline_note);
form.append('regulations', this.data.regulations); form.append('regulations', this.data.regulations);
form.append('freedeadline', this.data.freedeadline); form.append('freedeadline', this.data.freedeadline);
form.append('tradeaddress', this.data.tradeaddress); form.append('tradeaddress', this.data.tradeaddress);
@ -1361,6 +1373,7 @@ const contractNewApply = () => {
form.append('pays', JSON.stringify(this.pays)); form.append('pays', JSON.stringify(this.pays));
form.append('status', 1); form.append('status', 1);
form.append('review_comment', this.data.review_comment); form.append('review_comment', this.data.review_comment);
form.append('description', this.data.description);
for (var i = 0; i < this.data.files.length; i++) { for (var i = 0; i < this.data.files.length; i++) {
form.append('files[]', this.data.files[i]); form.append('files[]', this.data.files[i]);
} }
@ -1378,22 +1391,38 @@ const contractNewApply = () => {
}) })
}, },
agree() { agree() {
if (!confirm("確定同意嗎?")) { if (!confirm("確定同意嗎?")) return;
return;
}
this.isLoading = true this.isLoading = true
let newprogress = 0;
let newstatus = 0;
if (this.progress <= 1) {
newprogress = 2;
} else if (this.progress == 2) {
newprogress = 3;
}
if (this.status == 1 && this.progress == 2) {
newstatus = 3
} else {
newstatus = 1
}
console.log(newstatus);
console.log(newprogress)
console.log(this.data.regulations);
this.data.regulations = 100
const form = new FormData(); const form = new FormData();
form.append('contract_new_apply_id', contract_new_apply_id); form.append('contract_new_apply_id', contract_new_apply_id);
form.append('vol_no', this.data.vol_no); form.append('vol_no', this.data.vol_no);
form.append('status', 3); form.append('status', newstatus);
form.append('review_comment', this.data.review_comment); form.append('review_comment', this.data.review_comment);
form.append('review_person_id', user_id); form.append('review_person_id', user_id);
form.append('progress', 2); form.append('progress', newprogress);
axios.post('./api/postContractNewApplyData.php', form).then(res => { axios.post('./api/postContractNewApplyData.php', form).then(res => {
if (res.status === 200) { if (res.status === 200) {
alert('審核成功'); alert('審核成功');
console.log(res.data);
console.log(res.status);
window.location.reload(); window.location.reload();
} }
this.isLoading = false this.isLoading = false
@ -1429,9 +1458,9 @@ const contractNewApply = () => {
}, },
removeFile(id) { removeFile(id) {
if (!confirm('確定移除該檔案嗎?')) return; if (!confirm('確定移除該檔案嗎?')) return;
console.log(this.data.originfiles);
console.log(id); console.log(id);
this.data.removefiles.push(id); this.data.removefiles.push(id);
this.data.originfiles.splice(id, 1);
this.data.originfiles = this.data.originfiles.filter(file => file.id != id) this.data.originfiles = this.data.originfiles.filter(file => file.id != id)
} }

8
wms/contract/styles/style.css

@ -574,6 +574,14 @@ main table td, main table th {
font-weight: 900; font-weight: 900;
padding: 0; padding: 0;
} }
.contract-input-component .form table textarea, .contract-management .form table textarea, .contract-new-apply-component .form table textarea {
width: 100%;
resize: vertical;
min-height: 150px;
border: 1px #ccc solid;
outline: none;
border-radius: 6px;
}
.contract-input-component .form table .opinion, .contract-management .form table .opinion, .contract-new-apply-component .form table .opinion { .contract-input-component .form table .opinion, .contract-management .form table .opinion, .contract-new-apply-component .form table .opinion {
width: 100%; width: 100%;
min-height: 100px; min-height: 100px;

2
wms/contract/styles/style.css.map

File diff suppressed because one or more lines are too long

8
wms/contract/styles/style.scss

@ -594,6 +594,14 @@ main{
font-weight: 900; font-weight: 900;
padding: 0; padding: 0;
} }
textarea{
width: 100%;
resize: vertical;
min-height: 150px;
border:1px #ccc solid;
outline: none;
border-radius: 6px;
}
.opinion{ .opinion{
width:100%; width:100%;
min-height: 100px; min-height: 100px;

BIN
wms/facility-price.xlsx

Binary file not shown.

18
wms/fun_global.php

@ -83,7 +83,7 @@ function manage_class($user_id, &$ret = [])
* @return array * @return array
* *
*/ */
function pricereview_class($rate, $user_id, &$ret = []) function pricereview_class($rate, $user_id, &$ret = [], $special_fee)
{ {
global $link; global $link;
@ -93,18 +93,19 @@ function pricereview_class($rate, $user_id, &$ret = [])
if ($row["manager"] == "M0001") return; // 董事長略過 if ($row["manager"] == "M0001") return; // 董事長略過
if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") { if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") {
$ret[1] = $row["manager"] . ",,"; $ret[1] = $row["manager"] . ",,";
pricereview_class($rate, $row["manager"], $ret); pricereview_class($rate, $row["manager"], $ret, $special_fee);
} else { } else {
$ret[2] = "M0024,,<##>M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人) $ret[2] = "M0024,,<##>M0107,,"; // 業務部專員:M0024許伃廷、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理 $ret[3] = "M0060,,"; // 業務協理
if ($rate < 75) $ret[4] = "M0006,,"; // 總經理 if ($rate < 80 || $special_fee > 0) {
$ret[4] = "M0006,,"; // 總經理
}
} }
} }
mysqli_free_result($res); mysqli_free_result($res);
return $ret; return $ret;
} }
/** /**
* 汰改(契約)價審簽核順位 * 汰改(契約)價審簽核順位
* @param string $rate:破價比 * @param string $rate:破價比
@ -128,13 +129,14 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag)
} }
} }
mysqli_free_result($res); mysqli_free_result($res);
$ret[2] = 'M0012';
if ($renovate_flag == "REN") { if ($renovate_flag == "REN") {
if ($rate < 80) $ret[3] = "M0008"; // 詹總 // $ret[2] = 'M0012';
if ($rate < 60) $ret[4] = "M0006"; // 總經理 if ($rate <= 100) $ret[3] = "M0008"; // 詹總
if ($rate < 75) $ret[4] = "M0006"; // 總經理
} else { } else {
// 全汰改 // 全汰改
if ($rate < 80) $ret[3] = "M0008"; // 詹總 if ($rate <= 100) $ret[3] = "M0008"; // 詹總
if ($rate < 75) $ret[4] = "M0006"; // 總經理 if ($rate < 75) $ret[4] = "M0006"; // 總經理
} }

2
wms/header.php

@ -34,7 +34,7 @@ if (isset($_REQUEST["function_name"])) {
* 連線T8 MSSQL * 連線T8 MSSQL
*/ */
try { try {
$conn = new PDO("sqlsrv:Server=220.130.203.251;Database=T8MASADA", "masada", "ztPmPP!HRoV6SL3E"); $conn = new PDO("sqlsrv:Server=220.130.203.251;Database=T8MASADA", "M0225", "IFFBU1E=");
if ($conn) { if ($conn) {
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} }

101
wms/mkt/assets/js/alpine.js

@ -191,3 +191,104 @@ const priceOptionSelect = ()=>{
} }
} }
} }
const pricereviewOptionSelect = ()=>{
return {
init(){
console.log(options);
this.optionCategory = 0
this.initButtons();
},
options: options,
orioptions: options,
optionalArr: {
1:'標配',
2:'選配',
3:'加價',
},
searchtext:'',
kind:0,
subkind:0,
buttons:[],
initButtons(kind){
if(kind == 'A'){
this.buttons = [
{name: '車廂意匠', type: 'A1'}
]
}else if(kind == 'B'){
this.buttons = [
{name: '天井', type: 'B1'},
{name: '地板', type: 'B2'},
{name: '操縱盤', type: 'B3'},
{name: '扶手', type: 'B4'},
{name: '車廂門與層門(轎門/層門)', type: 'B5'},
{name: '轎壁(車廂側板)', type: 'B6'},
{name: '其他車廂內裝配件', type: 'B7'},
]
}else if(kind == 'C'){
this.buttons = [
{name: '框', type: 'C1'},
{name: '乘場指示器', type: 'C2'},
{name: '燈', type: 'C3'},
{name: '方式與門', type: 'C4'},
]
}else if(kind == 'D'){
this.buttons = [
{name: '功能與配置', type: 'D1'},
{name: 'OH與樓高', type: 'D2'},
]
}else if(kind == 'E'){
this.buttons = [
{name: '平台梯', type: 'E1'},
]
}else if(kind == 'F'){
this.buttons = [
{name: '汰改', type: 'F1'},
]
}else if(kind == 0){
this.buttons = []
}
},
optionSubCategory:1,
changeCategory(category, subcategory=0){
this.kind = (category=='sub') ? this.kind : category;
if(subcategory != 0) {
this.subkind = subcategory
}else{
this.subkind = 0
}
if(category == 0){
this.kind = 0;
this.subkind = 0;
}
this.initButtons(category)
this.reloadOptions();
},
reloadOptions(){
if(this.kind == 0){
this.options = this.orioptions
return;
}
if(this.subkind == 0){
this.options = this.orioptions.filter(option=> option.kind == this.kind)
return;
}
this.options = this.orioptions.filter(option=> option.kind == this.kind && option.subkind == this.subkind)
},
searchOptions(e){
this.reloadOptions();
let val = e.target.value.toLowerCase()
this.options = (this.options).filter(option=>{
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 = ''
return option.group_name.includes(val) || option.memo.toLowerCase().includes(val) || option.spec.toLowerCase().includes(val) || option.unit.includes(val) || String(option.price).includes(val)
})
}
}
}

365
wms/mkt/price_normal-index.php

@ -7,22 +7,27 @@ include "../header.php";
.container { .container {
padding-top: 10px !important; padding-top: 10px !important;
} }
#exTab1 .tab-content { #exTab1 .tab-content {
color: white; color: white;
padding: 5px 15px; padding: 5px 15px;
} }
/* remove border radius for the tab */ /* remove border radius for the tab */
#exTab1 .nav-pills>li>a { #exTab1 .nav-pills>li>a {
border-radius: 10%; border-radius: 10%;
font-size: 16px; font-size: 16px;
} }
#exTab1 .tab-content table { #exTab1 .tab-content table {
border: 1px solid #000; border: 1px solid #000;
} }
</style> </style>
<div style="overflow-x:auto;"> <div style="overflow-x:auto;">
<div class="container"><h2>電梯標準價查詢</h2></div> <div class="container">
<h2>電梯標準價查詢</h2>
</div>
<div id="exTab1" class="container"> <div id="exTab1" class="container">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li class="active"><a href="#1a" data-toggle="tab">小機房</a></li> <li class="active"><a href="#1a" data-toggle="tab">小機房</a></li>
@ -51,36 +56,34 @@ include "../header.php";
<td class=xl123 width=213 style='width:160pt'>單位:萬元</td> <td class=xl123 width=213 style='width:160pt'>單位:萬元</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt'><span <td height=51 class=xl89 style='height:38.0pt'><span style='mso-spacerun:yes'> </span>
style='mso-spacerun:yes'> </span><font class="font21"><span <font class="font21"><span style='mso-spacerun:yes'>                </span></font>
style='mso-spacerun:yes'>                </span></font></td> </td>
<td class=xl89 style='border-top:none;border-left:none'>標準價</td> <td class=xl89 style='border-top:none;border-left:none'>標準價</td>
<td class=xl89 style='border-top:none;border-left:none'>(±1S)<span <td class=xl89 style='border-top:none;border-left:none'>(±1S)<span style='mso-spacerun:yes'> </span></td>
style='mso-spacerun:yes'> </span></td>
<td colspan=2 rowspan=12 class=xl124 width=461 style='border-right:1.0pt solid black; <td colspan=2 rowspan=12 class=xl124 width=461 style='border-right:1.0pt solid black;
border-bottom:1.0pt solid black;width:346pt;vertical-align:middle;text-align:left;font-size:16px;'>1、1.0最低到5停;5停以下以5停計。<br> border-bottom:1.0pt solid black;width:346pt;vertical-align:middle;text-align:left;font-size:16px;'>1、1.5及1.75最低到5停,5停以下以5停計。<br>
2、1.5及1.75最低到8停;8停以下以8停計。<br> 2、處長權限為發佈價之80%。<br>
3、1.5變為1.75---》+5.4萬/台;加減1停同1.5。<br> </td>
4、經理權限為發佈價之80%、業務部協理權限為75%。</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-6*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-6*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>89.0</td> <td class=xl81 style='border-top:none;border-left:none'>90.1</td>
<td class=xl81 style='border-top:none;border-left:none'>4.0</td> <td class=xl81 style='border-top:none;border-left:none'>4.0</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-8*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-8*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>89.1</td> <td class=xl81 style='border-top:none;border-left:none'>90.1</td>
<td class=xl81 style='border-top:none;border-left:none'>4.0</td> <td class=xl81 style='border-top:none;border-left:none'>4.0</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-9*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-9*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>89.7</td> <td class=xl81 style='border-top:none;border-left:none'>90.4</td>
<td class=xl81 style='border-top:none;border-left:none'>4.0</td> <td class=xl81 style='border-top:none;border-left:none'>4.0</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-10*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-10*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>90.4</td> <td class=xl81 style='border-top:none;border-left:none'>91.9</td>
<td class=xl81 style='border-top:none;border-left:none'>4.0</td> <td class=xl81 style='border-top:none;border-left:none'>4.0</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
@ -90,64 +93,63 @@ include "../header.php";
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-12*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-12*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>95.6</td> <td class=xl81 style='border-top:none;border-left:none'>95.2</td>
<td class=xl81 style='border-top:none;border-left:none'>4.0</td> <td class=xl81 style='border-top:none;border-left:none'>4.0</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-13*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-13*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>98.0</td> <td class=xl81 style='border-top:none;border-left:none'>97.8</td>
<td class=xl81 style='border-top:none;border-left:none'>4.1</td> <td class=xl81 style='border-top:none;border-left:none'>4.1</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-15*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-15*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>98.5</td> <td class=xl81 style='border-top:none;border-left:none'>98.3</td>
<td class=xl81 style='border-top:none;border-left:none'>4.1</td> <td class=xl81 style='border-top:none;border-left:none'>4.1</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-17*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-17*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>133.6</td> <td class=xl81 style='border-top:none;border-left:none'>130.6</td>
<td class=xl81 style='border-top:none;border-left:none'>5.1</td> <td class=xl81 style='border-top:none;border-left:none'>4.5</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-20*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-20*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>153.2</td> <td class=xl81 style='border-top:none;border-left:none'>150.2</td>
<td class=xl81 style='border-top:none;border-left:none'>5.4</td> <td class=xl81 style='border-top:none;border-left:none'>4.9</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl90 style='height:38.0pt;border-top:none'>MAE100-24*7-CO60</td> <td height=51 class=xl90 style='height:38.0pt;border-top:none'>MAE100-24*7-CO60</td>
<td class=xl81 style='border-top:none;border-left:none'>158.4</td> <td class=xl81 style='border-top:none;border-left:none'>155.4</td>
<td class=xl81 style='border-top:none;border-left:none'>5.4</td> <td class=xl81 style='border-top:none;border-left:none'>4.9</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td colspan=5 height=51 class=xl123 style='height:38.0pt'> </td> <td colspan=5 height=51 class=xl123 style='height:38.0pt'> </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt'><span <td height=51 class=xl89 style='height:38.0pt'><span style='mso-spacerun:yes'> </span>
style='mso-spacerun:yes'> </span><font class="font21"><span <font class="font21"><span style='mso-spacerun:yes'>                </span></font>
style='mso-spacerun:yes'>                </span></font></td> </td>
<td class=xl89 style='border-left:none'>標準價</td> <td class=xl89 style='border-left:none'>標準價</td>
<td class=xl89 style='border-left:none'>(±1S)<span <td class=xl89 style='border-left:none'>(±1S)<span style='mso-spacerun:yes'> </span></td>
style='mso-spacerun:yes'> </span></td>
<td class=xl91 style='border-left:none'>規格</td> <td class=xl91 style='border-left:none'>規格</td>
<td class=xl92 style='border-left:none'>標準價</td> <td class=xl92 style='border-left:none'>標準價</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-8*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-8*10-CO90</td>
<td class=xl81 style='border-top:none;border-left:none'>101.5</td> <td class=xl81 style='border-top:none;border-left:none'>102.1</td>
<td class=xl81 style='border-top:none;border-left:none'>4.0</td> <td class=xl81 style='border-top:none;border-left:none'>4.0</td>
<td class=xl114 style='border-top:none'>MAE100-8*10-CO105</td> <td class=xl114 style='border-top:none'>MAE100-8*10-CO105</td>
<td class=xl81 style='border-top:none;border-left:none'>106.3</td> <td class=xl81 style='border-top:none;border-left:none'>106.3</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-9*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-9*10-CO90</td>
<td class=xl81 style='border-top:none;border-left:none'>102.1</td> <td class=xl81 style='border-top:none;border-left:none'>102.6</td>
<td class=xl81 style='border-top:none;border-left:none'>4.0</td> <td class=xl81 style='border-top:none;border-left:none'>4.0</td>
<td class=xl114 style='border-top:none'>MAE100-9*10-CO105</td> <td class=xl114 style='border-top:none'>MAE100-9*10-CO105</td>
<td class=xl81 style='border-top:none;border-left:none'>107.4</td> <td class=xl81 style='border-top:none;border-left:none'>107.4</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-10*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-10*10-CO90</td>
<td class=xl81 style='border-top:none;border-left:none'>103.0</td> <td class=xl81 style='border-top:none;border-left:none'>108.0</td>
<td class=xl81 style='border-top:none;border-left:none'>4.0</td> <td class=xl81 style='border-top:none;border-left:none'>4.0</td>
<td class=xl114 style='border-top:none'>MAE100-10*10-CO105</td> <td class=xl114 style='border-top:none'>MAE100-10*10-CO105</td>
<td class=xl81 style='border-top:none;border-left:none'>108.6</td> <td class=xl81 style='border-top:none;border-left:none'>108.6</td>
@ -164,42 +166,42 @@ include "../header.php";
<td class=xl81 style='border-top:none;border-left:none'>110.0</td> <td class=xl81 style='border-top:none;border-left:none'>110.0</td>
<td class=xl81 style='border-top:none;border-left:none'>4.0</td> <td class=xl81 style='border-top:none;border-left:none'>4.0</td>
<td class=xl114 style='border-top:none'>MAE100-12*10-CO105</td> <td class=xl114 style='border-top:none'>MAE100-12*10-CO105</td>
<td class=xl81 style='border-top:none;border-left:none'>115.5</td> <td class=xl81 style='border-top:none;border-left:none'>115.3</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-13*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-13*10-CO90</td>
<td class=xl81 style='border-top:none;border-left:none'>112.2</td> <td class=xl81 style='border-top:none;border-left:none'>112.2</td>
<td class=xl81 style='border-top:none;border-left:none'>4.1</td> <td class=xl81 style='border-top:none;border-left:none'>4.1</td>
<td class=xl114 style='border-top:none'>MAE100-13*10-CO105</td> <td class=xl114 style='border-top:none'>MAE100-13*10-CO105</td>
<td class=xl81 style='border-top:none;border-left:none'>117.8</td> <td class=xl81 style='border-top:none;border-left:none'>117.5</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-15*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-15*10-CO90</td>
<td class=xl81 style='border-top:none;border-left:none'>113.4</td> <td class=xl81 style='border-top:none;border-left:none'>113.4</td>
<td class=xl81 style='border-top:none;border-left:none'>4.1</td> <td class=xl81 style='border-top:none;border-left:none'>4.1</td>
<td class=xl114 style='border-top:none'>MAE100-15*10-CO105</td> <td class=xl114 style='border-top:none'>MAE100-15*10-CO105</td>
<td class=xl81 style='border-top:none;border-left:none'>119.0</td> <td class=xl81 style='border-top:none;border-left:none'>118.8</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-17*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-17*10-CO90</td>
<td class=xl81 style='border-top:none;border-left:none'>151.1</td> <td class=xl81 style='border-top:none;border-left:none'>148.1</td>
<td class=xl81 style='border-top:none;border-left:none'>5.1</td> <td class=xl81 style='border-top:none;border-left:none'>4.5</td>
<td class=xl114 style='border-top:none'>MAE100-17*10-CO105</td> <td class=xl114 style='border-top:none'>MAE100-17*10-CO105</td>
<td class=xl81 style='border-top:none;border-left:none'>156.7</td> <td class=xl81 style='border-top:none;border-left:none'>152.7</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-20*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-20*10-CO90</td>
<td class=xl81 style='border-top:none;border-left:none'>173.0</td> <td class=xl81 style='border-top:none;border-left:none'>170.0</td>
<td class=xl81 style='border-top:none;border-left:none'>5.4</td> <td class=xl81 style='border-top:none;border-left:none'>4.9</td>
<td class=xl114 style='border-top:none'>MAE100-20*10-CO105</td> <td class=xl114 style='border-top:none'>MAE100-20*10-CO105</td>
<td class=xl81 style='border-top:none;border-left:none'>178.6</td> <td class=xl81 style='border-top:none;border-left:none'>173.6</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl90 style='height:38.0pt;border-top:none'>MAE100-24*10-CO90</td> <td height=51 class=xl90 style='height:38.0pt;border-top:none'>MAE100-24*10-CO90</td>
<td class=xl81 style='border-top:none;border-left:none'>192.0</td> <td class=xl81 style='border-top:none;border-left:none'>188.0</td>
<td class=xl81 style='border-top:none;border-left:none'>5.4</td> <td class=xl81 style='border-top:none;border-left:none'>4.9</td>
<td class=xl114 style='border-top:none'>MAE100-24*10-CO105</td> <td class=xl114 style='border-top:none'>MAE100-24*10-CO105</td>
<td class=xl82 style='border-top:none;border-left:none'>198.0</td> <td class=xl82 style='border-top:none;border-left:none'>193.0</td>
</tr> </tr>
<![if supportMisalignedColumns]> <![if supportMisalignedColumns]>
<tr height=0 style='display:none'> <tr height=0 style='display:none'>
@ -227,137 +229,133 @@ include "../header.php";
<td class=xl123 width=213 style='width:160pt'>單位:萬元</td> <td class=xl123 width=213 style='width:160pt'>單位:萬元</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl93 style='height:38.0pt'><span <td height=51 class=xl93 style='height:38.0pt'><span style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>                </span></td>
style='mso-spacerun:yes'> </span><span
style='mso-spacerun:yes'>                </span></td>
<td class=xl93 style='border-top:none;border-left:none'>標準價</td> <td class=xl93 style='border-top:none;border-left:none'>標準價</td>
<td class=xl93 style='border-top:none;border-left:none'>(±1S)<span <td class=xl93 style='border-top:none;border-left:none'>(±1S)<span style='mso-spacerun:yes'> </span></td>
style='mso-spacerun:yes'> </span></td>
<td colspan=2 rowspan=11 class=xl124 width=470 style='border-right:1.0pt solid black; <td colspan=2 rowspan=11 class=xl124 width=470 style='border-right:1.0pt solid black;
width:353pt;vertical-align:middle;text-align:left;font-size:16px;'>1、1.0最低到5停;5停以下以5停計。<br> width:353pt;vertical-align:middle;text-align:left;font-size:16px;'>1、1.5及1.75停最低到5停;5停以下以5停計。<br>
2、1.5及1.75最低到8停;8停以下以8停計。<br> 2、處長權限為發布價之80%。<br>
3、1.5變為1.75---》+5.4萬/台;加減1停同1.5。<br> </td>
4、營業員權限為發佈價之73%</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-8*7-CO60</td> <td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-8*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>117.5</td> <td class=xl83 style='border-top:none;border-left:none'>111.9</td>
<td class=xl83 style='border-top:none;border-left:none'>4.5</td> <td class=xl83 style='border-top:none;border-left:none'>4.5</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-9*7-CO60</td> <td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-9*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>118.7</td> <td class=xl83 style='border-top:none;border-left:none'>112.7</td>
<td class=xl83 style='border-top:none;border-left:none'>4.5</td> <td class=xl83 style='border-top:none;border-left:none'>4.5</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-10*7-CO60</td> <td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-10*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>120.1</td> <td class=xl83 style='border-top:none;border-left:none'>114.3</td>
<td class=xl83 style='border-top:none;border-left:none'>4.5</td> <td class=xl83 style='border-top:none;border-left:none'>4.5</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-11*7-CO60</td> <td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-11*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>121.2</td> <td class=xl83 style='border-top:none;border-left:none'>115.4</td>
<td class=xl83 style='border-top:none;border-left:none'>4.5</td> <td class=xl83 style='border-top:none;border-left:none'>4.5</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-12*7-CO60</td> <td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-12*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>122.5</td> <td class=xl83 style='border-top:none;border-left:none'>116.6</td>
<td class=xl83 style='border-top:none;border-left:none'>4.5</td> <td class=xl83 style='border-top:none;border-left:none'>4.5</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-13*7-CO60</td> <td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-13*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>123.8</td> <td class=xl83 style='border-top:none;border-left:none'>117.8</td>
<td class=xl83 style='border-top:none;border-left:none'>4.5</td> <td class=xl83 style='border-top:none;border-left:none'>4.5</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-15*7-CO60</td> <td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAM200-15*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>124.9</td> <td class=xl83 style='border-top:none;border-left:none'>118.9</td>
<td class=xl83 style='border-top:none;border-left:none'>4.5</td> <td class=xl83 style='border-top:none;border-left:none'>4.5</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-17*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-17*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>187.4</td> <td class=xl83 style='border-top:none;border-left:none'>178.3</td>
<td class=xl83 style='border-top:none;border-left:none'>6.4</td> <td class=xl83 style='border-top:none;border-left:none'>5.7</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-20*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-20*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>204.8</td> <td class=xl83 style='border-top:none;border-left:none'>194.8</td>
<td class=xl83 style='border-top:none;border-left:none'>6.4</td> <td class=xl83 style='border-top:none;border-left:none'>5.7</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-24*7-CO60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-24*7-CO60</td>
<td class=xl83 style='border-top:none;border-left:none'>208.5</td> <td class=xl83 style='border-top:none;border-left:none'>198.3</td>
<td class=xl83 style='border-top:none;border-left:none'>6.4</td> <td class=xl83 style='border-top:none;border-left:none'>5.7</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-8*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-8*10-CO90</td>
<td class=xl83 style='border-top:none;border-left:none'>133.4</td> <td class=xl83 style='border-top:none;border-left:none'>127.7</td>
<td class=xl83 style='border-top:none;border-left:none'>4.9</td> <td class=xl83 style='border-top:none;border-left:none'>4.9</td>
<td class=xl114 style='border-top:none'>MAM200-8*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-8*10-CO105</td>
<td class=xl84 style='border-top:none;border-left:none'>139.1</td> <td class=xl84 style='border-top:none;border-left:none'>131.6</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-9*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-9*10-CO90</td>
<td class=xl83 style='border-top:none;border-left:none'>134.5</td> <td class=xl83 style='border-top:none;border-left:none'>128.7</td>
<td class=xl83 style='border-top:none;border-left:none'>4.9</td> <td class=xl83 style='border-top:none;border-left:none'>4.9</td>
<td class=xl114 style='border-top:none'>MAM200-9*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-9*10-CO105</td>
<td class=xl84 style='border-top:none;border-left:none'>140.2</td> <td class=xl84 style='border-top:none;border-left:none'>132.7</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-10*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-10*10-CO90</td>
<td class=xl83 style='border-top:none;border-left:none'>135.8</td> <td class=xl83 style='border-top:none;border-left:none'>130.0</td>
<td class=xl83 style='border-top:none;border-left:none'>4.9</td> <td class=xl83 style='border-top:none;border-left:none'>4.9</td>
<td class=xl114 style='border-top:none'>MAM200-10*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-10*10-CO105</td>
<td class=xl84 style='border-top:none;border-left:none'>141.5</td> <td class=xl84 style='border-top:none;border-left:none'>133.9</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-11*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-11*10-CO90</td>
<td class=xl83 style='border-top:none;border-left:none'>137.1</td> <td class=xl83 style='border-top:none;border-left:none'>131.2</td>
<td class=xl83 style='border-top:none;border-left:none'>4.9</td> <td class=xl83 style='border-top:none;border-left:none'>4.9</td>
<td class=xl114 style='border-top:none'>MAM200-11*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-11*10-CO105</td>
<td class=xl84 style='border-top:none;border-left:none'>142.8</td> <td class=xl84 style='border-top:none;border-left:none'>135.1</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-12*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-12*10-CO90</td>
<td class=xl83 style='border-top:none;border-left:none'>138.2</td> <td class=xl83 style='border-top:none;border-left:none'>132.3</td>
<td class=xl83 style='border-top:none;border-left:none'>4.9</td> <td class=xl83 style='border-top:none;border-left:none'>4.9</td>
<td class=xl114 style='border-top:none'>MAM200-12*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-12*10-CO105</td>
<td class=xl84 style='border-top:none;border-left:none'>143.9</td> <td class=xl84 style='border-top:none;border-left:none'>136.2</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-13*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-13*10-CO90</td>
<td class=xl83 style='border-top:none;border-left:none'>140.0</td> <td class=xl83 style='border-top:none;border-left:none'>134.0</td>
<td class=xl83 style='border-top:none;border-left:none'>4.9</td> <td class=xl83 style='border-top:none;border-left:none'>4.9</td>
<td class=xl114 style='border-top:none'>MAM200-13*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-13*10-CO105</td>
<td class=xl84 style='border-top:none;border-left:none'>145.7</td> <td class=xl84 style='border-top:none;border-left:none'>137.9</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-15*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-15*10-CO90</td>
<td class=xl83 style='border-top:none;border-left:none'>141.2</td> <td class=xl83 style='border-top:none;border-left:none'>135.1</td>
<td class=xl83 style='border-top:none;border-left:none'>4.9</td> <td class=xl83 style='border-top:none;border-left:none'>4.9</td>
<td class=xl114 style='border-top:none'>MAM200-15*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-15*10-CO105</td>
<td class=xl84 style='border-top:none;border-left:none'>146.9</td> <td class=xl84 style='border-top:none;border-left:none'>139.0</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-17*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-17*10-CO90</td>
<td class=xl83 style='border-top:none;border-left:none'>202.8</td> <td class=xl83 style='border-top:none;border-left:none'>196.6</td>
<td class=xl83 style='border-top:none;border-left:none'>6.5</td> <td class=xl83 style='border-top:none;border-left:none'>5.9</td>
<td class=xl114 style='border-top:none'>MAM200-17*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-17*10-CO105</td>
<td class=xl84 style='border-top:none;border-left:none'>208.5</td> <td class=xl84 style='border-top:none;border-left:none'>199.5</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-20*10-CO90</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAM200-20*10-CO90</td>
<td class=xl83 style='border-top:none;border-left:none'>220.2</td> <td class=xl83 style='border-top:none;border-left:none'>213.2</td>
<td class=xl83 style='border-top:none;border-left:none'>6.5</td> <td class=xl83 style='border-top:none;border-left:none'>5.9</td>
<td class=xl114 style='border-top:none'>MAM200-20*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-20*10-CO105</td>
<td class=xl84 style='border-top:none;border-left:none'>225.9</td> <td class=xl84 style='border-top:none;border-left:none'>223.9</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl90 style='height:38.0pt;border-top:none'>MAM200-24*10-CO90</td> <td height=51 class=xl90 style='height:38.0pt;border-top:none'>MAM200-24*10-CO90</td>
<td class=xl85 style='border-top:none;border-left:none'>223.9</td> <td class=xl85 style='border-top:none;border-left:none'>216.7</td>
<td class=xl85 style='border-top:none;border-left:none'>6.5</td> <td class=xl85 style='border-top:none;border-left:none'>5.9</td>
<td class=xl114 style='border-top:none'>MAM200-24*10-CO105</td> <td class=xl114 style='border-top:none'>MAM200-24*10-CO105</td>
<td class=xl86 style='border-top:none;border-left:none'>229.6</td> <td class=xl86 style='border-top:none;border-left:none'>227.6</td>
</tr> </tr>
<![if supportMisalignedColumns]> <![if supportMisalignedColumns]>
<tr height=0 style='display:none'> <tr height=0 style='display:none'>
@ -378,17 +376,16 @@ include "../header.php";
<col width=261 span=2 style='mso-width-source:userset;mso-width-alt:8362; <col width=261 span=2 style='mso-width-source:userset;mso-width-alt:8362;
width:196pt'> width:196pt'>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl123 width=261 style='height:38.0pt;width:196pt'><font class="font20">小電梯</font></td> <td height=51 class=xl123 width=261 style='height:38.0pt;width:196pt'>
<font class="font20">小電梯</font>
</td>
<td class=xl123 width=261 style='width:196pt'>MAH100</td> <td class=xl123 width=261 style='width:196pt'>MAH100</td>
<td class=xl123 width=261 style='width:196pt'>單位:萬元</td> <td class=xl123 width=261 style='width:196pt'>單位:萬元</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl95 style='height:38.0pt'><span <td height=51 class=xl95 style='height:38.0pt'><span style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>                </span></td>
style='mso-spacerun:yes'> </span><span
style='mso-spacerun:yes'>                </span></td>
<td class=xl95 style='border-left:none'>標準價</td> <td class=xl95 style='border-left:none'>標準價</td>
<td class=xl95 style='border-left:none'>(±1S)<span <td class=xl95 style='border-left:none'>(±1S)<span style='mso-spacerun:yes'> </span></td>
style='mso-spacerun:yes'> </span></td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAH100-6*5-2S45</td> <td height=51 class=xl94 style='height:38.0pt;border-top:none'>MAH100-6*5-2S45</td>
@ -422,8 +419,8 @@ include "../header.php";
</tr> </tr>
<tr class=xl67 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl67 height=51 style='mso-height-source:userset;height:38.0pt'>
<td colspan=2 rowspan=4 height=150 class=xl129 width=522 style='height:113.75pt;width:392pt'>註:<br> <td colspan=2 rowspan=4 height=150 class=xl129 width=522 style='height:113.75pt;width:392pt'>註:<br>
1、最低到3停;2停以3停計。<br>
2、經理權限為發佈價之80%、業務部協理權限為75%。</td> 1、處長權限為發布價之80%。</td>
<td class="xl67"></td> <td class="xl67"></td>
</tr> </tr>
<![if supportMisalignedColumns]> <![if supportMisalignedColumns]>
@ -444,85 +441,82 @@ include "../header.php";
<td class=xl123 width=261 style='width:196pt'>單位:萬元</td> <td class=xl123 width=261 style='width:196pt'>單位:萬元</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl95 style='height:38.0pt'><span <td height=51 class=xl95 style='height:38.0pt'><span style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>                </span></td>
style='mso-spacerun:yes'> </span><span
style='mso-spacerun:yes'>                </span></td>
<td class=xl88 style='border-left:none'>標準價</td> <td class=xl88 style='border-left:none'>標準價</td>
<td class=xl92 style='border-left:none'>(±1S)<span <td class=xl92 style='border-left:none'>(±1S)<span style='mso-spacerun:yes'> </span></td>
style='mso-spacerun:yes'> </span></td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-12*20-CO120</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-12*20-CO120</td>
<td class=xl109 style='border-top:none;border-left:none'>180.0 </td> <td class=xl109 style='border-top:none;border-left:none'>190.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>5.0 </td> <td class=xl110 style='border-top:none;border-left:none'>4.8 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-13*20-CO120</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-13*20-CO120</td>
<td class=xl109 style='border-top:none;border-left:none'>181.3 </td> <td class=xl109 style='border-top:none;border-left:none'>191.3 </td>
<td class=xl110 style='border-top:none;border-left:none'>5.0 </td> <td class=xl110 style='border-top:none;border-left:none'>4.8 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-15*20-CO120</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-15*20-CO120</td>
<td class=xl109 style='border-top:none;border-left:none'>182.7 </td> <td class=xl109 style='border-top:none;border-left:none'>192.7 </td>
<td class=xl110 style='border-top:none;border-left:none'>5.0 </td> <td class=xl110 style='border-top:none;border-left:none'>4.8 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-17*20-CO120</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-17*20-CO120</td>
<td class=xl109 style='border-top:none;border-left:none'>217.1 </td> <td class=xl109 style='border-top:none;border-left:none'>215.1 </td>
<td class=xl110 style='border-top:none;border-left:none'>6.3 </td> <td class=xl110 style='border-top:none;border-left:none'>5.8 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-20*20-CO120</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-20*20-CO120</td>
<td class=xl109 style='border-top:none;border-left:none'>225.6 </td> <td class=xl109 style='border-top:none;border-left:none'>223.6 </td>
<td class=xl110 style='border-top:none;border-left:none'>6.4 </td> <td class=xl110 style='border-top:none;border-left:none'>5.9 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-24*20-CO120</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-24*20-CO120</td>
<td class=xl109 style='border-top:none;border-left:none'>240.2 </td> <td class=xl109 style='border-top:none;border-left:none'>238.2 </td>
<td class=xl110 style='border-top:none;border-left:none'>6.5 </td> <td class=xl110 style='border-top:none;border-left:none'>6.0 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-12*20-CO150</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-12*20-CO150</td>
<td class=xl109 style='border-top:none;border-left:none'>223.0 </td> <td class=xl109 style='border-top:none;border-left:none'>216.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>6.1 </td> <td class=xl110 style='border-top:none;border-left:none'>5.7 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-13*20-CO150</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-13*20-CO150</td>
<td class=xl109 style='border-top:none;border-left:none'>224.1 </td> <td class=xl109 style='border-top:none;border-left:none'>224.1 </td>
<td class=xl110 style='border-top:none;border-left:none'>6.1 </td> <td class=xl110 style='border-top:none;border-left:none'>5.7 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-15*20-CO150</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-15*20-CO150</td>
<td class=xl109 style='border-top:none;border-left:none'>225.4 </td> <td class=xl109 style='border-top:none;border-left:none'>225.4 </td>
<td class=xl110 style='border-top:none;border-left:none'>6.1 </td> <td class=xl110 style='border-top:none;border-left:none'>5.7 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-17*20-CO150</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-17*20-CO150</td>
<td class=xl109 style='border-top:none;border-left:none'>239.9 </td> <td class=xl109 style='border-top:none;border-left:none'>236.9 </td>
<td class=xl110 style='border-top:none;border-left:none'>6.5 </td> <td class=xl110 style='border-top:none;border-left:none'>6.0 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-20*20-CO150</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAE100-20*20-CO150</td>
<td class=xl109 style='border-top:none;border-left:none'>244.3 </td> <td class=xl109 style='border-top:none;border-left:none'>241.3 </td>
<td class=xl110 style='border-top:none;border-left:none'>6.5 </td> <td class=xl110 style='border-top:none;border-left:none'>6.0 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl90 style='height:38.0pt;border-top:none'>MAE100-24*20-CO150</td> <td height=51 class=xl90 style='height:38.0pt;border-top:none'>MAE100-24*20-CO150</td>
<td class=xl111 style='border-top:none;border-left:none'>253.3 </td> <td class=xl111 style='border-top:none;border-left:none'>250.3 </td>
<td class=xl112 style='border-top:none;border-left:none'>6.5 </td> <td class=xl112 style='border-top:none;border-left:none'>6.0 </td>
</tr> </tr>
<tr class=xl67 height=33 style='mso-height-source:userset;height:25.25pt'> <tr class=xl67 height=33 style='mso-height-source:userset;height:25.25pt'>
<td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>註:<br>1、2.0及2.5最低到15停;15停以下以15停計</td> <td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>註:<br>1、2.0及2.5最低到15停;15停以下以15停計</td>
<td class=xl99></td> <td class=xl99></td>
</tr> </tr>
<tr class=xl67 height=33 style='mso-height-source:userset;height:25.25pt'> <tr class=xl67 height=33 style='mso-height-source:userset;height:25.25pt'>
<td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>2、P-12(含)以下以P-13計</td> <td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>2、處長權限為發布價之80%</td>
<td class=xl99></td> <td class=xl99></td>
</tr> </tr>
<tr class=xl69 height=33 style='mso-height-source:userset;height:25.25pt'> <!-- <tr class=xl69 height=33 style='mso-height-source:userset;height:25.25pt'>
<td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>3、經理權限為發佈價之80%、業務部協理權限為75%。</td> <td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>3、經理權限為發佈價之80%、業務部協理權限為75%。</td>
<td class=xl113></td> <td class=xl113></td>
</tr> </tr> -->
<tr class=xl69 height=33 style='mso-height-source:userset;height:25.25pt'> <tr class=xl69 height=33 style='mso-height-source:userset;height:25.25pt'>
<td height=33 class=xl69 style='height:25.25pt'></td> <td height=33 class=xl69 style='height:25.25pt'></td>
<td class=xl69></td> <td class=xl69></td>
@ -546,94 +540,91 @@ include "../header.php";
<td class=xl123 width=261 style='width:196pt'>單位:萬元</td> <td class=xl123 width=261 style='width:196pt'>單位:萬元</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl95 style='height:38.0pt'><span <td height=51 class=xl95 style='height:38.0pt'><span style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>                </span></td>
style='mso-spacerun:yes'> </span><span
style='mso-spacerun:yes'>                </span></td>
<td class=xl88 style='border-left:none'>標準價</td> <td class=xl88 style='border-left:none'>標準價</td>
<td class=xl92 style='border-left:none'>(±1S)<span <td class=xl92 style='border-left:none'>(±1S)<span style='mso-spacerun:yes'> </span></td>
style='mso-spacerun:yes'> </span></td>
</tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-750*3-2S45</td>
<td class=xl109 style='border-top:none;border-left:none'>114.3 </td>
<td class=xl110 style='border-top:none;border-left:none'>5.8 </td>
</tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-750*3-2S60</td>
<td class=xl109 style='border-top:none;border-left:none'>115.5 </td>
<td class=xl110 style='border-top:none;border-left:none'>5.8 </td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-1000*3-2S45</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-1000*3-2S45</td>
<td class=xl109 style='border-top:none;border-left:none'>136.4 </td> <td class=xl109 style='border-top:none;border-left:none'>116.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>8.7 </td> <td class=xl110 style='border-top:none;border-left:none'>5.3 </td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-1000*3-2S60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-1000*3-2S60</td>
<td class=xl109 style='border-top:none;border-left:none'>138.5 </td> <td class=xl109 style='border-top:none;border-left:none'>117.8 </td>
<td class=xl110 style='border-top:none;border-left:none'>8.7 </td> <td class=xl110 style='border-top:none;border-left:none'>5.3 </td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-1500*3-2S45</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-1500*3-2S45</td>
<td class=xl109 style='border-top:none;border-left:none'>171.4 </td> <td class=xl109 style='border-top:none;border-left:none'>145.7 </td>
<td class=xl110 style='border-top:none;border-left:none'>9.7 </td> <td class=xl110 style='border-top:none;border-left:none'>9.8 </td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-1500*3-2S60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-1500*3-2S60</td>
<td class=xl109 style='border-top:none;border-left:none'>175.5 </td> <td class=xl109 style='border-top:none;border-left:none'>149.2 </td>
<td class=xl110 style='border-top:none;border-left:none'>9.7 </td> <td class=xl110 style='border-top:none;border-left:none'>9.8 </td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-2000*3-2S45</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-2000*3-2S45</td>
<td class=xl109 style='border-top:none;border-left:none'>195.3 </td> <td class=xl109 style='border-top:none;border-left:none'>166.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>10.0 </td> <td class=xl110 style='border-top:none;border-left:none'>10.0 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-2000*3-2S60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-2000*3-2S60</td>
<td class=xl109 style='border-top:none;border-left:none'>198.5 </td> <td class=xl109 style='border-top:none;border-left:none'>168.7 </td>
<td class=xl110 style='border-top:none;border-left:none'>10.0 </td> <td class=xl110 style='border-top:none;border-left:none'>10.0 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-2500*3-2S45</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-2500*3-4PCO45</td>
<td class=xl109 style='border-top:none;border-left:none'>286.3 </td> <td class=xl109 style='border-top:none;border-left:none'>243.3 </td>
<td class=xl110 style='border-top:none;border-left:none'>15.1 </td> <td class=xl110 style='border-top:none;border-left:none'>14.2 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-2500*3-2S60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-2500*3-4PCO60</td>
<td class=xl109 style='border-top:none;border-left:none'>288.3 </td> <td class=xl109 style='border-top:none;border-left:none'>245.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>15.1 </td> <td class=xl110 style='border-top:none;border-left:none'>14.2 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-3000*3-2S45</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-3000*3-4PCO45</td>
<td class=xl109 style='border-top:none;border-left:none'>307.7 </td> <td class=xl109 style='border-top:none;border-left:none'>261.5 </td>
<td class=xl110 style='border-top:none;border-left:none'>16.3 </td> <td class=xl110 style='border-top:none;border-left:none'>15.2 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-3000*3-2S60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-3000*3-4PCO60</td>
<td class=xl109 style='border-top:none;border-left:none'>309.5 </td> <td class=xl109 style='border-top:none;border-left:none'>263.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>16.3 </td> <td class=xl110 style='border-top:none;border-left:none'>15.2 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-3500*3-2S45</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-3500*3-4PCO45</td>
<td class=xl109 style='border-top:none;border-left:none'>365.5 </td> <td class=xl109 style='border-top:none;border-left:none'>310.6 </td>
<td class=xl110 style='border-top:none;border-left:none'>18.2 </td> <td class=xl110 style='border-top:none;border-left:none'>18.2 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-3500*3-2S60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-3500*3-4PCO60</td>
<td class=xl109 style='border-top:none;border-left:none'>368.5 </td> <td class=xl109 style='border-top:none;border-left:none'>313.2 </td>
<td class=xl110 style='border-top:none;border-left:none'>18.2 </td> <td class=xl110 style='border-top:none;border-left:none'>18.2 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-4000*3-2S45</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-4000*3-6PCO45</td>
<td class=xl109 style='border-top:none;border-left:none'>407.5 </td> <td class=xl109 style='border-top:none;border-left:none'>346.4 </td>
<td class=xl110 style='border-top:none;border-left:none'>20.5 </td> <td class=xl110 style='border-top:none;border-left:none'>20.5 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-4000*3-2S60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-4000*3-6PCO60</td>
<td class=xl109 style='border-top:none;border-left:none'>409.5 </td> <td class=xl109 style='border-top:none;border-left:none'>348.1 </td>
<td class=xl110 style='border-top:none;border-left:none'>20.5 </td> <td class=xl110 style='border-top:none;border-left:none'>20.5 </td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-5000*3-6PCO45</td>
<td class=xl109 style='border-top:none;border-left:none'>442.5 </td>
<td class=xl110 style='border-top:none;border-left:none'>24.0 </td>
</tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-5000*3-6PCO60</td>
<td class=xl109 style='border-top:none;border-left:none'>447.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>24.0 </td>
</tr>
<!-- <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-5000*3-2S45</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-5000*3-2S45</td>
<td class=xl109 style='border-top:none;border-left:none'>520.5 </td> <td class=xl109 style='border-top:none;border-left:none'>520.5 </td>
<td class=xl110 style='border-top:none;border-left:none'>25.5 </td> <td class=xl110 style='border-top:none;border-left:none'>25.5 </td>
@ -642,14 +633,14 @@ include "../header.php";
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-5000*3-2S60</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAF100-5000*3-2S60</td>
<td class=xl111 style='border-top:none;border-left:none'>525.8 </td> <td class=xl111 style='border-top:none;border-left:none'>525.8 </td>
<td class=xl112 style='border-top:none;border-left:none'>25.5 </td> <td class=xl112 style='border-top:none;border-left:none'>25.5 </td>
</tr> </tr> -->
<tr class=xl67 height=33 style='mso-height-source:userset;height:25.25pt'> <tr class=xl67 height=33 style='mso-height-source:userset;height:25.25pt'>
<td height=33 class=xl99 style='height:25.25pt'>註:<br>1、最低為2停</td> <td height=33 class=xl99 style='height:25.25pt'>註:<br>1、最低為2停</td>
<td class=xl99></td> <td class=xl99></td>
<td class=xl99></td> <td class=xl99></td>
</tr> </tr>
<tr class=xl67 height=33 style='mso-height-source:userset;height:25.25pt'> <tr class=xl67 height=33 style='mso-height-source:userset;height:25.25pt'>
<td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>2、經理權限為發佈價之80%、業務部協理權限為75%。</td> <td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>2、處長權限為發佈價之80%。</td>
<td class=xl99></td> <td class=xl99></td>
</tr> </tr>
<![if supportMisalignedColumns]> <![if supportMisalignedColumns]>
@ -670,16 +661,14 @@ include "../header.php";
<td class=xl123 width=323 style='width:242pt'>單位:萬元</td> <td class=xl123 width=323 style='width:242pt'>單位:萬元</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl95 style='height:38.0pt'><span <td height=51 class=xl95 style='height:38.0pt'><span style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>                </span></td>
style='mso-spacerun:yes'> </span><span
style='mso-spacerun:yes'>                </span></td>
<td class=xl88 style='border-left:none'>標準價</td> <td class=xl88 style='border-left:none'>標準價</td>
<td class=xl88 style='border-left:none'>提升高度標準</td> <td class=xl88 style='border-left:none'>提升高度標準</td>
<td class=xl92 style='border-left:none'>備註</td> <td class=xl92 style='border-left:none'>備註</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*2-CO09</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*2-CO09</td>
<td class=xl109 style='border-top:none;border-left:none'>78.5 </td> <td class=xl109 style='border-top:none;border-left:none'>75.0 </td>
<td class=xl109 style='border-top:none;border-left:none'>3.0 </td> <td class=xl109 style='border-top:none;border-left:none'>3.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>岩板;L型開門另加3萬元/台</td> <td class=xl110 style='border-top:none;border-left:none'>岩板;L型開門另加3萬元/台</td>
</tr> </tr>
@ -703,43 +692,43 @@ include "../header.php";
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*2-CO09</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*2-CO09</td>
<td class=xl109 style='border-top:none;border-left:none'>80.2 </td> <td class=xl109 style='border-top:none;border-left:none'>82.0 </td>
<td class=xl109 style='border-top:none;border-left:none'>3.0 </td> <td class=xl109 style='border-top:none;border-left:none'>3.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>人造皮革;L型開門另加3萬元/台</td> <td class=xl110 style='border-top:none;border-left:none'>人造皮革;L型開門另加3萬元/台</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*3-CO09</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*3-CO09</td>
<td class=xl109 style='border-top:none;border-left:none'>88.5 </td> <td class=xl109 style='border-top:none;border-left:none'>90.0 </td>
<td class=xl109 style='border-top:none;border-left:none'>6.0 </td> <td class=xl109 style='border-top:none;border-left:none'>6.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>人造皮革;L型開門另加3萬元/台</td> <td class=xl110 style='border-top:none;border-left:none'>人造皮革;L型開門另加3萬元/台</td>
</tr> </tr>
<tr height=51 style='mso-height-source:userset;height:38.0pt'> <tr height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*4-CO09</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*4-CO09</td>
<td class=xl109 style='border-top:none;border-left:none'>96.5 </td> <td class=xl109 style='border-top:none;border-left:none'>98.0 </td>
<td class=xl109 style='border-top:none;border-left:none'>9.0 </td> <td class=xl109 style='border-top:none;border-left:none'>9.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>人造皮革;L型開門另加3萬元/台</td> <td class=xl110 style='border-top:none;border-left:none'>人造皮革;L型開門另加3萬元/台</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*5-CO09</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-280*5-CO09</td>
<td class=xl109 style='border-top:none;border-left:none'>104.5 </td> <td class=xl109 style='border-top:none;border-left:none'>107.0 </td>
<td class=xl109 style='border-top:none;border-left:none'>12.0 </td> <td class=xl109 style='border-top:none;border-left:none'>12.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>人造皮革;L型開門另加3萬元/台</td> <td class=xl110 style='border-top:none;border-left:none'>人造皮革;L型開門另加3萬元/台</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-320*2-CO09</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-320*2-CO09</td>
<td class=xl109 style='border-top:none;border-left:none'>82.0 </td> <td class=xl109 style='border-top:none;border-left:none'>77.5 </td>
<td class=xl109 style='border-top:none;border-left:none'>3.0 </td> <td class=xl109 style='border-top:none;border-left:none'>3.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>岩板;L型開門另加3萬元/台</td> <td class=xl110 style='border-top:none;border-left:none'>岩板;L型開門另加3萬元/台</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-320*3-CO09</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-320*3-CO09</td>
<td class=xl109 style='border-top:none;border-left:none'>90.0 </td> <td class=xl109 style='border-top:none;border-left:none'>88.5 </td>
<td class=xl109 style='border-top:none;border-left:none'>6.0 </td> <td class=xl109 style='border-top:none;border-left:none'>6.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>岩板;L型開門另加3萬元/台</td> <td class=xl110 style='border-top:none;border-left:none'>岩板;L型開門另加3萬元/台</td>
</tr> </tr>
<tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'> <tr class=xl66 height=51 style='mso-height-source:userset;height:38.0pt'>
<td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-320*4-CO09</td> <td height=51 class=xl89 style='height:38.0pt;border-top:none'>MAP100-320*4-CO09</td>
<td class=xl109 style='border-top:none;border-left:none'>98.0 </td> <td class=xl109 style='border-top:none;border-left:none'>96.5 </td>
<td class=xl109 style='border-top:none;border-left:none'>9.0 </td> <td class=xl109 style='border-top:none;border-left:none'>9.0 </td>
<td class=xl110 style='border-top:none;border-left:none'>岩板;L型開門另加3萬元/台</td> <td class=xl110 style='border-top:none;border-left:none'>岩板;L型開門另加3萬元/台</td>
</tr> </tr>
@ -798,7 +787,7 @@ include "../header.php";
<td class=xl99></td> <td class=xl99></td>
</tr> </tr>
<tr class=xl69 height=33 style='mso-height-source:userset;height:25.25pt'> <tr class=xl69 height=33 style='mso-height-source:userset;height:25.25pt'>
<td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>3、經理權限為發佈價之80%、業務部協理權限為75%。</td> <td height=33 class=xl99 colspan=2 style='height:25.25pt;mso-ignore:colspan'>3、處長權限為發佈價之80%。</td>
<td class=xl69></td> <td class=xl69></td>
<td class=xl113></td> <td class=xl113></td>
</tr> </tr>

20
wms/mkt/pricereview-check.php

@ -105,7 +105,7 @@ foreach ($res as $data) {
} elseif ($status2 == "N") { } elseif ($status2 == "N") {
$checker_2_result = "不同意"; $checker_2_result = "不同意";
} }
if ($status3 == "Y") { if ($status3 == "Y" || $status3 == "YY") {
$checker_3_result = "同意"; $checker_3_result = "同意";
} elseif ($status3 == "N") { } elseif ($status3 == "N") {
$checker_3_result = "不同意"; $checker_3_result = "不同意";
@ -263,6 +263,7 @@ foreach ($res as $data) {
//alert(data.err); //alert(data.err);
return false; return false;
} }
console.log(data.content);
Object.keys(data.content).forEach(function(k) { Object.keys(data.content).forEach(function(k) {
//console.log(data.content[k][0]); //console.log(data.content[k][0]);
// 有值表示先前已寫入MI // 有值表示先前已寫入MI
@ -283,11 +284,16 @@ foreach ($res as $data) {
mihtml += "以上合計:" + commafy(data.content[k][12]) + "/台"; mihtml += "以上合計:" + commafy(data.content[k][12]) + "/台";
mihtml += "<hr>"; mihtml += "<hr>";
mihtml += "<h5>OPTION</h5>"; mihtml += "<h5>OPTION</h5>";
console.log(data.content[k]);
Object.keys(data.content[k][14]).forEach(function(m) { Object.keys(data.content[k][14]).forEach(function(m) {
if(data.content[k][14][m][0] != '') {
mihtml += "<li>" + data.content[k][14][m][0] + ":" + commafy(data.content[k][14][m][1]) + "</li>"; mihtml += "<li>" + data.content[k][14][m][0] + ":" + commafy(data.content[k][14][m][1]) + "</li>";
}
}); });
Object.keys(data.content[k][16]).forEach(function(m) { Object.keys(data.content[k][16]).forEach(function(m) {
if(data.content[k][16][m][0] != ''){
mihtml += "<li>" + data.content[k][16][m][0] + ":" + commafy(data.content[k][16][m][1]) + "</li>"; mihtml += "<li>" + data.content[k][16][m][0] + ":" + commafy(data.content[k][16][m][1]) + "</li>";
}
}); });
Object.keys(data.content[k][18]).forEach(function(m) { Object.keys(data.content[k][18]).forEach(function(m) {
mihtml += "<li>" + data.content[k][18][m][0] + ":" + commafy(data.content[k][18][m][1]) + "</li>"; mihtml += "<li>" + data.content[k][18][m][0] + ":" + commafy(data.content[k][18][m][1]) + "</li>";
@ -548,7 +554,12 @@ foreach ($res as $data) {
<?php <?php
$idx = 1; $idx = 1;
$item_amt_B_all = 0; $item_amt_B_all = 0;
$total_qty = 0;
foreach ($option_arr as $item_no => $val) { foreach ($option_arr as $item_no => $val) {
if($val['item_qty'] <= 0){
continue;
}
$total_qty = $total_qty + $val['item_qty'];
$item_amt_B_all += $val["item_price_bp"]; $item_amt_B_all += $val["item_price_bp"];
?> ?>
<tr> <tr>
@ -564,10 +575,12 @@ foreach ($res as $data) {
$idx++; $idx++;
} }
?> ?>
<?php if($total_qty > 0): ?>
<tr> <tr>
<td colspan="4">小計</td> <td colspan="4">小計</td>
<td colspan="3"><input type="text" name="option_amt" id="option_amt" class="form-control dollar-right" size="8" value="<?= number_format($item_amt_B_all); ?>"></td> <td colspan="3"><input type="text" name="option_amt" id="option_amt" class="form-control dollar-right" size="8" value="<?= number_format($item_amt_B_all); ?>"></td>
</tr> </tr>
<?php endif; ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -874,7 +887,7 @@ foreach ($res as $data) {
<input type="text" name="qty_total" id="qty_total" value="<?= number_format($data["qty_total"]); ?>"> <input type="text" name="qty_total" id="qty_total" value="<?= number_format($data["qty_total"]); ?>">
</div> </div>
<div> <div>
<label for="special_fee">特殊費用</label> <label for="special_fee">服務費</label>
<input type="text" name="special_fee" id="special_fee" value="<?php echo number_format($data["special_fee"]); ?>"> <input type="text" name="special_fee" id="special_fee" value="<?php echo number_format($data["special_fee"]); ?>">
</div> </div>
<div> <div>
@ -923,6 +936,9 @@ foreach ($res as $data) {
</tr> </tr>
</tbody> </tbody>
</table> </table>
<ul style="display:block">
<li>營業權限85%以上;85-80%呈至區處長審核;80%以下呈至總經理審核。</li>
</ul>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">

393
wms/mkt/pricereview-create.php

@ -47,6 +47,7 @@ if (count($last_pr_arr) > 0) {
$last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"]; $last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"];
} }
} }
mysqli_free_result($res); mysqli_free_result($res);
$sql = "select * from pricereview_pay where mid = '" . $last_pr_arr["id"] . "' order by pay_kind"; $sql = "select * from pricereview_pay where mid = '" . $last_pr_arr["id"] . "' order by pay_kind";
@ -143,6 +144,7 @@ while ($row = mysqli_fetch_assoc($res)) {
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["unit"] = $row["unit"]; $opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["unit"] = $row["unit"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["price"] = $row["price"]; $opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["price"] = $row["price"];
} }
mysqli_free_result($res); mysqli_free_result($res);
$option_str = '<table id="table_index2" class="table table-striped table-bordered" style="width:100%">'; $option_str = '<table id="table_index2" class="table table-striped table-bordered" style="width:100%">';
$option_str .= '<thead> $option_str .= '<thead>
@ -193,101 +195,136 @@ foreach ($opt_data_arr as $k => $v) {
*/ */
} }
$option_str .= "</tbody></table>"; $option_str .= "</tbody></table>";
?> ?>
<style> <style>
.c_iframe iframe { .c_iframe iframe {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.c_iframe { .c_iframe {
width: 1350px; width: 1350px;
height: 500px; height: 500px;
margin-right: auto; margin-right: auto;
margin-left: auto; margin-left: auto;
} }
.container { .container {
width: 1350px; width: 1350px;
} }
.nextline { .nextline {
width: 100%; width: 100%;
height: 0; height: 0;
} }
#btnadd, #btnadd2, #btnadd3, #btnadd4, a[name=btndel], a[name=btndel2], a[name=btndel3], a[name=btndel4] {
#btnadd,
#btnadd2,
#btnadd3,
#btnadd4,
a[name=btndel],
a[name=btndel2],
a[name=btndel3],
a[name=btndel4] {
margin-left: 4px; margin-left: 4px;
} }
tr th svg { tr th svg {
vertical-align: text-top; vertical-align: text-top;
} }
tr select { tr select {
margin: 8px; margin: 8px;
} }
.modal-dialog { .modal-dialog {
width: 1200px; width: 1200px;
} }
.modal-content { .modal-content {
height:660px; height: 760px;
} }
#optionModal .modal-body { #optionModal .modal-body {
height: 540px; height: 540px;
overflow-y: auto; overflow-y: auto;
} }
#optionFaciModal .modal-body { #optionFaciModal .modal-body {
font-size: 16px; font-size: 16px;
} }
#optionFaciModal .modal-dialog { #optionFaciModal .modal-dialog {
margin-top: 200px; margin-top: 200px;
width: 400px; width: 400px;
} }
#optionFaciModal .modal-content { #optionFaciModal .modal-content {
height: auto; height: auto;
} }
ol li { ol li {
margin-left: -20px; margin-left: -20px;
line-height: 160%; line-height: 160%;
} }
a[name=optdel] { a[name=optdel] {
font-size: 13px; font-size: 13px;
text-decoration: none; text-decoration: none;
} }
.dollar-right { .dollar-right {
text-align: right; text-align: right;
} }
.kind-title { .kind-title {
background-color: black; background-color: black;
color: white; color: white;
font-size: 18px; font-size: 18px;
} }
.kind-col { .kind-col {
color: brown; color: brown;
} }
.col-md-6 { .col-md-6 {
width: 100%; width: 100%;
} }
#table_index2_filter label { #table_index2_filter label {
width: 30%; width: 30%;
} }
#table_index2 { #table_index2 {
cursor: pointer; cursor: pointer;
} }
.notice { .notice {
margin: 0 0 -2px 10px; margin: 0 0 -2px 10px;
color: red; color: red;
} }
.btn2:hover { .btn2:hover {
color: #fff; color: #fff;
} }
button[name=btnpost] { button[name=btnpost] {
margin-top: 12px; margin-top: 12px;
} }
input[type=checkbox] { input[type=checkbox] {
margin: 8px; margin: 8px;
} }
.star { .star {
color: red; color: red;
font-weight: bold; font-weight: bold;
} }
</style> </style>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script defer src="../contract/js/alpinejs/cdn.min.js"></script>
<script> <script>
// 加千分位 // 加千分位
function commafy(num) { function commafy(num) {
@ -471,7 +508,25 @@ function selEX(o) {
$(function() { $(function() {
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
$(document).ready(function() {
$('input[name=pay_scale]').each(function() {
if ($(this).val() != '') {
// console.log($(this).val());
$(this).closest('td').next('td').find('input[name=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g, "") / 100 * $(this).val()).toFixed(0)));
var payAllScale = 0;
var payAllAmt = 0;
$("input[name=pay_scale]").each(function() {
payAllScale += Number($(this).val().replace(/[,]+/g, ""))
});
$("input[name=pay_amount]").each(function() {
payAllAmt += Number($(this).val().replace(/[,]+/g, ""))
});
$("input[name=pay_all_scale]").val(commafy(payAllScale));
$("input[name=pay_all_amount]").val(commafy(payAllAmt));
}
})
})
$('#table_index2').DataTable({ $('#table_index2').DataTable({
"language": { "language": {
"zeroRecords": "沒有符合的結果", "zeroRecords": "沒有符合的結果",
@ -529,10 +584,18 @@ $(function(){
}); });
}); });
$('#deposit_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); $('#deposit_rate').keyup(function() {
$('#keep_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1'));
$('#warranty_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); });
$('#special_fee').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); $('#keep_rate').keyup(function() {
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1'));
});
$('#warranty_rate').keyup(function() {
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1'));
});
$('#special_fee').keyup(function() {
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
});
/* /*
// for 動態表格的作法:event delegation // for 動態表格的作法:event delegation
$('#tb1').on('click', $("input[name='item_qty']"), function(){ $('#tb1').on('click', $("input[name='item_qty']"), function(){
@ -679,11 +742,14 @@ $(function(){
var jobj = $(this); // 父視窗 var jobj = $(this); // 父視窗
$("#optionModal .modal-body td").unbind().click(function() { $("#optionModal .modal-body td").unbind().click(function() {
var pobj = $(this).closest('td').parent(); var pobj = $(this).closest('td').parent();
jobj.html(pobj.find('td').eq(0).html()+' '+pobj.find('td').eq(1).html()); console.log(jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html()));
console.log(pobj.find('td').eq(0).html()+ pobj.find('td').eq(2).html() + ' ' + pobj.find('td').eq(1).html());
jobj.html(pobj.find('td').eq(0).html() + ' ' + pobj.find('td').eq(1).html() + '<br />(' + pobj.find('td').eq(2).html() + ')');
jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(5).html()); jobj.closest('td').parent().find('input[name=option_unit_price]').val(pobj.find('td').eq(5).html());
jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(5).html().replace(/[,]+/g, "") * jobj.closest('td').parent().find('input[name=option_qty]').val().replace(/[,]+/g, ""))); jobj.closest('td').parent().find('input[name=option_price_bp]').val(commafy(pobj.find('td').eq(5).html().replace(/[,]+/g, "") * jobj.closest('td').parent().find('input[name=option_qty]').val().replace(/[,]+/g, "")));
jobj.closest('td').parent().find('input[name=op_id]').val(pobj.find('input[name=option_id]').val()); jobj.closest('td').parent().find('input[name=op_id]').val(pobj.find('input[name=option_id]').val());
$("#optionModal").modal('hide'); $("#optionModal").modal('hide');
}); });
}); });
$("#optionFaciModal").on("hidden.bs.modal", function() { $("#optionFaciModal").on("hidden.bs.modal", function() {
@ -730,6 +796,37 @@ $(function(){
return false; return false;
} }
}); });
$('#tb3').on('click', 'a[name=btnfaci]', function() {
var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('a[name=option_href]').html() != '點選') {
var k = 1;
$("input[name=item_spec]").each(function() {
if ($(this).val() == '') return;
var objInput = document.createElement("input");
objInput.setAttribute("type", "checkbox");
objInput.setAttribute("name", "sub_faci");
objInput.setAttribute("value", k + '.' + $(this).val());
$("#optionFaciModal .modal-body").append(objInput);
$("#optionFaciModal .modal-body").append(k + '.' + $(this).val());
$("#optionFaciModal .modal-body").append("<br>");
k++;
});
$("#optionFaciModal .modal-body").append("<p><button type='button' name='btnpost' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>確定</span></button></p>");
$("#optionFaciModal").modal('show');
var str = "";
$("button[name=btnpost]").click(function() {
$('input[name=sub_faci]').each(function() {
if ($(this).prop('checked')) {
str += $(this).val() + "<br>";
}
});
jobj.closest('td').parent().find('td[name=option_relate_facil]').html(str);
});
} else {
alert("請先新增OPTION");
return false;
}
});
$('#tb4').on('click', 'a[name=btnfaci]', function() { $('#tb4').on('click', 'a[name=btnfaci]', function() {
var jobj = $(this); // 父視窗 var jobj = $(this); // 父視窗
if (jobj.closest('td').parent().find('select[name=mn_kind]').val() != '') { if (jobj.closest('td').parent().find('select[name=mn_kind]').val() != '') {
@ -763,6 +860,7 @@ $(function(){
return false; return false;
} }
}); });
$("input[name=pay_scale]").keyup(function() { $("input[name=pay_scale]").keyup(function() {
$(this).closest('td').next('td').find('input[name=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g, "") / 100 * $(this).val()).toFixed(0))); $(this).closest('td').next('td').find('input[name=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g, "") / 100 * $(this).val()).toFixed(0)));
var payAllScale = 0; var payAllScale = 0;
@ -822,49 +920,79 @@ $(function(){
$('button[name=submit],button[name=save').click(function() { $('button[name=submit],button[name=save').click(function() {
var itemFpidArr = []; var itemFpidArr = [];
$("input[name='fp_id']").each(function(){ if ($(this).val() != '') itemFpidArr.push($(this).val()); }) $("input[name='fp_id']").each(function() {
if ($(this).val() != '') itemFpidArr.push($(this).val());
})
$('#fp_id_all').val(itemFpidArr); $('#fp_id_all').val(itemFpidArr);
var fpKindArr = []; var fpKindArr = [];
$("select[name='fp_kind']").each(function(){ if ($(this).val() != '') fpKindArr.push($(this).val()); }) $("select[name='fp_kind']").each(function() {
if ($(this).val() != '') fpKindArr.push($(this).val());
})
$('#fp_kind_all').val(fpKindArr); $('#fp_kind_all').val(fpKindArr);
var fpSeatArr = []; var fpSeatArr = [];
$("select[name='fp_seat']").each(function(){ if ($(this).val() != '') fpSeatArr.push($(this).val()); }) $("select[name='fp_seat']").each(function() {
if ($(this).val() != '') fpSeatArr.push($(this).val());
})
$('#fp_seat_all').val(fpSeatArr); $('#fp_seat_all').val(fpSeatArr);
var fpNumberofstopArr = []; var fpNumberofstopArr = [];
$("input[name='fp_numberofstop']").each(function(){ if ($(this).val() != '') fpNumberofstopArr.push($(this).val()); }) $("input[name='fp_numberofstop']").each(function() {
if ($(this).val() != '') fpNumberofstopArr.push($(this).val());
})
$('#fp_numberofstop_all').val(fpNumberofstopArr); $('#fp_numberofstop_all').val(fpNumberofstopArr);
var fpSpeedArr = []; var fpSpeedArr = [];
$("select[name='fp_speed']").each(function(){ if ($(this).val() != '') fpSpeedArr.push($(this).val()); }) $("select[name='fp_speed']").each(function() {
if ($(this).val() != '') fpSpeedArr.push($(this).val());
})
$('#fp_speed_all').val(fpSpeedArr); $('#fp_speed_all').val(fpSpeedArr);
var itemOpArr = []; var itemOpArr = [];
$("select[name='item_op']").each(function(){ if ($(this).val() != '') itemOpArr.push($(this).val()); }) $("select[name='item_op']").each(function() {
if ($(this).val() != '') itemOpArr.push($(this).val());
})
$('#item_op_all').val(itemOpArr); $('#item_op_all').val(itemOpArr);
var itemWeightArr = []; var itemWeightArr = [];
$("input[name='item_weight']").each(function(){ if ($(this).val() != '') itemWeightArr.push($(this).val()); }) $("input[name='item_weight']").each(function() {
if ($(this).val() != '') itemWeightArr.push($(this).val());
})
$('#item_weight_all').val(itemWeightArr); $('#item_weight_all').val(itemWeightArr);
var itemSpecArr = []; var itemSpecArr = [];
$("input[name='item_spec']").each(function(){ itemSpecArr.push($(this).val()); }) $("input[name='item_spec']").each(function() {
itemSpecArr.push($(this).val());
})
$('#item_spec_all').val(itemSpecArr); $('#item_spec_all').val(itemSpecArr);
var itemGroupArr = []; var itemGroupArr = [];
$("input[name='item_group']").each(function(){ itemGroupArr.push($(this).val()); }) $("input[name='item_group']").each(function() {
itemGroupArr.push($(this).val());
})
$('#item_group_all').val(itemGroupArr); $('#item_group_all').val(itemGroupArr);
var itemUnitPriceArr = []; var itemUnitPriceArr = [];
$("input[name='item_unit_price']").each(function(){ itemUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_unit_price']").each(function() {
itemUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_unit_price_all').val(itemUnitPriceArr); $('#item_unit_price_all').val(itemUnitPriceArr);
var itemQtyArr = []; var itemQtyArr = [];
$("input[name='item_qty']").each(function(){ itemQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_qty']").each(function() {
itemQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_qty_all').val(itemQtyArr); $('#item_qty_all').val(itemQtyArr);
var itemQtyOriArr = []; var itemQtyOriArr = [];
$("input[name='item_qty_ori']").each(function(){ itemQtyOriArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_qty_ori']").each(function() {
itemQtyOriArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_qty_ori_all').val(itemQtyOriArr); $('#item_qty_ori_all').val(itemQtyOriArr);
var itemPriceBpArr = []; var itemPriceBpArr = [];
$("input[name='item_price_bp']").each(function(){ itemPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_price_bp']").each(function() {
itemPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_bp_all').val(itemPriceBpArr); $('#item_price_bp_all').val(itemPriceBpArr);
var itemPriceCtArr = []; var itemPriceCtArr = [];
$("input[name='item_price_ct']").each(function(){ itemPriceCtArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_price_ct']").each(function() {
itemPriceCtArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_ct_all').val(itemPriceCtArr); $('#item_price_ct_all').val(itemPriceCtArr);
var itemPriceArr = []; var itemPriceArr = [];
$("input[name='item_price']").each(function(){ itemPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_price']").each(function() {
itemPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_all').val(itemPriceArr); $('#item_price_all').val(itemPriceArr);
var grossProfitArr = []; var grossProfitArr = [];
$("input[name='gross_profit']").each(function() { $("input[name='gross_profit']").each(function() {
@ -872,88 +1000,144 @@ $(function(){
}) })
$('#gross_profit_all').val(grossProfitArr); $('#gross_profit_all').val(grossProfitArr);
var pvRateArr = []; var pvRateArr = [];
$("input[name='pv_rate']").each(function(){ pvRateArr.push($(this).val()); }) $("input[name='pv_rate']").each(function() {
pvRateArr.push($(this).val());
})
$('#pv_rate_all').val(pvRateArr); $('#pv_rate_all').val(pvRateArr);
var noteArr = []; var noteArr = [];
$("input[name='note']").each(function(){ noteArr.push($(this).val()); }) $("input[name='note']").each(function() {
noteArr.push($(this).val());
})
$('#note_all').val(noteArr); $('#note_all').val(noteArr);
var payKindArr = []; var payKindArr = [];
$("input[name='pay_kind']").each(function(){ payKindArr.push($(this).val()); }) $("input[name='pay_kind']").each(function() {
payKindArr.push($(this).val());
})
$('#pay_kind_all').val(payKindArr); $('#pay_kind_all').val(payKindArr);
var payScaleArr = []; var payScaleArr = [];
$("input[name='pay_scale']").each(function(){ payScaleArr.push($(this).val()); }) $("input[name='pay_scale']").each(function() {
payScaleArr.push($(this).val());
})
$('#pay_scale_all').val(payScaleArr); $('#pay_scale_all').val(payScaleArr);
var payAmountArr = []; var payAmountArr = [];
$("input[name='pay_amount']").each(function(){ payAmountArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='pay_amount']").each(function() {
payAmountArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#pay_amount_all').val(payAmountArr); $('#pay_amount_all').val(payAmountArr);
var payPeriodArr = []; var payPeriodArr = [];
$("select[name='pay_period']").each(function(){ payPeriodArr.push($(this).val()); }) $("select[name='pay_period']").each(function() {
payPeriodArr.push($(this).val());
})
$('#pay_period_all').val(payPeriodArr); $('#pay_period_all').val(payPeriodArr);
var itemOpidArr = []; var itemOpidArr = [];
$("input[name='op_id']").each(function(){ itemOpidArr.push($(this).val()); }) $("input[name='op_id']").each(function() {
itemOpidArr.push($(this).val());
})
$('#op_id_all').val(itemOpidArr); $('#op_id_all').val(itemOpidArr);
var optionSeatArr = []; var optionSeatArr = [];
$("td[name='option_seat'] a").each(function(){ optionSeatArr.push($(this).html()+"@@"); }) $("td[name='option_seat'] a").each(function() {
optionSeatArr.push($(this).html() + "@@");
})
$('#option_seat_all').val(optionSeatArr); $('#option_seat_all').val(optionSeatArr);
var optionUnitPriceArr = []; var optionUnitPriceArr = [];
$("input[name='option_unit_price']").each(function(){ optionUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='option_unit_price']").each(function() {
optionUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#option_unit_price_all').val(optionUnitPriceArr); $('#option_unit_price_all').val(optionUnitPriceArr);
var optionQtyArr = []; var optionQtyArr = [];
$("input[name='option_qty']").each(function(){ optionQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='option_qty']").each(function() {
optionQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#option_qty_all').val(optionQtyArr); $('#option_qty_all').val(optionQtyArr);
var optionPriceBpArr = []; var optionPriceBpArr = [];
$("input[name='option_price_bp']").each(function(){ optionPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='option_price_bp']").each(function() {
optionPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#option_price_bp_all').val(optionPriceBpArr); $('#option_price_bp_all').val(optionPriceBpArr);
var optionMemoArr = []; var optionMemoArr = [];
$("input[name='option_memo']").each(function(){ optionMemoArr.push($(this).val()+"@@"); }) $("input[name='option_memo']").each(function() {
optionMemoArr.push($(this).val() + "@@");
})
$('#option_memo_all').val(optionMemoArr); $('#option_memo_all').val(optionMemoArr);
var optionRelateFacilArr = []; var optionRelateFacilArr = [];
$("td[name='option_relate_facil']").each(function(){ optionRelateFacilArr.push($(this).html()); }) $("td[name='option_relate_facil']").each(function() {
optionRelateFacilArr.push($(this).html());
})
$('#option_relate_facil_all').val(optionRelateFacilArr); $('#option_relate_facil_all').val(optionRelateFacilArr);
var mnIdArr = []; var mnIdArr = [];
$("input[name='mn_id']").each(function(){ mnIdArr.push($(this).val()); }) $("input[name='mn_id']").each(function() {
mnIdArr.push($(this).val());
})
$('#mn_id_all').val(mnIdArr); $('#mn_id_all').val(mnIdArr);
var mnKindArr = []; var mnKindArr = [];
$("select[name='mn_kind']").each(function(){ mnKindArr.push($(this).val()); }) $("select[name='mn_kind']").each(function() {
mnKindArr.push($(this).val());
})
$('#mn_kind_all').val(mnKindArr); $('#mn_kind_all').val(mnKindArr);
var mnSeatArr = []; var mnSeatArr = [];
$("select[name='mn_seat']").each(function(){ mnSeatArr.push($(this).val()); }) $("select[name='mn_seat']").each(function() {
mnSeatArr.push($(this).val());
})
$('#mn_seat_all').val(mnSeatArr); $('#mn_seat_all').val(mnSeatArr);
var mnNumberofstopArr = []; var mnNumberofstopArr = [];
$("input[name='mn_numberofstop']").each(function(){ mnNumberofstopArr.push($(this).val()); }) $("input[name='mn_numberofstop']").each(function() {
mnNumberofstopArr.push($(this).val());
})
$('#mn_numberofstop_all').val(mnNumberofstopArr); $('#mn_numberofstop_all').val(mnNumberofstopArr);
var mnSpeedArr = []; var mnSpeedArr = [];
$("select[name='mn_speed']").each(function(){ mnSpeedArr.push($(this).val()); }) $("select[name='mn_speed']").each(function() {
mnSpeedArr.push($(this).val());
})
$('#mn_speed_all').val(mnSpeedArr); $('#mn_speed_all').val(mnSpeedArr);
var mnUnitPriceArr = []; var mnUnitPriceArr = [];
$("input[name='mn_unit_price']").each(function(){ mnUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='mn_unit_price']").each(function() {
mnUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#mn_unit_price_all').val(mnUnitPriceArr); $('#mn_unit_price_all').val(mnUnitPriceArr);
var mnQtyArr = []; var mnQtyArr = [];
$("input[name='mn_qty']").each(function(){ mnQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='mn_qty']").each(function() {
mnQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#mn_qty_all').val(mnQtyArr); $('#mn_qty_all').val(mnQtyArr);
var mnPriceBpArr = []; var mnPriceBpArr = [];
$("input[name='mn_price_bp']").each(function(){ mnPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='mn_price_bp']").each(function() {
mnPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#mn_price_bp_all').val(mnPriceBpArr); $('#mn_price_bp_all').val(mnPriceBpArr);
var mnMemoArr = []; var mnMemoArr = [];
$("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); }) $("input[name='mn_memo']").each(function() {
mnMemoArr.push($(this).val() + "@@");
})
$('#mn_memo_all').val(mnMemoArr); $('#mn_memo_all').val(mnMemoArr);
var mnRelateFacilArr = []; var mnRelateFacilArr = [];
$("td[name='mn_relate_facil']").each(function(){ mnRelateFacilArr.push($(this).html()); }) $("td[name='mn_relate_facil']").each(function() {
mnRelateFacilArr.push($(this).html());
})
$('#mn_relate_facil_all').val(mnRelateFacilArr); $('#mn_relate_facil_all').val(mnRelateFacilArr);
var exNoteArr = []; var exNoteArr = [];
$("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); }) $("input[name='except_note']").each(function() {
exNoteArr.push($(this).val());
})
$('#except_note_all').val(exNoteArr); $('#except_note_all').val(exNoteArr);
var exSpecArr = []; var exSpecArr = [];
$("input[name='except_spec']").each(function(){ exSpecArr.push($(this).val()); }) $("input[name='except_spec']").each(function() {
exSpecArr.push($(this).val());
})
$('#except_spec_all').val(exSpecArr); $('#except_spec_all').val(exSpecArr);
var exUnitPriceArr = []; var exUnitPriceArr = [];
$("input[name='except_unit_price']").each(function(){ exUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='except_unit_price']").each(function() {
exUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#except_unit_price_all').val(exUnitPriceArr); $('#except_unit_price_all').val(exUnitPriceArr);
var exQtyArr = []; var exQtyArr = [];
$("input[name='except_qty']").each(function(){ exQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='except_qty']").each(function() {
exQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#except_qty_all').val(exQtyArr); $('#except_qty_all').val(exQtyArr);
var exPriceBpArr = []; var exPriceBpArr = [];
$("input[name='except_price_bp']").each(function(){ exPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='except_price_bp']").each(function() {
exPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#except_price_bp_all').val(exPriceBpArr); $('#except_price_bp_all').val(exPriceBpArr);
$("input[name='pmstatus']").val($(this).val()); $("input[name='pmstatus']").val($(this).val());
@ -990,6 +1174,14 @@ $(function(){
}); });
}); });
</script> </script>
<?php
require_once('./conn.php');
$sql_str = "SELECT * FROM option_price WHERE status='Y' ORDER BY kind ASC";
$stmt = $conn->prepare($sql_str);
$stmt->execute();
$options = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<div> <div>
<ul class="notice"> <ul class="notice">
<li>「保存」:儲存價審單內容</li> <li>「保存」:儲存價審單內容</li>
@ -1018,7 +1210,7 @@ $(function(){
</div> </div>
</div> </div>
<!--子窗:option加價--> <!--子窗:option加價-->
<div class="modal fade" id="optionModal" tabindex="-1" role="dialog" aria-labelledby="optionModalTitle" aria-hidden="true"> <div class="modal fade" id="optionModal" tabindex="-1" role="dialog" aria-labelledby="optionModalTitle" aria-hidden="true" x-data=pricereviewOptionSelect()>
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -1026,9 +1218,49 @@ $(function(){
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<label for="" >
<input type="text" class="form-control" style="float:left" placeholder="搜尋..." x-model="searchtext" @keyup="searchOptions($event)" />
</label>
<div class="categories">
<button :class="['btn', (kind==0) ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory(0)">顯示全部</button>
<button :class="['btn', (kind=='A') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('A')">A-1 車廂意匠</button>
<button :class="['btn', (kind=='B') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('B')">A-2 車廂內裝</button>
<button :class="['btn', (kind=='C') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('C')">A-3 車廂外部</button>
<button :class="['btn', (kind=='D') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('D')">A-4 控制與其他</button>
<button :class="['btn', (kind=='E') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('E')">B-1 平台梯</button>
<button :class="['btn', (kind=='F') ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('F')">C-1 汰改</button>
<br /><br />
<template x-for="button in buttons" >
<button style="margin-right:3px" :class="['btn', (button.type == subkind) ? 'btn-primary' : 'btn-secondary text-light']" @click="changeCategory('sub', button.type)" x-text="button.name"></button>
</template>
</div>
</div> </div>
<div class="modal-body" > <div class="modal-body" >
<?php echo $option_str; ?> <table id="" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr class="kind-col">
<th scope="col" nowrap>名稱</th>
<th scope="col" nowrap>規格</th>
<th scope="col" nowrap>備註</th>
<th scope="col" nowrap>配置</th>
<th scope="col" nowrap>單位</th>
<th scope="col" nowrap>定價</th>
</tr>
</thead>
<tbody>
<template x-for="option in options" >
<tr style="cursor:pointer">
<td x-text="option.group_name"> </td>
<td x-text="option.spec"></td>
<td x-text="option.memo"></td>
<td x-text="optionalArr[option.optional]"></td>
<td x-text="option.unit"></td>
<td x-text="option.price"></td>
</tr>
</template>
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
@ -1654,12 +1886,14 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯項次">所屬電梯 <th class="star">
<div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯項次">所屬電梯
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" /> <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" /> <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
</svg> </svg>
</div></th> </div>
</th>
<th>功能</th> <th>功能</th>
</tr> </tr>
</thead> </thead>
@ -1670,7 +1904,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
?> ?>
<tr name="option_templ"> <tr name="option_templ">
<td name="option_seat"> <td name="option_seat">
<a href="" name="option_href" data-toggle="modal"><?php echo $v["item_spec"]; ?></a> <a href="" name="option_href" data-toggle="modal"><?php echo $v["item_spec"] . '-(' . $v['item_memo'] . ')'; ?></a>
</td> </td>
<td><input type="text" name="option_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td> <td><input type="text" name="option_unit_price" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_unit_price"]); ?>" readonly></td>
<td><input type="text" name="option_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["item_qty"]; ?>"></td> <td><input type="text" name="option_qty" class="form-control" size="2" maxlength="2" value="<?php echo $v["item_qty"]; ?>"></td>
@ -1710,7 +1944,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
?> ?>
<tr name="option_templ"> <tr name="option_templ">
<td name="option_seat"> <td name="option_seat">
<a href="" name="option_href" data-toggle="modal">點選</a> <a href="" name="option_href" data-toggle="modal" @click="searchtext = ''">點選</a>
</td> </td>
<td><input type="text" name="option_unit_price" class="form-control dollar-right" size="8" value="<?php echo (isset($v["option_price"])) ? number_format($v["option_price"]) : 0; ?>" readonly></td> <td><input type="text" name="option_unit_price" class="form-control dollar-right" size="8" value="<?php echo (isset($v["option_price"])) ? number_format($v["option_price"]) : 0; ?>" readonly></td>
<td><input type="text" name="option_qty" class="form-control" size="2" maxlength="2" value="<?php echo (isset($v["option_num"])) ? $v["option_num"] : 0; ?>"></td> <td><input type="text" name="option_qty" class="form-control" size="2" maxlength="2" value="<?php echo (isset($v["option_num"])) ? $v["option_num"] : 0; ?>"></td>
@ -1758,8 +1992,10 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="except_qty" class="form-control" size="4" maxlength="4" value="<?php echo $v["item_qty"]; ?>"><input type="hidden" name="except_qty_ori" value="<?php echo $v["item_qty"]; ?>"></td> <td><input type="text" name="except_qty" class="form-control" size="4" maxlength="4" value="<?php echo $v["item_qty"]; ?>"><input type="hidden" name="except_qty_ori" value="<?php echo $v["item_qty"]; ?>"></td>
<td><input type="text" name="except_price_bp" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly> <td><input type="text" name="except_price_bp" class="form-control dollar-right" size="8" value="<?php echo number_format($v["item_price_bp"]); ?>" readonly>
<input type="hidden" name="item_group" value="E"> <input type="hidden" name="item_group" value="E">
<a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a>
</td> </td>
<td name="mn_relate_facil" nowrap></td>
</tr> </tr>
<?php <?php
} }
@ -1771,8 +2007,10 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8"></td> <td><input type="text" name="except_unit_price" class="form-control dollar-right" size="8"></td>
<td><input type="text" name="except_qty" class="form-control" size="4" maxlength="4"></td> <td><input type="text" name="except_qty" class="form-control" size="4" maxlength="4"></td>
<td><input type="text" name="except_price_bp" class="form-control dollar-right" size="8" readonly> <td><input type="text" name="except_price_bp" class="form-control dollar-right" size="8" readonly>
<a href="javascript:void(0);" name="btnfaci" class="btn btn-danger btn-sm">電梯</a>
<a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a> <a href="javascript:void(0);" name="btndel3" class="btn btn-danger btn-sm">X</a>
</td> </td>
<td name="mn_relate_facil" nowrap></td>
</tr> </tr>
<?php <?php
} }
@ -1800,7 +2038,9 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<th>數量(月)</th> <th>數量(月)</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star">所屬電梯</div></th> <th class="star">所屬電梯
</div>
</th>
<th>功能</th> <th>功能</th>
</tr> </tr>
</thead> </thead>
@ -1955,13 +2195,13 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<tr> <tr>
<td rowspan="4">材料</td> <td rowspan="4">材料</td>
<td>1、訂金<input type="hidden" name="pay_kind" value="1"></td> <td>1、訂金<input type="hidden" name="pay_kind" value="1"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[1]["pay_scale"]; ?>"></td> <td><input type="text" id="pay_scale1" name="pay_scale" class="form-control" size="3" value="<?php echo empty(@$last_prpay_arr[1]["pay_scale"]) ? 20 : @$last_prpay_arr[1]["pay_scale"]; ?>"></td>
<td id="pay1"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[1]["pay_amount"]); ?>" readonly></td> <td id="pay1"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[1]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
<option value=""></option> <option value=""></option>
<option value="7" <?php if (@$last_prpay_arr[1]["pay_period"] == "7") echo " selected"; ?>>7天</option> <option value="7" <?php if (@$last_prpay_arr[1]["pay_period"] == "7") echo " selected"; ?>>7天</option>
<option value="30"<?php if (@$last_prpay_arr[1]["pay_period"]=="30") echo " selected"; ?>>30天</option> <option value="30" <?php if (@$last_prpay_arr[1]["pay_period"] == "30" || @$last_prpay_arr[1]["pay_period"] == "") echo " selected"; ?>>30天</option>
<option value="60" <?php if (@$last_prpay_arr[1]["pay_period"] == "60") echo " selected"; ?>>60天</option> <option value="60" <?php if (@$last_prpay_arr[1]["pay_period"] == "60") echo " selected"; ?>>60天</option>
<option value="90" <?php if (@$last_prpay_arr[1]["pay_period"] == "90") echo " selected"; ?>>90天</option> <option value="90" <?php if (@$last_prpay_arr[1]["pay_period"] == "90") echo " selected"; ?>>90天</option>
<option value="120" <?php if (@$last_prpay_arr[1]["pay_period"] == "120") echo " selected"; ?>>120天</option> <option value="120" <?php if (@$last_prpay_arr[1]["pay_period"] == "120") echo " selected"; ?>>120天</option>
@ -1972,7 +2212,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
</tr> </tr>
<tr> <tr>
<td>2、二次款<input type="hidden" name="pay_kind" value="2"></td> <td>2、二次款<input type="hidden" name="pay_kind" value="2"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[2]["pay_scale"]; ?>"></td> <td><input type="text" id="pay_scale2" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[2]["pay_scale"]; ?>"></td>
<td id="pay2"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[2]["pay_amount"]); ?>" readonly></td> <td id="pay2"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[2]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
@ -1989,13 +2229,13 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
</tr> </tr>
<tr> <tr>
<td>3、貨到工地款<input type="hidden" name="pay_kind" value="3"></td> <td>3、貨到工地款<input type="hidden" name="pay_kind" value="3"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[3]["pay_scale"]; ?>"></td> <td><input type="text" id="pay_scale3" name="pay_scale" class="form-control" size="3" value="<?php echo empty(@$last_prpay_arr[3]["pay_scale"]) ? 50 : @$last_prpay_arr[3]["pay_scale"]; ?>"></td>
<td id="pay3"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[3]["pay_amount"]); ?>" readonly></td> <td id="pay3"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[3]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
<option value=""></option> <option value=""></option>
<option value="7" <?php if (@$last_prpay_arr[3]["pay_period"] == "7") echo " selected"; ?>>7天</option> <option value="7" <?php if (@$last_prpay_arr[3]["pay_period"] == "7") echo " selected"; ?>>7天</option>
<option value="30"<?php if (@$last_prpay_arr[3]["pay_period"]=="30") echo " selected"; ?>>30天</option> <option value="30" <?php if (@$last_prpay_arr[3]["pay_period"] == "30" || @$last_prpay_arr[3]["pay_period"] == "") echo " selected"; ?>>30天</option>
<option value="60" <?php if (@$last_prpay_arr[3]["pay_period"] == "60") echo " selected"; ?>>60天</option> <option value="60" <?php if (@$last_prpay_arr[3]["pay_period"] == "60") echo " selected"; ?>>60天</option>
<option value="90" <?php if (@$last_prpay_arr[3]["pay_period"] == "90") echo " selected"; ?>>90天</option> <option value="90" <?php if (@$last_prpay_arr[3]["pay_period"] == "90") echo " selected"; ?>>90天</option>
<option value="120" <?php if (@$last_prpay_arr[3]["pay_period"] == "120") echo " selected"; ?>>120天</option> <option value="120" <?php if (@$last_prpay_arr[3]["pay_period"] == "120") echo " selected"; ?>>120天</option>
@ -2006,7 +2246,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
</tr> </tr>
<tr> <tr>
<td>4、其它<input type="hidden" name="pay_kind" value="4"></td> <td>4、其它<input type="hidden" name="pay_kind" value="4"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[4]["pay_scale"]; ?>"></td> <td><input type="text" id="pay_scale4" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[4]["pay_scale"]; ?>"></td>
<td id="pay4"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[4]["pay_amount"]); ?>" readonly></td> <td id="pay4"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[4]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
@ -2024,13 +2264,13 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<tr> <tr>
<td rowspan="3">安裝</td> <td rowspan="3">安裝</td>
<td>5、安裝完畢款<input type="hidden" name="pay_kind" value="5"></td> <td>5、安裝完畢款<input type="hidden" name="pay_kind" value="5"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[5]["pay_scale"]; ?>"></td> <td><input type="text" id="pay_scale5" name="pay_scale" class="form-control" size="3" value="<?php echo empty(@$last_prpay_arr[5]["pay_scale"]) ? 20 : @$last_prpay_arr[5]["pay_scale"]; ?>"></td>
<td id="pay5"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[5]["pay_amount"]); ?>" readonly></td> <td id="pay5"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[5]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
<option value=""></option> <option value=""></option>
<option value="7" <?php if (@$last_prpay_arr[5]["pay_period"] == "7") echo " selected"; ?>>7天</option> <option value="7" <?php if (@$last_prpay_arr[5]["pay_period"] == "7") echo " selected"; ?>>7天</option>
<option value="30"<?php if (@$last_prpay_arr[5]["pay_period"]=="30") echo " selected"; ?>>30天</option> <option value="30" <?php if (@$last_prpay_arr[5]["pay_period"] == "30" || @$last_prpay_arr[5]["pay_period"] == "") echo " selected"; ?>>30天</option>
<option value="60" <?php if (@$last_prpay_arr[5]["pay_period"] == "60") echo " selected"; ?>>60天</option> <option value="60" <?php if (@$last_prpay_arr[5]["pay_period"] == "60") echo " selected"; ?>>60天</option>
<option value="90" <?php if (@$last_prpay_arr[5]["pay_period"] == "90") echo " selected"; ?>>90天</option> <option value="90" <?php if (@$last_prpay_arr[5]["pay_period"] == "90") echo " selected"; ?>>90天</option>
<option value="120" <?php if (@$last_prpay_arr[5]["pay_period"] == "120") echo " selected"; ?>>120天</option> <option value="120" <?php if (@$last_prpay_arr[5]["pay_period"] == "120") echo " selected"; ?>>120天</option>
@ -2041,13 +2281,13 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
</tr> </tr>
<tr> <tr>
<td>6、驗收款<input type="hidden" name="pay_kind" value="6"></td> <td>6、驗收款<input type="hidden" name="pay_kind" value="6"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[6]["pay_scale"]; ?>"></td> <td><input type="text" id="pay_scale6" name="pay_scale" class="form-control" size="3" value="<?php echo empty(@$last_prpay_arr[6]["pay_scale"]) ? 10 : @$last_prpay_arr[6]["pay_scale"]; ?>"></td>
<td id="pay6"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[6]["pay_amount"]); ?>" readonly></td> <td id="pay6"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[6]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
<option value=""></option> <option value=""></option>
<option value="7" <?php if (@$last_prpay_arr[6]["pay_period"] == "7") echo " selected"; ?>>7天</option> <option value="7" <?php if (@$last_prpay_arr[6]["pay_period"] == "7") echo " selected"; ?>>7天</option>
<option value="30"<?php if (@$last_prpay_arr[6]["pay_period"]=="30") echo " selected"; ?>>30天</option> <option value="30" <?php if (@$last_prpay_arr[6]["pay_period"] == "30" || @$last_prpay_arr[6]["pay_period"] == "") echo " selected"; ?>>30天</option>
<option value="60" <?php if (@$last_prpay_arr[6]["pay_period"] == "60") echo " selected"; ?>>60天</option> <option value="60" <?php if (@$last_prpay_arr[6]["pay_period"] == "60") echo " selected"; ?>>60天</option>
<option value="90" <?php if (@$last_prpay_arr[6]["pay_period"] == "90") echo " selected"; ?>>90天</option> <option value="90" <?php if (@$last_prpay_arr[6]["pay_period"] == "90") echo " selected"; ?>>90天</option>
<option value="120" <?php if (@$last_prpay_arr[6]["pay_period"] == "120") echo " selected"; ?>>120天</option> <option value="120" <?php if (@$last_prpay_arr[6]["pay_period"] == "120") echo " selected"; ?>>120天</option>
@ -2109,13 +2349,9 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<label for="qty_total">總台數</label> <label for="qty_total">總台數</label>
<input type="text" name="qty_total" id="qty_total" value="<?php echo $qty_total; ?>" readonly> <input type="text" name="qty_total" id="qty_total" value="<?php echo $qty_total; ?>" readonly>
</div> </div>
<div>
<label for="special_fee">特殊費用</label>
<input type="text" name="special_fee" id="special_fee" value="<?php if (isset($last_pr_arr["special_fee"])) echo number_format($last_pr_arr["special_fee"]); ?>">
</div>
<div> <div>
<label for="special_fee">服務費</label> <label for="special_fee">服務費</label>
<input type="text" name="service_fee" id="service_fee" value="0"> <input type="text" name="special_fee" id="special_fee" value="<?php if (isset($last_pr_arr["special_fee"])) echo number_format($last_pr_arr["special_fee"]); ?>">
</div> </div>
<div> <div>
<label for="price_broken">破價(台)</label> <label for="price_broken">破價(台)</label>
@ -2164,11 +2400,12 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
<ul> <ul>
<li>業務員權限>=80%以上;<80-75%呈至業務協理審核<75%以下呈至總經理審核</li> <li>營業權限85%以上;85-80%呈至區處長審核;80%以下呈至總經理審核。</li>
</ul> </ul>
</div>
<div class="nextline"></div> <div class="nextline"></div>
<label for="attatch1">報價單</label> <label for="attatch1">報價單</label>
<input type="file" name="attatch1" id="attatch1"><a href="javascript:void(0);" name="filedel" class="btn btn-danger btn-sm">X</a> <input type="file" name="attatch1" id="attatch1"><a href="javascript:void(0);" name="filedel" class="btn btn-danger btn-sm">X</a>
@ -2233,3 +2470,9 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<?php <?php
include "../footer.php"; include "../footer.php";
?> ?>
<script src="./assets/js/alpine.js"></script>
<script>
const options = [...<?php echo json_encode($options); ?>];
</script>

7
wms/mkt/pricereview-edit.php

@ -1684,7 +1684,7 @@ $(function(){
<input type="text" name="qty_total" id="qty_total" readonly> <input type="text" name="qty_total" id="qty_total" readonly>
</div> </div>
<div> <div>
<label for="special_fee">特殊費用</label> <label for="special_fee">服務費</label>
<input type="text" name="special_fee" id="special_fee" value="<?php echo number_format($data["special_fee"]); ?>"> <input type="text" name="special_fee" id="special_fee" value="<?php echo number_format($data["special_fee"]); ?>">
</div> </div>
<div> <div>
@ -1732,11 +1732,10 @@ $(function(){
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
<ul> <ul>
<li>業務員權限>=80%以上;<80-75%呈至業務協理審核<75%以下呈至總經理審核</li> <li>營業權限85%以上;85-80%呈至區處長審核;80%以下呈至總經理審核。。</li>
</ul> </ul>
</div>
<div class="nextline"></div> <div class="nextline"></div>
<label for="attatch1">報價單</label> <label for="attatch1">報價單</label>
<?php <?php

36
wms/mkt/pricereview-index.php

@ -10,21 +10,21 @@ $status_arr = ["Y1" => "暫存", "YS" => "簽核中", "YY" => "結案同意", "Y
$data = array(); $data = array();
// sql語法存在變數中 // sql語法存在變數中
$sql_cmd = sql_myself($user_id, "pricereview_main .creater"); $sql_cmd = sql_myself($user_id, "pricereview_main .creater");
$sql = "select pricereview_main.*, contract_new_apply.status as applystatus from pricereview_main left join contract_new_apply on pricereview_main.id = contract_new_apply.mid where pricereview_main.creater = '$user_id' and pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id"; $sql = "select pricereview_main.*, contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress from pricereview_main left join contract_new_apply on pricereview_main.id = contract_new_apply.mid where pricereview_main.creater = '$user_id' and pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id";
// M0024許伃廷,M0107許紓晴權限全開 // M0024許伃廷,M0107許紓晴權限全開
if ($user_id == "M0024" || $user_id == "M0107" || $user_id == "M0174" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "TEST04") { if ($user_id == "M0024" || $user_id == 'M0026' || $user_id == "M0107" || $user_id == "M0174" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "TEST04") {
$sql_cmd = "where create_at >= '2023-01-01 00:00:00'"; $sql_cmd = "where create_at >= '2023-01-01 00:00:00'";
$sql = "select pricereview_main.*, contract_new_apply.status as applystatus from pricereview_main left join contract_new_apply on pricereview_main.id = contract_new_apply.mid where create_at >= '2023-01-01 00:00:00' and pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id"; $sql = "select pricereview_main.*, contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress from pricereview_main left join contract_new_apply on pricereview_main.id = contract_new_apply.mid where create_at >= '2023-01-01 00:00:00' and pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id";
} }
if ($user_id == "M0060") { if ($user_id == "M0060") {
$sql_cmd = "where creater in (select accountid from account where (department_id like '3%' or department_id like '5%'))"; $sql_cmd = "where creater in (select accountid from account where (department_id like '3%' or department_id like '5%'))";
$sql = "select pricereview_main.*,contract_new_apply.status as applystatus from pricereview_main left join contract_new_apply on pricereview_main.id = contract_new_apply.mid where creater in (select accountid from account where (department_id like '3%' or department_id like '5%')) and pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id"; $sql = "select pricereview_main.*,contract_new_apply.status as applystatus from pricereview_main left join contract_new_apply on pricereview_main.id = contract_new_apply.mid where creater in (select accountid from account where (department_id like '3%' or department_id like '5%')) and pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id";
} }
if (empty($sql_cmd)) $sql = "select pricereview_main.*, contract_new_apply.status as applystatus from pricereview_main left join contract_new_apply on pricereview_main.id = contract_new_apply.mid where pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id"; if (empty($sql_cmd)) $sql = "select pricereview_main.*, contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress from pricereview_main left join contract_new_apply on pricereview_main.id = contract_new_apply.mid where pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id";
else $sql = "select pricereview_main.*, contract_new_apply.status as applystatus from pricereview_main left join contract_new_apply on contract_new_apply.mid = pricereview_main.id $sql_cmd and pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id"; else $sql = "select pricereview_main.*, contract_new_apply.status as applystatus, contract_new_apply.progress as applyprogress from pricereview_main left join contract_new_apply on contract_new_apply.mid = pricereview_main.id $sql_cmd and pricereview_main.status like 'Y%' and pricereview_main.ekind = '新梯' order by pricereview_main.id";
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
// echo $sql;
$para = "function_name=pricereview&" . $token_link; $para = "function_name=pricereview&" . $token_link;
?> ?>
<style> <style>
@ -238,6 +238,14 @@ if ($data) :
<?php <?php
//if ($oneself && !($data["status"] == "YY" || $data["status"] == "YN")) { // 自己可以進行規調 //if ($oneself && !($data["status"] == "YY" || $data["status"] == "YN")) { // 自己可以進行規調
if ($oneself) { if ($oneself) {
// 重填價審只能有最新一筆,填規調只有最新一筆可以填。
$contractno = $data['contractno'];
$sql = "SELECT MAX(id),COUNT(*) FROM pricereview_main WHERE contractno = '$contractno' ORDER BY id DESC";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_row($result);
$maxContractID = $row[0];
$countContract = $row[1];
if ($data["status"] == "Y1") { if ($data["status"] == "Y1") {
?> ?>
<a href="pricereview-edit.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-primary btn-sm">修改</a> <a href="pricereview-edit.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-primary btn-sm">修改</a>
@ -246,6 +254,10 @@ if ($data) :
} elseif ($data["status"] == "YS") { } elseif ($data["status"] == "YS") {
?> ?>
<a href="specsurvey-create.php?mid=<?= $data['id']; ?>&function_name=specsurvey&token=<?= $token; ?>" class="btn btn-danger btn-sm">填規調</a> <a href="specsurvey-create.php?mid=<?= $data['id']; ?>&function_name=specsurvey&token=<?= $token; ?>" class="btn btn-danger btn-sm">填規調</a>
<?php
} elseif ($data['status'] == 'YN' && $data['id'] == $maxContractID) {
?>
<a href="pricereview-create.php?vol_no=<?= $data['contractno'] ?>&id=<?= $data['id']; ?>&function_name=specsurvey&token=<?= $token; ?>" class="btn btn-danger btn-sm">重填價審</a>
<?php <?php
} }
} }
@ -269,7 +281,7 @@ if ($data) :
elseif ($ustatus == "N") $str = "<span class=\"glyphicon glyphicon-ban-circle\" title=\"不同意\"></span>"; elseif ($ustatus == "N") $str = "<span class=\"glyphicon glyphicon-ban-circle\" title=\"不同意\"></span>";
$str .= "<br>" . $accountname_arr[$uperson] . "<br>" . $udtte; $str .= "<br>" . $accountname_arr[$uperson] . "<br>" . $udtte;
} else { } else {
if ($ss_arr["sign_st"] == 1 && in_array($user_id, $ss_arr["sign_nt"]) && $data["status"] == "YS" || $user_id = 'TEST04') { if ($ss_arr["sign_st"] == 1 && in_array($user_id, $ss_arr["sign_nt"]) && $data["status"] == "YS" || $user_id == 'TEST04') {
$str = "<span class=\"glyphicon glyphicon-user\"></span>"; $str = "<span class=\"glyphicon glyphicon-user\"></span>";
$str = "待簽核"; $str = "待簽核";
$str = "<a href=\"pricereview-check.php?st=1&id=" . $data["id"] . "&" . $para . "\" class=\"btn btn-primary btn-sm\">" . $str . "</a>"; $str = "<a href=\"pricereview-check.php?st=1&id=" . $data["id"] . "&" . $para . "\" class=\"btn btn-primary btn-sm\">" . $str . "</a>";
@ -457,7 +469,10 @@ if ($data) :
} }
</style> </style>
<td> <td>
<?php if (($data['status'] == 'YY' && $oneself) || $user_id == "M0174" || $user_id == 'M0225') : ?> <?php if (($data['status'] == 'YY' && $oneself) || ($data['status'] == 'YY' && ($user_id == "M0174" || $user_id == 'M0225' || $user_id === "M0107" || $user_id === "M0060"))) : ?>
<?php if (($user_id === "M0107" || $user_id === "M0060") && $data['applystatus'] < 3) : ?>
<span style="font-size:13px;font-weight:600">待申請</span>
<?php elseif ($data['applystatus'] < 3) : ?>
<a class="applybtn" href="../contract/contract-new-apply.php?id=<?php echo $data['id'] . '&' . $para; ?>"> <a class="applybtn" href="../contract/contract-new-apply.php?id=<?php echo $data['id'] . '&' . $para; ?>">
<?php if ($data['applystatus'] < 1) { <?php if ($data['applystatus'] < 1) {
echo "申請"; echo "申請";
@ -466,8 +481,11 @@ if ($data) :
} ?> } ?>
</a><br> </a><br>
<?php endif; ?> <?php endif; ?>
<?php else : ?>
<?php endif; ?>
<?php if ($data['status'] == 'YY' && ($user_id == "M0060" || $user_id == "M0107" || $user_id == "M0174" || $user_id == 'M0225') && $data['applystatus'] == 1) : ?> <?php if ($data['status'] == 'YY' && (($user_id == "M0060" && $data['applyprogress'] == 2) || ($user_id == "M0107" && $data['applyprogress'] <= 1) || $user_id == "M0174" || $user_id == 'M0225') && $data['applystatus'] == 1) : ?>
<a class="applybtn" href="../contract/contract-new-apply.php?id=<?php echo $data['id'] . '&' . $para; ?>">待簽核</a><br> <a class="applybtn" href="../contract/contract-new-apply.php?id=<?php echo $data['id'] . '&' . $para; ?>">待簽核</a><br>
<?php endif; ?> <?php endif; ?>
<?php if ($data['status'] != 'YY') : ?> <?php if ($data['status'] != 'YY') : ?>

9
wms/mkt/pricereview-record-submit.php

@ -1,6 +1,7 @@
<?php <?php
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
//print_r($_POST);exit; print_r($_POST);
exit;
foreach ($_POST as $k => $v) { foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v))); $$k = htmlspecialchars(stripslashes(trim($v)));
} }
@ -279,10 +280,11 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} }
// 價審簽核流程 // 價審簽核流程
// <75%以下呈至總經理審核. ($price_rate) // 小於80%呈至總經理審核. ($price_rate)
// 上級主管 > 伃廷 > MAX > 總經理 // 上級主管 > 伃廷 > MAX > 總經理
if ($status == "YS") { if ($status == "YS") {
$manager_arr = pricereview_class($price_rate, $user_id); $ret = [];
$manager_arr = pricereview_class($price_rate, $user_id, $ret, $special_fee);
if ($manager_arr) { if ($manager_arr) {
$sign1 = $sign2 = $sign3 = $sign4 = ""; $sign1 = $sign2 = $sign3 = $sign4 = "";
foreach ($manager_arr as $k => $v) { foreach ($manager_arr as $k => $v) {
@ -333,4 +335,3 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
echo "</script>"; echo "</script>";
} }
} }
?>

2
wms/mkt/pricereview-record-update.php

@ -384,7 +384,7 @@ if(isset($_POST['pmstatus'])) {
} }
// 價審簽核流程 // 價審簽核流程
// <75%以下呈至總經理審核. ($price_rate) // 小於80%呈至總經理審核. ($price_rate)
// 上級主管 > 伃廷 > MAX > 總經理 // 上級主管 > 伃廷 > MAX > 總經理
if ($status == "YS") { if ($status == "YS") {
$manager_arr = pricereview_class($price_rate, $user_id); $manager_arr = pricereview_class($price_rate, $user_id);

4
wms/mkt/pricereview_mi-api.php

@ -83,7 +83,7 @@ try {
$row = mysqli_fetch_row($res); $row = mysqli_fetch_row($res);
$special_fee = $row[0]; $special_fee = $row[0];
mysqli_free_result($res); mysqli_free_result($res);
$specarr[0] = "特殊費用"; $specarr[0] = "服務費";
$specarr[1] = round($special_fee/$elev_qty_all, 0); $specarr[1] = round($special_fee/$elev_qty_all, 0);
// 電梯所屬OPTION // 電梯所屬OPTION
@ -265,6 +265,7 @@ try {
$sql4 .= "and ($v[item_weight] between o.min_weight and o.max_weight) and o.open_kind = '".$v["item_op"]."'"; $sql4 .= "and ($v[item_weight] between o.min_weight and o.max_weight) and o.open_kind = '".$v["item_op"]."'";
$res_om = mysqli_query($link, $sql4); $res_om = mysqli_query($link, $sql4);
if ($row_om = mysqli_fetch_assoc($res_om)) { if ($row_om = mysqli_fetch_assoc($res_om)) {
$row_om['price'] = (int)ceil($row_om['price']);
$plus = ($v["floors"] > $row_om["base_floor"]) ? ($v["floors"] - $row_om["base_floor"])*$row_om["base_floor_plus"] : 0; $plus = ($v["floors"] > $row_om["base_floor"]) ? ($v["floors"] - $row_om["base_floor"])*$row_om["base_floor_plus"] : 0;
// 特例 // 特例
if ($opt_elev_arr[$val]["price_id"] == "256" && ($v["floors"] < $row_om["base_floor"])) $row_om["price"] = 9815; if ($opt_elev_arr[$val]["price_id"] == "256" && ($v["floors"] < $row_om["base_floor"])) $row_om["price"] = 9815;
@ -287,7 +288,6 @@ try {
$j++; $j++;
} }
} }
// 保固延長 // 保固延長
$mnarr = []; $mnarr = [];
$mn_fee = $j = 0; $mn_fee = $j = 0;

37
wms/mkt/pricereview_renovate-check.php

@ -358,28 +358,44 @@ $(function () {
$('button[name=status]').click(function() { $('button[name=status]').click(function() {
var itemNoArr = []; var itemNoArr = [];
$("input[name='item_no']").each(function(){ itemNoArr.push($(this).val()); }) $("input[name='item_no']").each(function() {
itemNoArr.push($(this).val());
})
$('#item_no_all').val(itemNoArr); $('#item_no_all').val(itemNoArr);
var itemPriceArr = []; var itemPriceArr = [];
$("input[name='item_price']").each(function(){ itemPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_price']").each(function() {
itemPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_all').val(itemPriceArr); $('#item_price_all').val(itemPriceArr);
var pvRateArr = []; var pvRateArr = [];
$("input[name='pv_rate']").each(function(){ pvRateArr.push($(this).val()); }) $("input[name='pv_rate']").each(function() {
pvRateArr.push($(this).val());
})
$('#pv_rate_all').val(pvRateArr); $('#pv_rate_all').val(pvRateArr);
var allocateArr = []; var allocateArr = [];
$("input[name='allocate']").each(function(){ allocateArr.push($(this).val()); }) $("input[name='allocate']").each(function() {
allocateArr.push($(this).val());
})
$('#allocate_all').val(allocateArr); $('#allocate_all').val(allocateArr);
var grossProfitArr = []; var grossProfitArr = [];
$("input[name='gross_profit']").each(function(){ grossProfitArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='gross_profit']").each(function() {
grossProfitArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#gross_profit_all').val(grossProfitArr); $('#gross_profit_all').val(grossProfitArr);
var grossProfitRateArr = []; var grossProfitRateArr = [];
$("input[name='gross_profit_rate']").each(function(){ grossProfitRateArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='gross_profit_rate']").each(function() {
grossProfitRateArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#gross_profit_rate_all').val(grossProfitRateArr); $('#gross_profit_rate_all').val(grossProfitRateArr);
var noteArr = []; var noteArr = [];
$("input[name='note']").each(function(){ noteArr.push($(this).val()); }) $("input[name='note']").each(function() {
noteArr.push($(this).val());
})
$('#note_all').val(noteArr); $('#note_all').val(noteArr);
var miFixArr = []; var miFixArr = [];
$("input[name='mi_fix']").each(function(){ miFixArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='mi_fix']").each(function() {
miFixArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#mi_fix_all').val(miFixArr); $('#mi_fix_all').val(miFixArr);
}); });
$('#btn_close').click(function() { $('#btn_close').click(function() {
@ -394,19 +410,24 @@ $(function () {
.container { .container {
width: 1350px; width: 1350px;
} }
.nextline { .nextline {
width: 100%; width: 100%;
height: 0; height: 0;
} }
.modal-dialog { .modal-dialog {
width: 1200px; width: 1200px;
} }
.modal-content { .modal-content {
height: 660px; height: 660px;
} }
.dollar-right { .dollar-right {
text-align: right; text-align: right;
} }
hr { hr {
border: 0; border: 0;
border-bottom: 1px dashed #ccc; border-bottom: 1px dashed #ccc;

335
wms/mkt/pricereview_renovate-create.php

@ -2,6 +2,15 @@
include "../header.php"; include "../header.php";
$vol_no = $_REQUEST["vol_no"]; // 從有望客戶過來:卷號 $vol_no = $_REQUEST["vol_no"]; // 從有望客戶過來:卷號
$id = $_GET['id'];
// $sql = "SELECT * FROM pricereview_main WHERE id = $id";
// $result1 = mysqli_query($link, $sql);
// if (!empty($result1)) {
// $sql = "UPDATE pricereview_main SET status = 'D' WHERE id = $id";
// $result = mysqli_query($link, $sql);
// }
// 營業員只建自己客戶的價審單 // 營業員只建自己客戶的價審單
$sql = "select pre_order_date, case_name from hope_elevator_customer where salesman = '$user_id' and vol_no = '$vol_no'"; $sql = "select pre_order_date, case_name from hope_elevator_customer where salesman = '$user_id' and vol_no = '$vol_no'";
@ -201,89 +210,123 @@ $option_str .= "</tbody></table>";
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.c_iframe { .c_iframe {
width: 1350px; width: 1350px;
height: 500px; height: 500px;
margin-right: auto; margin-right: auto;
margin-left: auto; margin-left: auto;
} }
.container { .container {
width: 1350px; width: 1350px;
} }
.nextline { .nextline {
width: 100%; width: 100%;
height: 0; height: 0;
} }
#btnadd, #btnadd2, #btnadd3, #btnadd4, #btnadd5, a[name=btndel], a[name=btndel2], a[name=btndel3], a[name=btndel4], a[name=btndel5] {
#btnadd,
#btnadd2,
#btnadd3,
#btnadd4,
#btnadd5,
a[name=btndel],
a[name=btndel2],
a[name=btndel3],
a[name=btndel4],
a[name=btndel5] {
margin-left: 4px; margin-left: 4px;
} }
tr th svg { tr th svg {
vertical-align: text-top; vertical-align: text-top;
} }
tr select { tr select {
margin: 8px; margin: 8px;
} }
.modal-dialog { .modal-dialog {
width: 1200px; width: 1200px;
} }
.modal-content { .modal-content {
height: 660px; height: 660px;
} }
#optionModal .modal-body { #optionModal .modal-body {
height: 540px; height: 540px;
overflow-y: auto; overflow-y: auto;
} }
#optionFaciModal .modal-body { #optionFaciModal .modal-body {
font-size: 16px; font-size: 16px;
} }
#optionFaciModal .modal-dialog { #optionFaciModal .modal-dialog {
margin-top: 200px; margin-top: 200px;
width: 400px; width: 400px;
} }
#optionFaciModal .modal-content { #optionFaciModal .modal-content {
height: auto; height: auto;
} }
ol li { ol li {
margin-left: -20px; margin-left: -20px;
line-height: 160%; line-height: 160%;
} }
a[name=optdel] { a[name=optdel] {
font-size: 13px; font-size: 13px;
text-decoration: none; text-decoration: none;
} }
.dollar-right { .dollar-right {
text-align: right; text-align: right;
} }
.kind-title { .kind-title {
background-color: black; background-color: black;
color: white; color: white;
font-size: 18px; font-size: 18px;
} }
.kind-col { .kind-col {
color: brown; color: brown;
} }
.col-md-6 { .col-md-6 {
width: 100%; width: 100%;
} }
#table_index2_filter label { #table_index2_filter label {
width: 30%; width: 30%;
} }
#table_index2 { #table_index2 {
cursor: pointer; cursor: pointer;
} }
.notice { .notice {
margin: 0 0 -2px 10px; margin: 0 0 -2px 10px;
color: red; color: red;
} }
.btn2:hover { .btn2:hover {
color: #fff; color: #fff;
} }
button[name=btnpost] { button[name=btnpost] {
margin-top: 12px; margin-top: 12px;
} }
input[type=checkbox] { input[type=checkbox] {
margin: 8px; margin: 8px;
} }
.star { .star {
color: red; color: red;
font-weight: bold; font-weight: bold;
@ -509,6 +552,26 @@ function selDemolition(o) {
$(function() { $(function() {
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
$(document).ready(function() {
$('input[name=pay_scale]').each(function() {
if ($(this).val() != '') {
// console.log($(this).val());
$(this).closest('td').next('td').find('input[name=pay_amount]').val(commafy(($("#price_total").val().replace(/[,]+/g, "") / 100 * $(this).val()).toFixed(0)));
var payAllScale = 0;
var payAllAmt = 0;
$("input[name=pay_scale]").each(function() {
payAllScale += Number($(this).val().replace(/[,]+/g, ""))
});
$("input[name=pay_amount]").each(function() {
payAllAmt += Number($(this).val().replace(/[,]+/g, ""))
});
$("input[name=pay_all_scale]").val(commafy(payAllScale));
$("input[name=pay_all_amount]").val(commafy(payAllAmt));
}
})
})
$('#table_index2').DataTable({ $('#table_index2').DataTable({
"language": { "language": {
"zeroRecords": "沒有符合的結果", "zeroRecords": "沒有符合的結果",
@ -566,10 +629,18 @@ $(function(){
}); });
}); });
$('#deposit_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); $('#deposit_rate').keyup(function() {
$('#keep_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1'));
$('#warranty_rate').keyup(function(){ $(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')); }); });
$('#special_fee').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }); $('#keep_rate').keyup(function() {
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1'));
});
$('#warranty_rate').keyup(function() {
$(this).val($(this).val().replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1'));
});
$('#special_fee').keyup(function() {
$(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
});
/* /*
// for 動態表格的作法:event delegation // for 動態表格的作法:event delegation
$('#tb1').on('click', $("input[name='item_qty']"), function(){ $('#tb1').on('click', $("input[name='item_qty']"), function(){
@ -893,49 +964,79 @@ $(function(){
$('button[name=submit],button[name=save').click(function() { $('button[name=submit],button[name=save').click(function() {
var itemFpidArr = []; var itemFpidArr = [];
$("input[name='fp_id']").each(function(){ if ($(this).val() != '') itemFpidArr.push($(this).val()); }) $("input[name='fp_id']").each(function() {
if ($(this).val() != '') itemFpidArr.push($(this).val());
})
$('#fp_id_all').val(itemFpidArr); $('#fp_id_all').val(itemFpidArr);
var fpKindArr = []; var fpKindArr = [];
$("select[name='fp_kind']").each(function(){ if ($(this).val() != '') fpKindArr.push($(this).val()); }) $("select[name='fp_kind']").each(function() {
if ($(this).val() != '') fpKindArr.push($(this).val());
})
$('#fp_kind_all').val(fpKindArr); $('#fp_kind_all').val(fpKindArr);
var fpSeatArr = []; var fpSeatArr = [];
$("select[name='fp_seat']").each(function(){ if ($(this).val() != '') fpSeatArr.push($(this).val()); }) $("select[name='fp_seat']").each(function() {
if ($(this).val() != '') fpSeatArr.push($(this).val());
})
$('#fp_seat_all').val(fpSeatArr); $('#fp_seat_all').val(fpSeatArr);
var fpNumberofstopArr = []; var fpNumberofstopArr = [];
$("input[name='fp_numberofstop']").each(function(){ if ($(this).val() != '') fpNumberofstopArr.push($(this).val()); }) $("input[name='fp_numberofstop']").each(function() {
if ($(this).val() != '') fpNumberofstopArr.push($(this).val());
})
$('#fp_numberofstop_all').val(fpNumberofstopArr); $('#fp_numberofstop_all').val(fpNumberofstopArr);
var fpSpeedArr = []; var fpSpeedArr = [];
$("select[name='fp_speed']").each(function(){ if ($(this).val() != '') fpSpeedArr.push($(this).val()); }) $("select[name='fp_speed']").each(function() {
if ($(this).val() != '') fpSpeedArr.push($(this).val());
})
$('#fp_speed_all').val(fpSpeedArr); $('#fp_speed_all').val(fpSpeedArr);
var itemOpArr = []; var itemOpArr = [];
$("select[name='item_op']").each(function(){ if ($(this).val() != '') itemOpArr.push($(this).val()); }) $("select[name='item_op']").each(function() {
if ($(this).val() != '') itemOpArr.push($(this).val());
})
$('#item_op_all').val(itemOpArr); $('#item_op_all').val(itemOpArr);
var itemWeightArr = []; var itemWeightArr = [];
$("input[name='item_weight']").each(function(){ if ($(this).val() != '') itemWeightArr.push($(this).val()); }) $("input[name='item_weight']").each(function() {
if ($(this).val() != '') itemWeightArr.push($(this).val());
})
$('#item_weight_all').val(itemWeightArr); $('#item_weight_all').val(itemWeightArr);
var itemSpecArr = []; var itemSpecArr = [];
$("input[name='item_spec']").each(function(){ itemSpecArr.push($(this).val()); }) $("input[name='item_spec']").each(function() {
itemSpecArr.push($(this).val());
})
$('#item_spec_all').val(itemSpecArr); $('#item_spec_all').val(itemSpecArr);
var itemGroupArr = []; var itemGroupArr = [];
$("input[name='item_group']").each(function(){ itemGroupArr.push($(this).val()); }) $("input[name='item_group']").each(function() {
itemGroupArr.push($(this).val());
})
$('#item_group_all').val(itemGroupArr); $('#item_group_all').val(itemGroupArr);
var itemUnitPriceArr = []; var itemUnitPriceArr = [];
$("input[name='item_unit_price']").each(function(){ itemUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_unit_price']").each(function() {
itemUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_unit_price_all').val(itemUnitPriceArr); $('#item_unit_price_all').val(itemUnitPriceArr);
var itemQtyArr = []; var itemQtyArr = [];
$("input[name='item_qty']").each(function(){ itemQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_qty']").each(function() {
itemQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_qty_all').val(itemQtyArr); $('#item_qty_all').val(itemQtyArr);
var itemQtyOriArr = []; var itemQtyOriArr = [];
$("input[name='item_qty_ori']").each(function(){ itemQtyOriArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_qty_ori']").each(function() {
itemQtyOriArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_qty_ori_all').val(itemQtyOriArr); $('#item_qty_ori_all').val(itemQtyOriArr);
var itemPriceBpArr = []; var itemPriceBpArr = [];
$("input[name='item_price_bp']").each(function(){ itemPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_price_bp']").each(function() {
itemPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_bp_all').val(itemPriceBpArr); $('#item_price_bp_all').val(itemPriceBpArr);
var itemPriceCtArr = []; var itemPriceCtArr = [];
$("input[name='item_price_ct']").each(function(){ itemPriceCtArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_price_ct']").each(function() {
itemPriceCtArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_ct_all').val(itemPriceCtArr); $('#item_price_ct_all').val(itemPriceCtArr);
var itemPriceArr = []; var itemPriceArr = [];
$("input[name='item_price']").each(function(){ itemPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='item_price']").each(function() {
itemPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#item_price_all').val(itemPriceArr); $('#item_price_all').val(itemPriceArr);
var grossProfitArr = []; var grossProfitArr = [];
$("input[name='gross_profit']").each(function() { $("input[name='gross_profit']").each(function() {
@ -943,106 +1044,174 @@ $(function(){
}) })
$('#gross_profit_all').val(grossProfitArr); $('#gross_profit_all').val(grossProfitArr);
var pvRateArr = []; var pvRateArr = [];
$("input[name='pv_rate']").each(function(){ pvRateArr.push($(this).val()); }) $("input[name='pv_rate']").each(function() {
pvRateArr.push($(this).val());
})
$('#pv_rate_all').val(pvRateArr); $('#pv_rate_all').val(pvRateArr);
var noteArr = []; var noteArr = [];
$("input[name='note']").each(function(){ noteArr.push($(this).val()); }) $("input[name='note']").each(function() {
noteArr.push($(this).val());
})
$('#note_all').val(noteArr); $('#note_all').val(noteArr);
var payKindArr = []; var payKindArr = [];
$("input[name='pay_kind']").each(function(){ payKindArr.push($(this).val()); }) $("input[name='pay_kind']").each(function() {
payKindArr.push($(this).val());
})
$('#pay_kind_all').val(payKindArr); $('#pay_kind_all').val(payKindArr);
var payScaleArr = []; var payScaleArr = [];
$("input[name='pay_scale']").each(function(){ payScaleArr.push($(this).val()); }) $("input[name='pay_scale']").each(function() {
payScaleArr.push($(this).val());
})
$('#pay_scale_all').val(payScaleArr); $('#pay_scale_all').val(payScaleArr);
var payAmountArr = []; var payAmountArr = [];
$("input[name='pay_amount']").each(function(){ payAmountArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='pay_amount']").each(function() {
payAmountArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#pay_amount_all').val(payAmountArr); $('#pay_amount_all').val(payAmountArr);
var payPeriodArr = []; var payPeriodArr = [];
$("select[name='pay_period']").each(function(){ payPeriodArr.push($(this).val()); }) $("select[name='pay_period']").each(function() {
payPeriodArr.push($(this).val());
})
$('#pay_period_all').val(payPeriodArr); $('#pay_period_all').val(payPeriodArr);
var itemOpidArr = []; var itemOpidArr = [];
$("input[name='op_id']").each(function(){ itemOpidArr.push($(this).val()); }) $("input[name='op_id']").each(function() {
itemOpidArr.push($(this).val());
})
$('#op_id_all').val(itemOpidArr); $('#op_id_all').val(itemOpidArr);
var optionSeatArr = []; var optionSeatArr = [];
$("td[name='option_seat'] a").each(function(){ optionSeatArr.push($(this).html()+"@@"); }) $("td[name='option_seat'] a").each(function() {
optionSeatArr.push($(this).html() + "@@");
})
$('#option_seat_all').val(optionSeatArr); $('#option_seat_all').val(optionSeatArr);
var optionUnitPriceArr = []; var optionUnitPriceArr = [];
$("input[name='option_unit_price']").each(function(){ optionUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='option_unit_price']").each(function() {
optionUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#option_unit_price_all').val(optionUnitPriceArr); $('#option_unit_price_all').val(optionUnitPriceArr);
var optionQtyArr = []; var optionQtyArr = [];
$("input[name='option_qty']").each(function(){ optionQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='option_qty']").each(function() {
optionQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#option_qty_all').val(optionQtyArr); $('#option_qty_all').val(optionQtyArr);
var optionPriceBpArr = []; var optionPriceBpArr = [];
$("input[name='option_price_bp']").each(function(){ optionPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='option_price_bp']").each(function() {
optionPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#option_price_bp_all').val(optionPriceBpArr); $('#option_price_bp_all').val(optionPriceBpArr);
var optionMemoArr = []; var optionMemoArr = [];
$("input[name='option_memo']").each(function(){ optionMemoArr.push($(this).val()+"@@"); }) $("input[name='option_memo']").each(function() {
optionMemoArr.push($(this).val() + "@@");
})
$('#option_memo_all').val(optionMemoArr); $('#option_memo_all').val(optionMemoArr);
var optionRelateFacilArr = []; var optionRelateFacilArr = [];
$("td[name='option_relate_facil']").each(function(){ optionRelateFacilArr.push($(this).html()); }) $("td[name='option_relate_facil']").each(function() {
optionRelateFacilArr.push($(this).html());
})
$('#option_relate_facil_all').val(optionRelateFacilArr); $('#option_relate_facil_all').val(optionRelateFacilArr);
var mnIdArr = []; var mnIdArr = [];
$("input[name='mn_id']").each(function(){ mnIdArr.push($(this).val()); }) $("input[name='mn_id']").each(function() {
mnIdArr.push($(this).val());
})
$('#mn_id_all').val(mnIdArr); $('#mn_id_all').val(mnIdArr);
var mnKindArr = []; var mnKindArr = [];
$("select[name='mn_kind']").each(function(){ mnKindArr.push($(this).val()); }) $("select[name='mn_kind']").each(function() {
mnKindArr.push($(this).val());
})
$('#mn_kind_all').val(mnKindArr); $('#mn_kind_all').val(mnKindArr);
var mnSeatArr = []; var mnSeatArr = [];
$("select[name='mn_seat']").each(function(){ mnSeatArr.push($(this).val()); }) $("select[name='mn_seat']").each(function() {
mnSeatArr.push($(this).val());
})
$('#mn_seat_all').val(mnSeatArr); $('#mn_seat_all').val(mnSeatArr);
var mnNumberofstopArr = []; var mnNumberofstopArr = [];
$("input[name='mn_numberofstop']").each(function(){ mnNumberofstopArr.push($(this).val()); }) $("input[name='mn_numberofstop']").each(function() {
mnNumberofstopArr.push($(this).val());
})
$('#mn_numberofstop_all').val(mnNumberofstopArr); $('#mn_numberofstop_all').val(mnNumberofstopArr);
var mnSpeedArr = []; var mnSpeedArr = [];
$("select[name='mn_speed']").each(function(){ mnSpeedArr.push($(this).val()); }) $("select[name='mn_speed']").each(function() {
mnSpeedArr.push($(this).val());
})
$('#mn_speed_all').val(mnSpeedArr); $('#mn_speed_all').val(mnSpeedArr);
var mnUnitPriceArr = []; var mnUnitPriceArr = [];
$("input[name='mn_unit_price']").each(function(){ mnUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='mn_unit_price']").each(function() {
mnUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#mn_unit_price_all').val(mnUnitPriceArr); $('#mn_unit_price_all').val(mnUnitPriceArr);
var mnQtyArr = []; var mnQtyArr = [];
$("input[name='mn_qty']").each(function(){ mnQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='mn_qty']").each(function() {
mnQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#mn_qty_all').val(mnQtyArr); $('#mn_qty_all').val(mnQtyArr);
var mnPriceBpArr = []; var mnPriceBpArr = [];
$("input[name='mn_price_bp']").each(function(){ mnPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='mn_price_bp']").each(function() {
mnPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#mn_price_bp_all').val(mnPriceBpArr); $('#mn_price_bp_all').val(mnPriceBpArr);
var mnMemoArr = []; var mnMemoArr = [];
$("input[name='mn_memo']").each(function(){ mnMemoArr.push($(this).val()+"@@"); }) $("input[name='mn_memo']").each(function() {
mnMemoArr.push($(this).val() + "@@");
})
$('#mn_memo_all').val(mnMemoArr); $('#mn_memo_all').val(mnMemoArr);
var mnRelateFacilArr = []; var mnRelateFacilArr = [];
$("td[name='mn_relate_facil']").each(function(){ mnRelateFacilArr.push($(this).html()); }) $("td[name='mn_relate_facil']").each(function() {
mnRelateFacilArr.push($(this).html());
})
$('#mn_relate_facil_all').val(mnRelateFacilArr); $('#mn_relate_facil_all').val(mnRelateFacilArr);
var exNoteArr = []; var exNoteArr = [];
$("input[name='except_note']").each(function(){ exNoteArr.push($(this).val()); }) $("input[name='except_note']").each(function() {
exNoteArr.push($(this).val());
})
$('#except_note_all').val(exNoteArr); $('#except_note_all').val(exNoteArr);
var exSpecArr = []; var exSpecArr = [];
$("input[name='except_spec']").each(function(){ exSpecArr.push($(this).val()); }) $("input[name='except_spec']").each(function() {
exSpecArr.push($(this).val());
})
$('#except_spec_all').val(exSpecArr); $('#except_spec_all').val(exSpecArr);
var exUnitPriceArr = []; var exUnitPriceArr = [];
$("input[name='except_unit_price']").each(function(){ exUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='except_unit_price']").each(function() {
exUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#except_unit_price_all').val(exUnitPriceArr); $('#except_unit_price_all').val(exUnitPriceArr);
var exQtyArr = []; var exQtyArr = [];
$("input[name='except_qty']").each(function(){ exQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='except_qty']").each(function() {
exQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#except_qty_all').val(exQtyArr); $('#except_qty_all').val(exQtyArr);
var exPriceBpArr = []; var exPriceBpArr = [];
$("input[name='except_price_bp']").each(function(){ exPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='except_price_bp']").each(function() {
exPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#except_price_bp_all').val(exPriceBpArr); $('#except_price_bp_all').val(exPriceBpArr);
var demIdArr = []; var demIdArr = [];
$("input[name='dem_id']").each(function(){ demIdArr.push($(this).val()); }) $("input[name='dem_id']").each(function() {
demIdArr.push($(this).val());
})
$('#dem_id_all').val(demIdArr); $('#dem_id_all').val(demIdArr);
var demSeatArr = []; var demSeatArr = [];
$("select[name='seat']").each(function(){ demSeatArr.push($(this).val()); }) $("select[name='seat']").each(function() {
demSeatArr.push($(this).val());
})
$('#seat_all').val(demSeatArr); $('#seat_all').val(demSeatArr);
var demFloorArr = []; var demFloorArr = [];
$("select[name='floor']").each(function(){ demFloorArr.push($(this).val()); }) $("select[name='floor']").each(function() {
demFloorArr.push($(this).val());
})
$('#floor_all').val(demFloorArr); $('#floor_all').val(demFloorArr);
var demUnitPriceArr = []; var demUnitPriceArr = [];
$("input[name='demolition_unit_price']").each(function(){ demUnitPriceArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='demolition_unit_price']").each(function() {
demUnitPriceArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#demolition_unit_price_all').val(demUnitPriceArr); $('#demolition_unit_price_all').val(demUnitPriceArr);
var demQtyArr = []; var demQtyArr = [];
$("input[name='demolition_qty']").each(function(){ demQtyArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='demolition_qty']").each(function() {
demQtyArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#demolition_qty_all').val(demQtyArr); $('#demolition_qty_all').val(demQtyArr);
var demPriceBpArr = []; var demPriceBpArr = [];
$("input[name='demolition_price_bp']").each(function(){ demPriceBpArr.push($(this).val().replace(/[,]+/g,"")); }) $("input[name='demolition_price_bp']").each(function() {
demPriceBpArr.push($(this).val().replace(/[,]+/g, ""));
})
$('#demolition_price_bp_all').val(demPriceBpArr); $('#demolition_price_bp_all').val(demPriceBpArr);
$("input[name='pmstatus']").val($(this).val()); $("input[name='pmstatus']").val($(this).val());
@ -1151,32 +1320,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
*/ */
?> ?>
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data"> <form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data">
<!--
<div>
<label for="contractno">卷號</label>
<input type="text" name="contractno" id="contractno" maxlength="7" required>
</div>
<div>
<label for="person">營業員</label>
<input type="text" name="person" id="person">
</div>
<div>
<label for="company">客戶名稱</label>
<input type="text" name="company" id="company" required>
</div>
<div>
<label for="case_name">案件名稱</label>
<input type="text" name="case_name" id="case_name" required>
</div>
<div>
<label for="address">工地地址</label>
<input type="text" name="address" id="address" required>
</div>
<div>
<label for="compete">競爭對手</label>
<input type="text" name="compete" id="compete">
</div>
-->
<div class="table-responsive"> <div class="table-responsive">
<table id="tb1" class="table table-bordered"> <table id="tb1" class="table table-bordered">
<thead> <thead>
@ -1760,12 +1904,14 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<th>數量</th> <th>數量</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star"><div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯項次">所屬電梯 <th class="star">
<div data-toggle="tooltip" data-placement="auto" title="每次選完OPTION後,請點選右方紅色按鈕「電梯」來勾選電梯項次">所屬電梯
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" /> <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" /> <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
</svg> </svg>
</div></th> </div>
</th>
<th>功能</th> <th>功能</th>
</tr> </tr>
</thead> </thead>
@ -1906,7 +2052,9 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<th>數量(月)</th> <th>數量(月)</th>
<th>複價</th> <th>複價</th>
<th>備註</th> <th>備註</th>
<th class="star">所屬電梯</div></th> <th class="star">所屬電梯
</div>
</th>
<th>功能</th> <th>功能</th>
</tr> </tr>
</thead> </thead>
@ -2157,13 +2305,13 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<tr> <tr>
<td rowspan="4">材料</td> <td rowspan="4">材料</td>
<td>1、訂金<input type="hidden" name="pay_kind" value="1"></td> <td>1、訂金<input type="hidden" name="pay_kind" value="1"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[1]["pay_scale"]; ?>"></td> <td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo empty(@$last_prpay_arr[1]["pay_scale"]) ? 20 : @$last_prpay_arr[1]["pay_scale"]; ?>"></td>
<td id="pay1"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[1]["pay_amount"]); ?>" readonly></td> <td id="pay1"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[1]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
<option value=""></option> <option value=""></option>
<option value="7" <?php if (@$last_prpay_arr[1]["pay_period"] == "7") echo " selected"; ?>>7天</option> <option value="7" <?php if (@$last_prpay_arr[1]["pay_period"] == "7") echo " selected"; ?>>7天</option>
<option value="30"<?php if (@$last_prpay_arr[1]["pay_period"]=="30") echo " selected"; ?>>30天</option> <option value="30" <?php if (@$last_prpay_arr[1]["pay_period"] == "30" || @$last_prpay_arr[1]["pay_period"] == "") echo " selected"; ?>>30天</option>
<option value="60" <?php if (@$last_prpay_arr[1]["pay_period"] == "60") echo " selected"; ?>>60天</option> <option value="60" <?php if (@$last_prpay_arr[1]["pay_period"] == "60") echo " selected"; ?>>60天</option>
<option value="90" <?php if (@$last_prpay_arr[1]["pay_period"] == "90") echo " selected"; ?>>90天</option> <option value="90" <?php if (@$last_prpay_arr[1]["pay_period"] == "90") echo " selected"; ?>>90天</option>
<option value="120" <?php if (@$last_prpay_arr[1]["pay_period"] == "120") echo " selected"; ?>>120天</option> <option value="120" <?php if (@$last_prpay_arr[1]["pay_period"] == "120") echo " selected"; ?>>120天</option>
@ -2191,13 +2339,13 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
</tr> </tr>
<tr> <tr>
<td>3、貨到工地款<input type="hidden" name="pay_kind" value="3"></td> <td>3、貨到工地款<input type="hidden" name="pay_kind" value="3"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[3]["pay_scale"]; ?>"></td> <td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo empty(@$last_prpay_arr[3]["pay_scale"]) ? 50 : @$last_prpay_arr[3]["pay_scale"]; ?>"></td>
<td id="pay3"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[3]["pay_amount"]); ?>" readonly></td> <td id="pay3"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[3]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
<option value=""></option> <option value=""></option>
<option value="7" <?php if (@$last_prpay_arr[3]["pay_period"] == "7") echo " selected"; ?>>7天</option> <option value="7" <?php if (@$last_prpay_arr[3]["pay_period"] == "7") echo " selected"; ?>>7天</option>
<option value="30"<?php if (@$last_prpay_arr[3]["pay_period"]=="30") echo " selected"; ?>>30天</option> <option value="30" <?php if (@$last_prpay_arr[3]["pay_period"] == "30" || @$last_prpay_arr[3]["pay_period"] == "") echo " selected"; ?>>30天</option>
<option value="60" <?php if (@$last_prpay_arr[3]["pay_period"] == "60") echo " selected"; ?>>60天</option> <option value="60" <?php if (@$last_prpay_arr[3]["pay_period"] == "60") echo " selected"; ?>>60天</option>
<option value="90" <?php if (@$last_prpay_arr[3]["pay_period"] == "90") echo " selected"; ?>>90天</option> <option value="90" <?php if (@$last_prpay_arr[3]["pay_period"] == "90") echo " selected"; ?>>90天</option>
<option value="120" <?php if (@$last_prpay_arr[3]["pay_period"] == "120") echo " selected"; ?>>120天</option> <option value="120" <?php if (@$last_prpay_arr[3]["pay_period"] == "120") echo " selected"; ?>>120天</option>
@ -2226,13 +2374,13 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<tr> <tr>
<td rowspan="3">安裝</td> <td rowspan="3">安裝</td>
<td>5、安裝完畢款<input type="hidden" name="pay_kind" value="5"></td> <td>5、安裝完畢款<input type="hidden" name="pay_kind" value="5"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[5]["pay_scale"]; ?>"></td> <td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo empty(@$last_prpay_arr[5]["pay_scale"]) ? 20 : @$last_prpay_arr[5]["pay_scale"];; ?>"></td>
<td id="pay5"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[5]["pay_amount"]); ?>" readonly></td> <td id="pay5"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[5]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
<option value=""></option> <option value=""></option>
<option value="7" <?php if (@$last_prpay_arr[5]["pay_period"] == "7") echo " selected"; ?>>7天</option> <option value="7" <?php if (@$last_prpay_arr[5]["pay_period"] == "7") echo " selected"; ?>>7天</option>
<option value="30"<?php if (@$last_prpay_arr[5]["pay_period"]=="30") echo " selected"; ?>>30天</option> <option value="30" <?php if (@$last_prpay_arr[5]["pay_period"] == "30" || @$last_prpay_arr[5]["pay_period"] == "") echo " selected"; ?>>30天</option>
<option value="60" <?php if (@$last_prpay_arr[5]["pay_period"] == "60") echo " selected"; ?>>60天</option> <option value="60" <?php if (@$last_prpay_arr[5]["pay_period"] == "60") echo " selected"; ?>>60天</option>
<option value="90" <?php if (@$last_prpay_arr[5]["pay_period"] == "90") echo " selected"; ?>>90天</option> <option value="90" <?php if (@$last_prpay_arr[5]["pay_period"] == "90") echo " selected"; ?>>90天</option>
<option value="120" <?php if (@$last_prpay_arr[5]["pay_period"] == "120") echo " selected"; ?>>120天</option> <option value="120" <?php if (@$last_prpay_arr[5]["pay_period"] == "120") echo " selected"; ?>>120天</option>
@ -2243,13 +2391,13 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
</tr> </tr>
<tr> <tr>
<td>6、驗收款<input type="hidden" name="pay_kind" value="6"></td> <td>6、驗收款<input type="hidden" name="pay_kind" value="6"></td>
<td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo @$last_prpay_arr[6]["pay_scale"]; ?>"></td> <td><input type="text" name="pay_scale" class="form-control" size="3" value="<?php echo empty(@$last_prpay_arr[6]["pay_scale"]) ? 10 : @$last_prpay_arr[6]["pay_scale"]; ?>"></td>
<td id="pay6"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[6]["pay_amount"]); ?>" readonly></td> <td id="pay6"><input type="text" name="pay_amount" class="form-control dollar-right" size="8" value="<?php echo number_format(@$last_prpay_arr[6]["pay_amount"]); ?>" readonly></td>
<td> <td>
<select name="pay_period" class="form-control"> <select name="pay_period" class="form-control">
<option value=""></option> <option value=""></option>
<option value="7" <?php if (@$last_prpay_arr[6]["pay_period"] == "7") echo " selected"; ?>>7天</option> <option value="7" <?php if (@$last_prpay_arr[6]["pay_period"] == "7") echo " selected"; ?>>7天</option>
<option value="30"<?php if (@$last_prpay_arr[6]["pay_period"]=="30") echo " selected"; ?>>30天</option> <option value="30" <?php if (@$last_prpay_arr[6]["pay_period"] == "30" || @$last_prpay_arr[6]["pay_period"] == '') echo " selected"; ?>>30天</option>
<option value="60" <?php if (@$last_prpay_arr[6]["pay_period"] == "60") echo " selected"; ?>>60天</option> <option value="60" <?php if (@$last_prpay_arr[6]["pay_period"] == "60") echo " selected"; ?>>60天</option>
<option value="90" <?php if (@$last_prpay_arr[6]["pay_period"] == "90") echo " selected"; ?>>90天</option> <option value="90" <?php if (@$last_prpay_arr[6]["pay_period"] == "90") echo " selected"; ?>>90天</option>
<option value="120" <?php if (@$last_prpay_arr[6]["pay_period"] == "120") echo " selected"; ?>>120天</option> <option value="120" <?php if (@$last_prpay_arr[6]["pay_period"] == "120") echo " selected"; ?>>120天</option>
@ -2312,7 +2460,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
<input type="text" name="qty_total" id="qty_total" value="<?php echo $qty_total; ?>" readonly> <input type="text" name="qty_total" id="qty_total" value="<?php echo $qty_total; ?>" readonly>
</div> </div>
<div> <div>
<label for="special_fee">特殊費用</label> <label for="special_fee">服務費</label>
<input type="text" name="special_fee" id="special_fee" value="<?php if (isset($last_pr_arr["special_fee"])) echo number_format($last_pr_arr["special_fee"]); ?>"> <input type="text" name="special_fee" id="special_fee" value="<?php if (isset($last_pr_arr["special_fee"])) echo number_format($last_pr_arr["special_fee"]); ?>">
</div> </div>
<div> <div>
@ -2365,7 +2513,8 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) {
</div> </div>
<ul> <ul>
<li>業務員權限>=80%以上;<80-75%呈至業務協理審核<75%以下呈至總經理審核</li> <li>營業權限>=85%以上;<85-80%呈至區處長審核<80%以下呈至總經理審核< /li>
</ul> </ul>
<div class="nextline"></div> <div class="nextline"></div>
<label for="attatch1">報價單</label> <label for="attatch1">報價單</label>

6
wms/mkt/pricereview_renovate-edit.php

@ -1,5 +1,4 @@
<?php <?php
phpinfo();
include "../header.php"; include "../header.php";
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.'); $id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
@ -2054,7 +2053,7 @@ foreach ($res as $data) {
<input type="text" name="qty_total" id="qty_total" readonly> <input type="text" name="qty_total" id="qty_total" readonly>
</div> </div>
<div> <div>
<label for="special_fee">特殊費用</label> <label for="special_fee">服務費</label>
<input type="text" name="special_fee" id="special_fee" value="<?php echo number_format($data["special_fee"]); ?>"> <input type="text" name="special_fee" id="special_fee" value="<?php echo number_format($data["special_fee"]); ?>">
</div> </div>
<div> <div>
@ -2103,9 +2102,8 @@ foreach ($res as $data) {
</tbody> </tbody>
</table> </table>
</div> </div>
<ul> <ul>
<li>業務員權限>=80%以上;<80-75%呈至業務協理審核<75%以下呈至總經理審核< /li> <li>營業員權限85%以上;85-80%呈至業務協理審核;80%以下呈至總經理審核。</li>
</ul> </ul>
<div class="nextline"></div> <div class="nextline"></div>
<label for="attatch1">報價單</label> <label for="attatch1">報價單</label>

40
wms/mkt/pricereview_renovate-index.php

@ -137,7 +137,7 @@ if ($data) :
?> ?>
<link rel="stylesheet" href="common.css"> <link rel="stylesheet" href="common.css">
<div style="overflow-x:auto; white-space:nowrap;"> <div style="overflow-x:auto; white-space:nowrap;">
<table id="table_index2" class="table table-striped table-bordered" style="width:100%"> <table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead> <thead>
<tr> <tr>
<th>項次</th> <th>項次</th>
@ -154,7 +154,8 @@ if ($data) :
<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>
@ -208,15 +209,30 @@ if ($data) :
<?php <?php
//if ($oneself && !($data["status"] == "YY" || $data["status"] == "YN")) { // 自己可以進行規調 //if ($oneself && !($data["status"] == "YY" || $data["status"] == "YN")) { // 自己可以進行規調
if ($oneself) { if ($oneself) {
// 重填價審只能有最新一筆,填規調只有最新一筆可以填。
$contractno = $data['contractno'];
$sql = "SELECT MAX(id),COUNT(*) FROM pricereview_main WHERE contractno = '$contractno' ORDER BY id DESC";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_row($result);
$maxContractID = $row[0];
$countContract = $row[1];
// echo '<pre>';
// print_r($maxContractID);
// echo '</pre>';
if ($data["status"] == "Y1") { if ($data["status"] == "Y1") {
?> ?>
<a href="pricereview_renovate-edit.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-primary btn-sm">修改</a> <a href="pricereview_renovate-edit.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-primary btn-sm">修改</a>
<a href="pricereview_renovate-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-secondary btn-sm" onClick="return confirm('Are you sure you want to delete?')">刪除</a> <a href="pricereview_renovate-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-secondary btn-sm" onClick="return confirm('Are you sure you want to delete?')">刪除</a>
<?php <?php
} elseif ($data["status"] == "YS") { } elseif ($data["status"] == "YS" && $countContract == 0) {
?> ?>
<a href="specsurvey_renovate-create.php?mid=<?= $data['id']; ?>&function_name=specsurvey_renovate&token=<?= $token; ?>" class="btn btn-danger btn-sm">填規調</a> <a href="specsurvey_renovate-create.php?mid=<?= $data['id']; ?>&function_name=specsurvey_renovate&token=<?= $token; ?>" class="btn btn-danger btn-sm">填規調</a>
<?php <?php
} elseif ($data['status'] == "YN" && $data['id'] == $maxContractID) {
?>
<a href="pricereview_renovate-create.php?vol_no=<?= $data['contractno']; ?>&id=<?= $data['id'] ?>&function_name=pricereview_renovate&token=<?= $token; ?>" class="btn btn-danger btn-sm">重填價審</a>
<?php
} }
} }
?> ?>
@ -271,6 +287,24 @@ if ($data) :
//echo $str; //echo $str;
?> ?>
</td> </td>
<td>
<?php
$str = $uperson = $ustatus = $udtte = "";
if (!empty($sign2)) list($uperson, $ustatus, $udtte) = explode(",", $sign2);
if ($ustatus) {
if ($ustatus == "Y") $str = "<span class=\"glyphicon glyphicon-ok\" title=\"同意\"></span>";
elseif ($ustatus == "N") $str = "<span class=\"glyphicon glyphicon-ban-circle\" title=\"不同意\"></span>";
$str .= "<br>" . $accountname_arr[$uperson] . "<br>" . $udtte;
} else {
if ($sign_st == 2 && $sign_nt == $user_id && $data["status"] == "YS") {
$str = "<span class=\"glyphicon glyphicon-user\"></span>";
$str = "待簽核";
$str = "<a href=\"pricereview_renovate-check.php?st=2&id=" . $data["id"] . "&" . $para . "\" class=\"btn btn-primary btn-sm\">" . $str . "</a>";
} else $str = "--";
}
echo $str;
?>
</td>
<td> <td>
<?php <?php
$str = $uperson = $ustatus = $udtte = ""; $str = $uperson = $ustatus = $udtte = "";

2
wms/mkt/pricereview_renovate-record-submit.php

@ -1,4 +1,5 @@
<?php <?php
/** /**
* 沒有選擇M1/M4的-->全汰改 * 沒有選擇M1/M4的-->全汰改
*/ */
@ -346,4 +347,3 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
echo "</script>"; echo "</script>";
} }
} }
?>

60
wms/rib-invoice-check.php

@ -0,0 +1,60 @@
<?php
include "header.php";
$sql = "SELECT
B.rib_id,B.BillNo,B.DeptId, B.CreatorId, C.name, A.InvoiceNo,B.CurrentState
FROM `rib_sub` AS A
LEFT JOIN `rib` AS B
ON A.rib_id=B.rib_id
LEFT JOIN `account` AS C ON A.CreatorId=C.accountid
WHERE B.CurrentState
IN (1,2,4) AND A.InvoiceNo IS NOT NULL AND trim(A.InvoiceNo)!='' AND B.BillNo NOT IN ('M0056231003','M0056231002')
ORDER BY A.InvoiceNo";
$query = mysqli_query($link, $sql);
$array = array();
$repeat_array = array();
foreach ($query as $value) {
$InvoiceNo = preg_replace('/\s(?=)/', '', $value['InvoiceNo']);
$InvoiceNo = str_replace('-', '', $InvoiceNo);
// echo $InvoiceNo." //".$value['BillNo'];
// echo "<br>";
if (isset($array[$InvoiceNo])) {
if (in_array($value['BillNo'], $array[$InvoiceNo]['BillNo'])) {
} else {
array_push($array[$InvoiceNo]['BillNo'], $value['BillNo']);
array_push($array[$InvoiceNo]['InvoiceNo'], $value['InvoiceNo']);
$repeat_array[$InvoiceNo]['BillNo']= $array[$InvoiceNo]['BillNo'];
$repeat_array[$InvoiceNo]['InvoiceNo']= $array[$InvoiceNo]['InvoiceNo'];
}
} else {
// $array[$InvoiceNo] = array($value['BillNo']);
$array[$InvoiceNo]['BillNo']= array($value['BillNo']);
$array[$InvoiceNo]['InvoiceNo']=array($value['InvoiceNo']);
}
}
$duplicate = "(";
foreach($repeat_array as $repeat){
$tmp = "'";
$tmp .= implode("','",$repeat['InvoiceNo']);
$tmp .="'";
$duplicate .= $tmp.",";
}
$duplicate = substr($duplicate,0,-1);
$duplicate.=")";
// // echo $repeat."<br>";
$sql_repeat = "SELECT
A.rib_id,A.BillNo, A.CurrentState, A.CreatorId,C.name,B.InvoiceNo, A.GatheringPersonId,A.WriteOffAmount,A.CreateTime
FROM `rib_sub` AS B
LEFT JOIN `rib` AS A ON A.rib_id=B.rib_id
LEFT JOIN `account` AS C ON A.CreatorId=C.accountid
WHERE A.CurrentState IN (1,2,4)
AND B.InvoiceNo IN $duplicate ORDER BY B.InvoiceNo";
$repeat_query = mysqli_query($link, $sql_repeat);
foreach($repeat_query as $value){
echo $value['rib_id'].";".$value['BillNo'].";".$value['CurrentState'].";".$value['CreatorId'].";".$value['name'].";".$value['InvoiceNo'].";".$value['GatheringPersonId'].";".$value['WriteOffAmount'].";".$value['CreateTime'];
echo "<br>";
}
?>

20
wms/rib02-create.php

@ -7,8 +7,10 @@ $CurrId = isset($_GET['CurrId']) ? $_GET['CurrId'] : null;
$sql_rib = ""; $sql_rib = "";
if (empty($rib_id)) { if (empty($rib_id)) {
$sql_rib = "SELECT * FROM rib WHERE BillNo = '$BillNo' && CurrentState=0"; $sql_rib = "SELECT * FROM rib WHERE BillNo = '$BillNo' && CurrentState=0";
$sql_invoiceNo = "SELECT DISTINCT InvoiceNo FROM rib_sub WHERE BillNo!==$BillNo";
} else { } else {
$sql_rib = "SELECT * FROM rib WHERE rib_id = $rib_id"; $sql_rib = "SELECT * FROM rib WHERE rib_id = $rib_id";
$sql_invoiceNo = "SELECT DISTINCT InvoiceNo FROM rib_sub WHERE rib_id!==$rib_id";
} }
$rib_query = mysqli_query($link, $sql_rib); $rib_query = mysqli_query($link, $sql_rib);
if (mysqli_num_rows($rib_query) > 0) { if (mysqli_num_rows($rib_query) > 0) {
@ -114,7 +116,17 @@ foreach ($BizPartner as $biz) {
array_push($BusinessPartner, $bizKey); array_push($BusinessPartner, $bizKey);
$bizcount += 1; $bizcount += 1;
} }
// 取得所有報銷過的發票號碼
$invoiceNo = mysqli_query($link, $sql_invoiceNo);
$invoiceNo_array = array();
foreach ($invoiceNo as $invoice) {
array_push($invoiceNo_array, $invoice['InvoiceNo']);
}
$BizJSON = json_encode($BusinessPartner); $BizJSON = json_encode($BusinessPartner);
$InvoiceJSON = json_encode($invoiceNo_array);
$sql_Project = "SELECT * FROM comProject"; $sql_Project = "SELECT * FROM comProject";
$projects = $conn->query($sql_Project); $projects = $conn->query($sql_Project);
$sql_Material = "SELECT * FROM comMaterialGroup"; $sql_Material = "SELECT * FROM comMaterialGroup";
@ -389,7 +401,7 @@ $materials = $conn->query($sql_Material);
</div> </div>
<div class="col-md-3" id="NotInvoice2"> <div class="col-md-3" id="NotInvoice2">
<label for="InvoiceNo">發票號碼</label> <label for="InvoiceNo">發票號碼</label>
<input class="form-control" type="text" name="InvoiceNo" id="InvoiceNo"> <input class="form-control" type="text" name="InvoiceNo" id="InvoiceNo" onblur="checkInvoice()">
</div> </div>
</div> </div>
@ -665,6 +677,12 @@ $materials = $conn->query($sql_Material);
window.open('rib02-invoice.php', '發票範例', config = 'height=600, width=600'); window.open('rib02-invoice.php', '發票範例', config = 'height=600, width=600');
} }
function checkInvoice(){
var invoiceArray = <?= $InvoiceJSON ?>;
if($.inArray($("#InvoiceNo").val(),invoiceArray) !== -1) {
alert("此發票已報銷過");
$("#InvoiceNo").val('');}
}
function changeWriteOffId(SelectedDept) { function changeWriteOffId(SelectedDept) {
var SelectDeptId = 'WriteOff' + SelectedDept + '-'; var SelectDeptId = 'WriteOff' + SelectedDept + '-';

19
wms/rib02-edit.php

@ -55,7 +55,18 @@ foreach ($BizPartner as $biz) {
array_push($BusinessPartner, $bizKey); array_push($BusinessPartner, $bizKey);
$bizcount += 1; $bizcount += 1;
} }
// 取得所有報銷過的發票號碼
$rib_id = $ribsub['rib_id'];
$sql_invoiceNo = "SELECT DISTINCT InvoiceNo FROM rib_sub WHERE rib_id !== $rib_id";
$invoiceNo = mysqli_query($link, $sql_invoiceNo);
$invoiceNo_array = array();
foreach ($invoiceNo as $invoice) {
array_push($invoiceNo_array, $invoice['InvoiceNo']);
}
$BizJSON = json_encode($BusinessPartner); $BizJSON = json_encode($BusinessPartner);
$InvoiceJSON = json_encode($invoiceNo_array);
$sql_Project = "SELECT * FROM comProject"; $sql_Project = "SELECT * FROM comProject";
$projects = $conn->query($sql_Project); $projects = $conn->query($sql_Project);
$sql_Material = "SELECT * FROM comMaterialGroup"; $sql_Material = "SELECT * FROM comMaterialGroup";
@ -410,7 +421,7 @@ $materials = $conn->query($sql_Material);
</div> </div>
<div class="col-md-3" id="NotInvoice2"> <div class="col-md-3" id="NotInvoice2">
<label for="InvoiceNo">發票號碼</label> <label for="InvoiceNo">發票號碼</label>
<input class="form-control" type="text" name="InvoiceNo" id="InvoiceNo" value="<?= $ribsub['InvoiceNo'] ?>"> <input class="form-control" type="text" name="InvoiceNo" id="InvoiceNo" value="<?= $ribsub['InvoiceNo'] ?>" onblur="checkInvoice()">
</div> </div>
</div> </div>
<div> <div>
@ -683,6 +694,12 @@ $materials = $conn->query($sql_Material);
window.open('rib02-invoice.php', '新視窗的名稱', config = 'height=600, width=600'); window.open('rib02-invoice.php', '新視窗的名稱', config = 'height=600, width=600');
} }
function checkInvoice(){
var invoiceArray = <?= $InvoiceJSON ?>;
if($.inArray($("#InvoiceNo").val().replace("-", ""),invoiceArray) !== -1) {
alert("此發票已報銷過");
$("#InvoiceNo").val('');}
}
function changeWriteOffId(SelectedDept) { function changeWriteOffId(SelectedDept) {
var SelectDeptId = 'WriteOff' + SelectedDept + '-'; var SelectDeptId = 'WriteOff' + SelectedDept + '-';

9
wms/rib02-submit.php

@ -15,6 +15,13 @@ foreach ($BizPartner as $biz) {
$bizValue = $biz['BizPartnerName']; $bizValue = $biz['BizPartnerName'];
$BusinessPartner[$bizKey] = $bizValue; $BusinessPartner[$bizKey] = $bizValue;
} }
// 取得所有報銷過的發票號碼
$sql_invoiceNo = "SELECT DISTINCT InvoiceNo FROM rib_sub WHERE rib_id !== $rib_id";
$invoiceNo = mysqli_query($link, $sql_invoiceNo);
$invoiceNo_array = array();
foreach ($invoiceNo as $invoice) {
array_push($invoiceNo_array, $invoice['InvoiceNo']);
}
$RowCode = $_POST['RowCode']; $RowCode = $_POST['RowCode'];
$FeeDate = $_POST['FeeDate']; $FeeDate = $_POST['FeeDate'];
@ -35,7 +42,7 @@ $IsCounteract = $_POST['IsCounteract'];
$InvoiceId = $_POST['InvoiceId']; $InvoiceId = $_POST['InvoiceId'];
$VoucherCount = empty($_POST['VoucherCount']) ? 1 : $_POST['VoucherCount']; $VoucherCount = empty($_POST['VoucherCount']) ? 1 : $_POST['VoucherCount'];
$VoucherType = isset($_POST['VoucherType']) ? $_POST['VoucherType'] : 0; $VoucherType = isset($_POST['VoucherType']) ? $_POST['VoucherType'] : 0;
$InvoiceNo = empty($_POST['InvoiceNo']) ? NULL : $_POST['InvoiceNo']; $InvoiceNo = empty($_POST['InvoiceNo']) ? " ": (in_array(str_replace("-", "",$_POST['InvoiceNo']), $invoiceNo_array) ? " ": str_replace("-", "",$_POST['InvoiceNo']));
$CurrLAmount = empty($_POST['CurrLAmount']) ? null : $_POST['CurrLAmount']; $CurrLAmount = empty($_POST['CurrLAmount']) ? null : $_POST['CurrLAmount'];
// $comSupplierName = empty($_POST['comSupplierName']) ? null : $_POST['comSupplierName']; // $comSupplierName = empty($_POST['comSupplierName']) ? null : $_POST['comSupplierName'];

2
wms/schedule-index.php

@ -38,7 +38,7 @@ if (!empty($sql_cmd2)) {
} }
//$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id"; //$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id";
$sql = "SELECT * FROM schedule $sql_cmd ORDER BY id asc"; $sql = "SELECT * FROM schedule $sql_cmd ORDER BY id desc";
if (!$page_close) $sql .= " limit $page_from, $page_each"; if (!$page_close) $sql .= " limit $page_from, $page_each";
//echo $sql; //echo $sql;

8
wms/sign/list.php

@ -38,10 +38,10 @@ if ($result == false) {
die(mysqli_error($link)); die(mysqli_error($link));
} }
$res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC); $res_get = mysqli_fetch_all(mysqli_query($link, $sql_get), MYSQLI_ASSOC);
echo '<pre>'; // echo '<pre>';
print_r($sql_get); // print_r($sql_get);
echo '</pre>'; // echo '</pre>';
exit; // exit;
$system_name_opt = array_map(function ($item) { $system_name_opt = array_map(function ($item) {
return array('system_id' => $item['system_id'], 'system_name' => $item['system_name']); return array('system_id' => $item['system_id'], 'system_name' => $item['system_name']);

Loading…
Cancel
Save