You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
4.8 KiB
157 lines
4.8 KiB
<?php
|
|
require_once dirname(__FILE__) . "/../mkt/database.php";
|
|
include "fun_global.php";
|
|
|
|
// AJAX 顯示合約明細
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
$form_name = $_POST['form_name'];
|
|
$type = $_POST['type'];
|
|
$mtype = $_POST['mtype'];
|
|
$year = $_POST['year'];
|
|
$month = $_POST['month'];
|
|
if ($form_name == 'getShipping') {
|
|
echo getShipping($type, $mtype, $year, $month);
|
|
}
|
|
if ($form_name == 'getInstalling') {
|
|
echo getInstalling($type, $mtype, $year, $month);
|
|
}
|
|
if ($form_name == 'getInstalling2') {
|
|
echo getInstalling2($type, $mtype, $year, $month);
|
|
}
|
|
if ($form_name == 'getQCing') {
|
|
echo getQCing($type, $mtype, $year, $month);
|
|
}
|
|
if ($form_name == 'getDeliverying') {
|
|
echo getDeliverying($type, $mtype, $year, $month);
|
|
}
|
|
}
|
|
|
|
// 出貨台數
|
|
function getShipping($type, $mtype, $year, $month)
|
|
{
|
|
global $link;
|
|
$sql = "
|
|
SELECT
|
|
*
|
|
FROM wipwholestatus
|
|
WHERE status = '1'
|
|
AND (
|
|
real_arrival_date IS NOT NULL
|
|
AND real_arrival_date != ''
|
|
)
|
|
";
|
|
if(!empty($month)){
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
|
|
}else{
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
|
|
}
|
|
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
|
|
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
|
|
$result = mysqli_query($link, $sql);
|
|
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
|
|
return json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
// 在裝台數
|
|
function getInstalling($type, $mtype, $year, $month)
|
|
{
|
|
global $link;
|
|
$sql = "
|
|
SELECT
|
|
*
|
|
FROM wipwholestatus
|
|
WHERE status = '1'
|
|
AND (
|
|
install_start_date IS NOT NULL
|
|
OR install_start_date != ''
|
|
)
|
|
AND (
|
|
install_end_date IS NULL
|
|
OR install_end_date = ''
|
|
)
|
|
";
|
|
if(!empty($month)){
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
|
|
}else{
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
|
|
}
|
|
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
|
|
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
|
|
$result = mysqli_query($link, $sql);
|
|
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
|
|
return json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
// 完工台數
|
|
function getInstalling2($type, $mtype, $year, $month)
|
|
{
|
|
global $link;
|
|
$sql = "
|
|
SELECT
|
|
*
|
|
FROM wipwholestatus
|
|
WHERE status = '1'
|
|
AND install_start_date IS NOT NULL
|
|
AND install_start_date != ''
|
|
AND install_end_date IS NOT NULL
|
|
AND install_end_date != ''
|
|
";
|
|
if(!empty($month)){
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
|
|
}else{
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
|
|
}
|
|
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
|
|
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
|
|
$result = mysqli_query($link, $sql);
|
|
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
|
|
return json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
// QC台數
|
|
function getQCing($type, $mtype, $year, $month)
|
|
{
|
|
global $link;
|
|
$sql = "
|
|
SELECT
|
|
*
|
|
FROM wipwholestatus
|
|
WHERE status = '1'
|
|
AND end_qc_date IS NOT NULL
|
|
AND end_qc_date != ''
|
|
";
|
|
if(!empty($month)){
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
|
|
}else{
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
|
|
}
|
|
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
|
|
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
|
|
$result = mysqli_query($link, $sql);
|
|
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
|
|
return json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|
|
// 移交台數
|
|
function getDeliverying($type, $mtype, $year, $month)
|
|
{
|
|
global $link;
|
|
$sql = "
|
|
SELECT
|
|
*
|
|
FROM wipwholestatus
|
|
WHERE status = '1'
|
|
AND delivery_date IS NOT NULL
|
|
AND delivery_date != ''
|
|
";
|
|
if(!empty($month)){
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-$month-01' AND '$year-$month-31'";
|
|
}else{
|
|
$sql .= " AND real_arrival_date BETWEEN '$year-01-01' AND '$year-12-31'";
|
|
}
|
|
$sql .= !empty($type) ? " AND contract_type = '$type'" : "";
|
|
$sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : "";
|
|
$result = mysqli_query($link, $sql);
|
|
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
|
|
return json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
}
|
|
|