|
|
@ -203,7 +203,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
</td> |
|
|
|
<td style="vertical-align: middle">樓停</td> |
|
|
|
<td> |
|
|
|
<input class="form-control disabled_select" type="number" name="numberofstop" min="0" value="<?= $row["numberofstop"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
|
<input class="form-control disabled_select" type="number" name="numberofstop" id="numberofstop" min="0" value="<?= $row["numberofstop"]; ?>" <?php echo $update_delete_status; ?>> |
|
|
|
</td> |
|
|
|
<td style="vertical-align: middle">樓層</td> |
|
|
|
<td> |
|
|
@ -374,6 +374,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<?php |
|
|
|
// echo !empty($row['customer_planning_verify_file']) ? "<a id='customer_planning_verify_file_a' style='color:#00F;' href='" . $row['customer_planning_verify_file'] . "' target='_blank'>下載附件</a>" : ""; |
|
|
|
?> |
|
|
|
<br /> |
|
|
|
<?php |
|
|
|
$customer_planning_verify_files = getAllCustomerPlanningVerify($link, $id); |
|
|
|
foreach ($customer_planning_verify_files as $row2) : |
|
|
@ -853,7 +854,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<tr> |
|
|
|
<td>備註</td> |
|
|
|
<td colspan="7"> |
|
|
|
<textarea class="form-control" name="warehouse_remark" <?= $warehouse; ?>><?php echo $row['warehouse_remark']; ?></textarea> |
|
|
|
<textarea class="form-control" name="warehouse_remark" <?= $warehouse2; ?>><?php echo $row['warehouse_remark']; ?></textarea> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
@ -1038,7 +1039,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<tr> |
|
|
|
<td style="vertical-align: middle">預計到貨日<br />(到觀音廠日)</td> |
|
|
|
<td> |
|
|
|
<select name="estimated_shipping_schedule_date_verify" id="estimated_shipping_schedule_date_verify" <?= $yewu; ?>> |
|
|
|
<select name="estimated_shipping_schedule_date_verify" id="estimated_shipping_schedule_date_verify" <?= $user_id == 'M0168' ? "" : $yewu; ?>> |
|
|
|
<option <?php if ($row["estimated_shipping_schedule_date_verify"] == "1") echo " selected"; ?> value="1">請選擇</option> |
|
|
|
<option <?php if ($row["estimated_shipping_schedule_date_verify"] == "0") echo " selected"; ?> value="0">已完成</option> |
|
|
|
<option <?php if ($row["estimated_shipping_schedule_date_verify"] == "1") echo " selected"; ?> value="1">進行中</option> |
|
|
@ -1047,9 +1048,9 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
</td> |
|
|
|
<td> |
|
|
|
<div class="input-group"> |
|
|
|
<input class="form-control" type="date" id="estimated_shipping_schedule_date" name="estimated_shipping_schedule_date" value="<?= $row['estimated_shipping_schedule_date']; ?>" <?= $yewu; ?>> |
|
|
|
<input class="form-control" type="date" id="estimated_shipping_schedule_date" name="estimated_shipping_schedule_date" value="<?= $row['estimated_shipping_schedule_date']; ?>" <?= $user_id == 'M0168' ? "" : $yewu; ?>> |
|
|
|
<span class="input-group-btn"> |
|
|
|
<button class="btn btn-default" type='button' onclick='$("#estimated_shipping_schedule_date").val("");' <?= $yewu; ?>>清除</button> |
|
|
|
<button class="btn btn-default" type='button' onclick='$("#estimated_shipping_schedule_date").val("");' <?= $user_id == 'M0168' ? "" : $yewu; ?>>清除</button> |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</td> |
|
|
@ -1141,6 +1142,12 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<button class="btn btn-primary btn-lg pull-right" type="button" style="margin-left:3px;" disabled>日程已結案</button> |
|
|
|
<?php |
|
|
|
} else { |
|
|
|
// 生管 小雯 預計到貨日(到觀音廠日)權限 |
|
|
|
if ($user_id == 'M0168') { |
|
|
|
?> |
|
|
|
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> |
|
|
|
<?php |
|
|
|
} |
|
|
|
if (($user_department_id == 220 || ($user_department_id == 321 && $role_id !== '5') || $user_id == 'M0060')) { |
|
|
|
?> |
|
|
|
<button onclick="savedata()" type="button" class="btn btn-primary btn-lg pull-right" style="margin-left:3px;">存檔</button> |
|
|
@ -1330,7 +1337,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<!-- <tr> |
|
|
|
<td style="vertical-align: middle">發包類型</td> |
|
|
|
<td> |
|
|
|
<input type='radio' name='outsourcer_type' id='outsourcer_type_I' value='I' checked /> |
|
|
|
<input type='radio' name='outsourcer_type' id='outsourcer_type_I' value='I' /> |
|
|
|
<label for='outsourcer_type_I'>安裝</label> |
|
|
|
<input type='radio' name='outsourcer_type' id='outsourcer_type_T' value='T' /> |
|
|
|
<label for='outsourcer_type_T'>試車</label> |
|
|
@ -1340,6 +1347,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
if (getSaveEstimateInstallData($user_department_id, $role_id)) { |
|
|
|
?> |
|
|
|
<button type='button' class='btn btn-default' onclick='setOutSourcerDate();'>帶入日期</button> |
|
|
|
<button type='button' class='btn btn-default' onclick='resetAllOutSourcerDate();'>清除日期</button> |
|
|
|
<?php |
|
|
|
} |
|
|
|
?> |
|
|
@ -1348,7 +1356,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<tr> |
|
|
|
<td style="vertical-align: middle">安裝發包廠商</td> |
|
|
|
<td> |
|
|
|
<input name="install_outsourcer" id="install_outsourcer" class="form-control disabled_select" type="text" value="<?php echo $row['install_outsourcer']; ?>" <?= $warehouse2; ?> /> |
|
|
|
<input name="install_outsourcer disabled_select" id="install_outsourcer" class="form-control disabled_select" type="text" value="<?php echo $row['install_outsourcer']; ?>" <?= $warehouse2; ?> /> |
|
|
|
</td> |
|
|
|
<td style="vertical-align: middle;">確認人</td> |
|
|
|
<td> |
|
|
@ -1362,7 +1370,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<td style="vertical-align: middle">安裝發包日</td> |
|
|
|
<td style="vertical-align: middle"> |
|
|
|
<div class="input-group"> |
|
|
|
<input class="form-control" type="date" name="install_outsourcer_date" id="install_outsourcer_date" value="<?= $row['install_outsourcer_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<input class="form-control disabled_select" type="date" name="install_outsourcer_date" id="install_outsourcer_date" value="<?= $row['install_outsourcer_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<span class="input-group-btn"> |
|
|
|
<button class="btn btn-default" type='button' onclick='$("#install_outsourcer_date").val("");' <?= $warehouse2; ?>>清除</button> |
|
|
|
</span> |
|
|
@ -1380,7 +1388,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<td style="vertical-align: middle">預計安裝開工日</td> |
|
|
|
<td style="vertical-align: middle"> |
|
|
|
<div class="input-group"> |
|
|
|
<input class="form-control" type="date" name="estimate_install_start_date" id="estimate_install_start_date" value="<?= $row['estimate_install_start_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<input class="form-control disabled_select" type="date" name="estimate_install_start_date" id="estimate_install_start_date" value="<?= $row['estimate_install_start_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<span class="input-group-btn"> |
|
|
|
<button class="btn btn-default" type='button' onclick='$("#estimate_install_start_date").val("");' <?= $warehouse2; ?>>清除</button> |
|
|
|
</span> |
|
|
@ -1398,7 +1406,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<td style="vertical-align: middle">預計安裝完工日</td> |
|
|
|
<td style="vertical-align: middle"> |
|
|
|
<div class="input-group"> |
|
|
|
<input class="form-control" type="date" name="estimate_install_end_date" id="estimate_install_end_date" value="<?= $row['estimate_install_end_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<input class="form-control disabled_select" type="date" name="estimate_install_end_date" id="estimate_install_end_date" value="<?= $row['estimate_install_end_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<span class="input-group-btn"> |
|
|
|
<button class="btn btn-default" type='button' onclick='$("#estimate_install_end_date").val("");' <?= $warehouse2; ?>>清除</button> |
|
|
|
</span> |
|
|
@ -1415,7 +1423,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<tr> |
|
|
|
<td style="vertical-align: middle">試車發包廠商</td> |
|
|
|
<td> |
|
|
|
<input name="tryrun_outsourcer" id="tryrun_outsourcer" class="form-control disabled_select" type="text" value="<?php echo $row['tryrun_outsourcer']; ?>" <?= $warehouse2; ?> /> |
|
|
|
<input name="tryrun_outsourcer disabled_select" id="tryrun_outsourcer" class="form-control disabled_select" type="text" value="<?php echo $row['tryrun_outsourcer']; ?>" <?= $warehouse2; ?> /> |
|
|
|
</td> |
|
|
|
<td style="vertical-align: middle;">確認人</td> |
|
|
|
<td> |
|
|
@ -1429,7 +1437,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<td style="vertical-align: middle">試車發包日</td> |
|
|
|
<td style="vertical-align: middle"> |
|
|
|
<div class="input-group"> |
|
|
|
<input class="form-control" type="date" name="tryrun_outsourcer_date" id="tryrun_outsourcer_date" value="<?= $row['tryrun_outsourcer_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<input class="form-control disabled_select" type="date" name="tryrun_outsourcer_date" id="tryrun_outsourcer_date" value="<?= $row['tryrun_outsourcer_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<span class="input-group-btn"> |
|
|
|
<button class="btn btn-default" type='button' onclick='$("#tryrun_outsourcer_date").val("");' <?= $warehouse2; ?>>清除</button> |
|
|
|
</span> |
|
|
@ -1447,7 +1455,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<td style="vertical-align: middle">預計試車開工日</td> |
|
|
|
<td style="vertical-align: middle"> |
|
|
|
<div class="input-group"> |
|
|
|
<input class="form-control" type="date" name="estimate_tryrun_start_date" id="estimate_tryrun_start_date" value="<?= $row['estimate_tryrun_start_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<input class="form-control disabled_select" type="date" name="estimate_tryrun_start_date" id="estimate_tryrun_start_date" value="<?= $row['estimate_tryrun_start_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<span class="input-group-btn"> |
|
|
|
<button class="btn btn-default" type='button' onclick='$("#estimate_tryrun_start_date").val("");' <?= $warehouse2; ?>>清除</button> |
|
|
|
</span> |
|
|
@ -1465,7 +1473,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<td style="vertical-align: middle">預計試車完工日</td> |
|
|
|
<td style="vertical-align: middle"> |
|
|
|
<div class="input-group"> |
|
|
|
<input class="form-control" type="date" name="estimate_tryrun_end_date" id="estimate_tryrun_end_date" value="<?= $row['estimate_tryrun_end_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<input class="form-control disabled_select" type="date" name="estimate_tryrun_end_date" id="estimate_tryrun_end_date" value="<?= $row['estimate_tryrun_end_date']; ?>" <?= $warehouse2; ?>> |
|
|
|
<span class="input-group-btn"> |
|
|
|
<button class="btn btn-default" type='button' onclick='$("#estimate_tryrun_end_date").val("");' <?= $warehouse2; ?>>清除</button> |
|
|
|
</span> |
|
|
@ -1482,7 +1490,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
<tr> |
|
|
|
<td>備註</td> |
|
|
|
<td colspan="3"> |
|
|
|
<textarea class="form-control" name="warehouse_assistant_remark" id="warehouse_assistant_remark" <?= $warehouse2; ?>><?php echo $row['warehouse_assistant_remark']; ?></textarea> |
|
|
|
<textarea class="form-control disabled_select" name="warehouse_assistant_remark" id="warehouse_assistant_remark" <?= $warehouse2; ?>><?php echo $row['warehouse_assistant_remark']; ?></textarea> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
@ -1861,7 +1869,7 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
if (confirm('確定要更改日期嗎?') == true) { |
|
|
|
var estimated_shipping_schedule_date = $("#estimated_shipping_schedule_date").val(); |
|
|
|
var real_contract_arrival_date = $("#real_contract_arrival_date_tmp").val(); |
|
|
|
if (real_contract_arrival_date <= estimated_shipping_schedule_date) { |
|
|
|
if (real_contract_arrival_date < estimated_shipping_schedule_date) { |
|
|
|
alert("日期不可以比預計到貨日(到觀音日)早"); |
|
|
|
} else { |
|
|
|
$("#real_contract_arrival_date").val($("#real_contract_arrival_date_tmp").val()); |
|
|
@ -1901,29 +1909,91 @@ include "wipwhole-rec-invoice-edit-submit.php"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// function setOutSourcerDate() { |
|
|
|
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 (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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function resetIOutSourcerDate() { |
|
|
|
$("#estimate_install_start_date").val(""); |
|
|
|
$("#estimate_install_end_date").val(""); |
|
|
|
} |
|
|
|
|
|
|
|
function resetTOutSourcerDate() { |
|
|
|
$("#estimate_tryrun_start_date").val(""); |
|
|
|
$("#estimate_tryrun_end_date").val(""); |
|
|
|
} |
|
|
|
|
|
|
|
// // 發包類型 |
|
|
|
// let outsourcer_type = $("input[name^='outsourcer_type']").val(); |
|
|
|
// // 預計出貨日(到工地) |
|
|
|
// let real_contract_arrival_date = $("#real_contract_arrival_date").val(); |
|
|
|
// // 樓停 |
|
|
|
// let numberofstop = $("#numberofstop").val(); |
|
|
|
|
|
|
|
// if (outsourcer_type === 'I') { |
|
|
|
// // 預計安裝開工日 |
|
|
|
// let tmp = Date.prototype.addDays = function(days) { |
|
|
|
// this.setDate(this.getDate() + days); |
|
|
|
// return this; |
|
|
|
// } |
|
|
|
// alert(tmp); |
|
|
|
function resetAllOutSourcerDate() { |
|
|
|
resetIOutSourcerDate(); |
|
|
|
resetTOutSourcerDate(); |
|
|
|
} |
|
|
|
|
|
|
|
// } |
|
|
|
// if (outsourcer_type === 'T') { |
|
|
|
function specificationDayFormula(numberofstop) { |
|
|
|
if (numberofstop > 0 && numberofstop <= 7) |
|
|
|
return 7; |
|
|
|
if (numberofstop > 7 && numberofstop < 14) |
|
|
|
return numberofstop; |
|
|
|
if (numberofstop >= 14) |
|
|
|
return 14; |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
|
// } |
|
|
|
// if (outsourcer_type === 'IT') { |
|
|
|
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> |