Browse Source

獎金計算

gary
Cheng 1 year ago
parent
commit
4e2ce3009e
  1. 69
      wms/bons/api/get.php
  2. 118
      wms/bons/bons_index.php
  3. 3
      wms/contract-repair/contract-repair-input.php
  4. 77
      wms/contract-repair/js/alpine.js
  5. 1
      wms/contract/api/postContractData.php
  6. 2
      wms/contract/connt8.php
  7. 15
      wms/contract/connt8_test.php
  8. 3288
      wms/mkt/pricereview-edit.php

69
wms/bons/api/get.php

@ -0,0 +1,69 @@
<?php
require_once('../../contract/connt8.php');
if (!empty($_GET['contract_no'])) {
$contract_no = $_GET['contract_no'];
$sql = "SELECT
a.BillNo,
b.OTaxAmt as amount,
a.CU_EstPayDate as createDate,
b.PersonId as personId,
c.BillNo as CBno,
c.CU_MaterialId as facility
FROM salIncomeApplyDetail as a
LEFT JOIN salIncomeApplyMaster as b ON a.BillNo = b.BillNo
LEFT JOIN (
SELECT aMaster.BillNo,aMaster.BizPartnerId,aDetail.CU_MaterialId FROM arCheckBill as aMaster
LEFT JOIN arCheckBillDetail as aDetail ON aMaster.BizPartnerId = aDetail.FromBillNo
WHERE aMaster.BizPartnerId = 'Q23080067' AND aMaster.TypeId = 'RVS'
) AS c ON a.BillNo = c.BizPartnerId
WHERE a.BillNo = 'Q23080067'
AND a.RowNo = '1'
";
$stmt = $connT8->prepare($sql);
$stmt->execute();
$data = $stmt->fetch(PDO::FETCH_ASSOC);
$data['amount'] = intval($data['amount']);
$checkBillNo = $data['CBno'];
$sql = "SELECT
c.BillDate AS CheckBillDate
FROM arWriteOffBill AS a
LEFT JOIN arWriteOffBillRec AS b ON a.BillNo=b.BillNo
LEFT JOIN
(SELECT temp1.*,arWriteOffBillDetail.* FROM arWriteOffBillDetail
LEFT JOIN
(SELECT
arCheckBill.BillNo AS checkBillNo, arCheckBill.BillDate,arCheckBillInvInfo.InvoiceNo
FROM arCheckBill
LEFT JOIN arCheckBillInvInfo
ON arCheckBill.InvoiceBillNo=arCheckBillInvInfo.InvoiceBillNo) AS temp1
ON temp1.checkBillNo = arWriteOffBillDetail.FromBillNo) AS c
ON a.BillNo=c.BillNo
WHERE c.checkBillNo = '$checkBillNo'
";
$stmt = $connT8->prepare($sql);
$stmt->execute();
$check = $stmt->fetch(PDO::FETCH_ASSOC);
$sql = "SELECT SQuantity FROM salIncomeApplyMaster WHERE BillNo = '$contract_no'";
$stmt = $connT8->prepare($sql);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$count = COUNT($result);
$data['maintain_month'] = intval($conunt * $result['Squantity'])
if (!empty($check['CheckBillDate'])) {
header('Content-Type: application/json');
echo json_encode($data);
} else {
echo false;
exit;
}
}

118
wms/bons/bons_index.php

@ -0,0 +1,118 @@
<?php
include('../header.php');
require_once('../contract-repair/conn.php');
?>
<link rel="stylesheet" href="../contract-repair/styles/style.css">
<link rel="stylesheet" href="../contract-repair/semantic/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="../contract-repair/js/alpine.js"></script>
<script defer src="../contract-repair/js/alpinejs/cdn.min.js"></script>
<script src="../contract-repair/js/axios/axios.min.js"></script>
<script src="../contract-repair/js/jquery/jquery-3.1.1.min.js"></script>
<script src="../contract-repair/semantic/dist/semantic.min.js"></script>
<div class="bons_index" x-data="bonsIndex">
<div class="form" method="post" id="form" enctype="multipart/form-data">
<input type="hidden" name="form_name" value="main_form">
<div>
<table class="table table-bordered query-table table-striped table-bordered display compact" style="width:99%;margin-left:.5%">
<thead>
<tr>
<td colspan="8">
<h3 style='text-align:center'>獎金計算</h3>
</td>
</tr>
</thead>
<template x-if="step==1">
<tbody style="font-weight: bolder;margin: botton 20px;">
<tr>
<td style="vertical-align: middle;">合約號</td>
<td colspan="5">
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="contract_no" x-model="data.contract_no">
</td>
<td colspan="2" style="vertical-align:middle"></td>
</tr>
</tbody>
</template>
<template x-if="step==2">
<tbody style="font-weight: bolder;margin-bottom:20px">
<tr>
<td colspan="7" style="vertical-align:middle;border-right:0px">
<h4>獎金確認項</h4>
</td>
<td class="text-right" style="border: left 0px;">
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close()">關閉</button>
</td>
</tr>
<tr>
<td style="vertical-align:middle">合約號</td>
<td>
<input type="text" x-model="data.contract_no" disabled="disabled">
</td>
<td style="vertical-align:middle">合約類別</td>
<td>
<select id="client_type" x-model="data.client_type">
<option value="">--請選擇--</option>
<option value="1">新簽約</option>
<option value="2">免保轉有費</option>
<option value="3">續簽約</option>
</select>
</td>
<td style="vertical-align:middle">作番號</td>
<td>
<input type="text" x-model="data.facility_no" disabled="disabled">
</td>
<td style="vertical-align:middle">獎金適用版本</td>
<td>
<input type="text" x-model="data.bons_verson" disabled="disabled">
</td>
</tr>
<tr>
<td style="vertical-align:middle">獎金發放人員</td>
<td>
<input type="text" x-model="data.receiver" disabled="disabled">
</td>
<td style="vertical-align:middle">保養月份</td>
<td>
<input type="text" x-model="data.maintain_month" disabled="disabled">
</td>
<td style="vertical-align:middle">保養總額</td>
<td>
<input type="text" x-model="data.maintain_price_toal" disabled="disabled">
</td>
</tr>
</tbody>
</template>
</table>
<button x-show="step==3" @click="save()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>存檔</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
<button x-show="step<=2" @click="nextStepFn()" type="button" class="btn btn-primary btn-lg pull-right savebtn" :disabled="isLoading">
<template x-if="!isLoading">
<span>下一步</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
<button x-show="step>1" @click="preStepFn()" :disabled="isLoading" type="button" class="btn btn-primary btn-lg pull-right savebtn">
<template x-if="!isLoading">
<span>上一步</span>
</template>
<template x-if="isLoading">
<div class="loader"></div>
</template>
</button>
</div>
</div>
</div>

3
wms/contract-repair/contract-repair-input.php

@ -48,7 +48,6 @@ $contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修
<td style="vertical-align: middle">報價單編號</td>
<td colspan="5">
<input class="form-control" @keyup="nextStepKeyupFn($event)" type="text" name="repair_no" x-model="data.repair_no">
</td>
<td colspan="2" style="vertical-align: middle">
<label for="customize">
@ -68,7 +67,7 @@ $contract_stauts = ["合約簽回", "採購", "工程發包", "工程中", "修
<h4>業務確認項</h4>
</td>
<td class="text-right" style='border-left:0px;'>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.history.back();">返回</button>
<button type="button" id="btn_back" class="btn btn-default" onclick="window.history.back();">返回</button>
<button type="button" id="btn_close" class="btn btn-default" onclick="window.close();">關閉分頁</button>
</td>
</tr>

77
wms/contract-repair/js/alpine.js

@ -873,3 +873,80 @@ const contract_edit = () => {
}
}
const bonsIndex = () => {
return {
data: {
contract_no: 'Q23080067',
client_type: '',
facility_no: '',
bons_verson: '',
receiver: '',
maintain_month: '',
maintain_price_toal: ''
},
step: 1,
isLoading: false,
fail_arr: [],
nextStepFn() {
if (this.step == 1) {
if (this.data.contract_no == '') return alert('請輸入合約號');
this.isLoading = true;
this.getContractData();
} else if (this.step == 2) {
if (!this.data.disabled) {
this.createElevator();
}
}
this.step = 3;
},
nextStepKeyupFn(e) {
if (e.keyCode !== 13) return;
if (this.step == 1) {
if (this.data.contract_no == '') return alert('請輸入合約號');
this.isLoading = true;
this.getContractData();
} else if (this.step == 2) {
this.step = 3; s
}
},
getContractData() {
axios.get('./api/get.php?contract_no=' + this.data.contract_no).then(res => {
if (!res.data) {
this.step = 2;
this.isLoading = false;
return;
}
if (!this.customize) {
this.data.contract_no = res.data.BillNo;
this.data.facility_no = res.data.facility;
this.data.bons_verson = res.data.bons_verson;
this.data.receiver = res.data.personId;
this.data.maintain_price_toal = res.data.amount;
this.data.bons_verson = 2;
}
this.step = 2;
this.isLoading = false;
}).catch(err => {
})
},
preStepFn() {
if (this.step == 2) {
console.log
}
},
save() {
},
errorFn() {
let msg = '';
for (let i = 0; i < this.fail_arr.length; i++) {
msg += this.fail_arr[i] + '、';
}
alert(msg);
},
}
}

1
wms/contract/api/postContractData.php

@ -596,6 +596,7 @@ function T8insert($data, $facilityno)
$result = T8API($API_body);
if ($result['Status'] == 'Error' || $result['Status'] == 'Fails') {
http_response_code(404);
die('Error!:' . $result['ErrorMsg']);
}

2
wms/contract/connt8.php

@ -4,7 +4,7 @@ include "/Users/LO_2342/Desktop/httpdocs/wms/fun_global.php";
// phpinfo();
// exit();
try {
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8TEST", "M0225", "IFFBU1E=");
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8masada", "M0225", "IFFBU1E=");
if ($connT8) {
$connT8->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}

15
wms/contract/connt8_test.php

@ -0,0 +1,15 @@
<?php
require_once dirname(__FILE__) . "/../../mkt/database.php";
include "/Users/LO_2342/Desktop/httpdocs/wms/fun_global.php";
// phpinfo();
// exit();
try {
$connT8 = new PDO("sqlsrv:Server=220.130.203.251;Database=T8test", "M0225", "IFFBU1E=");
if ($connT8) {
$connT8->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
} catch (PDOException $e) {
// echo "fail";
// echo $e->getMessage();
die("ERROR!!!: " . $e->getMessage());
}

3288
wms/mkt/pricereview-edit.php

File diff suppressed because it is too large
Loading…
Cancel
Save