@ -1,6 +1,15 @@
<?php
<?php
include "header.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);
$follower = find_follow($user_id);
$arrayData = [];
$arrayData = [];
$receivable_array = [];
$receivable_array = [];
@ -40,7 +49,7 @@ LEFT JOIN comBusinessPartner AS c ON s.BizPartnerId=c.BizPartnerId
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) ";
WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) ";
// T8 銷售訂單 作番金額
// T8 銷售訂單 作番金額
$sql_contract_budget = "SELECT A.BillNo, A.OAmountWithTax,A.CU_MaterialId FROM salSalesOrderDetail AS A
$sql_contract_budget = "SELECT A.BillNo, A.OAmountWithTax,A.CU_MaterialId, A.MaterialId FROM salSalesOrderDetail AS A
LEFT JOIN salSalesOrder AS B ON A.BillNo=B.BillNo
LEFT JOIN salSalesOrder AS B ON A.BillNo=B.BillNo
WHERE B.ModeId='M' AND A.ItemType=1 ";
WHERE B.ModeId='M' AND A.ItemType=1 ";
@ -129,10 +138,16 @@ foreach ($contract_budget_data as $cont) {
$contract_budget[$cont['BillNo']]['total'] = $cont['OAmountWithTax'];
$contract_budget[$cont['BillNo']]['total'] = $cont['OAmountWithTax'];
}
}
if (isset($contract_budget[$cont['BillNo']][$cont['CU_MaterialId']])) {
if (isset($contract_budget[$cont['BillNo']][$cont['CU_MaterialId']])) {
$contract_budget[$cont['BillNo']][$cont['CU_MaterialId']] += $cont['OAmountWithTax'];
$contract_budget[$cont['BillNo']][$cont['CU_MaterialId']]['total'] += $cont['OAmountWithTax'];
} else {
} else {
$contract_budget[$cont['BillNo']][$cont['CU_MaterialId']] = $cont['OAmountWithTax'];
$contract_budget[$cont['BillNo']][$cont['CU_MaterialId']]['total'] = $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'];
}
}
/* 計算比例
/* 計算比例
@ -147,8 +162,8 @@ function get_ratio($facility_list, $contract_no, $contract_budget)
return 0;
return 0;
} else {
} else {
foreach ($facility_list as $every) {
foreach ($facility_list as $every) {
if (isset($contract_budget[$contract_no][$every]) & & isset($contract_budget[$contract_no]['total'])) {
if (isset($contract_budget[$contract_no][$every]['total'] ) & & isset($contract_budget[$contract_no]['total'])) {
$ratio += $contract_budget[$contract_no][$every] / $contract_budget[$contract_no]['total'];
$ratio += $contract_budget[$contract_no][$every]['total'] / $contract_budget[$contract_no]['total'];
}
}
}
}
return $ratio;
return $ratio;
@ -285,12 +300,16 @@ foreach ($wipwhole_array as $wip) {
$arrayData[$wip['contractno']][4] = $wip['name'];
$arrayData[$wip['contractno']][4] = $wip['name'];
$arrayData[$wip['contractno']][10] = $wip['contractno'];
$arrayData[$wip['contractno']][10] = $wip['contractno'];
$arrayData[$wip['contractno']]['total_facility_num'] += 1;
$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']
// [合約號]['facility'][作番號]['no']
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['no'] = $wip['facilityno'];
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['no'] = $wip['facilityno'];
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = "";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = "";
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['total_budget'] = 0;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['total_budget'] = 0;
$arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['receivable_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']]['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'] [金額]/[合約預計收款日期]
// [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期]
// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期]
// [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期]
@ -881,8 +900,8 @@ foreach ($arrayData as &$value) {
foreach ($contractstage as $stage) {
foreach ($contractstage as $stage) {
if (isset($value[$stage][0]) & & !empty($value[$stage][0])) {
if (isset($value[$stage][0]) & & !empty($value[$stage][0])) {
$val[$stage][0] = $value[$stage][0];
$val[$stage][0] = $value[$stage][0];
if (isset($contract_budget[$value[10]]['total']) & & isset($contract_budget[$value[10]][$val['no']])) {
if (isset($contract_budget[$value[10]]['total']) & & isset($contract_budget[$value[10]][$val['no']]['total'] )) {
$ratio = $contract_budget[$value[10]][$val['no']] / $contract_budget[$value[10]]['total'];
$ratio = $contract_budget[$value[10]][$val['no']]['total'] / $contract_budget[$value[10]]['total'];
} else {
} else {
$ratio = 0;
$ratio = 0;
}
}
@ -1252,7 +1271,10 @@ $facility_array = array();
$facility_boga_array = array();
$facility_boga_array = array();
$facility_exclude_boga_array = array();
$facility_exclude_boga_array = array();
foreach ($arrayData as $key => $value) {
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['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0;
$value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0;
$value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0;
$value['arrive'][3] = (isset($value['arrive'][3])) ? $value['arrive'][3] : 0;
$value['arrive'][3] = (isset($value['arrive'][3])) ? $value['arrive'][3] : 0;
@ -1272,42 +1294,42 @@ foreach ($arrayData as $key => $value) {
if ($value['sign'][0] == "寶佳出貨前30天") {
if ($value['sign'][0] == "寶佳出貨前30天") {
$boga_array[$key] = [
$boga_array[$key] = [
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$value['sign'][1], $value['sign'][3], $value['sign'][6], $value['sign'][7], $value['sign'][4], $value['sign'][5], $value['sign']['max'], $value['sign']['min'],
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'],
$value['second'][1], $value['second'][3], $value['second'][6], $value['second'][7], $value['second'][4], $value['second'][5], $value['second']['max'], $value['second']['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'],
$value['arrive'][1], $value['arrive'][3], $value['arrive'][6], $value['arrive'][7], $value['arrive'][4], $value['arrive'][5], $value['arrive']['max'], $value['arrive']['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'],
$value['install'][1], $value['install'][3], $value['install'][6], $value['install'][7], $value['install'][4], $value['install'][5], $value['install']['max'], $value['install']['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'],
$value['tryrun'][1], $value['tryrun'][3], $value['tryrun'][6], $value['tryrun'][7], $value['tryrun'][4], $value['tryrun'][5], $value['tryrun']['max'], $value['tryrun']['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'],
$value['check'][1], $value['check'][3], $value['check'][6], $value['check'][7], $value['check'][4], $value['check'][5], $value['check']['max'], $value['check']['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'],
$value['delivery'][1], $value['delivery'][3], $value['delivery'][6], $value['delivery'][7], $value['delivery'][4], $value['delivery'][5], $value['delivery']['max'], $value['delivery']['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'],
$value['final'][1], $value['final'][3], $value['final'][6], $value['final'][7], $value['final'][4], $value['final'][5], $value['final']['max'], $value['final']['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'],
$value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], $value['total_facility_num'], str_replace('< br > ', '; ', $value['facilities'])
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'])
];
];
} else {
} else {
$exclude_boga_array[$key] = [
$exclude_boga_array[$key] = [
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$value['sign'][1], $value['sign'][3], $value['sign'][6], $value['sign'][7], $value['sign'][4], $value['sign'][5], $value['sign']['max'], $value['sign']['min'],
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'],
$value['second'][1], $value['second'][3], $value['second'][6], $value['second'][7], $value['second'][4], $value['second'][5], $value['second']['max'], $value['second']['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'],
$value['arrive'][1], $value['arrive'][3], $value['arrive'][6], $value['arrive'][7], $value['arrive'][4], $value['arrive'][5], $value['arrive']['max'], $value['arrive']['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'],
$value['install'][1], $value['install'][3], $value['install'][6], $value['install'][7], $value['install'][4], $value['install'][5], $value['install']['max'], $value['install']['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'],
$value['tryrun'][1], $value['tryrun'][3], $value['tryrun'][6], $value['tryrun'][7], $value['tryrun'][4], $value['tryrun'][5], $value['tryrun']['max'], $value['tryrun']['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'],
$value['check'][1], $value['check'][3], $value['check'][6], $value['check'][7], $value['check'][4], $value['check'][5], $value['check']['max'], $value['check']['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'],
$value['delivery'][1], $value['delivery'][3], $value['delivery'][6], $value['delivery'][7], $value['delivery'][4], $value['delivery'][5], $value['delivery']['max'], $value['delivery']['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'],
$value['final'][1], $value['final'][3], $value['final'][6], $value['final'][7], $value['final'][4], $value['final'][5], $value['final']['max'], $value['final']['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'],
$value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], $value['total_facility_num'], str_replace('< br > ', '; ', $value['facilities'])
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'])
];
];
}
}
$excel_aray[$key] = [
$excel_aray[$key] = [
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$value['sign'][1], $value['sign'][3], $value['sign'][6], $value['sign'][7], $value['sign'][4], $value['sign'][5], $value['sign']['max'], $value['sign']['min'],
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'],
$value['second'][1], $value['second'][3], $value['second'][6], $value['second'][7], $value['second'][4], $value['second'][5], $value['second']['max'], $value['second']['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'],
$value['arrive'][1], $value['arrive'][3], $value['arrive'][6], $value['arrive'][7], $value['arrive'][4], $value['arrive'][5], $value['arrive']['max'], $value['arrive']['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'],
$value['install'][1], $value['install'][3], $value['install'][6], $value['install'][7], $value['install'][4], $value['install'][5], $value['install']['max'], $value['install']['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'],
$value['tryrun'][1], $value['tryrun'][3], $value['tryrun'][6], $value['tryrun'][7], $value['tryrun'][4], $value['tryrun'][5], $value['tryrun']['max'], $value['tryrun']['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'],
$value['check'][1], $value['check'][3], $value['check'][6], $value['check'][7], $value['check'][4], $value['check'][5], $value['check']['max'], $value['check']['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'],
$value['delivery'][1], $value['delivery'][3], $value['delivery'][6], $value['delivery'][7], $value['delivery'][4], $value['delivery'][5], $value['delivery']['max'], $value['delivery']['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'],
$value['final'][1], $value['final'][3], $value['final'][6], $value['final'][7], $value['final'][4], $value['final'][5], $value['final']['max'], $value['final']['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'],
$value['total_budget'], $value['receivable_budget'], $value['invoice_budget'], $value['received_budget'], $value['total_facility_num'], str_replace('< br > ', '; ', $value['facilities'])
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'])
];
];
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份
@ -1324,45 +1346,48 @@ foreach ($arrayData as $key => $value) {
}
}
$facility_array[$valkey] = [
$facility_array[$valkey] = [
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][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], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][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], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][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], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][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], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][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], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][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], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][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], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][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']), $val['total_budget'], $val['receivable_budget']
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']))
];
];
if ($value['sign'][0] == "寶佳出貨前30天") {
if ($value['sign'][0] == "寶佳出貨前30天") {
$facility_boga_array[$valkey] = [
$facility_boga_array[$valkey] = [
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][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], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][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], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][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], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][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], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][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], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][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], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][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], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][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']), $val['total_budget'], $val['receivable_budget']
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']))
];
];
} else {
} else {
$facility_exclude_boga_array[$valkey] = [
$facility_exclude_boga_array[$valkey] = [
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6],
$val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][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], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][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], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][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], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][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], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][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], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][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], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][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], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][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']), $val['total_budget'], $val['receivable_budget']
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']))
];
];
}
}
}
}
}
}
$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);
$total_data = json_encode($excel_aray);
$boga_data = json_encode($boga_array);
$boga_data = json_encode($boga_array);
@ -1426,6 +1451,51 @@ $facility_exclude_boga_data = json_encode($facility_exclude_boga_array);
< / div >
< / div >
< / 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;" >
< 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 >
@ -1535,7 +1605,6 @@ $facility_exclude_boga_data = json_encode($facility_exclude_boga_array);
< script >
< script >
function showContract(BillNo) {
function showContract(BillNo) {
window.open('account-receivable-contract.php?BillNo=' + BillNo + '& <? = $token_link ?> ', '發票範例', config = 'height=600, width=1200');
window.open('account-receivable-contract.php?BillNo=' + BillNo + '& <? = $token_link ?> ', '發票範例', config = 'height=600, width=1200');
console.log(BillNo);
}
}
function test() {
function test() {
@ -1578,7 +1647,6 @@ $facility_exclude_boga_data = json_encode($facility_exclude_boga_array);
}
}
function bogaData() {
function bogaData() {
console.log(<? = $boga_data ?> );
var xhr = new XMLHttpRequest();
var xhr = new XMLHttpRequest();
var url = window.location.origin + "/wms/account-receivable-excel.php?type=boga& <? = $token_link ?> ";
var url = window.location.origin + "/wms/account-receivable-excel.php?type=boga& <? = $token_link ?> ";
xhr.open('POST', url, true);
xhr.open('POST', url, true);