Cheng 1 year ago
parent
commit
ae9c51c874
  1. 18
      wms/account-receivable-excel.php
  2. BIN
      wms/account-receivable-facility.xlsx
  3. 196
      wms/account-receivable-index-ing.php
  4. 196
      wms/account-receivable-index.php
  5. 8
      wms/account-receivable-test.php
  6. BIN
      wms/account-receivable-test.xlsx
  7. 2410
      wms/account_receivable_sql_file.sql
  8. 2
      wms/contract/insertData.php
  9. BIN
      wms/contract/option/option1.xlsx
  10. BIN
      wms/contract/option/option10.xlsx
  11. BIN
      wms/contract/option/option11.xlsx
  12. BIN
      wms/contract/option/option12.xlsx
  13. 0
      wms/contract/option/option1220/option.xlsx
  14. BIN
      wms/contract/option/option1220/option1.xlsx
  15. BIN
      wms/contract/option/option1220/option10.xlsx
  16. BIN
      wms/contract/option/option1220/option11.xlsx
  17. BIN
      wms/contract/option/option1220/option12.xlsx
  18. BIN
      wms/contract/option/option1220/option13.xlsx
  19. BIN
      wms/contract/option/option1220/option14.xlsx
  20. BIN
      wms/contract/option/option1220/option15.xlsx
  21. 0
      wms/contract/option/option1220/option16.xlsx
  22. BIN
      wms/contract/option/option1220/option2.xlsx
  23. 0
      wms/contract/option/option1220/option20.xlsx
  24. BIN
      wms/contract/option/option1220/option3.xlsx
  25. BIN
      wms/contract/option/option1220/option4.xlsx
  26. BIN
      wms/contract/option/option1220/option5.xlsx
  27. BIN
      wms/contract/option/option1220/option6.xlsx
  28. BIN
      wms/contract/option/option1220/option7.xlsx
  29. BIN
      wms/contract/option/option1220/option8.xlsx
  30. BIN
      wms/contract/option/option1220/option9.xlsx
  31. BIN
      wms/contract/option/option13.xlsx
  32. BIN
      wms/contract/option/option14.xlsx
  33. BIN
      wms/contract/option/option15.xlsx
  34. BIN
      wms/contract/option/option2.xlsx
  35. BIN
      wms/contract/option/option3.xlsx
  36. BIN
      wms/contract/option/option4.xlsx
  37. BIN
      wms/contract/option/option5.xlsx
  38. BIN
      wms/contract/option/option6.xlsx
  39. BIN
      wms/contract/option/option7.xlsx
  40. BIN
      wms/contract/option/option8.xlsx
  41. BIN
      wms/contract/option/option9.xlsx
  42. 1
      wms/frame/pending.php
  43. 1
      wms/fun_global.php
  44. 20
      wms/header.php
  45. 10
      wms/mkt/assets/js/alpine.js
  46. 2
      wms/mkt/price_option-index.php
  47. 8
      wms/mkt/price_option-select.php
  48. 2
      wms/mkt/pricereview_renovate-check.php
  49. 1
      wms/mkt/pricereview_renovate-create.php
  50. 2
      wms/mkt/pricereview_renovate-index.php
  51. 5
      wms/rib02-check.php

18
wms/account-receivable-excel.php

@ -24,17 +24,17 @@ if ($type == 'facility') {
'官檢款名稱', '官檢款合約金額', '官檢款應收日期', '官檢款目前應收金額', '官檢款已收金額', '官檢款催收金額', '官檢款催收次數', '官檢款名稱', '官檢款合約金額', '官檢款應收日期', '官檢款目前應收金額', '官檢款已收金額', '官檢款催收金額', '官檢款催收次數',
'交車款名稱', '交車款合約金額', '交車款應收日期', '交車款目前應收金額', '交車款已收金額', '交車款催收金額', '交車款催收次數', '交車款名稱', '交車款合約金額', '交車款應收日期', '交車款目前應收金額', '交車款已收金額', '交車款催收金額', '交車款催收次數',
'尾款名稱', '尾款金額', '尾款應收日期', '尾款應收金額', '尾款已收金額', '尾款催收金額', '尾款催收次數', '尾款名稱', '尾款金額', '尾款應收日期', '尾款應收金額', '尾款已收金額', '尾款催收金額', '尾款催收次數',
'作番狀態', '作番合約總金額', '作番總應收金額' '作番狀態', '合約-設備金額','合約-安裝金額','作番合約總金額', '作番總應收金額'
]; ];
$sheet->fromArray($colomnHeader, NULL, 'A1'); $sheet->fromArray($colomnHeader, NULL, 'A1');
$rowIndex = 2; $rowIndex = 2;
foreach ($Bill as $key => $value) { foreach ($Bill as $key => $value) {
$sheet->fromArray($value, NULL, 'A' . $rowIndex, true); $sheet->fromArray($value, NULL, 'A' . $rowIndex);
$column = [ $column = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ',
'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP' 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP','BQ','BR'
]; ];
foreach ($column as $col) { foreach ($column as $col) {
$sheet->getColumnDimension($col)->setAutoSize(true); $sheet->getColumnDimension($col)->setAutoSize(true);
@ -56,23 +56,23 @@ if ($type == 'facility') {
'官檢款', '官檢款目前應收', '官檢款已開票金額','官檢款未開票金額', '官檢款已收金額', '官檢款催收金額', '官檢款最大催收次數', '官檢款最小催收次數', '官檢款', '官檢款目前應收', '官檢款已開票金額','官檢款未開票金額', '官檢款已收金額', '官檢款催收金額', '官檢款最大催收次數', '官檢款最小催收次數',
'交車款', '交車款目前應收', '交車款已開票金額','交車款未開票金額', '交車款已收金額', '交車款催收金額', '交車款最大催收次數', '交車款最小催收次數', '交車款', '交車款目前應收', '交車款已開票金額','交車款未開票金額', '交車款已收金額', '交車款催收金額', '交車款最大催收次數', '交車款最小催收次數',
'尾款', '尾款目前應收', '尾款已開票金額','尾款未開票金額', '尾款已收金額', '尾款催收金額', '尾款最大催收次數', '尾款最小催收次數', '尾款', '尾款目前應收', '尾款已開票金額','尾款未開票金額', '尾款已收金額', '尾款催收金額', '尾款最大催收次數', '尾款最小催收次數',
'合約總金額', '目前應收', '已開發票金額', '已收金額', '作番總數', '作番狀態' '合約設備金額','合約安裝金額','合約總金額', '目前應收', '已開發票金額', '已收金額', '作番總數', '作番狀態'
]; ];
$sheet->fromArray($colomnHeader, NULL, 'A1'); $sheet->fromArray($colomnHeader, NULL, 'A1');
$rowIndex = 2; $rowIndex = 2;
foreach ($Bill as $key => $value) { foreach ($Bill as $key => $value) {
$sheet->fromArray($value, NULL, 'A' . $rowIndex, true); $sheet->fromArray($value, NULL, 'A' . $rowIndex);
$column = [ $column = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ',
'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ', 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ',
'CA' 'CA','CB','CC'
]; ];
foreach ($column as $col) { foreach ($column as $col) {
if ($col == 'BZ') { if ($col == 'CB') {
$sheet->getColumnDimension('BZ')->setWidth(40); $sheet->getColumnDimension('CB')->setWidth(40);
$sheet->getStyle('BZ')->getAlignment()->setWrapText(true); $sheet->getStyle('CB')->getAlignment()->setWrapText(true);
} else { } else {
$sheet->getColumnDimension($col)->setAutoSize(true); $sheet->getColumnDimension($col)->setAutoSize(true);
} }

BIN
wms/account-receivable-facility.xlsx

Binary file not shown.

196
wms/account-receivable-index-ing.php

@ -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);

196
wms/account-receivable-index.php

@ -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);

8
wms/account-receivable-test.php

@ -42,3 +42,11 @@ include './header.php';
// echo $row['BillNo']."<br>"; // echo $row['BillNo']."<br>";
// } // }
// } // }
// $sql_purBill = "SELECT * FROM purBillOrderDetail WHERE MaterialId IN ('2MH00028P','3MH00123P','2MH00026P','3MW00067P','3MH00124P','3MH00121P','3MH00122P','2MW00027P','3MH00297P','2MW00001P','3MH00111P','3MW00190P','3MW00118P','3MH00093P','3MH00002P','3MW00024P','3MH00130P','3MH00196P','3MW00119P','3MH00205P','3MH00259P','3MW00159P','3MW00243P','3MH00351P','3MH00352P','2MX00015P','3MH00353P','3MH00298P','3MH00113P','3MH00036P','3MH00206P','3MH00179P','3MH00180P','3MH00181P','3MW00350P','3MH00053P','3MH00054P','3MH00178P','3MH00296P','2MH00047P','3MW00114P','3MH00282P','2MH00048P','3MH00609P','3MH00148P','3MH00354P','3MX00021P','3MW00210P','3MH00184P','3MH00185P','3MH00283P','3MW00209P','3MH00182P','3MH00183P','3MH00189P','3MH00512P','3MH00355P','3MH00286P','3MH00511P','2MX00008P','2MX00014P','3MH00244P','3MH00555P','3MH00450P','3MW00211P','3MH00177P','2MX00009P','2MX00012P','3MW00139P','3MH00540P','3MH00504P','3MH00360P','3MH00301P','3MX00020P','2MX00013P')";
// $purBill = $conn->query($sql_purBill);
//找T8銷售訂單 所有設備跟安裝款的平均價格

BIN
wms/account-receivable-test.xlsx

Binary file not shown.

2410
wms/account_receivable_sql_file.sql

File diff suppressed because it is too large

2
wms/contract/insertData.php

@ -140,7 +140,7 @@ foreach ($sheet->getRowIterator() as $key => $row) {
$option_price_id = $last_id; $option_price_id = $last_id;
$option_price = $cost; $option_price = $cost;
$quotation_no = 'Q2401001'; $quotation_no = 'Q2401002';
foreach ($open_kind_arr as $kind) { foreach ($open_kind_arr as $kind) {
$min_weight = 1; $min_weight = 1;
$max_weight = 1600; $max_weight = 1600;

BIN
wms/contract/option/option1.xlsx

Binary file not shown.

BIN
wms/contract/option/option10.xlsx

Binary file not shown.

BIN
wms/contract/option/option11.xlsx

Binary file not shown.

BIN
wms/contract/option/option12.xlsx

Binary file not shown.

0
wms/contract/option/option.xlsx → wms/contract/option/option1220/option.xlsx

BIN
wms/contract/option/option1220/option1.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option10.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option11.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option12.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option13.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option14.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option15.xlsx

Binary file not shown.

0
wms/contract/option/option16.xlsx → wms/contract/option/option1220/option16.xlsx

BIN
wms/contract/option/option1220/option2.xlsx

Binary file not shown.

0
wms/contract/option/option20.xlsx → wms/contract/option/option1220/option20.xlsx

BIN
wms/contract/option/option1220/option3.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option4.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option5.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option6.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option7.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option8.xlsx

Binary file not shown.

BIN
wms/contract/option/option1220/option9.xlsx

Binary file not shown.

BIN
wms/contract/option/option13.xlsx

Binary file not shown.

BIN
wms/contract/option/option14.xlsx

Binary file not shown.

BIN
wms/contract/option/option15.xlsx

Binary file not shown.

BIN
wms/contract/option/option2.xlsx

Binary file not shown.

BIN
wms/contract/option/option3.xlsx

Binary file not shown.

BIN
wms/contract/option/option4.xlsx

Binary file not shown.

BIN
wms/contract/option/option5.xlsx

Binary file not shown.

BIN
wms/contract/option/option6.xlsx

Binary file not shown.

BIN
wms/contract/option/option7.xlsx

Binary file not shown.

BIN
wms/contract/option/option8.xlsx

Binary file not shown.

BIN
wms/contract/option/option9.xlsx

Binary file not shown.

1
wms/frame/pending.php

@ -89,6 +89,7 @@ function here() {
url: URL, url: URL,
success: function (msg) { success: function (msg) {
var obj = JSON.parse(msg); var obj = JSON.parse(msg);
console.log(obj);
var myhtml = ''; var myhtml = '';
if (obj.st == 'ok') { if (obj.st == 'ok') {
myhtml += '<ul class="nav nav-pills flex-column">'; myhtml += '<ul class="nav nav-pills flex-column">';

1
wms/fun_global.php

@ -144,6 +144,7 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag)
} }
} }
} }
$ret[1] = "M0029";
mysqli_free_result($res); mysqli_free_result($res);
$ret[2] = 'M0012'; $ret[2] = 'M0012';
if ($renovate_flag == "REN") { if ($renovate_flag == "REN") {

20
wms/header.php

@ -1,5 +1,5 @@
<?php <?php
ini_set('display_errors', 'off'); // ini_set('display_errors', 'off');
// 維護專用 // 維護專用
// include "maintenance.php"; // include "maintenance.php";
@ -33,15 +33,15 @@ if (isset($_REQUEST["function_name"])) {
/** /**
* 連線T8 MSSQL * 連線T8 MSSQL
*/ */
try { // try {
$conn = new PDO("sqlsrv:Server=220.130.203.251;Database=T8MASADA", "M0225", "IFFBU1E="); // $conn = new PDO("sqlsrv:Server=220.130.203.251;Database=T8MASADA", "M0225", "IFFBU1E=");
if ($conn) { // if ($conn) {
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} // }
} catch (PDOException $e) { // } catch (PDOException $e) {
//echo "fail"; // //echo "fail";
//echo $e->getMessage(); // //echo $e->getMessage();
} // }

10
wms/mkt/assets/js/alpine.js

@ -11,8 +11,9 @@ const priceOptionIndex = ()=>{
orioptions: options, orioptions: options,
options: options, options: options,
options_arr: { options_arr: {
1:'標', 1:'標配',
2:'選', 2:'選配',
3:'加價'
}, },
btntype:1, btntype:1,
buttons:[], buttons:[],
@ -131,8 +132,9 @@ const priceOptionSelect = ()=>{
orioptions: options, orioptions: options,
options: options, options: options,
options_arr: { options_arr: {
1:'標', 1:'標配',
2:'選', 2:'選配',
3:'加價'
}, },
btntype:1, btntype:1,
buttons:[], buttons:[],

2
wms/mkt/price_option-index.php

@ -93,7 +93,7 @@ $optional_arr = [1 => '標', 2 => '選'];
<td x-text="option.memo"></td> <td x-text="option.memo"></td>
<td x-text="options_arr[option.optional]"></td> <td x-text="options_arr[option.optional]"></td>
<td x-text="option.unit"></td> <td x-text="option.unit"></td>
<td x-html="option.price!=null ? '$'+Number(option.price).toLocaleString() : ''"></td> <td x-html="option.price!=null ? '$'+Number(option.price).toLocaleString() : '$0'"></td>
<?php if ($user_id == 'M0174' || $user_id == 'M0107' || $user_id == "M0225") : ?> <?php if ($user_id == 'M0174' || $user_id == 'M0107' || $user_id == "M0225") : ?>
<td x-html="option.mi!=null ? '$'+Number(option.mi).toLocaleString() : ''"></td> <td x-html="option.mi!=null ? '$'+Number(option.mi).toLocaleString() : ''"></td>
<?php endif; ?> <?php endif; ?>

8
wms/mkt/price_option-select.php

@ -2,11 +2,11 @@
include "../header.php"; include "../header.php";
require_once('./conn.php'); require_once('./conn.php');
$sql_str = "SELECT * FROM option_price WHERE status ='Y'"; $sql_str = "SELECT * FROM option_price WHERE status ='Y'";
$sql_str = "SELECT option_price.*, option_mi.price as mi FROM option_price LEFT JOIN (SELECT option_mi.option_price_id, option_mi.price FROM option_mi GROUP BY option_mi.option_price_id) option_mi ON option_price.id = option_mi.option_price_id WHERE status ='Y'"; $sql_str = "SELECT option_price.*, option_mi.price as mi FROM option_price LEFT JOIN (SELECT option_mi.option_price_id, option_mi.price FROM option_mi GROUP BY option_mi.option_price_id) option_mi ON option_price.id = option_mi.option_price_id WHERE status ='Y' ORDER BY kind ASC";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->execute(); $stmt->execute();
$options = $stmt->fetchAll(PDO::FETCH_ASSOC); $options = $stmt->fetchAll(PDO::FETCH_ASSOC);
$optional_arr = [1 => '標', 2 => '選']; $optional_arr = [1 => '標', 2 => '選配',3=>'加價'];
?> ?>
<link rel="stylesheet" href="./css/style.css"> <link rel="stylesheet" href="./css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
@ -77,9 +77,9 @@ $optional_arr = [1 => '標', 2 => '選'];
<td x-text="option.memo"></td> <td x-text="option.memo"></td>
<td x-text="options_arr[option.optional]"></td> <td x-text="options_arr[option.optional]"></td>
<td x-text="option.unit"></td> <td x-text="option.unit"></td>
<td x-html="option.price!=null ? '$'+Number(option.price).toLocaleString() : ''"></td> <td x-html="option.price!=null ? '$'+Number(option.price).toLocaleString() : '$0'"></td>
<?php if ($user_id == 'M0174' || $user_id == 'M0107' || $user_id == "M0225") : ?> <?php if ($user_id == 'M0174' || $user_id == 'M0107' || $user_id == "M0225") : ?>
<td x-html="option.mi!=null ? '$'+Number(option.mi).toLocaleString() : ''"></td> <td x-html="option.mi!=null ? '$'+Number(option.mi).toLocaleString() : '$0'"></td>
<?php endif; ?> <?php endif; ?>
</tr> </tr>
</template> </template>

2
wms/mkt/pricereview_renovate-check.php

@ -1089,7 +1089,7 @@ foreach ($res as $data) {
<label>審核人員</label> <label>審核人員</label>
<input type="text" name="checker" id="checker" value="<?= $user_id; ?>" readonly> <input type="text" name="checker" id="checker" value="<?= $user_id; ?>" readonly>
<button type="submit" name="status" id="status_n" value="N" onclick="if (!confirm('確定不同意?')) return false;"><?php echo ($sign_total == $st) ? "結案(不同意)" : "不同意"; ?></button> <button type="submit" name="status" id="status_n" value="N" onclick="if (!confirm('確定不同意?')) return false;"><?php echo ($sign_total == $st) ? "結案(不同意)" : "不同意"; ?></button>
<button type="submit" name="status" id="status_y" value="Y" onclick="if (!confirm('確定同意?')) return false;"><?php echo ($sign_total == $st) ? "結案(同意)" : "同意"; ?></button> <button type="submit" name="status" id="status_y" value="Y" onclick="if (!confirm('確定同意?')) return false;"><?php echo ($sign_total == $st) ? "同意(上呈)" : "同意"; ?></button>
<?php } else { ?> <?php } else { ?>
<button type="button" id="btn_close" class="btn btn-default">回上頁</button> <button type="button" id="btn_close" class="btn btn-default">回上頁</button>
<?php } ?> <?php } ?>

1
wms/mkt/pricereview_renovate-create.php

@ -1319,6 +1319,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
} }
*/ */
?> ?>
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data"> <form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data">
<div class="table-responsive"> <div class="table-responsive">

2
wms/mkt/pricereview_renovate-index.php

@ -11,7 +11,7 @@ $data = array();
// sql語法存在變數中 // sql語法存在變數中
$sql_cmd = sql_myself($user_id); $sql_cmd = sql_myself($user_id);
// M0024許伃廷,M0107許紓晴,M0012李盈瑩權限全開 // M0024許伃廷,M0107許紓晴,M0012李盈瑩權限全開
if ($user_id == "M0024" || $user_id == "M0107" || $user_id == "M0012" || $user_id == "M0060" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "TEST04") { if ($user_id == "M0024" || $user_id == "M0107" || $user_id == "M0012" || $user_id == "M0060" || $user_id == "M0189" || $user_id == "TEST01" || $user_id == "TEST02" || $user_id == "TEST03" || $user_id == "TEST04" || $user_id=="M0029") {
$sql_cmd = "where create_at >= '2023-01-01 00:00:00'"; $sql_cmd = "where create_at >= '2023-01-01 00:00:00'";
} }
if ($user_id == "M0008") { if ($user_id == "M0008") {

5
wms/rib02-check.php

@ -1,5 +1,5 @@
<?php <?php
include "./header.php"; include "header.php";
$ribsub_id = $_GET['id']; $ribsub_id = $_GET['id'];
$sql_ribsub = "SELECT * FROM rib_sub WHERE ribsub_id = $ribsub_id"; $sql_ribsub = "SELECT * FROM rib_sub WHERE ribsub_id = $ribsub_id";
@ -8,8 +8,7 @@ $ribsub = mysqli_fetch_assoc($rib_query);
//取得費用項目代碼 //取得費用項目代碼
$sql_feetype = "SELECT FeeTypeId, FeeTypeName FROM comFeeType WHERE (FeeTypeId NOT LIKE 'A%') AND(FeeTypeId NOT LIKE 'Z%')"; $sql_feetype = "SELECT FeeTypeId, FeeTypeName FROM comFeeType WHERE (FeeTypeId NOT LIKE 'A%') AND(FeeTypeId NOT LIKE 'Z%')";
$feetype_query = mysqli_query($link, $sql_feetype); $feetype_query = $conn->query($sql_feetype);
$feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC);
// 找出使用者的部門 // 找出使用者的部門
$mydepart_sql = "SELECT department_id from account Where accountid = '$user_id'"; $mydepart_sql = "SELECT department_id from account Where accountid = '$user_id'";

Loading…
Cancel
Save