Cheng 1 year ago
parent
commit
f0292f393a
  1. 8
      wms/api/bpm/draw_update.php
  2. 2
      wms/contract-repair/insertFacility.php
  3. 8
      wms/contract/contract-download.php
  4. 114
      wms/contract/contract-maintainance-management.php
  5. 16
      wms/contract/contract-new-apply.php
  6. 1
      wms/contract/js/alpine.js
  7. BIN
      wms/contract/option/facility.xlsx
  8. 5
      wms/contract/prviewPdf.php
  9. 2
      wms/contract/restoremi.php
  10. 20
      wms/database.php
  11. 12
      wms/estimated_shipping_date_report.php
  12. 8
      wms/fun_global.php
  13. 399
      wms/maintainance_contract_payment_status.php
  14. 1
      wms/mkt/assets/js/alpine.js
  15. 29
      wms/mkt/pricereview-index.php
  16. 90
      wms/mkt/pricereview_mi-api.php
  17. 21
      wms/wipwhole-index-function.php
  18. 13
      wms/wipwhole-rec-invoice-edit-submit.php
  19. 39
      wms/wipwhole-rec-invoice-edit.php
  20. 21
      wms/wipwhole-renovate-index-function.php
  21. 16
      wms/wipwhole-renovate-rec-invoice-edit-submit.php
  22. 41
      wms/wipwhole-renovate-rec-invoice-edit.php
  23. 92
      wms/wipwhole-wipinstallstatus-index-modal.php
  24. 23
      wms/wipwhole-wipinstallstatus-index.php
  25. 2
      wms/wipwholeinstall-index-export-excel.php
  26. 4
      wms/wipwholeinstall-index-table-html.php
  27. 2
      wms/wipwholeinstall-renovate-index-export-excel.php
  28. 4
      wms/wipwholeinstall-renovate-index-table-html.php

8
wms/api/bpm/draw_update.php

@ -0,0 +1,8 @@
<?php
header('Access-Control-Allow-Origin:*');
echo json_encode([
'success' => true
], JSON_UNESCAPED_UNICODE);
?>

2
wms/contract-repair/insertFacility.php

@ -5,7 +5,7 @@ ini_set('data.timezone', 'Asia/Taipei');
use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\IOFactory;
$filePath = './facility/facility.xlsx'; // $filePath = './facility/facility.xlsx';
try { try {
$spreadsheet = IOFactory::load($filePath); $spreadsheet = IOFactory::load($filePath);

8
wms/contract/contract-download.php

@ -24,6 +24,7 @@ if (isset($_GET['id']) && $_GET['id'] != "") {
$stmt->bindParam(':id', $id); $stmt->bindParam(':id', $id);
$stmt->execute(); $stmt->execute();
$contracts = $stmt->fetchAll(PDO::FETCH_ASSOC); $contracts = $stmt->fetchAll(PDO::FETCH_ASSOC);
$contract = $contracts[0]; $contract = $contracts[0];
$contract_apply_id = $contract['id']; $contract_apply_id = $contract['id'];
if (($contract['status'] !== "YY" && $user_id != 'M0107' && $user_id != "TEST02" && $user_id == "TEST01") && $user_id != 'M0174' && $user_id != 'M0225') { if (($contract['status'] !== "YY" && $user_id != 'M0107' && $user_id != "TEST02" && $user_id == "TEST01") && $user_id != 'M0174' && $user_id != 'M0225') {
@ -52,7 +53,8 @@ if (isset($_GET['id']) && $_GET['id'] != "") {
$install_total_price = 0; $install_total_price = 0;
// $noteArr = explode(",", $contracts[0]['note']); // $noteArr = explode(",", $contracts[0]['note']);
$noteArr = array(1, 1, 1, 1, 1); $noteArr = array(1, 1, 1, 1, 1);
$qty = $contracts[0]['total_items']; // $qty = $contracts[0]['total_items'];
$qty = 1;
foreach ($contracts as $idx => $amount) { foreach ($contracts as $idx => $amount) {
$isset = false; $isset = false;
if ($amount['pay_kind'] == 5 || $amount['pay_kind'] == 6) { if ($amount['pay_kind'] == 5 || $amount['pay_kind'] == 6) {
@ -413,8 +415,8 @@ if (isset($_GET['id']) && $_GET['id'] != "") {
<input type="hidden" name="buystandard" x-model="toggleBuyStandard" /> <input type="hidden" name="buystandard" x-model="toggleBuyStandard" />
<input type="hidden" name="installstandard" x-model="toggleInstallStandard" /> <input type="hidden" name="installstandard" x-model="toggleInstallStandard" />
<input type="hidden" name="total_price" x-model="total_price" id="total_price" /> <input type="hidden" name="total_price" x-model="total_price" id="total_price" />
<input type="hidden" name="person" id="person" value="<?php echo $contract['accountname']; ?>" /> <input type="hidden" name="person" id="person" value="<?php echo $contract['personname']; ?>" />
<input type="hidden" name="personid" id="personid" value="<?php echo $contract['accountid']; ?>" /> <input type="hidden" name="personid" id="personid" value="<?php echo $contract['person']; ?>" />
<input type="hidden" name="delivery_term" id="delivery_term" x-model="buyfill1" /> <input type="hidden" name="delivery_term" id="delivery_term" x-model="buyfill1" />
<input type="hidden" name="install_period" id="install_period" x-model="installfill1" /> <input type="hidden" name="install_period" id="install_period" x-model="installfill1" />
<input type="hidden" name="free_maintainance" id="free_maintainance" x-model="installfill2" /> <input type="hidden" name="free_maintainance" id="free_maintainance" x-model="installfill2" />

114
wms/contract/contract-maintainance-management.php

@ -0,0 +1,114 @@
<?php
include("../header.php");
require_once("./conn.php");
$sql_str = "SELECT * FROM contract_b_signed_back ";
$stmt = $conn->prepare($sql_str);
$stmt->execute();
$contracts= $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<link rel="stylesheet" href="./styles/style.css">
<link rel="stylesheet" href="semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script defer src="./js/alpinejs/cdn.min.js"></script>
<script src="./js/axios/axios.min.js"></script>
<div style="overflow-x:auto;margin-top:12px">
<a href="contract-newelevator-input.php?function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>項次</th>
<th>合約號</th>
<th>客戶名稱</th>
<th>統編</th>
<th>營業員</th>
<th>合約開始時間</th>
<th>合約終止時間</th>
<th>狀態</th>
<th>建檔者</th>
<th>建立時間</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($contracts as $contract): ?>
<tr>
<td><?php echo $contract['id']; ?></td>
<td><?php echo $contract['contract_no'] ?></td>
<td><?php echo $contract['company'] ?></td>
<td><?php echo $contract['customer_no'] ?></td>
<td><?php echo $contract['salesperson'] ?></td>
<td><?php echo $contract['contract_start_date'] ?></td>
<td><?php echo $contract['contract_end_date'] ?></td>
<td>
<?php
$endDate = new DateTime($contract['contract_end_date']);
$now = new DateTime();
$interval = $now->diff($endDate);
if ($interval->days <= 60) {
echo "60天以內。";
} else {
echo "指定日期與當前日期相差超過60天。";
}
?>
</td>
<td><?php echo $contract['created_by'] ?></td>
<td><?php echo $contract['created_at'] ?></td>
<td style="width:30px">
<p>
<a href="contract-newelevator-edit.php?contractid=<?php echo $contract['id']; ?>&function_name=repair&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-pencil"></span>
</a>
<a href="javascript:;" class="btn btn-info btn-sm" style="margin-left:10px;" @click="deleteFn(<?php echo $contract['id']; ?>)">
<span class="glyphicon glyphicon-remove"></span>
</a>
</p>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
<style>
table {
table-layout:fixed;
width: 100%;
}
td {
word-wrap:break-word;
}
img {
width:125px;
}
.width_style_1 {
width:125px;
}
table{
width:100%;
}
#table_index_filter{
float:right;
}
#table_index_paginate{
float:right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>

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

@ -97,13 +97,14 @@ if (empty($contract_new_apply)) {
$stmt->bindParam(':contract_id', $id); $stmt->bindParam(':contract_id', $id);
$stmt->execute(); $stmt->execute();
$files = $stmt->fetchAll(PDO::FETCH_ASSOC); $files = $stmt->fetchAll(PDO::FETCH_ASSOC);
print_r($files); // print_r($files);
} }
$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; $progress = isset($contract['progress']) ? $contract['progress'] : 0;
$person = $contract['person']; $person = $contract['person'];
$para = "function_name=pricereview&" . $token_link;
?> ?>
<link rel="stylesheet" href="./styles/style.css"> <link rel="stylesheet" href="./styles/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
@ -129,7 +130,8 @@ $person = $contract['person'];
</td> </td>
<td class="text-right" style='border-left:0px;'> <td class="text-right" style='border-left:0px;'>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button> <button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button> <button type="button" id="btn_close" class="btn btn-success" onclick="donwloadDraft()">下載草搞</button>
<!-- <a class="applybtn" href="./contract-download.php?id=<?php echo $id . '&' . $para ?>">下載草稿</a> -->
</td> </td>
</tr> </tr>
<tr> <tr>
@ -703,3 +705,13 @@ $person = $contract['person'];
</script> </script>
<?php endif; ?> <?php endif; ?>
<script>
const donwloadDraft = () => {
if('<?php echo $status ?>' >=0 ){
window.location.href='./contract-download.php?id=<?php echo $id . '&' . $para ?>'
}else{
alert("請先暫存或送審文件!")
}
}
</script>

1
wms/contract/js/alpine.js

@ -1381,6 +1381,7 @@ const contractNewApply = () => {
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); form.append('description', this.data.description);
form.append('progress', 0);
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]);
} }

BIN
wms/contract/option/facility.xlsx

Binary file not shown.

5
wms/contract/prviewPdf.php

@ -19,6 +19,7 @@ if($_POST['list']){
$total_price = $_POST['total_price']; $total_price = $_POST['total_price'];
$person = $_POST['person']; $person = $_POST['person'];
$personid = $_POST['personid']; $personid = $_POST['personid'];
echo "----->" . $personid;
$delivery_term = $_POST['delivery_term']; $delivery_term = $_POST['delivery_term'];
$install_period = $_POST['install_period']; $install_period = $_POST['install_period'];
$free_maintainance = $_POST['free_maintainance']; $free_maintainance = $_POST['free_maintainance'];
@ -45,6 +46,10 @@ if($_POST['list']){
$stmt->bindParam(':vol_no', $partyAcontractno); $stmt->bindParam(':vol_no', $partyAcontractno);
$stmt->execute(); $stmt->execute();
$customer = $stmt->fetch(PDO::FETCH_ASSOC); $customer = $stmt->fetch(PDO::FETCH_ASSOC);
if(empty($customer)){
echo "有望客戶資料有誤!";
exit;
}
if(count($customer) <= 0 ){ if(count($customer) <= 0 ){
echo "<script> echo "<script>
alert('資料不齊或合約書已生成過。'); alert('資料不齊或合約書已生成過。');

2
wms/contract/restoremi.php

@ -9,7 +9,7 @@ $id = $_GET['id'];
use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\IOFactory;
if($id == 999){ if($id == 999){
$filePath = './option/f1.xlsx'; $filePath = './option/facility.xlsx';
try { try {
$spreadsheet = IOFactory::load($filePath); $spreadsheet = IOFactory::load($filePath);
} catch (\PhpOffice\PhpSpreadsheet\Reader\Exception $e) { } catch (\PhpOffice\PhpSpreadsheet\Reader\Exception $e) {

20
wms/database.php

@ -19,21 +19,21 @@ $host = getenv('DB_HOST');
$dbuser = getenv('DB_USERNAME'); $dbuser = getenv('DB_USERNAME');
$dbpassword = getenv('DB_PASSWORD'); $dbpassword = getenv('DB_PASSWORD');
$dbname = getenv('DB_DATABASE'); $dbname = getenv('DB_DATABASE');
$link = mysqli_connect($host, $dbuser, $dbpassword, $dbname); // $link = mysqli_connect($host, $dbuser, $dbpassword, $dbname);
$sqlsrv = getenv('sqlsrv'); $sqlsrv = getenv('sqlsrv');
$Database = getenv('Database'); $Database = getenv('Database');
$Account = getenv('Account'); $Account = getenv('Account');
$Password = getenv('Password'); $Password = getenv('Password');
try { // try {
$conn = new PDO("sqlsrv:Server=$sqlsrv;Database=$Database", "$Account", "$Password"); // $conn = new PDO("sqlsrv:Server=$sqlsrv;Database=$Database", "$Account", "$Password");
if ($conn) { // if ($conn) {
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} // }
} catch (PDOException $e) { // } catch (PDOException $e) {
echo "fail"; // echo "fail";
echo $e->getMessage(); // echo $e->getMessage();
} // }
if ($link) { if ($link) {
mysqli_query($link, 'SET NAMES utf8'); mysqli_query($link, 'SET NAMES utf8');
// echo "正確連接資料庫"; // echo "正確連接資料庫";

12
wms/estimated_shipping_date_report.php

@ -8,8 +8,8 @@ use PhpOffice\PhpSpreadsheet\Style\Fill;
include "header.php"; include "header.php";
$start_y = empty($_POST['start_month']) ? '2023' : substr($_POST['start_month'], 0, 4); $start_y = empty($_POST['start_month']) ? date("Y") : substr($_POST['start_month'], 0, 4);
$end_y = empty($_POST['end_month']) ? '2023' : substr($_POST['end_month'], 0, 4); $end_y = empty($_POST['end_month']) ? date("Y") : substr($_POST['end_month'], 0, 4);
$start_m = empty($_POST['start_month']) ? '01' : substr($_POST['start_month'], 5, 2); $start_m = empty($_POST['start_month']) ? '01' : substr($_POST['start_month'], 5, 2);
$end_m = empty($_POST['end_month']) ? '12' : substr($_POST['end_month'], 5, 2); $end_m = empty($_POST['end_month']) ? '12' : substr($_POST['end_month'], 5, 2);
@ -29,8 +29,8 @@ $sql = "
w.contract_type w.contract_type
FROM wipwholestatus AS w FROM wipwholestatus AS w
WHERE status = '1' WHERE status = '1'
AND real_contract_arrival_date >= '$start_y-$start_m-1' AND DATE_FORMAT(real_contract_arrival_date, '%Y-%m-%d') >= '$start_y-$start_m-01'
AND real_contract_arrival_date <= '$end_y-$end_m-31' AND DATE_FORMAT(real_contract_arrival_date, '%Y-%m-%d') <= '$end_y-$end_m-31'
) AS this_order ) AS this_order
WHERE 1 = 1 WHERE 1 = 1
GROUP BY this_order.contract_type, GROUP BY this_order.contract_type,
@ -38,6 +38,7 @@ $sql = "
this_order.date_year, this_order.date_year,
this_order.date_month this_order.date_month
"; ";
$result = mysqli_query($link, $sql); $result = mysqli_query($link, $sql);
$data = []; $data = [];
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
@ -286,7 +287,8 @@ function alpha2num($a)
return $n - 1; return $n - 1;
} }
if ($_SERVER["REQUEST_METHOD"] == 'POST') { if ($_SERVER["REQUEST_METHOD"] == 'POST') {
if ($_POST['excel_output'] == 'excel_output') { $excel_output = !empty($_POST['excel_output']) ? $_POST['excel_output'] : '';
if ($excel_output == 'excel_output') {
$spreadsheet = new Spreadsheet(); $spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle('出貨總表'); $sheet->setTitle('出貨總表');

8
wms/fun_global.php

@ -102,7 +102,7 @@ function pricereview_class($rate, $user_id, &$ret = [], $special_fee, $i = 0)
// 若為第一層且使用者ID為區經理,直接訂好接下來的簽核人員並跳出。 // 若為第一層且使用者ID為區經理,直接訂好接下來的簽核人員並跳出。
if ($i == 0 && ($user_id == 'M0033' || $user_id == "M0137" || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == "M0086")) { if ($i == 0 && ($user_id == 'M0033' || $user_id == "M0137" || $user_id == 'M0029' || $user_id == 'M0054' || $user_id == "M0086")) {
$ret[1] = $user_id . ",,"; $ret[1] = $user_id . ",,";
$ret[2] = "M0175,,<##>M0107,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人) $ret[2] = "M0107,,<##>M0175,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理 $ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) { if ($rate < 80 || $special_fee > 0) {
$ret[4] = "M0006,,"; // 總經理 $ret[4] = "M0006,,"; // 總經理
@ -123,7 +123,7 @@ function pricereview_class($rate, $user_id, &$ret = [], $special_fee, $i = 0)
} }
} else { } else {
$ret[2] = "M0175,,<##>M0107,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人) $ret[2] = "M0107,,<##>M0175,,"; // 業務部專員:M0175陳君敏、M0107許紓晴(第2關有多位審核人)
$ret[3] = "M0060,,"; // 業務協理 $ret[3] = "M0060,,"; // 業務協理
if ($rate < 80 || $special_fee > 0) { if ($rate < 80 || $special_fee > 0) {
$ret[4] = "M0006,,"; // 總經理 $ret[4] = "M0006,,"; // 總經理
@ -158,7 +158,7 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag)
} }
} }
// $ret[1] = "M0029"; // $ret[1] = "M0029";
mysqli_free_result($res);
$ret[2] = 'M0012'; $ret[2] = 'M0012';
if ($renovate_flag == "REN") { if ($renovate_flag == "REN") {
// $ret[2] = 'M0012'; // $ret[2] = 'M0012';
@ -169,7 +169,7 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag)
if ($rate <= 100) $ret[3] = "M0008"; // 詹總 if ($rate <= 100) $ret[3] = "M0008"; // 詹總
if ($rate < 80) $ret[4] = "M0006"; // 總經理 if ($rate < 80) $ret[4] = "M0006"; // 總經理
} }
mysqli_free_result($res);
return $ret; return $ret;
} }

399
wms/maintainance_contract_payment_status.php

@ -0,0 +1,399 @@
<?php
include "header.php";
include "css/view/wipwhole-index.php";
// 設置一個空陣列來放資料
$data = array();
$contractno = empty($_POST['contractno']) ? null : $_POST['contractno'];
$contractno = getContractnoDetails($link, $user_id, $contractno);
$sql = "
SELECT
siamd.RowNo,
siamd.RowCode,
siam.BillNo,
siamd.CU_EstPayDate,
siamd.UnTransCheckBLAmtWTax ,
siamd.HadTransCheckBLAmtWTax,
siamd.CU_MaterialId,
acb_tmp.BillNo2,
acb_tmp.RowCode2,
asim.BillNo AS BillNo3,
asim.InvoiceName,
asim.OAmountWithTax,
asi.InvoiceNo
FROM salIncomeApplyMaster AS siam -- 收入申請單
LEFT JOIN salIncomeApplyDetail AS siamd -- 收入申請單明細
ON siam.BillNo = siamd.BillNo
LEFT JOIN (
SELECT
acbd.FromRowCode,
acb.FromBillNo,
acbd.BillNo AS BillNo2,
acbd.RowCode AS RowCode2
FROM arCheckBill AS acb -- 應收確認單
LEFT JOIN arCheckBillDetail AS acbd -- 應收確認單明細
ON acb.BillNo = acbd.BillNo
WHERE 1 = 1
AND acb.TypeId = 'RVS'
";
$sql .= !empty($contractno) ? " AND acb.FromBillNo IN ($contractno) " : "";
$sql .= "
) AS acb_tmp
ON siamd.RowNo = acb_tmp.FromRowCode
AND siamd.BillNo = acb_tmp.FromBillNo
LEFT JOIN arSellInvoiceMaterial AS asim -- 買賣發票明細
ON asim.FromBillNo = acb_tmp.BillNo2
AND asim.RowCode = acb_tmp.RowCode2
LEFT JOIN arSellInvoice AS asi
ON asim.BillNo = asi.BillNo
WHERE 1 = 1
";
$sql .= !empty($contractno) ? " AND siam.BillNo IN ($contractno)" : "";
$data = $conn->query($sql);
function getContractnoDetails($link, $user_id, $contractno = null)
{
$sql = "
SELECT
c.contractno
FROM contract AS c
LEFT JOIN con_maintance_examine_apply AS cmea
ON c.contractno = cmea.vol_no
WHERE 1 = 1
AND cmea.salesman IN (" . getAccountids($link, $user_id) . ")
";
if (!empty($contractno)) {
$sql .= "
AND c.contractno = '$contractno'
";
}
$result = mysqli_query($link, $sql);
$data = [];
foreach ($result as $row) {
array_push($data, $row['contractno']);
}
return "'" . implode("','", $data) . "'";
}
function getSalesmanNo($link, $contractno)
{
$sql = "
SELECT
cmea.salesman
FROM contract AS c
LEFT JOIN con_maintance_examine_apply AS cmea
ON c.contractno = cmea.vol_no
WHERE 1 = 1
AND c.contractno IN ('$contractno')
";
$result = mysqli_query($link, $sql);
$data = [];
foreach ($result as $row)
return $row['salesman'];
return "";
}
function getSalesmanName($link, $contractno)
{
$sql = "
SELECT
a.name
FROM contract AS c
LEFT JOIN con_maintance_examine_apply AS cmea
ON c.contractno = cmea.vol_no
LEFT JOIN account AS a
ON cmea.salesman = a.accountid
WHERE 1 = 1
AND c.contractno IN ('$contractno')
";
$result = mysqli_query($link, $sql);
$data = [];
foreach ($result as $row)
return $row['name'];
return "";
}
function getAccountids($link, $user_id)
{
$sql = "
SELECT
accountid
FROM account
WHERE 1 = 1
AND (accountid = '$user_id'
OR accountid IN (
SELECT
accountid
FROM account
WHERE 1 = 1
AND manager = '$user_id'
AND accounttype IN ('B','E','M','W')
)
)
";
$result = mysqli_query($link, $sql);
$data = [];
foreach ($result as $row) {
array_push($data, $row['accountid']);
}
return "'" . implode("','", $data) . "'";
}
function checkArCheckBillStatus($row)
{
$CU_EstPayDate = $row['CU_EstPayDate'];
$BillNo2 = $row['BillNo2'];
if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) {
if (empty($BillNo2)) {
return "<span class='text-danger'>未轉應收確認單</span>";
} else {
return "<span class='text-primary'>已轉應收確認單</span>";
}
} else {
return "時間未到";
}
}
function arSellInvoiceMaterial($row)
{
$CU_EstPayDate = $row['CU_EstPayDate'];
$InvoiceName = $row['InvoiceName'];
if (substr($CU_EstPayDate, 0, 6) <= date("Ym")) {
if (empty($InvoiceName)) {
return "<span class='text-danger'>未開發票</span>";
} else {
return "<span class='text-primary'>已開發票</span>";
}
} else {
return "時間未到";
}
}
function checkArWriteOffBill($conn, $row)
{
$BillNo = $row['BillNo2'];
$sql = "
SELECT
*
-- a.BillNo,
-- a.WriteOffBizPartnerId,
-- a.PayWriteOffOAmount,
-- b.FromBillDate AS ReceivedDate,
-- b.CurrWOFeeOAmt AS Fee,
-- c.OrderBillNo,
-- c.checkBillNo,
-- c.InvoiceNo,
-- c.BillDate AS CheckBillDate
FROM arWriteOffBill AS a
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo
LEFT JOIN
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail
LEFT JOIN
(SELECT
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo
FROM arCheckBill
LEFT JOIN arCheckBillInvInfo
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c
ON a.BillNo=c.BillNo
WHERE c.checkBillNo = '$BillNo'
";
$del = $conn->query($sql);
$i = 0;
foreach ($del as $row)
$i++;
if (empty($i)) {
return "<span class='text-danger'>未收款</span>";
} else {
return "<span class='text-primary'>已收款</span>";
}
}
?>
<?php if ($user_auth & 2) { ?>
<!-- <p>
<a href="board-create.php?function_name=board&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
</p> -->
<?php
}
if ($data) :
?>
<style>
table {
table-layout: fixed;
width: 100%;
}
td {
word-wrap: break-word;
}
img {
width: 125px;
}
.width_style_1 {
width: 125px;
}
table {
width: 100%;
}
#table_index_filter {
float: right;
}
#table_index_paginate {
float: right;
}
label {
display: inline-flex;
margin-bottom: .5rem;
margin-top: .5rem;
}
</style>
<div style="overflow-x:auto;">
<form id='myForm' method='post' action='maintainance_contract_payment_status.php?<?= $token_link ?>'>
<table class='table query-table table-striped table-bordered display compact' style='width:98%;text-align:center;margin:0 auto'>
<thead>
<tr>
<td colspan="5">
<h3 style='text-align:center'>保養合約-應收款項明細</h3>
</td>
</tr>
</thead>
<tbody>
<tr>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<td style='text-align:center;vertical-align: middle;'>
<input type="text" class='form-control' id='contractno' name='contractno' value="">
</td>
<td style='text-align:left;vertical-align: middle;'>
<button type="submit" style='text-align:center; margin:0 auto' class="btn btn-primary btn-sm">查詢</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div style="overflow-x:auto;">
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style='text-align:center;vertical-align: middle;'>營業人員/契約人員</th>
<th style='text-align:center;vertical-align: middle;'>合約號</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>標示號</th>
<th style='text-align:center;vertical-align: middle;'>電梯編號</th>
<th style='text-align:center;vertical-align: middle;'>預計請款日</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>催收次數</th>
<th style='text-align:center;vertical-align: middle;'>應收申請單狀態</th>
<th style='text-align:center;vertical-align: middle;'>請款金額(未轉應收)</th>
<th style='text-align:center;vertical-align: middle;'>請款金額(已轉應收)</th>
<th style='text-align:center;vertical-align: middle;'>應收申請單號</th>
<th style='text-align:center;vertical-align: middle;'>發票狀態</th>
<th style='text-align:center;vertical-align: middle;width:50px;'>發票單標示號</th>
<th style='text-align:center;vertical-align: middle;'>發票單號</th>
<th style='text-align:center;vertical-align: middle;'>發票明細</th>
<th style='text-align:center;vertical-align: middle;width:80px;'>發票金額</th>
<th style='text-align:center;vertical-align: middle;width:120px;'>發票號碼</th>
<th style='text-align:center;vertical-align: middle;'>核銷</th>
<!-- <th style='text-align:center;vertical-align: middle;'>核銷日期</th>
<th style='text-align:center;vertical-align: middle;'>未核銷金額</th>
<th style='text-align:center;vertical-align: middle;'>已核銷金額</th> -->
</tr>
</thead>
<tbody>
<?php foreach ($data as $row) { ?>
<tr>
<td>
<?php
echo getSalesmanNo($link, $row['BillNo']);
echo "<br/>";
echo getSalesmanName($link, $row['BillNo']);
?>
</td>
<td>
<?php echo $row['BillNo']; ?>
</td>
<td>
<?php echo $row['RowNo']; ?>
</td>
<td>
<?php echo $row['CU_MaterialId']; ?>
</td>
<td>
<?php echo date('Y/m/d', strtotime($row['CU_EstPayDate'])); ?>
</td>
<td>
<?php echo collect_month(strtotime($row['CU_EstPayDate'])); ?>
</td>
<td>
<?php echo checkArCheckBillStatus($row); ?>
</td>
<td>
<?php echo number_format(intval($row['UnTransCheckBLAmtWTax']), 0, '', ','); ?>
</td>
<td>
<?php echo number_format(intval($row['HadTransCheckBLAmtWTax']), 0, '', ','); ?>
</td>
<td>
<?php echo $row['BillNo2']; ?>
</td>
<td>
<?php echo arSellInvoiceMaterial($row); ?>
</td>
<td>
<?php echo $row['RowCode2']; ?>
</td>
<td>
<?php echo $row['BillNo3']; ?>
</td>
<td>
<?php echo $row['InvoiceName']; ?>
</td>
<td>
<?php echo number_format(intval($row['OAmountWithTax']), 0, '', ','); ?>
</td>
<td>
<?php echo $row['InvoiceNo']; ?>
</td>
<td>
<?php
echo checkArWriteOffBill($conn, $row)
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<script>
$(function() {
document.getElementById('loadingOverlay').classList.add('hidden');
})
</script>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "footer.php";
?>

1
wms/mkt/assets/js/alpine.js

@ -297,6 +297,7 @@ const pricereviewOptionSelect = () => {
this.options = this.orioptions this.options = this.orioptions
this.reloadOptions(); this.reloadOptions();
let val = (e== null) ? this.searchtext.toLowerCase() : e.target.value.toLowerCase() let val = (e== null) ? this.searchtext.toLowerCase() : e.target.value.toLowerCase()
console.log(val);
this.options.forEach(option=>{ this.options.forEach(option=>{
if(option.group_name == null) option.group_name = '' if(option.group_name == null) option.group_name = ''
if(option.spec == null) option.spec = '' if(option.spec == null) option.spec = ''

29
wms/mkt/pricereview-index.php

@ -125,6 +125,14 @@ if (!empty($res_get) || (!empty($_GET['check']) && $_GET['check'] == 1)) {
// echo $sql; // echo $sql;
} }
if($user_id === "M0137"){
$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
JOIN account ON account.accountid = pricereview_main.creater
WHERE (account.manager = 'M0029' OR account.manager='M0137') AND pricereview_main.status <> 'D' AND pricereview_main.ekind = '新梯' order by pricereview_main.id";
}
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
// 若結案不同意 // 若結案不同意
@ -323,9 +331,11 @@ function get_pending($token)
} }
$result = get_pending($token); $result = get_pending($token);
print_r($result); // print_r($result);
$result[1]['sid'] = !empty($result) ? $result[1]['sid'] : 'prm'; if(count($result) > 0){
$result[1]['fid'] = !empty($result) ? $result[1]['fid'] : 'prm01'; $result[1]['sid'] = !empty($result) ? $result[1]['sid'] : 'prm';
$result[1]['fid'] = !empty($result) ? $result[1]['fid'] : 'prm01';
}
if ($data) : if ($data) :
/* /*
@ -348,9 +358,13 @@ if ($data) :
</style> </style>
<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;">
<?php if($user_id=== "M0060" || $user_id==="M0107" || $user_id==="M0175" || $user_id==="M0174" || $user_id==="M0225"){ ?> <?php if(($user_id=== "M0060" || $user_id==="M0107" || $user_id==="M0175" || $user_id==="M0174" || $user_id==="M0225")){ ?>
<a href="/wms/mkt/pricereview-index.php?&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (!isset($_GET['system_id']) && !isset($_GET['check'])) ? "btn btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 所有價審</a> <a href="/wms/mkt/pricereview-index.php?&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (!isset($_GET['system_id']) && !isset($_GET['check'])) ? "btn btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 所有價審</a>
<?php if(count($result) > 0): ?>
<a href="/wms/mkt/pricereview-index.php?system_id=<?= $result[1]['sid'] ?>&flow_id=<?= $result[1]['fid'] ?>&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['system_id'])) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 待我簽核</a> <a href="/wms/mkt/pricereview-index.php?system_id=<?= $result[1]['sid'] ?>&flow_id=<?= $result[1]['fid'] ?>&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['system_id'])) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 待我簽核</a>
<?php else: ?>
<a href="javascript:;" onclick="alert('無待簽資料')" class=" btn <?php echo (isset($_GET['system_id'])) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 待我簽核</a>
<?php endif ;?>
<a href="/wms/mkt/pricereview-index.php?check=1&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 1) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 簽核完畢</a> <a href="/wms/mkt/pricereview-index.php?check=1&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 1) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 簽核完畢</a>
<a href="/wms/mkt/pricereview-index.php?check=2&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 2) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 結案同意</a> <a href="/wms/mkt/pricereview-index.php?check=2&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 2) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 結案同意</a>
<a href="/wms/mkt/pricereview-index.php?check=3&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 3) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 結案不同意</a> <a href="/wms/mkt/pricereview-index.php?check=3&function_name=pricereview&token=<?php echo $token; ?>" class=" btn <?php echo (isset($_GET['check']) && $_GET['check'] == 3) ? "btn-primary" : "btn-secondary"; ?> btn-sm categoryBtn"> 結案不同意</a>
@ -698,13 +712,15 @@ if ($data) :
<?php if (($user_id === "M0107" || $user_id === "M0060") && $data['applystatus'] < 3) : ?> <?php if (($user_id === "M0107" || $user_id === "M0060") && $data['applystatus'] < 3) : ?>
<span style="font-size:13px;font-weight:600">待申請</span> <span style="font-size:13px;font-weight:600">待申請</span>
<?php elseif ($data['applystatus'] < 3) : ?> <?php elseif ($data['applystatus'] < 3) : ?>
<a class="applybtn" target="_blank" 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 "申請";
} else { } else {
echo "檢視"; echo "檢視";
} ?> } ?>
</a><br> </a><br>
<?php else : ?>
<a class="applybtn" href="../contract/contract-new-apply.php?id=<?php echo $data['id'] . '&' . $para; ?>">審請已通過</a><br>
<?php endif; ?> <?php endif; ?>
<?php else : ?> <?php else : ?>
@ -720,9 +736,6 @@ if ($data) :
<?php if (false && ($data['status'] === 'YY' && $data['applystatus'] == 3 && ($user_id == "M0107" || $user_id == "M0060" || $user_id == "M0175" || $user_id === "TEST02")) || $user_id == "M0174" || $user_id == 'M0225') : ?> <?php if (false && ($data['status'] === 'YY' && $data['applystatus'] == 3 && ($user_id == "M0107" || $user_id == "M0060" || $user_id == "M0175" || $user_id === "TEST02")) || $user_id == "M0174" || $user_id == 'M0225') : ?>
<a class="applybtn" href="../contract/contract-download.php?id=<?php echo $data['id'] . '&' . $para ?>">下載</a> <a class="applybtn" href="../contract/contract-download.php?id=<?php echo $data['id'] . '&' . $para ?>">下載</a>
<?php endif; ?> <?php endif; ?>
<?php if ($data['status'] === 'YY') : ?>
<a class="applybtn" href="../contract/contract-download.php?id=<?php echo $data['id'] . '&' . $para ?>">下載草稿</a>
<?php endif; ?>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>

90
wms/mkt/pricereview_mi-api.php

@ -167,6 +167,7 @@ try {
$ex_fee += $exarr[$j][1]; $ex_fee += $exarr[$j][1];
$j++; $j++;
} }
// print_r($exarr);
mysqli_free_result($res); mysqli_free_result($res);
// 拆梯&美容平均分到每台電梯 // 拆梯&美容平均分到每台電梯
@ -326,14 +327,14 @@ try {
LEFT JOIN option_mi ON option_price.id = option_mi.option_price_id LEFT JOIN option_mi ON option_price.id = option_mi.option_price_id
LEFT JOIN elevator_quotation_rule ON option_mi.quotation_no = elevator_quotation_rule.quotation_no LEFT JOIN elevator_quotation_rule ON option_mi.quotation_no = elevator_quotation_rule.quotation_no
WHERE option_price.status = 'Y' "; WHERE option_price.status = 'Y' ";
$sql4 = "SELECT option_price.id, elevator_quotation_rule.equipment, option_mi.base_floor, option_mi.quotation_no, option_mi.base_floor_plus, option_mi.price, option_price.price as OP //新的SQL
FROM option_price $sql4 = "SELECT option_price.id, elevator_quotation_rule.equipment, option_mi.base_floor, option_mi.quotation_no, option_mi.base_floor_plus, option_mi.price, option_price.price as OP
LEFT JOIN option_mi ON option_price.id = option_mi.option_price_id FROM option_price
LEFT JOIN elevator_quotation_rule ON option_mi.quotation_no = elevator_quotation_rule.quotation_no LEFT JOIN option_mi ON option_price.id = option_mi.option_price_id
WHERE option_mi.option_price_id = " . $opt_elev_arr[$val]["price_id"] . " LEFT JOIN elevator_quotation_rule ON option_mi.quotation_no = elevator_quotation_rule.quotation_no
AND (" . $v["item_weight"] . " BETWEEN option_mi.min_weight AND option_mi.max_weight) WHERE option_mi.option_price_id = " . $opt_elev_arr[$val]["price_id"] . "
AND option_mi.open_kind = '" . $v["item_op"] . "'"; AND (" . $v["item_weight"] . " BETWEEN option_mi.min_weight AND option_mi.max_weight)
AND option_mi.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)) {
@ -449,6 +450,79 @@ AND option_mi.open_kind = '" . $v["item_op"] . "'";
} }
$rarr["content"] = $mi_arr; $rarr["content"] = $mi_arr;
$sql_str = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'E'";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $id);
$stmt->execute();
$items = $stmt->fetchAll(PDO::FETCH_ASSOC);
$sql_str = "SELECT pricereview_item.*,option_mi.price as option_mi FROM pricereview_item LEFT JOIN option_mi ON pricereview_item.price_id = option_mi.option_price_id WHERE pricereview_item.mid = :mid AND pricereview_item.item_group = 'B'";
$sql_str = "SELECT
pricereview_item.*,
(SELECT option_mi.price
FROM option_mi
WHERE pricereview_item.price_id = option_mi.option_price_id
ORDER BY option_mi.id ASC LIMIT 1) AS option_mi
FROM
pricereview_item
WHERE
pricereview_item.mid = :mid
AND pricereview_item.item_group = 'B'";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $id);
$stmt->execute();
$itemoptions = $stmt->fetchAll(PDO::FETCH_ASSOC);
$exceptArr = [];
foreach($items as $item){
if($item['option_relate_spec'] != NULL){
$exceptArr[] = [
'option_relate_spec'=> $item['option_relate_spec'],
'item_spec'=>$item['item_spec'],
'item_unit_price'=>$item['item_unit_price'],
'item_qty'=>$item['item_qty'],
'item_price_bp'=> $item['item_price_bp'],
];
}
}
// $rarr["content"][] = $exceptArr;
foreach($rarr["content"] as $idx=>&$item){
$newTotal = 0;
$item[16] = [];
$item[14] = [];
foreach($exceptArr as $except){
if($idx+1 == $except['option_relate_spec']){
$item[16][] = [
$except['item_spec'],
$except['item_unit_price']* $except['item_qty']
];
}
}
foreach($itemoptions as $itemoption){
if($idx+1 == $itemoption['option_relate_spec']){
$item[14][] = [
$itemoption['item_spec'],
round($itemoption['option_mi'] * $itemoption['item_qty'], 0),
];
}
}
foreach($item[14] as $option){
$newTotal += $option[1];
}
foreach($item[16] as $ex){
$newTotal += $ex[1];
}
$newTotal += $item[17];
$newTotal += $item[19][1];
$item[13] = $newTotal;
}
} catch (\Exception $e) { } catch (\Exception $e) {
$rarr['st'] = 'err'; $rarr['st'] = 'err';
$rarr['err'] = $e->getMessage(); $rarr['err'] = $e->getMessage();

21
wms/wipwhole-index-function.php

@ -1337,8 +1337,8 @@ function checkUseridIsManager($user_id)
// 中區 李烘銘 // 中區 李烘銘
if (in_array($user_id, ['M0086'])) if (in_array($user_id, ['M0086']))
return true; return true;
// 桃竹 張莉凱 // 桃竹 張莉凱 改 陳家文
if (in_array($user_id, ['M0026'])) if (in_array($user_id, ['M0029']))
return true; return true;
// 宜花東 陳志文 // 宜花東 陳志文
if (in_array($user_id, ['M0054'])) if (in_array($user_id, ['M0054']))
@ -1348,3 +1348,20 @@ function checkUseridIsManager($user_id)
return true; return true;
return false; return false;
} }
function manage_class_gary_ver($user_id)
{
global $link;
$sql = "
SELECT manager
FROM account
WHERE accountid = '$user_id'";
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($res);
$manager = $row["manager"];
mysqli_free_result($res);
if ($manager == "M0001")
return ""; // 董事長略過
return $manager;
}

13
wms/wipwhole-rec-invoice-edit-submit.php

@ -140,6 +140,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$tryrun_start_date_owner = $_POST['tryrun_start_date_owner']; $tryrun_start_date_owner = $_POST['tryrun_start_date_owner'];
$tryrun_end_date = $_POST['tryrun_end_date']; $tryrun_end_date = $_POST['tryrun_end_date'];
$tryrun_end_date_owner = $_POST['tryrun_end_date_owner']; $tryrun_end_date_owner = $_POST['tryrun_end_date_owner'];
$association_check_type = $_POST['association_check_type'];
$salesname = accountid2name($salesid)[$salesid]; $salesname = accountid2name($salesid)[$salesid];
$salesmail = accountid2email([$salesid])[$salesid]; $salesmail = accountid2email([$salesid])[$salesid];
@ -378,6 +379,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
delivery_date_owner = '$delivery_date_owner', delivery_date_owner = '$delivery_date_owner',
marketing_remark = '', marketing_remark = '',
real_custom_name = '$real_custom_name', real_custom_name = '$real_custom_name',
association_check_type = '$association_check_type',
"; ";
if (!empty(trim($marketing_remark))) { if (!empty(trim($marketing_remark))) {
$updatesql .= " $updatesql .= "
@ -1080,8 +1082,8 @@ function checkWwsAssianStatus($link, $user_id, $id = null)
$data['salesname'] = accountid2name($data['salesid'])[$data['salesid']]; $data['salesname'] = accountid2name($data['salesid'])[$data['salesid']];
$data['salesmail'] = accountid2email([$data['salesid']])[$data['salesid']]; $data['salesmail'] = accountid2email([$data['salesid']])[$data['salesid']];
$data['salesmanagername'] = accountid2name(manage_class($data['salesid'])[0])[manage_class($data['salesid'])[0]]; $data['salesmanagername'] = accountid2name(manage_class_gary_ver($data['salesid']))[manage_class_gary_ver($data['salesid'])];
$data['salesmanagermail'] = accountid2email([manage_class($data['salesid'])[0]])[manage_class($data['salesid'])[0]]; $data['salesmanagermail'] = accountid2email([manage_class_gary_ver($data['salesid'])])[manage_class_gary_ver($data['salesid'])];
$data['designname'] = accountid2name("M0023")["M0023"]; $data['designname'] = accountid2name("M0023")["M0023"];
$data['designmail'] = accountid2email(["M0023"])["M0023"]; $data['designmail'] = accountid2email(["M0023"])["M0023"];
$data['designleadername'] = accountid2name(getSheJiokLeaderNo($link))[getSheJiokLeaderNo($link)]; $data['designleadername'] = accountid2name(getSheJiokLeaderNo($link))[getSheJiokLeaderNo($link)];
@ -1123,7 +1125,12 @@ function checkWwsAssianStatus($link, $user_id, $id = null)
], ],
"永佳捷科技" "永佳捷科技"
); );
do_wws_next_assign(manage_class($data['salesid'])[0], $form_YD_key, 'I'); // 如果是桃竹區 主管是家文的新梯 簽到劉永德經理那
if (manage_class_gary_ver($data['salesid']) == 'M0029') {
do_wws_next_assign("M0137", $form_YD_key, 'I');
} else {
do_wws_next_assign(manage_class_gary_ver($data['salesid']), $form_YD_key, 'I');
}
return true; return true;
} }
} }

39
wms/wipwhole-rec-invoice-edit.php

@ -300,18 +300,27 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tbody style="font-weight: bolder;margin-bottom: 20px"> <tbody style="font-weight: bolder;margin-bottom: 20px">
<tr> <tr>
<td>營業人員確認項</td> <td>營業人員確認項</td>
<td> <td colspan="3">
<?php <?php
echo "營業擔當:" . $row['salesid'] . accountid2name()[$row['salesid']]; echo "營業擔當:" . $row['salesid'] . accountid2name()[$row['salesid']];
?> ?>
<br /> <br />
<?php <?php
if (!checkUseridIsManager($row['salesid'])) { if (!checkUseridIsManager($row['salesid'])) {
echo "營業擔當主管:" . manage_class($row['salesid'])[0] . accountid2name(manage_class($row['salesid'])[0])[manage_class($row['salesid'])[0]]; echo "營業擔當主管:" . manage_class_gary_ver($row['salesid']) . accountid2name(manage_class_gary_ver($row['salesid']))[manage_class_gary_ver($row['salesid'])];
} }
?> ?>
</td> </td>
</tr> </tr>
<tr>
<td style="vertical-align: middle">官檢類型</td>
<td colspan="3">
<input type='radio' id="association_check_type_1" name='association_check_type' value='1' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '1' ? "checked disabled" : ""; ?> />
<label for='association_check_type_1'>需要</label>
<input type='radio' id="association_check_type_2" name='association_check_type' value='2' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '2' ? "checked disabled" : ""; ?> />
<label for='association_check_type_2'>不需要</label>
</td>
</tr>
<tr> <tr>
<td style="vertical-align: middle;width:auto;">營業/契約確認規格</td> <td style="vertical-align: middle;width:auto;">營業/契約確認規格</td>
<td style="width:150px;"> <td style="width:150px;">
@ -384,7 +393,7 @@ include "wipwhole-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 type="text" name="real_custom_name" id="real_custom_name" style="width:70%;display:inline;" value="<?= $row["real_custom_name"]; ?>" <?= $marketing; ?> placeholder="輸入後即可上傳附件" /> 客戶姓名:<input type="text" name="real_custom_name" id="real_custom_name" style="width:70%;display:inline;" value="<?= $row["real_custom_name"]; ?>" <?= $marketing2; ?> placeholder="輸入後即可上傳附件" />
<br /> <br />
<input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" disabled> <input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" disabled>
<?php <?php
@ -1437,12 +1446,12 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr> <tr>
<td style="vertical-align: middle">QC及官檢類型</td> <td style="vertical-align: middle">QC及官檢類型</td>
<td> <td>
<input type='radio' id="qc_official_type_Q" name='qc_official_type' value='Q' <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'Q' ? "checked" : ""; ?> /> <input type='radio' id="qc_official_type_0" disabled <?php echo $row['association_check_type'] == '0' ? "checked" : ""; ?> />
<label for='qc_official_type_Q'>只需QC</label> <label for='qc_official_type_0'>未選擇</label>
<input type='radio' id="qc_official_type_O" name='qc_official_type' value='O' <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'O' ? "checked" : ""; ?> /> <input type='radio' id="qc_official_type_2" disabled <?php echo $row['association_check_type'] == '2' ? "checked" : ""; ?> />
<label for='qc_official_type_O'>只需官檢</label> <label for='qc_official_type_2'>只需QC</label>
<input type='radio' id="qc_official_type_QO" name='qc_official_type' value='QO' <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'QO' ? "checked" : ""; ?> /> <input type='radio' id="qc_official_type_1" disabled <?php echo $row['association_check_type'] == '1' ? "checked" : ""; ?> />
<label for='qc_official_type_QO'>QC+官檢</label> <label for='qc_official_type_1'>QC+官檢</label>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -1467,9 +1476,9 @@ include "wipwhole-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">QC合格日</td> <td style="vertical-align: middle">QC合格日</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="end_qc_date" name="end_qc_date" value="<?= $row['end_qc_date']; ?>" <?= $pinzheng; ?>> <input class="form-control" type="date" id="end_qc_date" name="end_qc_date" value="<?= $row['end_qc_date']; ?>" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "disabled" : ""; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#end_qc_date").val("");' <?= $pinzheng; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#end_qc_date").val("");' <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "disabled" : ""; ?>>清除</button>
</span> </span>
</div> </div>
</td> </td>
@ -1485,10 +1494,10 @@ include "wipwhole-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="official_check_date" name="official_check_date" value="<?= $row['official_check_date']; ?>" <?= $pinzheng; ?>> <input class="form-control" type="date" id="official_check_date" name="official_check_date" value="<?= $row['official_check_date']; ?>" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>
<input type="hidden" id="old_official_check_date" name="old_official_check_date" value="<?= $row['official_check_date']; ?>"> <input type="hidden" id="old_official_check_date" name="old_official_check_date" value="<?= $row['official_check_date']; ?>" <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#official_check_date").val("");' <?= $pinzheng; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#official_check_date").val("");' <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>清除</button>
</span> </span>
</div> </div>
</td> </td>
@ -1503,7 +1512,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr> <tr>
<td style='width:180px;'>官檢附件</td> <td style='width:180px;'>官檢附件</td>
<td> <td>
<input style="width:70%;display:inline;" type="file" id="official_check_file" name="official_check_file" <?= $pinzheng; ?>> <input style="width:70%;display:inline;" type="file" id="official_check_file" name="official_check_file" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "disabled" : ""; ?>>
<?php <?php
echo !empty($row['official_check_file']) ? "<a id='official_check_file' style='color:#00F;' href='" . $row['official_check_file'] . "' target='_blank'>下載附件</a>" : ""; echo !empty($row['official_check_file']) ? "<a id='official_check_file' style='color:#00F;' href='" . $row['official_check_file'] . "' target='_blank'>下載附件</a>" : "";
?> ?>

21
wms/wipwhole-renovate-index-function.php

@ -1279,8 +1279,8 @@ function checkUseridIsManager($user_id)
// 中區 李烘銘 // 中區 李烘銘
if (in_array($user_id, ['M0086'])) if (in_array($user_id, ['M0086']))
return true; return true;
// 桃竹 張莉凱 // 桃竹 張莉凱 改 陳家文
if (in_array($user_id, ['M0026'])) if (in_array($user_id, ['M0029']))
return true; return true;
// 宜花東 陳志文 // 宜花東 陳志文
if (in_array($user_id, ['M0054'])) if (in_array($user_id, ['M0054']))
@ -1290,3 +1290,20 @@ function checkUseridIsManager($user_id)
return true; return true;
return false; return false;
} }
function manage_class_gary_ver($user_id)
{
global $link;
$sql = "
SELECT manager
FROM account
WHERE accountid = '$user_id'";
$res = mysqli_query($link, $sql);
$row = mysqli_fetch_assoc($res);
$manager = $row["manager"];
mysqli_free_result($res);
if ($manager == "M0001")
return ""; // 董事長略過
return $manager;
}

16
wms/wipwhole-renovate-rec-invoice-edit-submit.php

@ -128,9 +128,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$delivery_date = $_POST['delivery_date'] ?: $row['delivery_date']; $delivery_date = $_POST['delivery_date'] ?: $row['delivery_date'];
$old_delivery_date = $_POST['old_delivery_date'] ?: $row['old_delivery_date']; $old_delivery_date = $_POST['old_delivery_date'] ?: $row['old_delivery_date'];
$delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner']; $delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner'];
$salesid = $_POST['salesid'] ?: $row['salesid'];
$warehouseid = $_POST['warehouseid'] ?: $row['warehouseid']; $warehouseid = $_POST['warehouseid'] ?: $row['warehouseid'];
$old_warehouseid = $_POST['old_warehouseid'] ?: $row['warehouseid']; $old_warehouseid = $_POST['old_warehouseid'] ?: $row['warehouseid'];
$association_check_type = $_POST['association_check_type'] ?: $row['association_check_type'];
$salesname = accountid2name($salesid)[$salesid];
$salesmail = accountid2email([$salesid])[$salesid];
$creater = $_POST['creater']; $creater = $_POST['creater'];
$create_at = date("Y-m-d H:i:s"); $create_at = date("Y-m-d H:i:s");
@ -328,11 +332,12 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
. " . "
移交日:" . $old_delivery_date . " => " . $delivery_date; 移交日:" . $old_delivery_date . " => " . $delivery_date;
} }
$cmail->sendx( $cmail->sendx(
$mail_title, $mail_title,
$mail_content, $mail_content,
[ [
[$salesname, $salesmail] [$salesname, $salesmail],
// ['gary', 'gary_chen@masada.com.tw'] // ['gary', 'gary_chen@masada.com.tw']
], ],
"永佳捷科技" "永佳捷科技"
@ -382,6 +387,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
customer_planning_verify = '$customer_planning_verify', customer_planning_verify = '$customer_planning_verify',
customer_planning_verify_at = '$customer_planning_verify_at', customer_planning_verify_at = '$customer_planning_verify_at',
customer_planning_verify_owner = '$customer_planning_verify_owner', customer_planning_verify_owner = '$customer_planning_verify_owner',
association_check_type = '$association_check_type',
marketing_remark = '', marketing_remark = '',
"; ";
if (!empty(trim($marketing_remark))) { if (!empty(trim($marketing_remark))) {
@ -1149,8 +1155,8 @@ function checkWwsAssianStatus($link, $user_id)
$data['salesname'] = accountid2name($data['salesid'])[$data['salesid']]; $data['salesname'] = accountid2name($data['salesid'])[$data['salesid']];
$data['salesmail'] = accountid2email([$data['salesid']])[$data['salesid']]; $data['salesmail'] = accountid2email([$data['salesid']])[$data['salesid']];
$data['salesmanagername'] = accountid2name(manage_class($data['salesid'])[0])[manage_class($data['salesid'])[0]]; $data['salesmanagername'] = accountid2name(manage_class_gary_ver($data['salesid']))[manage_class_gary_ver($data['salesid'])];
$data['salesmanagermail'] = accountid2email([manage_class($data['salesid'])[0]])[manage_class($data['salesid'])[0]]; $data['salesmanagermail'] = accountid2email([manage_class_gary_ver($data['salesid'])])[manage_class_gary_ver($data['salesid'])];
$data['designname'] = accountid2name("M0023")["M0023"]; $data['designname'] = accountid2name("M0023")["M0023"];
$data['designmail'] = accountid2email(["M0023"])["M0023"]; $data['designmail'] = accountid2email(["M0023"])["M0023"];
$data['designleadername'] = accountid2name(getSheJiokLeaderNo($link))[getSheJiokLeaderNo($link)]; $data['designleadername'] = accountid2name(getSheJiokLeaderNo($link))[getSheJiokLeaderNo($link)];
@ -1197,7 +1203,7 @@ function checkWwsAssianStatus($link, $user_id)
], ],
"永佳捷科技" "永佳捷科技"
); );
do_wws_next_assign(manage_class($data['salesid'])[0], $form_key, 'F'); do_wws_next_assign(manage_class_gary_ver($data['salesid']), $form_key, 'F');
} }
} }

41
wms/wipwhole-renovate-rec-invoice-edit.php

@ -613,11 +613,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<br /> <br />
<?php <?php
if (!checkUseridIsManager($row['salesid'])) { if (!checkUseridIsManager($row['salesid'])) {
echo "營業擔當主管:" . manage_class($row['salesid'])[0] . accountid2name(manage_class($row['salesid'])[0])[manage_class($row['salesid'])[0]]; echo "營業擔當主管:" . manage_class_gary_ver($row['salesid']) . accountid2name(manage_class_gary_ver($row['salesid']))[manage_class_gary_ver($row['salesid'])];
} }
?> ?>
</td> </td>
</tr> </tr>
</tr>
<tr>
<td style="vertical-align: middle">官檢類型</td>
<td colspan="3">
<input type='radio' id="association_check_type_1" name='association_check_type' value='1' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '1' ? "checked disabled" : ""; ?> />
<label for='association_check_type_1'>需要</label>
<input type='radio' id="association_check_type_2" name='association_check_type' value='2' <?= $marketing2; ?> <?php echo $row['association_check_type'] == '2' ? "checked disabled" : ""; ?> />
<label for='association_check_type_2'>不需要</label>
</td>
</tr>
<tr> <tr>
<td style="vertical-align: middle;width:auto;">營業確認規格</td> <td style="vertical-align: middle;width:auto;">營業確認規格</td>
<td style="width:150px;"> <td style="width:150px;">
@ -693,7 +703,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 type="text" name="real_custom_name" id="real_custom_name" style="width:70%;display:inline;" value="<?= $row["real_custom_name"]; ?>" placeholder="輸入後即可上傳附件" <?= $marketing; ?> /> 客戶姓名:<input type="text" name="real_custom_name" id="real_custom_name" style="width:70%;display:inline;" value="<?= $row["real_custom_name"]; ?>" placeholder="輸入後即可上傳附件" <?= $marketing2; ?> />
<br /> <br />
<input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" disabled> <input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" disabled>
<?php <?php
@ -1430,12 +1440,12 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<tr> <tr>
<td style="vertical-align: middle">QC及官檢類型</td> <td style="vertical-align: middle">QC及官檢類型</td>
<td> <td>
<input type='radio' id="qc_official_type_Q" name='qc_official_type' value="Q" <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'Q' ? "checked" : ""; ?> /> <input type='radio' id="qc_official_type_0" disabled <?php echo $row['association_check_type'] == '0' ? "checked" : ""; ?> />
<label for='qc_official_type_Q'>只需QC</label> <label for='qc_official_type_0'>未選擇</label>
<input type='radio' id="qc_official_type_O" name='qc_official_type' value="O" <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'O' ? "checked" : ""; ?> /> <input type='radio' id="qc_official_type_2" disabled <?php echo $row['association_check_type'] == '2' ? "checked" : ""; ?> />
<label for='qc_official_type_O'>只需官檢</label> <label for='qc_official_type_2'>只需QC</label>
<input type='radio' id="qc_official_type_QO" name='qc_official_type' value="QO" <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'QO' ? "checked" : ""; ?> /> <input type='radio' id="qc_official_type_1" disabled <?php echo $row['association_check_type'] == '1' ? "checked" : ""; ?> />
<label for='qc_official_type_QO'>QC+官檢</label> <label for='qc_official_type_1'>QC+官檢</label>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -1478,10 +1488,10 @@ 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="official_check_date" name="official_check_date" value="<?= $row['official_check_date']; ?>" <?= $pinzheng; ?>> <input class="form-control" type="date" id="official_check_date" name="official_check_date" value="<?= $row['official_check_date']; ?>" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>
<input type="hidden" id="old_official_check_date" name="old_official_check_date" value="<?= $row['official_check_date']; ?>" <?= $pinzheng; ?>> <input type="hidden" id="old_official_check_date" name="old_official_check_date" value="<?= $row['official_check_date']; ?>" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type='button' onclick='$("#official_check_date").val("");' <?= $pinzheng; ?>>清除</button> <button class="btn btn-default" type='button' onclick='$("#official_check_date").val("");' <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>清除</button>
</span> </span>
</div> </div>
</td> </td>
@ -1496,7 +1506,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<tr> <tr>
<td style='width:180px;'>官檢附件</td> <td style='width:180px;'>官檢附件</td>
<td> <td>
<input style="width:70%;display:inline;" type="file" id="official_check_file" name="official_check_file" <?= $pinzheng; ?>> <input style="width:70%;display:inline;" type="file" id="official_check_file" name="official_check_file" <?= $pinzheng; ?> <?php echo $row['association_check_type'] == '2' ? "disabled" : ""; ?>>
<?php <?php
echo !empty($row['official_check_file']) ? "<a id='official_check_file' style='color:#00F;' href='" . $row['official_check_file'] . "' target='_blank'>下載附件</a>" : ""; echo !empty($row['official_check_file']) ? "<a id='official_check_file' style='color:#00F;' href='" . $row['official_check_file'] . "' target='_blank'>下載附件</a>" : "";
?> ?>
@ -2054,6 +2064,11 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
'install_end_date2', 'install_end_date2',
'tryrun_start_date2', 'tryrun_start_date2',
'tryrun_end_date2', 'tryrun_end_date2',
'install_start_date',
'install_end_date',
'tryrun_start_date',
'tryrun_end_date',
'delivery_date'
] ]
for (var i = 0; i < catchTime_input_arr.length; i++) { for (var i = 0; i < catchTime_input_arr.length; i++) {
inputChangeCatchTime(catchTime_input_arr[i]); inputChangeCatchTime(catchTime_input_arr[i]);
@ -2369,7 +2384,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
} }
} }
function sendExpressionMailToPlatform(id){ function sendExpressionMailToPlatform(id) {
if (confirm('確定要發送郵件嗎?') == true) { if (confirm('確定要發送郵件嗎?') == true) {
$("#wipwholestatusid").val(id); $("#wipwholestatusid").val(id);
$('#send_expression_mail_to_platform_form').submit(); $('#send_expression_mail_to_platform_form').submit();

92
wms/wipwhole-wipinstallstatus-index-modal.php

@ -19,7 +19,14 @@ if ($method == 'getInstallingDetails')
if ($method == 'getInstalling2Details') if ($method == 'getInstalling2Details')
echo getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month); echo getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month);
if ($method == 'getShippingDetailsSql')
echo getShippingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month);
if ($method == 'getEndingDetailsSql')
echo getEndingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month);
if ($method == 'getInstallingDetailsSql')
echo getInstallingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month);
if ($method == 'getInstalling2DetailsSql')
echo getInstalling2DetailsSql($type, $mtype, $radsY, $radsM, $year, $month);
// 出貨台數 // 出貨台數
@ -44,6 +51,25 @@ function getShippingDetails($type, $mtype, $radsY, $radsM, $year, $month)
return json_encode($data, JSON_UNESCAPED_UNICODE); return json_encode($data, JSON_UNESCAPED_UNICODE);
} }
function getShippingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
return $sql;
}
// 工收台數 // 工收台數
function getEndingDetails($type, $mtype, $radsY, $radsM, $year, $month) function getEndingDetails($type, $mtype, $radsY, $radsM, $year, $month)
@ -67,6 +93,24 @@ function getEndingDetails($type, $mtype, $radsY, $radsM, $year, $month)
return json_encode($data, JSON_UNESCAPED_UNICODE); return json_encode($data, JSON_UNESCAPED_UNICODE);
} }
function getEndingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
AND (delivery_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
OR
official_check_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
)
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
return $sql;
}
// 試車完台數 // 試車完台數
function getInstallingDetails($type, $mtype, $radsY, $radsM, $year, $month) function getInstallingDetails($type, $mtype, $radsY, $radsM, $year, $month)
@ -93,6 +137,27 @@ function getInstallingDetails($type, $mtype, $radsY, $radsM, $year, $month)
return json_encode($data, JSON_UNESCAPED_UNICODE); return json_encode($data, JSON_UNESCAPED_UNICODE);
} }
function getInstallingDetailsSql($type, $mtype, $radsY, $radsM, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND (
real_arrival_date IS NOT NULL
AND real_arrival_date != ''
)
AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
AND tryrun_end_date <= '$year-$month-31'
AND tryrun_end_date != ''
AND tryrun_end_date IS NOT NULL
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
return $sql;
}
// 在裝中台數 // 在裝中台數
function getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month) function getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month)
@ -121,3 +186,28 @@ function getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month)
$data = mysqli_fetch_all($result, MYSQLI_ASSOC); $data = mysqli_fetch_all($result, MYSQLI_ASSOC);
return json_encode($data, JSON_UNESCAPED_UNICODE); return json_encode($data, JSON_UNESCAPED_UNICODE);
} }
function getInstalling2DetailsSql($type, $mtype, $radsY, $radsM, $year, $month)
{
global $link;
$sql = "
SELECT
*
FROM wipwholestatus
WHERE status = '1'
AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31'
AND (
delivery_date IS NULL
OR delivery_date = ''
OR delivery_date >= '$year-$month-31'
)
AND(
official_check_date IS NULL
OR official_check_date = ''
OR official_check_date >= '$year-$month-31'
)
";
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
return $sql;
}

23
wms/wipwhole-wipinstallstatus-index.php

@ -617,6 +617,29 @@ if ((int)$radsY . $radsM > (int)$radeY . $radeM) {
function showDetails(method, contract_type, renovate_type, radsY, radsM, radsYi, start_month) { function showDetails(method, contract_type, renovate_type, radsY, radsM, radsYi, start_month) {
$("#myModal").show(); $("#myModal").show();
$.ajax({
type: "POST",
dataType: "html",
url: "wipwhole-wipinstallstatus-index-modal.php",
data: {
method: method+'Sql',
contract_type: contract_type,
renovate_type: renovate_type,
radsY: radsY,
radsM: radsM,
radsYi: radsYi,
start_month: start_month
},
success: function(data) {
console.log(data);
},
error: function(data) {
console.log(data);
}
})
$.ajax({ $.ajax({
type: "POST", type: "POST",
dataType: "json", dataType: "json",

2
wms/wipwholeinstall-index-export-excel.php

@ -175,7 +175,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
substr($row['tryrun_end_date'], 0, 10), substr($row['tryrun_end_date'], 0, 10),
substr($row['qc_date'], 0, 10), substr($row['qc_date'], 0, 10),
substr($row['end_qc_date'], 0, 10), substr($row['end_qc_date'], 0, 10),
substr($row['official_check_date'], 0, 10), $row['association_check_type'] == '1' ? "-" : substr($row['official_check_date'], 0, 10),
substr($row['delivery_date'], 0, 10), substr($row['delivery_date'], 0, 10),
accountidToName($row['salesid']) accountidToName($row['salesid'])
]; ];

4
wms/wipwholeinstall-index-table-html.php

@ -172,8 +172,12 @@
</td> </td>
<td> <td>
<?php <?php
if ($data['association_check_type'] == '1') {
echo "-";
} else {
if (!empty($data['official_check_date'])) if (!empty($data['official_check_date']))
echo date("Y/m/d", strtotime($data['official_check_date'])); echo date("Y/m/d", strtotime($data['official_check_date']));
}
?> ?>
</td> </td>
<td> <td>

2
wms/wipwholeinstall-renovate-index-export-excel.php

@ -177,7 +177,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
substr($row['tryrun_end_date'], 0, 10), substr($row['tryrun_end_date'], 0, 10),
substr($row['qc_date'], 0, 10), substr($row['qc_date'], 0, 10),
substr($row['end_qc_date'], 0, 10), substr($row['end_qc_date'], 0, 10),
substr($row['official_check_date'], 0, 10), $row['association_check_type'] == '1' ? "-" : substr($row['official_check_date'], 0, 10),
substr($row['delivery_date'], 0, 10), substr($row['delivery_date'], 0, 10),
accountidToName($row['salesid']) accountidToName($row['salesid'])
]; ];

4
wms/wipwholeinstall-renovate-index-table-html.php

@ -155,8 +155,12 @@
</td> </td>
<td> <td>
<?php <?php
if ($data['association_check_type'] == '1') {
echo "-";
} else {
if (!empty($data['official_check_date'])) if (!empty($data['official_check_date']))
echo date("Y/m/d", strtotime($data['official_check_date'])); echo date("Y/m/d", strtotime($data['official_check_date']));
}
?> ?>
</td> </td>
<td> <td>

Loading…
Cancel
Save