From 083d7ce4e8ffb5db96233e2e561d7bb6a77a58af Mon Sep 17 00:00:00 2001 From: Ellin Date: Mon, 20 Nov 2023 18:49:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B2=BB=E7=94=A8=E5=A0=B1?= =?UTF-8?q?=E9=8A=B7=E5=96=AE=E6=9C=83=E8=A8=88=E5=8F=96T8=E8=B2=BB?= =?UTF-8?q?=E7=94=A8=E9=A0=85=E7=9B=AE=E7=9A=84=E5=85=A7=E5=AE=B9=EF=BC=8C?= =?UTF-8?q?=E6=87=89=E6=94=B6=E5=B8=B3=E6=AC=BE=E6=98=8E=E7=B4=B0=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=A9=B2=E9=9A=8E=E6=AE=B5=E6=87=89=E6=94=B6=E9=87=91?= =?UTF-8?q?=E9=A1=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mkt/database.php | 2 +- wms/account-receivable-index.php | 55 ++++++-- wms/rib01-check.php | 2 +- wms/rib02-check.php | 2 +- wms/rib02-create.php | 216 ++++++++++++++++++++++++++----- wms/rib02-edit.php | 2 +- 6 files changed, 231 insertions(+), 48 deletions(-) diff --git a/mkt/database.php b/mkt/database.php index 833945ae..dc71855b 100644 --- a/mkt/database.php +++ b/mkt/database.php @@ -1,5 +1,5 @@ "; +echo "合約號;部門;經理;營業員;客戶名稱;簽約款;二次款;貨抵工地款;安裝款;試車款;交車款;取得許可證約交款;取得許可函後6個月約交款;目前應收;總作番數;貨抵;安裝;試車;移交數;狀態
"; // $T8_array = mysqli_fetch_all($T8_array, MYSQLI_ASSOC); @@ -25,7 +25,13 @@ $contract = $conn->query($sql_contract); foreach ($contract as $cont) { // print_r($cont); // echo "
"; - $BillNo = $cont['BillNo']; + if ($cont['BillNo'] == 'SO20230801001') { + $BillNo = 'M230947'; + }elseif ($cont['BillNo'] == 'SO20230801002'){ + $BillNo = 'M231067'; + }else{ + $BillNo = $cont['BillNo']; + }; $PayStage = $cont['PayStage']; $PayAmount = $cont['PlanPayAmt']; $partnerName = $cont['BizPartnerName']; @@ -110,27 +116,56 @@ FROM department ) AS d ON d.department_id = tmp2.department_id"; $facitities = ""; + $total_facility_num = 0; + $arrive_num = 0; + $install_num = 0; + $tryrun_num = 0; + $delivery_num = 0; $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"; + $facitities .= $wip['facilityno'] . "(" . $wip['delivery_date'] . "已移交),\n"; + $total_facility_num += 1; + $arrive_num += 1; + $install_num += 1; + $tryrun_num += 1; + $delivery_num += 1; } elseif ($wip['tryrun_end_date'] != NULL) { - $facitities .= $wip['facilityno'] . "(" . $wip['tryrun_end_date'] . "試車完畢);\n"; + $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; } } - 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 . "
"; + 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); + } + 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 . "
"; } diff --git a/wms/rib01-check.php b/wms/rib01-check.php index 936e976e..c95ea203 100644 --- a/wms/rib01-check.php +++ b/wms/rib01-check.php @@ -335,7 +335,7 @@ $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC); ?>
diff --git a/wms/rib02-check.php b/wms/rib02-check.php index 628cbe1c..7d02688b 100644 --- a/wms/rib02-check.php +++ b/wms/rib02-check.php @@ -7,7 +7,7 @@ $rib_query = mysqli_query($link, $sql_ribsub); $ribsub = mysqli_fetch_assoc($rib_query); //取得費用項目代碼 -$sql_feetype = "SELECT * from feetype"; +$sql_feetype = "SELECT FeeTypeId, FeeTypeName FROM comFeeType WHERE (FeeTypeId NOT LIKE 'A%') AND(FeeTypeId NOT LIKE 'Z%')"; $feetype_query = mysqli_query($link, $sql_feetype); $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC); diff --git a/wms/rib02-create.php b/wms/rib02-create.php index 3291bd43..7eca2d8e 100644 --- a/wms/rib02-create.php +++ b/wms/rib02-create.php @@ -15,6 +15,51 @@ if (mysqli_num_rows($rib_query) > 0) { $rib_id = $rib['rib_id']; $WrtieOffId = $rib['WriteOffId']; $FeeDeptId = $rib['DeptId']; + $CurrId = $rib['CurrId']; + if ($rib['CurrentState'] == 1) { + // 爬蟲--匯率 + function htmlContentGet($url) + { + $opts = [ + "http" => [ + "method" => "GET", + "header" => "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36\r\n" + ] + ]; + + return file_get_contents($url, false, stream_context_create($opts)); + } + + $week = date("w"); + $currency_day = date("Y-m-d", strtotime("-1 day")); + if ($week == 1) { + $currency_day = date("Y-m-d", strtotime("-3 day")); + } elseif ($week == 0) { + $currency_day = date("Y-m-d", strtotime("-2 day")); + } + $X = htmlContentGet('https://rate.bot.com.tw/xrt/all/' . $currency_day); + $string = strip_tags($X); // 先清掉 html tag, 以免 html tag 被破壞 + //美金 + $USD = explode(' ', stristr($string, '美金'))[298]; + //人民幣 + $RMB = explode(' ', stristr($string, '人民幣'))[298]; + //歐元 + $EUR = explode(' ', stristr($string, '歐元'))[298]; + //港幣 + $HKD = explode(' ', stristr($string, '港幣'))[298]; + + //整理要變更的數據 -表身 + $CurrLAmount = 1; + if ($rib['CurrId'] == "CNY") { + $CurrLAmount = $RMB; + } elseif ($rib['CurrId'] == "EUR") { + $CurrLAmount = $EUR; + } elseif ($rib['CurrId'] == "HKD") { + $CurrLAmount = $HKD; + } elseif ($rib['CurrId'] == "USD") { + $CurrLAmount = $USD; + } + } } } @@ -22,7 +67,7 @@ $RowCode = $_GET['RowCode']; //取得費用項目代碼 -$sql_feetype = "SELECT FeeTypeId, FeeTypeName FROM comFeeType WHERE (FeeTypeId NOT LIKE 'A%')AND(FeeTypeId NOT LIKE 'M%') AND(FeeTypeId NOT LIKE 'Z%')"; +$sql_feetype = "SELECT FeeTypeId, FeeTypeName FROM comFeeType WHERE (FeeTypeId NOT LIKE 'A%') AND(FeeTypeId NOT LIKE 'Z%')"; $feetype = $conn->query($sql_feetype); $member = array(); //取得人員名單與使用者的部門 @@ -68,8 +113,8 @@ $bizcount = 0; foreach ($BizPartner as $biz) { $bizKey = $biz['BizPartnerId']; $bizValue = $biz['BizPartnerName']; - array_push($BusinessPartner,$bizKey); - $bizcount +=1; + array_push($BusinessPartner, $bizKey); + $bizcount += 1; } $BizJSON = json_encode($BusinessPartner); $sql_Project = "SELECT * FROM comProject"; @@ -209,6 +254,24 @@ $materials = $conn->query($sql_Material);
+ +
+
+ + +
+
+ + +
+
@@ -234,24 +297,57 @@ $materials = $conn->query($sql_Material);
-
-
- - + +
+
+ + " disabled> +
+
+ + +
+
+ + +
+
+ + +
-
- - + + +
+
+ + +
+ +
+ + +
+
+ + +
+ -
@@ -331,25 +427,26 @@ $materials = $conn->query($sql_Material); $("#ProjectId").selectize(); $("#CU_MaterialId").selectize(); }) + function checkBiz() { if ($("#TaxNo").val().length !== 8) { - alert("統一編號格式錯誤"); - }else{ - var biz = $("#TaxNo").val(); - var BizArray = ; - var answer = 0; - for (var partner = 0; partner < ; partner++){ - var value = BizArray[partner]; - if (biz == value){ - answer +=1 + alert("統一編號格式錯誤"); + } else { + var biz = $("#TaxNo").val(); + var BizArray = ; + var answer = 0; + for (var partner = 0; partner < ; partner++) { + var value = BizArray[partner]; + if (biz == value) { + answer += 1 + } + } + if (answer == 1) { + alert("供應商認證成功") + } else { + alert("T8內無此供應商") } } - if (answer==1){ - alert("供應商認證成功") - }else{ - alert("T8內無此供應商") - } - } } $(function() { @@ -434,10 +531,52 @@ $materials = $conn->query($sql_Material); }) $("#Price").change(function() { $("#OAmount").val($("#Quantity").val() * $("#Price").val()); + $("#LAmount").val($("#OAmount").val() * $("#CurrLAmount").val()); + if ($("#TaxId").val() === "ST005") { + $("#OTax").val($("#OAmount").val() - ($("#OAmount").val() / 1.05)); + $("#LTax").val($("#OTax").val() * $("#CurrLAmount").val()); + $("#OAmountUnWithTax").val($("#OAmount").val() / 1.05); + $("#LAmountUnWithTax").val($("#OAmountUnWithTax").val() * $("#CurrLAmount").val()); + + } else { + $("#OTax").val(0); + $("#LTax").val(0); + $("#OAmountUnWithTax").val($("#OAmount").val()); + $("#LAmountUnWithTax").val($("#OAmount").val() * $("#CurrLAmount").val()); + } }); $("#Quantity").change(function() { $("#OAmount").val($("#Quantity").val() * $("#Price").val()); + $("#LAmount").val($("#OAmount").val() * $("#CurrLAmount").val()); + if ($("#TaxId").val() === "ST005") { + $("#OTax").val($("#OAmount").val() - ($("#OAmount").val() / 1.05)); + $("#LTax").val($("#OTax").val() * $("#CurrLAmount").val()); + $("#OAmountUnWithTax").val($("#OAmount").val() / 1.05); + $("#LAmountUnWithTax").val($("#OAmountUnWithTax").val() * $("#CurrLAmount").val()); + + } else { + $("#OTax").val(0); + $("#LTax").val(0); + $("#OAmountUnWithTax").val($("#OAmount").val()); + $("#LAmountUnWithTax").val($("#OAmount").val() * $("#CurrLAmount").val()); + } }); + $("#TaxId").change(function() { + $("#OAmount").val($("#Quantity").val() * $("#Price").val()); + $("#LAmount").val($("#OAmount").val() * $("#CurrLAmount").val()); + if ($("#TaxId").val() === "ST005") { + $("#OTax").val($("#OAmount").val() - ($("#OAmount").val() / 1.05)); + $("#LTax").val($("#OTax").val() * $("#CurrLAmount").val()); + $("#OAmountUnWithTax").val($("#OAmount").val() / 1.05); + $("#LAmountUnWithTax").val($("#OAmountUnWithTax").val() * $("#CurrLAmount").val()); + + } else { + $("#OTax").val(0); + $("#LTax").val(0); + $("#OAmountUnWithTax").val($("#OAmount").val()); + $("#LAmountUnWithTax").val($("#OAmount").val() * $("#CurrLAmount").val()); + } + }) $("#FeeDate").change(function() { if ($("#FeeDate").val().length != 8) { alert("輸入格式錯誤"); @@ -454,7 +593,7 @@ $materials = $conn->query($sql_Material); $("#FeeDate").val(''); } else { now.setMonth(now.getMonth() - 2); - now.setDate(01); + now.setDate(1); now.setDate(now.getDate() - 1) if (feedate < now) { alert("超過兩個月的費用無法進行報銷"); @@ -493,6 +632,15 @@ $materials = $conn->query($sql_Material); } else { $("#OAmount").prop("disabled", false); + + $("#OTax").prop("disabled", false); + $("#LTax").prop("disabled", false); + $("#OAmountUnWithTax").prop("disabled", false); + $("#LAmountUnWithTax").prop("disabled", false); + $("#LAmount").prop("disabled", false); + $("#OAmount").prop("disabled", false); + $('#ribsubform').submit(); } diff --git a/wms/rib02-edit.php b/wms/rib02-edit.php index ce37d0b0..a608cabe 100644 --- a/wms/rib02-edit.php +++ b/wms/rib02-edit.php @@ -10,7 +10,7 @@ $ribsub = mysqli_fetch_assoc($rib_query); //取得費用項目代碼 -$sql_feetype = "SELECT FeeTypeId, FeeTypeName FROM comFeeType WHERE (FeeTypeId NOT LIKE 'A%')AND(FeeTypeId NOT LIKE 'M%') AND(FeeTypeId NOT LIKE 'Z%')"; +$sql_feetype = "SELECT FeeTypeId, FeeTypeName FROM comFeeType WHERE (FeeTypeId NOT LIKE 'A%') AND(FeeTypeId NOT LIKE 'Z%')"; $feetype = $conn->query($sql_feetype); $member = array(); //取得人員名單與使用者的部門