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.
644 lines
27 KiB
644 lines
27 KiB
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>上传CSV文件</title>
|
|
</head>
|
|
|
|
<body>
|
|
<h2>上传CSV文件</h2>
|
|
<form action="" method="post" enctype="multipart/form-data">
|
|
已簽回合約總表:
|
|
<input type="file" name="csv_file" accept=".csv"><br />
|
|
作番編列-新梯:
|
|
<input type="file" name="csv_file2" accept=".csv"><br />
|
|
合約書管理-舊改:
|
|
<input type="file" name="csv_file3" accept=".csv"><br />
|
|
舊改合約:
|
|
<input type="file" name="csv_file4" accept=".csv"><br />
|
|
<input type="submit" value="上传">
|
|
</form>
|
|
</body>
|
|
|
|
</html>
|
|
|
|
<?php
|
|
include "fun_global.php";
|
|
include "database.php";
|
|
|
|
function findSaleMan($sale_name, $link)
|
|
{
|
|
|
|
$sql = "
|
|
SELECT employee_no AS saleman_no FROM `employee` where name = '$sale_name'
|
|
UNION
|
|
SELECT accountid AS saleman_no FROM `account` where name = '$sale_name';
|
|
";
|
|
$res = mysqli_query($link, $sql);
|
|
$row = mysqli_fetch_row($res);
|
|
return empty($row[0]) ? "" : $row[0];
|
|
}
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
|
|
if (isset($_FILES['csv_file']) && $_FILES['csv_file']['error'] === UPLOAD_ERR_OK) {
|
|
|
|
$file = $_FILES['csv_file']['tmp_name'];
|
|
$data = [];
|
|
if (($handle = fopen($file, 'r')) !== false) {
|
|
while (($row = fgetcsv($handle, 1000, ',')) !== false) {
|
|
$data[] = $row;
|
|
}
|
|
fclose($handle);
|
|
}
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
for ($j = 0; $j < count($data[$i]); $j++) {
|
|
$data[$i][$j] = empty($data[$i][$j]) ? "" : mb_convert_kana($data[$i][$j], "a");
|
|
}
|
|
}
|
|
array_shift($data);
|
|
|
|
$elevator_type = array(
|
|
"4PCO",
|
|
"6PCO",
|
|
"CO",
|
|
"2S",
|
|
"3S",
|
|
"2U",
|
|
);
|
|
|
|
$fix_arrs = [];
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$fix_arr = [];
|
|
for ($j = 0; $j < count($data[$i]); $j++) {
|
|
array_push($fix_arr, $data[$i][$j]);
|
|
}
|
|
array_push($fix_arrs, $fix_arr);
|
|
}
|
|
|
|
for ($i = 0; $i < count($fix_arrs); $i++) {
|
|
for ($j = 0; $j < count($fix_arrs[$i]); $j++) {
|
|
echo $j . ":" . $fix_arrs[$i][$j] . " ,";
|
|
}
|
|
echo "<br/>";
|
|
}
|
|
|
|
foreach ($fix_arrs as $row) {
|
|
|
|
$contract_arrival_date = $row[9];
|
|
$prattford_order_date = $row[10];
|
|
$estimated_shipping_date = $row[11];
|
|
$estimated_shipping_schedule_date = $row[12];
|
|
$real_contract_arrival_date = $row[14];
|
|
$facilityno = $row[1];
|
|
|
|
$sql = "
|
|
SELECT COUNT(*) FROM `wipwholestatus`
|
|
WHERE facilityno = '$facilityno'
|
|
";
|
|
$res = mysqli_query($link, $sql);
|
|
$row = mysqli_fetch_row($res);
|
|
$count = $row[0];
|
|
mysqli_free_result($res);
|
|
if ($count > 0) {
|
|
$sql = "
|
|
UPDATE wipwholestatus SET
|
|
";
|
|
$sql2 = "";
|
|
$sql2 .= !empty($prattford_order_date) ? " prattford_order_date= '$prattford_order_date' ," : "";
|
|
$sql2 .= !empty($estimated_shipping_date) ? " estimated_shipping_date= '$estimated_shipping_date' ," : "";
|
|
$sql2 .= !empty($estimated_shipping_schedule_date) ? " estimated_shipping_schedule_date= '$estimated_shipping_schedule_date' ," : "";
|
|
$sql2 .= !empty($contract_arrival_date) ? " contract_arrival_date= '$contract_arrival_date' ," : "";
|
|
$sql2 .= !empty($real_contract_arrival_date) ? " real_contract_arrival_date= '$real_contract_arrival_date' ," : "";
|
|
// $sql2 .= !empty($weight) ? " weight= '$weight' ," : "";
|
|
// $sql2 .= !empty($numberofpassenger) ? " numberofpassenger= '$numberofpassenger' ," : "";
|
|
// $sql2 .= !empty($numberofstop) ? " numberofstop= '$numberofstop' ," : "";
|
|
// $sql2 .= !empty($numberoffloor) ? " numberoffloor= '$numberoffloor' ," : "";
|
|
// $sql2 .= !empty($opentype) ? " opentype= '$opentype' ," : "";
|
|
// $sql2 .= !empty($speed) ? " speed= '$speed' ," : "";
|
|
// $sql2 .= !empty($facility_kind) ? " facility_kind= '$facility_kind' ," : "";
|
|
// $sql2 .= !empty($address) ? " address= '$address' ," : "";
|
|
$sql .= substr($sql2, 0, -1);
|
|
$sql .= "
|
|
WHERE facilityno = '$facilityno';
|
|
";
|
|
}
|
|
mysqli_query($link, $sql);
|
|
}
|
|
} else {
|
|
echo '文件上传错误';
|
|
echo "<br/>";
|
|
}
|
|
|
|
// 作番編列
|
|
|
|
if (isset($_FILES['csv_file2']) && $_FILES['csv_file2']['error'] === UPLOAD_ERR_OK) {
|
|
$file = $_FILES['csv_file2']['tmp_name'];
|
|
$data = [];
|
|
if (($handle = fopen($file, 'r')) !== false) {
|
|
while (($row = fgetcsv($handle, 1000, ',')) !== false) {
|
|
$data[] = $row;
|
|
}
|
|
fclose($handle);
|
|
}
|
|
// $data_tmp = [];
|
|
// for ($i = 0; $i < count($data); $i++) {
|
|
// for ($j = 0; $j < count($data[$i]); $j++) {
|
|
// $data[$i][$j] = empty($data[$i][$j]) ? mb_convert_kana($data_tmp[$j], "a") : mb_convert_kana($data[$i][$j], "a");
|
|
// }
|
|
// $data_tmp = $data[$i];
|
|
// }
|
|
array_shift($data);
|
|
|
|
$elevator_type = array(
|
|
"4PCO",
|
|
"6PCO",
|
|
"2S",
|
|
"3S",
|
|
"2U",
|
|
"CO"
|
|
);
|
|
|
|
$fix_arrs = [];
|
|
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$fix_arr = [];
|
|
for ($j = 0; $j < count($data[$i]); $j++) {
|
|
if ($j == 6) {
|
|
if (!empty($data[$i][$j])) {
|
|
// $data[$i][$j] = str_replace('*', '-', substr($data[$i][$j], 1));
|
|
$elevator_arr = explode("-", $data[$i][$j]);
|
|
array_push($fix_arr, $elevator_arr[1]);
|
|
array_push($fix_arr, $elevator_arr[2]);
|
|
$elevator_arr[4] = str_replace($elevator_type, "", $elevator_arr[3]);
|
|
$elevator_arr[3] = str_replace($elevator_arr[4], "", $elevator_arr[3]);
|
|
array_push($fix_arr, $elevator_arr[3]);
|
|
array_push($fix_arr, $elevator_arr[4]);
|
|
} else {
|
|
array_push($fix_arr, "");
|
|
array_push($fix_arr, "");
|
|
array_push($fix_arr, "");
|
|
array_push($fix_arr, "");
|
|
}
|
|
} else {
|
|
array_push($fix_arr, $data[$i][$j]);
|
|
}
|
|
}
|
|
array_push($fix_arrs, $fix_arr);
|
|
}
|
|
|
|
for ($i = 0; $i < count($fix_arrs); $i++) {
|
|
echo $i . ": ";
|
|
for ($j = 0; $j < count($fix_arrs[$i]); $j++) {
|
|
echo $j . ":" . $fix_arrs[$i][$j] . " ,";
|
|
}
|
|
echo "<br/>";
|
|
}
|
|
|
|
foreach ($fix_arrs as $row) {
|
|
|
|
$contractno = $row[2];
|
|
$custom = $row[3];
|
|
$salesid = findSaleMan($row[4], $link);
|
|
$facilityno = $row[1];
|
|
$facility_kind = $row[5];
|
|
$weight = $row[6] >= 100 ? $row[6] : null;
|
|
$numberofpassenger = $row[6] < 100 ? $row[6] : null;
|
|
$numberofstop = $row[7];
|
|
$opentype = $row[8];
|
|
$speed = $row[9];
|
|
$address = $row[11];
|
|
$contract_arrival_date = $row[12];
|
|
$numberoffloor = null;
|
|
// $address2 = $row[13];
|
|
$contract_type = 'A';
|
|
|
|
$prattford_order_date = $row[13];
|
|
$estimated_shipping_date = $row[14];
|
|
$estimated_shipping_schedule_date = $row[15];
|
|
$real_contract_arrival_date = $row[16];
|
|
|
|
$sales_spec_verify = '1';
|
|
$customer_planning_verify = '1';
|
|
$customer_color_verify = '1';
|
|
$customer_style_verify = '1';
|
|
$desin_spec_verify = '1';
|
|
$desin_planning_verify = '1';
|
|
$desin_color_verify = '1';
|
|
$desin_style_verify = '1';
|
|
$desin_leader_verify = '1';
|
|
$building_heigh_verify = '1';
|
|
$electrical_design_publish = '1';
|
|
$mechanical_design_publish = '1';
|
|
$electrical_shipping_date_publish = '1';
|
|
$mechanical_shipping_date_publish = '1';
|
|
|
|
$site_survey_contact_verify = '1';
|
|
$site_survey_contact_form_verify = '1';
|
|
$shengguanok_status = '1';
|
|
$prattford_order_date_verify = '1';
|
|
$estimated_shipping_date_verify = '1';
|
|
$estimated_shipping_schedule_date_verify = '1';
|
|
$goods_type = '1';
|
|
$taiwan_goods_type = '1';
|
|
$arrival_date_verify = '1';
|
|
|
|
|
|
|
|
$sql = "
|
|
SELECT COUNT(*) FROM `wipwholestatus`
|
|
WHERE facilityno = '$facilityno'
|
|
";
|
|
$res = mysqli_query($link, $sql);
|
|
$row = mysqli_fetch_row($res);
|
|
$count = $row[0];
|
|
mysqli_free_result($res);
|
|
|
|
|
|
if ($count > 0) {
|
|
// update
|
|
// $sql = "
|
|
// UPDATE wipwholestatus SET
|
|
// ";
|
|
// $sql2 = "";
|
|
// $sql2 .= !empty($contractno) ? " contractno= '$contractno' ," : "";
|
|
// $sql2 .= !empty($weight) ? " weight= '$weight' ," : "";
|
|
// $sql2 .= !empty($numberofpassenger) ? " numberofpassenger= '$numberofpassenger' ," : "";
|
|
// $sql2 .= !empty($numberofstop) ? " numberofstop= '$numberofstop' ," : "";
|
|
// $sql2 .= !empty($numberoffloor) ? " numberoffloor= '$numberoffloor' ," : "";
|
|
// $sql2 .= !empty($opentype) ? " opentype= '$opentype' ," : "";
|
|
// $sql2 .= !empty($speed) ? " speed= '$speed' ," : "";
|
|
// $sql2 .= !empty($facility_kind) ? " facility_kind= '$facility_kind' ," : "";
|
|
// $sql2 .= !empty($address) ? " address= '$address' ," : "";
|
|
// $sql2 .= !empty($contract_arrival_date) ? " contract_arrival_date= '$contract_arrival_date' ," : "";
|
|
// $sql2 .= !empty($salesid) ? " salesid= '$salesid' ," : "";
|
|
// $sql2 .= !empty($contract_type) ? " contract_type= '$contract_type' ," : "";
|
|
// $sql .= substr($sql2, 0, -1);
|
|
// $sql .= "
|
|
// WHERE facilityno = '$facilityno';
|
|
// ";
|
|
} else {
|
|
// insert
|
|
$sql = "
|
|
INSERT INTO wipwholestatus (
|
|
sales_spec_verify,
|
|
customer_planning_verify,
|
|
customer_color_verify,
|
|
customer_style_verify,
|
|
desin_spec_verify,
|
|
desin_planning_verify,
|
|
desin_color_verify,
|
|
desin_style_verify,
|
|
desin_leader_verify,
|
|
building_heigh_verify,
|
|
electrical_design_publish,
|
|
mechanical_design_publish,
|
|
electrical_shipping_date_publish,
|
|
mechanical_shipping_date_publish,
|
|
contractno,
|
|
salesid,
|
|
custom,
|
|
facilityno,
|
|
weight,
|
|
numberofpassenger,
|
|
numberofstop,
|
|
opentype,
|
|
speed,
|
|
facility_kind,
|
|
address,
|
|
contract_arrival_date,
|
|
real_contract_arrival_date,
|
|
prattford_order_date,
|
|
estimated_shipping_date,
|
|
estimated_shipping_schedule_date,
|
|
contract_type,
|
|
site_survey_contact_verify,
|
|
site_survey_contact_form_verify,
|
|
shengguanok_status,
|
|
prattford_order_date_verify,
|
|
estimated_shipping_date_verify,
|
|
estimated_shipping_schedule_date_verify,
|
|
goods_type,
|
|
taiwan_goods_type,
|
|
arrival_date_verify
|
|
) VALUES (
|
|
'$sales_spec_verify',
|
|
'$customer_planning_verify',
|
|
'$customer_color_verify',
|
|
'$customer_style_verify',
|
|
'$desin_spec_verify',
|
|
'$desin_planning_verify',
|
|
'$desin_color_verify',
|
|
'$desin_style_verify',
|
|
'$desin_leader_verify',
|
|
'$building_heigh_verify',
|
|
'$electrical_design_publish',
|
|
'$mechanical_design_publish',
|
|
'$electrical_shipping_date_publish',
|
|
'$mechanical_shipping_date_publish',
|
|
'$contractno',
|
|
'$salesid',
|
|
'$custom',
|
|
'$facilityno',
|
|
'$weight',
|
|
'$numberofpassenger',
|
|
'$numberofstop',
|
|
'$opentype',
|
|
'$speed',
|
|
'$facility_kind',
|
|
'$address',
|
|
'$contract_arrival_date',
|
|
'$real_contract_arrival_date',
|
|
'$prattford_order_date',
|
|
'$estimated_shipping_date',
|
|
'$estimated_shipping_schedule_date',
|
|
'$contract_type',
|
|
'$site_survey_contact_verify',
|
|
'$site_survey_contact_form_verify',
|
|
'$shengguanok_status',
|
|
'$prattford_order_date_verify',
|
|
'$estimated_shipping_date_verify',
|
|
'$estimated_shipping_schedule_date_verify',
|
|
'$goods_type',
|
|
'$taiwan_goods_type',
|
|
'$arrival_date_verify'
|
|
)
|
|
";
|
|
}
|
|
mysqli_query($link, $sql);
|
|
// 取得此筆 form_id
|
|
$last_form_id = mysqli_insert_id($link);
|
|
// 寫入營業員待簽程狀態 A
|
|
do_wws_assign($salesid, $last_form_id, 'A');
|
|
// 寫入工務員工簽程狀態 G
|
|
$north_arr = array('台北', '基隆', '宜蘭', '新北', '桃園', '苗栗', '新竹');
|
|
$north_arr2 = array('宜蘭');
|
|
$center_arr = array('南投', '彰化', '雲林', '台中');
|
|
$south_arr = array('台南', '嘉義', '屏東', '高雄');
|
|
|
|
foreach ($north_arr as $key => $value) {
|
|
if (mb_strpos($value, $address2, 0, "UTF-8") !== false) {
|
|
do_wws_assign('M0041', $last_form_id, 'G');
|
|
break;
|
|
}
|
|
}
|
|
|
|
foreach ($north_arr as $key => $value) {
|
|
if (mb_strpos($value, $address2, 0, "UTF-8") !== false) {
|
|
do_wws_assign('M0087', $last_form_id, 'G');
|
|
break;
|
|
}
|
|
}
|
|
|
|
foreach ($center_arr as $key => $value) {
|
|
if (mb_strpos($value, $address2, 0, "UTF-8") !== false) {
|
|
do_wws_assign('M0113', $last_form_id, 'G');
|
|
break;
|
|
}
|
|
}
|
|
|
|
foreach ($south_arr as $key => $value) {
|
|
if (mb_strpos($value, $address2, 0, "UTF-8") !== false) {
|
|
do_wws_assign('M0039', $last_form_id, 'G');
|
|
break;
|
|
}
|
|
}
|
|
|
|
echo $last_form_id . ":" . $address2 . "<br/>";
|
|
}
|
|
}
|
|
|
|
|
|
// 舊改
|
|
|
|
if (isset($_FILES['csv_file3']) && $_FILES['csv_file3']['error'] === UPLOAD_ERR_OK) {
|
|
$file = $_FILES['csv_file3']['tmp_name'];
|
|
$data = [];
|
|
if (($handle = fopen($file, 'r')) !== false) {
|
|
while (($row = fgetcsv($handle, 1000, ',')) !== false) {
|
|
$data[] = $row;
|
|
}
|
|
fclose($handle);
|
|
}
|
|
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
for ($j = 0; $j < count($data[$i]); $j++) {
|
|
$data[$i][$j] = mb_convert_kana($data[$i][$j], "a");
|
|
}
|
|
}
|
|
array_shift($data);
|
|
|
|
$elevator_type = array(
|
|
"4PCO",
|
|
"6PCO",
|
|
"2S",
|
|
"3S",
|
|
"2U",
|
|
"CO"
|
|
);
|
|
|
|
$fix_arrs = [];
|
|
|
|
for ($i = 0; $i < count($data); $i++) {
|
|
$fix_arr = [];
|
|
for ($j = 0; $j < count($data[$i]); $j++) {
|
|
if ($j == 4) {
|
|
if (!empty($data[$i][$j])) {
|
|
// array_push($fix_arr, $data[$i][$j]);
|
|
// $data[$i][$j] = str_replace('*', '-', substr($data[$i][$j], 1));
|
|
$elevator_arr = explode("-", $data[$i][$j]);
|
|
array_push($fix_arr, $elevator_arr[0]);
|
|
array_push($fix_arr, $elevator_arr[1]);
|
|
array_push($fix_arr, $elevator_arr[2]);
|
|
$elevator_arr[4] = str_replace($elevator_type, "", $elevator_arr[3]);
|
|
$elevator_arr[3] = str_replace($elevator_arr[4], "", $elevator_arr[3]);
|
|
array_push($fix_arr, $elevator_arr[3]);
|
|
array_push($fix_arr, $elevator_arr[4]);
|
|
} else {
|
|
array_push($fix_arr, "");
|
|
array_push($fix_arr, "");
|
|
array_push($fix_arr, "");
|
|
array_push($fix_arr, "");
|
|
array_push($fix_arr, "");
|
|
}
|
|
} else {
|
|
array_push($fix_arr, $data[$i][$j]);
|
|
}
|
|
}
|
|
array_push($fix_arrs, $fix_arr);
|
|
}
|
|
|
|
for ($i = 0; $i < count($fix_arrs); $i++) {
|
|
for ($j = 0; $j < count($fix_arrs[$i]); $j++) {
|
|
echo $j . ":" . $fix_arrs[$i][$j] . " ,";
|
|
}
|
|
echo "<br/>";
|
|
}
|
|
|
|
foreach ($fix_arrs as $row) {
|
|
|
|
$custom = $row[2];
|
|
$salesid = findSaleMan($row[3], $link);
|
|
$facilityno = $row[1];
|
|
$facility_kind = $row[4];
|
|
$weight = $row[5] >= 100 ? $row[5] : null;
|
|
$numberofpassenger = $row[5] < 100 ? $row[5] : null;
|
|
$numberofstop = $row[6];
|
|
$opentype = $row[7];
|
|
$speed = $row[8];
|
|
$address = $row[10];
|
|
$contract_arrival_date = $row[11];
|
|
$prattford_order_date = $row[12];
|
|
$estimated_shipping_date = $row[13];
|
|
$estimated_shipping_schedule_date = $row[14];
|
|
$real_contract_arrival_date = $row[15];
|
|
$renovate_type = $row[16];
|
|
$contractno = $row[17];
|
|
$contract_type = 'B';
|
|
|
|
$sales_spec_verify = '1';
|
|
$customer_planning_verify = '1';
|
|
$customer_color_verify = '1';
|
|
$customer_style_verify = '1';
|
|
$desin_spec_verify = '1';
|
|
$desin_planning_verify = '1';
|
|
$desin_color_verify = '1';
|
|
$desin_style_verify = '1';
|
|
$desin_leader_verify = '1';
|
|
$building_heigh_verify = '1';
|
|
$electrical_design_publish = '1';
|
|
$mechanical_design_publish = '1';
|
|
$electrical_shipping_date_publish = '1';
|
|
$mechanical_shipping_date_publish = '1';
|
|
|
|
$sql = "
|
|
SELECT COUNT(*) FROM `wipwholestatus`
|
|
WHERE facilityno = '$facilityno'
|
|
";
|
|
$res = mysqli_query($link, $sql);
|
|
$row = mysqli_fetch_row($res);
|
|
$count = $row[0];
|
|
mysqli_free_result($res);
|
|
if ($count > 0) {
|
|
|
|
// update
|
|
$sql = "
|
|
UPDATE wipwholestatus SET
|
|
";
|
|
$sql2 = "";
|
|
$sql2 .= !empty($contractno) ? " contractno= '$contractno' ," : "";
|
|
$sql2 .= !empty($custom) ? " custom= '$custom' ," : "";
|
|
$sql2 .= !empty($weight) ? " weight= '$weight' ," : "";
|
|
$sql2 .= !empty($numberofpassenger) ? " numberofpassenger= '$numberofpassenger' ," : "";
|
|
$sql2 .= !empty($numberofstop) ? " numberofstop= '$numberofstop' ," : "";
|
|
$sql2 .= !empty($numberoffloor) ? " numberoffloor= '$numberoffloor' ," : "";
|
|
$sql2 .= !empty($opentype) ? " opentype= '$opentype' ," : "";
|
|
$sql2 .= !empty($speed) ? " speed= '$speed' ," : "";
|
|
$sql2 .= !empty($facility_kind) ? " facility_kind= '$facility_kind' ," : "";
|
|
$sql2 .= !empty($address) ? " address= '$address' ," : "";
|
|
$sql2 .= !empty($contract_arrival_date) ? " contract_arrival_date= '$contract_arrival_date' ," : "";
|
|
$sql2 .= !empty($salesid) ? " salesid= '$salesid' ," : "";
|
|
$sql2 .= !empty($contract_type) ? " contract_type= '$contract_type' ," : "";
|
|
$sql2 .= !empty($renovate_type) ? " renovate_type= '$renovate_type' ," : "";
|
|
$sql2 .= !empty($prattford_order_date) ? " prattford_order_date= '$prattford_order_date' ," : "";
|
|
$sql2 .= !empty($estimated_shipping_date) ? " estimated_shipping_date= '$estimated_shipping_date' ," : "";
|
|
$sql2 .= !empty($estimated_shipping_schedule_date) ? " estimated_shipping_schedule_date= '$estimated_shipping_schedule_date' ," : "";
|
|
$sql2 .= !empty($real_contract_arrival_date) ? " real_contract_arrival_date= '$real_contract_arrival_date' ," : "";
|
|
$sql .= substr($sql2, 0, -1);
|
|
$sql .= "
|
|
WHERE facilityno = '$facilityno';
|
|
";
|
|
} else {
|
|
// insert
|
|
$sql = "
|
|
INSERT INTO wipwholestatus (
|
|
contractno,
|
|
prattford_order_date,
|
|
estimated_shipping_date,
|
|
estimated_shipping_schedule_date,
|
|
real_contract_arrival_date,
|
|
sales_spec_verify,
|
|
customer_planning_verify,
|
|
customer_color_verify,
|
|
customer_style_verify,
|
|
desin_spec_verify,
|
|
desin_planning_verify,
|
|
desin_color_verify,
|
|
desin_style_verify,
|
|
desin_leader_verify,
|
|
building_heigh_verify,
|
|
electrical_design_publish,
|
|
mechanical_design_publish,
|
|
electrical_shipping_date_publish,
|
|
mechanical_shipping_date_publish,
|
|
salesid,
|
|
custom,
|
|
facilityno,
|
|
weight,
|
|
numberofpassenger,
|
|
numberofstop,
|
|
opentype,
|
|
speed,
|
|
facility_kind,
|
|
address,
|
|
contract_arrival_date,
|
|
contract_type,
|
|
renovate_type
|
|
) VALUES (
|
|
'$contractno',
|
|
'$prattford_order_date',
|
|
'$estimated_shipping_date',
|
|
'$estimated_shipping_schedule_date',
|
|
'$real_contract_arrival_date',
|
|
'$sales_spec_verify',
|
|
'$customer_planning_verify',
|
|
'$customer_color_verify',
|
|
'$customer_style_verify',
|
|
'$desin_spec_verify',
|
|
'$desin_planning_verify',
|
|
'$desin_color_verify',
|
|
'$desin_style_verify',
|
|
'$desin_leader_verify',
|
|
'$building_heigh_verify',
|
|
'$electrical_design_publish',
|
|
'$mechanical_design_publish',
|
|
'$electrical_shipping_date_publish',
|
|
'$mechanical_shipping_date_publish',
|
|
'$salesid',
|
|
'$custom',
|
|
'$facilityno',
|
|
'$weight',
|
|
'$numberofpassenger',
|
|
'$numberofstop',
|
|
'$opentype',
|
|
'$speed',
|
|
'$facility_kind',
|
|
'$address',
|
|
'$contract_arrival_date',
|
|
'$contract_type',
|
|
'$renovate_type'
|
|
)
|
|
";
|
|
}
|
|
// echo $sql."<br/>";exit;
|
|
mysqli_query($link, $sql);
|
|
// 取得此筆 form_id
|
|
$last_form_id = mysqli_insert_id($link);
|
|
// 寫入待簽程狀態 G (工務)
|
|
$yelang = array('宜蘭');
|
|
$north_arr = array('台北', '基隆', '新北', '桃園', '苗栗', '新竹');
|
|
$center_arr = array('南投', '台中', '彰化', '雲林');
|
|
$south_arr = array('台南', '嘉義', '屏東', '高雄');
|
|
|
|
if (in_array($address, $yelang)) {
|
|
do_wws2_assign('M0087', $last_form_id, 'A');
|
|
} else if (in_array($address, $north_arr)) {
|
|
do_wws2_assign('M0040', $last_form_id, 'A');
|
|
} else if (in_array($address, $center_arr)) {
|
|
do_wws2_assign('M0113', $last_form_id, 'A');
|
|
} else if (in_array($address, $south_arr)) {
|
|
do_wws2_assign('M0039', $last_form_id, 'A');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|