|
@ -99,7 +99,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
<tr> |
|
|
<tr> |
|
|
<td style="vertical-align: middle">合約號</td> |
|
|
<td style="vertical-align: middle">合約號</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="text" name="contractno" value="<?= $row["contractno"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="text" id="contractno" name="contractno" value="<?= $row["contractno"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<?php |
|
|
<?php |
|
|
if (in_array($user_department_id, [311, 312, 313, 314, 315, 501, 511, 512, 513, 514, 220, 911, 50, 320, 250])) { |
|
|
if (in_array($user_department_id, [311, 312, 313, 314, 315, 501, 511, 512, 513, 514, 220, 911, 50, 320, 250])) { |
|
|
$sql = " |
|
|
$sql = " |
|
@ -120,11 +120,11 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">作番號</td> |
|
|
<td style="vertical-align: middle">作番號</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="text" name="facilityno" value="<?= $row["facilityno"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="text" name="facilityno" value="<?= $row["facilityno"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">汰改種類</td> |
|
|
<td style="vertical-align: middle">汰改種類</td> |
|
|
<td style="vertical-align: middle"> |
|
|
<td style="vertical-align: middle"> |
|
|
<select class="form-control" multiple="multiple" id="renovate_type" name="renovate_type[]" <?php echo $update_delete_status; ?>> |
|
|
<select class="form-control disabled_select" multiple="multiple" id="renovate_type" name="renovate_type[]" <?php echo $update_delete_status; ?>> |
|
|
<option value="M1">M1</option> |
|
|
<option value="M1">M1</option> |
|
|
<option value="M2">M2</option> |
|
|
<option value="M2">M2</option> |
|
|
<option value="M3">M3</option> |
|
|
<option value="M3">M3</option> |
|
@ -134,21 +134,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">合約交期<br />(到工地)</td> |
|
|
<td style="vertical-align: middle">合約交期<br />(到工地)</td> |
|
|
<td style="vertical-align: middle"> |
|
|
<td style="vertical-align: middle"> |
|
|
<input class="form-control" type="date" name="contract_arrival_date" value="<?= $row['contract_arrival_date']; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="date" name="contract_arrival_date" value="<?= $row['contract_arrival_date']; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td style="vertical-align: middle">客戶名稱</td> |
|
|
<td style="vertical-align: middle">客戶名稱</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="text" name="custom" value="<?= $row["custom"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="text" name="custom" value="<?= $row["custom"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">號機</td> |
|
|
<td style="vertical-align: middle">號機</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="text" name="facility_temp_no" value="<?= $row["facility_temp_no"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="text" name="facility_temp_no" value="<?= $row["facility_temp_no"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">工地負責人</td> |
|
|
<td style="vertical-align: middle">工地負責人</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="text" name="site_manager" value="<?= $row["site_manager"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="text" name="site_manager" value="<?= $row["site_manager"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">預計交期(到工地) |
|
|
<td style="vertical-align: middle">預計交期(到工地) |
|
|
<br /> |
|
|
<br /> |
|
@ -158,21 +158,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
?> |
|
|
?> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle"> |
|
|
<td style="vertical-align: middle"> |
|
|
<input class="form-control " type="date" value="<?= $row['real_contract_arrival_date']; ?>" disabled> |
|
|
<input class="form-control disabled_select" type="date" value="<?= $row['real_contract_arrival_date']; ?>" disabled> |
|
|
</td> |
|
|
</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<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 " type="text" name="longitude" value="<?= $row["longitude"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="text" name="longitude" value="<?= $row["longitude"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">緯度</td> |
|
|
<td style="vertical-align: middle">緯度</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="text" name="latitude" value="<?= $row["latitude"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="text" name="latitude" value="<?= $row["latitude"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">地址</td> |
|
|
<td style="vertical-align: middle">地址</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="text" name="address" value="<?= $row["address"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="text" name="address" value="<?= $row["address"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">工地地址<br /> |
|
|
<td style="vertical-align: middle">工地地址<br /> |
|
|
<?php |
|
|
<?php |
|
@ -187,29 +187,29 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
<tr> |
|
|
<tr> |
|
|
<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 " type="number" name="weight" min="0" value="<?= $row["weight"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="number" name="weight" min="0" value="<?= $row["weight"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</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 " type="number" name="numberofpassenger" min="0" value="<?= $row["numberofpassenger"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="number" name="numberofpassenger" min="0" value="<?= $row["numberofpassenger"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">樓停</td> |
|
|
<td style="vertical-align: middle">樓停</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="number" name="numberofstop" min="0" value="<?= $row["numberofstop"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="number" id="numberofstop" name="numberofstop" min="0" value="<?= $row["numberofstop"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">樓層</td> |
|
|
<td style="vertical-align: middle">樓層</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="number" name="numberoffloor" min="0" value="<?= $row["numberoffloor"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="number" name="numberoffloor" min="0" value="<?= $row["numberoffloor"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td style="vertical-align: middle">機型</td> |
|
|
<td style="vertical-align: middle">機型</td> |
|
|
<td> |
|
|
<td> |
|
|
<input class="form-control " type="text" name="facility_kind" value="<?= $row["facility_kind"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="text" name="facility_kind" value="<?= $row["facility_kind"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">開門方式</td> |
|
|
<td style="vertical-align: middle">開門方式</td> |
|
|
<td style="vertical-align: middle"> |
|
|
<td style="vertical-align: middle"> |
|
|
<select class="form-control" name="opentype" <?php echo $update_delete_status; ?>> |
|
|
<select class="form-control disabled_select" name="opentype" <?php echo $update_delete_status; ?>> |
|
|
<option value=""></option> |
|
|
<option value=""></option> |
|
|
<?php |
|
|
<?php |
|
|
foreach ($opendoor_options as $opendoor_option) : |
|
|
foreach ($opendoor_options as $opendoor_option) : |
|
@ -224,7 +224,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
</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 " type="number" name="speed" min="0" value="<?= $row["speed"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
<input class="form-control disabled_select" type="number" name="speed" min="0" value="<?= $row["speed"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle">簽核狀況</td> |
|
|
<td style="vertical-align: middle">簽核狀況</td> |
|
|
<td style="vertical-align: middle"> |
|
|
<td style="vertical-align: middle"> |
|
@ -550,8 +550,11 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
<tr> |
|
|
<tr> |
|
|
<td colspan="4"> |
|
|
<td colspan="4"> |
|
|
<?php |
|
|
<?php |
|
|
if (getSaveInstallDataButtonStatus($user_department_id, $role_id)) |
|
|
if (getSaveInstallDataButtonStatus($user_department_id, $role_id)) { |
|
|
echo "<button onclick='saveInstallData()' type='button' class='btn btn-primary btn-lg pull-right' style='margin-left:3px;'>存檔</button>"; |
|
|
echo "<button onclick='saveInstallData()' type='button' class='btn btn-primary btn-lg pull-right' style='margin-left:3px;'>存檔</button>"; |
|
|
|
|
|
echo "<label class='pull-right' for='change_all_contractno_tmp'> 變更此合約全部日期</label>"; |
|
|
|
|
|
echo "<input class='pull-right' type='checkbox' id='change_all_contractno_tmp' value='1' />"; |
|
|
|
|
|
} |
|
|
?> |
|
|
?> |
|
|
</td> |
|
|
</td> |
|
|
</tr> |
|
|
</tr> |
|
@ -689,9 +692,9 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
<td style="vertical-align: middle">移交日</td> |
|
|
<td style="vertical-align: middle">移交日</td> |
|
|
<td style="vertical-align: middle"> |
|
|
<td style="vertical-align: middle"> |
|
|
<div class="input-group"> |
|
|
<div class="input-group"> |
|
|
<input class="form-control" type="date" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing; ?>> |
|
|
<input class="form-control" type="date" id="delivery_date" name="delivery_date" value="<?= $row['delivery_date']; ?>" <?= $marketing2; ?>> |
|
|
<span class="input-group-btn"> |
|
|
<span class="input-group-btn"> |
|
|
<button class="btn btn-default" type='button' onclick='$("#delivery_date").val("");' <?= $marketing; ?>>清除</button> |
|
|
<button class="btn btn-default" type='button' onclick='$("#delivery_date").val("");' <?= $marketing2; ?>>清除</button> |
|
|
</span> |
|
|
</span> |
|
|
</div> |
|
|
</div> |
|
|
</td> |
|
|
</td> |
|
@ -1146,8 +1149,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
<?php |
|
|
<?php |
|
|
} else { |
|
|
} else { |
|
|
// 生管 小雯 預計到貨日(到觀音廠日)權限 |
|
|
// 生管 小雯 預計到貨日(到觀音廠日)權限 |
|
|
if ($user_id == 'M0168') |
|
|
if ($user_id == 'M0168') { |
|
|
{ |
|
|
|
|
|
?> |
|
|
?> |
|
|
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> |
|
|
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> |
|
|
<?php |
|
|
<?php |
|
@ -1332,10 +1334,32 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
(工務助理項目) |
|
|
(工務助理項目) |
|
|
</td> |
|
|
</td> |
|
|
</tr> |
|
|
</tr> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td style="vertical-align: middle">發包類型</td> |
|
|
|
|
|
<td> |
|
|
|
|
|
<input type='radio' class="disabled_select" name='outsourcer_type' id='outsourcer_type_I' value='I' <?php echo $row['outsourcer_type'] == 'I' ? 'checked' : ''; |
|
|
|
|
|
echo $warehouse2; ?> /> |
|
|
|
|
|
<label for='outsourcer_type_I'>安裝</label> |
|
|
|
|
|
<input type='radio' class="disabled_select" name='outsourcer_type' id='outsourcer_type_T' value='T' <?php echo $row['outsourcer_type'] == 'T' ? 'checked' : ''; |
|
|
|
|
|
echo $warehouse2; ?> /> |
|
|
|
|
|
<label for='outsourcer_type_T'>試車</label> |
|
|
|
|
|
<input type='radio' class="disabled_select" name='outsourcer_type' id='outsourcer_type_IT' value='IT' <?php echo $row['outsourcer_type'] == 'IT' ? 'checked' : ''; |
|
|
|
|
|
echo $warehouse2; ?> /> |
|
|
|
|
|
<label for='outsourcer_type_IT'>安裝+試車</label> |
|
|
|
|
|
<?php |
|
|
|
|
|
if (getSaveEstimateInstallData($user_department_id, $role_id)) { |
|
|
|
|
|
?> |
|
|
|
|
|
<button type='button' class='btn btn-default disabled_select' onclick='setOutSourcerDate();' <?php echo $warehouse2; ?>>帶入日期</button> |
|
|
|
|
|
<button type='button' class='btn btn-default disabled_select' onclick='resetAllOutSourcerDate();' <?php echo $warehouse2; ?>>清除日期</button> |
|
|
|
|
|
<?php |
|
|
|
|
|
} |
|
|
|
|
|
?> |
|
|
|
|
|
</td> |
|
|
|
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td style="vertical-align: middle">安裝發包廠商</td> |
|
|
<td style="vertical-align: middle">安裝發包廠商</td> |
|
|
<td> |
|
|
<td> |
|
|
<input name="install_outsourcer disabled_select" id="install_outsourcer" class="form-control disabled_select" type="text" value="<?php echo $row['install_outsourcer']; ?>" <?= $warehouse2; ?> /> |
|
|
<input name="install_outsourcer" id="install_outsourcer" class="form-control disabled_select" type="text" value="<?php echo $row['install_outsourcer']; ?>" <?= $warehouse2; ?> /> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle;">確認人</td> |
|
|
<td style="vertical-align: middle;">確認人</td> |
|
|
<td> |
|
|
<td> |
|
@ -1402,7 +1426,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
<tr> |
|
|
<tr> |
|
|
<td style="vertical-align: middle">試車發包廠商</td> |
|
|
<td style="vertical-align: middle">試車發包廠商</td> |
|
|
<td> |
|
|
<td> |
|
|
<input name="tryrun_outsourcer disabled_select" id="tryrun_outsourcer" class="form-control disabled_select" type="text" value="<?php echo $row['tryrun_outsourcer']; ?>" <?= $warehouse2; ?> /> |
|
|
<input name="tryrun_outsourcer" id="tryrun_outsourcer" class="form-control disabled_select" type="text" value="<?php echo $row['tryrun_outsourcer']; ?>" <?= $warehouse2; ?> /> |
|
|
</td> |
|
|
</td> |
|
|
<td style="vertical-align: middle;">確認人</td> |
|
|
<td style="vertical-align: middle;">確認人</td> |
|
|
<td> |
|
|
<td> |
|
@ -1525,6 +1549,8 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
</form> |
|
|
</form> |
|
|
|
|
|
|
|
|
<form method="post" id="update_install_date_form" enctype="multipart/form-data"> |
|
|
<form method="post" id="update_install_date_form" enctype="multipart/form-data"> |
|
|
|
|
|
<input type="hidden" id="change_all_contractno" name='change_all_contractno' value="0" /> |
|
|
|
|
|
<input type="hidden" id="contractno2" name='contractno2' value="<?php echo $row['contractno']; ?>" /> |
|
|
<input type="hidden" id="install_start_date" name='install_start_date' value="<?php echo $row['install_start_date']; ?>" /> |
|
|
<input type="hidden" id="install_start_date" name='install_start_date' value="<?php echo $row['install_start_date']; ?>" /> |
|
|
<input type="hidden" id="install_start_date_owner" name='install_start_date_owner' value="<?php echo $row['install_start_date_owner']; ?>" /> |
|
|
<input type="hidden" id="install_start_date_owner" name='install_start_date_owner' value="<?php echo $row['install_start_date_owner']; ?>" /> |
|
|
<input type="hidden" id="install_end_date" name='install_end_date' value="<?php echo $row['install_end_date']; ?>" /> |
|
|
<input type="hidden" id="install_end_date" name='install_end_date' value="<?php echo $row['install_end_date']; ?>" /> |
|
@ -1906,15 +1932,156 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php"; |
|
|
|
|
|
|
|
|
function saveInstallData() { |
|
|
function saveInstallData() { |
|
|
if (confirm('確定要更改實際安裝日程嗎?') == true) { |
|
|
if (confirm('確定要更改實際安裝日程嗎?') == true) { |
|
|
$("#install_start_date").val($("#install_start_date_tmp").val()); |
|
|
if ($("#change_all_contractno_tmp").prop('checked')) { |
|
|
$("#install_start_date_owner").val($("#install_start_date_owner_tmp").val()); |
|
|
if ($("#contractno").val() == '' || $("#contractno").val() == null) { |
|
|
$("#install_end_date").val($("#install_end_date_tmp").val()); |
|
|
alert("合約號空白"); |
|
|
$("#install_end_date_owner").val($("#install_end_date_owner_tmp").val()); |
|
|
} else { |
|
|
$("#tryrun_start_date").val($("#tryrun_start_date_tmp").val()); |
|
|
$("#change_all_contractno").val($("#change_all_contractno_tmp").prop('checked')); |
|
|
$("#tryrun_start_date_owner").val($("#tryrun_start_date_owner_tmp").val()); |
|
|
$("#contractno2").val($("#contractno").val()); |
|
|
$("#tryrun_end_date").val($("#tryrun_end_date_tmp").val()); |
|
|
$("#install_start_date").val($("#install_start_date_tmp").val()); |
|
|
$("#tryrun_end_date_owner").val($("#tryrun_end_date_owner_tmp").val()); |
|
|
$("#install_start_date_owner").val($("#install_start_date_owner_tmp").val()); |
|
|
$('#update_install_date_form').submit(); |
|
|
$("#install_end_date").val($("#install_end_date_tmp").val()); |
|
|
|
|
|
$("#install_end_date_owner").val($("#install_end_date_owner_tmp").val()); |
|
|
|
|
|
$("#tryrun_start_date").val($("#tryrun_start_date_tmp").val()); |
|
|
|
|
|
$("#tryrun_start_date_owner").val($("#tryrun_start_date_owner_tmp").val()); |
|
|
|
|
|
$("#tryrun_end_date").val($("#tryrun_end_date_tmp").val()); |
|
|
|
|
|
$("#tryrun_end_date_owner").val($("#tryrun_end_date_owner_tmp").val()); |
|
|
|
|
|
$('#update_install_date_form').submit(); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
$("#install_start_date").val($("#install_start_date_tmp").val()); |
|
|
|
|
|
$("#install_start_date_owner").val($("#install_start_date_owner_tmp").val()); |
|
|
|
|
|
$("#install_end_date").val($("#install_end_date_tmp").val()); |
|
|
|
|
|
$("#install_end_date_owner").val($("#install_end_date_owner_tmp").val()); |
|
|
|
|
|
$("#tryrun_start_date").val($("#tryrun_start_date_tmp").val()); |
|
|
|
|
|
$("#tryrun_start_date_owner").val($("#tryrun_start_date_owner_tmp").val()); |
|
|
|
|
|
$("#tryrun_end_date").val($("#tryrun_end_date_tmp").val()); |
|
|
|
|
|
$("#tryrun_end_date_owner").val($("#tryrun_end_date_owner_tmp").val()); |
|
|
|
|
|
$('#update_install_date_form').submit(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setOutSourcerDate() { |
|
|
|
|
|
|
|
|
|
|
|
// 發包類型 |
|
|
|
|
|
let outsourcer_type = $("input[name^='outsourcer_type']:checked").val(); |
|
|
|
|
|
// 預計出貨日(到工地) |
|
|
|
|
|
let real_contract_arrival_date = $("#real_contract_arrival_date").val(); |
|
|
|
|
|
// 樓停 |
|
|
|
|
|
let numberofstop = $("#numberofstop").val(); |
|
|
|
|
|
// 目前操作者 |
|
|
|
|
|
let user_id = '<?php echo $user_id; ?>'; |
|
|
|
|
|
|
|
|
|
|
|
if (getSetOutSourcerDateStatus() == '1') { |
|
|
|
|
|
if (outsourcer_type === 'I') { |
|
|
|
|
|
resetTOutSourcerDate(); |
|
|
|
|
|
$("#estimate_install_start_date").val(dateAddDays(real_contract_arrival_date, 5)); |
|
|
|
|
|
$("#estimate_install_start_date_owner").val(user_id); |
|
|
|
|
|
$("#estimate_install_end_date").val( |
|
|
|
|
|
dateAddDays($("#estimate_install_start_date").val(), specificationDayFormula(numberofstop)) |
|
|
|
|
|
); |
|
|
|
|
|
$("#estimate_install_end_date_owner").val(user_id); |
|
|
|
|
|
} |
|
|
|
|
|
if (outsourcer_type === 'T') { |
|
|
|
|
|
resetIOutSourcerDate(); |
|
|
|
|
|
$("#estimate_tryrun_start_date").val(dateAddDays(real_contract_arrival_date, 5)); |
|
|
|
|
|
$("#estimate_tryrun_start_date_owner").val(user_id); |
|
|
|
|
|
$("#estimate_tryrun_end_date").val( |
|
|
|
|
|
dateAddDays($("#estimate_tryrun_start_date").val(), specificationDayFormula(numberofstop)) |
|
|
|
|
|
); |
|
|
|
|
|
$("#estimate_tryrun_end_date_owner").val(user_id); |
|
|
|
|
|
} |
|
|
|
|
|
if (outsourcer_type === 'IT') { |
|
|
|
|
|
$("#estimate_install_start_date").val(dateAddDays(real_contract_arrival_date, 5)); |
|
|
|
|
|
$("#estimate_install_start_date_owner").val(user_id); |
|
|
|
|
|
$("#estimate_install_end_date").val( |
|
|
|
|
|
dateAddDays($("#estimate_install_start_date").val(), specificationDayFormula(numberofstop)) |
|
|
|
|
|
); |
|
|
|
|
|
$("#estimate_install_end_date_owner").val(user_id); |
|
|
|
|
|
$("#estimate_tryrun_start_date").val(dateAddDays($("#estimate_install_end_date").val(), 1)); |
|
|
|
|
|
$("#estimate_tryrun_start_date_owner").val(user_id); |
|
|
|
|
|
$("#estimate_tryrun_end_date").val( |
|
|
|
|
|
dateAddDays($("#estimate_tryrun_start_date").val(), specificationDayFormula(numberofstop)) |
|
|
|
|
|
); |
|
|
|
|
|
$("#estimate_tryrun_end_date_owner").val(user_id); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
const errrMessage = { |
|
|
|
|
|
'2': '請選擇發包種類', |
|
|
|
|
|
'3': '樓停未填寫', |
|
|
|
|
|
'4': '預計交期(到工地)未填寫' |
|
|
|
|
|
} |
|
|
|
|
|
if ((errrMessage[getSetOutSourcerDateStatus()] !== 'undefined')) { |
|
|
|
|
|
alert(errrMessage[getSetOutSourcerDateStatus()]); |
|
|
|
|
|
} else { |
|
|
|
|
|
alert("不明錯誤"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getSetOutSourcerDateStatus() { |
|
|
|
|
|
let outsourcer_type = $("input[name^='outsourcer_type']:checked").val(); |
|
|
|
|
|
let real_contract_arrival_date = $("#real_contract_arrival_date").val(); |
|
|
|
|
|
let numberofstop = $("#numberofstop").val(); |
|
|
|
|
|
let user_id = '<?php echo $user_id; ?>'; |
|
|
|
|
|
|
|
|
|
|
|
if (typeof outsourcer_type == 'undefined') |
|
|
|
|
|
return 2; |
|
|
|
|
|
if (typeof numberofstop == 'undefined') |
|
|
|
|
|
return 3; |
|
|
|
|
|
if (numberofstop == 0 || numberofstop == '' || numberofstop == '0') |
|
|
|
|
|
return 3; |
|
|
|
|
|
if (typeof real_contract_arrival_date == 'undefined') |
|
|
|
|
|
return 4; |
|
|
|
|
|
if (real_contract_arrival_date == 0 || real_contract_arrival_date == '' || real_contract_arrival_date == '0') |
|
|
|
|
|
return 4; |
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function resetIOutSourcerDate() { |
|
|
|
|
|
$("#estimate_install_start_date").val(""); |
|
|
|
|
|
$("#estimate_install_end_date").val(""); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function resetTOutSourcerDate() { |
|
|
|
|
|
$("#estimate_tryrun_start_date").val(""); |
|
|
|
|
|
$("#estimate_tryrun_end_date").val(""); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function resetAllOutSourcerDate() { |
|
|
|
|
|
resetIOutSourcerDate(); |
|
|
|
|
|
resetTOutSourcerDate(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function specificationDayFormula(numberofstop) { |
|
|
|
|
|
if (numberofstop > 0 && numberofstop <= 7) |
|
|
|
|
|
return 7; |
|
|
|
|
|
if (numberofstop > 7 && numberofstop < 14) |
|
|
|
|
|
return numberofstop; |
|
|
|
|
|
if (numberofstop >= 14) |
|
|
|
|
|
return 14; |
|
|
|
|
|
return 0 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function dateAddDays(dateString, daysToAdd = 0) { |
|
|
|
|
|
daysToAdd = Number(daysToAdd); |
|
|
|
|
|
// 將日期字串轉換為日期物件 |
|
|
|
|
|
var initialDate = new Date(dateString); |
|
|
|
|
|
// 增加指定天數 |
|
|
|
|
|
initialDate.setDate(initialDate.getDate() + daysToAdd); |
|
|
|
|
|
|
|
|
|
|
|
// 將結果轉換為所需的日期格式(例如:yyyy-mm-dd) |
|
|
|
|
|
var year = initialDate.getFullYear(); |
|
|
|
|
|
var month = String(initialDate.getMonth() + 1).padStart(2, "0"); // 月份從0開始,需要加1 |
|
|
|
|
|
var day = String(initialDate.getDate()).padStart(2, "0"); |
|
|
|
|
|
var resultDateString = year + "-" + month + "-" + day; |
|
|
|
|
|
|
|
|
|
|
|
return resultDateString; |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |