|
|
@ -1,15 +1,6 @@ |
|
|
|
<?php |
|
|
|
include "header.php"; |
|
|
|
|
|
|
|
$sum_facility = 0; |
|
|
|
$sum_A40001 = 0; |
|
|
|
$sum_A40008 = 0; |
|
|
|
$sum_total_budget = 0; |
|
|
|
$average_budget = 0; |
|
|
|
$average_A40001 = 0; |
|
|
|
$average_A40008 = 0; |
|
|
|
|
|
|
|
|
|
|
|
$follower = find_follow($user_id); |
|
|
|
$arrayData = []; |
|
|
|
$receivable_array = []; |
|
|
@ -49,7 +40,7 @@ LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId |
|
|
|
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; |
|
|
|
|
|
|
|
// T8 銷售訂單 作番金額 |
|
|
|
$sql_contract_budget = "SELECT A.BillNo, A.OAmountWithTax,A.CU_MaterialId, A.MaterialId FROM salSalesOrderDetail AS A |
|
|
|
$sql_contract_budget = "SELECT A.BillNo, A.OAmountWithTax,A.CU_MaterialId FROM salSalesOrderDetail AS A |
|
|
|
LEFT JOIN salSalesOrder AS B ON A.BillNo=B.BillNo |
|
|
|
WHERE B.ModeId='M' AND A.ItemType=1 "; |
|
|
|
|
|
|
@ -103,7 +94,6 @@ if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { |
|
|
|
$sql_opening .= " OR person_id = '$user_id'"; |
|
|
|
$sql .= " WHERE salesid = '$user_id'"; |
|
|
|
$sql_contract_budget .= " AND (PersonId = '$user_id'"; |
|
|
|
$sql_contract_budget .= " AND (PersonId = '$user_id'"; |
|
|
|
if (count($follower) > 0) { |
|
|
|
$column_str = "('$user_id'" . ",'"; |
|
|
|
$column_str .= implode("','", $follower); |
|
|
@ -113,19 +103,16 @@ if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { |
|
|
|
$sql_opening .= " OR person_id IN $column_str)"; |
|
|
|
$sql .= " OR salesid IN $column_str ORDER BY contractno"; |
|
|
|
$sql_contract_budget .= " OR PersonId IN $column_str ORDER BY BillNo, CU_MaterialId)"; |
|
|
|
$sql_contract_budget .= " OR PersonId IN $column_str ORDER BY BillNo, CU_MaterialId)"; |
|
|
|
} else { |
|
|
|
$sql_contract .= ")"; |
|
|
|
// $sql_received .= ")"; |
|
|
|
$sql_opening .= ")"; |
|
|
|
$sql .= " ORDER BY contractno"; |
|
|
|
$sql_contract_budget .= ")"; |
|
|
|
$sql_contract_budget .= ")"; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
$sql .= " ORDER BY contractno"; |
|
|
|
$sql_contract_budget .= "ORDER BY BillNo, CU_MaterialId"; |
|
|
|
$sql_contract_budget .= "ORDER BY BillNo, CU_MaterialId"; |
|
|
|
} |
|
|
|
|
|
|
|
$contract = $conn->query($sql_contract); |
|
|
@ -142,16 +129,10 @@ foreach ($contract_budget_data as $cont) { |
|
|
|
$contract_budget[$cont['BillNo']]['total'] = $cont['OAmountWithTax']; |
|
|
|
} |
|
|
|
if (isset($contract_budget[$cont['BillNo']][$cont['CU_MaterialId']])) { |
|
|
|
$contract_budget[$cont['BillNo']][$cont['CU_MaterialId']]['total'] += $cont['OAmountWithTax']; |
|
|
|
$contract_budget[$cont['BillNo']][$cont['CU_MaterialId']] += $cont['OAmountWithTax']; |
|
|
|
} else { |
|
|
|
$contract_budget[$cont['BillNo']][$cont['CU_MaterialId']]['total'] = $cont['OAmountWithTax']; |
|
|
|
$contract_budget[$cont['BillNo']][$cont['CU_MaterialId']] = $cont['OAmountWithTax']; |
|
|
|
}; |
|
|
|
if (isset($contract_budget[$cont['BillNo']][$cont['MaterialId']])) { |
|
|
|
$contract_budget[$cont['BillNo']][$cont['MaterialId']] += $cont['OAmountWithTax']; |
|
|
|
} else { |
|
|
|
$contract_budget[$cont['BillNo']][$cont['MaterialId']] = $cont['OAmountWithTax']; |
|
|
|
} |
|
|
|
$contract_budget[$cont['BillNo']][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax']; |
|
|
|
} |
|
|
|
|
|
|
|
/* 計算比例 |
|
|
@ -166,8 +147,8 @@ function get_ratio($facility_list, $contract_no, $contract_budget) |
|
|
|
return 0; |
|
|
|
} else { |
|
|
|
foreach ($facility_list as $every) { |
|
|
|
if (isset($contract_budget[$contract_no][$every]['total']) && isset($contract_budget[$contract_no]['total'])) { |
|
|
|
$ratio += $contract_budget[$contract_no][$every]['total'] / $contract_budget[$contract_no]['total']; |
|
|
|
if (isset($contract_budget[$contract_no][$every]) && isset($contract_budget[$contract_no]['total'])) { |
|
|
|
$ratio += $contract_budget[$contract_no][$every] / $contract_budget[$contract_no]['total']; |
|
|
|
} |
|
|
|
} |
|
|
|
return $ratio; |
|
|
@ -215,7 +196,6 @@ foreach ($contract as $cont) { |
|
|
|
$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]['sign_num'] = $arrayData[$BillNo]['receivable_budget'] = 0; |
|
|
|
$arrayData[$BillNo]['total_list'] = $arrayData[$BillNo]['sign_list'] = $arrayData[$BillNo]['second_list'] = $arrayData[$BillNo]['arrive_list'] = $arrayData[$BillNo]['install_list'] = $arrayData[$BillNo]['tryrun_list'] = $arrayData[$BillNo]['check_list'] = $arrayData[$BillNo]['delivery_list'] = $arrayData[$BillNo]['final_list'] = []; |
|
|
|
$arrayData[$BillNo]['total_list'] = $arrayData[$BillNo]['sign_list'] = $arrayData[$BillNo]['second_list'] = $arrayData[$BillNo]['arrive_list'] = $arrayData[$BillNo]['install_list'] = $arrayData[$BillNo]['tryrun_list'] = $arrayData[$BillNo]['check_list'] = $arrayData[$BillNo]['delivery_list'] = $arrayData[$BillNo]['final_list'] = []; |
|
|
|
} |
|
|
|
if (stristr($PayStage, '二次款') || (stristr($PayStage, '出貨前') && $PayStage != "寶佳出貨前30天") || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60') || stristr($PayStage, '寶佳出貨後10天')) { |
|
|
|
$arrayData[$BillNo]['second'][0] = $PayStage; |
|
|
@ -305,16 +285,12 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']][4] = $wip['name']; |
|
|
|
$arrayData[$wip['contractno']][10] = $wip['contractno']; |
|
|
|
$arrayData[$wip['contractno']]['total_facility_num'] += 1; |
|
|
|
$arrayData[$wip['contractno']]['A40001'] = $contract_budget[$wip['contractno']]['A40001']; |
|
|
|
$arrayData[$wip['contractno']]['A40008'] = $contract_budget[$wip['contractno']]['A40008']; |
|
|
|
// [合約號]['facility'][作番號]['no'] |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['no'] = $wip['facilityno']; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = ""; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['total_budget'] = 0; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['receivable_budget'] = 0; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['collect_budget'] = 0; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40001'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40001']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40001'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40001'] : 0; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40008'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40008']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40008'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40008'] : 0; |
|
|
|
|
|
|
|
// [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] |
|
|
|
// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] |
|
|
@ -406,7 +382,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
if ($arrayData[$wip['contractno']]['sign'][0] == "寶佳出貨前30天") { |
|
|
|
$facility_status = ""; |
|
|
|
array_push($arrayData[$wip['contractno']]['total_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['total_list'], $wip['facilityno']); |
|
|
|
$today = strtotime(date('Ymd')); |
|
|
|
$contractday = strtotime($arrayData[$wip['contractno']]['sign'][2]); |
|
|
|
$month = collect_month($contractday); |
|
|
@ -415,7 +390,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
if ($today > $contractday) { |
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
$facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "已過) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; |
|
|
|
//二次款 |
|
|
@ -426,7 +400,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
if ($today > $contractday) { |
|
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
$facility_status = $wip['facilityno'] . " (出貨後10天" . $arrayData[$wip['contractno']]['second'][2] . "已過) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; |
|
|
|
//貨抵工地款 |
|
|
@ -439,7 +412,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
if ($today > $contractday) { |
|
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['arrive'][2] = strval(date('Y-m-d', $contractday)); |
|
|
|
$facility_status = $wip['facilityno'] . " (貨抵工地後90天" . $arrayData[$wip['contractno']]['arrive'][2] . "已過) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; |
|
|
@ -453,7 +425,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
if ($today > $contractday) { |
|
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['tryrun'][2] = strval(date('Y-m-d', $contractday)); |
|
|
|
$facility_status = $wip['facilityno'] . " (試車後90天" . $arrayData[$wip['contractno']]['tryrun'][2] . "已過) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; |
|
|
@ -468,8 +439,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']]['delivery_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['delivery'][2] = strval(date('Y-m-d', $contractday)); |
|
|
|
$facility_status = $wip['facilityno'] . " (交車後270天" . $arrayData[$wip['contractno']]['delivery'][2] . "已過) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; |
|
|
@ -488,7 +457,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
} else { |
|
|
|
$signtime = strtotime($arrayData[$wip['contractno']]['sign'][2]); |
|
|
|
array_push($arrayData[$wip['contractno']]['total_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['total_list'], $wip['facilityno']); |
|
|
|
$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)); |
|
|
@ -503,19 +471,14 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
|
|
|
|
if ($arrayData[$wip['contractno']]['delivery'][0] == "交車後270天") { |
|
|
|
$estimate_delivery_time = strtotime($wip['delivery_date']); |
|
|
@ -525,8 +488,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']]['delivery_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); |
|
|
|
} |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][6] = $month; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][2] = strval(date('Ymd', $arrivetime)); |
|
|
@ -538,11 +499,8 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']]['delivery_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['check_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['check_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['check_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['delivery'][2] = strval($wip['delivery_date']); |
|
|
|
$deliverytime = strtotime($wip['delivery_date']); |
|
|
|
$month = collect_month($deliverytime); |
|
|
@ -614,22 +572,16 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['check_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['check_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['check_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
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']['max'], strtotime(strval($wip['official_check_date']))); |
|
|
@ -707,19 +659,14 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['tryrun_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { |
|
|
|
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']))); |
|
|
@ -775,16 +722,12 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['install_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { |
|
|
|
$installtime = strtotime($wip['install_end_date']); |
|
|
|
$month = collect_month($installtime); |
|
|
@ -832,13 +775,10 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['arrive_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
|
|
|
|
if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { |
|
|
|
$estimate_delivery_time = strtotime($wip['real_arrival_date']); |
|
|
@ -868,14 +808,11 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (已達二次款收款條件) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['second_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); |
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
} else { |
|
|
|
$arrayData[$wip['contractno']]['sign_num'] += 1; |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); |
|
|
|
if ($wip['real_contract_arrival_date'] != NULL) { |
|
|
|
$arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日) <br>"; |
|
|
|
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日) <br>"; |
|
|
@ -914,30 +851,6 @@ foreach ($wipwhole_array as $wip) { |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
// foreach ($arrayData as $key => $value) { |
|
|
|
// echo $key."<br>"; |
|
|
|
// print_r($value['total_list']); |
|
|
|
// echo " / 總 "; |
|
|
|
// print_r($value['sign_list']); |
|
|
|
// echo " / 訂金 <br>"; |
|
|
|
// print_r($value['arrive_list']); |
|
|
|
// echo " / 貨抵 "; |
|
|
|
// print_r($value['install_list']); |
|
|
|
// echo " / 安裝 <br>"; |
|
|
|
// print_r($value['tryrun_list']); |
|
|
|
// echo " / 試車 "; |
|
|
|
// print_r($value['check_list']); |
|
|
|
// echo " / 官檢 <br>"; |
|
|
|
// print_r($value['delivery_list']); |
|
|
|
// echo " / 移交 "; |
|
|
|
// print_r($value['final_list']); |
|
|
|
// echo " / 結案 <br>"; |
|
|
|
// echo "---------------------------<br>"; |
|
|
|
// foreach($value['sign_list'] as $fac){ |
|
|
|
// echo $fac."========="; |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// 計算每個合約的應收款、作番總數 |
|
|
|
$today_date = new DateTime(date('Y-m-d', strtotime('-1 month', strtotime(date('Y-m-d'))))); |
|
|
@ -962,33 +875,14 @@ foreach ($arrayData as &$value) { |
|
|
|
$value['final'][3] = $value['final'][1] * $final_ratio; |
|
|
|
$value['receivable_budget'] = $value['sign'][3] + $value['second'][3] + $value['arrive'][3] + $value['install'][3] + $value['tryrun'][3] + $value['check'][3] + $value['delivery'][3] + $value['final'][3]; |
|
|
|
} |
|
|
|
//['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
|
|
|
$sign_ratio = get_ratio($value['sign_list'], $value[10], $contract_budget); |
|
|
|
$value['sign'][3] = $value['sign'][1] * $sign_ratio; |
|
|
|
$second_ratio = get_ratio($value['second_list'], $value[10], $contract_budget); |
|
|
|
$value['second'][3] = $value['second'][1] * $second_ratio; |
|
|
|
$arrive_ratio = get_ratio($value['arrive_list'], $value[10], $contract_budget); |
|
|
|
$value['arrive'][3] = $value['arrive'][1] * $arrive_ratio; |
|
|
|
$install_ratio = get_ratio($value['install_list'], $value[10], $contract_budget); |
|
|
|
$value['install'][3] = $value['install'][1] * $install_ratio; |
|
|
|
$tryrun_ratio = get_ratio($value['tryrun_list'], $value[10], $contract_budget); |
|
|
|
$value['tryrun'][3] = $value['tryrun'][1] * $tryrun_ratio; |
|
|
|
$check_ratio = get_ratio($value['check_list'], $value[10], $contract_budget); |
|
|
|
$value['check'][3] = $value['check'][1] * $check_ratio; |
|
|
|
$delivery_ratio = get_ratio($value['delivery_list'], $value[10], $contract_budget); |
|
|
|
$value['delivery'][3] = $value['delivery'][1] * $delivery_ratio; |
|
|
|
$final_ratio = get_ratio($value['final_list'], $value[10], $contract_budget); |
|
|
|
$value['final'][3] = $value['final'][1] * $final_ratio; |
|
|
|
$value['receivable_budget'] = $value['sign'][3] + $value['second'][3] + $value['arrive'][3] + $value['install'][3] + $value['tryrun'][3] + $value['check'][3] + $value['delivery'][3] + $value['final'][3]; |
|
|
|
} |
|
|
|
//['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
|
|
|
// 計算每台作番金額與各階段應收金額 |
|
|
|
foreach ($value['facility'] as &$val) { |
|
|
|
foreach ($contractstage as $stage) { |
|
|
|
if (isset($value[$stage][0]) && !empty($value[$stage][0])) { |
|
|
|
$val[$stage][0] = $value[$stage][0]; |
|
|
|
if (isset($contract_budget[$value[10]]['total']) && isset($contract_budget[$value[10]][$val['no']]['total'])) { |
|
|
|
$ratio = $contract_budget[$value[10]][$val['no']]['total'] / $contract_budget[$value[10]]['total']; |
|
|
|
if (isset($contract_budget[$value[10]]['total']) && isset($contract_budget[$value[10]][$val['no']])) { |
|
|
|
$ratio = $contract_budget[$value[10]][$val['no']] / $contract_budget[$value[10]]['total']; |
|
|
|
} else { |
|
|
|
$ratio = 0; |
|
|
|
} |
|
|
@ -1349,284 +1243,6 @@ foreach ($arrayData as $key => &$data) { |
|
|
|
$data['final'][7] = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 4 已收金額 5 催收金額 6 已開發票金額 7 未開發票金額 min 最早應收月份 max 最晚應收月份 |
|
|
|
foreach ($arrayData as $key => &$data) { |
|
|
|
$tmp_data = $data['received_budget']; |
|
|
|
$tmp_invoice = $data['invoice_budget']; |
|
|
|
|
|
|
|
if ($data['sign'][3] > 0) { |
|
|
|
if ($tmp_data > 0) { |
|
|
|
if (($tmp_data - $data['sign'][3]) >= 0) { |
|
|
|
$data['sign'][4] = $data['sign'][3]; |
|
|
|
$tmp_data -= $data['sign'][3]; |
|
|
|
} else { |
|
|
|
$data['sign'][4] = $tmp_data; |
|
|
|
$tmp_data = 0; |
|
|
|
} |
|
|
|
$data['sign'][5] = $data['sign'][3] - $data['sign'][4]; |
|
|
|
} else { |
|
|
|
$data['sign'][4] = 0; |
|
|
|
$data['sign'][5] = $data['sign'][3]; |
|
|
|
} |
|
|
|
if ($tmp_invoice > 0) { |
|
|
|
if (($tmp_invoice - $data['sign'][3]) >= 0) { |
|
|
|
$data['sign'][6] = $data['sign'][3]; |
|
|
|
$tmp_invoice -= $data['sign'][3]; |
|
|
|
} else { |
|
|
|
$data['sign'][6] = $tmp_invoice; |
|
|
|
$tmp_invoice = 0; |
|
|
|
} |
|
|
|
$data['sign'][7] = $data['sign'][3] - $data['sign'][6]; |
|
|
|
} else { |
|
|
|
$data['sign'][6] = 0; |
|
|
|
$data['sign'][7] = $data['sign'][3]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$data['sign'][4] = 0; |
|
|
|
$data['sign'][5] = 0; |
|
|
|
$data['sign'][6] = 0; |
|
|
|
$data['sign'][7] = 0; |
|
|
|
} |
|
|
|
if ($data['second'][3] > 0) { |
|
|
|
if ($tmp_data > 0) { |
|
|
|
if (($tmp_data - $data['second'][3]) >= 0) { |
|
|
|
$data['second'][4] = $data['second'][3]; |
|
|
|
$tmp_data -= $data['second'][3]; |
|
|
|
} else { |
|
|
|
$data['second'][4] = $tmp_data; |
|
|
|
$tmp_data = 0; |
|
|
|
} |
|
|
|
$data['second'][5] = $data['second'][3] - $data['second'][4]; |
|
|
|
} else { |
|
|
|
$data['second'][4] = 0; |
|
|
|
$data['second'][5] = $data['second'][3]; |
|
|
|
} |
|
|
|
if ($tmp_invoice > 0) { |
|
|
|
if (($tmp_invoice - $data['second'][3]) >= 0) { |
|
|
|
$data['second'][6] = $data['second'][3]; |
|
|
|
$tmp_invoice -= $data['second'][3]; |
|
|
|
} else { |
|
|
|
$data['second'][6] = $tmp_invoice; |
|
|
|
$tmp_invoice = 0; |
|
|
|
} |
|
|
|
$data['second'][7] = $data['second'][3] - $data['second'][6]; |
|
|
|
} else { |
|
|
|
$data['second'][6] = 0; |
|
|
|
$data['second'][7] = $data['second'][3]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$data['second'][4] = 0; |
|
|
|
$data['second'][5] = 0; |
|
|
|
$data['second'][6] = 0; |
|
|
|
$data['second'][7] = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if ($data['arrive'][3] > 0) { |
|
|
|
|
|
|
|
if ($tmp_data > 0) { |
|
|
|
if (($tmp_data - $data['arrive'][1]) >= 0) { |
|
|
|
$data['arrive'][4] = $data['arrive'][3]; |
|
|
|
$tmp_data -= $data['arrive'][3]; |
|
|
|
} else { |
|
|
|
$data['arrive'][4] = $tmp_data; |
|
|
|
$tmp_data = 0; |
|
|
|
} |
|
|
|
$data['arrive'][5] = $data['arrive'][3] - $data['arrive'][4]; |
|
|
|
} else { |
|
|
|
$data['arrive'][4] = 0; |
|
|
|
$data['arrive'][5] = $data['arrive'][3]; |
|
|
|
} |
|
|
|
if ($tmp_invoice > 0) { |
|
|
|
if (($tmp_invoice - $data['arrive'][3]) >= 0) { |
|
|
|
$data['arrive'][6] = $data['arrive'][3]; |
|
|
|
$tmp_invoice -= $data['arrive'][3]; |
|
|
|
} else { |
|
|
|
$data['arrive'][6] = $tmp_invoice; |
|
|
|
$tmp_invoice = 0; |
|
|
|
} |
|
|
|
$data['arrive'][7] = $data['arrive'][3] - $data['arrive'][6]; |
|
|
|
} else { |
|
|
|
$data['arrive'][6] = 0; |
|
|
|
$data['arrive'][7] = $data['arrive'][3]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$data['arrive'][4] = 0; |
|
|
|
$data['arrive'][5] = 0; |
|
|
|
$data['arrive'][6] = 0; |
|
|
|
$data['arrive'][7] = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if ($data['install'][3] > 0) { |
|
|
|
|
|
|
|
if ($tmp_data > 0) { |
|
|
|
if (($tmp_data - $data['install'][1]) >= 0) { |
|
|
|
$data['install'][4] = $data['install'][3]; |
|
|
|
$tmp_data -= $data['install'][3]; |
|
|
|
} else { |
|
|
|
$data['install'][4] = $tmp_data; |
|
|
|
$tmp_data = 0; |
|
|
|
} |
|
|
|
$data['install'][5] = $data['install'][3] - $data['install'][4]; |
|
|
|
} else { |
|
|
|
$data['install'][4] = 0; |
|
|
|
$data['install'][5] = $data['install'][3]; |
|
|
|
} |
|
|
|
if ($tmp_invoice > 0) { |
|
|
|
if (($tmp_invoice - $data['install'][3]) >= 0) { |
|
|
|
$data['install'][6] = $data['install'][3]; |
|
|
|
$tmp_invoice -= $data['install'][3]; |
|
|
|
} else { |
|
|
|
$data['install'][6] = $tmp_invoice; |
|
|
|
$tmp_invoice = 0; |
|
|
|
} |
|
|
|
$data['install'][7] = $data['install'][3] - $data['install'][6]; |
|
|
|
} else { |
|
|
|
$data['install'][6] = 0; |
|
|
|
$data['install'][7] = $data['install'][3]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$data['install'][4] = 0; |
|
|
|
$data['install'][5] = 0; |
|
|
|
$data['install'][6] = 0; |
|
|
|
$data['install'][7] = 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($data['tryrun'][3] > 0) { |
|
|
|
if ($tmp_data > 0) { |
|
|
|
if (($tmp_data - $data['tryrun'][1]) >= 0) { |
|
|
|
$data['tryrun'][4] = $data['tryrun'][3]; |
|
|
|
$tmp_data -= $data['tryrun'][3]; |
|
|
|
} else { |
|
|
|
$data['tryrun'][4] = $tmp_data; |
|
|
|
$tmp_data = 0; |
|
|
|
} |
|
|
|
$data['tryrun'][5] = $data['tryrun'][3] - $data['tryrun'][4]; |
|
|
|
} else { |
|
|
|
$data['tryrun'][4] = 0; |
|
|
|
$data['tryrun'][5] = $data['tryrun'][3]; |
|
|
|
} |
|
|
|
if ($tmp_invoice > 0) { |
|
|
|
if (($tmp_invoice - $data['tryrun'][3]) >= 0) { |
|
|
|
$data['tryrun'][6] = $data['tryrun'][3]; |
|
|
|
$tmp_invoice -= $data['tryrun'][3]; |
|
|
|
} else { |
|
|
|
$data['tryrun'][6] = $tmp_invoice; |
|
|
|
$tmp_invoice = 0; |
|
|
|
} |
|
|
|
$data['tryrun'][7] = $data['tryrun'][3] - $data['tryrun'][6]; |
|
|
|
} else { |
|
|
|
$data['tryrun'][6] = 0; |
|
|
|
$data['tryrun'][7] = $data['tryrun'][3]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$data['tryrun'][4] = 0; |
|
|
|
$data['tryrun'][5] = 0; |
|
|
|
$data['tryrun'][6] = 0; |
|
|
|
$data['tryrun'][7] = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if ($data['check'][3] > 0) { |
|
|
|
if ($tmp_data > 0) { |
|
|
|
if (($tmp_data - $data['check'][1]) >= 0) { |
|
|
|
$data['check'][4] = $data['check'][3]; |
|
|
|
$tmp_data -= $data['check'][3]; |
|
|
|
} else { |
|
|
|
$data['check'][4] = $tmp_data; |
|
|
|
$tmp_data = 0; |
|
|
|
} |
|
|
|
$data['check'][5] = $data['check'][3] - $data['check'][4]; |
|
|
|
} else { |
|
|
|
$data['check'][4] = 0; |
|
|
|
$data['check'][5] = $data['check'][3]; |
|
|
|
} |
|
|
|
if ($tmp_invoice > 0) { |
|
|
|
if (($tmp_invoice - $data['check'][3]) >= 0) { |
|
|
|
$data['check'][6] = $data['check'][3]; |
|
|
|
$tmp_invoice -= $data['check'][3]; |
|
|
|
} else { |
|
|
|
$data['check'][6] = $tmp_invoice; |
|
|
|
$tmp_invoice = 0; |
|
|
|
} |
|
|
|
$data['check'][7] = $data['check'][3] - $data['check'][6]; |
|
|
|
} else { |
|
|
|
$data['check'][6] = 0; |
|
|
|
$data['check'][7] = $data['check'][3]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$data['check'][4] = 0; |
|
|
|
$data['check'][5] = 0; |
|
|
|
$data['check'][6] = 0; |
|
|
|
$data['check'][7] = 0; |
|
|
|
} |
|
|
|
if ($data['delivery'][3] > 0) { |
|
|
|
if ($tmp_data > 0) { |
|
|
|
if (($tmp_data - $data['delivery'][1]) >= 0) { |
|
|
|
$data['delivery'][4] = $data['delivery'][3]; |
|
|
|
$tmp_data -= $data['delivery'][3]; |
|
|
|
} else { |
|
|
|
$data['delivery'][4] = $tmp_data; |
|
|
|
$tmp_data = 0; |
|
|
|
} |
|
|
|
$data['delivery'][5] = $data['delivery'][3] - $data['delivery'][4]; |
|
|
|
} else { |
|
|
|
$data['delivery'][4] = 0; |
|
|
|
$data['delivery'][5] = $data['delivery'][3]; |
|
|
|
} |
|
|
|
if ($tmp_invoice > 0) { |
|
|
|
if (($tmp_invoice - $data['delivery'][3]) >= 0) { |
|
|
|
$data['delivery'][6] = $data['delivery'][3]; |
|
|
|
$tmp_invoice -= $data['delivery'][3]; |
|
|
|
} else { |
|
|
|
$data['delivery'][6] = $tmp_invoice; |
|
|
|
$tmp_invoice = 0; |
|
|
|
} |
|
|
|
$data['delivery'][7] = $data['delivery'][3] - $data['delivery'][6]; |
|
|
|
} else { |
|
|
|
$data['delivery'][6] = 0; |
|
|
|
$data['delivery'][7] = $data['delivery'][3]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$data['delivery'][4] = 0; |
|
|
|
$data['delivery'][5] = 0; |
|
|
|
$data['delivery'][6] = 0; |
|
|
|
$data['delivery'][7] = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if ($data['final'][3] > 0) { |
|
|
|
if ($tmp_data > 0) { |
|
|
|
if (($tmp_data - $data['final'][1]) >= 0) { |
|
|
|
$data['final'][4] = $data['final'][3]; |
|
|
|
$tmp_data -= $data['final'][3]; |
|
|
|
} else { |
|
|
|
$data['final'][4] = $tmp_data; |
|
|
|
$tmp_data = 0; |
|
|
|
} |
|
|
|
$data['final'][5] = $data['final'][3] - $data['final'][4]; |
|
|
|
} else { |
|
|
|
$data['final'][4] = 0; |
|
|
|
$data['final'][5] = $data['final'][3]; |
|
|
|
} |
|
|
|
if ($tmp_invoice > 0) { |
|
|
|
if (($tmp_invoice - $data['final'][3]) >= 0) { |
|
|
|
$data['final'][6] = $data['final'][3]; |
|
|
|
$tmp_invoice -= $data['final'][3]; |
|
|
|
} else { |
|
|
|
$data['final'][6] = $tmp_invoice; |
|
|
|
$tmp_invoice = 0; |
|
|
|
} |
|
|
|
$data['final'][7] = $data['final'][3] - $data['final'][6]; |
|
|
|
} else { |
|
|
|
$data['final'][6] = 0; |
|
|
|
$data['final'][7] = $data['final'][3]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$data['final'][4] = 0; |
|
|
|
$data['final'][5] = 0; |
|
|
|
$data['final'][6] = 0; |
|
|
|
$data['final'][7] = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//產生excel的array |
|
|
|
$excel_aray = array(); |
|
|
@ -1636,10 +1252,7 @@ $facility_array = array(); |
|
|
|
$facility_boga_array = array(); |
|
|
|
$facility_exclude_boga_array = array(); |
|
|
|
foreach ($arrayData as $key => $value) { |
|
|
|
$sum_A40001 += $value['A40001']; |
|
|
|
$sum_A40008 += $value['A40008']; |
|
|
|
$sum_total_budget += $value['total_budget']; |
|
|
|
$sum_facility += $value['total_facility_num']; |
|
|
|
|
|
|
|
$value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0; |
|
|
|
$value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0; |
|
|
|
$value['arrive'][3] = (isset($value['arrive'][3])) ? $value['arrive'][3] : 0; |
|
|
@ -1654,52 +1267,49 @@ foreach ($arrayData as $key => $value) { |
|
|
|
$value[$i]['min'] = (empty($value[$i]['min']) || is_null($value[$i]['min'])) ? 0 : $value[$i]['min']; |
|
|
|
$value[$i][4] = (isset($value[$i][4])) ? $value[$i][4] : 0; |
|
|
|
$value[$i][5] = (isset($value[$i][5])) ? $value[$i][5] : 0; |
|
|
|
$value[$i][4] = (isset($value[$i][4])) ? $value[$i][4] : 0; |
|
|
|
$value[$i][5] = (isset($value[$i][5])) ? $value[$i][5] : 0; |
|
|
|
}; |
|
|
|
|
|
|
|
if ($value['sign'][0] == "寶佳出貨前30天") { |
|
|
|
$boga_array[$key] = [ |
|
|
|
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], |
|
|
|
number_format(round($value['sign'][1])), number_format(round($value['sign'][3])), number_format(round($value['sign'][6])), number_format(round($value['sign'][7])), number_format(round($value['sign'][4])), number_format(round($value['sign'][5])), $value['sign']['max'], $value['sign']['min'], |
|
|
|
number_format(round($value['second'][1])), number_format(round($value['second'][3])), number_format(round($value['second'][6])), number_format(round($value['second'][7])), number_format(round($value['second'][4])), number_format(round($value['second'][5])), $value['second']['max'], $value['second']['min'], |
|
|
|
number_format(round($value['arrive'][1])), number_format(round($value['arrive'][3])), number_format(round($value['arrive'][6])), number_format(round($value['arrive'][7])), number_format(round($value['arrive'][4])), number_format(round($value['arrive'][5])), $value['arrive']['max'], $value['arrive']['min'], |
|
|
|
number_format(round($value['install'][1])), number_format(round($value['install'][3])), number_format(round($value['install'][6])), number_format(round($value['install'][7])), number_format(round($value['install'][4])), number_format(round($value['install'][5])), $value['install']['max'], $value['install']['min'], |
|
|
|
number_format(round($value['tryrun'][1])), number_format(round($value['tryrun'][3])), number_format(round($value['tryrun'][6])), number_format(round($value['tryrun'][7])), number_format(round($value['tryrun'][4])), number_format(round($value['tryrun'][5])), $value['tryrun']['max'], $value['tryrun']['min'], |
|
|
|
number_format(round($value['check'][1])), number_format(round($value['check'][3])), number_format(round($value['check'][6])), number_format(round($value['check'][7])), number_format(round($value['check'][4])), number_format(round($value['check'][5])), $value['check']['max'], $value['check']['min'], |
|
|
|
number_format(round($value['delivery'][1])), number_format(round($value['delivery'][3])), number_format(round($value['delivery'][6])), number_format(round($value['delivery'][7])), number_format(round($value['delivery'][4])), number_format(round($value['delivery'][5])), $value['delivery']['max'], $value['delivery']['min'], |
|
|
|
number_format(round($value['final'][1])), number_format(round($value['final'][3])), number_format(round($value['final'][6])), number_format(round($value['final'][7])), number_format(round($value['final'][4])), number_format(round($value['final'][5])), $value['final']['max'], $value['final']['min'], |
|
|
|
number_format(round($value['A40001'])), number_format(round($value['A40008'])), number_format(round($value['total_budget'])), number_format(round($value['receivable_budget'])), number_format(round($value['invoice_budget'])), number_format(round($value['received_budget'])), $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities']) |
|
|
|
round($value['sign'][1]), round($value['sign'][3]), round($value['sign'][6]), round($value['sign'][7]), round($value['sign'][4]), round($value['sign'][5]), $value['sign']['max'], $value['sign']['min'], |
|
|
|
round($value['second'][1]), round($value['second'][3]), round($value['second'][6]), round($value['second'][7]), round($value['second'][4]), round($value['second'][5]), $value['second']['max'], $value['second']['min'], |
|
|
|
round($value['arrive'][1]), round($value['arrive'][3]), round($value['arrive'][6]), round($value['arrive'][7]), round($value['arrive'][4]), round($value['arrive'][5]), $value['arrive']['max'], $value['arrive']['min'], |
|
|
|
round($value['install'][1]), round($value['install'][3]), round($value['install'][6]), round($value['install'][7]), round($value['install'][4]), round($value['install'][5]), $value['install']['max'], $value['install']['min'], |
|
|
|
round($value['tryrun'][1]), round($value['tryrun'][3]), round($value['tryrun'][6]), round($value['tryrun'][7]), round($value['tryrun'][4]), round($value['tryrun'][5]), $value['tryrun']['max'], $value['tryrun']['min'], |
|
|
|
round($value['check'][1]), round($value['check'][3]), round($value['check'][6]), round($value['check'][7]), round($value['check'][4]), round($value['check'][5]), $value['check']['max'], $value['check']['min'], |
|
|
|
round($value['delivery'][1]), round($value['delivery'][3]), round($value['delivery'][6]), round($value['delivery'][7]), round($value['delivery'][4]), round($value['delivery'][5]), $value['delivery']['max'], $value['delivery']['min'], |
|
|
|
round($value['final'][1]), round($value['final'][3]), round($value['final'][6]), round($value['final'][7]), round($value['final'][4]), round($value['final'][5]), $value['final']['max'], $value['final']['min'], |
|
|
|
round($value['total_budget']), round($value['receivable_budget']), round($value['invoice_budget']), round($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], |
|
|
|
number_format(round($value['sign'][1])), number_format(round($value['sign'][3])), number_format(round($value['sign'][6])), number_format(round($value['sign'][7])), number_format(round($value['sign'][4])), number_format(round($value['sign'][5])), $value['sign']['max'], $value['sign']['min'], |
|
|
|
number_format(round($value['second'][1])), number_format(round($value['second'][3])), number_format(round($value['second'][6])), number_format(round($value['second'][7])), number_format(round($value['second'][4])), number_format(round($value['second'][5])), $value['second']['max'], $value['second']['min'], |
|
|
|
number_format(round($value['arrive'][1])), number_format(round($value['arrive'][3])), number_format(round($value['arrive'][6])), number_format(round($value['arrive'][7])), number_format(round($value['arrive'][4])), number_format(round($value['arrive'][5])), $value['arrive']['max'], $value['arrive']['min'], |
|
|
|
number_format(round($value['install'][1])), number_format(round($value['install'][3])), number_format(round($value['install'][6])), number_format(round($value['install'][7])), number_format(round($value['install'][4])), number_format(round($value['install'][5])), $value['install']['max'], $value['install']['min'], |
|
|
|
number_format(round($value['tryrun'][1])), number_format(round($value['tryrun'][3])), number_format(round($value['tryrun'][6])), number_format(round($value['tryrun'][7])), number_format(round($value['tryrun'][4])), number_format(round($value['tryrun'][5])), $value['tryrun']['max'], $value['tryrun']['min'], |
|
|
|
number_format(round($value['check'][1])), number_format(round($value['check'][3])), number_format(round($value['check'][6])), number_format(round($value['check'][7])), number_format(round($value['check'][4])), number_format(round($value['check'][5])), $value['check']['max'], $value['check']['min'], |
|
|
|
number_format(round($value['delivery'][1])), number_format(round($value['delivery'][3])), number_format(round($value['delivery'][6])), number_format(round($value['delivery'][7])), number_format(round($value['delivery'][4])), number_format(round($value['delivery'][5])), $value['delivery']['max'], $value['delivery']['min'], |
|
|
|
number_format(round($value['final'][1])), number_format(round($value['final'][3])), number_format(round($value['final'][6])), number_format(round($value['final'][7])), number_format(round($value['final'][4])), number_format(round($value['final'][5])), $value['final']['max'], $value['final']['min'], |
|
|
|
number_format(round($value['A40001'])), number_format(round($value['A40008'])), number_format(round($value['total_budget'])), number_format(round($value['receivable_budget'])), number_format(round($value['invoice_budget'])), number_format(round($value['received_budget'])), $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities']) |
|
|
|
round($value['sign'][1]), round($value['sign'][3]), round($value['sign'][6]), round($value['sign'][7]), round($value['sign'][4]), round($value['sign'][5]), $value['sign']['max'], $value['sign']['min'], |
|
|
|
round($value['second'][1]), round($value['second'][3]), round($value['second'][6]), round($value['second'][7]), round($value['second'][4]), round($value['second'][5]), $value['second']['max'], $value['second']['min'], |
|
|
|
round($value['arrive'][1]), round($value['arrive'][3]), round($value['arrive'][6]), round($value['arrive'][7]), round($value['arrive'][4]), round($value['arrive'][5]), $value['arrive']['max'], $value['arrive']['min'], |
|
|
|
round($value['install'][1]), round($value['install'][3]), round($value['install'][6]), round($value['install'][7]), round($value['install'][4]), round($value['install'][5]), $value['install']['max'], $value['install']['min'], |
|
|
|
round($value['tryrun'][1]), round($value['tryrun'][3]), round($value['tryrun'][6]), round($value['tryrun'][7]), round($value['tryrun'][4]), round($value['tryrun'][5]), $value['tryrun']['max'], $value['tryrun']['min'], |
|
|
|
round($value['check'][1]), round($value['check'][3]), round($value['check'][6]), round($value['check'][7]), round($value['check'][4]), round($value['check'][5]), $value['check']['max'], $value['check']['min'], |
|
|
|
round($value['delivery'][1]), round($value['delivery'][3]), round($value['delivery'][6]), round($value['delivery'][7]), round($value['delivery'][4]), round($value['delivery'][5]), $value['delivery']['max'], $value['delivery']['min'], |
|
|
|
round($value['final'][1]), round($value['final'][3]), round($value['final'][6]), round($value['final'][7]), round($value['final'][4]), round($value['final'][5]), $value['final']['max'], $value['final']['min'], |
|
|
|
round($value['total_budget']), round($value['receivable_budget']), round($value['invoice_budget']), round($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], |
|
|
|
number_format(round($value['sign'][1])), number_format(round($value['sign'][3])), number_format(round($value['sign'][6])), number_format(round($value['sign'][7])), number_format(round($value['sign'][4])), number_format(round($value['sign'][5])), $value['sign']['max'], $value['sign']['min'], |
|
|
|
number_format(round($value['second'][1])), number_format(round($value['second'][3])), number_format(round($value['second'][6])), number_format(round($value['second'][7])), number_format(round($value['second'][4])), number_format(round($value['second'][5])), $value['second']['max'], $value['second']['min'], |
|
|
|
number_format(round($value['arrive'][1])), number_format(round($value['arrive'][3])), number_format(round($value['arrive'][6])), number_format(round($value['arrive'][7])), number_format(round($value['arrive'][4])), number_format(round($value['arrive'][5])), $value['arrive']['max'], $value['arrive']['min'], |
|
|
|
number_format(round($value['install'][1])), number_format(round($value['install'][3])), number_format(round($value['install'][6])), number_format(round($value['install'][7])), number_format(round($value['install'][4])), number_format(round($value['install'][5])), $value['install']['max'], $value['install']['min'], |
|
|
|
number_format(round($value['tryrun'][1])), number_format(round($value['tryrun'][3])), number_format(round($value['tryrun'][6])), number_format(round($value['tryrun'][7])), number_format(round($value['tryrun'][4])), number_format(round($value['tryrun'][5])), $value['tryrun']['max'], $value['tryrun']['min'], |
|
|
|
number_format(round($value['check'][1])), number_format(round($value['check'][3])), number_format(round($value['check'][6])), number_format(round($value['check'][7])), number_format(round($value['check'][4])), number_format(round($value['check'][5])), $value['check']['max'], $value['check']['min'], |
|
|
|
number_format(round($value['delivery'][1])), number_format(round($value['delivery'][3])), number_format(round($value['delivery'][6])), number_format(round($value['delivery'][7])), number_format(round($value['delivery'][4])), number_format(round($value['delivery'][5])), $value['delivery']['max'], $value['delivery']['min'], |
|
|
|
number_format(round($value['final'][1])), number_format(round($value['final'][3])), number_format(round($value['final'][6])), number_format(round($value['final'][7])), number_format(round($value['final'][4])), number_format(round($value['final'][5])), $value['final']['max'], $value['final']['min'], |
|
|
|
number_format(round($value['A40001'])), number_format(round($value['A40008'])), number_format(round($value['total_budget'])), number_format(round($value['receivable_budget'])), number_format(round($value['invoice_budget'])), number_format(round($value['received_budget'])), $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities']) |
|
|
|
round($value['sign'][1]), round($value['sign'][3]), round($value['sign'][6]), round($value['sign'][7]), round($value['sign'][4]), round($value['sign'][5]), $value['sign']['max'], $value['sign']['min'], |
|
|
|
round($value['second'][1]), round($value['second'][3]), round($value['second'][6]), round($value['second'][7]), round($value['second'][4]), round($value['second'][5]), $value['second']['max'], $value['second']['min'], |
|
|
|
round($value['arrive'][1]), round($value['arrive'][3]), round($value['arrive'][6]), round($value['arrive'][7]), round($value['arrive'][4]), round($value['arrive'][5]), $value['arrive']['max'], $value['arrive']['min'], |
|
|
|
round($value['install'][1]), round($value['install'][3]), round($value['install'][6]), round($value['install'][7]), round($value['install'][4]), round($value['install'][5]), $value['install']['max'], $value['install']['min'], |
|
|
|
round($value['tryrun'][1]), round($value['tryrun'][3]), round($value['tryrun'][6]), round($value['tryrun'][7]), round($value['tryrun'][4]), round($value['tryrun'][5]), $value['tryrun']['max'], $value['tryrun']['min'], |
|
|
|
round($value['check'][1]), round($value['check'][3]), round($value['check'][6]), round($value['check'][7]), round($value['check'][4]), round($value['check'][5]), $value['check']['max'], $value['check']['min'], |
|
|
|
round($value['delivery'][1]), round($value['delivery'][3]), round($value['delivery'][6]), round($value['delivery'][7]), round($value['delivery'][4]), round($value['delivery'][5]), $value['delivery']['max'], $value['delivery']['min'], |
|
|
|
round($value['final'][1]), round($value['final'][3]), round($value['final'][6]), round($value['final'][7]), round($value['final'][4]), round($value['final'][5]), $value['final']['max'], $value['final']['min'], |
|
|
|
round($value['total_budget']), round($value['receivable_budget']), round($value['invoice_budget']), round($value['received_budget']), $value['total_facility_num'], str_replace('<br>', '; ', $value['facilities']) |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份 |
|
|
|
//[合約號]['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 |
|
|
|
foreach ($value['facility'] as $valkey => $val) { |
|
|
@ -1714,48 +1324,45 @@ foreach ($arrayData as $key => $value) { |
|
|
|
} |
|
|
|
$facility_array[$valkey] = [ |
|
|
|
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], |
|
|
|
$val['sign'][0], number_format(round($val['sign'][1])), $val['sign'][2], number_format(round($val['sign'][3])), number_format(round($val['sign'][4])), number_format(round($val['sign'][5])), $val['sign'][6], |
|
|
|
$val['second'][0], number_format(round($val['second'][1])), $val['second'][2], number_format(round($val['second'][3])), number_format(round($val['second'][4])), number_format(round($val['second'][5])), $val['second'][6], |
|
|
|
$val['arrive'][0], number_format(round($val['arrive'][1])), $val['arrive'][2], number_format(round($val['arrive'][3])), number_format(round($val['arrive'][4])), number_format(round($val['arrive'][5])), $val['arrive'][6], |
|
|
|
$val['install'][0], number_format(round($val['install'][1])), $val['install'][2], number_format(round($val['install'][3])), number_format(round($val['install'][4])), number_format(round($val['install'][5])), $val['install'][6], |
|
|
|
$val['tryrun'][0], number_format(round($val['tryrun'][1])), $val['tryrun'][2], number_format(round($val['tryrun'][3])), number_format(round($val['tryrun'][4])), number_format(round($val['tryrun'][5])), $val['tryrun'][6], |
|
|
|
$val['check'][0], number_format(round($val['check'][1])), $val['check'][2], number_format(round($val['check'][3])), number_format(round($val['check'][4])), number_format(round($val['check'][5])), $val['check'][6], |
|
|
|
$val['delivery'][0], number_format(round($val['delivery'][1])), $val['delivery'][2], number_format(round($val['delivery'][3])), number_format(round($val['delivery'][4])), number_format(round($val['delivery'][5])), $val['delivery'][6], |
|
|
|
$val['final'][0], number_format(round($val['final'][1])), $val['final'][2], number_format(round($val['final'][3])), number_format(round($val['final'][4])), number_format(round($val['final'][5])), $val['final'][6], |
|
|
|
str_replace('<br>', '; ', $val['status']), number_format(round($val['A40001'])), number_format(round($val['A40008'])), number_format(round($val['total_budget'])), number_format(round($val['receivable_budget'])) |
|
|
|
$val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][6], |
|
|
|
$val['second'][0], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][6], |
|
|
|
$val['arrive'][0], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][6], |
|
|
|
$val['install'][0], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][6], |
|
|
|
$val['tryrun'][0], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][6], |
|
|
|
$val['check'][0], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][6], |
|
|
|
$val['delivery'][0], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][6], |
|
|
|
$val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6], |
|
|
|
str_replace('<br>', '; ', $val['status']), $val['total_budget'], $val['receivable_budget'] |
|
|
|
]; |
|
|
|
if ($value['sign'][0] == "寶佳出貨前30天") { |
|
|
|
$facility_boga_array[$valkey] = [ |
|
|
|
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], |
|
|
|
$val['sign'][0], number_format(round($val['sign'][1])), $val['sign'][2], number_format(round($val['sign'][3])), number_format(round($val['sign'][4])), number_format(round($val['sign'][5])), $val['sign'][6], |
|
|
|
$val['second'][0], number_format(round($val['second'][1])), $val['second'][2], number_format(round($val['second'][3])), number_format(round($val['second'][4])), number_format(round($val['second'][5])), $val['second'][6], |
|
|
|
$val['arrive'][0], number_format(round($val['arrive'][1])), $val['arrive'][2], number_format(round($val['arrive'][3])), number_format(round($val['arrive'][4])), number_format(round($val['arrive'][5])), $val['arrive'][6], |
|
|
|
$val['install'][0], number_format(round($val['install'][1])), $val['install'][2], number_format(round($val['install'][3])), number_format(round($val['install'][4])), number_format(round($val['install'][5])), $val['install'][6], |
|
|
|
$val['tryrun'][0], number_format(round($val['tryrun'][1])), $val['tryrun'][2], number_format(round($val['tryrun'][3])), number_format(round($val['tryrun'][4])), number_format(round($val['tryrun'][5])), $val['tryrun'][6], |
|
|
|
$val['check'][0], number_format(round($val['check'][1])), $val['check'][2], number_format(round($val['check'][3])), number_format(round($val['check'][4])), number_format(round($val['check'][5])), $val['check'][6], |
|
|
|
$val['delivery'][0], number_format(round($val['delivery'][1])), $val['delivery'][2], number_format(round($val['delivery'][3])), number_format(round($val['delivery'][4])), number_format(round($val['delivery'][5])), $val['delivery'][6], |
|
|
|
$val['final'][0], number_format(round($val['final'][1])), $val['final'][2], number_format(round($val['final'][3])), number_format(round($val['final'][4])), number_format(round($val['final'][5])), $val['final'][6], |
|
|
|
str_replace('<br>', '; ', $val['status']), number_format(round($val['A40001'])), number_format(round($val['A40008'])), number_format(round($val['total_budget'])), number_format(round($val['receivable_budget'])) |
|
|
|
$val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][6], |
|
|
|
$val['second'][0], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][6], |
|
|
|
$val['arrive'][0], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][6], |
|
|
|
$val['install'][0], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][6], |
|
|
|
$val['tryrun'][0], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][6], |
|
|
|
$val['check'][0], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][6], |
|
|
|
$val['delivery'][0], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][6], |
|
|
|
$val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6], |
|
|
|
str_replace('<br>', '; ', $val['status']), $val['total_budget'], $val['receivable_budget'] |
|
|
|
]; |
|
|
|
} else { |
|
|
|
$facility_exclude_boga_array[$valkey] = [ |
|
|
|
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], |
|
|
|
$val['sign'][0], number_format(round($val['sign'][1])), $val['sign'][2], number_format(round($val['sign'][3])), number_format(round($val['sign'][4])), number_format(round($val['sign'][5])), $val['sign'][6], |
|
|
|
$val['second'][0], number_format(round($val['second'][1])), $val['second'][2], number_format(round($val['second'][3])), number_format(round($val['second'][4])), number_format(round($val['second'][5])), $val['second'][6], |
|
|
|
$val['arrive'][0], number_format(round($val['arrive'][1])), $val['arrive'][2], number_format(round($val['arrive'][3])), number_format(round($val['arrive'][4])), number_format(round($val['arrive'][5])), $val['arrive'][6], |
|
|
|
$val['install'][0], number_format(round($val['install'][1])), $val['install'][2], number_format(round($val['install'][3])), number_format(round($val['install'][4])), number_format(round($val['install'][5])), $val['install'][6], |
|
|
|
$val['tryrun'][0], number_format(round($val['tryrun'][1])), $val['tryrun'][2], number_format(round($val['tryrun'][3])), number_format(round($val['tryrun'][4])), number_format(round($val['tryrun'][5])), $val['tryrun'][6], |
|
|
|
$val['check'][0], number_format(round($val['check'][1])), $val['check'][2], number_format(round($val['check'][3])), number_format(round($val['check'][4])), number_format(round($val['check'][5])), $val['check'][6], |
|
|
|
$val['delivery'][0], number_format(round($val['delivery'][1])), $val['delivery'][2], number_format(round($val['delivery'][3])), number_format(round($val['delivery'][4])), number_format(round($val['delivery'][5])), $val['delivery'][6], |
|
|
|
$val['final'][0], number_format(round($val['final'][1])), $val['final'][2], number_format(round($val['final'][3])), number_format(round($val['final'][4])), number_format(round($val['final'][5])), $val['final'][6], |
|
|
|
str_replace('<br>', '; ', $val['status']), number_format(round($val['A40001'])), number_format(round($val['A40008'])), number_format(round($val['total_budget'])), number_format(round($val['receivable_budget'])) |
|
|
|
$val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][6], |
|
|
|
$val['second'][0], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][6], |
|
|
|
$val['arrive'][0], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][6], |
|
|
|
$val['install'][0], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][6], |
|
|
|
$val['tryrun'][0], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][6], |
|
|
|
$val['check'][0], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][6], |
|
|
|
$val['delivery'][0], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][6], |
|
|
|
$val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6], |
|
|
|
str_replace('<br>', '; ', $val['status']), $val['total_budget'], $val['receivable_budget'] |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$average_A40001 = round($sum_A40001 / $sum_facility, 2); |
|
|
|
$average_A40008 = round($sum_A40008 / $sum_facility, 2); |
|
|
|
$average_budget = round($sum_total_budget / $sum_facility, 2); |
|
|
|
|
|
|
|
$total_data = json_encode($excel_aray); |
|
|
|
$boga_data = json_encode($boga_array); |
|
|
@ -1819,51 +1426,6 @@ $facility_exclude_boga_data = json_encode($facility_exclude_boga_array); |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="container"> |
|
|
|
<div class="text-center" style="margin-bottom: 20px;"> |
|
|
|
<h3><strong>合約 (新梯)統整資訊</strong></h3> |
|
|
|
</div> |
|
|
|
<form class="form-horizontal"> |
|
|
|
<div class="form-group"> |
|
|
|
<div class="col-md-3"> |
|
|
|
<label for="sum_total_budget">合約總金額</label> |
|
|
|
<input type="text" class="form-control" id="sum_total_budget" name="sum_total_budget" value="<?= number_format($sum_total_budget) ?>" disabled> |
|
|
|
</div> |
|
|
|
<div class="col-md-3"> |
|
|
|
<label for="sum_A40001">合約設備總金額</label> |
|
|
|
<input type="text" class="form-control" id="sum_A40001" name="sum_A40001" value="<?= number_format($sum_A40001) ?>" disabled> |
|
|
|
</div> |
|
|
|
<div class="col-md-3"> |
|
|
|
<label for="sum_A40008">合約安裝總金額</label> |
|
|
|
<input type="text" class="form-control" id="sum_A40008" name="sum_A40008" value="<?= number_format($sum_A40008) ?>" disabled> |
|
|
|
</div> |
|
|
|
<div class="col-md-3"> |
|
|
|
<label for="sum_facility">總台數</label> |
|
|
|
<input type="text" class="form-control" id="sum_facility" name="sum_facility" value="<?= number_format($sum_facility) ?>" disabled> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<div class="col-md-3"> |
|
|
|
<label for="average_budget">平均金額</label> |
|
|
|
<input type="text" class="form-control" id="average_budget" name="average_budget" value="<?= number_format($average_budget) ?>" disabled> |
|
|
|
</div> |
|
|
|
<div class="col-md-3"> |
|
|
|
<label for="average_A40001">設備平均金額</label> |
|
|
|
<input type="text" class="form-control" id="average_A40001" name="average_A40001" value="<?= number_format($average_A40001) ?>" disabled> |
|
|
|
</div> |
|
|
|
<div class="col-md-3"> |
|
|
|
<label for="average_A40008">安裝平均金額</label> |
|
|
|
<input type="text" class="form-control" id="average_A40008" name="average_A40008" value="<?= number_format($average_A40008) ?>" disabled> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
</div> |
|
|
|
|
|
|
|
<?php |
|
|
|
include "./footer.php"; |
|
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
<div style="width:98%;margin:1% ;overflow-x: auto;"> |
|
|
|
<table id="table_index" class="table table-striped table-bordered" style="width:100%;"> |
|
|
|
<thead> |
|
|
@ -1973,6 +1535,7 @@ include "./footer.php"; |
|
|
|
<script> |
|
|
|
function showContract(BillNo) { |
|
|
|
window.open('account-receivable-contract.php?BillNo=' + BillNo + '&<?= $token_link ?>', '發票範例', config = 'height=600, width=1200'); |
|
|
|
console.log(BillNo); |
|
|
|
} |
|
|
|
|
|
|
|
function test() { |
|
|
@ -2015,6 +1578,7 @@ include "./footer.php"; |
|
|
|
} |
|
|
|
|
|
|
|
function bogaData() { |
|
|
|
console.log(<?= $boga_data ?>); |
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
|
var url = window.location.origin + "/wms/account-receivable-excel.php?type=boga&<?= $token_link ?>"; |
|
|
|
xhr.open('POST', url, true); |
|
|
|