|
@ -1,11 +1,5 @@ |
|
|
<?php |
|
|
<?php |
|
|
include "header.php"; |
|
|
include "header.php"; |
|
|
require_once dirname(__DIR__) . '/common/composer/vendor/autoload.php'; |
|
|
|
|
|
|
|
|
|
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet; |
|
|
|
|
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx as xls; |
|
|
|
|
|
//use PhpOffice\PhpSpreadsheet\Reader\Xls; |
|
|
|
|
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx; |
|
|
|
|
|
|
|
|
|
|
|
$follower = find_follow($user_id); |
|
|
$follower = find_follow($user_id); |
|
|
$arrayData = []; |
|
|
$arrayData = []; |
|
@ -15,7 +9,7 @@ $received_array = []; |
|
|
//arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交 |
|
|
//arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交 |
|
|
$sql_received = "SELECT * from account_received"; |
|
|
$sql_received = "SELECT * from account_received"; |
|
|
|
|
|
|
|
|
$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName, s.PersonId, |
|
|
$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt, a.PlanPayDate,s.BizPartnerId,c.BizPartnerName, s.PersonId, |
|
|
c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a |
|
|
c.EnterpriseName, c.TaxNo, c.ContactAddress FROM salOrderStagePay AS a |
|
|
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo |
|
|
LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo |
|
|
LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId |
|
|
LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId |
|
@ -33,7 +27,9 @@ if (!(in_array(accountidToDepartId($user_id), array('220', '210')))) { |
|
|
$sql_contract .= ")"; |
|
|
$sql_contract .= ")"; |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
$sign60 = array('簽訂後60天', '簽約60日', '簽約後60天', '簽訂後60日內', '訂金支付後60天'); |
|
|
|
|
|
$sign90 = array('簽約後90天', '簽約後90日', '簽訂後90天'); |
|
|
|
|
|
$sign120 = array('簽約後120天', '簽約後120日', '簽訂後120天'); |
|
|
$contract = $conn->query($sql_contract); |
|
|
$contract = $conn->query($sql_contract); |
|
|
|
|
|
|
|
|
// 取收款資料 account_received |
|
|
// 取收款資料 account_received |
|
@ -59,6 +55,8 @@ foreach ($received_data as $received) { |
|
|
$received_array[$BillNo][2] = (intval($received['status']) < 4) ? intval($received['status']) : 0; |
|
|
$received_array[$BillNo][2] = (intval($received['status']) < 4) ? intval($received['status']) : 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 將T8合約收款階段資料依據款別分類放進arraData裡 |
|
|
foreach ($contract as $cont) { |
|
|
foreach ($contract as $cont) { |
|
|
// print_r($cont); |
|
|
// print_r($cont); |
|
|
// echo "<br>"; |
|
|
// echo "<br>"; |
|
@ -70,57 +68,215 @@ foreach ($contract as $cont) { |
|
|
$BillNo = $cont['BillNo']; |
|
|
$BillNo = $cont['BillNo']; |
|
|
}; |
|
|
}; |
|
|
$PayStage = $cont['PayStage']; |
|
|
$PayStage = $cont['PayStage']; |
|
|
|
|
|
$PlanPayDate = $cont['PlanPayDate']; |
|
|
$PayAmount = $cont['PlanPayAmt']; |
|
|
$PayAmount = $cont['PlanPayAmt']; |
|
|
$partnerName = $cont['BizPartnerName']; |
|
|
$partnerName = $cont['BizPartnerName']; |
|
|
$EnterpriseName = $cont['EnterpriseName']; |
|
|
$EnterpriseName = $cont['EnterpriseName']; |
|
|
$TaxNo = $cont['TaxNo']; |
|
|
$TaxNo = $cont['TaxNo']; |
|
|
$ContactAddress = $cont['ContactAddress']; |
|
|
$ContactAddress = $cont['ContactAddress']; |
|
|
//4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 |
|
|
//['sign'] 0 款項名稱 1 簽約金額 2 簽約日期 ['second'] 0 二次款名 1 二次款金額 2 收款日期 ['arrive'] 0 貨抵工地款名稱 1 貨抵工地款金額 2 貨抵工地收款日期 ['install'] 0 安裝款名 1 安裝金額 2 安裝收款日期 |
|
|
if (isset($arrayData[$BillNo])) { |
|
|
//['tryrun'] 0 試車款名 1試車金額 2 試車收款日期 ['check'] 0 官檢款名 1 官檢金額 2 官檢收款日期 ['delivery'] 0 交車款名 1 交車金額 2 交車收款日期 ['final'] 0 尾款名 1 尾款金額 2 尾款收款日期 |
|
|
|
|
|
if (!(isset($arrayData[$BillNo]))) { |
|
|
|
|
|
// 0 部門id 1 部門名稱 2 經理名稱 3 營業員id 4 營業員名稱 5 客戶名稱 6 抬頭 7 統編 8 通訊地址 |
|
|
|
|
|
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
|
|
|
|
|
$arrayData[$BillNo][5] = $partnerName; |
|
|
|
|
|
$arrayData[$BillNo][6] = $EnterpriseName; |
|
|
|
|
|
$arrayData[$BillNo][7] = $TaxNo; |
|
|
|
|
|
$arrayData[$BillNo][8] = $ContactAddress; |
|
|
|
|
|
} |
|
|
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { |
|
|
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { |
|
|
$arrayData[$BillNo][5] = $PayAmount; |
|
|
$arrayData[$BillNo]['second'][0] = $PayStage; |
|
|
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { |
|
|
$arrayData[$BillNo]['second'][1] = $PayAmount; |
|
|
$arrayData[$BillNo][4] = $PayAmount; |
|
|
$arrayData[$BillNo]['second'][2] = $PlanPayDate; |
|
|
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { |
|
|
if (isset($arrayData[$BillNo]['sign'][2]) && !is_null($arrayData[$BillNo]['sign'][2])) { |
|
|
$arrayData[$BillNo][6] = $PayAmount; |
|
|
$signtime = strtotime(strval($arrayData[$BillNo]['sign'][2])); |
|
|
|
|
|
if (in_array($PayStage, $sign60)) { |
|
|
|
|
|
$secondtime = $signtime - (60 * 86400); |
|
|
|
|
|
$secondtime = date('Ymd', $secondtime); |
|
|
|
|
|
$arrayData[$BillNo]['second'][2] = intval($secondtime); |
|
|
|
|
|
} elseif (in_array($PayStage, $sign90)) { |
|
|
|
|
|
$secondtime = $signtime - (90 * 86400); |
|
|
|
|
|
$secondtime = date('Ymd', $secondtime); |
|
|
|
|
|
$arrayData[$BillNo]['second'][2] = intval($secondtime); |
|
|
|
|
|
} elseif (in_array($PayStage, $sign120)) { |
|
|
|
|
|
$secondtime = $signtime - (120 * 86400); |
|
|
|
|
|
$secondtime = date('Ymd', $secondtime); |
|
|
|
|
|
$arrayData[$BillNo]['second'][2] = intval($secondtime); |
|
|
|
|
|
} elseif (stristr($PayStage, '簽訂後30天')) { |
|
|
|
|
|
$secondtime = $signtime - (30 * 86400); |
|
|
|
|
|
$secondtime = date('Ymd', $secondtime); |
|
|
|
|
|
$arrayData[$BillNo]['second'][2] = intval($secondtime); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金') || stristr($PayStage, '工地動工')) { |
|
|
|
|
|
$arrayData[$BillNo]['sign'][0] = $PayStage; |
|
|
|
|
|
$arrayData[$BillNo]['sign'][1] = $PayAmount; |
|
|
|
|
|
$arrayData[$BillNo]['sign'][2] = $PlanPayDate; |
|
|
} elseif (stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { |
|
|
} elseif (stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { |
|
|
$arrayData[$BillNo][8] = $PayAmount; |
|
|
$arrayData[$BillNo]['tryrun'][0] = $PayStage; |
|
|
} elseif (stristr($PayStage, '安裝')) { |
|
|
$arrayData[$BillNo]['tryrun'][1] = $PayAmount; |
|
|
$arrayData[$BillNo][7] = $PayAmount; |
|
|
$arrayData[$BillNo]['tryrun'][2] = $PlanPayDate; |
|
|
|
|
|
} elseif (stristr($PayStage, '安裝') || stristr($PayStage, '貨抵工地且完工')) { |
|
|
|
|
|
$arrayData[$BillNo]['install'][0] = $PayStage; |
|
|
|
|
|
$arrayData[$BillNo]['install'][1] = $PayAmount; |
|
|
|
|
|
$arrayData[$BillNo]['install'][2] = $PlanPayDate; |
|
|
|
|
|
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { |
|
|
|
|
|
$arrayData[$BillNo]['arrive'][0] = $PayStage; |
|
|
|
|
|
$arrayData[$BillNo]['arrive'][1] = $PayAmount; |
|
|
|
|
|
$arrayData[$BillNo]['arrive'][2] = $PlanPayDate; |
|
|
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { |
|
|
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { |
|
|
$arrayData[$BillNo][10] = $PayAmount; |
|
|
$arrayData[$BillNo]['delivery'][0] = $PayStage; |
|
|
|
|
|
$arrayData[$BillNo]['delivery'][1] = $PayAmount; |
|
|
|
|
|
$arrayData[$BillNo]['delivery'][2] = $PlanPayDate; |
|
|
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { |
|
|
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { |
|
|
$arrayData[$BillNo][9] = $PayAmount; |
|
|
$arrayData[$BillNo]['check'][0] = $PayStage; |
|
|
|
|
|
$arrayData[$BillNo]['check'][1] = $PayAmount; |
|
|
|
|
|
$arrayData[$BillNo]['check'][2] = $PlanPayDate; |
|
|
} else { |
|
|
} else { |
|
|
$arrayData[$BillNo][12] = $PayAmount; |
|
|
|
|
|
|
|
|
$arrayData[$BillNo]['other'][1] = $PayAmount; |
|
|
|
|
|
$arrayData[$BillNo]['other'][2] = $PlanPayDate; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
$sql = "SELECT |
|
|
|
|
|
tmp2.*, |
|
|
|
|
|
d.name AS depart_name |
|
|
|
|
|
FROM( |
|
|
|
|
|
SELECT |
|
|
|
|
|
a.manager, |
|
|
|
|
|
a2.name as manager_name, |
|
|
|
|
|
a.name, |
|
|
|
|
|
a.department_id, |
|
|
|
|
|
w.salesid, |
|
|
|
|
|
w.contractno, |
|
|
|
|
|
w.facilityno, |
|
|
|
|
|
w.estimated_shipping_date, |
|
|
|
|
|
w.actual_tofactory_date, |
|
|
|
|
|
w.real_arrival_date, |
|
|
|
|
|
w.install_end_date, |
|
|
|
|
|
w.tryrun_end_date, |
|
|
|
|
|
w.official_check_date, |
|
|
|
|
|
w.delivery_date |
|
|
|
|
|
from wipwholestatus AS w |
|
|
|
|
|
left join account AS a |
|
|
|
|
|
ON w.salesid = a.accountid |
|
|
|
|
|
left join account AS a2 |
|
|
|
|
|
ON a2.accountid = a.manager |
|
|
|
|
|
where w.status = '1' AND w.contract_type='A' |
|
|
|
|
|
)AS tmp2 |
|
|
|
|
|
left join ( |
|
|
|
|
|
SELECT DISTINCT |
|
|
|
|
|
department_id, |
|
|
|
|
|
name |
|
|
|
|
|
FROM department |
|
|
|
|
|
|
|
|
|
|
|
) AS d |
|
|
|
|
|
ON d.department_id = tmp2.department_id"; |
|
|
|
|
|
$wipwhole_array = mysqli_query($link, $sql); |
|
|
|
|
|
foreach ($wipwhole_array as $wip) { |
|
|
|
|
|
if (isset($arrayData[$wip['contractno']])) { |
|
|
|
|
|
$arrayData[$wip['contractno']][0] = $wip['department_id'];; |
|
|
|
|
|
$arrayData[$wip['contractno']][1] = $wip['depart_name']; |
|
|
|
|
|
$arrayData[$wip['contractno']][2] = $wip['manager_name']; |
|
|
|
|
|
$arrayData[$wip['contractno']][3] = $wip['salesid']; |
|
|
|
|
|
$arrayData[$wip['contractno']][4] = $wip['name']; |
|
|
|
|
|
if (isset($arrayData[$wip['contractno']]['second']) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前30天')) { |
|
|
|
|
|
$estimate_delivery_time = strtotime(strval($arrayData[$wip['contractno']]['second'][2])); |
|
|
|
|
|
$secondtime = $estimate_delivery_time - (30 * 86400); |
|
|
|
|
|
$secondtime = date('Ymd', $secondtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['second'][2] = intval($secondtime); |
|
|
|
|
|
} elseif (isset($arrayData[$wip['contractno']]['second']) && stristr($arrayData[$wip['contractno']]['second'][0], '出貨前90天')) { |
|
|
|
|
|
$estimate_delivery_time = strtotime(strval($arrayData[$wip['contractno']]['second'][2])); |
|
|
|
|
|
$secondtime = $estimate_delivery_time - (90 * 86400); |
|
|
|
|
|
$secondtime = date('Ymd', $secondtime); |
|
|
|
|
|
$arrayData[$wip['contractno']]['second'][2] = intval($secondtime); |
|
|
|
|
|
} |
|
|
|
|
|
$facitities = ""; |
|
|
|
|
|
$total_facility_num = 0; |
|
|
|
|
|
$arrive_num = 0; |
|
|
|
|
|
$tryrun_num = 0; |
|
|
|
|
|
$delivery_num = 0; |
|
|
|
|
|
$official_num = 0; |
|
|
|
|
|
if ($wip['delivery_date'] != NULL) { |
|
|
|
|
|
$facitities .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; |
|
|
|
|
|
$total_facility_num += 1; |
|
|
|
|
|
$arrive_num += 1; |
|
|
|
|
|
$tryrun_num += 1; |
|
|
|
|
|
$official_num += 1; |
|
|
|
|
|
$delivery_num += 1; |
|
|
|
|
|
} elseif ($wip['official_check_date'] != NULL) { |
|
|
|
|
|
$facitities .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) <br>"; |
|
|
|
|
|
$total_facility_num += 1; |
|
|
|
|
|
$arrive_num += 1; |
|
|
|
|
|
$tryrun_num += 1; |
|
|
|
|
|
$official_num += 1; |
|
|
|
|
|
} elseif ($wip['tryrun_end_date'] != NULL) { |
|
|
|
|
|
$facitities .= $wip['facilityno'] . " (" . $wip['tryrun_end_date'] . "試車完畢) <br>"; |
|
|
|
|
|
$total_facility_num += 1; |
|
|
|
|
|
$arrive_num += 1; |
|
|
|
|
|
$tryrun_num += 1; |
|
|
|
|
|
} elseif ($wip['install_end_date'] != NULL) { |
|
|
|
|
|
$facitities .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) <br>"; |
|
|
|
|
|
$total_facility_num += 1; |
|
|
|
|
|
$arrive_num += 1; |
|
|
|
|
|
} elseif ($wip['real_arrival_date'] != NULL) { |
|
|
|
|
|
$facitities .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) <br>"; |
|
|
|
|
|
$total_facility_num += 1; |
|
|
|
|
|
$arrive_num += 1; |
|
|
|
|
|
} elseif ($wip['actual_tofactory_date'] != NULL) { |
|
|
|
|
|
$facitities .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日) <br>"; |
|
|
|
|
|
$total_facility_num += 1; |
|
|
|
|
|
} elseif ($wip['estimated_shipping_date'] != NULL) { |
|
|
|
|
|
$facitities .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港) <br>"; |
|
|
|
|
|
$total_facility_num += 1; |
|
|
} else { |
|
|
} else { |
|
|
$arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
|
|
$facitities .= $wip['facilityno'] . " (預計到港日待確認) <br>"; |
|
|
$arrayData[$BillNo][3] = $partnerName; |
|
|
$total_facility_num += 1; |
|
|
$arrayData[$BillNo][13] = $EnterpriseName; |
|
|
} |
|
|
$arrayData[$BillNo][14] = $TaxNo; |
|
|
if ($total_facility_num > 0) { |
|
|
$arrayData[$BillNo][15] = $ContactAddress; |
|
|
$receivable_budget= $arrayData[$wip['contractno']]['sign'][1]; |
|
|
if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { |
|
|
// $receivable_budget = $value[4] + ($value[5] + $value[6]) * ($arrive_num / $total_facility_num) + |
|
|
$arrayData[$BillNo][5] = $PayAmount; |
|
|
// ($value[7] + $value[8]) * ($tryrun_num / $total_facility_num) + ($value[9]) * ($official_num / $total_facility_num) |
|
|
} elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { |
|
|
// + ($value[10]) * ($delivery_num / $total_facility_num); |
|
|
$arrayData[$BillNo][4] = $PayAmount; |
|
|
$uninvoice_budget = $receivable_budget; |
|
|
} elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { |
|
|
$unreceived_budget = $receivable_budget; |
|
|
$arrayData[$BillNo][6] = $PayAmount; |
|
|
$received_invoice = 0; |
|
|
} elseif (stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { |
|
|
$received_budget = 0; |
|
|
$arrayData[$BillNo][8] = $PayAmount; |
|
|
if (isset($received_array[$key][0])) { |
|
|
} elseif (stristr($PayStage, '安裝')) { |
|
|
$uninvoice_budget = $receivable_budget - $received_array[$key][0]; |
|
|
$arrayData[$BillNo][7] = $PayAmount; |
|
|
$received_invoice = $received_array[$key][0]; |
|
|
} elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { |
|
|
} else { |
|
|
$arrayData[$BillNo][10] = $PayAmount; |
|
|
$uninvoice_budget = $receivable_budget; |
|
|
} elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { |
|
|
} |
|
|
$arrayData[$BillNo][9] = $PayAmount; |
|
|
if (isset($received_array[$key][1])) { |
|
|
|
|
|
$unreceived_budget = $receivable_budget - $received_array[$key][1]; |
|
|
|
|
|
$received_budget = $received_array[$key][1]; |
|
|
|
|
|
} else { |
|
|
|
|
|
$unreceived_budget = $receivable_budget; |
|
|
|
|
|
} |
|
|
|
|
|
if (isset($received_array[$key][2])) { |
|
|
|
|
|
$status = $received_array[$key][2]; |
|
|
} else { |
|
|
} else { |
|
|
$arrayData[$BillNo][12] = $PayAmount; |
|
|
$status = 0; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
exit(); |
|
|
|
|
|
foreach ($arrayData as $key => $value) { |
|
|
|
|
|
echo $key . "<br>"; |
|
|
|
|
|
print_r($value); |
|
|
|
|
|
echo "<br><br>"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//D23070086 |
|
|
|
|
|
//Array ( [0] => 312 [1] => 桃竹營銷部 [2] => 張莉凱 [3] => M0074 [4] => 章又仁 [5] => 永融營造(大園學八街) [6] => 永融營造工程有限公司 [7] => 13010305 [8] => 桃園市平鎮區環南路184號7樓之2 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [sign] => Array ( [0] => 簽約 [1] => 210000.000000 [2] => 20230825 ) [arrive] => Array ( [0] => 貨抵工地 [1] => 525000.000000 [2] => 20231231 ) [tryrun] => Array ( [0] => 安裝試車 [1] => 210000.000000 [2] => 20240131 ) [delivery] => Array ( [0] => 交車 [1] => 105000.000000 [2] => 20240301 ) ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit(); |
|
|
|
|
|
|
|
|
foreach ($arrayData as $key => $value) { |
|
|
foreach ($arrayData as $key => $value) { |
|
|
|
|
|
if (array_key_exists($key, $arrayData) && isset($arrayData[$key])) { |
|
|
$sql = "SELECT |
|
|
$sql = "SELECT |
|
|
tmp2.*, |
|
|
tmp2.*, |
|
|
d.name AS depart_name |
|
|
d.name AS depart_name |
|
@ -162,13 +318,15 @@ ON d.department_id = tmp2.department_id"; |
|
|
$tryrun_num = 0; |
|
|
$tryrun_num = 0; |
|
|
$delivery_num = 0; |
|
|
$delivery_num = 0; |
|
|
$official_num = 0; |
|
|
$official_num = 0; |
|
|
|
|
|
$value[16] = ''; |
|
|
|
|
|
$value[17] = ''; |
|
|
$wipwhole_array = mysqli_query($link, $sql); |
|
|
$wipwhole_array = mysqli_query($link, $sql); |
|
|
foreach ($wipwhole_array as $wip) { |
|
|
foreach ($wipwhole_array as $wip) { |
|
|
$value[0] = $wip['depart_name']; |
|
|
$value[0] = $wip['depart_name']; |
|
|
$value[1] = $wip['manager_name']; |
|
|
$value[1] = $wip['manager_name']; |
|
|
$value[2] = $wip['name']; |
|
|
$value[2] = $wip['name']; |
|
|
$value[16] = isset($wip['department_id']) ? $wip['department_id'] : ''; |
|
|
$value[16] = is_null($wip['department_id']) ? '' : $wip['department_id']; |
|
|
$value[17] = isset($wip['salesid']) ? $wip['salesid'] : ''; |
|
|
$value[17] = is_null($wip['salesid']) ? '' : $wip['salesid']; |
|
|
if ($wip['delivery_date'] != NULL) { |
|
|
if ($wip['delivery_date'] != NULL) { |
|
|
$facitities .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; |
|
|
$facitities .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) <br>"; |
|
|
$total_facility_num += 1; |
|
|
$total_facility_num += 1; |
|
@ -243,7 +401,7 @@ ON d.department_id = tmp2.department_id"; |
|
|
$uninvoice_budget, $unreceived_budget, $status |
|
|
$uninvoice_budget, $unreceived_budget, $status |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$data = json_encode($receivable_array); |
|
|
$data = json_encode($receivable_array); |
|
@ -353,13 +511,29 @@ $data = json_encode($receivable_array); |
|
|
</table> |
|
|
</table> |
|
|
</div> |
|
|
</div> |
|
|
<script> |
|
|
<script> |
|
|
|
|
|
// function sendData(BillNo) { |
|
|
|
|
|
// console.log(BillNo); |
|
|
|
|
|
// var BillData = <?= $data ?>; |
|
|
|
|
|
// var Bill = BillData[BillNo]; |
|
|
|
|
|
// var form = document.createElement("form"); |
|
|
|
|
|
// form.method = 'POST'; |
|
|
|
|
|
// form.action = "account-receivable-excel.php?<?= $token_link ?>"; |
|
|
|
|
|
// var input = document.createElement("input"); |
|
|
|
|
|
// input.type = "hidden"; |
|
|
|
|
|
// input.name = "Bill"; |
|
|
|
|
|
// input.value = JSON.stringify(Bill); |
|
|
|
|
|
// form.appendChild(input); |
|
|
|
|
|
// document.body.appendChild(form); |
|
|
|
|
|
// form.submit(); |
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
function sendData(BillNo) { |
|
|
function sendData(BillNo) { |
|
|
console.log(BillNo); |
|
|
|
|
|
var BillData = <?= $data ?>; |
|
|
var BillData = <?= $data ?>; |
|
|
var Bill = BillData[BillNo]; |
|
|
var Bill = BillData; |
|
|
var form = document.createElement("form"); |
|
|
var form = document.createElement("form"); |
|
|
form.method = 'POST'; |
|
|
form.method = 'POST'; |
|
|
form.action = "account-receivable-check.php?<?= $token_link ?>"; |
|
|
form.action = "account-receivable-excel.php?<?= $token_link ?>"; |
|
|
var input = document.createElement("input"); |
|
|
var input = document.createElement("input"); |
|
|
input.type = "hidden"; |
|
|
input.type = "hidden"; |
|
|
input.name = "Bill"; |
|
|
input.name = "Bill"; |
|
|