From 53ba49b59977c0318b68d4f369598946cb0490f3 Mon Sep 17 00:00:00 2001 From: Ellin Date: Wed, 15 Nov 2023 18:12:51 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=B8=AC=E8=A9=A6=E5=B0=8D=E5=B8=B3?= =?UTF-8?q?=E7=B3=BB=E7=B5=B1=E8=B3=87=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/account-receivable-index.php | 36 ++++++++++++++++++++++++ wms/rib02-purReceive-submit.php | 48 ++++++++++++++++++-------------- 2 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 wms/account-receivable-index.php diff --git a/wms/account-receivable-index.php b/wms/account-receivable-index.php new file mode 100644 index 00000000..f2e91ec6 --- /dev/null +++ b/wms/account-receivable-index.php @@ -0,0 +1,36 @@ +"; +} +echo "
"; +// $sql_depid = "SELECT department_id, name from department"; +// $dept_query = mysqli_query($link, $sql_depid); +// $deptype = mysqli_fetch_all($dept_query, MYSQLI_ASSOC); +$sql_contract = "SELECT * FROM salOrderStagePay;"; +$contract = $conn->query($sql_contract); +foreach($contract as $cont){ + print_r($cont); + echo "
"; +} \ No newline at end of file diff --git a/wms/rib02-purReceive-submit.php b/wms/rib02-purReceive-submit.php index 24b0a1d9..27b73cc2 100644 --- a/wms/rib02-purReceive-submit.php +++ b/wms/rib02-purReceive-submit.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/wms/account-receivable-index.php b/wms/account-receivable-index.php index 860a6c70..e7e2afb0 100644 --- a/wms/account-receivable-index.php +++ b/wms/account-receivable-index.php @@ -8,17 +8,83 @@ use PhpOffice\PhpSpreadsheet\Writer\Xlsx as xls; use PhpOffice\PhpSpreadsheet\Reader\Xlsx; $arrayData = []; -$sql = "SELECT +echo "合約號,部門,經理,營業員,簽約款,二次款,貨抵工地款,安裝款,試車款,交車款,取得許可證約交款,取得許可函後6個月約交款,狀態
"; + +// $T8_array = mysqli_fetch_all($T8_array, MYSQLI_ASSOC); + +// $sql_depid = "SELECT department_id, name from department"; +// $dept_query = mysqli_query($link, $sql_depid); +// $deptype = mysqli_fetch_all($dept_query, MYSQLI_ASSOC); + + +$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt FROM salOrderStagePay AS a +LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; +$contract = $conn->query($sql_contract); +foreach ($contract as $cont) { + // print_r($cont); + // echo "
"; + $BillNo = $cont['BillNo']; + $PayStage = $cont['PayStage']; + $PayAmount = $cont['PlanPayAmt']; + + if (isset($arrayData[$BillNo])) { + if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { + $arrayData[$BillNo][5] = $PayAmount; + } elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { + $arrayData[$BillNo][4] = $PayAmount; + } elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { + $arrayData[$BillNo][6] = $PayAmount; + } elseif (stristr($PayStage, '安裝')) { + $arrayData[$BillNo][7] = $PayAmount; + } elseif (stristr($PayStage, '試車')) { + $arrayData[$BillNo][8] = $PayAmount; + } elseif (stristr($PayStage, '交車') || stristr($PayStage, '完工') || stristr($PayStage, '驗收')) { + $arrayData[$BillNo][9] = $PayAmount; + } elseif (stristr($PayStage, '取得合格函') || stristr($PayStage, '取得許可函')) { + $arrayData[$BillNo][10] = $PayAmount; + } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月')) { + $arrayData[$BillNo][11] = $PayAmount; + } else { + $arrayData[$BillNo][12] = $PayAmount; + } + } else { + $arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { + $arrayData[$BillNo][5] = $PayAmount; + } elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { + $arrayData[$BillNo][4] = $PayAmount; + } elseif (stristr($PayStage, '貨抵工地') || stristr($PayStage, '貨底工地')) { + $arrayData[$BillNo][6] = $PayAmount; + } elseif (stristr($PayStage, '安裝')) { + $arrayData[$BillNo][7] = $PayAmount; + } elseif (stristr($PayStage, '試車')) { + $arrayData[$BillNo][8] = $PayAmount; + } elseif (stristr($PayStage, '交車') || stristr($PayStage, '完工') || stristr($PayStage, '驗收')) { + $arrayData[$BillNo][9] = $PayAmount; + } elseif (stristr($PayStage, '取得合格函') || stristr($PayStage, '取得許可函')) { + $arrayData[$BillNo][10] = $PayAmount; + } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月')) { + $arrayData[$BillNo][11] = $PayAmount; + } else { + $arrayData[$BillNo][12] = $PayAmount; + } + } +} +foreach ($arrayData as $key => $value) { + $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, @@ -28,7 +94,8 @@ left join account AS a ON w.salesid = a.accountid left join account AS a2 ON a2.accountid = a.manager -where w.status = '1' +where w.status = '1' AND w.contractno='" . $key . "'" . " + )AS tmp2 left join ( SELECT DISTINCT @@ -38,84 +105,28 @@ FROM department ) AS d ON d.department_id = tmp2.department_id"; +$facitities = ""; -$wipwhole_array = mysqli_query($link, $sql); -// $T8_array = mysqli_fetch_all($T8_array, MYSQLI_ASSOC); -foreach ($wipwhole_array as $wip) { - // print_r($wip); - // echo "
"; -} -echo "
"; -// $sql_depid = "SELECT department_id, name from department"; -// $dept_query = mysqli_query($link, $sql_depid); -// $deptype = mysqli_fetch_all($dept_query, MYSQLI_ASSOC); - - -$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt FROM salOrderStagePay AS a -LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo WHERE s.ModeId = 'M'"; -$contract = $conn->query($sql_contract); -foreach ($contract as $cont) { - // print_r($cont); - // echo "
"; - $BillNo = $cont['BillNo']; - $PayStage = $cont['PayStage']; - $PayAmount = $cont['PlanPayAmt']; - - if (isset($arrayData[$BillNo])) { - if ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { - $arrayData[$BillNo][0] = $PayAmount; - } elseif (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時')) { - $arrayData[$BillNo][1] = $PayAmount; - } elseif (stristr($PayStage, '貨抵工地')||stristr($PayStage, '貨底工地')) { - $arrayData[$BillNo][2] = $PayAmount; - } elseif (stristr($PayStage, '安裝')) { - $arrayData[$BillNo][3] = $PayAmount; - } elseif (stristr($PayStage, '試車')) { - $arrayData[$BillNo][4] = $PayAmount; - } elseif (stristr($PayStage, '交車') || stristr($PayStage, '完工') || stristr($PayStage, '驗收')) { - $arrayData[$BillNo][5] = $PayAmount; - } elseif (stristr($PayStage, '取得合格函') || stristr($PayStage, '取得許可函')) { - $arrayData[$BillNo][6] = $PayAmount; - } elseif (stristr($PayStage, '得合格函後6個月') || stristr($PayStage, '核可函取得後6個月')) { - $arrayData[$BillNo][7] = $PayAmount; - }else{ - $arrayData[$BillNo][8] = $PayAmount; + $wipwhole_array = mysqli_query($link, $sql); + foreach ($wipwhole_array as $wip) { + $value[0] = $wip['depart_name']; + $value[1] = $wip['manager_name']; + $value[2] = $wip['name']; + if ($wip['delivery_date'] != NULL) { + $facitities .= $wip['facilityno'] . "(" . $wip['delivery_date'] . "已移交);\n"; + } elseif ($wip['tryrun_end_date'] != NULL) { + $facitities .= $wip['facilityno'] . "(" . $wip['tryrun_end_date'] . "試車完畢);\n"; + } elseif ($wip['install_end_date'] != NULL) { + $facitities .= $wip['facilityno'] . "(" . $wip['install_end_date'] . "安裝完畢);\n"; + } elseif ($wip['real_arrival_date'] != NULL) { + $facitities .= $wip['facilityno'] . "(".$wip['real_arrival_date'] . "貨抵工地);\n"; + } elseif ($wip['actual_tofactory_date'] != NULL) { + $facitities .= $wip['facilityno'] . "(" . $wip['actual_tofactory_date'] . "實際到觀音日);\n"; + }elseif ($wip['estimated_shipping_date'] != NULL) { + $facitities .= $wip['facilityno'] . "(" . $wip['estimated_shipping_date'] . "預計到港);\n"; + }else { + $facitities .= $wip['facilityno'] . "(預計到港日待確認);\n"; } - } else { - - $arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0]; } - - // echo "
"."--------------------------------"."
"; - - // array_push($arrayData,$payment); - // print_r($payment); - // echo "
---------------------------
"; + echo $key . "," . $value[0] . "," . $value[1] . "," . $value[2] . "," . $value[4] . "," . $value[5] . "," . $value[6] . "," . $value[7] . "," . $value[8] . "," . $value[9] . "," . $value[10] . "," . $value[11] . ",". $facitities . "
"; } -foreach ($arrayData as $key => $value) { - print_r($key); - echo "
"; - print_r($value); - echo "
-----------------------------
"; -} -echo "
###########################
"; - - //產生excel - // $spreadsheet = new Spreadsheet(); - // $sheet = $spreadsheet->getActiveSheet(); - // $colArr = ['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']; - // $colTitleArr = ['合約號','付款階段','付款金額']; - // $sheet->setTitle('預收款清單'); - // for ($i = 0; $i setCellValue($colArr[$i].'1', $colTitleArr[$i]); - // } - // $i=2; - // for ($j=0; $j setCellValue($colArr[$j].$i, $payment[$j][$i]); - // $i++; - // } From 58322e733ce01c5d8fc892b4938e299b1f132855 Mon Sep 17 00:00:00 2001 From: jrbin Date: Fri, 17 Nov 2023 17:44:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=83=B9=E5=AF=A9bug=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/mkt/pricereview-create.php | 6 ++++-- wms/mkt/pricereview_renovate-create.php | 4 +++- wms/mkt/pricereview_repair-index.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wms/mkt/pricereview-create.php b/wms/mkt/pricereview-create.php index 3198464a..79f28ac0 100644 --- a/wms/mkt/pricereview-create.php +++ b/wms/mkt/pricereview-create.php @@ -43,7 +43,9 @@ if (count($last_pr_arr) > 0) { $res = mysqli_query($link, $sql); while ($row = mysqli_fetch_assoc($res)) { $last_pritem_arr[$row["item_group"]][$row["item_no"]] = $row; - $last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"]; + if (isset($last_pritem_arr["A"][$row["item_no"]])) { + $last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"]; + } } mysqli_free_result($res); @@ -1673,7 +1675,7 @@ if (count($last_pritem_arr) > 0 && isset($last_pritem_arr["B"])) { " readonly > "> " readonly> - + "> "> diff --git a/wms/mkt/pricereview_renovate-create.php b/wms/mkt/pricereview_renovate-create.php index cce6d88e..379685c5 100644 --- a/wms/mkt/pricereview_renovate-create.php +++ b/wms/mkt/pricereview_renovate-create.php @@ -44,7 +44,9 @@ if (count($last_pr_arr) > 0) { $res = mysqli_query($link, $sql); while ($row = mysqli_fetch_assoc($res)) { $last_pritem_arr[$row["item_group"]][$row["item_no"]] = $row; - $last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"]; + if (isset($last_pritem_arr["A"][$row["item_no"]])) { + $last_pr_arr["qty_total"] += $last_pritem_arr["A"][$row["item_no"]]["item_qty"]; + } } mysqli_free_result($res); diff --git a/wms/mkt/pricereview_repair-index.php b/wms/mkt/pricereview_repair-index.php index e9908255..a910c023 100644 --- a/wms/mkt/pricereview_repair-index.php +++ b/wms/mkt/pricereview_repair-index.php @@ -119,7 +119,7 @@ $(function () { objInput1.setAttribute("type", "text"); objInput1.setAttribute("name", "total_price"); objInput1.setAttribute("readonly", true); - objInput1.setAttribute("value", pobj.find('td').eq(6).html().trim()); + objInput1.setAttribute("value", pobj.find('td').eq(5).html().trim()); var objLabel2 = document.createElement("label"); objLabel2.setAttribute("for", "final_price"); objLabel2.textContent = "議價後金額"; From 499075276da6ec848eed91429d072b89f2632518 Mon Sep 17 00:00:00 2001 From: Ellin Date: Fri, 17 Nov 2023 18:52:39 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=B0=8D=E5=B8=B3=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AE=A2=E6=88=B6=E5=90=8D=E7=A8=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/T8_APItest.php | 4 ++-- wms/T8_Authorization.php | 6 +++--- wms/account-receivable-index.php | 20 ++++++++++++-------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/wms/T8_APItest.php b/wms/T8_APItest.php index 713838bf..d327c6e5 100644 --- a/wms/T8_APItest.php +++ b/wms/T8_APItest.php @@ -5,8 +5,8 @@ echo "ii"; \ No newline at end of file diff --git a/wms/account-receivable-index.php b/wms/account-receivable-index.php index e7e2afb0..6cd28f13 100644 --- a/wms/account-receivable-index.php +++ b/wms/account-receivable-index.php @@ -8,7 +8,7 @@ use PhpOffice\PhpSpreadsheet\Writer\Xlsx as xls; use PhpOffice\PhpSpreadsheet\Reader\Xlsx; $arrayData = []; -echo "合約號,部門,經理,營業員,簽約款,二次款,貨抵工地款,安裝款,試車款,交車款,取得許可證約交款,取得許可函後6個月約交款,狀態
"; +echo "合約號,部門,經理,營業員,客戶名稱,簽約款,二次款,貨抵工地款,安裝款,試車款,交車款,取得許可證約交款,取得許可函後6個月約交款,狀態
"; // $T8_array = mysqli_fetch_all($T8_array, MYSQLI_ASSOC); @@ -17,8 +17,10 @@ echo "合約號,部門,經理,營業員,簽約款,二次款,貨抵工地款,安 // $deptype = mysqli_fetch_all($dept_query, MYSQLI_ASSOC); -$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt FROM salOrderStagePay AS a -LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; +$sql_contract = "SELECT a.BillNo, a.PayStage, a.PlanPayAmt,s.BizPartnerId,c.BizPartnerName FROM salOrderStagePay AS a +LEFT JOIN salSalesOrder AS s on a.BillNo = s.BillNo +LEFT JOIN comBusinessPartner as c ON s.BizPartnerId=c.BizPartnerId +WHERE s.ModeId = 'M' AND (s.CurrentState=2 OR s.CurrentState=4) "; $contract = $conn->query($sql_contract); foreach ($contract as $cont) { // print_r($cont); @@ -26,6 +28,7 @@ foreach ($contract as $cont) { $BillNo = $cont['BillNo']; $PayStage = $cont['PayStage']; $PayAmount = $cont['PlanPayAmt']; + $partnerName = $cont['BizPartnerName']; if (isset($arrayData[$BillNo])) { if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { @@ -49,6 +52,7 @@ foreach ($contract as $cont) { } } else { $arrayData[$BillNo] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + $arrayData[$BillNo][3] = $partnerName; if (stristr($PayStage, '二次款') || stristr($PayStage, '出貨前') || stristr($PayStage, '簽約後') || stristr($PayStage, '簽訂後') || stristr($PayStage, '建照核發時') || stristr($PayStage, '簽約60')) { $arrayData[$BillNo][5] = $PayAmount; } elseif ($PayStage == '簽約' || stristr($PayStage, '簽定') || stristr($PayStage, '簽訂') || stristr($PayStage, '訂金')) { @@ -105,7 +109,7 @@ FROM department ) AS d ON d.department_id = tmp2.department_id"; -$facitities = ""; + $facitities = ""; $wipwhole_array = mysqli_query($link, $sql); foreach ($wipwhole_array as $wip) { @@ -119,14 +123,14 @@ $facitities = ""; } elseif ($wip['install_end_date'] != NULL) { $facitities .= $wip['facilityno'] . "(" . $wip['install_end_date'] . "安裝完畢);\n"; } elseif ($wip['real_arrival_date'] != NULL) { - $facitities .= $wip['facilityno'] . "(".$wip['real_arrival_date'] . "貨抵工地);\n"; + $facitities .= $wip['facilityno'] . "(" . $wip['real_arrival_date'] . "貨抵工地);\n"; } elseif ($wip['actual_tofactory_date'] != NULL) { $facitities .= $wip['facilityno'] . "(" . $wip['actual_tofactory_date'] . "實際到觀音日);\n"; - }elseif ($wip['estimated_shipping_date'] != NULL) { + } elseif ($wip['estimated_shipping_date'] != NULL) { $facitities .= $wip['facilityno'] . "(" . $wip['estimated_shipping_date'] . "預計到港);\n"; - }else { + } else { $facitities .= $wip['facilityno'] . "(預計到港日待確認);\n"; } } - echo $key . "," . $value[0] . "," . $value[1] . "," . $value[2] . "," . $value[4] . "," . $value[5] . "," . $value[6] . "," . $value[7] . "," . $value[8] . "," . $value[9] . "," . $value[10] . "," . $value[11] . ",". $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] . "," . $value[11] . "," . $facitities . "
"; }