From 481a368df57d3cfd034aa258631e1ac0a223acee Mon Sep 17 00:00:00 2001 From: Ellin Date: Tue, 24 Oct 2023 18:17:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9business=20index=EF=BC=9B01ed?= =?UTF-8?q?it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wms/rib01-business-check.php | 165 +++++++++++++++++------ wms/rib01-business-index.php | 250 +++++++++++++++++++++++++++++++++++ wms/rib02-submit.php | 25 ++-- 3 files changed, 393 insertions(+), 47 deletions(-) create mode 100644 wms/rib01-business-index.php diff --git a/wms/rib01-business-check.php b/wms/rib01-business-check.php index da9ccee9..37d97f87 100644 --- a/wms/rib01-business-check.php +++ b/wms/rib01-business-check.php @@ -3,16 +3,11 @@ include "./header.php"; $BillNo = $_GET['BillNo']; $state = $_GET['state']; //取得表頭數據 -$date_sql = "SELECT BillNo from rib_business WHERE (BillNo LIKE '$sqlname%')"; +$date_sql = "SELECT * from rib_business WHERE (BillNo='$BillNo')"; $query_rib = mysqli_query($link, $date_sql); -$myNo = mysqli_fetch_all($query_rib); -foreach ($myNo as $thisMyNo) { - $thisMyNo = (int)substr($thisMyNo[0], -2); - if ($thisMyNo > $MaxBillNo) { - $MaxBillNo = $thisMyNo; - } +foreach ($query_rib as $q) { + $rib = $q; } -$BillNo = $sqlname; // 連線T8MASADA try { $conn = new PDO("sqlsrv:Server=60.244.87.101;Database=T8MASADA", "masada", "ZXCVasdf1234"); @@ -52,17 +47,12 @@ try { echo "fail"; echo $e->getMessage(); } -$MaxBillNo += 1; -if ($MaxBillNo < 10) { - $BillNo .= "0" . strval($MaxBillNo); -} else { - $BillNo .= strval($MaxBillNo); -} + ?>
- +
@@ -79,7 +69,7 @@ if ($MaxBillNo < 10) {
- disabled> + disabled>
@@ -90,7 +80,7 @@ if ($MaxBillNo < 10) { 請選擇採購人員 $value) { ?> -
@@ -138,7 +144,9 @@ if ($MaxBillNo < 10) { $BizValue) { ?> - +
@@ -159,6 +167,99 @@ if ($MaxBillNo < 10) { + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
發票日期數量單價費用項目原幣報銷金額說明發票號碼功能
+ + + + + + + + + + + +
+
+ +
+ + + + + \ No newline at end of file diff --git a/wms/rib01-business-index.php b/wms/rib01-business-index.php new file mode 100644 index 00000000..442bae45 --- /dev/null +++ b/wms/rib01-business-index.php @@ -0,0 +1,250 @@ + 0) { + echo "有下屬"; + $column_str = "('$user_id'" . ",'"; + $column_str .= implode("','", $follower); + $column_str .= "')"; + $sql .= "WHERE ((PersonId in $column_str) or (CreatorId in $column_str))"; + } else { + $sql .= "WHERE ((PersonId= '$user_id') or (CreatorId= '$user_id'))"; + }; + $data = mysqli_query($link, $sql); +} +$DeptName = array(); +// 連線T8MASADA +try { + $conn = new PDO("sqlsrv:Server=60.244.87.101;Database=T8MASADA", "masada", "ZXCVasdf1234"); + if ($conn) { + $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $member = array(); + //取得人員名單與使用者的部門 + $sql_mydept = "SELECT UserId, Username FROM capMembership"; + $deptmem = $conn->query($sql_mydept); + foreach ($deptmem as $mem) { + $userid = $mem['UserId']; + $username = $mem['Username']; + $member["$userid"] = [$username]; + }; + $sql_dept = "SELECT DeptId, PersonId FROM comPerson WHERE DeptId!='0001'"; + $allpeople = $conn->query($sql_dept); + foreach ($allpeople as $man) { + if ($man['PersonId'] == $user_id) { + $mydepart = $man['DeptId']; + } + $personid = $man['PersonId']; + $depart = $man['DeptId']; + if (isset($member["$personid"])) { + array_push($member["$personid"], "$depart"); + }; + } + + //取得部門代碼 + $sql_department = "SELECT DeptId,DeptName FROM comDepartment WHERE DeptId!='0001'"; + $deptype = $conn->query($sql_department); + foreach ($deptype as $dept) { + $deptid = $dept['DeptId']; + $deptname = $dept['DeptName']; + $DeptName[$deptid] = $deptname; + } + //取得供應商 + $sql_Biz = "SELECT comBusinessPartner.BizPartnerId, comBusinessPartner.BizPartnerName FROM comBusinessPartner INNER JOIN comSupplier ON comBusinessPartner.BizPartnerId=comSupplier.BizPartnerId WHERE comBusinessPartner.BizPartnerId !='V0001'"; + $BizPartner = $conn->query($sql_Biz); + foreach($BizPartner as $partner){ + $partnerid = $partner['BizPartnerId']; + $partnername = $partner['BizPartnerName']; + $Supplier[$partnerid]= $partnername; + } + $conn = null; + } +} catch (PDOException $e) { + echo "fail"; + echo $e->getMessage(); +} +?> + +

+ + + +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
單據編號單據日期供應商報銷人報銷部門幣別報銷金額狀態功能
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+
+
+ + +There is no record!"; +endif; + +include "./footer.php"; +?> \ No newline at end of file diff --git a/wms/rib02-submit.php b/wms/rib02-submit.php index f1e44f4a..229dea2b 100644 --- a/wms/rib02-submit.php +++ b/wms/rib02-submit.php @@ -29,11 +29,11 @@ $CurrId = empty($_POST['CurrId']) ? null : $_POST['CurrId']; $comSupplierName = empty($_POST['comSupplierName']) ? null : $_POST['comSupplierName']; $FromSourceTag = 0; $TaxRate = ($TaxId == "ST005") ? 0.05 : 0; -$OTax = isset($_POST['OTax']) ? $_POST['OTax']:NULL; -$LTax = isset($_POST['LTax']) ? $_POST['LTax']:NULL; -$OAmountUnWithTax = isset($_POST['OAmountUnWithTax']) ? $_POST['OAmountUnWithTax']:null; -$LAmountUnWithTax = isset($_POST['LAmountUnWithTax']) ? $_POST['LAmountUnWithTax']:null; -$LAmount = isset($_POST['LAmount']) ? $_POST['LAmount']:null; +$OTax = isset($_POST['OTax']) ? $_POST['OTax'] : NULL; +$LTax = isset($_POST['LTax']) ? $_POST['LTax'] : NULL; +$OAmountUnWithTax = isset($_POST['OAmountUnWithTax']) ? $_POST['OAmountUnWithTax'] : null; +$LAmountUnWithTax = isset($_POST['LAmountUnWithTax']) ? $_POST['LAmountUnWithTax'] : null; +$LAmount = isset($_POST['LAmount']) ? $_POST['LAmount'] : null; $TaxNo = empty($_POST['TaxNo']) ? '' : $_POST['TaxNo']; if (isset($comSupplierName) && ($comSupplierName != "雜項請款用")) { @@ -113,11 +113,11 @@ if ($submit == "add") { $SQL1 .= empty($InvoiceNo) ? "" : ",InvoiceNo='$InvoiceNo'"; $SQL1 .= empty($comSupplierName) ? ",comSupplierName=' '" : ",comSupplierName='$comSupplierName'"; $SQL1 .= empty($comSupplierId) ? ",comSupplierId=' '" : ",comSupplierId='$comSupplierId'"; - $SQL1 .= isset($OTax) ? ",OTax=$OTax":""; - $SQL1 .= isset($LTax) ? ",LTax=$LTax":""; - $SQL1 .= isset($OAmountUnWithTax) ? ",OAmountUnWithTax=$OAmountUnWithTax":""; - $SQL1 .= isset($LAmountUnWithTax) ? ",LAmountUnWithTax=$LAmountUnWithTax":""; - $SQL1 .= isset($LAmount) ? ",LAmount=$LAmount":""; + $SQL1 .= isset($OTax) ? ",OTax=$OTax" : ""; + $SQL1 .= isset($LTax) ? ",LTax=$LTax" : ""; + $SQL1 .= isset($OAmountUnWithTax) ? ",OAmountUnWithTax=$OAmountUnWithTax" : ""; + $SQL1 .= isset($LAmountUnWithTax) ? ",LAmountUnWithTax=$LAmountUnWithTax" : ""; + $SQL1 .= isset($LAmount) ? ",LAmount=$LAmount" : ""; if ($user_id == "M0056" && $state == 1) { $SQL1 .= ",FeeBalance=$LAmountUnWithTax"; $SQL1 .= ",WriteOffAmount=$OAmount"; @@ -159,6 +159,11 @@ if ($submit == "add") { $SQL1 = str_replace("'", '', $SQL1); $sql_rib = "UPDATE rib SET OAmountWithTax=$OAmountWithTax, LAmountWithTax= $LAmountWithTax, LAmount=$LAmount,OAmount =$OAmount, UnPayOAmount=$OAmountWithTax, Balance = $OAmountWithTax, LBalance= $UnPayLAmount ,UnPaymentLAmt=$UnPayLAmount, UnPayLAmount=$UnPayLAmount,OTax=$OTax, LTax=$LTax, WriteOffAmount=$WriteOffAmount, LastOperatorId='$user_id' WHERE rib_id = $rib_id"; mysqli_query($link, $sql_rib); + ?> + +