@ -50,7 +50,7 @@ $pinzheng = getPinzhengStatus($link, $user_department_id, $role_id);
$tab = getTabNo($user_department_id);
// 工務助理
if (in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188'])) {
if (in_array($user_id, ['M0164', 'M0165', 'M0127', 'M0193', 'M0170', 'M0188', 'M0117' ])) {
$warehouse2 = "";
$tab = 5;
}
@ -99,7 +99,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
< tr >
< td style = "vertical-align: middle" > 合約號< / 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
if (in_array($user_department_id, [311, 312, 313, 314, 315, 501, 511, 512, 513, 514, 220, 911, 50, 320, 250])) {
$sql = "
@ -120,11 +120,11 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
< / td >
< td style = "vertical-align: middle" > 作番號< / 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 style = "vertical-align: middle" > 汰改種類< / td >
< 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 = "M2" > M2< / option >
< option value = "M3" > M3< / option >
@ -134,21 +134,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
< / td >
< td style = "vertical-align: middle" > 合約交期< br / > (到工地)< / td >
< 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 >
< / tr >
< tr >
< td style = "vertical-align: middle" > 客戶名稱< / 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 style = "vertical-align: middle" > 號機< / 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 style = "vertical-align: middle" > 工地負責人< / 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 style = "vertical-align: middle" > 預計交期(到工地)
< br / >
@ -158,21 +158,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
?>
< / td >
< 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 >
< / tr >
< tr >
< td style = "vertical-align: middle" > 經度< / td >
< 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 style = "vertical-align: middle" > 緯度< / 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 style = "vertical-align: middle" > 地址< / 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 style = "vertical-align: middle" > 工地地址< br / >
<?php
@ -187,29 +187,29 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
< tr >
< td style = "vertical-align: middle" > 載重< / td >
< 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 style = "vertical-align: middle" > 人乘< / td >
< 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 style = "vertical-align: middle" > 樓停< / 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 style = "vertical-align: middle" > 樓層< / 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 >
< / tr >
< tr >
< td style = "vertical-align: middle" > 機型< / 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 style = "vertical-align: middle" > 開門方式< / td >
< 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 >
<?php
foreach ($opendoor_options as $opendoor_option) :
@ -224,7 +224,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
< / td >
< td style = "vertical-align: middle" > 速度< / td >
< 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 style = "vertical-align: middle" > 簽核狀況< / td >
< td style = "vertical-align: middle" >
@ -550,8 +550,11 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
< tr >
< td colspan = "4" >
<?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 "< 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 >
< / tr >
@ -689,9 +692,9 @@ include "wipwhole-renovate-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" 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" >
< 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 >
< / div >
< / td >
@ -1146,8 +1149,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<?php
} 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 >
<?php
@ -1244,6 +1246,17 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
< div id = "tabs-5" >
< table class = "table table-bordered" style = "width:100%" >
< tbody style = "font-weight: bolder;margin-bottom: 20px" >
< tr >
< td style = "vertical-align: middle" > QC及官檢類型< / td >
< td >
< input type = 'radio' disabled <?php echo $row [ 'qc_official_type' ] == 'Q' ? "checked" : "" ; ?> />
< label for = 'outsourcer_type_I' > 只需QC< / label >
< input type = 'radio' disabled <?php echo $row [ 'qc_official_type' ] == 'O' ? "checked" : "" ; ?> />
< label for = 'outsourcer_type_T' > 只需官檢< / label >
< input type = 'radio' disabled <?php echo $row [ 'qc_official_type' ] == 'QO' ? "checked" : "" ; ?> />
< label for = 'outsourcer_type_IT' > QC+官檢< / label >
< / td >
< / tr >
< tr >
< td style = "vertical-align: middle" > 內部QC日< / td >
< td style = "vertical-align: middle" >
@ -1332,10 +1345,49 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
(工務助理項目)
< / td >
< / 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 >
< td style = "vertical-align: middle;" > 合約上傳< / td >
< td id = "ocfi_td" style = "vertical-align: middle;" >
< button type = "button" onclick = "addOutsourcerContractFileItem()" class = "btn btn-primary btn-lg pull-right" style = "margin-left:3px;" > +< / button >
< input style = "width:70%;display:inline;" type = "file" id = "outsourcer_contract_file_0" name = "outsourcer_contract_file[]" multiple >
< button type = "button" class = "btn btn-danger" id = "outsourcer_contract_file_del_0" onclick = "delOutsourcerContractFileItem(0)" > x< / button >
<?php
if (!empty($row['outsourcer_contract_file'])) {
$outsourcer_contract_file_tmp = json_decode($row['outsourcer_contract_file']);
foreach ($outsourcer_contract_file_tmp as $val) {
echo "< br / > < a style = 'color:#00F;' target = '_blank' href = '" . $val . "' > " . str_replace("public-wipwhole/", "", $val) . "< / a > ";
}
echo "< / br > ";
}
?>
< / td >
< / tr >
< tr >
< td style = "vertical-align: middle" > 安裝發包廠商< / 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 style = "vertical-align: middle;" > 確認人< / td >
< td >
@ -1402,7 +1454,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
< tr >
< td style = "vertical-align: middle" > 試車發包廠商< / 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 style = "vertical-align: middle;" > 確認人< / td >
< td >
@ -1481,6 +1533,15 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
?>
< / td >
< / tr >
< tr >
< td style = "vertical-align: middle;" > 完工驗收單附件< / td >
< td colspan = "5" style = "vertical-align: middle;" >
< input style = "width:70%;display:inline;" type = "file" name = "completion_acceptance_file" <? = $warehouse2 ; ?> >
<?php
echo !empty($row['completion_acceptance_file']) ? "< a id = 'plan_diagram_file_a' style = 'color:#00F;' href = '" . $row[' completion_acceptance_file ' ] . " ' target = '_blank' > 下載附件< / a > " : "";
?>
< / td >
< / tr >
< tr >
< td colspan = "4" >
<?php
@ -1525,6 +1586,8 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
< / form >
< 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_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' ]; ?> " />
@ -1906,6 +1969,12 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
function saveInstallData() {
if (confirm('確定要更改實際安裝日程嗎?') == true) {
if ($("#change_all_contractno_tmp").prop('checked')) {
if ($("#contractno").val() == '' || $("#contractno").val() == null) {
alert("合約號空白");
} else {
$("#change_all_contractno").val($("#change_all_contractno_tmp").prop('checked'));
$("#contractno2").val($("#contractno").val());
$("#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());
@ -1916,5 +1985,154 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
$("#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;
}
var ocfi_id = 0;
function addOutsourcerContractFileItem() {
ocfi_id++;
let html = "< input style = 'width:70%;display:inline;' type = 'file' id = 'outsourcer_contract_file_" + ocfi_id + "' name = 'outsourcer_contract_file[]' multiple > ";
html += "< button type = 'button' class = 'btn btn-danger' id = 'outsourcer_contract_file_del_" + ocfi_id + "' onclick = 'delOutsourcerContractFileItem(" + ocfi_id + ")' > x< / button > ";
$("#ocfi_td").append(html);
}
function delOutsourcerContractFileItem(id) {
$("#outsourcer_contract_file_del_" + id).remove();
$("#outsourcer_contract_file_" + id).remove();
}
< / script >