diff --git a/wms/account-receivable-facility.xlsx b/wms/account-receivable-facility.xlsx
index 8f5c2974..80c882a6 100644
Binary files a/wms/account-receivable-facility.xlsx and b/wms/account-receivable-facility.xlsx differ
diff --git a/wms/account-receivable-index-ing.php b/wms/account-receivable-index-ing.php
index 51cbb096..fd59165e 100644
--- a/wms/account-receivable-index-ing.php
+++ b/wms/account-receivable-index-ing.php
@@ -1,4 +1,7 @@
0) {
$column_str = "('$user_id'" . ",'";
$column_str .= implode("','", $follower);
$column_str .= "')";
$sql_contract .= " OR s.PersonId IN $column_str)";
- $sql_received .= " OR PersonId IN $column_str)";
+ // $sql_received .= " OR PersonId IN $column_str)";
$sql_opening .= " OR person_id IN $column_str)";
+ $sql .= " OR salesid IN $column_str ORDER BY contractno";
} else {
$sql_contract .= ")";
- $sql_received .= ")";
+ // $sql_received .= ")";
$sql_opening .= ")";
+ $sql .= " ORDER BY contractno";
};
+} else {
+ $sql .= " ORDER BY contractno";
}
$contract = $conn->query($sql_contract);
@@ -183,41 +230,7 @@ foreach ($contract as $cont) {
//取作番大日程作番與時程
// real_contract_arrival_date 預計出貨日
// real_arrival_date 實際出貨日
-$sql = "SELECT
-tmp2.*,
-d.name AS depart_name
-FROM(
-SELECT
- a.manager,
- a2.name as manager_name,
- a.name,
- a.department_id,
- w.salesid,
- w.contractno,
- w.facilityno,
- w.estimated_shipping_date,
- w.real_contract_arrival_date,
-w.actual_tofactory_date,
- w.real_arrival_date,
- w.install_end_date,
- w.tryrun_end_date,
- w.official_check_date,
- w.delivery_date
-from wipwholestatus AS w
-left join account AS a
-ON w.salesid = a.accountid
-left join account AS a2
-ON a2.accountid = a.manager
-where w.status = '1' AND w.contract_type='A'
-)AS tmp2
-left join (
-SELECT DISTINCT
- department_id,
- name
-FROM department
-) AS d
-ON d.department_id = tmp2.department_id ORDER BY contractno";
$wipwhole_array = mysqli_query($link, $sql);
foreach ($wipwhole_array as $wip) {
$today = strtotime(date('Ymd'));
@@ -515,7 +528,7 @@ foreach ($wipwhole_array as $wip) {
}
if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) {
- if ( isset($arrayData[$wip['contractno']]['tryrun'][0]) && $arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") {
+ if (isset($arrayData[$wip['contractno']]['tryrun'][0]) && $arrayData[$wip['contractno']]['tryrun'][0] == "安裝試車後90天") {
$estimate_delivery_time = strtotime($wip['tryrun_end_date']);
$tryruntime = $estimate_delivery_time + (90 * 86400);
$month = collect_month($tryruntime);
@@ -846,6 +859,8 @@ $excel_aray = array();
$boga_array = array();
$exclude_boga_array = array();
$facility_array = array();
+$facility_boga_array = array();
+$facility_exclude_boga_array = array();
foreach ($arrayData as $key => $value) {
$value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0;
$value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0;
@@ -916,7 +931,7 @@ foreach ($arrayData as $key => $value) {
$val[$stage][6] = (!(isset($val[$stage][6])) || is_null($val[$stage][6])) ? 0 : $val[$stage][6];
}
$facility_array[$valkey] = [
- $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], $valkey,
+ $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['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],
@@ -927,316 +942,82 @@ foreach ($arrayData as $key => $value) {
$val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6],
str_replace('
', '; ', $val['status']), $val['total_budget'], $val['receivable_budget']
];
- }
-}
-// foreach($facility_array as $key=>$value){
-// echo $key;
-// echo '
';
-// print_r($value);
-// echo '
';
-// }
-
-$data = json_encode($excel_aray);
-$boga_data = json_encode($boga_array);
-$exclude_boga_data = json_encode($exclude_boga_array);
-$facility_data = json_encode($facility_array);
-
-?>
-
-
合約號 | -部門 | -經理 | -營業員 | -客戶名稱 | -簽約款 | -應收簽約金額 | -簽約最小催收次數 | -簽約最大催收次數 | -二次款 | -應收二次金額 | -二次最小催收次數 | -二次最大催收次數 | -貨抵工地款 | -應收貨抵工地金額 | -貨抵工地最小催收次數 | -貨抵工地最大催收次數 | -安裝款 | -應收安裝金額 | -安裝最小催收次數 | -安裝最大催收次數 | -試車款 | -應收試車金額 | -試車最小催收次數 | -試車最大催收次數 | -官檢款 | -應收官檢金額 | -官檢最小催收次數 | -官檢最大催收次數 | -移交款 | -應收移交金額 | -移交最小催收次數 | -移交最大催收次數 | -尾款 | -應收尾款金額 | -尾款最小催收次數 | -尾款最大催收次數 | -合約總金額 | -目前應收 | -已開發票金額 | -已收金額 | - -收款狀態 | - -
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
= $key ?> | -= $value[1] ?> | -= $value[2] ?> | -= $value[4] ?> | -= $value[5] ?> | -= number_format(round($value['sign'][1])) ?> | -= isset($value['sign'][3]) ? number_format(round($value['sign'][3])) : '--' ?> | -= isset($value['sign']['min']) ? $value['sign']['min'] : '--' ?> | -= isset($value['sign']['max']) ? $value['sign']['max'] : '--' ?> | -= isset($value['second'][1]) ? number_format(round($value['second'][1])) : '--' ?> | -= isset($value['second'][3]) ? number_format(round($value['second'][3])) : '--' ?> | -= isset($value['second']['min']) ? $value['second']['min'] : '--' ?> | -= isset($value['second']['max']) ? $value['second']['max'] : '--' ?> | -= isset($value['arrive'][1]) ? number_format(round($value['arrive'][1])) : '--' ?> | -= isset($value['arrive'][3]) ? number_format(round($value['arrive'][3])) : '--' ?> | -= isset($value['arrive']['min']) ? $value['arrive']['min'] : '--' ?> | -= isset($value['arrive']['max']) ? $value['arrive']['max'] : '--' ?> | -= isset($value['install'][1]) ? number_format(round($value['install'][1])) : '--' ?> | -= isset($value['install'][3]) ? number_format(round($value['install'][3])) : '--' ?> | -= isset($value['install']['min']) ? $value['install']['min'] : '--' ?> | -= isset($value['install']['max']) ? $value['install']['max'] : '--' ?> | -= isset($value['tryrun'][1]) ? number_format(round($value['tryrun'][1])) : '--' ?> | -= isset($value['tryrun'][3]) ? number_format(round($value['tryrun'][3])) : '--' ?> | -= isset($value['tryrun']['min']) ? $value['tryrun']['min'] : '--' ?> | -= isset($value['tryrun']['max']) ? $value['tryrun']['max'] : '--' ?> | -= isset($value['check'][1]) ? number_format(round($value['check'][1])) : '--' ?> | -= isset($value['check'][3]) ? number_format(round($value['check'][3])) : '--' ?> | -= isset($value['check']['min']) ? $value['check']['min'] : '--' ?> | -= isset($value['check']['max']) ? $value['check']['max'] : '--' ?> | -= isset($value['delivery'][1]) ? number_format(round($value['delivery'][1])) : '--' ?> | -= isset($value['delivery'][3]) ? number_format(round($value['delivery'][3])) : '--' ?> | -= isset($value['delivery']['min']) ? $value['delivery']['min'] : '--' ?> | -= isset($value['delivery']['max']) ? $value['delivery']['max'] : '--' ?> | -= isset($value['final'][1]) ? number_format(round($value['final'][1])) : '--' ?> | -= isset($value['final'][3]) ? number_format(round($value['final'][3])) : '--' ?> | -= isset($value['final']['min']) ? $value['final']['min'] : '--' ?> | -= isset($value['final']['max']) ? $value['final']['max'] : '--' ?> | -= isset($value['total_budget']) ? number_format(round($value['total_budget'])) : '--' ?> | -= isset($value['receivable_budget']) ? number_format(round($value['receivable_budget'])) : '--' ?> | -= isset($value['invoice_budget']) ? number_format(round($value['invoice_budget'])) : '--' ?> | -= isset($value['received_budget']) ? number_format(round($value['received_budget'])) : '--' ?> | -= $value['facilities'] ?> | - -