Cheng 1 year ago
parent
commit
7bba4a35a3
  1. BIN
      wms/account-receivable-contract.xlsx
  2. 24
      wms/account-receivable-excel.php
  3. 17
      wms/account-receivable-maintainance-index.php
  4. 257
      wms/account-receivable-new-index.php
  5. 7
      wms/account-receivable-test.php
  6. 2
      wms/account-receivable.txt

BIN
wms/account-receivable-contract.xlsx

Binary file not shown.

24
wms/account-receivable-excel.php

@ -5,6 +5,10 @@ require_once dirname(__DIR__) . '/common/composer/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\Font;
header('Content-Type: application/json'); header('Content-Type: application/json');
$type = $_GET['type']; $type = $_GET['type'];
@ -14,8 +18,16 @@ $spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
if ($type == 'newContract') { if ($type == 'newContract') {
$sheet->mergeCells('A1:X1');
$sheet->setTitle('新梯催收統整');
$sheet->setCellValue('A1', '新梯催收統整');
$sheet->getStyle('A1')->getFont()->setBold(true);
$sheet->getStyle('A1')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$sheet->getStyle('A1')->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
$sheet->getStyle('A1')->getFont()->setSize(14);
$sheet->getRowDimension('1')->setRowHeight(38);
$colomnHeader = [ $colomnHeader = [
'合約號', '客戶名稱', '營業員', '合約金額', '台數', '作番狀態', '催收金額', '催收次數', '訂金催收金額', '訂金催收次數', '二次款催收金額', '二次款催收次數', '合約號', '客戶名稱','部門','營業員', '合約金額', '台數', '作番狀態', '催收金額', '訂金催收金額', '訂金催收次數', '二次款催收金額', '二次款催收次數',
'貨抵工地款催收金額', '貨抵工地款催收次數', '貨抵工地款催收金額', '貨抵工地款催收次數',
'安裝款催收金額', '安裝款催收次數', '安裝款催收金額', '安裝款催收次數',
'試車款催收金額', '試車款催收次數', '試車款催收金額', '試車款催收次數',
@ -25,8 +37,8 @@ if ($type == 'newContract') {
]; ];
file_put_contents('account-receivable.txt', json_encode($Bill, JSON_UNESCAPED_UNICODE)); file_put_contents('account-receivable.txt', json_encode($Bill, JSON_UNESCAPED_UNICODE));
$sheet->fromArray($colomnHeader, NULL, 'A1'); $sheet->fromArray($colomnHeader, NULL, 'A2');
$rowIndex = 2; $rowIndex = 3;
foreach ($Bill as $key => $value) { foreach ($Bill as $key => $value) {
$sheet->fromArray($value, NULL, 'A' . $rowIndex); $sheet->fromArray($value, NULL, 'A' . $rowIndex);
@ -34,9 +46,9 @@ if ($type == 'newContract') {
'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' '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'
]; ];
foreach ($column as $col) { foreach ($column as $col) {
if ($col == 'F') { if ($col == 'G') {
$sheet->getColumnDimension('F')->setWidth(35); $sheet->getColumnDimension('G')->setWidth(35);
$sheet->getStyle('F')->getAlignment()->setWrapText(true); $sheet->getStyle('G')->getAlignment()->setWrapText(true);
} else { } else {
// $sheet->getColumnDimension($col)->setAutoSize(true); // $sheet->getColumnDimension($col)->setAutoSize(true);
$sheet->getColumnDimension($col)->setWidth(10); $sheet->getColumnDimension($col)->setWidth(10);

17
wms/account-receivable-maintainance-index.php

@ -136,7 +136,6 @@ for ($i = 0; $i < count($rows); $i++) {
$tmpname = $row['ProjectId'] . $row['RowCode']; $tmpname = $row['ProjectId'] . $row['RowCode'];
$data[$tmpname] = $row; $data[$tmpname] = $row;
$data[$tmpname]['CU_EstPayDate'] = date('Y-m-d', strtotime($row['CU_EstPayDate'])); $data[$tmpname]['CU_EstPayDate'] = date('Y-m-d', strtotime($row['CU_EstPayDate']));
$receivable_date = $data[$tmpname]['CU_EstPayDate'];
$data[$tmpname]['havetopay'] = strtotime($row['CU_EstPayDate']) > $today ? '--' : 'V'; $data[$tmpname]['havetopay'] = strtotime($row['CU_EstPayDate']) > $today ? '--' : 'V';
$datahavetopay = strtotime($row['CU_EstPayDate']) > $today ? 0 : 1; $datahavetopay = strtotime($row['CU_EstPayDate']) > $today ? 0 : 1;
$data[$tmpname]['collecttime'] = collect_month(strtotime($row['CU_EstPayDate'])); $data[$tmpname]['collecttime'] = collect_month(strtotime($row['CU_EstPayDate']));
@ -152,19 +151,19 @@ for ($i = 0; $i < count($rows); $i++) {
$facility_no = $row['CU_MaterialId']; $facility_no = $row['CU_MaterialId'];
$RowCode = $row['RowCode']; $RowCode = $row['RowCode'];
$BillNo = $row['BillNo']; $BillNo = $row['BillNo'];
$data[$tmpname]['receivable_date'] = date('Y-m-d', strtotime($row['CU_EstPayDate'])); $data[$tmpname]['receivable_date'] = (is_null($row['CU_EstPayDate'])) ? null : date('Y-m-d', strtotime($row['CU_EstPayDate']));
$budget = $row['OAmountWithTax']; $receivable_date = (is_null($data[$tmpname]['receivable_date'])) ? null : $data[$tmpname]['receivable_date'];
$budget = (is_null($row['OAmountWithTax'])) ? 0 : $row['OAmountWithTax'];
$invoiceNo = $row['InvoiceNo']; $invoiceNo = $row['InvoiceNo'];
$tableinvoice_state = is_null($invoiceNo) ? 0 : 1; $tableinvoice_state = is_null($invoiceNo) ? 0 : 1;
$data[$tmpname]['invoice_budget'] = is_null($row['InvoiceOAmount']) ? 0 : $row['InvoiceOAmount']; $data[$tmpname]['invoice_budget'] = is_null($row['InvoiceOAmount']) ? 0 : $row['InvoiceOAmount'];
$invoice_budget = $data[$tmpname]['invoice_budget']; $invoice_budget = (is_null($data[$tmpname]['invoice_budget'])) ? 0 : $data[$tmpname]['invoice_budget'];
$table_writeoff = ($data[$tmpname]['WriteOff'] =='V') ? 1 : 0; $table_writeoff = ($data[$tmpname]['WriteOff'] =='V') ? 1 : 0;
$table1 = "INSERT INTO account_receivable_maintainance( $table1 = "INSERT INTO account_receivable_maintainance(
`contract_no`, `contract_no`,
`facility_no`, `facility_no`,
`RowCode`, `RowCode`,
`BillNo`, `BillNo`,
`receivable_date`,
`budget`, `budget`,
`receivable`, `receivable`,
`invoice_state`, `invoice_state`,
@ -176,24 +175,26 @@ for ($i = 0; $i < count($rows); $i++) {
'$facility_no', '$facility_no',
'$RowCode', '$RowCode',
'$BillNo', '$BillNo',
'$receivable_date',
$budget, $budget,
$datahavetopay, $datahavetopay,
$tableinvoice_state, $tableinvoice_state,
$invoice_budget, $invoice_budget,
$table_writeoff $table_writeoff
"; ";
$table1 .= is_null($receivable_date) ? "" : ",`receivable_date`";
$table2 .= is_null($receivable_date) ? "" : ",'$receivable_date'";
$table1 .= is_null($invoicedate) ? "" : ",`invoice_date`"; $table1 .= is_null($invoicedate) ? "" : ",`invoice_date`";
$table2 .= is_null($invoicedate) ? "" : ",'$invoicedate'"; $table2 .= is_null($invoicedate) ? "" : ",'$invoicedate'";
$table1 .= is_null($invoiceNo) ? "" : ",`invoice_no`"; $table1 .= is_null($invoiceNo) ? "" : ",`invoice_no`";
$table2 .= is_null($invoiceNo) ? "" : ",'$invoiceNo'"; $table2 .= is_null($invoiceNo) ? "" : ",'$invoiceNo'";
$table .= $table1 . $table2 . "); \n"; $table .= $table1 . $table2 . "); \n";
} }
// $file_path = 'account_receivable_maintainance_sql.sql'; // $file_path = 'account_receivable_maintainance_sql.sql';
// if (file_put_contents($file_path, $table) !== false) { // if (file_put_contents($file_path, $table) !== false) {
// echo "SQL文件已成功生成:{$file_path}"; // echo "SQL文件已成功生成:{$file_path}";
// } else { // }else{
// echo "生成SQL文件时出现错误。"; // "fail";
// } // }
// foreach ($data as $key => $row) { // foreach ($data as $key => $row) {

257
wms/account-receivable-new-index.php

@ -338,6 +338,10 @@ $sign0 = array('簽約', '簽訂', '合約簽訂', '訂金');
$arrival = array('貨抵工地', '貨底工地', '工地動工'); $arrival = array('貨抵工地', '貨底工地', '工地動工');
$final6 = array('核可函取得後6個月', '得合格函後6個月'); $final6 = array('核可函取得後6個月', '得合格函後6個月');
foreach ($PayStage_array as $key => &$value) { foreach ($PayStage_array as $key => &$value) {
foreach ($value as $paykey => &$payvalue) { foreach ($value as $paykey => &$payvalue) {
if (isset($wip_array[$payvalue['facilityno']])) { if (isset($wip_array[$payvalue['facilityno']])) {
@ -860,7 +864,20 @@ $excel_contract_boga_array = array();
$excel_contract_noboga_array = array(); $excel_contract_noboga_array = array();
$excel_facility_array = array(); $excel_facility_array = array();
$total_collect_budget = 0;
$total_collect_facility = 0;
$boga_collect_budget = 0;
$boga_collect_facility = 0;
$noboga_collect_budget = 0;
$noboga_collect_facility = 0;
$total_sign_collect_budget = $boga_sign_collect_budget = $noboga_sign_collect_budget = 0;
$total_second_collect_budget = $boga_second_collect_budget = $noboga_second_collect_budget = 0;
$total_arrival_collect_budget = $boga_arrival_collect_budget = $noboga_arrival_collect_budget = 0;
$total_install_collect_budget = $boga_install_collect_budget = $noboga_install_collect_budget = 0;
$total_tryrun_collect_budget = $boga_tryrun_collect_budget = $noboga_tryrun_collect_budget = 0;
$total_check_collect_budget = $boga_check_collect_budget = $noboga_check_collect_budget = 0;
$total_delivery_collect_budget = $boga_delivery_collect_budget = $noboga_delivery_collect_budget = 0;
$total_final_collect_budget = $boga_final_collect_budget = $noboga_final_collect_budget = 0;
foreach ($arrayData as $key => &$value) { foreach ($arrayData as $key => &$value) {
$excel_contract_array[$key] = array_fill(0, 76, ''); $excel_contract_array[$key] = array_fill(0, 76, '');
@ -875,30 +892,30 @@ foreach ($arrayData as $key => &$value) {
$excel_contract_array[$key][8] = (isset($value['PersonName']) && !is_null($value['PersonName'])) ? $value['PersonName'] : ''; $excel_contract_array[$key][8] = (isset($value['PersonName']) && !is_null($value['PersonName'])) ? $value['PersonName'] : '';
$excel_contract_array[$key][9] = (isset($value['ManagerId']) && !is_null($value['ManagerId'])) ? $value['ManagerId'] : ''; $excel_contract_array[$key][9] = (isset($value['ManagerId']) && !is_null($value['ManagerId'])) ? $value['ManagerId'] : '';
$excel_contract_array[$key][10] = (isset($value['ManagerName']) && !is_null($value['ManagerName'])) ? $value['ManagerName'] : ''; $excel_contract_array[$key][10] = (isset($value['ManagerName']) && !is_null($value['ManagerName'])) ? $value['ManagerName'] : '';
$excel_contract_array[$key][11] = (isset($value['OAmountWithTax']) && !is_null($value['OAmountWithTax'])) ? number_format(round($value['OAmountWithTax'])) : '0'; $excel_contract_array[$key][11] = (isset($value['OAmountWithTax']) && !is_null($value['OAmountWithTax'])) ? round($value['OAmountWithTax']) : 0;
$excel_contract_array[$key][12] = (isset($value['A40001']) && !is_null($value['A40001'])) ? number_format(round($value['A40001'])) : '0'; $excel_contract_array[$key][12] = (isset($value['A40001']) && !is_null($value['A40001'])) ? round($value['A40001']) : 0;
$excel_contract_array[$key][13] = (isset($value['A40008']) && !is_null($value['A40008'])) ? number_format(round($value['A40008'])) : '0'; $excel_contract_array[$key][13] = (isset($value['A40008']) && !is_null($value['A40008'])) ? round($value['A40008']) : 0;
$excel_contract_array[$key][14] = (isset($value['receivable_budget']) && !is_null($value['receivable_budget'])) ? $value['receivable_budget'] : 0; $excel_contract_array[$key][14] = (isset($value['receivable_budget']) && !is_null($value['receivable_budget'])) ? round($value['receivable_budget']) : 0;
$excel_contract_array[$key][15] = (isset($value['invoice_budget']) && !is_null($value['invoice_budget'])) ? number_format(round($value['invoice_budget'])) : '0'; $excel_contract_array[$key][15] = (isset($value['invoice_budget']) && !is_null($value['invoice_budget'])) ? round($value['invoice_budget']) : 0;
$excel_contract_array[$key][16] = (isset($value['received_budget']) && !is_null($value['received_budget'])) ? $value['received_budget'] : 0; $excel_contract_array[$key][16] = (isset($value['received_budget']) && !is_null($value['received_budget'])) ? round($value['received_budget']) : 0;
$value['collect_budget'] = (($excel_contract_array[$key][14] - $excel_contract_array[$key][16]) > 0) ? $excel_contract_array[$key][14] - $excel_contract_array[$key][16] : 0; $value['collect_budget'] = (abs($excel_contract_array[$key][14] - $excel_contract_array[$key][16]) > 10) ? round($excel_contract_array[$key][14] - $excel_contract_array[$key][16]) : 0;
$excel_contract_array[$key][17] = number_format(round($excel_contract_array[$key][14] - $excel_contract_array[$key][16])); $excel_contract_array[$key][17] = $value['collect_budget'];
$excel_contract_array[$key][18] = (isset($value['collect_month']) && !is_null($value['collect_month'])) ? number_format(round($value['collect_month'])) : '0'; $excel_contract_array[$key][18] = (isset($value['collect_month']) && !is_null($value['collect_month'])) ? round($value['collect_month']) : 0;
$excel_contract_array[$key][19] = (isset($value['facility_num']) && !is_null($value['facility_num'])) ? number_format(round($value['facility_num'])) : '0'; $excel_contract_array[$key][19] = (isset($value['facility_num']) && !is_null($value['facility_num'])) ? round($value['facility_num']) : 0;
$excel_contract_array[$key][20] = (isset($value['facility_status']) && !is_null($value['facility_status'])) ? $value['facility_status'] : '--'; $excel_contract_array[$key][20] = (isset($value['facility_status']) && !is_null($value['facility_status'])) ? $value['facility_status'] : '--';
$excel_contract_array[$key][14] = number_format(round($excel_contract_array[$key][14]));
$excel_contract_array[$key][16] = number_format(round($excel_contract_array[$key][16]));
if (isset($value['PayStage']) && is_iterable($value['PayStage'])) { if (isset($value['PayStage']) && is_iterable($value['PayStage'])) {
if ($excel_contract_array[$key][18] !== '0') { if ($excel_contract_array[$key][18] >0 && abs($value['collect_budget']) > 10) {
$excel_contract_all_array[$key] = array_fill(0, 24, 0); $excel_contract_all_array[$key] = array_fill(0, 24, 0);
$excel_contract_all_array[$key][0] = $excel_contract_array[$key][0]; $excel_contract_all_array[$key][0] = $excel_contract_array[$key][0];
$excel_contract_all_array[$key][1] = $excel_contract_array[$key][3]; $excel_contract_all_array[$key][1] = $excel_contract_array[$key][3];
$excel_contract_all_array[$key][2] = $excel_contract_array[$key][8]; $excel_contract_all_array[$key][2] = $excel_contract_array[$key][6];
$excel_contract_all_array[$key][3] = $excel_contract_array[$key][11]; $excel_contract_all_array[$key][3] = $excel_contract_array[$key][8];
$excel_contract_all_array[$key][4] = $excel_contract_array[$key][19]; $excel_contract_all_array[$key][4] = $excel_contract_array[$key][11];
$excel_contract_all_array[$key][5] = $excel_contract_array[$key][20]; $excel_contract_all_array[$key][5] = $excel_contract_array[$key][19];
$excel_contract_all_array[$key][6] = $excel_contract_array[$key][17]; $excel_contract_all_array[$key][6] = $excel_contract_array[$key][20];
$excel_contract_all_array[$key][7] = $excel_contract_array[$key][18]; $excel_contract_all_array[$key][7] = $excel_contract_array[$key][17];
$total_collect_budget += $excel_contract_all_array[$key][6];
$total_collect_facility += $excel_contract_all_array[$key][4];
$isBoga = 0; $isBoga = 0;
if (stristr($value['PayStage'][1]['PayStage'], '寶佳')) { if (stristr($value['PayStage'][1]['PayStage'], '寶佳')) {
$isBoga = 1; $isBoga = 1;
@ -911,6 +928,8 @@ foreach ($arrayData as $key => &$value) {
$excel_contract_boga_array[$key][5] = $excel_contract_array[$key][20]; $excel_contract_boga_array[$key][5] = $excel_contract_array[$key][20];
$excel_contract_boga_array[$key][6] = $excel_contract_array[$key][17]; $excel_contract_boga_array[$key][6] = $excel_contract_array[$key][17];
$excel_contract_boga_array[$key][7] = $excel_contract_array[$key][18]; $excel_contract_boga_array[$key][7] = $excel_contract_array[$key][18];
$boga_collect_budget += $excel_contract_boga_array[$key][6];
$boga_collect_facility += $excel_contract_boga_array[$key][4];
} else { } else {
$excel_contract_noboga_array[$key] = array_fill(0, 24, ''); $excel_contract_noboga_array[$key] = array_fill(0, 24, '');
$excel_contract_noboga_array[$key][0] = $excel_contract_array[$key][0]; $excel_contract_noboga_array[$key][0] = $excel_contract_array[$key][0];
@ -921,6 +940,8 @@ foreach ($arrayData as $key => &$value) {
$excel_contract_noboga_array[$key][5] = $excel_contract_array[$key][20]; $excel_contract_noboga_array[$key][5] = $excel_contract_array[$key][20];
$excel_contract_noboga_array[$key][6] = $excel_contract_array[$key][17]; $excel_contract_noboga_array[$key][6] = $excel_contract_array[$key][17];
$excel_contract_noboga_array[$key][7] = $excel_contract_array[$key][18]; $excel_contract_noboga_array[$key][7] = $excel_contract_array[$key][18];
$noboga_collect_budget += $excel_contract_noboga_array[$key][6];
$noboga_collect_facility += $excel_contract_noboga_array[$key][4];
} }
} }
@ -928,175 +949,174 @@ foreach ($arrayData as $key => &$value) {
switch ($payvalue['stage']) { switch ($payvalue['stage']) {
case "訂金": case "訂金":
$excel_contract_array[$key][21] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][21] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][22] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; $excel_contract_array[$key][22] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? round($payvalue['PlanPayAmt']) : 0;
$excel_contract_array[$key][23] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; $excel_contract_array[$key][23] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? round($payvalue['receivable_budget']) : 0;
$excel_contract_array[$key][24] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; $excel_contract_array[$key][24] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? round($payvalue['invoice_budget']) : 0;
$excel_contract_array[$key][25] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][25] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? round($payvalue['received_budget']) : 0;
$excel_contract_array[$key][26] = number_format(round($excel_contract_array[$key][23] - $excel_contract_array[$key][25])); $excel_contract_array[$key][26] = (abs($excel_contract_array[$key][23] - $excel_contract_array[$key][25]) >10)?round($excel_contract_array[$key][23] - $excel_contract_array[$key][25]):0;
$excel_contract_array[$key][27] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][27] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month']) && abs($excel_contract_array[$key][26]) > 10) ? round($payvalue['collect_month']) : 0;
$total_sign_collect_budget += $excel_contract_array[$key][26];
if (isset($excel_contract_all_array[$key])) { if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][8] = number_format(round($excel_contract_array[$key][23] - $excel_contract_array[$key][25])); $excel_contract_all_array[$key][8] = $excel_contract_array[$key][26];
$excel_contract_all_array[$key][9] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_all_array[$key][9] = $excel_contract_array[$key][27];
$total_sign_collect_budget += $excel_contract_all_array[$key][8];
if ($isBoga == 1) { if ($isBoga == 1) {
$excel_contract_boga_array[$key][8] = $excel_contract_all_array[$key][8]; $excel_contract_boga_array[$key][8] = $excel_contract_all_array[$key][8];
$excel_contract_boga_array[$key][9] = $excel_contract_all_array[$key][9]; $excel_contract_boga_array[$key][9] = $excel_contract_all_array[$key][9];
$boga_sign_collect_budget += $excel_contract_boga_array[$key][8];
} else { } else {
$excel_contract_noboga_array[$key][8] = $excel_contract_all_array[$key][8]; $excel_contract_noboga_array[$key][8] = $excel_contract_all_array[$key][8];
$excel_contract_noboga_array[$key][9] = $excel_contract_all_array[$key][9]; $excel_contract_noboga_array[$key][9] = $excel_contract_all_array[$key][9];
$noboga_sign_collect_budget += $excel_contract_noboga_array[$key][8];
} }
} }
$excel_contract_array[$key][23] = number_format(round($excel_contract_array[$key][23]));
$excel_contract_array[$key][25] = number_format(round($excel_contract_array[$key][25]));
break; break;
case "二次款": case "二次款":
$excel_contract_array[$key][28] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][28] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][29] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; $excel_contract_array[$key][29] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? round($payvalue['PlanPayAmt']) : 0;
$excel_contract_array[$key][30] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; $excel_contract_array[$key][30] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? round($payvalue['receivable_budget']) : 0;
$excel_contract_array[$key][31] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; $excel_contract_array[$key][31] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? round($payvalue['invoice_budget']) : 0;
$excel_contract_array[$key][32] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][32] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? round($payvalue['received_budget']) : 0;
$excel_contract_array[$key][33] = number_format(round($excel_contract_array[$key][30] - $excel_contract_array[$key][32])); $excel_contract_array[$key][33] = (abs($excel_contract_array[$key][30] - $excel_contract_array[$key][32]) >10)?round($excel_contract_array[$key][30] - $excel_contract_array[$key][32]):0;
$excel_contract_array[$key][34] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][34] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month']) && abs($excel_contract_array[$key][33]) > 10) ? round($payvalue['collect_month']) : 0;
if (isset($excel_contract_all_array[$key])) { if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][10] = number_format(round($excel_contract_array[$key][30] - $excel_contract_array[$key][32])); $excel_contract_all_array[$key][10] = $excel_contract_array[$key][33];
$excel_contract_all_array[$key][11] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_all_array[$key][11] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? round($payvalue['collect_month']) : 0;
$total_second_collect_budget += $excel_contract_all_array[$key][10];
if ($isBoga == 1) { if ($isBoga == 1) {
$excel_contract_boga_array[$key][10] = $excel_contract_all_array[$key][10]; $excel_contract_boga_array[$key][10] = $excel_contract_all_array[$key][10];
$excel_contract_boga_array[$key][11] = $excel_contract_all_array[$key][11]; $excel_contract_boga_array[$key][11] = $excel_contract_all_array[$key][11];
$boga_second_collect_budget += $excel_contract_boga_array[$key][10];
} else { } else {
$excel_contract_noboga_array[$key][10] = $excel_contract_all_array[$key][10]; $excel_contract_noboga_array[$key][10] = $excel_contract_all_array[$key][10];
$excel_contract_noboga_array[$key][11] = $excel_contract_all_array[$key][11]; $excel_contract_noboga_array[$key][11] = $excel_contract_all_array[$key][11];
$noboga_second_collect_budget += $excel_contract_noboga_array[$key][10];
} }
} }
$excel_contract_array[$key][30] = number_format(round($excel_contract_array[$key][30]));
$excel_contract_array[$key][32] = number_format(round($excel_contract_array[$key][32]));
break; break;
case "貨抵工地款": case "貨抵工地款":
$excel_contract_array[$key][35] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][35] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][36] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; $excel_contract_array[$key][36] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? round($payvalue['PlanPayAmt']) : 0;
$excel_contract_array[$key][37] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; $excel_contract_array[$key][37] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? round($payvalue['receivable_budget']) : 0;
$excel_contract_array[$key][38] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; $excel_contract_array[$key][38] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? round($payvalue['invoice_budget']) : 0;
$excel_contract_array[$key][39] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][39] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? round($payvalue['received_budget']) : 0;
$excel_contract_array[$key][40] = number_format(round($excel_contract_array[$key][37] - $excel_contract_array[$key][39])); $excel_contract_array[$key][40] = (abs($excel_contract_array[$key][37] - $excel_contract_array[$key][39])>10)?round($excel_contract_array[$key][37] - $excel_contract_array[$key][39]):0;
$excel_contract_array[$key][41] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][41] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month']) && abs($excel_contract_array[$key][40]) > 10) ? round($payvalue['collect_month']) : 0;
if (isset($excel_contract_all_array[$key])) { if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][12] = number_format(round($excel_contract_array[$key][37] - $excel_contract_array[$key][39])); $excel_contract_all_array[$key][12] = $excel_contract_array[$key][40];
$excel_contract_all_array[$key][13] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_all_array[$key][13] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? round($payvalue['collect_month']) : 0;
$total_arrival_collect_budget += $excel_contract_all_array[$key][12];
if ($isBoga == 1) { if ($isBoga == 1) {
$excel_contract_boga_array[$key][12] = $excel_contract_all_array[$key][12]; $excel_contract_boga_array[$key][12] = $excel_contract_all_array[$key][12];
$excel_contract_boga_array[$key][13] = $excel_contract_all_array[$key][13]; $excel_contract_boga_array[$key][13] = $excel_contract_all_array[$key][13];
$boga_arrival_collect_budget += $excel_contract_boga_array[$key][12];
} else { } else {
$excel_contract_noboga_array[$key][12] = $excel_contract_all_array[$key][12]; $excel_contract_noboga_array[$key][12] = $excel_contract_all_array[$key][12];
$excel_contract_noboga_array[$key][13] = $excel_contract_all_array[$key][13]; $excel_contract_noboga_array[$key][13] = $excel_contract_all_array[$key][13];
$noboga_arrival_collect_budget += $excel_contract_noboga_array[$key][12];
} }
} }
$excel_contract_array[$key][37] = number_format(round($excel_contract_array[$key][37]));
$excel_contract_array[$key][39] = number_format(round($excel_contract_array[$key][39]));
break; break;
case "安裝款": case "安裝款":
$excel_contract_array[$key][42] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][42] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][43] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; $excel_contract_array[$key][43] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? round($payvalue['PlanPayAmt']) : 0;
$excel_contract_array[$key][44] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; $excel_contract_array[$key][44] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? round($payvalue['receivable_budget']) : 0;
$excel_contract_array[$key][45] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; $excel_contract_array[$key][45] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? round($payvalue['invoice_budget']) : 0;
$excel_contract_array[$key][46] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][46] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? round($payvalue['received_budget']) : 0;
$excel_contract_array[$key][47] = number_format(round($excel_contract_array[$key][44] - $excel_contract_array[$key][46])); $excel_contract_array[$key][47] = (abs($excel_contract_array[$key][44] - $excel_contract_array[$key][46])>10)?round($excel_contract_array[$key][44] - $excel_contract_array[$key][46]):0;
$excel_contract_array[$key][48] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][48] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month']) && abs($excel_contract_array[$key][47]) > 10) ? round($payvalue['collect_month']) : 0;
if (isset($excel_contract_all_array[$key])) { if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][14] = number_format(round($excel_contract_array[$key][44] - $excel_contract_array[$key][46])); $excel_contract_all_array[$key][14] = $excel_contract_array[$key][47];
$excel_contract_all_array[$key][15] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_all_array[$key][15] = $excel_contract_array[$key][48];
$excel_contract_noboga_array[$key][14] = $excel_contract_all_array[$key][14]; $excel_contract_noboga_array[$key][14] = $excel_contract_all_array[$key][14];
$excel_contract_noboga_array[$key][15] = $excel_contract_all_array[$key][15]; $excel_contract_noboga_array[$key][15] = $excel_contract_all_array[$key][15];
$total_install_collect_budget += $excel_contract_all_array[$key][14];
$noboga_install_collect_budget += $excel_contract_noboga_array[$key][14];
} }
$excel_contract_array[$key][44] = number_format(round($excel_contract_array[$key][44]));
$excel_contract_array[$key][46] = number_format(round($excel_contract_array[$key][46]));
break; break;
case "試車款": case "試車款":
$excel_contract_array[$key][49] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][49] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][50] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; $excel_contract_array[$key][50] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? round($payvalue['PlanPayAmt']) : 0;
$excel_contract_array[$key][51] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; $excel_contract_array[$key][51] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? round($payvalue['receivable_budget']) : 0;
$excel_contract_array[$key][52] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; $excel_contract_array[$key][52] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? round($payvalue['invoice_budget']) : 0;
$excel_contract_array[$key][53] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][53] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? round($payvalue['received_budget']) : 0;
$excel_contract_array[$key][54] = number_format(round($excel_contract_array[$key][51] - $excel_contract_array[$key][53])); $excel_contract_array[$key][54] = (abs($excel_contract_array[$key][51] - $excel_contract_array[$key][53])>10)?round($excel_contract_array[$key][51] - $excel_contract_array[$key][53]):0;
$excel_contract_array[$key][55] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][55] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month']) && abs($excel_contract_array[$key][54]) > 10) ? round($payvalue['collect_month']) : 0;
if (isset($excel_contract_all_array[$key])) { if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][16] = number_format(round($excel_contract_array[$key][51] - $excel_contract_array[$key][53])); $excel_contract_all_array[$key][16] = $excel_contract_array[$key][54];
$excel_contract_all_array[$key][17] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_all_array[$key][17] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? round($payvalue['collect_month']) : 0;
$total_tryrun_collect_budget += $excel_contract_all_array[$key][16];
if ($isBoga == 1) { if ($isBoga == 1) {
$excel_contract_boga_array[$key][16] = $excel_contract_all_array[$key][16]; $excel_contract_boga_array[$key][16] = $excel_contract_all_array[$key][16];
$excel_contract_boga_array[$key][17] = $excel_contract_all_array[$key][17]; $excel_contract_boga_array[$key][17] = $excel_contract_all_array[$key][17];
$boga_tryrun_collect_budget += $excel_contract_boga_array[$key][16];
} else { } else {
$excel_contract_noboga_array[$key][16] = $excel_contract_all_array[$key][16]; $excel_contract_noboga_array[$key][16] = $excel_contract_all_array[$key][16];
$excel_contract_noboga_array[$key][17] = $excel_contract_all_array[$key][17]; $excel_contract_noboga_array[$key][17] = $excel_contract_all_array[$key][17];
$noboga_tryrun_collect_budget += $excel_contract_noboga_array[$key][16];
} }
} }
$excel_contract_array[$key][51] = number_format(round($excel_contract_array[$key][51]));
$excel_contract_array[$key][53] = number_format(round($excel_contract_array[$key][53]));
break; break;
case "官檢驗收款": case "官檢驗收款":
$excel_contract_array[$key][56] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][56] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][57] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; $excel_contract_array[$key][57] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? round($payvalue['PlanPayAmt']) : 0;
$excel_contract_array[$key][58] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; $excel_contract_array[$key][58] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? round($payvalue['receivable_budget']) : 0;
$excel_contract_array[$key][59] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; $excel_contract_array[$key][59] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? round($payvalue['invoice_budget']) : 0;
$excel_contract_array[$key][60] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][60] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? round($payvalue['received_budget']) : 0;
$excel_contract_array[$key][61] = number_format(round($excel_contract_array[$key][58] - $excel_contract_array[$key][60])); $excel_contract_array[$key][61] = (abs($excel_contract_array[$key][58] - $excel_contract_array[$key][60])>10)?round($excel_contract_array[$key][58] - $excel_contract_array[$key][60]):0;
$excel_contract_array[$key][62] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][62] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month']) && abs($excel_contract_array[$key][61]) > 10) ? round($payvalue['collect_month']) : 0;
if (isset($excel_contract_all_array[$key])) { if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][18] = number_format(round($excel_contract_array[$key][58] - $excel_contract_array[$key][60])); $excel_contract_all_array[$key][18] = $excel_contract_array[$key][61];
$excel_contract_all_array[$key][19] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_all_array[$key][19] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? round($payvalue['collect_month']) : 0;
$total_check_collect_budget += $excel_contract_all_array[$key][18];
$excel_contract_noboga_array[$key][18] = $excel_contract_all_array[$key][18]; $excel_contract_noboga_array[$key][18] = $excel_contract_all_array[$key][18];
$excel_contract_noboga_array[$key][19] = $excel_contract_all_array[$key][19]; $excel_contract_noboga_array[$key][19] = $excel_contract_all_array[$key][19];
$noboga_check_collect_budget += $excel_contract_noboga_array[$key][18];
} }
$excel_contract_array[$key][58] = number_format(round($excel_contract_array[$key][58]));
$excel_contract_array[$key][60] = number_format(round($excel_contract_array[$key][60]));
break; break;
case "交車款": case "交車款":
$excel_contract_array[$key][63] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][63] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][64] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; $excel_contract_array[$key][64] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? round($payvalue['PlanPayAmt']) : 0;
$excel_contract_array[$key][65] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; $excel_contract_array[$key][65] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? round($payvalue['receivable_budget']) : 0;
$excel_contract_array[$key][66] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; $excel_contract_array[$key][66] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? round($payvalue['invoice_budget']) : 0;
$excel_contract_array[$key][67] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][67] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? round($payvalue['received_budget']) : 0;
$excel_contract_array[$key][68] = number_format(round($excel_contract_array[$key][65] - $excel_contract_array[$key][67])); $excel_contract_array[$key][68] = (abs($excel_contract_array[$key][65] - $excel_contract_array[$key][67])>10)?round($excel_contract_array[$key][65] - $excel_contract_array[$key][67]):0;
$excel_contract_array[$key][69] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][69] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month']) && abs($excel_contract_array[$key][68]) > 10) ? round($payvalue['collect_month']) : 0;
if (isset($excel_contract_all_array[$key])) { if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][20] = number_format(round($excel_contract_array[$key][65] - $excel_contract_array[$key][67])); $excel_contract_all_array[$key][20] = $excel_contract_array[$key][68];
$excel_contract_all_array[$key][21] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_all_array[$key][21] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? round($payvalue['collect_month']) : 0;
$total_delivery_collect_budget += $excel_contract_all_array[$key][20];
$excel_contract_noboga_array[$key][20] = $excel_contract_all_array[$key][20]; $excel_contract_noboga_array[$key][20] = $excel_contract_all_array[$key][20];
$excel_contract_noboga_array[$key][21] = $excel_contract_all_array[$key][21]; $excel_contract_noboga_array[$key][21] = $excel_contract_all_array[$key][21];
$noboga_delivery_collect_budget += $excel_contract_noboga_array[$key][20];
} }
$excel_contract_array[$key][65] = number_format(round($excel_contract_array[$key][65]));
$excel_contract_array[$key][67] = number_format(round($excel_contract_array[$key][67]));
break; break;
case "尾款": case "尾款":
$excel_contract_array[$key][70] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--'; $excel_contract_array[$key][70] = (isset($payvalue['PayStage']) && !is_null($payvalue['PayStage'])) ? $payvalue['PayStage'] : '--';
$excel_contract_array[$key][71] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? number_format(round($payvalue['PlanPayAmt'])) : '0'; $excel_contract_array[$key][71] = (isset($payvalue['PlanPayAmt']) && !is_null($payvalue['PlanPayAmt'])) ? round($payvalue['PlanPayAmt']) : 0;
$excel_contract_array[$key][72] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? $payvalue['receivable_budget'] : 0; $excel_contract_array[$key][72] = (isset($payvalue['receivable_budget']) && !is_null($payvalue['receivable_budget'])) ? round($payvalue['receivable_budget']) : 0;
$excel_contract_array[$key][73] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? number_format(round($payvalue['invoice_budget'])) : '0'; $excel_contract_array[$key][73] = (isset($payvalue['invoice_budget']) && !is_null($payvalue['invoice_budget'])) ? round($payvalue['invoice_budget']) : 0;
$excel_contract_array[$key][74] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? $payvalue['received_budget'] : 0; $excel_contract_array[$key][74] = (isset($payvalue['received_budget']) && !is_null($payvalue['received_budget'])) ? round($payvalue['received_budget']) : 0;
$excel_contract_array[$key][75] = number_format(round($excel_contract_array[$key][72] - $excel_contract_array[$key][74])); $excel_contract_array[$key][75] = (abs($excel_contract_array[$key][72] - $excel_contract_array[$key][74])>10)?round($excel_contract_array[$key][72] - $excel_contract_array[$key][74]):0;
$excel_contract_array[$key][76] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_array[$key][76] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month']) && abs($excel_contract_array[$key][75]) > 10) ? round($payvalue['collect_month']) : 0;
if (isset($excel_contract_all_array[$key])) { if (isset($excel_contract_all_array[$key])) {
$excel_contract_all_array[$key][22] = number_format(round($excel_contract_array[$key][72] - $excel_contract_array[$key][74])); $excel_contract_all_array[$key][22] = $excel_contract_array[$key][75];
$excel_contract_all_array[$key][23] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? number_format(round($payvalue['collect_month'])) : '0'; $excel_contract_all_array[$key][23] = (isset($payvalue['collect_month']) && !is_null($payvalue['collect_month'])) ? round($payvalue['collect_month']) : 0;
$total_final_collect_budget += $excel_contract_all_array[$key][22];
if ($isBoga == 1) { if ($isBoga == 1) {
$excel_contract_boga_array[$key][22] = $excel_contract_all_array[$key][22]; $excel_contract_boga_array[$key][22] = $excel_contract_all_array[$key][22];
$excel_contract_boga_array[$key][23] = $excel_contract_all_array[$key][23]; $excel_contract_boga_array[$key][23] = $excel_contract_all_array[$key][23];
$boga_final_collect_budget += $excel_contract_boga_array[$key][22];
} else { } else {
$excel_contract_noboga_array[$key][22] = $excel_contract_all_array[$key][22]; $excel_contract_noboga_array[$key][22] = $excel_contract_all_array[$key][22];
$excel_contract_noboga_array[$key][23] = $excel_contract_all_array[$key][23]; $excel_contract_noboga_array[$key][23] = $excel_contract_all_array[$key][23];
$noboga_final_collect_budget += $excel_contract_noboga_array[$key][22];
} }
} }
$excel_contract_array[$key][72] = number_format(round($excel_contract_array[$key][72]));
$excel_contract_array[$key][74] = number_format(round($excel_contract_array[$key][74]));
break; break;
} }
} }
@ -1117,6 +1137,29 @@ foreach ($arrayData as $key => &$value) {
} }
} }
} }
// $excel_contract_all_array['last']= $excel_contract_boga_array['last'] = $excel_contract_noboga_array['last'] = array_fill(0, 23, '');
$excel_contract_all_array['last']= ['合計', '', '', '', $total_collect_facility, '', $total_collect_budget, '', $total_sign_collect_budget, '', $total_second_collect_budget, '', $total_arrival_collect_budget, '', $total_install_collect_budget, '', $total_tryrun_collect_budget, '', $total_check_collect_budget, '', $total_delivery_collect_budget, '', $total_final_collect_budget, ''];
$excel_contract_boga_array['last']= ['合計', '', '', '', $boga_collect_facility, '', $boga_collect_budget, '', $boga_sign_collect_budget, '', $boga_second_collect_budget, '', $boga_arrival_collect_budget, '', $boga_install_collect_budget, '', $boga_tryrun_collect_budget, '', $boga_check_collect_budget, '', $boga_delivery_collect_budget, '', $boga_final_collect_budget, ''];
$excel_contract_noboga_array['last']= ['合計', '', '', '', $noboga_collect_facility, '', $noboga_collect_budget, '', $noboga_sign_collect_budget, '', $noboga_second_collect_budget, '', $noboga_arrival_collect_budget, '', $noboga_install_collect_budget, '', $noboga_tryrun_collect_budget, '', $noboga_check_collect_budget, '', $noboga_delivery_collect_budget, '', $noboga_final_collect_budget, ''];
// print_r($excel_contract_array['M230064']);
// echo "<br>---------------------------------------------------------<br>";
// foreach($arrayData['M230064'] as $key => $value){
// if($key == 'PayStage'){
// echo "是PayStage!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <br>";
// foreach($value as $k => $v){
// echo $k.' => ';
// print_r($v);
// echo '<br>';
// }
// echo "-----------------------<br>";
// }else{
// echo $key.' => ';
// print_r($value);
// echo '<br>';
// }
// }
// print_r($arrayData['M220003']); // print_r($arrayData['M220003']);
// exit(); // exit();
$total_data = json_encode($excel_contract_all_array); $total_data = json_encode($excel_contract_all_array);

7
wms/account-receivable-test.php

@ -441,7 +441,6 @@ $P_all = "
// echo $value['BillNo'] . ";" . $mode . ";" . $value['BizPartnerId'] .";".$value['BizPartnerName'].";".$value['ProjectId']. ";".$value['CU_MaterialId']. ";".$value['DispBillNo'].";" . $value['DispBillDate'] ."<br>"; // echo $value['BillNo'] . ";" . $mode . ";" . $value['BizPartnerId'] .";".$value['BizPartnerName'].";".$value['ProjectId']. ";".$value['CU_MaterialId']. ";".$value['DispBillNo'].";" . $value['DispBillDate'] ."<br>";
// } // }
$sql = "SELECT salOrderStagePay.BillNo, salOrderStagePay.PayStage FROM salOrderStagePay LEFT JOIN salSalesOrder ON salSalesOrder.BillNo = salOrderStagePay.BillNo WHERE salSalesOrder.ModeId = 'M'
$TIME = strtotime('2000-12-02'); ORDER BY salOrderStagePay.BillNo, salOrderStagePay.PayStage";
$query = mysqli_query($link, $sql);
echo $TIME;

2
wms/account-receivable.txt

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save