From 8f0ab0aaa270da3896e6adf4f714fcd4056d618c Mon Sep 17 00:00:00 2001 From: Ellin Date: Thu, 30 Nov 2023 19:07:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=87=89=E6=94=B6=E5=B8=B3=E6=AC=BE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/T8_purRequestOrder_create.php | 1 + wms/account-receivable-index.php | 77 ++++++++++++++++--------------- wms/rib-test.php | 8 ++++ 3 files changed, 50 insertions(+), 36 deletions(-) create mode 100644 wms/T8_purRequestOrder_create.php diff --git a/wms/T8_purRequestOrder_create.php b/wms/T8_purRequestOrder_create.php new file mode 100644 index 00000000..b3d9bbc7 --- /dev/null +++ b/wms/T8_purRequestOrder_create.php @@ -0,0 +1 @@ +"; + //4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 +//arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交 +echo "合約號;部門;經理;營業員;客戶名稱;簽約款;二次款;貨抵工地款;安裝款;試車款;官檢款;交車款;目前應收;總作番數;貨抵;安裝試車;官檢;移交數;狀態
"; // $T8_array = mysqli_fetch_all($T8_array, MYSQLI_ASSOC); @@ -27,15 +29,15 @@ foreach ($contract as $cont) { // echo "
"; if ($cont['BillNo'] == 'SO20230801001') { $BillNo = 'M230947'; - }elseif ($cont['BillNo'] == 'SO20230801002'){ + } elseif ($cont['BillNo'] == 'SO20230801002') { $BillNo = 'M231067'; - }else{ + } else { $BillNo = $cont['BillNo']; }; $PayStage = $cont['PayStage']; $PayAmount = $cont['PlanPayAmt']; $partnerName = $cont['BizPartnerName']; - + //4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 if (isset($arrayData[$BillNo])) { if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { $arrayData[$BillNo][5] = $PayAmount; @@ -43,16 +45,14 @@ foreach ($contract as $cont) { $arrayData[$BillNo][4] = $PayAmount; } elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { $arrayData[$BillNo][6] = $PayAmount; - } elseif (stristr($PayStage, '安裝')) { - $arrayData[$BillNo][7] = $PayAmount; - } elseif (stristr($PayStage, '試車')) { + } elseif ( stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { $arrayData[$BillNo][8] = $PayAmount; - } elseif (stristr($PayStage, '交車') || stristr($PayStage, '完工') || stristr($PayStage, '驗收')) { - $arrayData[$BillNo][9] = $PayAmount; - } elseif (stristr($PayStage, '取得合格函') || stristr($PayStage, '取得許可函')) { + }elseif (stristr($PayStage, '安裝')) { + $arrayData[$BillNo][7] = $PayAmount; + } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { $arrayData[$BillNo][10] = $PayAmount; - } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月')) { - $arrayData[$BillNo][11] = $PayAmount; + } elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { + $arrayData[$BillNo][9] = $PayAmount; } else { $arrayData[$BillNo][12] = $PayAmount; } @@ -65,21 +65,20 @@ foreach ($contract as $cont) { $arrayData[$BillNo][4] = $PayAmount; } elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { $arrayData[$BillNo][6] = $PayAmount; - } elseif (stristr($PayStage, '安裝')) { - $arrayData[$BillNo][7] = $PayAmount; - } elseif (stristr($PayStage, '試車')) { + } elseif ( stristr($PayStage, '試車') || stristr($PayStage, '驗收完成')) { $arrayData[$BillNo][8] = $PayAmount; - } elseif (stristr($PayStage, '交車') || stristr($PayStage, '完工') || stristr($PayStage, '驗收')) { - $arrayData[$BillNo][9] = $PayAmount; - } elseif (stristr($PayStage, '取得合格函') || stristr($PayStage, '取得許可函')) { + }elseif (stristr($PayStage, '安裝')) { + $arrayData[$BillNo][7] = $PayAmount; + } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月') || stristr($PayStage, '交車')) { $arrayData[$BillNo][10] = $PayAmount; - } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月')) { - $arrayData[$BillNo][11] = $PayAmount; + } elseif (stristr($PayStage, '合格') || stristr($PayStage, '驗收') || stristr($PayStage, '許可') || stristr($PayStage, '核可')) { + $arrayData[$BillNo][9] = $PayAmount; } else { $arrayData[$BillNo][12] = $PayAmount; } } } + foreach ($arrayData as $key => $value) { $sql = "SELECT tmp2.*, @@ -98,6 +97,7 @@ 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 @@ -118,10 +118,9 @@ ON d.department_id = tmp2.department_id"; $facitities = ""; $total_facility_num = 0; $arrive_num = 0; - $install_num = 0; $tryrun_num = 0; $delivery_num = 0; - + $official_num = 0; $wipwhole_array = mysqli_query($link, $sql); foreach ($wipwhole_array as $wip) { @@ -130,42 +129,48 @@ ON d.department_id = tmp2.department_id"; $value[1] = $wip['manager_name']; $value[2] = $wip['name']; if ($wip['delivery_date'] != NULL) { - $facitities .= $wip['facilityno'] . "(" . $wip['delivery_date'] . "已移交),\n"; + $facitities .= $wip['facilityno'] . " (" . $wip['delivery_date'] . "已移交) , \n"; $total_facility_num += 1; $arrive_num += 1; - $install_num += 1; $tryrun_num += 1; + $official_num += 1; $delivery_num += 1; - } elseif ($wip['tryrun_end_date'] != NULL) { - $facitities .= $wip['facilityno'] . "(" . $wip['tryrun_end_date'] . "試車完畢),\n"; + } elseif($wip['official_check_date'] != NULL){ + $facitities .= $wip['facilityno'] . " (" . $wip['official_check_date'] . "官檢完畢) , \n"; + $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'] . "試車完畢) , \n"; $total_facility_num += 1; $arrive_num += 1; - $install_num += 1; $tryrun_num += 1; } elseif ($wip['install_end_date'] != NULL) { - $facitities .= $wip['facilityno'] . "(" . $wip['install_end_date'] . "安裝完畢),\n"; + $facitities .= $wip['facilityno'] . " (" . $wip['install_end_date'] . "安裝完畢) , \n"; $total_facility_num += 1; $arrive_num += 1; - $install_num += 1; } elseif ($wip['real_arrival_date'] != NULL) { - $facitities .= $wip['facilityno'] . "(" . $wip['real_arrival_date'] . "貨抵工地),\n"; + $facitities .= $wip['facilityno'] . " (" . $wip['real_arrival_date'] . "貨抵工地) , \n"; $total_facility_num += 1; $arrive_num += 1; } elseif ($wip['actual_tofactory_date'] != NULL) { - $facitities .= $wip['facilityno'] . "(" . $wip['actual_tofactory_date'] . "實際到觀音日),\n"; + $facitities .= $wip['facilityno'] . " (" . $wip['actual_tofactory_date'] . "實際到觀音日) , \n"; $total_facility_num += 1; } elseif ($wip['estimated_shipping_date'] != NULL) { - $facitities .= $wip['facilityno'] . "(" . $wip['estimated_shipping_date'] . "預計到港),\n"; + $facitities .= $wip['facilityno'] . " (" . $wip['estimated_shipping_date'] . "預計到港) , \n"; $total_facility_num += 1; } else { - $facitities .= $wip['facilityno'] . "(預計到港日待確認),\n"; + $facitities .= $wip['facilityno'] . " (預計到港日待確認) , \n"; $total_facility_num += 1; } } + //這是錢 4 簽約 5 二次款 6 貨抵工地 7 安裝 8 試車 9官檢 10 交車 + //這是數量 arrive_num 貨抵工地 tryrun_num 試車安裝完畢 official_num 官檢完畢 delivery_num 移交 if ($total_facility_num > 0) { $receivable_budget = $value[4] + ($value[5] + $value[6]) * ($arrive_num / $total_facility_num) + - ($value[7]) * ($install_num / $total_facility_num) + ($value[8]) * ($tryrun_num / $total_facility_num) - + ($value[9] + $value[10] + $value[11]) * ($delivery_num / $total_facility_num); + ($value[7]+$value[8]) * ($tryrun_num / $total_facility_num) + ($value[9]) * ($official_num / $total_facility_num) + + ($value[10]) * ($delivery_num / $total_facility_num); } - echo $key . ";" . $value[0] . ";" . $value[1] . ";" . $value[2] . ";" . $value[3] . ";" . $value[4] . ";" . $value[5] . ";" . $value[6] . ";" . $value[7] . ";" . $value[8] . ";" . $value[9] . ";" . $value[10] . ";" . $value[11] . ";" . $receivable_budget . ";" . $total_facility_num . ";" . $arrive_num . ";" . $install_num . ";" . $tryrun_num . ";" . $delivery_num . ";" . $facitities . "
"; + echo $key . ";" . $value[0] . ";" . $value[1] . ";" . $value[2] . ";" . $value[3] . ";" . $value[4] . ";" . $value[5] . ";" . $value[6] . ";" . $value[7] . ";" . $value[8] . ";" . $value[9].";" . $value[10] . ";" . $receivable_budget . ";" . $total_facility_num . ";" . $arrive_num . ";". $tryrun_num . ";" .$official_num.";". $delivery_num . ";" . $facitities . "
"; } diff --git a/wms/rib-test.php b/wms/rib-test.php index e62884bb..ee591f50 100644 --- a/wms/rib-test.php +++ b/wms/rib-test.php @@ -1,4 +1,12 @@ ".$delivery_date; +$final_date = strtotime("2023-05-03 +6 months"); +echo "
".$final_date; +echo "
-------
".gettype($final_date); +exit(); include "T8_Authorization.php"; echo "發貨單"; ?>