10994015 1 year ago
parent
commit
963df7d03f
  1. BIN
      wms/WriteOff.xlsx
  2. 38
      wms/rib-test.php
  3. 34
      wms/rib01-check.php
  4. 4
      wms/rib01-delete.php
  5. 2
      wms/rib01-edit.php
  6. 8
      wms/rib01-index.php
  7. 2
      wms/rib01-submit.php
  8. 2
      wms/rib02-check.php
  9. 4
      wms/rib02-create.php
  10. 8
      wms/rib02-edit.php
  11. 2
      wms/rib02-submit.php
  12. 28
      wms/rib03-submit.php

BIN
wms/WriteOff.xlsx

Binary file not shown.

38
wms/rib-test.php

@ -3,6 +3,7 @@ include "T8_Authorization.php";
echo "ii"; echo "ii";
?> ?>
<script> <script>
console.log(<?=$now ?>);
get_Auth(); get_Auth();
window.addEventListener('message', function(event) { window.addEventListener('message', function(event) {
if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) { if (event.origin === "http://localhost:3000" && (typeof event.data === "string")) {
@ -18,8 +19,8 @@ echo "ii";
var body = [{ var body = [{
"name": "MasterTable", "name": "MasterTable",
"rows": [{ "rows": [{
"BillNo": "Z003", "BillNo": "Z004",
"BillDate": 20230930, "BillDate": 20231030,
"OrgId": "1000", "OrgId": "1000",
"TypeId": "OPV", "TypeId": "OPV",
"IsPriceWithTax":1, "IsPriceWithTax":1,
@ -28,7 +29,7 @@ echo "ii";
"CurrId": "RMB", "CurrId": "RMB",
"CurrOAmount":1, "CurrOAmount":1,
"CurrLAmount":4, "CurrLAmount":4,
"TaxId": "ST005", "TaxId": "ST101",
"PersonId": "M0012", "PersonId": "M0012",
"DeptId": "220", "DeptId": "220",
"CompId": "1001", "CompId": "1001",
@ -39,16 +40,16 @@ echo "ii";
{ {
"name": "DetailTable", "name": "DetailTable",
"rows": [{ "rows": [{
"BillNo": "Z003", "BillNo": "Z004",
"RowCode": 1, "RowCode": 1,
"RowNo": 1, "RowNo": 1,
"ItemType": 0, "ItemType": 0,
"TaxId": "ST005", "TaxId": "ST101",
"MaterialId": "MX00000001", "MaterialId": "MX00000001",
"UnitId": "PCS", "UnitId": "PCS",
"MaterialSpec": "", "MaterialSpec": "",
"SQuantity":10, "SQuantity":10,
"SPrice":105, "SPrice":100,
}, },
// { // {
// "BillNo": "Z002", // "BillNo": "Z002",
@ -66,19 +67,20 @@ echo "ii";
// "TaxId": "ST005" // "TaxId": "ST005"
// } // }
] ]
},
{
"name":"apCheckBillInvInfo",
"rows":[{
"BillNo":"Z003",
"RowCode":1,
"RowNo":1,
"InvoiceNo":"ap12345678",
"InvoiceId":25,
"TaxId":"ST005",
"LAmountWithTax":105
}]
} }
// ,
// {
// "name":"apCheckBillInvInfo",
// "rows":[{
// "BillNo":"Z003",
// "RowCode":1,
// "RowNo":1,
// "InvoiceNo":"ap12345678",
// "InvoiceId":25,
// "TaxId":"ST005",
// "LAmountWithTax":105
// }]
// }
]; ];
var json = JSON.stringify(body); var json = JSON.stringify(body);
obj = { obj = {

34
wms/rib01-check.php

@ -88,7 +88,7 @@ if ($state == 0) :
</p> </p>
</div> </div>
<?php <?php
elseif ($state == 1 && $user_id == "M0056") : elseif ($state == 1 && ($user_id == "M0056" || $user_id == "M0209")) :
?> ?>
<div style="width: 90%;"> <div style="width: 90%;">
@ -107,7 +107,7 @@ elseif ($state == 1 && $user_id == "M0056") :
</p> </p>
</div> </div>
<?php <?php
elseif ($state == 1 && $user_id != "M0056") : elseif ($state == 1 && ($user_id == "M0056" || $user_id == "M0209")) :
?> ?>
<div style="padding-left: 2rem;"> <div style="padding-left: 2rem;">
@ -179,28 +179,6 @@ endif
</div> </div>
<div class="form-group"> <div class="form-group">
<!-- <div class="col-md-3">
<label for="WriteOffType">報銷人類型</label>
<select name="WriteOffType" id="WriteOffType" class="form-control" disabled>
<option value=0 <?php if ($data['WriteOffType'] == 0) {
echo "selected";
} ?>>客戶</option>
<option value=1 <?php if ($data['WriteOffType'] == 1) {
echo "selected";
} ?>>廠商</option>
<option value=2 <?php if ($data['WriteOffType'] == 2) {
echo "selected";
} ?>>員工</option>
<option value=3 <?php if ($data['WriteOffType'] == 3) {
echo "selected";
} ?>>其他</option>
<option value=4 <?php if ($data['WriteOffType'] == 4) {
echo "selected";
} ?>>公司</option>
</select>
</div> -->
<div class="col-md-3"> <div class="col-md-3">
<label for="DeptId">報銷單位</label> <label for="DeptId">報銷單位</label>
<select name="DeptId" id="DeptId" class="form-control" required disabled> <select name="DeptId" id="DeptId" class="form-control" required disabled>
@ -253,7 +231,7 @@ endif
</div> </div>
</div> </div>
<?php <?php
if ($user_id == "M0056" && $state == 1) { ?> if (($user_id == "M0056" || $user_id == "M0209") && $state == 1) { ?>
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">
@ -320,7 +298,7 @@ endif
</a> </a>
</div> </div>
<?php <?php
elseif ($state == 1 && $user_id == 'M0056') : elseif ($state == 1 && ($user_id == "M0056" || $user_id == "M0209")) :
?> ?>
<div class="form-group"> <div class="form-group">
<div class="col-md-7"> <div class="col-md-7">
@ -371,7 +349,7 @@ $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC);
<th>發票日期</th> <th>發票日期</th>
<th>數量</th> <th>數量</th>
<th>單價</th> <th>單價</th>
<th>費用項目</th> <th>費用/產品</th>
<th>原幣報銷金額</th> <th>原幣報銷金額</th>
<th>說明</th> <th>說明</th>
<th>發票號碼</th> <th>發票號碼</th>
@ -401,7 +379,7 @@ $feetype = mysqli_fetch_all($feetype_query, MYSQLI_ASSOC);
<span class=" glyphicon glyphicon-trash"></span> <span class=" glyphicon glyphicon-trash"></span>
</a> </a>
</td> </td>
<?php } elseif ($state == 1 && $user_id == "M0056") { ?> <?php } elseif ($state == 1 && ($user_id == "M0056" || $user_id == "M0209")) { ?>
<td><a href="rib02-edit.php?id=<?php echo $pay['ribsub_id'] ?>&state=1&<?= $token_link ?>" class="btn btn-warning btn-sm"> <td><a href="rib02-edit.php?id=<?php echo $pay['ribsub_id'] ?>&state=1&<?= $token_link ?>" class="btn btn-warning btn-sm">
<span class=" glyphicon glyphicon-pencil"></span> <span class=" glyphicon glyphicon-pencil"></span>
</a> </a>

4
wms/rib01-delete.php

@ -2,7 +2,7 @@
include "./header.php"; include "./header.php";
$rib_id = isset($_GET['id']) ? $_GET['id'] : die('ERROR:Rib_id is not found.'); $rib_id = isset($_GET['id']) ? $_GET['id'] : die('ERROR:Rib_id is not found.');
$state = isset($_GET['state'])?$_GET['state']:0; $state = isset($_GET['state'])?$_GET['state']:0;
if ($state==1&& $user_id=="M0056"){ if ($state==1&& ($user_id == "M0056" || $user_id == "M0209")){
?> ?>
<script type="text/javascript"> <script type="text/javascript">
@ -22,7 +22,7 @@ if ($state==1&& $user_id=="M0056"){
</script> </script>
<?php <?php
} }
elseif($state==1&& $user_id!="M0056"){ elseif($state==1&& $user_id!="M0056" && $user_id!="M0209"){
?> ?>
<script type="text/javascript"> <script type="text/javascript">

2
wms/rib01-edit.php

@ -205,7 +205,7 @@ if ($pay_data) {
</div> </div>
<div class="form-group"> <div class="form-group">
<?php <?php
if ($user_id == "M0056" && $state == 1) { ?> if (($user_id == "M0056" || $user_id == "M0209") && $state == 1) { ?>
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">

8
wms/rib01-index.php

@ -8,7 +8,7 @@ $data = array();
$sql = "select * from rib "; $sql = "select * from rib ";
// 是否為會計 阿娥 // 是否為會計 阿娥
if ($user_id == 'M0056') { if (($user_id == "M0056" || $user_id == "M0209")) {
$sql .= "WHERE ((CurrentState =1) or (TransactId= '$user_id') or (WriteOffId='$user_id') or (GatheringPersonId='$user_id'))"; $sql .= "WHERE ((CurrentState =1) or (TransactId= '$user_id') or (WriteOffId='$user_id') or (GatheringPersonId='$user_id'))";
$data = mysqli_query($link, $sql); $data = mysqli_query($link, $sql);
} else { } else {
@ -96,7 +96,7 @@ if ($data) :
<th>報銷人</th> <th>報銷人</th>
<th>幣別</th> <th>幣別</th>
<?php <?php
if ($user_id == "M0056") { ?> if (($user_id == "M0056" || $user_id == "M0209")) { ?>
<th>報銷金額</th> <th>報銷金額</th>
<?php } ?> <?php } ?>
<th style="width: 8%;">狀態</th> <th style="width: 8%;">狀態</th>
@ -129,7 +129,7 @@ if ($data) :
elseif ($data['CurrId'] == "EUR") : echo "歐元"; elseif ($data['CurrId'] == "EUR") : echo "歐元";
endif; ?> </td> endif; ?> </td>
<?php <?php
if ($user_id == "M0056") { ?> if (($user_id == "M0056" || $user_id == "M0209")) { ?>
<td><?php echo $data['OAmountWithTax']; ?> </td> <td><?php echo $data['OAmountWithTax']; ?> </td>
<?php } ?> <?php } ?>
<td><?php if ($data['CurrentState'] == 0) : echo "草稿"; <td><?php if ($data['CurrentState'] == 0) : echo "草稿";
@ -142,7 +142,7 @@ if ($data) :
</td> </td>
<td> <td>
<p> <p>
<?php if ($user_id == 'M0056' && $data['CurrentState'] == 1) { <?php if (($user_id == "M0056" || $user_id == "M0209") && $data['CurrentState'] == 1) {
?> ?>
<a href="rib01-check.php?id=<?php echo $data['rib_id'] ?>&state=1&<?= $token_link ?>" class="btn btn-success btn-sm"> <a href="rib01-check.php?id=<?php echo $data['rib_id'] ?>&state=1&<?= $token_link ?>" class="btn btn-success btn-sm">
<span class="glyphicon glyphicon-pawn"></span> <span class="glyphicon glyphicon-pawn"></span>

2
wms/rib01-submit.php

@ -82,7 +82,7 @@ if (mysqli_affected_rows($link)) {
} }
//增加紀錄 //增加紀錄
if ($user_id == 'M0056') { if (($user_id == "M0056" || $user_id == "M0209")) {
$sql_submit = str_replace("'", "", $SQL1); $sql_submit = str_replace("'", "", $SQL1);
$sql_rib = "UPDATE rib SET LastOperatorId = '$user_id', LastOperation='$sql_submit' WHERE rib_id=$rib_id"; $sql_rib = "UPDATE rib SET LastOperatorId = '$user_id', LastOperation='$sql_submit' WHERE rib_id=$rib_id";
mysqli_query($link, $sql_rib); mysqli_query($link, $sql_rib);

2
wms/rib02-check.php

@ -172,7 +172,7 @@ $unit = mysqli_fetch_all($unit_query, MYSQLI_ASSOC);
</div> </div>
</div> </div>
<?php <?php
if ($user_id == "M0056") { if ($user_id == "M0056" || $user_id == "M0209") {
?> ?>
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">

4
wms/rib02-create.php

@ -105,7 +105,7 @@ $materials = $conn->query($sql_Material);
<input class="form-control" type="int" name="FeeDate" id="FeeDate" placeholder="西元年(4碼)+月(2碼)+日(2碼)" required> <input class="form-control" type="int" name="FeeDate" id="FeeDate" placeholder="西元年(4碼)+月(2碼)+日(2碼)" required>
</div> </div>
<?php if ($user_id == "M0056") { ?> <?php if ($user_id == "M0056" || $user_id == "M0209") { ?>
<div class="col-md-3"> <div class="col-md-3">
<label for="FeeTypeId" style="color: red;">費用項目代碼</label> <label for="FeeTypeId" style="color: red;">費用項目代碼</label>
<select name="FeeTypeId" class="form-control" required> <select name="FeeTypeId" class="form-control" required>
@ -282,7 +282,7 @@ $materials = $conn->query($sql_Material);
<option value="25">一般電子發票-> 進項三聯式收銀機統一發票及一般稅額計算之電子發票</option> <option value="25">一般電子發票-> 進項三聯式收銀機統一發票及一般稅額計算之電子發票</option>
<option value="21">三聯式手開發票-> 進項三聯式、電子計算機統一發票</option> <option value="21">三聯式手開發票-> 進項三聯式、電子計算機統一發票</option>
<option value="22">二聯式收銀機發票 -> 進項二聯式收銀機統一發票、載有稅額之其他憑證</option> <option value="22">二聯式收銀機發票 -> 進項二聯式收銀機統一發票、載有稅額之其他憑證</option>
<?php if ($user_id == "M0056") { ?> <?php if ($user_id == "M0056" || $user_id == "M0209") { ?>
<option value="23">三聯式、電子計算機、三聯式收銀機統一發票及一般稅額計算之電子發票之進貨退出或折讓證明單</option> <option value="23">三聯式、電子計算機、三聯式收銀機統一發票及一般稅額計算之電子發票之進貨退出或折讓證明單</option>
<option value="24">二聯式收銀機統一發票及載有稅額之其他憑證之進貨退出或折讓證明單</option> <option value="24">二聯式收銀機統一發票及載有稅額之其他憑證之進貨退出或折讓證明單</option>
<option value="26">彙總登錄每張稅額伍佰元以下之進項三聯式、電子計算機統一發票</option> <option value="26">彙總登錄每張稅額伍佰元以下之進項三聯式、電子計算機統一發票</option>

8
wms/rib02-edit.php

@ -89,7 +89,7 @@ $materials = $conn->query($sql_Material);
<input class="form-control" type="int" name="FeeDate" id="FeeDate" placeholder="西元年(4碼)+月(2碼)+日(2碼)" value="<?= $ribsub['FeeDate'] ?>" required> <input class="form-control" type="int" name="FeeDate" id="FeeDate" placeholder="西元年(4碼)+月(2碼)+日(2碼)" value="<?= $ribsub['FeeDate'] ?>" required>
</div> </div>
<?php if ($user_id == "M0056") { ?> <?php if ($user_id == "M0056" || $user_id == "M0209") { ?>
<div class="col-md-3"> <div class="col-md-3">
<label for="FeeTypeId" style="color: red;">費用項目代碼</label> <label for="FeeTypeId" style="color: red;">費用項目代碼</label>
<select name="FeeTypeId" class="form-control" required> <select name="FeeTypeId" class="form-control" required>
@ -296,7 +296,7 @@ $materials = $conn->query($sql_Material);
</div> </div>
</div> </div>
<?php <?php
if ($user_id == "M0056" && $state == 1) { if (($user_id == "M0056" || $user_id == "M0209") && $state == 1) {
?> ?>
<div class="form-group"> <div class="form-group">
<div class="col-md-3"> <div class="col-md-3">
@ -385,7 +385,7 @@ $materials = $conn->query($sql_Material);
<option value="22" <?php if ($ribsub['InvoiceId'] == "22") { <option value="22" <?php if ($ribsub['InvoiceId'] == "22") {
echo "selected"; echo "selected";
} ?>>二聯式收銀機發票 -> 進項二聯式收銀機統一發票、載有稅額之其他憑證</option> } ?>>二聯式收銀機發票 -> 進項二聯式收銀機統一發票、載有稅額之其他憑證</option>
<?php if ($user_id == "M0056") { ?> <?php if ($user_id == "M0056" || $user_id == "M0209") { ?>
<option value="23" <?php if ($ribsub['InvoiceId'] == "23") { <option value="23" <?php if ($ribsub['InvoiceId'] == "23") {
echo "selected"; echo "selected";
} ?>>三聯式、電子計算機、三聯式收銀機統一發票及一般稅額計算之電子發票之進貨退出或折讓證明單</option> } ?>>三聯式、電子計算機、三聯式收銀機統一發票及一般稅額計算之電子發票之進貨退出或折讓證明單</option>
@ -649,7 +649,7 @@ $materials = $conn->query($sql_Material);
} else { } else {
$("#OAmount").prop("disabled", false); $("#OAmount").prop("disabled", false);
<?php <?php
if ($user_id == "M0056" && $state == 1) { ?> if (($user_id == "M0056" || $user_id == "M0209") && $state == 1) { ?>
$("#OTax").prop("disabled", false); $("#OTax").prop("disabled", false);
$("#LTax").prop("disabled", false); $("#LTax").prop("disabled", false);
$("#OAmountUnWithTax").prop("disabled", false); $("#OAmountUnWithTax").prop("disabled", false);

2
wms/rib02-submit.php

@ -128,7 +128,7 @@ if ($submit == "add") {
$SQL1 .= isset($OAmountUnWithTax) ? ",OAmountUnWithTax=$OAmountUnWithTax" : ""; $SQL1 .= isset($OAmountUnWithTax) ? ",OAmountUnWithTax=$OAmountUnWithTax" : "";
$SQL1 .= isset($LAmountUnWithTax) ? ",LAmountUnWithTax=$LAmountUnWithTax" : ""; $SQL1 .= isset($LAmountUnWithTax) ? ",LAmountUnWithTax=$LAmountUnWithTax" : "";
$SQL1 .= isset($LAmount) ? ",LAmount=$LAmount" : ""; $SQL1 .= isset($LAmount) ? ",LAmount=$LAmount" : "";
if ($user_id == "M0056" && $state == 1) { if (($user_id == "M0056" || $user_id == "M0209") && $state == 1) {
$SQL1 .= ",FeeBalance=$LAmountUnWithTax"; $SQL1 .= ",FeeBalance=$LAmountUnWithTax";
$SQL1 .= ",WriteOffAmount=$OAmount"; $SQL1 .= ",WriteOffAmount=$OAmount";
} }

28
wms/rib03-submit.php

@ -200,16 +200,10 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
} }
$notice_rib_num = mysqli_num_rows($notice_rib); $notice_rib_num = mysqli_num_rows($notice_rib);
$notice_rib = mysqli_fetch_row($notice_rib); $notice_rib = mysqli_fetch_row($notice_rib);
$notice_sql = "SELECT * FROM notice WHERE related_id = 810";
$notice_num = mysqli_query($link, $notice_sql);
$notice_num = mysqli_num_rows($notice_num);
$title = "有" . $notice_rib_num . "個費用報銷單待審核"; $title = "有" . $notice_rib_num . "個費用報銷單待審核";
if ($notice_num == 0) { $insert_notice_sql = "UPDATE notice SET title= '$title', content='$content',haveread=NULL WHERE id=1654";
$insert_notice_sql = "INSERT INTO notice (kind, related_id, title, content, haveread, permission, creater) VALUES(1,810,'$title','$content',1,'M0056','system')"; mysqli_query($link, $insert_notice_sql);
} else { $insert_notice_sql = "UPDATE notice SET title= '$title', content='$content',haveread=NULL WHERE id=1959";
$insert_notice_sql = "UPDATE notice SET title= '$title', content='$content',permission='M0056' WHERE related_id=810";
}
mysqli_query($link, $insert_notice_sql); mysqli_query($link, $insert_notice_sql);
} elseif ($state == 2) { } elseif ($state == 2) {
//取得表頭資料 //取得表頭資料
@ -392,24 +386,12 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
} }
$notice_rib_num = mysqli_num_rows($notice_rib); $notice_rib_num = mysqli_num_rows($notice_rib);
$notice_rib = mysqli_fetch_row($notice_rib); $notice_rib = mysqli_fetch_row($notice_rib);
$notice_sql = "SELECT * FROM notice WHERE related_id = 810";
$notice_num = mysqli_query($link, $notice_sql);
$notice_num = mysqli_num_rows($notice_num);
$title = "有" . $notice_rib_num . "個費用報銷單待審核"; $title = "有" . $notice_rib_num . "個費用報銷單待審核";
if ($notice_rib_num > 0) { $insert_notice_sql = "UPDATE notice SET title= '$title', content='$content',haveread=NULL WHERE id=1654";
if ($notice_num == 0) {
$insert_notice_sql = "INSERT INTO notice (kind, related_id, title, content, haveread, permission, creater) VALUES(1,810,'$title','$content',1,'M0056','system')";
} else {
$insert_notice_sql = "UPDATE notice SET title= '$title', content='$content',permission='M0056' WHERE related_id=810";
}
mysqli_query($link, $insert_notice_sql); mysqli_query($link, $insert_notice_sql);
} else { $insert_notice_sql = "UPDATE notice SET title= '$title', content='$content',haveread=NULL WHERE id=1959";
if ($notice_num != 0) {
$insert_notice_sql = "DELETE FROM notice WHERE related_id = 810";
}
mysqli_query($link, $insert_notice_sql); mysqli_query($link, $insert_notice_sql);
} }
}
?> ?>
<script> <script>
window.location.href = "rib01-index.php?<?= $token_link ?>"; window.location.href = "rib01-index.php?<?= $token_link ?>";

Loading…
Cancel
Save