"; $result = mysqli_query($link, $sql); $data = mysqli_fetch_array($result, MYSQLI_ASSOC); return $data['all_count']; } // 試車完台數 function getInstalling($type, $mtype, $radsY, $radsM, $year, $month) { global $link; $sql = " SELECT count(*) AS all_count -- real_arrival_date, -- tryrun_end_date 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%'" : ""; // echo $sql."
"; $result = mysqli_query($link, $sql); $data = mysqli_fetch_array($result, MYSQLI_ASSOC); return $data['all_count']; } // 工收台數 function getEnding($type, $mtype, $radsY, $radsM, $year, $month) { global $link; $sql = " SELECT count( * ) AS all_count -- real_arrival_date, -- delivery_date, -- official_check_date 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%'" : ""; // echo $sql . "
"; $result = mysqli_query($link, $sql); $data = mysqli_fetch_array($result, MYSQLI_ASSOC); return $data['all_count']; } // 在裝中台數 function getInstalling2($type, $mtype, $radsY, $radsM, $year, $month) { global $link; $sql = " SELECT count(*) AS all_count -- delivery_date, -- official_check_date 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%'" : ""; $result = mysqli_query($link, $sql); $data = mysqli_fetch_array($result, MYSQLI_ASSOC); return $data['all_count']; } ?>

在裝中統計表

(int)$radeY . $radeM) { echo "結束時間不可小於開始時間"; } ?>
(int)$radeY . $radeM) { exit; } ?> $all_count"; // 新梯工收 $all_count = 0; $all_count = getEnding("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; // 新梯試車完 $all_count = 0; $all_count = getInstalling("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; // 新梯在裝中 $all_count = 0; $all_count = getInstalling2("A", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; } ?> $a_count"; // echo ""; // echo ""; ?> $all_count"; // M1工收 $all_count = 0; $all_count = getEnding("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; // M1試車完 $all_count = 0; $all_count = getInstalling("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; // M1在裝中 $all_count = 0; $all_count = getInstalling2("B", "M1", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; } ?> $a_count"; // echo ""; // echo ""; ?> $all_count"; // MA工收 $all_count = 0; $all_count = getEnding("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; // MA試車完 $all_count = 0; $all_count = getInstalling("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; // MA在裝中 $all_count = 0; $all_count = getInstalling2("B", "MA", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; } ?> $a_count"; // echo ""; // echo ""; ?> $all_count"; // 工收 $all_count = 0; $all_count = getEnding("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; // 試車完 $all_count = 0; $all_count = getInstalling("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; // 在裝中 $all_count = 0; $all_count = getInstalling2("", "", $radsY, $radsM, $radsYi, str_pad($start_month, 2, "0", STR_PAD_LEFT)); echo ""; } ?> $a_count"; // echo ""; // echo ""; ?>
出貨年月
種類 出貨 工收 試車完 在裝中
新梯 $all_count$all_count$all_count$b_count$c_count
M1 $all_count$all_count$all_count$b_count$c_count
MA $all_count$all_count$all_count$b_count$c_count
合計 $all_count$all_count$all_count$b_count$c_count