Browse Source

Merge branch 'main' into gary

gary
gary_chen\gary_chen 1 year ago
parent
commit
23ec9ed89d
  1. BIN
      wms/WriteOff.xlsx
  2. 2
      wms/crm/async_req.php
  3. 2
      wms/crm/crmm03-edit.php
  4. 2
      wms/crm/crmm04-edit.php
  5. 4
      wms/fun_global.php
  6. 4
      wms/mkt/pricereview_renovate-index.php
  7. 5
      wms/mkt/pricereview_repair-check.php
  8. 29
      wms/mkt/pricereview_repair-create.php
  9. 16
      wms/mkt/pricereview_repair-index.php
  10. 16
      wms/rib02-create.php
  11. 11
      wms/rib02-edit.php
  12. 62
      wms/rib03-submit.php

BIN
wms/WriteOff.xlsx

Binary file not shown.

2
wms/crm/async_req.php

@ -19,5 +19,5 @@ function rm_option($req)
{
$vol_no = $req['vol_no'];
$model_no = $req['model_no'];
DB::query("delete from hope_elevator_option_price where vol_no='$vol_no' and model_no='$model_no'");
DB::query("delete from hope_elevator_option_price where vol_no='$vol_no' and id='$model_no'");
}

2
wms/crm/crmm03-edit.php

@ -131,7 +131,7 @@ $hpeoRow .= "<td><button onClick='delHpeoRow(this)' type='button' class='btn btn
//linkman,
$sql = " SELECT id,spec,memo,case when optional then '1-選配' when 2 then '2-標配' end optional ,unit,price FROM option_price ";
$sql = " SELECT id,spec,memo,case when optional then '1-選配' when 2 then '2-標配' end optional ,unit,price FROM option_price where status='Y'";
$option_price = DB::result($sql);

2
wms/crm/crmm04-edit.php

@ -143,7 +143,7 @@ $option_price_column = [
];
$sql = " SELECT * FROM $table_option_price where 1=1 $where ";
$hope_project_elevator_option = DB::result($sql);
$sql = " SELECT id,spec,memo,case when optional then '1-選配' when 2 then '2-標配' end optional ,unit,price FROM option_price ";
$sql = " SELECT id,spec,memo,case when optional then '1-選配' when 2 then '2-標配' end optional ,unit,price FROM option_price where status='Y'";
$option_price = DB::result($sql);
$hpeoRow = " <tr>";

4
wms/fun_global.php

@ -124,11 +124,11 @@ function pricereview_renovate_class($rate, $user_id, $renovate_flag) {
mysqli_free_result($res);
if ($renovate_flag == "REN") {
if ($rate < 80 && $rate >= 60) $ret[3] = "M0008"; // 詹總
if ($rate < 80) $ret[3] = "M0008"; // 詹總
if ($rate < 60) $ret[4] = "M0006"; // 總經理
} else {
// 全汰改
if ($rate < 80 && $rate >= 75) $ret[3] = "M0008"; // 詹總
if ($rate < 80) $ret[3] = "M0008"; // 詹總
if ($rate < 75) $ret[4] = "M0006"; // 總經理
}

4
wms/mkt/pricereview_renovate-index.php

@ -10,8 +10,8 @@ $status_arr = ["Y1" => "暫存", "YS" => "簽核中", "YY" => "結案同意", "Y
$data = array();
// sql語法存在變數中
$sql_cmd = sql_myself($user_id);
// M0024許伃廷,M0107許紓晴權限全開
if ($user_id == "M0024" || $user_id == "M0107") {
// M0024許伃廷,M0107許紓晴,M0012李盈瑩權限全開
if ($user_id == "M0024" || $user_id == "M0107" || $user_id == "M0012") {
$sql_cmd = "where create_at >= '2023-01-01 00:00:00'";
}
if ($user_id == "M0008") {

5
wms/mkt/pricereview_repair-check.php

@ -91,6 +91,9 @@ input[type=submit], input[type=button] {
.dollar-right {
text-align: right;
}
.star {
color: red;
}
</style>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
@ -230,7 +233,7 @@ $(function(){
<table class="table table-bordered">
<thead>
<tr>
<th colspan="10">簽核操作</th>
<th colspan="10">簽核操作<span class="star">*</span></th>
</tr>
</thead>
<tbody>

29
wms/mkt/pricereview_repair-create.php

@ -116,6 +116,9 @@ input[type=submit], input[type=button] {
.dollar-right {
text-align: right;
}
.star {
color: red;
}
</style>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
@ -342,7 +345,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
?>
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data">
<div>
<label for="contractno">客戶合約號</label>
<label for="contractno">客戶合約號<span class="star">*</span></label>
<input type="text" name="contractno" id="contractno" required>
</div>
<div>
@ -351,16 +354,16 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</div>
<div class="nextline"></div>
<div>
<label for="repair_no">報價單編號</label>
<label for="repair_no">報價單編號<span class="star">*</span></label>
<input type="text" name="repair_no" id="repair_no" value="<?php echo $repair_no; ?>" readonly>
</div>
<div class="nextline"></div>
<div>
<label for="sign_date">簽訂日期</label><br>
<label for="sign_date">簽訂日期<span class="star">*</span></label><br>
<input type="date" name="sign_date" id="sign_date" value="<?php echo date('Y-m-d'); ?>" required>
</div>
<div>
<label for="company">公司地址</label>
<label for="company">公司地址<span class="star">*</span></label>
<select name="masada_addr" id="masada_addr" required>
<option value=""></option>
<?php
@ -371,11 +374,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</select>
</div>
<div>
<label for="company">客戶名稱</label>
<label for="company">客戶名稱<span class="star">*</span></label>
<input type="text" name="company" id="company" size="30" required>
</div>
<div>
<label for="facilityno">電梯編號</label>
<label for="facilityno">電梯編號<span class="star">*</span></label>
<input type="text" name="facilityno" required>
<select name="facilityno" required>
<option value=""></option>
@ -383,19 +386,19 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
</div>
<div class="nextline"></div>
<div>
<label for="address">工程地址</label>
<label for="address">工程地址<span class="star">*</span></label>
<input type="text" name="address" id="address" size="50" required>
</div>
<div>
<label for="taxid">客戶統一編號</label>
<input type="text" name="taxid" id="taxid" maxlength="8" required>
<label for="taxid">客戶統一編號<span></span></label>
<input type="text" name="taxid" id="taxid" maxlength="8">
</div>
<div>
<label for="invoice">客戶發票抬頭</label>
<label for="invoice">客戶發票抬頭<span class="star">*</span></label>
<input type="text" name="invoice" id="invoice" size="30" required>
</div>
<div>
<label for="repairerid">申請人</label>
<label for="repairerid">申請人<span class="star">*</span></label>
<select name="repairerid" id="repairerid" required>
<option value=""></option>
<?php
@ -418,7 +421,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<table id="tb1" class="table table-bordered">
<thead>
<tr>
<th colspan="10"><a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm">新增</a></th>
<th colspan="10"><a href="javascript:void(0);" id="btnadd" class="btn btn-primary btn-sm">新增備品</a> <span class="star">*</span></th>
</tr>
<tr>
<th nowrap>名稱</th>
@ -476,7 +479,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){
<table class="table table-bordered">
<thead>
<tr>
<th colspan="10">簽核操作</th>
<th colspan="10">簽核操作<span class="star">*</span></th>
</tr>
</thead>
<tbody>

16
wms/mkt/pricereview_repair-index.php

@ -9,24 +9,16 @@ $psta_arr = ["A" => "簽核中", "B1" => "已同意", "B2" => "已完工", "X" =
// 設置一個空陣列來放資料
$data = array();
// sql語法存在變數中
$sql_cmd = sql_myself($user_id, "repairerid");
$sql_cmd = "where (repairerid = '$user_id' or checker = '$user_id')";
$is_manager = 0;
// 宜:M0054-陳志文
$repman_arr[0] = ["M0177"];
// 北:M0137-劉永德
$repman_arr[1] = ["M0059","M0083","M0084","M0090","M0064","M0106","M0092","M0120","M0147","M0139","M0194","M0210"];
// 桃:M0026-張莉凱
$repman_arr[2] = ["M0018", "M0045","M0089","M0104","M0111"];
// 中:M0086-李烘銘
$repman_arr[3] = ["M0148","M0114","M0161"];
// 南:M0033-吳育宗
$repman_arr[4] = ["M0196","M0195","M0190","M0094","M0123","M0124"];
if ($user_id == "M0054") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[0])."')"; }
elseif ($user_id == "M0137") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[1])."')"; }
elseif ($user_id == "M0026") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[2])."')"; }
elseif ($user_id == "M0086") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[3])."')"; }
elseif ($user_id == "M0033") { $is_manager = 1; $sql_cmd = "where repairerid in ('".implode("','", $repman_arr[4])."')"; }
elseif ($user_id == "M0012") $sql_cmd = "";
$manager_arr = ["M0054", "M0137", "M0026", "M0086", "M0033"];
if (in_array($user_id, $manager_arr)) $is_manager = 1;
if ($user_id == "M0012") $sql_cmd = "";
$sql = "select * from pricereview_repair_main $sql_cmd order by id";
$data = mysqli_query($link,$sql);
$para = "function_name=pricereview_repair&".$token_link;

16
wms/rib02-create.php

@ -636,11 +636,13 @@ $materials = $conn->query($sql_Material);
$("#FeeDate").val('');
} else {
let year = $("#FeeDate").val().substr(0, 4);
let month = $("#FeeDate").val().substr(4, 2);
let month = parseInt($("#FeeDate").val().substr(4, 2)) - 1;
let day = $("#FeeDate").val().substr(6, 2);
let feedate = new Date(year, month, day);
feedate.setMonth(feedate.getMonth() - 1);
let now = new Date();
if (feedate.getMonth() != month) {
alert("請輸入正確格式的日期");
} else {
if (feedate > now) {
alert("費用日期不可大於今天");
$("#FeeDate").val('');
@ -648,19 +650,13 @@ $materials = $conn->query($sql_Material);
now.setMonth(now.getMonth() - 2);
now.setDate(1);
now.setDate(now.getDate() - 1);
console.log(now.getFullYear());
console.log(now.getMonth());
console.log(now.getDate());
console.log(feedate.getFullYear());
console.log(feedate.getMonth());
console.log(feedate.getDate());
if (feedate <= now) {
alert("超過兩個月的費用無法進行報銷");
$("#FeeDate").val('');
}
}
}
}
})
})
@ -685,7 +681,7 @@ $materials = $conn->query($sql_Material);
};
function senddata() {
if ($("#FeeDate").val() == "" || $("#FeeNoteShow").val() == "" || $("#Price").val() == "" || $("#Quantity").val() == "") {
if ($("#FeeDate").val() == "" || $("#FeeNoteShow").val() == "" || $("#Price").val() == "" || $("#Quantity").val() == "" || $("#WriteOffId").val() == "") {
alert("請確認紅字部分皆有填寫");
} else if ($("#OAmount").val() <= 0) {
alert("金額必須大於零");

11
wms/rib02-edit.php

@ -550,24 +550,27 @@ $materials = $conn->query($sql_Material);
$("#FeeDate").val('');
} else {
let year = $("#FeeDate").val().substr(0, 4);
let month = $("#FeeDate").val().substr(4, 2);
let month = parseInt($("#FeeDate").val().substr(4, 2)) - 1;
let day = $("#FeeDate").val().substr(6, 2);
let feedate = new Date(year, month, day);
feedate.setMonth(feedate.getMonth() - 1);
let now = new Date();
if (feedate.getMonth() != month) {
alert("請輸入正確格式的日期");
} else {
if (feedate > now) {
alert("費用日期不可大於今天");
$("#FeeDate").val('');
} else {
now.setMonth(now.getMonth() - 2);
now.setDate(1);
now.setDate(now.getDate() - 1)
if (feedate < now) {
now.setDate(now.getDate() - 1);
if (feedate <= now) {
alert("超過兩個月的費用無法進行報銷");
$("#FeeDate").val('');
}
}
}
}
})
$("#Price").change(function() {

62
wms/rib03-submit.php

@ -224,13 +224,13 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$WriteOffDescribe = empty($rib['WriteOffDescribe']) ? null : $rib['WriteOffDescribe'];
$DeptId = $rib['DeptId'];
$CostCenterId = empty($rib['CostCenterId']) ? Null : $rib['CostCenterId'];
$HadPayOAmount = $rib['HadPayOAmount'];
$HadPayLAmount = $rib['HadPayLAmount'];
$UnPayOAmount = $rib['UnPayOAmount'];
$UnPayLAmount = $rib['UnPayLAmount'];
$HadPayOAmount = $CurrId=="TWD"? round($rib['HadPayOAmount']):round($rib['HadPayOAmount'],2);
$HadPayLAmount = $CurrId=="TWD"? round($rib['HadPayLAmount']):round($rib['HadPayLAmount'],2);
$UnPayOAmount = $CurrId=="TWD"? round($rib['UnPayOAmount']):round($rib['UnPayOAmount'],2);
$UnPayLAmount = $CurrId=="TWD"? round($rib['UnPayLAmount']):round($rib['UnPayLAmount'],2);
$PaymentState = $rib['PaymentState'];
$Balance = $rib['Balance'];
$LBalance = $rib['LBalance'];
$Balance = $CurrId=="TWD"? round($rib['Balance']):round($rib['Balance'],2);
$LBalance = $CurrId=="TWD"? round($rib['LBalance']):round($rib['LBalance'],2);
$GatheringPersonId = $rib['GatheringPersonId'];
$GatheringPersonDescribe = empty($rib['GatheringPersonDescribe']) ? Null : $rib['GatheringPersonDescribe'];
$BankId = empty($rib['BankId']) ? Null : $rib['BankId'];
@ -241,19 +241,20 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$BankAccount = empty($rib['BankAccount']) ? Null : $rib['BankAccount'];
$BankAccountName = empty($rib['BankAccountName']) ? Null : $rib['BankAccountName'];
$IsTaxBill = $rib['IsTaxBill'];
$OAmount = $rib['OAmount'];
$LAmount = $rib['LAmount'];
$OTax = $rib['OTax'];
$LTax = $rib['LTax'];
$LAmountWithTax = $rib['LAmountWithTax'];
$OAmountWithTax = $rib['OAmountWithTax'];
$OAmount = $CurrId=="TWD"? round($rib['OAmount']):round($rib['OAmount'],2);
$LAmount = $CurrId=="TWD"? round($rib['LAmount']):round($rib['LAmount'],2);
$OTax = $CurrId=="TWD"? round($rib['OTax']):round($rib['OTax'],2);
$LTax = $CurrId=="TWD"? round($rib['LTax']):round($rib['LTax'],2);
$LAmountWithTax = $CurrId=="TWD"? round($rib['LAmountWithTax']):round($rib['LAmountWithTax'],2);
$OAmountWithTax = $CurrId=="TWD"? round($rib['OAmountWithTax']):round($rib['OAmountWithTax'],2);
$IsContainTax = $rib['IsContainTax'];
$AdvanceOAmount = $rib['AdvanceOAmount'];
$AdvanceLAmount = $rib['AdvanceLAmount'];
$AdvanceOAmount = $CurrId=="TWD"? round($rib['AdvanceOAmount']):round($rib['AdvanceOAmount'],2);
$AdvanceLAmount = $CurrId=="TWD"? round($rib['AdvanceLAmount']):round($rib['AdvanceLAmount'],2);
$PrePayWriteOffAmount = $rib['PrePayWriteOffAmount'];
$WriteOffAmount = $rib['WriteOffAmount'];
$WriteOffAmount = $CurrId=="TWD"? round($rib['WriteOffAmount']):round($rib['WriteOffAmount'],2);
$TelNo = empty($rib['TelNo']) ? Null : $rib['TelNo'];
$UnPaymentLAmt = empty($rib['UnPaymentLAmt']) ? null : $rib['UnPaymentLAmt'];
$UnPaymentLAmt = empty($rib['UnPaymentLAmt']) ? null : ($CurrId=="TWD"? round($rib['UnPaymentLAmt']):round($rib['UnPaymentLAmt'],2));
$CreatorId = $rib['CreatorId'];
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@ -262,14 +263,14 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
HadPayOAmount,HadPayLAmount,UnPayOAmount,UnPayLAmount,PaymentState,Balance,LBalance,
FillUp,GatheringBizOrgId, GatheringPersonId, IsTaxBill, OAmount,LAmount,OTax,LTax,LAmountWithTax,OAmountWithTax,
IsContainTax,AdvanceOAmount,AdvanceLAmount,PrePayWriteOffAmount,WriteOffAmount,
CompId,UnPaymentOAmt,UnPaymentLAmt,IsPayment, CurrentState,PermitState";
CompId,UnPaymentOAmt,UnPaymentLAmt,IsPayment, CurrentState,PermitState,CreatorId";
$sql2 = ") VALUES ('$BillNo',$BillDate,'1000','1000','$TypeId','1000',
'$CurrId','$TransactId',$WriteOffType,'1000','$WriteOffId','$DeptId',
$HadPayOAmount,$HadPayLAmount,$UnPayOAmount,$UnPayLAmount,$PaymentState,$Balance,$LBalance,
0,'1000','$GatheringPersonId',$IsTaxBill,$OAmount,$LAmount,$OTax,$LTax,$LAmountWithTax,$OAmountWithTax,
$IsContainTax,$AdvanceOAmount,$AdvanceLAmount,$PrePayWriteOffAmount,$WriteOffAmount,
'1001',$WriteOffAmount,$UnPaymentLAmt,0,2,0";
'1001',$WriteOffAmount,$UnPaymentLAmt,0,2,0,'$CreatorId'";
$sql .= empty($CostCenterId) ? "" : ",CostCenterId";
$sql2 .= empty($CostCenterId) ? "" : ",'" . $CostCenterId . "'";
@ -309,18 +310,18 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$CostCenterId = empty($ribsub['CostCenterId']) ? Null : $ribsub['CostCenterId'];
$UnitId = $ribsub['UnitId'];
$Quantity = $ribsub['Quantity'];
$Price = $ribsub['Price'];
$CurrOAmount = $ribsub['CurrOAmount'];
$CurrLAmount = $ribsub['CurrentLAmount'];
$Price = $CurrId=="TWD"? round($ribsub['Price']) : round($ribsub['Price'],2);
$CurrOAmount = $CurrId=="TWD"? round($ribsub['CurrOAmount']) : round($ribsub['CurrOAmount'],2);
$CurrLAmount = $CurrId=="TWD"? round($ribsub['CurrentLAmount']): round($ribsub['CurrentLAmount'],2);
$TaxId = $ribsub['TaxId'];
$TaxRate = $ribsub['TaxRate'];
$OTax = $ribsub['OTax'];
$LTax = $ribsub['LTax'];
$LAmountUnWithTax = $ribsub['LAmountUnWithTax'];
$OAmountUnWithTax = $ribsub['OAmountUnWithTax'];
$OAmount = $ribsub['OAmount'];
$LAmount = $ribsub['LAmount'];
$FeeBalance = $ribsub['FeeBalance'];
$OTax = $CurrId=="TWD"? round($ribsub['OTax']): round($ribsub['OTax'],2);
$LTax = $CurrId=="TWD"? round($ribsub['LTax']): round($ribsub['LTax'],2);
$LAmountUnWithTax = $CurrId=="TWD"? round($ribsub['LAmountUnWithTax']): round($ribsub['LAmountUnWithTax'],2);
$OAmountUnWithTax = $CurrId=="TWD"? round($ribsub['OAmountUnWithTax']): round($ribsub['OAmountUnWithTax'],2);
$OAmount = $CurrId=="TWD"? round($ribsub['OAmount']): round($ribsub['OAmount'],2);
$LAmount = $CurrId=="TWD"? round($ribsub['LAmount']): round($ribsub['LAmount'],2);
$FeeBalance = $CurrId=="TWD"? round($ribsub['FeeBalance']): round($ribsub['FeeBalance'],2);
$VoucherCount = $ribsub['VoucherCount'];
$FeeNoteShow = empty($ribsub['FeeNoteShow']) ? Null : $ribsub['FeeNoteShow'];
@ -341,13 +342,13 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$sqlsub = "INSERT INTO glFeeWriteOffSub (BillNo, RowCode,RowNo,FeeDate,FeeTypeId, WriteOffType,
BizOrgId, WriteOffId, FeeOrgId, FeeDeptId, FeeCompanyId, UnitId ,
Quantity, Price, CurrOAmount,CurrLAmount,TaxId,TaxRate,OTax,LTax,LAmountUnWithTax
,OAmountUnWithTax,OAmount,LAmount,FeeBalance,VoucherCount,CurrId,WriteOffAmount,SupplyOrgId,IsCounteract,IsKeyByFeeInfo,CreatorId
,OAmountUnWithTax,OAmount,LAmount,FeeBalance,VoucherCount,CurrId,WriteOffAmount,SupplyOrgId,IsCounteract,IsKeyByFeeInfo
";
$sqlsub2 = ") VALUES ('$BillNo',$RowCode, $RowNo,$FeeDate,'$FeeTypeId',$WriteOffType,
'1000','$WriteOffId','1000','$FeeDeptId','1000','$UnitId',
$Quantity, $Price, $CurrOAmount, $CurrLAmount,'$TaxId',$TaxRate,$OTax,$LTax,$LAmountUnWithTax
,$OAmountUnWithTax,$OAmount,$LAmount,$FeeBalance,$VoucherCount,'$CurrId',$WriteOffAmount,'1000',$IsCounteract,0,$CreatorId
,$OAmountUnWithTax,$OAmount,$LAmount,$FeeBalance,$VoucherCount,'$CurrId',$WriteOffAmount,'1000',$IsCounteract,0
";
$sqlsub .= empty($WriteOffDescribe) ? "" : ",WriteOffDescribe";
@ -374,7 +375,6 @@ OAmount =$OAmount, UnPayOAmount=$UnPayOAmount, Balance = $OAmountWithTax, LBalan
$sqlsub .= $sqlsub2;
$sqlsub .= ")";
$result2 = $conn->query($sqlsub);
}

Loading…
Cancel
Save