diff --git a/wms/account-receivable-excel.php b/wms/account-receivable-excel.php index 58d53f1d..b89a7205 100644 --- a/wms/account-receivable-excel.php +++ b/wms/account-receivable-excel.php @@ -13,10 +13,9 @@ $Bill = json_decode(file_get_contents("php://input"), true); $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); // file_put_contents('account-receivable.txt', json_encode($Bill)); -// file_put_contents('account-receivable.txt', json_encode($Bill)); if ($type == 'facility') { $colomnHeader = [ - '作番號', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', + 'T8單據日期','作番號', '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', '訂金名稱', '訂金合約金額', '訂金應收日期', '訂金目前應收金額', '訂金已收金額', '訂金催收金額', '訂金催收次數', '二次款名稱', '二次款合約金額', '二次款應收日期', '二次款目前應收金額', '二次款已收金額', '二次款催收金額', '二次款催收次數', '貨抵工地款名稱', '貨抵工地款合約金額', '貨抵工地款應收日期', '貨抵工地款目前應收金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款催收次數', @@ -25,7 +24,7 @@ if ($type == 'facility') { '官檢款名稱', '官檢款合約金額', '官檢款應收日期', '官檢款目前應收金額', '官檢款已收金額', '官檢款催收金額', '官檢款催收次數', '交車款名稱', '交車款合約金額', '交車款應收日期', '交車款目前應收金額', '交車款已收金額', '交車款催收金額', '交車款催收次數', '尾款名稱', '尾款金額', '尾款應收日期', '尾款應收金額', '尾款已收金額', '尾款催收金額', '尾款催收次數', - '作番狀態', '合約-設備金額', '合約-安裝金額', '作番合約總金額', '作番總應收金額' + '作番狀態', '合約-設備金額','合約-安裝金額','作番合約總金額', '作番總應收金額' ]; $sheet->fromArray($colomnHeader, NULL, 'A1'); $rowIndex = 2; @@ -35,7 +34,7 @@ if ($type == 'facility') { $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', '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' + 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP','BQ','BR','BK' ]; foreach ($column as $col) { $sheet->getColumnDimension($col)->setAutoSize(true); @@ -48,32 +47,32 @@ if ($type == 'facility') { $writer->save($excelFileName); } else { $colomnHeader = [ - '合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', - '訂金', '訂金目前應收', '訂金已開票金額', '訂金未開票金額', '訂金已收金額', '訂金催收金額', '訂金最大催收次數', '訂金最小催收次數', - '二次款', '二次款目前應收', '二次款已開票金額', '二次款未開票金額', '二次款已收金額', '二次款催收金額', '二次款最大催收次數', '二次款最小催收次數', - '貨抵工地款', '貨抵工地款目前應收', '貨抵工地款已開票金額', '貨抵工地款未開票金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款最大催收次數', '貨抵工地款最小催收次數', - '安裝款', '安裝款目前應收', '安裝款已開票金額', '安裝款未開票金額', '安裝款已收金額', '安裝款催收金額', '安裝款最大催收次數', '安裝款最小催收次數', - '試車款', '試車款目前應收', '試車款已開票金額', '試車款未開票金額', '試車款已收金額', '試車款催收金額', '試車款最大催收次數', '試車款最小催收次數', - '官檢款', '官檢款目前應收', '官檢款已開票金額', '官檢款未開票金額', '官檢款已收金額', '官檢款催收金額', '官檢款最大催收次數', '官檢款最小催收次數', - '交車款', '交車款目前應收', '交車款已開票金額', '交車款未開票金額', '交車款已收金額', '交車款催收金額', '交車款最大催收次數', '交車款最小催收次數', - '尾款', '尾款目前應收', '尾款已開票金額', '尾款未開票金額', '尾款已收金額', '尾款催收金額', '尾款最大催收次數', '尾款最小催收次數', - '合約設備金額', '合約安裝金額', '合約總金額', '目前應收', '已開發票金額', '已收金額', '作番總數', '作番狀態' + 'T8單據日期','合約號', '部門', '經理', '營業員', '客戶名稱', '統一編號', '聯絡地址', '抬頭', + '訂金', '訂金目前應收', '訂金已開票金額','訂金未開票金額', '訂金已收金額', '訂金催收金額', '訂金最大催收次數', '訂金最小催收次數', + '二次款', '二次款目前應收', '二次款已開票金額','二次款未開票金額', '二次款已收金額', '二次款催收金額', '二次款最大催收次數', '二次款最小催收次數', + '貨抵工地款', '貨抵工地款目前應收', '貨抵工地款已開票金額','貨抵工地款未開票金額', '貨抵工地款已收金額', '貨抵工地款催收金額', '貨抵工地款最大催收次數', '貨抵工地款最小催收次數', + '安裝款', '安裝款目前應收', '安裝款已開票金額','安裝款未開票金額', '安裝款已收金額', '安裝款催收金額', '安裝款最大催收次數', '安裝款最小催收次數', + '試車款', '試車款目前應收', '試車款已開票金額','試車款未開票金額', '試車款已收金額', '試車款催收金額', '試車款最大催收次數', '試車款最小催收次數', + '官檢款', '官檢款目前應收', '官檢款已開票金額','官檢款未開票金額', '官檢款已收金額', '官檢款催收金額', '官檢款最大催收次數', '官檢款最小催收次數', + '交車款', '交車款目前應收', '交車款已開票金額','交車款未開票金額', '交車款已收金額', '交車款催收金額', '交車款最大催收次數', '交車款最小催收次數', + '尾款', '尾款目前應收', '尾款已開票金額','尾款未開票金額', '尾款已收金額', '尾款催收金額', '尾款最大催收次數', '尾款最小催收次數', + '合約設備金額','合約安裝金額','合約總金額', '目前應收', '已開發票金額', '已收金額', '作番總數', '作番狀態' ]; $sheet->fromArray($colomnHeader, NULL, 'A1'); $rowIndex = 2; foreach ($Bill as $key => $value) { - $sheet->fromArray($value, NULL, 'A' . $rowIndex, true); + $sheet->fromArray($value, NULL, 'A' . $rowIndex); $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', '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', - 'CA', 'CB', 'CC' + 'CA','CB','CC','CD' ]; foreach ($column as $col) { - if ($col == 'CB') { - $sheet->getColumnDimension('CB')->setWidth(40); - $sheet->getStyle('CB')->getAlignment()->setWrapText(true); + if ($col == 'CC') { + $sheet->getColumnDimension('CC')->setWidth(40); + $sheet->getStyle('CC')->getAlignment()->setWrapText(true); } else { $sheet->getColumnDimension($col)->setAutoSize(true); } diff --git a/wms/account-receivable-facility.xlsx b/wms/account-receivable-facility.xlsx index 17779853..4576e3b8 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 c41dd958..9d0a14d7 100644 --- a/wms/account-receivable-index-ing.php +++ b/wms/account-receivable-index-ing.php @@ -1,15 +1,6 @@ 0) { $column_str = "('$user_id'" . ",'"; $column_str .= implode("','", $follower); @@ -113,19 +103,16 @@ if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { $sql_opening .= " OR person_id IN $column_str)"; $sql .= " OR salesid IN $column_str ORDER BY contractno"; $sql_contract_budget .= " OR PersonId IN $column_str ORDER BY BillNo, CU_MaterialId)"; - $sql_contract_budget .= " OR PersonId IN $column_str ORDER BY BillNo, CU_MaterialId)"; } else { $sql_contract .= ")"; // $sql_received .= ")"; $sql_opening .= ")"; $sql .= " ORDER BY contractno"; $sql_contract_budget .= ")"; - $sql_contract_budget .= ")"; }; } else { $sql .= " ORDER BY contractno"; $sql_contract_budget .= "ORDER BY BillNo, CU_MaterialId"; - $sql_contract_budget .= "ORDER BY BillNo, CU_MaterialId"; } $contract = $conn->query($sql_contract); @@ -142,16 +129,10 @@ foreach ($contract_budget_data as $cont) { $contract_budget[$cont['BillNo']]['total'] = $cont['OAmountWithTax']; } if (isset($contract_budget[$cont['BillNo']][$cont['CU_MaterialId']])) { - $contract_budget[$cont['BillNo']][$cont['CU_MaterialId']]['total'] += $cont['OAmountWithTax']; + $contract_budget[$cont['BillNo']][$cont['CU_MaterialId']] += $cont['OAmountWithTax']; } else { - $contract_budget[$cont['BillNo']][$cont['CU_MaterialId']]['total'] = $cont['OAmountWithTax']; + $contract_budget[$cont['BillNo']][$cont['CU_MaterialId']] = $cont['OAmountWithTax']; }; - if (isset($contract_budget[$cont['BillNo']][$cont['MaterialId']])) { - $contract_budget[$cont['BillNo']][$cont['MaterialId']] += $cont['OAmountWithTax']; - } else { - $contract_budget[$cont['BillNo']][$cont['MaterialId']] = $cont['OAmountWithTax']; - } - $contract_budget[$cont['BillNo']][$cont['CU_MaterialId']][$cont['MaterialId']] = $cont['OAmountWithTax']; } /* 計算比例 @@ -166,8 +147,8 @@ function get_ratio($facility_list, $contract_no, $contract_budget) return 0; } else { foreach ($facility_list as $every) { - if (isset($contract_budget[$contract_no][$every]['total']) && isset($contract_budget[$contract_no]['total'])) { - $ratio += $contract_budget[$contract_no][$every]['total'] / $contract_budget[$contract_no]['total']; + if (isset($contract_budget[$contract_no][$every]) && isset($contract_budget[$contract_no]['total'])) { + $ratio += $contract_budget[$contract_no][$every] / $contract_budget[$contract_no]['total']; } } return $ratio; @@ -215,7 +196,6 @@ foreach ($contract as $cont) { $arrayData[$BillNo]['facilities'] = ""; $arrayData[$BillNo]['total_facility_num'] = $arrayData[$BillNo]['delivery_num'] = $arrayData[$BillNo]['check_num'] = $arrayData[$BillNo]['tryrun_num'] = $arrayData[$BillNo]['install_num'] = $arrayData[$BillNo]['arrive_num'] = $arrayData[$BillNo]['second_num'] = $arrayData[$BillNo]['sign_num'] = $arrayData[$BillNo]['receivable_budget'] = 0; $arrayData[$BillNo]['total_list'] = $arrayData[$BillNo]['sign_list'] = $arrayData[$BillNo]['second_list'] = $arrayData[$BillNo]['arrive_list'] = $arrayData[$BillNo]['install_list'] = $arrayData[$BillNo]['tryrun_list'] = $arrayData[$BillNo]['check_list'] = $arrayData[$BillNo]['delivery_list'] = $arrayData[$BillNo]['final_list'] = []; - $arrayData[$BillNo]['total_list'] = $arrayData[$BillNo]['sign_list'] = $arrayData[$BillNo]['second_list'] = $arrayData[$BillNo]['arrive_list'] = $arrayData[$BillNo]['install_list'] = $arrayData[$BillNo]['tryrun_list'] = $arrayData[$BillNo]['check_list'] = $arrayData[$BillNo]['delivery_list'] = $arrayData[$BillNo]['final_list'] = []; } if (stristr($PayStage, '二次款') || (stristr($PayStage, '出貨前') && $PayStage != "寶佳出貨前30天") || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60') || stristr($PayStage, '寶佳出貨後10天')) { $arrayData[$BillNo]['second'][0] = $PayStage; @@ -305,16 +285,12 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']][4] = $wip['name']; $arrayData[$wip['contractno']][10] = $wip['contractno']; $arrayData[$wip['contractno']]['total_facility_num'] += 1; - $arrayData[$wip['contractno']]['A40001'] = $contract_budget[$wip['contractno']]['A40001']; - $arrayData[$wip['contractno']]['A40008'] = $contract_budget[$wip['contractno']]['A40008']; // [合約號]['facility'][作番號]['no'] $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['no'] = $wip['facilityno']; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = ""; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['total_budget'] = 0; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['receivable_budget'] = 0; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['collect_budget'] = 0; - $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40001'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40001']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40001'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40001'] : 0; - $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['A40008'] = (isset($contract_budget[$wip['contractno']][$wip['facilityno']]['A40008']) && !is_null($contract_budget[$wip['contractno']][$wip['facilityno']]['A40008'])) ? $contract_budget[$wip['contractno']][$wip['facilityno']]['A40008'] : 0; // [合約號][作番號][款別] ['con'] [金額]/[合約預計收款日期] // [合約號][作番號][款別] ['inv'] [金額]/[發票開立日期] @@ -406,7 +382,6 @@ foreach ($wipwhole_array as $wip) { if ($arrayData[$wip['contractno']]['sign'][0] == "寶佳出貨前30天") { $facility_status = ""; array_push($arrayData[$wip['contractno']]['total_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['total_list'], $wip['facilityno']); $today = strtotime(date('Ymd')); $contractday = strtotime($arrayData[$wip['contractno']]['sign'][2]); $month = collect_month($contractday); @@ -415,7 +390,6 @@ foreach ($wipwhole_array as $wip) { if ($today > $contractday) { $arrayData[$wip['contractno']]['sign_num'] += 1; array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); $facility_status = $wip['facilityno'] . " (出貨前30天" . $arrayData[$wip['contractno']]['sign'][2] . "已過)
"; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; //二次款 @@ -426,7 +400,6 @@ foreach ($wipwhole_array as $wip) { if ($today > $contractday) { $arrayData[$wip['contractno']]['second_num'] += 1; array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); $facility_status = $wip['facilityno'] . " (出貨後10天" . $arrayData[$wip['contractno']]['second'][2] . "已過)
"; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; //貨抵工地款 @@ -439,7 +412,6 @@ foreach ($wipwhole_array as $wip) { if ($today > $contractday) { $arrayData[$wip['contractno']]['arrive_num'] += 1; array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['arrive'][2] = strval(date('Y-m-d', $contractday)); $facility_status = $wip['facilityno'] . " (貨抵工地後90天" . $arrayData[$wip['contractno']]['arrive'][2] . "已過)
"; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; @@ -453,7 +425,6 @@ foreach ($wipwhole_array as $wip) { if ($today > $contractday) { $arrayData[$wip['contractno']]['tryrun_num'] += 1; array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['tryrun'][2] = strval(date('Y-m-d', $contractday)); $facility_status = $wip['facilityno'] . " (試車後90天" . $arrayData[$wip['contractno']]['tryrun'][2] . "已過)
"; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; @@ -468,8 +439,6 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']]['delivery_num'] += 1; array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['delivery'][2] = strval(date('Y-m-d', $contractday)); $facility_status = $wip['facilityno'] . " (交車後270天" . $arrayData[$wip['contractno']]['delivery'][2] . "已過)
"; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $facility_status; @@ -488,7 +457,6 @@ foreach ($wipwhole_array as $wip) { } else { $signtime = strtotime($arrayData[$wip['contractno']]['sign'][2]); array_push($arrayData[$wip['contractno']]['total_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['total_list'], $wip['facilityno']); $month = collect_month($signtime); $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][6] = $month; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['sign'][2] = strval(date('Ymd', $signtime)); @@ -503,19 +471,14 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交)
"; $arrayData[$wip['contractno']]['tryrun_num'] += 1; array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['install_num'] += 1; array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['arrive_num'] += 1; array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['second_num'] += 1; array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['sign_num'] += 1; array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); if ($arrayData[$wip['contractno']]['delivery'][0] == "交車後270天") { $estimate_delivery_time = strtotime($wip['delivery_date']); @@ -525,8 +488,6 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']]['delivery_num'] += 1; array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); } $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][6] = $month; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['delivery'][2] = strval(date('Ymd', $arrivetime)); @@ -538,11 +499,8 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']]['delivery_num'] += 1; array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['delivery_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['final_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['check_num'] += 1; array_push($arrayData[$wip['contractno']]['check_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['check_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['delivery'][2] = strval($wip['delivery_date']); $deliverytime = strtotime($wip['delivery_date']); $month = collect_month($deliverytime); @@ -614,22 +572,16 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢)
"; $arrayData[$wip['contractno']]['check_num'] += 1; array_push($arrayData[$wip['contractno']]['check_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['check_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['tryrun_num'] += 1; array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['install_num'] += 1; array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['arrive_num'] += 1; array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['second_num'] += 1; array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['sign_num'] += 1; array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); if (!empty($wip['official_check_date']) && $wip['official_check_date'] != NULL) { array_push($arrayData[$wip['contractno']]['check']['min'], strtotime(strval($wip['official_check_date']))); array_push($arrayData[$wip['contractno']]['check']['max'], strtotime(strval($wip['official_check_date']))); @@ -707,19 +659,14 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢)
"; $arrayData[$wip['contractno']]['tryrun_num'] += 1; array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['tryrun_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['install_num'] += 1; array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['arrive_num'] += 1; array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['second_num'] += 1; array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['sign_num'] += 1; array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); if (!empty($wip['tryrun_end_date']) && $wip['tryrun_end_date'] != NULL) { array_push($arrayData[$wip['contractno']]['tryrun']['min'], strtotime(strval($wip['tryrun_end_date']))); array_push($arrayData[$wip['contractno']]['tryrun']['max'], strtotime(strval($wip['tryrun_end_date']))); @@ -775,16 +722,12 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢)
"; $arrayData[$wip['contractno']]['install_num'] += 1; array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['install_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['arrive_num'] += 1; array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['second_num'] += 1; array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['sign_num'] += 1; array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); if (!empty($wip['install_end_date']) && $wip['install_end_date'] != NULL) { $installtime = strtotime($wip['install_end_date']); $month = collect_month($installtime); @@ -832,13 +775,10 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地)
"; $arrayData[$wip['contractno']]['arrive_num'] += 1; array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['arrive_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['second_num'] += 1; array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['sign_num'] += 1; array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); if ($arrayData[$wip['contractno']]['arrive'][0] == "貨抵工地後90天") { $estimate_delivery_time = strtotime($wip['real_arrival_date']); @@ -868,14 +808,11 @@ foreach ($wipwhole_array as $wip) { $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (已達二次款收款條件)
"; $arrayData[$wip['contractno']]['second_num'] += 1; array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['second_list'], $wip['facilityno']); $arrayData[$wip['contractno']]['sign_num'] += 1; array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); } else { $arrayData[$wip['contractno']]['sign_num'] += 1; array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); - array_push($arrayData[$wip['contractno']]['sign_list'], $wip['facilityno']); if ($wip['real_contract_arrival_date'] != NULL) { $arrayData[$wip['contractno']]['facilities'] .= $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日)
"; $arrayData[$wip['contractno']]['facility'][$wip['facilityno']]['status'] = $wip['facilityno'] . " (" . $wip['real_contract_arrival_date'] . "預計出貨日)
"; @@ -914,30 +851,6 @@ foreach ($wipwhole_array as $wip) { // } // } -// foreach ($arrayData as $key => $value) { -// echo $key."
"; -// print_r($value['total_list']); -// echo " / 總 "; -// print_r($value['sign_list']); -// echo " / 訂金
"; -// print_r($value['arrive_list']); -// echo " / 貨抵 "; -// print_r($value['install_list']); -// echo " / 安裝
"; -// print_r($value['tryrun_list']); -// echo " / 試車 "; -// print_r($value['check_list']); -// echo " / 官檢
"; -// print_r($value['delivery_list']); -// echo " / 移交 "; -// print_r($value['final_list']); -// echo " / 結案
"; -// echo "---------------------------
"; -// foreach($value['sign_list'] as $fac){ -// echo $fac."========="; -// } -// } - // 計算每個合約的應收款、作番總數 $today_date = new DateTime(date('Y-m-d', strtotime('-1 month', strtotime(date('Y-m-d'))))); @@ -962,33 +875,14 @@ foreach ($arrayData as &$value) { $value['final'][3] = $value['final'][1] * $final_ratio; $value['receivable_budget'] = $value['sign'][3] + $value['second'][3] + $value['arrive'][3] + $value['install'][3] + $value['tryrun'][3] + $value['check'][3] + $value['delivery'][3] + $value['final'][3]; } - //['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 - $sign_ratio = get_ratio($value['sign_list'], $value[10], $contract_budget); - $value['sign'][3] = $value['sign'][1] * $sign_ratio; - $second_ratio = get_ratio($value['second_list'], $value[10], $contract_budget); - $value['second'][3] = $value['second'][1] * $second_ratio; - $arrive_ratio = get_ratio($value['arrive_list'], $value[10], $contract_budget); - $value['arrive'][3] = $value['arrive'][1] * $arrive_ratio; - $install_ratio = get_ratio($value['install_list'], $value[10], $contract_budget); - $value['install'][3] = $value['install'][1] * $install_ratio; - $tryrun_ratio = get_ratio($value['tryrun_list'], $value[10], $contract_budget); - $value['tryrun'][3] = $value['tryrun'][1] * $tryrun_ratio; - $check_ratio = get_ratio($value['check_list'], $value[10], $contract_budget); - $value['check'][3] = $value['check'][1] * $check_ratio; - $delivery_ratio = get_ratio($value['delivery_list'], $value[10], $contract_budget); - $value['delivery'][3] = $value['delivery'][1] * $delivery_ratio; - $final_ratio = get_ratio($value['final_list'], $value[10], $contract_budget); - $value['final'][3] = $value['final'][1] * $final_ratio; - $value['receivable_budget'] = $value['sign'][3] + $value['second'][3] + $value['arrive'][3] + $value['install'][3] + $value['tryrun'][3] + $value['check'][3] + $value['delivery'][3] + $value['final'][3]; - } //['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 // 計算每台作番金額與各階段應收金額 foreach ($value['facility'] as &$val) { foreach ($contractstage as $stage) { if (isset($value[$stage][0]) && !empty($value[$stage][0])) { $val[$stage][0] = $value[$stage][0]; - if (isset($contract_budget[$value[10]]['total']) && isset($contract_budget[$value[10]][$val['no']]['total'])) { - $ratio = $contract_budget[$value[10]][$val['no']]['total'] / $contract_budget[$value[10]]['total']; + if (isset($contract_budget[$value[10]]['total']) && isset($contract_budget[$value[10]][$val['no']])) { + $ratio = $contract_budget[$value[10]][$val['no']] / $contract_budget[$value[10]]['total']; } else { $ratio = 0; } @@ -1349,284 +1243,6 @@ foreach ($arrayData as $key => &$data) { $data['final'][7] = 0; } } -//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 4 已收金額 5 催收金額 6 已開發票金額 7 未開發票金額 min 最早應收月份 max 最晚應收月份 -foreach ($arrayData as $key => &$data) { - $tmp_data = $data['received_budget']; - $tmp_invoice = $data['invoice_budget']; - - if ($data['sign'][3] > 0) { - if ($tmp_data > 0) { - if (($tmp_data - $data['sign'][3]) >= 0) { - $data['sign'][4] = $data['sign'][3]; - $tmp_data -= $data['sign'][3]; - } else { - $data['sign'][4] = $tmp_data; - $tmp_data = 0; - } - $data['sign'][5] = $data['sign'][3] - $data['sign'][4]; - } else { - $data['sign'][4] = 0; - $data['sign'][5] = $data['sign'][3]; - } - if ($tmp_invoice > 0) { - if (($tmp_invoice - $data['sign'][3]) >= 0) { - $data['sign'][6] = $data['sign'][3]; - $tmp_invoice -= $data['sign'][3]; - } else { - $data['sign'][6] = $tmp_invoice; - $tmp_invoice = 0; - } - $data['sign'][7] = $data['sign'][3] - $data['sign'][6]; - } else { - $data['sign'][6] = 0; - $data['sign'][7] = $data['sign'][3]; - } - } else { - $data['sign'][4] = 0; - $data['sign'][5] = 0; - $data['sign'][6] = 0; - $data['sign'][7] = 0; - } - if ($data['second'][3] > 0) { - if ($tmp_data > 0) { - if (($tmp_data - $data['second'][3]) >= 0) { - $data['second'][4] = $data['second'][3]; - $tmp_data -= $data['second'][3]; - } else { - $data['second'][4] = $tmp_data; - $tmp_data = 0; - } - $data['second'][5] = $data['second'][3] - $data['second'][4]; - } else { - $data['second'][4] = 0; - $data['second'][5] = $data['second'][3]; - } - if ($tmp_invoice > 0) { - if (($tmp_invoice - $data['second'][3]) >= 0) { - $data['second'][6] = $data['second'][3]; - $tmp_invoice -= $data['second'][3]; - } else { - $data['second'][6] = $tmp_invoice; - $tmp_invoice = 0; - } - $data['second'][7] = $data['second'][3] - $data['second'][6]; - } else { - $data['second'][6] = 0; - $data['second'][7] = $data['second'][3]; - } - } else { - $data['second'][4] = 0; - $data['second'][5] = 0; - $data['second'][6] = 0; - $data['second'][7] = 0; - } - - if ($data['arrive'][3] > 0) { - - if ($tmp_data > 0) { - if (($tmp_data - $data['arrive'][1]) >= 0) { - $data['arrive'][4] = $data['arrive'][3]; - $tmp_data -= $data['arrive'][3]; - } else { - $data['arrive'][4] = $tmp_data; - $tmp_data = 0; - } - $data['arrive'][5] = $data['arrive'][3] - $data['arrive'][4]; - } else { - $data['arrive'][4] = 0; - $data['arrive'][5] = $data['arrive'][3]; - } - if ($tmp_invoice > 0) { - if (($tmp_invoice - $data['arrive'][3]) >= 0) { - $data['arrive'][6] = $data['arrive'][3]; - $tmp_invoice -= $data['arrive'][3]; - } else { - $data['arrive'][6] = $tmp_invoice; - $tmp_invoice = 0; - } - $data['arrive'][7] = $data['arrive'][3] - $data['arrive'][6]; - } else { - $data['arrive'][6] = 0; - $data['arrive'][7] = $data['arrive'][3]; - } - } else { - $data['arrive'][4] = 0; - $data['arrive'][5] = 0; - $data['arrive'][6] = 0; - $data['arrive'][7] = 0; - } - - if ($data['install'][3] > 0) { - - if ($tmp_data > 0) { - if (($tmp_data - $data['install'][1]) >= 0) { - $data['install'][4] = $data['install'][3]; - $tmp_data -= $data['install'][3]; - } else { - $data['install'][4] = $tmp_data; - $tmp_data = 0; - } - $data['install'][5] = $data['install'][3] - $data['install'][4]; - } else { - $data['install'][4] = 0; - $data['install'][5] = $data['install'][3]; - } - if ($tmp_invoice > 0) { - if (($tmp_invoice - $data['install'][3]) >= 0) { - $data['install'][6] = $data['install'][3]; - $tmp_invoice -= $data['install'][3]; - } else { - $data['install'][6] = $tmp_invoice; - $tmp_invoice = 0; - } - $data['install'][7] = $data['install'][3] - $data['install'][6]; - } else { - $data['install'][6] = 0; - $data['install'][7] = $data['install'][3]; - } - } else { - $data['install'][4] = 0; - $data['install'][5] = 0; - $data['install'][6] = 0; - $data['install'][7] = 0; - } - - - if ($data['tryrun'][3] > 0) { - if ($tmp_data > 0) { - if (($tmp_data - $data['tryrun'][1]) >= 0) { - $data['tryrun'][4] = $data['tryrun'][3]; - $tmp_data -= $data['tryrun'][3]; - } else { - $data['tryrun'][4] = $tmp_data; - $tmp_data = 0; - } - $data['tryrun'][5] = $data['tryrun'][3] - $data['tryrun'][4]; - } else { - $data['tryrun'][4] = 0; - $data['tryrun'][5] = $data['tryrun'][3]; - } - if ($tmp_invoice > 0) { - if (($tmp_invoice - $data['tryrun'][3]) >= 0) { - $data['tryrun'][6] = $data['tryrun'][3]; - $tmp_invoice -= $data['tryrun'][3]; - } else { - $data['tryrun'][6] = $tmp_invoice; - $tmp_invoice = 0; - } - $data['tryrun'][7] = $data['tryrun'][3] - $data['tryrun'][6]; - } else { - $data['tryrun'][6] = 0; - $data['tryrun'][7] = $data['tryrun'][3]; - } - } else { - $data['tryrun'][4] = 0; - $data['tryrun'][5] = 0; - $data['tryrun'][6] = 0; - $data['tryrun'][7] = 0; - } - - if ($data['check'][3] > 0) { - if ($tmp_data > 0) { - if (($tmp_data - $data['check'][1]) >= 0) { - $data['check'][4] = $data['check'][3]; - $tmp_data -= $data['check'][3]; - } else { - $data['check'][4] = $tmp_data; - $tmp_data = 0; - } - $data['check'][5] = $data['check'][3] - $data['check'][4]; - } else { - $data['check'][4] = 0; - $data['check'][5] = $data['check'][3]; - } - if ($tmp_invoice > 0) { - if (($tmp_invoice - $data['check'][3]) >= 0) { - $data['check'][6] = $data['check'][3]; - $tmp_invoice -= $data['check'][3]; - } else { - $data['check'][6] = $tmp_invoice; - $tmp_invoice = 0; - } - $data['check'][7] = $data['check'][3] - $data['check'][6]; - } else { - $data['check'][6] = 0; - $data['check'][7] = $data['check'][3]; - } - } else { - $data['check'][4] = 0; - $data['check'][5] = 0; - $data['check'][6] = 0; - $data['check'][7] = 0; - } - if ($data['delivery'][3] > 0) { - if ($tmp_data > 0) { - if (($tmp_data - $data['delivery'][1]) >= 0) { - $data['delivery'][4] = $data['delivery'][3]; - $tmp_data -= $data['delivery'][3]; - } else { - $data['delivery'][4] = $tmp_data; - $tmp_data = 0; - } - $data['delivery'][5] = $data['delivery'][3] - $data['delivery'][4]; - } else { - $data['delivery'][4] = 0; - $data['delivery'][5] = $data['delivery'][3]; - } - if ($tmp_invoice > 0) { - if (($tmp_invoice - $data['delivery'][3]) >= 0) { - $data['delivery'][6] = $data['delivery'][3]; - $tmp_invoice -= $data['delivery'][3]; - } else { - $data['delivery'][6] = $tmp_invoice; - $tmp_invoice = 0; - } - $data['delivery'][7] = $data['delivery'][3] - $data['delivery'][6]; - } else { - $data['delivery'][6] = 0; - $data['delivery'][7] = $data['delivery'][3]; - } - } else { - $data['delivery'][4] = 0; - $data['delivery'][5] = 0; - $data['delivery'][6] = 0; - $data['delivery'][7] = 0; - } - - if ($data['final'][3] > 0) { - if ($tmp_data > 0) { - if (($tmp_data - $data['final'][1]) >= 0) { - $data['final'][4] = $data['final'][3]; - $tmp_data -= $data['final'][3]; - } else { - $data['final'][4] = $tmp_data; - $tmp_data = 0; - } - $data['final'][5] = $data['final'][3] - $data['final'][4]; - } else { - $data['final'][4] = 0; - $data['final'][5] = $data['final'][3]; - } - if ($tmp_invoice > 0) { - if (($tmp_invoice - $data['final'][3]) >= 0) { - $data['final'][6] = $data['final'][3]; - $tmp_invoice -= $data['final'][3]; - } else { - $data['final'][6] = $tmp_invoice; - $tmp_invoice = 0; - } - $data['final'][7] = $data['final'][3] - $data['final'][6]; - } else { - $data['final'][6] = 0; - $data['final'][7] = $data['final'][3]; - } - } else { - $data['final'][4] = 0; - $data['final'][5] = 0; - $data['final'][6] = 0; - $data['final'][7] = 0; - } -} //產生excel的array $excel_aray = array(); @@ -1636,10 +1252,7 @@ $facility_array = array(); $facility_boga_array = array(); $facility_exclude_boga_array = array(); foreach ($arrayData as $key => $value) { - $sum_A40001 += $value['A40001']; - $sum_A40008 += $value['A40008']; - $sum_total_budget += $value['total_budget']; - $sum_facility += $value['total_facility_num']; + $value['sign'][3] = (isset($value['sign'][3])) ? $value['sign'][3] : 0; $value['second'][3] = (isset($value['second'][3])) ? $value['second'][3] : 0; $value['arrive'][3] = (isset($value['arrive'][3])) ? $value['arrive'][3] : 0; @@ -1654,51 +1267,48 @@ foreach ($arrayData as $key => $value) { $value[$i]['min'] = (empty($value[$i]['min']) || is_null($value[$i]['min'])) ? 0 : $value[$i]['min']; $value[$i][4] = (isset($value[$i][4])) ? $value[$i][4] : 0; $value[$i][5] = (isset($value[$i][5])) ? $value[$i][5] : 0; - $value[$i][4] = (isset($value[$i][4])) ? $value[$i][4] : 0; - $value[$i][5] = (isset($value[$i][5])) ? $value[$i][5] : 0; }; if ($value['sign'][0] == "寶佳出貨前30天") { $boga_array[$key] = [ $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], - number_format(round($value['sign'][1])), number_format(round($value['sign'][3])), number_format(round($value['sign'][6])), number_format(round($value['sign'][7])), number_format(round($value['sign'][4])), number_format(round($value['sign'][5])), $value['sign']['max'], $value['sign']['min'], - number_format(round($value['second'][1])), number_format(round($value['second'][3])), number_format(round($value['second'][6])), number_format(round($value['second'][7])), number_format(round($value['second'][4])), number_format(round($value['second'][5])), $value['second']['max'], $value['second']['min'], - number_format(round($value['arrive'][1])), number_format(round($value['arrive'][3])), number_format(round($value['arrive'][6])), number_format(round($value['arrive'][7])), number_format(round($value['arrive'][4])), number_format(round($value['arrive'][5])), $value['arrive']['max'], $value['arrive']['min'], - number_format(round($value['install'][1])), number_format(round($value['install'][3])), number_format(round($value['install'][6])), number_format(round($value['install'][7])), number_format(round($value['install'][4])), number_format(round($value['install'][5])), $value['install']['max'], $value['install']['min'], - number_format(round($value['tryrun'][1])), number_format(round($value['tryrun'][3])), number_format(round($value['tryrun'][6])), number_format(round($value['tryrun'][7])), number_format(round($value['tryrun'][4])), number_format(round($value['tryrun'][5])), $value['tryrun']['max'], $value['tryrun']['min'], - number_format(round($value['check'][1])), number_format(round($value['check'][3])), number_format(round($value['check'][6])), number_format(round($value['check'][7])), number_format(round($value['check'][4])), number_format(round($value['check'][5])), $value['check']['max'], $value['check']['min'], - number_format(round($value['delivery'][1])), number_format(round($value['delivery'][3])), number_format(round($value['delivery'][6])), number_format(round($value['delivery'][7])), number_format(round($value['delivery'][4])), number_format(round($value['delivery'][5])), $value['delivery']['max'], $value['delivery']['min'], - number_format(round($value['final'][1])), number_format(round($value['final'][3])), number_format(round($value['final'][6])), number_format(round($value['final'][7])), number_format(round($value['final'][4])), number_format(round($value['final'][5])), $value['final']['max'], $value['final']['min'], - number_format(round($value['A40001'])), number_format(round($value['A40008'])), number_format(round($value['total_budget'])), number_format(round($value['receivable_budget'])), number_format(round($value['invoice_budget'])), number_format(round($value['received_budget'])), $value['total_facility_num'], str_replace('
', '; ', $value['facilities']) + round($value['sign'][1]), round($value['sign'][3]), round($value['sign'][6]), round($value['sign'][7]), round($value['sign'][4]), round($value['sign'][5]), $value['sign']['max'], $value['sign']['min'], + round($value['second'][1]), round($value['second'][3]), round($value['second'][6]), round($value['second'][7]), round($value['second'][4]), round($value['second'][5]), $value['second']['max'], $value['second']['min'], + round($value['arrive'][1]), round($value['arrive'][3]), round($value['arrive'][6]), round($value['arrive'][7]), round($value['arrive'][4]), round($value['arrive'][5]), $value['arrive']['max'], $value['arrive']['min'], + round($value['install'][1]), round($value['install'][3]), round($value['install'][6]), round($value['install'][7]), round($value['install'][4]), round($value['install'][5]), $value['install']['max'], $value['install']['min'], + round($value['tryrun'][1]), round($value['tryrun'][3]), round($value['tryrun'][6]), round($value['tryrun'][7]), round($value['tryrun'][4]), round($value['tryrun'][5]), $value['tryrun']['max'], $value['tryrun']['min'], + round($value['check'][1]), round($value['check'][3]), round($value['check'][6]), round($value['check'][7]), round($value['check'][4]), round($value['check'][5]), $value['check']['max'], $value['check']['min'], + round($value['delivery'][1]), round($value['delivery'][3]), round($value['delivery'][6]), round($value['delivery'][7]), round($value['delivery'][4]), round($value['delivery'][5]), $value['delivery']['max'], $value['delivery']['min'], + round($value['final'][1]), round($value['final'][3]), round($value['final'][6]), round($value['final'][7]), round($value['final'][4]), round($value['final'][5]), $value['final']['max'], $value['final']['min'], + round($value['total_budget']), round($value['receivable_budget']), round($value['invoice_budget']), round($value['received_budget']), $value['total_facility_num'], str_replace('
', '; ', $value['facilities']) ]; } else { $exclude_boga_array[$key] = [ $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], - number_format(round($value['sign'][1])), number_format(round($value['sign'][3])), number_format(round($value['sign'][6])), number_format(round($value['sign'][7])), number_format(round($value['sign'][4])), number_format(round($value['sign'][5])), $value['sign']['max'], $value['sign']['min'], - number_format(round($value['second'][1])), number_format(round($value['second'][3])), number_format(round($value['second'][6])), number_format(round($value['second'][7])), number_format(round($value['second'][4])), number_format(round($value['second'][5])), $value['second']['max'], $value['second']['min'], - number_format(round($value['arrive'][1])), number_format(round($value['arrive'][3])), number_format(round($value['arrive'][6])), number_format(round($value['arrive'][7])), number_format(round($value['arrive'][4])), number_format(round($value['arrive'][5])), $value['arrive']['max'], $value['arrive']['min'], - number_format(round($value['install'][1])), number_format(round($value['install'][3])), number_format(round($value['install'][6])), number_format(round($value['install'][7])), number_format(round($value['install'][4])), number_format(round($value['install'][5])), $value['install']['max'], $value['install']['min'], - number_format(round($value['tryrun'][1])), number_format(round($value['tryrun'][3])), number_format(round($value['tryrun'][6])), number_format(round($value['tryrun'][7])), number_format(round($value['tryrun'][4])), number_format(round($value['tryrun'][5])), $value['tryrun']['max'], $value['tryrun']['min'], - number_format(round($value['check'][1])), number_format(round($value['check'][3])), number_format(round($value['check'][6])), number_format(round($value['check'][7])), number_format(round($value['check'][4])), number_format(round($value['check'][5])), $value['check']['max'], $value['check']['min'], - number_format(round($value['delivery'][1])), number_format(round($value['delivery'][3])), number_format(round($value['delivery'][6])), number_format(round($value['delivery'][7])), number_format(round($value['delivery'][4])), number_format(round($value['delivery'][5])), $value['delivery']['max'], $value['delivery']['min'], - number_format(round($value['final'][1])), number_format(round($value['final'][3])), number_format(round($value['final'][6])), number_format(round($value['final'][7])), number_format(round($value['final'][4])), number_format(round($value['final'][5])), $value['final']['max'], $value['final']['min'], - number_format(round($value['A40001'])), number_format(round($value['A40008'])), number_format(round($value['total_budget'])), number_format(round($value['receivable_budget'])), number_format(round($value['invoice_budget'])), number_format(round($value['received_budget'])), $value['total_facility_num'], str_replace('
', '; ', $value['facilities']) + round($value['sign'][1]), round($value['sign'][3]), round($value['sign'][6]), round($value['sign'][7]), round($value['sign'][4]), round($value['sign'][5]), $value['sign']['max'], $value['sign']['min'], + round($value['second'][1]), round($value['second'][3]), round($value['second'][6]), round($value['second'][7]), round($value['second'][4]), round($value['second'][5]), $value['second']['max'], $value['second']['min'], + round($value['arrive'][1]), round($value['arrive'][3]), round($value['arrive'][6]), round($value['arrive'][7]), round($value['arrive'][4]), round($value['arrive'][5]), $value['arrive']['max'], $value['arrive']['min'], + round($value['install'][1]), round($value['install'][3]), round($value['install'][6]), round($value['install'][7]), round($value['install'][4]), round($value['install'][5]), $value['install']['max'], $value['install']['min'], + round($value['tryrun'][1]), round($value['tryrun'][3]), round($value['tryrun'][6]), round($value['tryrun'][7]), round($value['tryrun'][4]), round($value['tryrun'][5]), $value['tryrun']['max'], $value['tryrun']['min'], + round($value['check'][1]), round($value['check'][3]), round($value['check'][6]), round($value['check'][7]), round($value['check'][4]), round($value['check'][5]), $value['check']['max'], $value['check']['min'], + round($value['delivery'][1]), round($value['delivery'][3]), round($value['delivery'][6]), round($value['delivery'][7]), round($value['delivery'][4]), round($value['delivery'][5]), $value['delivery']['max'], $value['delivery']['min'], + round($value['final'][1]), round($value['final'][3]), round($value['final'][6]), round($value['final'][7]), round($value['final'][4]), round($value['final'][5]), $value['final']['max'], $value['final']['min'], + round($value['total_budget']), round($value['receivable_budget']), round($value['invoice_budget']), round($value['received_budget']), $value['total_facility_num'], str_replace('
', '; ', $value['facilities']) ]; } $excel_aray[$key] = [ $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], - number_format(round($value['sign'][1])), number_format(round($value['sign'][3])), number_format(round($value['sign'][6])), number_format(round($value['sign'][7])), number_format(round($value['sign'][4])), number_format(round($value['sign'][5])), $value['sign']['max'], $value['sign']['min'], - number_format(round($value['second'][1])), number_format(round($value['second'][3])), number_format(round($value['second'][6])), number_format(round($value['second'][7])), number_format(round($value['second'][4])), number_format(round($value['second'][5])), $value['second']['max'], $value['second']['min'], - number_format(round($value['arrive'][1])), number_format(round($value['arrive'][3])), number_format(round($value['arrive'][6])), number_format(round($value['arrive'][7])), number_format(round($value['arrive'][4])), number_format(round($value['arrive'][5])), $value['arrive']['max'], $value['arrive']['min'], - number_format(round($value['install'][1])), number_format(round($value['install'][3])), number_format(round($value['install'][6])), number_format(round($value['install'][7])), number_format(round($value['install'][4])), number_format(round($value['install'][5])), $value['install']['max'], $value['install']['min'], - number_format(round($value['tryrun'][1])), number_format(round($value['tryrun'][3])), number_format(round($value['tryrun'][6])), number_format(round($value['tryrun'][7])), number_format(round($value['tryrun'][4])), number_format(round($value['tryrun'][5])), $value['tryrun']['max'], $value['tryrun']['min'], - number_format(round($value['check'][1])), number_format(round($value['check'][3])), number_format(round($value['check'][6])), number_format(round($value['check'][7])), number_format(round($value['check'][4])), number_format(round($value['check'][5])), $value['check']['max'], $value['check']['min'], - number_format(round($value['delivery'][1])), number_format(round($value['delivery'][3])), number_format(round($value['delivery'][6])), number_format(round($value['delivery'][7])), number_format(round($value['delivery'][4])), number_format(round($value['delivery'][5])), $value['delivery']['max'], $value['delivery']['min'], - number_format(round($value['final'][1])), number_format(round($value['final'][3])), number_format(round($value['final'][6])), number_format(round($value['final'][7])), number_format(round($value['final'][4])), number_format(round($value['final'][5])), $value['final']['max'], $value['final']['min'], - number_format(round($value['A40001'])), number_format(round($value['A40008'])), number_format(round($value['total_budget'])), number_format(round($value['receivable_budget'])), number_format(round($value['invoice_budget'])), number_format(round($value['received_budget'])), $value['total_facility_num'], str_replace('
', '; ', $value['facilities']) - ]; - + round($value['sign'][1]), round($value['sign'][3]), round($value['sign'][6]), round($value['sign'][7]), round($value['sign'][4]), round($value['sign'][5]), $value['sign']['max'], $value['sign']['min'], + round($value['second'][1]), round($value['second'][3]), round($value['second'][6]), round($value['second'][7]), round($value['second'][4]), round($value['second'][5]), $value['second']['max'], $value['second']['min'], + round($value['arrive'][1]), round($value['arrive'][3]), round($value['arrive'][6]), round($value['arrive'][7]), round($value['arrive'][4]), round($value['arrive'][5]), $value['arrive']['max'], $value['arrive']['min'], + round($value['install'][1]), round($value['install'][3]), round($value['install'][6]), round($value['install'][7]), round($value['install'][4]), round($value['install'][5]), $value['install']['max'], $value['install']['min'], + round($value['tryrun'][1]), round($value['tryrun'][3]), round($value['tryrun'][6]), round($value['tryrun'][7]), round($value['tryrun'][4]), round($value['tryrun'][5]), $value['tryrun']['max'], $value['tryrun']['min'], + round($value['check'][1]), round($value['check'][3]), round($value['check'][6]), round($value['check'][7]), round($value['check'][4]), round($value['check'][5]), $value['check']['max'], $value['check']['min'], + round($value['delivery'][1]), round($value['delivery'][3]), round($value['delivery'][6]), round($value['delivery'][7]), round($value['delivery'][4]), round($value['delivery'][5]), $value['delivery']['max'], $value['delivery']['min'], + round($value['final'][1]), round($value['final'][3]), round($value['final'][6]), round($value['final'][7]), round($value['final'][4]), round($value['final'][5]), $value['final']['max'], $value['final']['min'], + round($value['total_budget']), round($value['receivable_budget']), round($value['invoice_budget']), round($value['received_budget']), $value['total_facility_num'], str_replace('
', '; ', $value['facilities']) + ]; //['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 3 應收金額 min 最早應收月份 max 最晚應收月份 //[合約號]['facility'] [作番號][款別]0 款項名稱 1 合約金額 2 應收日期 3 應收金額 4 已收金額 5 催收金額 6 催收次數 @@ -1714,48 +1324,45 @@ foreach ($arrayData as $key => $value) { } $facility_array[$valkey] = [ $valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], - $val['sign'][0], number_format(round($val['sign'][1])), $val['sign'][2], number_format(round($val['sign'][3])), number_format(round($val['sign'][4])), number_format(round($val['sign'][5])), $val['sign'][6], - $val['second'][0], number_format(round($val['second'][1])), $val['second'][2], number_format(round($val['second'][3])), number_format(round($val['second'][4])), number_format(round($val['second'][5])), $val['second'][6], - $val['arrive'][0], number_format(round($val['arrive'][1])), $val['arrive'][2], number_format(round($val['arrive'][3])), number_format(round($val['arrive'][4])), number_format(round($val['arrive'][5])), $val['arrive'][6], - $val['install'][0], number_format(round($val['install'][1])), $val['install'][2], number_format(round($val['install'][3])), number_format(round($val['install'][4])), number_format(round($val['install'][5])), $val['install'][6], - $val['tryrun'][0], number_format(round($val['tryrun'][1])), $val['tryrun'][2], number_format(round($val['tryrun'][3])), number_format(round($val['tryrun'][4])), number_format(round($val['tryrun'][5])), $val['tryrun'][6], - $val['check'][0], number_format(round($val['check'][1])), $val['check'][2], number_format(round($val['check'][3])), number_format(round($val['check'][4])), number_format(round($val['check'][5])), $val['check'][6], - $val['delivery'][0], number_format(round($val['delivery'][1])), $val['delivery'][2], number_format(round($val['delivery'][3])), number_format(round($val['delivery'][4])), number_format(round($val['delivery'][5])), $val['delivery'][6], - $val['final'][0], number_format(round($val['final'][1])), $val['final'][2], number_format(round($val['final'][3])), number_format(round($val['final'][4])), number_format(round($val['final'][5])), $val['final'][6], - str_replace('
', '; ', $val['status']), number_format(round($val['A40001'])), number_format(round($val['A40008'])), number_format(round($val['total_budget'])), number_format(round($val['receivable_budget'])) + $val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][6], + $val['second'][0], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][6], + $val['arrive'][0], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][6], + $val['install'][0], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][6], + $val['tryrun'][0], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][6], + $val['check'][0], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][6], + $val['delivery'][0], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][6], + $val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6], + str_replace('
', '; ', $val['status']), $val['total_budget'], $val['receivable_budget'] ]; if ($value['sign'][0] == "寶佳出貨前30天") { $facility_boga_array[$valkey] = [ $valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], - $val['sign'][0], number_format(round($val['sign'][1])), $val['sign'][2], number_format(round($val['sign'][3])), number_format(round($val['sign'][4])), number_format(round($val['sign'][5])), $val['sign'][6], - $val['second'][0], number_format(round($val['second'][1])), $val['second'][2], number_format(round($val['second'][3])), number_format(round($val['second'][4])), number_format(round($val['second'][5])), $val['second'][6], - $val['arrive'][0], number_format(round($val['arrive'][1])), $val['arrive'][2], number_format(round($val['arrive'][3])), number_format(round($val['arrive'][4])), number_format(round($val['arrive'][5])), $val['arrive'][6], - $val['install'][0], number_format(round($val['install'][1])), $val['install'][2], number_format(round($val['install'][3])), number_format(round($val['install'][4])), number_format(round($val['install'][5])), $val['install'][6], - $val['tryrun'][0], number_format(round($val['tryrun'][1])), $val['tryrun'][2], number_format(round($val['tryrun'][3])), number_format(round($val['tryrun'][4])), number_format(round($val['tryrun'][5])), $val['tryrun'][6], - $val['check'][0], number_format(round($val['check'][1])), $val['check'][2], number_format(round($val['check'][3])), number_format(round($val['check'][4])), number_format(round($val['check'][5])), $val['check'][6], - $val['delivery'][0], number_format(round($val['delivery'][1])), $val['delivery'][2], number_format(round($val['delivery'][3])), number_format(round($val['delivery'][4])), number_format(round($val['delivery'][5])), $val['delivery'][6], - $val['final'][0], number_format(round($val['final'][1])), $val['final'][2], number_format(round($val['final'][3])), number_format(round($val['final'][4])), number_format(round($val['final'][5])), $val['final'][6], - str_replace('
', '; ', $val['status']), number_format(round($val['A40001'])), number_format(round($val['A40008'])), number_format(round($val['total_budget'])), number_format(round($val['receivable_budget'])) + $val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][6], + $val['second'][0], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][6], + $val['arrive'][0], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][6], + $val['install'][0], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][6], + $val['tryrun'][0], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][6], + $val['check'][0], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][6], + $val['delivery'][0], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][6], + $val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6], + str_replace('
', '; ', $val['status']), $val['total_budget'], $val['receivable_budget'] ]; } else { $facility_exclude_boga_array[$valkey] = [ $valkey, $key, $value[1], $value[2], $value[4], $value[5], $value[7], $value[8], $value[6], - $val['sign'][0], number_format(round($val['sign'][1])), $val['sign'][2], number_format(round($val['sign'][3])), number_format(round($val['sign'][4])), number_format(round($val['sign'][5])), $val['sign'][6], - $val['second'][0], number_format(round($val['second'][1])), $val['second'][2], number_format(round($val['second'][3])), number_format(round($val['second'][4])), number_format(round($val['second'][5])), $val['second'][6], - $val['arrive'][0], number_format(round($val['arrive'][1])), $val['arrive'][2], number_format(round($val['arrive'][3])), number_format(round($val['arrive'][4])), number_format(round($val['arrive'][5])), $val['arrive'][6], - $val['install'][0], number_format(round($val['install'][1])), $val['install'][2], number_format(round($val['install'][3])), number_format(round($val['install'][4])), number_format(round($val['install'][5])), $val['install'][6], - $val['tryrun'][0], number_format(round($val['tryrun'][1])), $val['tryrun'][2], number_format(round($val['tryrun'][3])), number_format(round($val['tryrun'][4])), number_format(round($val['tryrun'][5])), $val['tryrun'][6], - $val['check'][0], number_format(round($val['check'][1])), $val['check'][2], number_format(round($val['check'][3])), number_format(round($val['check'][4])), number_format(round($val['check'][5])), $val['check'][6], - $val['delivery'][0], number_format(round($val['delivery'][1])), $val['delivery'][2], number_format(round($val['delivery'][3])), number_format(round($val['delivery'][4])), number_format(round($val['delivery'][5])), $val['delivery'][6], - $val['final'][0], number_format(round($val['final'][1])), $val['final'][2], number_format(round($val['final'][3])), number_format(round($val['final'][4])), number_format(round($val['final'][5])), $val['final'][6], - str_replace('
', '; ', $val['status']), number_format(round($val['A40001'])), number_format(round($val['A40008'])), number_format(round($val['total_budget'])), number_format(round($val['receivable_budget'])) + $val['sign'][0], $val['sign'][1], $val['sign'][2], $val['sign'][3], $val['sign'][4], $val['sign'][5], $val['sign'][6], + $val['second'][0], $val['second'][1], $val['second'][2], $val['second'][3], $val['second'][4], $val['second'][5], $val['second'][6], + $val['arrive'][0], $val['arrive'][1], $val['arrive'][2], $val['arrive'][3], $val['arrive'][4], $val['arrive'][5], $val['arrive'][6], + $val['install'][0], $val['install'][1], $val['install'][2], $val['install'][3], $val['install'][4], $val['install'][5], $val['install'][6], + $val['tryrun'][0], $val['tryrun'][1], $val['tryrun'][2], $val['tryrun'][3], $val['tryrun'][4], $val['tryrun'][5], $val['tryrun'][6], + $val['check'][0], $val['check'][1], $val['check'][2], $val['check'][3], $val['check'][4], $val['check'][5], $val['check'][6], + $val['delivery'][0], $val['delivery'][1], $val['delivery'][2], $val['delivery'][3], $val['delivery'][4], $val['delivery'][5], $val['delivery'][6], + $val['final'][0], $val['final'][1], $val['final'][2], $val['final'][3], $val['final'][4], $val['final'][5], $val['final'][6], + str_replace('
', '; ', $val['status']), $val['total_budget'], $val['receivable_budget'] ]; } } } -$average_A40001 = round($sum_A40001 / $sum_facility, 2); -$average_A40008 = round($sum_A40008 / $sum_facility, 2); -$average_budget = round($sum_total_budget / $sum_facility, 2); $total_data = json_encode($excel_aray); $boga_data = json_encode($boga_array); @@ -1819,51 +1426,6 @@ $facility_exclude_boga_data = json_encode($facility_exclude_boga_array); -
-
-

合約 (新梯)統整資訊

-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
- - -
-
-
-
- - - -
@@ -1973,6 +1535,7 @@ include "./footer.php"; \ No newline at end of file diff --git a/wms/account-receivable-test.xlsx b/wms/account-receivable-test.xlsx index 7522e49c..e96404b2 100644 Binary files a/wms/account-receivable-test.xlsx and b/wms/account-receivable-test.xlsx differ diff --git a/wms/cont/apply_form.php b/wms/cont/apply_form.php index 2c9f1d73..42589e9e 100644 --- a/wms/cont/apply_form.php +++ b/wms/cont/apply_form.php @@ -67,11 +67,10 @@ $subflow_assign_opinions = SubflowManager::getCounterSignComments($form_key); $wf->setFormData(['discount' => 100]); $flowName = $wf->getFlowName(); $assigner = $wf->getAssignerList(); - $assign_status = $wf->getAssignStatus($assigner); -echo '
';
-print_r($assigner);
-echo '
'; +// echo '
';
+// print_r($assign_status);
+// echo '
'; $if_show_assign = true; //加載流程圖 //$fc = WorkFLowItems::get_records($flow->getSystemID(), $flow->getFlowID()); @@ -247,8 +246,8 @@ if ($result['department_id'] == '511') { $managerid = 'M0137'; $managername = '劉永德'; } else if ($result['department_id'] == '512') { - $managerid = 'M0137'; - $managername = '劉永德'; + $managerid = 'M0054'; + $managername = '陳志文'; } else if ($result['department_id'] == '513') { $managerid = 'M0086'; $managername = '李烘銘'; @@ -662,7 +661,7 @@ if ($result['department_id'] == 'M0137' || $result['department_id'] == 'M0086' | - + prepare($sql); -$stmt->execute(); -$result = $stmt->fetchAll(PDO::FETCH_ASSOC); -echo '
';
-print_r($result);
-echo '
'; -// $date = date("Y-m-d"); -// $date1 = str_replace('-', '', $date); -// $arr = [ -// "date" => $date1 -// ]; +$validation = get_Auth(); +$data = [ + [ + "name" => "OtherStockOutMtable", + "rows" => [ + [ + "BillNo" => "00850110", // 單據編號 varchar(20) + "BillDate" => 20210427, // 單據日期 int + "OrgId" => "1000", //組織 varchar(20) + "FOrgId" => "1000", //核算組織 varchar(20) + "TypeId" => "OS", //單據類型 varchar(10) + "BizPartnerId" => "", //往來對象(供應商) 可為空 + "PersonId" => "C0003", // 經辦人員 varchar(20) + "DeptId" => "250", // 經辦部門 varchar(20) + "CompId" => "1001" // 公司 varchar(20) + ] + ] + ], [ + "name" => "OtherStockOutDetail", + "rows" => [ + [ + "BillNo" => "00850110", //單據編號 varchar(20) + "RowCode" => 1, // 序號 int(10) + "MaterialId" => "MX00021003", // 產品代碼 -> 產品集成 varchar(40) + "SupplyOrgId" => "1000", // 供貨組織代碼 varchar(20) + "SQuantity" => 1, // 交易數量 numeric(19) + "WarehouseId" => "100" // 倉庫代碼 varchar(20) + ] + ] + ] +]; +$api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/STKOTHERSTOCKOUT/PostERPData'; +$header = [ + "CHI_Authorization :" . $validation +]; +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); +curl_setopt($ch, CURLOPT_HTTPHEADER, $header); +curl_setopt($ch, CURLOPT_POST, 1); +curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); -// echo '
';
-// print_r($arr);
-// echo '
'; -// $validation = get_Auth(); -// $data = [ -// [ -// "name" => "OtherStockOutMtable", -// "rows" => [ -// [ -// "BillNo" => "00850110", // 單據編號 varchar(20) -// "BillDate" => 20210427, // 單據日期 int -// "OrgId" => "1000", //組織 varchar(20) -// "FOrgId" => "1000", //核算組織 varchar(20) -// "TypeId" => "OS", //單據類型 varchar(10) -// "BizPartnerId" => "", //往來對象(供應商) 可為空 -// "PersonId" => "C0003", // 經辦人員 varchar(20) -// "DeptId" => "250", // 經辦部門 varchar(20) -// "CompId" => "1001" // 公司 varchar(20) -// ] -// ] -// ], [ -// "name" => "OtherStockOutDetail", -// "rows" => [ -// [ -// "BillNo" => "00850110", //單據編號 varchar(20) -// "RowCode" => 1, // 序號 int(10) -// "MaterialId" => "MX00021003", // 產品代碼 -> 產品集成 varchar(40) -// "SupplyOrgId" => "1000", // 供貨組織代碼 varchar(20) -// "SQuantity" => 1, // 交易數量 numeric(19) -// "WarehouseId" => "100" // 倉庫代碼 varchar(20) -// ] -// ] -// ] -// ]; -// $data = file_get_contents('test.json'); -// echo '
';
-// print_r($data);
-// echo '
'; -// $api_url = 'https://erp.masada.com.tw:780/twWebAPI/V1/STKOTHERSTOCKOUT/PostERPData'; -// $header = [ -// "CHI_Authorization :" . $validation -// ]; -// $ch = curl_init(); -// curl_setopt($ch, CURLOPT_URL, $api_url); // 设置请求的URL -// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); -// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); -// curl_setopt($ch, CURLOPT_HTTPHEADER, $header); -// curl_setopt($ch, CURLOPT_POST, 1); -// curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); +$response = curl_exec($ch); +if ($response === false) { + echo 'Curl error: ' . curl_error($ch); +} else { + $result = json_decode($response, true); + if ($result['Status'] == 'Error') { + echo '
';
+        print_r($result);
+        echo '
'; + echo 'API 傳入錯誤,' . $result['ErrorMsg']; + } else { + echo '
';
+        print_r($result['Status']);
+        echo '
'; + return $result; + } +} -// $response = curl_exec($ch); -// if ($response === false) { -// echo 'Curl error: ' . curl_error($ch); -// } else { -// $result = json_decode($response, true); -// if ($result['Status'] == 'Error') { -// echo '
';
-//         print_r($result);
-//         echo '
'; -// echo 'API 傳入錯誤,' . $result['ErrorMsg']; -// } else { -// echo '
';
-//         print_r($result['Status']);
-//         echo '
'; -// return $result; -// } -// } - -// curl_close($ch); +curl_close($ch); diff --git a/wms/contract/contract-download.php b/wms/contract/contract-download.php index dee15d1f..f5851ed5 100644 --- a/wms/contract/contract-download.php +++ b/wms/contract/contract-download.php @@ -26,7 +26,7 @@ if (isset($_GET['id']) && $_GET['id'] != "") { $contracts = $stmt->fetchAll(PDO::FETCH_ASSOC); $contract = $contracts[0]; $contract_apply_id = $contract['id']; - if (($contract['status'] !== "YY" && $user_id != 'M0107') && $user_id != 'M0174' && $user_id != 'M0225') { + if (($contract['status'] !== "YY" && $user_id != 'M0107' && $user_id != "TEST02" && $user_id == "TEST01") && $user_id != 'M0174' && $user_id != 'M0225') { echo '"; echo ""; exit; @@ -15,25 +15,25 @@ LEFT JOIN account AS person_account ON contract_new_apply.review_person_id = per LEFT JOIN account AS person_final_account ON contract_new_apply.review_final_person_id = person_final_account.accountid WHERE contract_new_apply.mid = :mid"; $stmt = $conn->prepare($sql_str); -$stmt->bindParam(':mid',$id); +$stmt->bindParam(':mid', $id); $stmt->execute(); $contract_new_apply = $stmt->fetch(PDO::FETCH_ASSOC); $contract = $contract_new_apply; $isFirst = empty($contract_new_apply) ? 1 : 0; -if(empty($contract_new_apply)){ +if (empty($contract_new_apply)) { $sql_str = "SELECT pricereview_main.contractno, pricereview_main.ekind, pricereview_main.person, pricereview_main.company, pricereview_main.case_name, pricereview_main.address, pricereview_main.price_lowest, pricereview_main.price_total, pricereview_main.price_rate, pricereview_main.status as priceview_status, pricereview_main.id as mainid, account.name as accountname FROM pricereview_main JOIN account ON pricereview_main.person = account.accountid WHERE pricereview_main.id = :id"; $stmt = $conn->prepare($sql_str); - $stmt->bindParam(':id',$id); + $stmt->bindParam(':id', $id); $stmt->execute(); $contract = $stmt->fetch(PDO::FETCH_ASSOC); // print_r($contract); $accounttype = "M"; $sql_str = "SELECT * FROM account WHERE accounttype = :accounttype"; $stmt = $conn->prepare($sql_str); - $stmt->bindParam(':accounttype',$accounttype); + $stmt->bindParam(':accounttype', $accounttype); $stmt->execute(); $persons = $stmt->fetchAll(PDO::FETCH_ASSOC); $sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no ORDER BY created_at DESC"; @@ -43,14 +43,14 @@ if(empty($contract_new_apply)){ $customer = $stmt->fetch(PDO::FETCH_ASSOC); $mid = $contract['mainid']; - + $sql_str = "SELECT * FROM pricereview_item WHERE mid = :mid AND item_group = 'A'"; $stmt = $conn->prepare($sql_str); $stmt->bindParam(':mid', $mid); $stmt->execute(); $items = $stmt->fetchAll(PDO::FETCH_ASSOC); $total_items = 0; - foreach($items as $item){ + foreach ($items as $item) { $total_items += $item['item_qty']; } $sql_str = "SELECT * FROM pricereview_pay WHERE mid = :mid ORDER BY pay_kind ASC"; @@ -60,15 +60,14 @@ if(empty($contract_new_apply)){ $pays = $stmt->fetchAll(PDO::FETCH_ASSOC); $price_a = 0; $price_b = 0; - foreach($pays as $pay){ - if($pay['pay_kind'] <= 4){ + foreach ($pays as $pay) { + if ($pay['pay_kind'] <= 4) { $price_a = $price_a + $pay['pay_amount']; - }else{ + } else { $price_b = $price_b + $pay['pay_amount']; } } - -}else{ +} else { $mid = $contract['mid']; $contract_new_apply_id = $contract_new_apply['id']; $sql_str = "SELECT * FROM contract_new_apply_pays WHERE mid = :mid ORDER BY pay_kind ASC"; @@ -84,10 +83,10 @@ if(empty($contract_new_apply)){ $items = $stmt->fetchAll(PDO::FETCH_ASSOC); $price_a = 0; $price_b = 0; - foreach($pays as $pay){ - if($pay['pay_kind'] <= 4){ + foreach ($pays as $pay) { + if ($pay['pay_kind'] <= 4) { $price_a = $price_a + $pay['pay_amount']; - }else{ + } else { $price_b = $price_b + $pay['pay_amount']; } } @@ -112,7 +111,7 @@ $person = $contract['person'];
-
+
@@ -142,61 +141,61 @@ $person = $contract['person']; - + - + @@ -282,29 +281,31 @@ $person = $contract['person']; - +
統一編號/身分證字號 - -

未填寫

+ +

未填寫

合約書申請日期 -

未填寫

+

未填寫

申請類別 -

未填寫

+

未填寫

案件名稱 - -

未填寫

+ +

未填寫

立約人 - -

未填寫

+ +

未填寫

負責人 - -

未填寫

+ +

未填寫

含稅給約總價 - -

未填寫

+ +

未填寫

含稅貸款(A) - -

未填寫

+ +

未填寫

含稅安裝款(A) - -

未填寫

+ +

未填寫

聯絡地址 - -

未填寫

+ +

未填寫

免保期限 @@ -206,9 +205,9 @@ $person = $contract['person']; 個月 -

未填寫

+

未填寫

完工期限 -
-
- 乙方應於貨抵工地後每台 -
- -
- 日內安裝完成 +
+
+ 乙方應於貨抵工地後每台 +
+ +
+ 日內安裝完成 +
+
-
-
-

未填寫

+

未填寫

交貨地點 - -

未填寫

+ +

未填寫

交貨期限 @@ -258,7 +257,7 @@ $person = $contract['person']; 天出貨 -

未填寫

+

未填寫

電梯總數
- + @@ -334,99 +335,99 @@ $person = $contract['person']; - - + "訂金", - 2=> "二次款", - 3=>"貨到款", - 4=>"", - 5=>"安裝款", - 6=>"尾款", - 7=>"", + 1 => "訂金", + 2 => "二次款", + 3 => "貨到款", + 4 => "", + 5 => "安裝款", + 6 => "尾款", + 7 => "", ]; $paydate = [ - 1=>"合約日", - 2=>"合約日", - 3=>"出貨日", - 4=>"", - 5=>"竣檢日", - 6=>"交車日", - 7=>"" + 1 => "合約日", + 2 => "合約日", + 3 => "出貨日", + 4 => "", + 5 => "竣檢日", + 6 => "交車日", + 7 => "" ]; - ?> - - - - - - - + + + + + - + - - - + + + +
-

-
-

-
- - - - - - - -

貨抵工地付貨到款

- - - - - - - -

-

- -
-

-
-
- -
- 天 + +
+

+
+

+
+ + + + + + + +

貨抵工地付貨到款

+ + + + + + + +

-

+ +
+

+
+
+ +
+ 天 +
- -
-
- -
- 天 +
+
+ +
+ 天 +
- -
-

%

-
-

-
+

%

+
+

+
@@ -437,7 +438,7 @@ $person = $contract['person']; 第二期款交貨期限(日) -

未填寫

+

未填寫

@@ -459,20 +460,20 @@ $person = $contract['person']; 附件上傳 - - + + - + @@ -484,7 +485,7 @@ $person = $contract['person'];

簽核流程

- + 審核 @@ -492,43 +493,43 @@ $person = $contract['person']; 結果 意見 時間 - 審核意見 + 審核意見 營業員 - = 1): ?>已送審 - 暫存 - 未提交 + = 1) : ?>已送審 + 暫存 + 未提交 --- - - + + 業務承辦人 - + - = 2): ?>已同意 - 結案不同意 - --- - + = 2) : ?>已同意 + 結案不同意 + --- + 業務部協理 - + - 結案同意 - 結案不同意 - --- - + 結案同意 + 結案不同意 + --- + @@ -538,7 +539,7 @@ $person = $contract['person']; - + 審核中...