Browse Source

1.預計出貨報表修正bug

2.大日程 manage_class 改用自己版本
3.修正桃竹區營業員階段bug
4.新增營業員判斷協檢功能
5.新增應收帳款功能(保養)
gary
gary_chen\gary_chen 1 year ago
parent
commit
dea8f62e45
  1. 8
      wms/api/bpm/draw_update.php
  2. 12
      wms/estimated_shipping_date_report.php
  3. 399
      wms/maintainance_contract_payment_status.php
  4. 21
      wms/wipwhole-index-function.php
  5. 13
      wms/wipwhole-rec-invoice-edit-submit.php
  6. 39
      wms/wipwhole-rec-invoice-edit.php
  7. 21
      wms/wipwhole-renovate-index-function.php
  8. 16
      wms/wipwhole-renovate-rec-invoice-edit-submit.php
  9. 39
      wms/wipwhole-renovate-rec-invoice-edit.php
  10. 92
      wms/wipwhole-wipinstallstatus-index-modal.php
  11. 23
      wms/wipwhole-wipinstallstatus-index.php
  12. 2
      wms/wipwholeinstall-index-export-excel.php
  13. 4
      wms/wipwholeinstall-index-table-html.php
  14. 2
      wms/wipwholeinstall-renovate-index-export-excel.php
  15. 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);
?>

12
wms/estimated_shipping_date_report.php

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

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";
?>

21
wms/wipwhole-index-function.php

@ -1337,8 +1337,8 @@ function checkUseridIsManager($user_id)
// 中區 李烘銘
if (in_array($user_id, ['M0086']))
return true;
// 桃竹 張莉凱
if (in_array($user_id, ['M0026']))
// 桃竹 張莉凱 改 陳家文
if (in_array($user_id, ['M0029']))
return true;
// 宜花東 陳志文
if (in_array($user_id, ['M0054']))
@ -1348,3 +1348,20 @@ function checkUseridIsManager($user_id)
return true;
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_end_date = $_POST['tryrun_end_date'];
$tryrun_end_date_owner = $_POST['tryrun_end_date_owner'];
$association_check_type = $_POST['association_check_type'];
$salesname = accountid2name($salesid)[$salesid];
$salesmail = accountid2email([$salesid])[$salesid];
@ -378,6 +379,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
delivery_date_owner = '$delivery_date_owner',
marketing_remark = '',
real_custom_name = '$real_custom_name',
association_check_type = '$association_check_type',
";
if (!empty(trim($marketing_remark))) {
$updatesql .= "
@ -1080,8 +1082,8 @@ function checkWwsAssianStatus($link, $user_id, $id = null)
$data['salesname'] = accountid2name($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['salesmanagermail'] = accountid2email([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_gary_ver($data['salesid'])])[manage_class_gary_ver($data['salesid'])];
$data['designname'] = accountid2name("M0023")["M0023"];
$data['designmail'] = accountid2email(["M0023"])["M0023"];
$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;
}
}

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">
<tr>
<td>營業人員確認項</td>
<td>
<td colspan="3">
<?php
echo "營業擔當:" . $row['salesid'] . accountid2name()[$row['salesid']];
?>
<br />
<?php
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>
</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>
<td style="vertical-align: middle;width:auto;">營業/契約確認規格</td>
<td style="width:150px;">
@ -384,7 +393,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
</td>
<td style="vertical-align: middle;">附件</td>
<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 />
<input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" disabled>
<?php
@ -1437,12 +1446,12 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr>
<td style="vertical-align: middle">QC及官檢類型</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" : ""; ?> />
<label for='qc_official_type_Q'>只需QC</label>
<input type='radio' id="qc_official_type_O" name='qc_official_type' value='O' <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'O' ? "checked" : ""; ?> />
<label for='qc_official_type_O'>只需官檢</label>
<input type='radio' id="qc_official_type_QO" name='qc_official_type' value='QO' <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'QO' ? "checked" : ""; ?> />
<label for='qc_official_type_QO'>QC+官檢</label>
<input type='radio' id="qc_official_type_0" disabled <?php echo $row['association_check_type'] == '0' ? "checked" : ""; ?> />
<label for='qc_official_type_0'>未選擇</label>
<input type='radio' id="qc_official_type_2" disabled <?php echo $row['association_check_type'] == '2' ? "checked" : ""; ?> />
<label for='qc_official_type_2'>只需QC</label>
<input type='radio' id="qc_official_type_1" disabled <?php echo $row['association_check_type'] == '1' ? "checked" : ""; ?> />
<label for='qc_official_type_1'>QC+官檢</label>
</td>
</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">
<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">
<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>
</div>
</td>
@ -1485,10 +1494,10 @@ include "wipwhole-rec-invoice-edit-submit.php";
<td style="vertical-align: middle">官檢日</td>
<td style="vertical-align: middle">
<div class="input-group">
<input class="form-control" type="date" id="official_check_date" name="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']; ?>">
<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']; ?>" <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>
<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>
</div>
</td>
@ -1503,7 +1512,7 @@ include "wipwhole-rec-invoice-edit-submit.php";
<tr>
<td style='width:180px;'>官檢附件</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
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']))
return true;
// 桃竹 張莉凱
if (in_array($user_id, ['M0026']))
// 桃竹 張莉凱 改 陳家文
if (in_array($user_id, ['M0029']))
return true;
// 宜花東 陳志文
if (in_array($user_id, ['M0054']))
@ -1290,3 +1290,20 @@ function checkUseridIsManager($user_id)
return true;
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'];
$old_delivery_date = $_POST['old_delivery_date'] ?: $row['old_delivery_date'];
$delivery_date_owner = $_POST['delivery_date_owner'] ?: $row['delivery_date_owner'];
$salesid = $_POST['salesid'] ?: $row['salesid'];
$warehouseid = $_POST['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'];
$create_at = date("Y-m-d H:i:s");
@ -328,11 +332,12 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
. "
移交日:" . $old_delivery_date . " => " . $delivery_date;
}
$cmail->sendx(
$mail_title,
$mail_content,
[
[$salesname, $salesmail]
[$salesname, $salesmail],
// ['gary', 'gary_chen@masada.com.tw']
],
"永佳捷科技"
@ -382,6 +387,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
customer_planning_verify = '$customer_planning_verify',
customer_planning_verify_at = '$customer_planning_verify_at',
customer_planning_verify_owner = '$customer_planning_verify_owner',
association_check_type = '$association_check_type',
marketing_remark = '',
";
if (!empty(trim($marketing_remark))) {
@ -1149,8 +1155,8 @@ function checkWwsAssianStatus($link, $user_id)
$data['salesname'] = accountid2name($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['salesmanagermail'] = accountid2email([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_gary_ver($data['salesid'])])[manage_class_gary_ver($data['salesid'])];
$data['designname'] = accountid2name("M0023")["M0023"];
$data['designmail'] = accountid2email(["M0023"])["M0023"];
$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');
}
}

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

@ -613,11 +613,21 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<br />
<?php
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>
</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>
<td style="vertical-align: middle;width:auto;">營業確認規格</td>
<td style="width:150px;">
@ -693,7 +703,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
</td>
<td style="vertical-align: middle;">附件</td>
<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 />
<input style="width:70%;display:inline;" type="file" id="customer_planning_verify_file" name="customer_planning_verify_file" disabled>
<?php
@ -1430,12 +1440,12 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<tr>
<td style="vertical-align: middle">QC及官檢類型</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" : ""; ?> />
<label for='qc_official_type_Q'>只需QC</label>
<input type='radio' id="qc_official_type_O" name='qc_official_type' value="O" <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'O' ? "checked" : ""; ?> />
<label for='qc_official_type_O'>只需官檢</label>
<input type='radio' id="qc_official_type_QO" name='qc_official_type' value="QO" <?= $pinzheng; ?> <?php echo $row['qc_official_type'] == 'QO' ? "checked" : ""; ?> />
<label for='qc_official_type_QO'>QC+官檢</label>
<input type='radio' id="qc_official_type_0" disabled <?php echo $row['association_check_type'] == '0' ? "checked" : ""; ?> />
<label for='qc_official_type_0'>未選擇</label>
<input type='radio' id="qc_official_type_2" disabled <?php echo $row['association_check_type'] == '2' ? "checked" : ""; ?> />
<label for='qc_official_type_2'>只需QC</label>
<input type='radio' id="qc_official_type_1" disabled <?php echo $row['association_check_type'] == '1' ? "checked" : ""; ?> />
<label for='qc_official_type_1'>QC+官檢</label>
</td>
</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">
<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 type="hidden" id="old_official_check_date" name="old_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; ?> <?php echo $row['association_check_type'] == '2' ? "" : "disabled"; ?>>
<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>
</div>
</td>
@ -1496,7 +1506,7 @@ include "wipwhole-renovate-rec-invoice-edit-submit.php";
<tr>
<td style='width:180px;'>官檢附件</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
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',
'tryrun_start_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++) {
inputChangeCatchTime(catchTime_input_arr[i]);

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

@ -19,7 +19,14 @@ if ($method == 'getInstallingDetails')
if ($method == 'getInstalling2Details')
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);
}
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)
@ -67,6 +93,24 @@ function getEndingDetails($type, $mtype, $radsY, $radsM, $year, $month)
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)
@ -93,6 +137,27 @@ function getInstallingDetails($type, $mtype, $radsY, $radsM, $year, $month)
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)
@ -121,3 +186,28 @@ function getInstalling2Details($type, $mtype, $radsY, $radsM, $year, $month)
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
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) {
$("#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({
type: "POST",
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['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),
accountidToName($row['salesid'])
];

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

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

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

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

Loading…
Cancel
Save