Browse Source

修理價審附件上傳

gary
Cheng 1 year ago
parent
commit
9f8b166d2c
  1. 6
      wms/contract/contract-new-apply.php
  2. 32
      wms/fun_global.php
  3. 13
      wms/mkt/pricereview_repair-create.php
  4. 27
      wms/mkt/pricereview_repair-record-submit.php

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

@ -708,9 +708,9 @@ $para = "function_name=pricereview&" . $token_link;
<script>
const donwloadDraft = () => {
if('<?php echo $status ?>' >=0 ){
window.location.href='./contract-download.php?id=<?php echo $id . '&' . $para ?>'
}else{
if ('<?php echo $status ?>' >= 0) {
window.location.href = './contract-download.php?id=<?php echo $id . '&' . $para ?>'
} else {
alert("請先暫存或送審文件!")
}
}

32
wms/fun_global.php

@ -99,7 +99,6 @@ function pricereview_class($rate, $user_id, &$ret = [], $special_fee, $i = 0)
return $ret;
exit;
} else {
<<<<<<< HEAD
// // 若為第一層且使用者ID為區經理,直接訂好接下來的簽核人員並跳出。
// if ($i == 0 && ($user_id == 'M0033' || $user_id == "M0137" || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == "M0086")) {
// $ret[1] = $user_id . ",,";
@ -129,37 +128,6 @@ function pricereview_class($rate, $user_id, &$ret = [], $special_fee, $i = 0)
$ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) {
$ret[4] = "M0006,,"; // 總經理
=======
// 若為第一層且使用者ID為區經理,直接訂好接下來的簽核人員並跳出。
if ($i == 0 && ($user_id == 'M0033' || $user_id == "M0137" || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == "M0086")) {
$ret[1] = $user_id . ",,";
// $ret[2] = "M0107,,<##>M0175,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) {
$ret[4] = "M0006,,"; // 總經理
}
return $ret;
exit;
}
if ($row["manager"] != "M0060" && $row["manager"] != "M0006" && $row["manager"] != "M0008") {
// 新梯的部分 桃竹本該給陳家文,改為劉永德
if ($row["manager"] == 'M0029') {
$ret[1] = "M0137,,";
$i++;
pricereview_class($rate, $row["manager"], $ret, $special_fee, $i);
} else {
$ret[1] = $row["manager"] . ",,";
$i++;
pricereview_class($rate, $row["manager"], $ret, $special_fee, $i);
}
} else {
// $ret[2] = "M0107,,<##>M0175,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) {
$ret[4] = "M0006,,"; // 總經理
}
>>>>>>> ea503fbee65cc2bb5ce9442e618db9c6878a09cb
}
// }

13
wms/mkt/pricereview_repair-create.php

@ -270,6 +270,15 @@ $assign_status = '<option value="FH">指派</option>'
$('#tb1 tr:last').prev().prev().prev().after($("tr[name='main_templ']").last().clone().find('input').val('').end());
$('#tb1 tr:last').prev().prev().prev().find('td a[name=item_href]').html('點選');
});
$("a[name=filedel]").hide();
$("input[name=attatch1]").change(function() {
if ($(this).val() != "") $("a[name=filedel]").show();
});
$("a[name=filedel]").click(function() {
$("input[name=attatch1]").val("");
$(this).hide();
});
// 點擊服務費會出現 or 消失 input 框
// $('#btnadd-sc').click(function() {
// $('#service_charge_tr').toggle();
@ -537,6 +546,10 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</table>
</div>
<div class="nextline"></div>
<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>
<div class="nextline"></div>
<div class="table-responsive">

27
wms/mkt/pricereview_repair-record-submit.php

@ -21,11 +21,34 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$new_repair_no = $repair_no_a . $serial;
if ($new_repair_no != $repair_no) $repair_no = $new_repair_no;
// 附件上傳
$target_dir = "pricereview-uploads/";
if ($_FILES["attatch1"]["error"] == 0) {
$file_name = $_FILES["attatch1"]["name"];
$temp_file_name = $_FILES["attatch1"]["tmp_name"];
$file_size = $_FILES["attatch1"]["size"];
$img_file_type = pathinfo($file_name, PATHINFO_EXTENSION);
$target_file1 = $target_dir . $vol_no . "-price-" . $tds . "." . $img_file_type;
$upload_ok = 1;
foreach (glob($target_dir . $repair_no . "-price-*") as $todelfile) {
unlink($todelfile);
}
$upload_res_1 = move_uploaded_file($temp_file_name, $target_file1);
} else $target_file1 = "";
if (($target_file1 && !$upload_res_1)) {
echo "<script type ='text/JavaScript'>";
echo "alert('檔案上傳失敗,資料請重建。');";
echo "history.go(-1);";
echo "</script>";
exit;
}
// 價審單-主文 pricereview_repair_main
$db_query = "INSERT INTO pricereview_repair_main(repair_no, contractno, masada_addr, company, taxid, invoice, facilityno, ";
$db_query .= "address, sales_tax, service_charge, total_price, sign_date, memo, repairerid, pstatus, checker, creater, create_at) values (";
$db_query .= "address, sales_tax, service_charge, total_price, sign_date, memo, repairerid, pstatus, checker, creater, create_at,file) values (";
$db_query .= "'$repair_no', '$contractno', '$masada_addr', '$company', '$taxid', '$invoice', '$facilityno', ";
$db_query .= "'$address', $sales_tax ,$service_charge ,$total_price, '$sign_date', '$memo', '$repairerid', 'A', '$next_users', '$user_id', '$create_at')";
$db_query .= "'$address', $sales_tax ,$service_charge ,$total_price, '$sign_date', '$memo', '$repairerid', 'A', '$next_users', '$user_id', '$create_at','$target_file1')";
$result = mysqli_query($link, $db_query);
$affected = mysqli_affected_rows($link);
if ($rid = mysqli_insert_id($link)) {

Loading…
Cancel
Save