|
@ -91,6 +91,7 @@ foreach ($contract as $cont) { |
|
|
$ContactAddress = $cont['ContactAddress']; |
|
|
$ContactAddress = $cont['ContactAddress']; |
|
|
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期 |
|
|
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期 |
|
|
//['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期 |
|
|
//['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期 |
|
|
|
|
|
//['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
|
|
if (!(isset($arrayData[$BillNo]))) { |
|
|
if (!(isset($arrayData[$BillNo]))) { |
|
|
// 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 |
|
|
// 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 |
|
|
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0]; |
|
|
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0]; |
|
@ -106,9 +107,9 @@ foreach ($contract as $cont) { |
|
|
$arrayData[$BillNo]['sign']['min'] = $arrayData[$BillNo]['second']['min'] = $arrayData[$BillNo]['arrive']['min'] = $arrayData[$BillNo]['install']['min'] = $arrayData[$BillNo]['tryrun']['min'] = $arrayData[$BillNo]['check']['min'] = $arrayData[$BillNo]['delivery']['min'] = $arrayData[$BillNo]['final']['min'] = array(); |
|
|
$arrayData[$BillNo]['sign']['min'] = $arrayData[$BillNo]['second']['min'] = $arrayData[$BillNo]['arrive']['min'] = $arrayData[$BillNo]['install']['min'] = $arrayData[$BillNo]['tryrun']['min'] = $arrayData[$BillNo]['check']['min'] = $arrayData[$BillNo]['delivery']['min'] = $arrayData[$BillNo]['final']['min'] = array(); |
|
|
$arrayData[$BillNo]['sign']['max'] = $arrayData[$BillNo]['second']['max'] = $arrayData[$BillNo]['arrive']['max'] = $arrayData[$BillNo]['install']['max'] = $arrayData[$BillNo]['tryrun']['max'] = $arrayData[$BillNo]['check']['max'] = $arrayData[$BillNo]['delivery']['max'] = $arrayData[$BillNo]['final']['max'] = array(); |
|
|
$arrayData[$BillNo]['sign']['max'] = $arrayData[$BillNo]['second']['max'] = $arrayData[$BillNo]['arrive']['max'] = $arrayData[$BillNo]['install']['max'] = $arrayData[$BillNo]['tryrun']['max'] = $arrayData[$BillNo]['check']['max'] = $arrayData[$BillNo]['delivery']['max'] = $arrayData[$BillNo]['final']['max'] = array(); |
|
|
$arrayData[$BillNo]['facilities'] = ""; |
|
|
$arrayData[$BillNo]['facilities'] = ""; |
|
|
$arrayData[$BillNo]['total_facility_num'] = $arrayData[$BillNo]['delivery_num'] = $arrayData[$BillNo]['check_num'] = $arrayData[$BillNo]['tryrun_num'] = $arrayData[$BillNo]['install_num'] = $arrayData[$BillNo]['arrive_num'] = $arrayData[$BillNo]['second_num'] = $arrayData[$BillNo]['receivable_budget'] = 0; |
|
|
$arrayData[$BillNo]['total_facility_num'] = $arrayData[$BillNo]['delivery_num'] = $arrayData[$BillNo]['check_num'] = $arrayData[$BillNo]['tryrun_num'] = $arrayData[$BillNo]['install_num'] = $arrayData[$BillNo]['arrive_num'] = $arrayData[$BillNo]['second_num'] = $arrayData[$BillNo]['sign_num'] = $arrayData[$BillNo]['receivable_budget'] = 0; |
|
|
} |
|
|
} |
|
|
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60') || stristr($PayStage, '寶佳出貨後10天')) { |
|
|
if (stristr($PayStage, '二次款') || (stristr($PayStage, '出貨前') && $PayStage != "寶佳出貨前30天") || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60') || stristr($PayStage, '寶佳出貨後10天')) { |
|
|
$arrayData[$BillNo]['second'][0] = $PayStage; |
|
|
$arrayData[$BillNo]['second'][0] = $PayStage; |
|
|
$arrayData[$BillNo]['second'][1] = $PayAmount; |
|
|
$arrayData[$BillNo]['second'][1] = $PayAmount; |
|
|
$arrayData[$BillNo]['second'][2] = $PlanPayDate; |
|
|
$arrayData[$BillNo]['second'][2] = $PlanPayDate; |
|
@ -133,14 +134,14 @@ foreach ($contract as $cont) { |
|
|
$arrayData[$BillNo]['second'][2] = strval($secondtime); |
|
|
$arrayData[$BillNo]['second'][2] = strval($secondtime); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金') || stristr($PayStage, '工地動工') || stristr($PayStage, '寶佳出貨前30天')) { |
|
|
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金') || stristr($PayStage, '工地動工') || $PayStage == '寶佳出貨前30天') { |
|
|
$arrayData[$BillNo]['sign'][0] = $PayStage; |
|
|
$arrayData[$BillNo]['sign'][0] = $PayStage; |
|
|
$arrayData[$BillNo]['sign'][1] = $PayAmount; |
|
|
$arrayData[$BillNo]['sign'][1] = $PayAmount; |
|
|
$arrayData[$BillNo]['sign'][2] = $PlanPayDate; |
|
|
$arrayData[$BillNo]['sign'][2] = $PlanPayDate; |
|
|
$arrayData[$BillNo]['total_budget'] += $PayAmount; |
|
|
$arrayData[$BillNo]['total_budget'] += $PayAmount; |
|
|
$arrayData[$BillNo]['receivable_budget'] += $PayAmount; |
|
|
$arrayData[$BillNo]['receivable_budget'] += $PayAmount; |
|
|
if (isset($PlanPayDate) && !empty($PlanPayDate)) { |
|
|
if (isset($PlanPayDate) && !empty($PlanPayDate) && $PayStage != "寶佳出貨前30天") { |
|
|
array_push($arrayData[$BillNo]['sign']['min'], strval($PlanPayDate)); |
|
|
array_push($arrayData[$BillNo]['sign']['min'], strtotime(strval($PlanPayDate))); |
|
|
array_push($arrayData[$BillNo]['sign']['max'], strtotime(strval($PlanPayDate))); |
|
|
array_push($arrayData[$BillNo]['sign']['max'], strtotime(strval($PlanPayDate))); |
|
|
} |
|
|
} |
|
|
} elseif (stristr($PayStage, '試車')) { |
|
|
} elseif (stristr($PayStage, '試車')) { |
|
@ -197,7 +198,6 @@ SELECT |
|
|
w.estimated_shipping_date, |
|
|
w.estimated_shipping_date, |
|
|
w.real_contract_arrival_date, |
|
|
w.real_contract_arrival_date, |
|
|
w.actual_tofactory_date, |
|
|
w.actual_tofactory_date, |
|
|
w.real_contract_arrival_date, |
|
|
|
|
|
w.real_arrival_date, |
|
|
w.real_arrival_date, |
|
|
w.install_end_date, |
|
|
w.install_end_date, |
|
|
w.tryrun_end_date, |
|
|
w.tryrun_end_date, |
|
@ -220,6 +220,8 @@ FROM department |
|
|
ON d.department_id = tmp2.department_id ORDER BY contractno"; |
|
|
ON d.department_id = tmp2.department_id ORDER BY contractno"; |
|
|
$wipwhole_array = mysqli_query($link, $sql); |
|
|
$wipwhole_array = mysqli_query($link, $sql); |
|
|
foreach ($wipwhole_array as $wip) { |
|
|
foreach ($wipwhole_array as $wip) { |
|
|
|
|
|
$today = strtotime(date('Ymd')); |
|
|
|
|
|
//[合約號]['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
|
|
if (isset($arrayData[$wip['contractno']])) { |
|
|
if (isset($arrayData[$wip['contractno']])) { |
|
|
// 整理合約資料 |
|
|
// 整理合約資料 |
|
|
$arrayData[$wip['contractno']][0] = $wip['department_id'];; |
|
|
$arrayData[$wip['contractno']][0] = $wip['department_id'];; |
|
@ -228,14 +230,16 @@ foreach ($wipwhole_array as $wip) { |
|
|
$arrayData[$wip['contractno']][3] = $wip['salesid']; |
|
|
$arrayData[$wip['contractno']][3] = $wip['salesid']; |
|
|
$arrayData[$wip['contractno']][4] = $wip['name']; |
|
|
$arrayData[$wip['contractno']][4] = $wip['name']; |
|
|
$arrayData[$wip['contractno']][10] = $wip['contractno']; |
|
|
$arrayData[$wip['contractno']][10] = $wip['contractno']; |
|
|
// [合約號][作番號]['no'] |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
$arrayData[$wip['contractno']][$wip['facilityno']]['no'] = $wip['facilityno']; |
|
|
// [合約號]['facility'][作番號]['no'] |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['no'] = $wip['facilityno']; |
|
|
|
|
|
|
|
|
// [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] |
|
|
// [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] |
|
|
// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] |
|
|
// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] |
|
|
// [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期] |
|
|
// [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期] |
|
|
$contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); |
|
|
$contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); |
|
|
foreach ($contractstage as $i) { |
|
|
foreach ($contractstage as $i) { |
|
|
|
|
|
$arrayData[$wip['contractno']][$wip['facilityno']][$i] = ['', 0, '', 0, 0, 0, 0]; |
|
|
$arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['date'] = ""; |
|
|
$arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['date'] = ""; |
|
|
$arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['budget'] = 0; |
|
|
$arrayData[$wip['contractno']][$wip['facilityno']][$i]['inv']['budget'] = 0; |
|
|
$arrayData[$wip['contractno']][$wip['facilityno']][$i]['rec']['date'] = ""; |
|
|
$arrayData[$wip['contractno']][$wip['facilityno']][$i]['rec']['date'] = ""; |
|
@ -284,6 +288,16 @@ foreach ($wipwhole_array as $wip) { |
|
|
array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); |
|
|
array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); |
|
|
array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); |
|
|
array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); |
|
|
} |
|
|
} |
|
|
|
|
|
} elseif (isset($arrayData[$wip['contractno']]['second'][0]) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前120天')) { |
|
|
|
|
|
if (empty($wip['real_contract_arrival_date'])) { |
|
|
|
|
|
} else { |
|
|
|
|
|
$estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); |
|
|
|
|
|
$secondtime = $estimate_delivery_time - (120 * 86400); |
|
|
|
|
|
$secondtime = date('Ymd', $secondtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['second'][2] = strval($secondtime); |
|
|
|
|
|
array_push($arrayData[$wip['contractno']]['second']['max'], strtotime(strval($secondtime))); |
|
|
|
|
|
array_push($arrayData[$wip['contractno']]['second']['min'], strtotime(strval($secondtime))); |
|
|
|
|
|
} |
|
|
} elseif (isset($arrayData[$wip['contractno']]['second'][0]) && $arrayData[$wip['contractno']]['second'][0] == '寶佳出貨後10天') { |
|
|
} elseif (isset($arrayData[$wip['contractno']]['second'][0]) && $arrayData[$wip['contractno']]['second'][0] == '寶佳出貨後10天') { |
|
|
|
|
|
|
|
|
if ($wip['real_arrival_date'] != NULL) { |
|
|
if ($wip['real_arrival_date'] != NULL) { |
|
@ -305,112 +319,225 @@ foreach ($wipwhole_array as $wip) { |
|
|
//根據作番狀態填入facilities,計算各階段數量、一個合約有幾個作番,增加作番資料 |
|
|
//根據作番狀態填入facilities,計算各階段數量、一個合約有幾個作番,增加作番資料 |
|
|
// real_contract_arrival_date 預計出貨日=預計到貨日=預計貨抵工地 |
|
|
// real_contract_arrival_date 預計出貨日=預計到貨日=預計貨抵工地 |
|
|
// real_arrival_date 實際出貨日=實際到貨日=實際貨抵工地 |
|
|
// real_arrival_date 實際出貨日=實際到貨日=實際貨抵工地 |
|
|
|
|
|
//----------------------------------------寶佳的另外處理--------------------------------------------------- |
|
|
|
|
|
//[合約號]['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
|
|
|
|
|
if ($arrayData[$wip['contractno']]['sign'][0] == "寶佳出貨前30天") { |
|
|
|
|
|
$facility_status = ""; |
|
|
|
|
|
// if ($arrayData[$wip['contractno']]['sign'][2]) |
|
|
|
|
|
$today = strtotime(date('Ymd')); |
|
|
|
|
|
$contractday = strtotime($arrayData[$wip['contractno']]['sign'][2]); |
|
|
|
|
|
$month = collect_month($contractday); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][2] = $arrayData[$wip['contractno']]['sign'][2]; |
|
|
|
|
|
if ($today > $contractday) { |
|
|
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
|
|
$facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "已過) <br>"; |
|
|
|
|
|
//二次款 |
|
|
|
|
|
$contractday = strtotime($arrayData[$wip['contractno']]['second'][2]); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][2] = $arrayData[$wip['contractno']]['second'][2]; |
|
|
|
|
|
$month = collect_month($contractday); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][6] = $month; |
|
|
|
|
|
if ($today > $contractday) { |
|
|
|
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
|
|
$facility_status = $wip['facilityno'] . " (出貨後10天" . $arrayData[$wip['contractno']]['second'][2] . "已過) <br>"; |
|
|
|
|
|
//貨抵工地款 |
|
|
|
|
|
if ($wip['real_arrival_date'] != NULL) { |
|
|
|
|
|
$estimate_time = strtotime($wip['real_arrival_date']); |
|
|
|
|
|
$contractday = $estimate_time + (90 * 86400); |
|
|
|
|
|
$month = collect_month($contractday); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $contractday)); |
|
|
|
|
|
if ($today > $contractday) { |
|
|
|
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval(date('Y-m-d', $contractday)); |
|
|
|
|
|
$facility_status = $wip['facilityno'] . " (貨抵工地後90天" . $arrayData[$wip['contractno']]['arrive'][2] . "已過) <br>"; |
|
|
|
|
|
//試車款 |
|
|
|
|
|
if ($wip['tryrun_end_date'] != NULL) { |
|
|
|
|
|
$estimate_time = strtotime($wip['tryrun_end_date']); |
|
|
|
|
|
$contractday = $estimate_time + (90 * 86400); |
|
|
|
|
|
$month = collect_month($contractday); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $contractday)); |
|
|
|
|
|
if ($today > $contractday) { |
|
|
|
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval(date('Y-m-d', $contractday)); |
|
|
|
|
|
$facility_status = $wip['facilityno'] . " (試車後90天" . $arrayData[$wip['contractno']]['tryrun'][2] . "已過) <br>"; |
|
|
|
|
|
//交車款 |
|
|
if ($wip['delivery_date'] != NULL) { |
|
|
if ($wip['delivery_date'] != NULL) { |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; |
|
|
$estimate_time = strtotime($wip['delivery_date']); |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
$contractday = $estimate_time + (270 * 86400); |
|
|
|
|
|
$month = collect_month($contractday); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][2] = strval(date('Ymd', $contractday)); |
|
|
|
|
|
if ($today > $contractday) { |
|
|
$arrayData[$wip['contractno']]['delivery_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['delivery_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['check_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['delivery'][2] = strval(date('Y-m-d', $contractday)); |
|
|
|
|
|
$facility_status = $wip['facilityno'] . " (交車後270天" . $arrayData[$wip['contractno']]['delivery'][2] . "已過) <br>"; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
$facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "未到) <br>"; |
|
|
|
|
|
} |
|
|
|
|
|
$arrayData[$wip['contractno']]['facilities'] .= $facility_status; |
|
|
|
|
|
} else { |
|
|
|
|
|
$signtime = strtotime($arrayData[$wip['contractno']]['sign'][2]); |
|
|
|
|
|
$month = collect_month($signtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][2] = strval(date('Ymd', $signtime)); |
|
|
|
|
|
if (isset($arrayData[$wip['contractno']]['second'][2]) && ($arrayData[$wip['contractno']]['second'][2] !== NULL)) { |
|
|
|
|
|
$secondtime = strtotime($arrayData[$wip['contractno']]['second'][2]); |
|
|
|
|
|
$month = collect_month($secondtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][2] = strval(date('Ymd', $secondtime)); |
|
|
|
|
|
} |
|
|
|
|
|
if ($wip['delivery_date'] != NULL) { |
|
|
|
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; |
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
|
|
|
|
|
if ($arrayData[$wip['contractno']]['delivery'][0] == "交車後270天") { |
|
|
if ($arrayData[$wip['contractno']]['delivery'][0] == "交車後270天") { |
|
|
$estimate_delivery_time = strtotime($wip['delivery_date']); |
|
|
$estimate_delivery_time = strtotime($wip['delivery_date']); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$month = collect_month($arrivetime); |
|
|
|
|
|
if ($today > $arrivetime) { |
|
|
|
|
|
$arrayData[$wip['contractno']]['delivery_num'] += 1; |
|
|
|
|
|
} |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][2] = strval(date('Ymd', $arrivetime)); |
|
|
|
|
|
$arrivetime = date('Ymd', $arrivetime); |
|
|
$arrayData[$wip['contractno']]['delivery'][2] = strval($secondtime); |
|
|
$arrayData[$wip['contractno']]['delivery'][2] = strval($secondtime); |
|
|
array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($arrivetime))); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
$arrayData[$wip['contractno']]['delivery_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['check_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['delivery'][2] = strval($wip['delivery_date']); |
|
|
$arrayData[$wip['contractno']]['delivery'][2] = strval($wip['delivery_date']); |
|
|
|
|
|
$deliverytime = strtotime($wip['delivery_date']); |
|
|
|
|
|
$month = collect_month($deliverytime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][2] = strval(date('Ymd', $deliverytime)); |
|
|
array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($wip['delivery_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['delivery']['min'], strtotime(strval($wip['delivery_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($wip['delivery_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['delivery']['max'], strtotime(strval($wip['delivery_date']))); |
|
|
} |
|
|
} |
|
|
if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { |
|
|
if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { |
|
|
array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); |
|
|
|
|
|
$checktime = strtotime($wip['official_check_date']); |
|
|
|
|
|
$month = collect_month($checktime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['check'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['check'][2] = strval(date('Ymd', $checktime)); |
|
|
} |
|
|
} |
|
|
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { |
|
|
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { |
|
|
if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { |
|
|
if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { |
|
|
$estimate_delivery_time = strtotime($wip['tryrun_end_date']); |
|
|
$estimate_delivery_time = strtotime($wip['tryrun_end_date']); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$tryruntime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$tryruntime = date('Ymd', $secondtime); |
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); |
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($tryruntime))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($tryruntime))); |
|
|
|
|
|
$month = collect_month($tryruntime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $tryruntime)); |
|
|
} else { |
|
|
} else { |
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); |
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
|
|
|
$tryruntime = strtotime($wip['tryrun_end_date']); |
|
|
|
|
|
$month = collect_month($tryruntime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $tryruntime)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { |
|
|
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { |
|
|
array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); |
|
|
|
|
|
$installtime = strtotime($wip['install_end_date']); |
|
|
|
|
|
$month = collect_month($installtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][2] = strval(date('Ymd', $installtime)); |
|
|
} |
|
|
} |
|
|
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { |
|
|
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
|
|
|
$month = collect_month($arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
$arrivetime = strtotime($wip['real_arrival_date']); |
|
|
|
|
|
$month = collect_month($arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
|
|
|
$estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); |
|
|
|
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
|
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); |
|
|
|
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
|
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
|
|
|
} else { |
|
|
|
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_contract_arrival_date']); |
|
|
|
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_contract_arrival_date']))); |
|
|
|
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_contract_arrival_date']))); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} elseif ($wip['official_check_date'] != NULL) { |
|
|
} elseif ($wip['official_check_date'] != NULL) { |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>"; |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>"; |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['check_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['check_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { |
|
|
if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { |
|
|
array_push($arrayData[$wip['contractno']]['check']['min'], strval($wip['official_check_date'])); |
|
|
array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); |
|
|
|
|
|
$checktime = strtotime($wip['official_check_date']); |
|
|
|
|
|
$month = collect_month($checktime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['check'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['check'][2] = strval(date('Ymd', $checktime)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { |
|
|
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { |
|
|
if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { |
|
|
if ($arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") { |
|
|
$estimate_delivery_time = strtotime($wip['tryrun_end_date']); |
|
|
$estimate_delivery_time = strtotime($wip['tryrun_end_date']); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$tryruntime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$month = collect_month($tryruntime); |
|
|
|
|
|
$tryruntime = date('Ymd', $tryruntime); |
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); |
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval($secondtime); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($tryruntime))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($tryruntime))); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval($tryruntime); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
$tryruntime = strtotime($wip['tryrun_end_date']); |
|
|
|
|
|
$month = collect_month($tryruntime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $tryruntime)); |
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); |
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval($wip['tryrun_end_date']); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { |
|
|
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { |
|
|
array_push($arrayData[$wip['contractno']]['install']['min'], strval($wip['install_end_date'])); |
|
|
$installtime = strtotime($wip['install_end_date']); |
|
|
|
|
|
$month = collect_month($installtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][2] = strval(date('Ymd', $installtime)); |
|
|
|
|
|
array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); |
|
|
} |
|
|
} |
|
|
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { |
|
|
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
|
|
|
$month = collect_month($arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
@ -419,6 +546,10 @@ foreach ($wipwhole_array as $wip) { |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
|
|
|
|
$arrivetime = strtotime($wip['real_arrival_date']); |
|
|
|
|
|
$month = collect_month($arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
@ -436,28 +567,43 @@ foreach ($wipwhole_array as $wip) { |
|
|
} |
|
|
} |
|
|
} elseif ($wip['tryrun_end_date'] != NULL) { |
|
|
} elseif ($wip['tryrun_end_date'] != NULL) { |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>"; |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>"; |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { |
|
|
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strval($wip['tryrun_end_date'])); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); |
|
|
|
|
|
$tryruntime = strtotime($wip['tryrun_end_date']); |
|
|
|
|
|
$month = collect_month($tryruntime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['tryrun'][2] = strval(date('Ymd', $tryruntime)); |
|
|
} |
|
|
} |
|
|
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { |
|
|
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { |
|
|
array_push($arrayData[$wip['contractno']]['install']['min'], strval($wip['install_end_date'])); |
|
|
array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strval($wip['install_end_date']))); |
|
|
|
|
|
$installtime = strtotime($wip['install_end_date']); |
|
|
|
|
|
$month = collect_month($installtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][2] = strval(date('Ymd', $installtime)); |
|
|
} |
|
|
} |
|
|
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { |
|
|
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$month = collect_month($arrivetime); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); |
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
|
|
|
$arrivetime = date('Ymd', $arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($arrivetime); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
$arrivetime = strtotime($wip['real_arrival_date']); |
|
|
|
|
|
$month = collect_month($arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
@ -466,8 +612,8 @@ foreach ($wipwhole_array as $wip) { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
$estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); |
|
|
$estimate_delivery_time = strtotime($wip['real_contract_arrival_date']); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$arrivetime = date('Ymd', $arrivetime); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($arrivetime); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
} else { |
|
|
} else { |
|
@ -478,23 +624,34 @@ foreach ($wipwhole_array as $wip) { |
|
|
} |
|
|
} |
|
|
} elseif ($wip['install_end_date'] != NULL) { |
|
|
} elseif ($wip['install_end_date'] != NULL) { |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>"; |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>"; |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { |
|
|
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { |
|
|
array_push($arrayData[$wip['contractno']]['install']['min'], strval($wip['install_end_date'])); |
|
|
$installtime = strtotime($wip['install_end_date']); |
|
|
|
|
|
$month = collect_month($installtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['install'][2] = strval(date('Ymd', $installtime)); |
|
|
|
|
|
array_push($arrayData[$wip['contractno']]['install']['min'], strtotime(strval($wip['install_end_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strtotime(strval($wip['install_end_date'])))); |
|
|
array_push($arrayData[$wip['contractno']]['install']['max'], strtotime(strtotime(strval($wip['install_end_date'])))); |
|
|
} |
|
|
} |
|
|
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { |
|
|
if (!empty($wip['real_arrival_date']) && $wip['real_arrival_date'] != NULL) { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$month = collect_month($arrivetime); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); |
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
|
|
|
$arrivetime = date('Ymd', $arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($arrivetime); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
$arrivetime = strtotime($wip['real_arrival_date']); |
|
|
|
|
|
$month = collect_month($arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
@ -515,50 +672,60 @@ foreach ($wipwhole_array as $wip) { |
|
|
} |
|
|
} |
|
|
} elseif ($wip['real_arrival_date'] != NULL) { |
|
|
} elseif ($wip['real_arrival_date'] != NULL) { |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>"; |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>"; |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
|
|
|
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = $estimate_delivery_time + (90 * 86400); |
|
|
$arrivetime = date('Ymd', $secondtime); |
|
|
$month = collect_month($arrivetime); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($secondtime); |
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
|
|
|
$arrivetime = date('Ymd', $arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($arrivetime); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($arrivetime))); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
$arrivetime = strtotime($wip['real_arrival_date']); |
|
|
|
|
|
$month = collect_month($arrivetime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['arrive'][2] = strval(date('Ymd', $arrivetime)); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval($wip['real_arrival_date']); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['min'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
|
array_push($arrayData[$wip['contractno']]['arrive']['max'], strtotime(strval($wip['real_arrival_date']))); |
|
|
} |
|
|
} |
|
|
} elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) { |
|
|
} elseif (($arrayData[$wip['contractno']]['second'] != NULL) && (isset($arrayData[$wip['contractno']]['second'][2])) && ($arrayData[$wip['contractno']]['second'][2] <= date('Ymd'))) { |
|
|
|
|
|
$secondtime = strtotime($arrayData[$wip['contractno']]['second'][2]); |
|
|
|
|
|
$month = collect_month($secondtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][6] = $month; |
|
|
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['second'][2] = strval(date('Ymd', $secondtime)); |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (已達二次款收款條件) <br>"; |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (已達二次款收款條件) <br>"; |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
if ($wip['real_contract_arrival_date'] != NULL) { |
|
|
if ($wip['real_contract_arrival_date'] != NULL) { |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日) <br>"; |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日) <br>"; |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
|
|
|
} elseif ($wip['estimated_shipping_date'] != NULL) { |
|
|
} elseif ($wip['estimated_shipping_date'] != NULL) { |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出港日) <br>"; |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計出港日) <br>"; |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計出港日待確認) <br>"; |
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (預計出港日待確認) <br>"; |
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 計算每個合約的應收款、作番總數 |
|
|
// 計算每個合約的應收款、作番總數 |
|
|
|
|
|
$today_date = new DateTime(date('Y-m-d', strtotime('-1 month', strtotime(date('Y-m-d'))))); |
|
|
foreach ($arrayData as &$value) { |
|
|
foreach ($arrayData as &$value) { |
|
|
if ($value['total_facility_num'] > 0) { |
|
|
if ($value['total_facility_num'] > 0) { |
|
|
$value['receivable_budget'] += ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) + |
|
|
$value['receivable_budget'] = $value['sign'][1] * ($value['sign_num'] / $value['total_facility_num']) + ($value['second'][1] * ($value['second_num'] / $value['total_facility_num'])) + |
|
|
($value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num'])) + ($value['install'][1] * ($value['install_num'] / $value['total_facility_num'])) + |
|
|
($value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num'])) + ($value['install'][1] * ($value['install_num'] / $value['total_facility_num'])) + |
|
|
($value['tryrun'][1] * ($value['tryrun_num'] / $value['total_facility_num'])) + ($value['check'][1] * ($value['check_num'] / $value['total_facility_num'])) + |
|
|
($value['tryrun'][1] * ($value['tryrun_num'] / $value['total_facility_num'])) + ($value['check'][1] * ($value['check_num'] / $value['total_facility_num'])) + |
|
|
(($value['delivery'][1] + $value['final'][1]) * ($value['delivery_num'] / $value['total_facility_num'])); |
|
|
(($value['delivery'][1] + $value['final'][1]) * ($value['delivery_num'] / $value['total_facility_num'])); |
|
|
$value['sign'][3] = $value['sign'][1]; |
|
|
$value['sign'][3] = $value['sign'][1] * ($value['sign_num'] / $value['total_facility_num']); |
|
|
$value['second'][3] = $value['second'][1] * ($value['second_num'] / $value['total_facility_num']); |
|
|
$value['second'][3] = $value['second'][1] * ($value['second_num'] / $value['total_facility_num']); |
|
|
$value['arrive'][3] = $value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num']); |
|
|
$value['arrive'][3] = $value['arrive'][1] * ($value['arrive_num'] / $value['total_facility_num']); |
|
|
$value['install'][3] = $value['install'][1] * ($value['install_num'] / $value['total_facility_num']); |
|
|
$value['install'][3] = $value['install'][1] * ($value['install_num'] / $value['total_facility_num']); |
|
@ -567,50 +734,41 @@ foreach ($arrayData as &$value) { |
|
|
$value['delivery'][3] = $value['delivery'][1] * ($value['delivery_num'] / $value['total_facility_num']); |
|
|
$value['delivery'][3] = $value['delivery'][1] * ($value['delivery_num'] / $value['total_facility_num']); |
|
|
$value['final'][3] = $value['final'][1] * ($value['delivery_num'] / $value['total_facility_num']); |
|
|
$value['final'][3] = $value['final'][1] * ($value['delivery_num'] / $value['total_facility_num']); |
|
|
} |
|
|
} |
|
|
$stagearray = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); |
|
|
// 計算最大催收次數與最小催收次數 |
|
|
|
|
|
$contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); |
|
|
|
|
|
|
|
|
$today = date('Ym01', strtotime('-1 month', strtotime(date('Ym01')))); |
|
|
foreach ($contractstage as $i) { |
|
|
// $today = strtotime($today,); |
|
|
if (!empty($value[$i]['min']) && count($value[$i]['min']) > 0) { |
|
|
// echo "today: " . $today . "<br>"; |
|
|
$latest_timestamp = max($value[$i]['min']); |
|
|
// exit(); |
|
|
$latest_date = new DateTime(); |
|
|
// foreach ($stagearray as $stage) { |
|
|
$latest_date->setTimestamp($latest_timestamp); |
|
|
// // 計算月份差距 |
|
|
if ($latest_date < $today_date) { |
|
|
// if (empty($value[$stage]['min'])==0) { |
|
|
$interval = $latest_date->diff($today_date); |
|
|
// print_r($value[$stage]['min']); |
|
|
$month = $interval->format('%m'); |
|
|
// echo "<br>"; |
|
|
$value[$i]['min'] = $month; |
|
|
// // $maxtime = array_map('strtotime', $value[$stage]['min']); |
|
|
} else { |
|
|
// $earliestDate = min($value[$stage]['min']); |
|
|
$value[$i]['min'] = 0; |
|
|
// $earliestMonth = date('Ym01', $earliestDate); |
|
|
} |
|
|
// echo "earliestDate: " . $earliestDate . "<br>"; |
|
|
} else { |
|
|
// // $earliestMonth = date('n', strtotime($earliestDate)); |
|
|
$value[$i]['min'] = 0; |
|
|
// // 計算月份差距 |
|
|
}; |
|
|
// $maxDifference = $today -$earliestMonth; |
|
|
if (!empty($value[$i]['max']) && count($value[$i]['max']) > 0) { |
|
|
// echo "difference = ".$maxDifference."<br>"; |
|
|
$latest_timestamp = min($value[$i]['max']); |
|
|
// $value[$stage]['max'] = $maxDifference; |
|
|
$latest_date = new DateTime(); |
|
|
// } else { |
|
|
$latest_date->setTimestamp($latest_timestamp); |
|
|
// $value[$stage]['max'] = 0; |
|
|
if ($latest_date < $today_date) { |
|
|
// } |
|
|
$interval = $latest_date->diff($today_date); |
|
|
// echo $value[$stage]['max']; |
|
|
$month = $interval->format('%m'); |
|
|
// echo "<br>--------------------<br>"; |
|
|
$value[$i]['max'] = $month; |
|
|
// exit(); |
|
|
} else { |
|
|
|
|
|
$value[$i]['max'] = 0; |
|
|
// if(!empty($value[$stage]['max']) && $value[$stage]['max'] !==10 && $value[$stage]['max'] !==1){ |
|
|
} |
|
|
// echo "max: " . $value[$stage]['max'] . "<br>"; |
|
|
} else { |
|
|
// if (!empty($value[$stage]['max'])) { |
|
|
$value[$i]['max'] = 0; |
|
|
// $mintime = array_map('strtotime', $value[$stage]['max']); |
|
|
}; |
|
|
// $latestDate = max($mintime); |
|
|
|
|
|
// $latestMonth = date('n', strtotime($latestDate)); |
|
|
|
|
|
// $minDifference = abs($latestMonth - $today); |
|
|
|
|
|
// $value[$stage]['min'] = $minDifference; |
|
|
|
|
|
// } else { |
|
|
|
|
|
// $value[$stage]['min'] = 0; |
|
|
|
|
|
// } |
|
|
|
|
|
// }else{ |
|
|
|
|
|
// $value[$stage]['min'] = 0; |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] |
|
|
// [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] |
|
|
// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] |
|
|
// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] |
|
|
// [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期] |
|
|
// [合約號][作番號][款別] ['rec'] [金額]/[實際收款日期] |
|
@ -622,7 +780,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// [invoice][發票號碼][0 發票日期, 1 發票金額, 2 發票狀態, 3 收款日期, 4 收款金額, 5 手續費, 6 核銷單號] |
|
|
// [invoice][發票號碼][0 發票日期, 1 發票金額, 2 發票狀態, 3 收款日期, 4 收款金額, 5 手續費, 6 核銷單號] |
|
|
foreach ($invoice_data as $invoice) { |
|
|
foreach ($invoice_data as $invoice) { |
|
|
if (isset($arrayData[$invoice['ProjectId']])) { |
|
|
if (isset($arrayData[$invoice['ProjectId']])) { |
|
@ -647,12 +804,74 @@ foreach ($received_array as $received) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//產生excel的array |
|
|
|
|
|
$excel_aray = array(); |
|
|
|
|
|
$boga_array = array(); |
|
|
|
|
|
$exclude_boga_array = array(); |
|
|
foreach ($arrayData as $key => $value) { |
|
|
foreach ($arrayData as $key => $value) { |
|
|
print_r($value); |
|
|
$value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0; |
|
|
echo "<br>"; |
|
|
$value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0; |
|
|
|
|
|
$value['arrive'][3] = (isset($value['arrive'][3])) ? $value['arrive'][3] : 0; |
|
|
|
|
|
$value['install'][3] = (isset($value['install'][3])) ? $value['install'][3] : 0; |
|
|
|
|
|
$value['tryrun'][3] = (isset($value['tryrun'][3])) ? $value['tryrun'][3] : 0; |
|
|
|
|
|
$value['check'][3] = (isset($value['check'][3])) ? $value['check'][3] : 0; |
|
|
|
|
|
$value['delivery'][3] = (isset($value['delivery'][3])) ? $value['delivery'][3] : 0; |
|
|
|
|
|
$value['final'][3] = (isset($value['final'][3])) ? $value['final'][3] : 0; |
|
|
|
|
|
$contractstage = array('sign', 'second', 'arrive', 'install', 'tryrun', 'check', 'delivery', 'final'); |
|
|
|
|
|
foreach ($contractstage as $i) { |
|
|
|
|
|
$value[$i]['max'] = (empty($value[$i]['max']) || is_null($value[$i]['max'])) ? 0 : $value[$i]['max']; |
|
|
|
|
|
$value[$i]['min'] = (empty($value[$i]['min']) || is_null($value[$i]['min'])) ? 0 : $value[$i]['min']; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if ($value['sign'][0] == "寶佳出貨前30天") { |
|
|
|
|
|
$boga_array[$key] = [ |
|
|
|
|
|
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], |
|
|
|
|
|
$value['sign'][1], $value['sign'][3], $value['sign']['max'], $value['sign']['min'], |
|
|
|
|
|
$value['second'][1], $value['second'][3], $value['second']['max'], $value['second']['min'], |
|
|
|
|
|
$value['arrive'][1], $value['arrive'][3], $value['arrive']['max'], $value['arrive']['min'], |
|
|
|
|
|
$value['install'][1], $value['install'][3], $value['install']['max'], $value['install']['min'], |
|
|
|
|
|
$value['tryrun'][1], $value['tryrun'][3], $value['tryrun']['max'], $value['tryrun']['min'], |
|
|
|
|
|
$value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], |
|
|
|
|
|
$value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], |
|
|
|
|
|
$value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], |
|
|
|
|
|
$value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities']) |
|
|
|
|
|
]; |
|
|
|
|
|
} else { |
|
|
|
|
|
$exclude_boga_array[$key] = [ |
|
|
|
|
|
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], |
|
|
|
|
|
$value['sign'][1], $value['sign'][3], $value['sign']['max'], $value['sign']['min'], |
|
|
|
|
|
$value['second'][1], $value['second'][3], $value['second']['max'], $value['second']['min'], |
|
|
|
|
|
$value['arrive'][1], $value['arrive'][3], $value['arrive']['max'], $value['arrive']['min'], |
|
|
|
|
|
$value['install'][1], $value['install'][3], $value['install']['max'], $value['install']['min'], |
|
|
|
|
|
$value['tryrun'][1], $value['tryrun'][3], $value['tryrun']['max'], $value['tryrun']['min'], |
|
|
|
|
|
$value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], |
|
|
|
|
|
$value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], |
|
|
|
|
|
$value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], |
|
|
|
|
|
$value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities']) |
|
|
|
|
|
]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$excel_aray[$key] = [ |
|
|
|
|
|
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], |
|
|
|
|
|
$value['sign'][1], $value['sign'][3], $value['sign']['max'], $value['sign']['min'], |
|
|
|
|
|
$value['second'][1], $value['second'][3], $value['second']['max'], $value['second']['min'], |
|
|
|
|
|
$value['arrive'][1], $value['arrive'][3], $value['arrive']['max'], $value['arrive']['min'], |
|
|
|
|
|
$value['install'][1], $value['install'][3], $value['install']['max'], $value['install']['min'], |
|
|
|
|
|
$value['tryrun'][1], $value['tryrun'][3], $value['tryrun']['max'], $value['tryrun']['min'], |
|
|
|
|
|
$value['check'][1], $value['check'][3], $value['check']['max'], $value['check']['min'], |
|
|
|
|
|
$value['delivery'][1], $value['delivery'][3], $value['delivery']['max'], $value['delivery']['min'], |
|
|
|
|
|
$value['final'][1], $value['final'][3], $value['final']['max'], $value['final']['min'], |
|
|
|
|
|
$value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities']) |
|
|
|
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$data = json_encode($arrayData); |
|
|
$data = json_encode($excel_aray); |
|
|
|
|
|
$boga_data = json_encode($boga_array); |
|
|
|
|
|
$exclude_boga_data = json_encode($exclude_boga_array); |
|
|
|
|
|
|
|
|
?> |
|
|
?> |
|
|
<style> |
|
|
<style> |
|
@ -692,7 +911,16 @@ $data = json_encode($arrayData); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
<button type="button" onclick="downloadData()" class="btn btn-warning btn-lg pull-right"><span class="glyphicon glyphicon-download-alt"></span></button> |
|
|
<button type="button" onclick="downloadData()" class="btn btn-success btn-lg pull-right">全部<span class="glyphicon glyphicon-download-alt"></span></button> |
|
|
|
|
|
<button type="button" onclick="exclude_bogaData()" class="btn btn-info btn-lg pull-right">不含寶佳<span class="glyphicon glyphicon-download-alt"></span></button> |
|
|
|
|
|
<button type="button" onclick="bogaData()" class="btn btn-warning btn-lg pull-right">寶佳<span class="glyphicon glyphicon-download-alt"></span></button> |
|
|
|
|
|
<?php |
|
|
|
|
|
if (in_array(accountidToDepartId($user_id), array('220', '210')) || $user_id == 'M0060') { |
|
|
|
|
|
?> |
|
|
|
|
|
<a href="facility-price.php?<?= $token_link ?>" class="btn btn-primary btn-lg pull-right">合約作番明細</span></a> |
|
|
|
|
|
<?php |
|
|
|
|
|
} |
|
|
|
|
|
?> |
|
|
<div style="width:98%;margin:1% ;overflow-x: auto;"> |
|
|
<div style="width:98%;margin:1% ;overflow-x: auto;"> |
|
|
<table id="table_index" class="table table-striped table-bordered" style="width:100%;"> |
|
|
<table id="table_index" class="table table-striped table-bordered" style="width:100%;"> |
|
|
<thead> |
|
|
<thead> |
|
@ -701,45 +929,45 @@ $data = json_encode($arrayData); |
|
|
<th style="width: 120px;">部門</th> |
|
|
<th style="width: 120px;">部門</th> |
|
|
<th style="width: 120px;">經理</th> |
|
|
<th style="width: 120px;">經理</th> |
|
|
<th style="width: 120px;">營業員</th> |
|
|
<th style="width: 120px;">營業員</th> |
|
|
<th style="width: 180px;">客戶名稱</th> |
|
|
<th style="width: 120px;">客戶名稱</th> |
|
|
<th style="width: 150px;">簽約款</th> |
|
|
<th style="width: 120px;">簽約款</th> |
|
|
<th style="width: 150px;">應收簽約金額</th> |
|
|
<th style="width: 120px;">應收簽約金額</th> |
|
|
<th style="width: 150px;">簽約最大催收次數</th> |
|
|
<th style="width: 120px;">簽約最小催收次數</th> |
|
|
<th style="width: 150px;">簽約最小催收次數</th> |
|
|
<th style="width: 120px;">簽約最大催收次數</th> |
|
|
<th style="width: 150px;">二次款</th> |
|
|
<th style="width: 120px;">二次款</th> |
|
|
<th style="width: 150px;">應收二次金額</th> |
|
|
<th style="width: 120px;">應收二次金額</th> |
|
|
<th style="width: 150px;">二次最大催收次數</th> |
|
|
<th style="width: 120px;">二次最小催收次數</th> |
|
|
<th style="width: 150px;">二次最小催收次數</th> |
|
|
<th style="width: 120px;">二次最大催收次數</th> |
|
|
<th style="width: 150px;">貨抵工地款</th> |
|
|
<th style="width: 120px;">貨抵工地款</th> |
|
|
<th style="width: 150px;">應收貨抵工地金額</th> |
|
|
<th style="width: 120px;">應收貨抵工地金額</th> |
|
|
<th style="width: 150px;">貨抵工地最大催收次數</th> |
|
|
<th style="width: 120px;">貨抵工地最小催收次數</th> |
|
|
<th style="width: 150px;">貨抵工地最小催收次數</th> |
|
|
<th style="width: 120px;">貨抵工地最大催收次數</th> |
|
|
<th style="width: 150px;">安裝款</th> |
|
|
<th style="width: 120px;">安裝款</th> |
|
|
<th style="width: 150px;">應收安裝金額</th> |
|
|
<th style="width: 120px;">應收安裝金額</th> |
|
|
<th style="width: 150px;">安裝最大催收次數</th> |
|
|
<th style="width: 120px;">安裝最小催收次數</th> |
|
|
<th style="width: 150px;">安裝最小催收次數</th> |
|
|
<th style="width: 120px;">安裝最大催收次數</th> |
|
|
<th style="width: 150px;">試車款</th> |
|
|
<th style="width: 120px;">試車款</th> |
|
|
<th style="width: 150px;">應收試車金額</th> |
|
|
<th style="width: 120px;">應收試車金額</th> |
|
|
<th style="width: 150px;">試車最大催收次數</th> |
|
|
<th style="width: 120px;">試車最小催收次數</th> |
|
|
<th style="width: 150px;">試車最小催收次數</th> |
|
|
<th style="width: 120px;">試車最大催收次數</th> |
|
|
<th style="width: 150px;">官檢款</th> |
|
|
<th style="width: 120px;">官檢款</th> |
|
|
<th style="width: 150px;">應收官檢金額</th> |
|
|
<th style="width: 120px;">應收官檢金額</th> |
|
|
<th style="width: 150px;">官檢最大催收次數</th> |
|
|
<th style="width: 120px;">官檢最小催收次數</th> |
|
|
<th style="width: 150px;">官檢最小催收次數</th> |
|
|
<th style="width: 120px;">官檢最大催收次數</th> |
|
|
<th style="width: 150px;">移交款</th> |
|
|
<th style="width: 120px;">移交款</th> |
|
|
<th style="width: 150px;">應收移交金額</th> |
|
|
<th style="width: 120px;">應收移交金額</th> |
|
|
<th style="width: 150px;">移交最大催收次數</th> |
|
|
<th style="width: 120px;">移交最小催收次數</th> |
|
|
<th style="width: 150px;">移交最小催收次數</th> |
|
|
<th style="width: 120px;">移交最大催收次數</th> |
|
|
<th style="width: 150px;">尾款</th> |
|
|
<th style="width: 120px;">尾款</th> |
|
|
<th style="width: 150px;">應收尾款金額</th> |
|
|
<th style="width: 120px;">應收尾款金額</th> |
|
|
<th style="width: 150px;">尾款最大催收次數</th> |
|
|
<th style="width: 120px;">尾款最小催收次數</th> |
|
|
<th style="width: 150px;">尾款最小催收次數</th> |
|
|
<th style="width: 120px;">尾款最大催收次數</th> |
|
|
<th style="width: 150px;">合約總金額</th> |
|
|
<th style="width: 120px;">合約總金額</th> |
|
|
<th style="width: 150px;" style="width: 120px;">目前應收</th> |
|
|
<th style="width: 120px;" style="width: 120px;">目前應收</th> |
|
|
<th style="width: 150px;" style="width: 120px;">已開發票金額</th> |
|
|
<th style="width: 120px;" style="width: 120px;">已開發票金額</th> |
|
|
<th style="width: 150px;">已收金額</th> |
|
|
<th style="width: 120px;">已收金額</th> |
|
|
<!-- <th>作番狀態</th> --> |
|
|
<!-- <th>作番狀態</th> --> |
|
|
<!-- <th style="width: 100px;">收款狀態</th> --> |
|
|
<th style="width: 350px;">收款狀態</th> |
|
|
|
|
|
|
|
|
</tr> |
|
|
</tr> |
|
|
</thead> |
|
|
</thead> |
|
@ -748,7 +976,7 @@ $data = json_encode($arrayData); |
|
|
foreach ($arrayData as $key => $value) { |
|
|
foreach ($arrayData as $key => $value) { |
|
|
?> |
|
|
?> |
|
|
<tr> |
|
|
<tr> |
|
|
<th><?= $key ?></th> |
|
|
<th><a onclick="showContract('<?= $key ?>')"><?= $key ?> </a></th> |
|
|
<td><?= $value[1] ?></td> |
|
|
<td><?= $value[1] ?></td> |
|
|
<td><?= $value[2] ?></td> |
|
|
<td><?= $value[2] ?></td> |
|
|
<td><?= $value[4] ?></td> |
|
|
<td><?= $value[4] ?></td> |
|
@ -789,8 +1017,8 @@ $data = json_encode($arrayData); |
|
|
<td style="text-align: end;"><?= isset($value['receivable_budget']) ? number_format(round($value['receivable_budget'])) : '--' ?></td> |
|
|
<td style="text-align: end;"><?= isset($value['receivable_budget']) ? number_format(round($value['receivable_budget'])) : '--' ?></td> |
|
|
<td style="text-align: end;"><?= isset($value['invoice_budget']) ? number_format(round($value['invoice_budget'])) : '--' ?></td> |
|
|
<td style="text-align: end;"><?= isset($value['invoice_budget']) ? number_format(round($value['invoice_budget'])) : '--' ?></td> |
|
|
<td style="text-align: end;"><?= isset($value['received_budget']) ? number_format(round($value['received_budget'])) : '--' ?></td> |
|
|
<td style="text-align: end;"><?= isset($value['received_budget']) ? number_format(round($value['received_budget'])) : '--' ?></td> |
|
|
<!-- <td style="text-align: start;"><?= $value['facilities'] ?></td>
|
|
|
<td style="text-align: start;"><?= $value['facilities'] ?></td> |
|
|
<td><button type="button" onclick="sendData('<?= $key ?>')" class="btn btn-primary btn-sm"><span class=" glyphicon glyphicon-search"></span></button> |
|
|
<!-- <td><button type="button" onclick="sendData('<?= $key ?>')" class="btn btn-primary btn-sm"><span class=" glyphicon glyphicon-search"></span></button>
|
|
|
</td> --> |
|
|
</td> --> |
|
|
</tr> |
|
|
</tr> |
|
|
<?php |
|
|
<?php |
|
@ -800,6 +1028,11 @@ $data = json_encode($arrayData); |
|
|
</table> |
|
|
</table> |
|
|
</div> |
|
|
</div> |
|
|
<script> |
|
|
<script> |
|
|
|
|
|
function showContract(BillNo) { |
|
|
|
|
|
window.open('account-receivable-contract.php?BillNo=' + BillNo + '&<?= $token_link ?>', '發票範例', config = 'height=600, width=1200'); |
|
|
|
|
|
console.log(BillNo); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function test() { |
|
|
function test() { |
|
|
var BillData = <?= $data ?>; |
|
|
var BillData = <?= $data ?>; |
|
|
var form = document.createElement("form"); |
|
|
var form = document.createElement("form"); |
|
@ -824,8 +1057,8 @@ $data = json_encode($arrayData); |
|
|
if (xhr.readyState === 4 && xhr.status === 200) { |
|
|
if (xhr.readyState === 4 && xhr.status === 200) { |
|
|
var file_path = xhr.responseText; |
|
|
var file_path = xhr.responseText; |
|
|
var link = document.createElement('a'); |
|
|
var link = document.createElement('a'); |
|
|
var name = "應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; |
|
|
var name = "全部應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; |
|
|
link.setAttribute('href', window.location.origin + "/wms/account-receivable.xlsx"); |
|
|
link.setAttribute('href', window.location.origin + "/wms/account-receivable-test.xlsx"); |
|
|
link.setAttribute('download', name); |
|
|
link.setAttribute('download', name); |
|
|
link.style.display = 'none'; |
|
|
link.style.display = 'none'; |
|
|
document.body.appendChild(link); |
|
|
document.body.appendChild(link); |
|
@ -833,11 +1066,68 @@ $data = json_encode($arrayData); |
|
|
document.body.removeChild(link); |
|
|
document.body.removeChild(link); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// xhr.send(JSON.stringify({ |
|
|
|
|
|
// Bill: <?= $data ?> |
|
|
|
|
|
// }) |
|
|
|
|
|
// ); |
|
|
xhr.send(JSON.stringify({ |
|
|
xhr.send(JSON.stringify({ |
|
|
Bill: <?= $data ?> |
|
|
Bill: <?= $data ?> |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function bogaData() { |
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
|
|
var url = window.location.origin + "/wms/account-receivable-excel.php?<?= $token_link ?>"; |
|
|
|
|
|
xhr.open('POST', url, true); |
|
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/json'); |
|
|
|
|
|
xhr.onreadystatechange = function() { |
|
|
|
|
|
if (xhr.readyState === 4 && xhr.status === 200) { |
|
|
|
|
|
var file_path = xhr.responseText; |
|
|
|
|
|
var link = document.createElement('a'); |
|
|
|
|
|
var name = "寶佳應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; |
|
|
|
|
|
link.setAttribute('href', window.location.origin + "/wms/account-receivable-test.xlsx"); |
|
|
|
|
|
link.setAttribute('download', name); |
|
|
|
|
|
link.style.display = 'none'; |
|
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
|
link.click(); |
|
|
|
|
|
document.body.removeChild(link); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
xhr.send(JSON.stringify({ |
|
|
|
|
|
Bill: <?= $boga_data ?> |
|
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function exclude_bogaData() { |
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
|
|
var url = window.location.origin + "/wms/account-receivable-excel.php?<?= $token_link ?>"; |
|
|
|
|
|
xhr.open('POST', url, true); |
|
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/json'); |
|
|
|
|
|
xhr.onreadystatechange = function() { |
|
|
|
|
|
if (xhr.readyState === 4 && xhr.status === 200) { |
|
|
|
|
|
var file_path = xhr.responseText; |
|
|
|
|
|
var link = document.createElement('a'); |
|
|
|
|
|
var name = "不含寶佳應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; |
|
|
|
|
|
link.setAttribute('href', window.location.origin + "/wms/account-receivable-test.xlsx"); |
|
|
|
|
|
link.setAttribute('download', name); |
|
|
|
|
|
link.style.display = 'none'; |
|
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
|
link.click(); |
|
|
|
|
|
document.body.removeChild(link); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
xhr.send(JSON.stringify({ |
|
|
|
|
|
Bill: <?= $exclude_boga_data ?> |
|
|
|
|
|
})); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sendData(BillNo) { |
|
|
function sendData(BillNo) { |
|
|
var BillData = <?= $data ?>; |
|
|
var BillData = <?= $data ?>; |
|
|
var Bill = BillData[BillNo]; |
|
|
var Bill = BillData[BillNo]; |
|
|