Browse Source

合約書附件bug修正

main
10994015 1 year ago
parent
commit
b0a04ee285
  1. 8
      wms/contract/contract-download.php
  2. 8
      wms/contract/js/alpine.js
  3. 6
      wms/contract/prviewPdf.php

8
wms/contract/contract-download.php

@ -25,6 +25,7 @@ if(isset($_GET['id']) && $_GET['id']!=""){
$stmt->execute(); $stmt->execute();
$contracts = $stmt->fetchAll(PDO::FETCH_ASSOC); $contracts = $stmt->fetchAll(PDO::FETCH_ASSOC);
$contract = $contracts[0]; $contract = $contracts[0];
$contract_apply_id = $contract['id'];
if(($contract['status'] !== "YY" && $user_id != 'M0107') && $user_id != 'M0174'){ if(($contract['status'] !== "YY" && $user_id != 'M0107') && $user_id != 'M0174'){
echo '<script type="text/javascript"> echo '<script type="text/javascript">
alert("非法訪問。"); alert("非法訪問。");
@ -79,14 +80,12 @@ if(isset($_GET['id']) && $_GET['id']!=""){
} }
} }
$sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL"; $sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL";
$sql_str = "SELECT contract_apply_files.*, contract_new_apply.id as apply_id FROM contract_apply_files LEFT JOIN contract_new_apply ON contract_apply_files.contract_id = contract_new_apply.id WHERE contract_new_apply.mid = :mid AND contract_apply_files.deleted_at IS NULL";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':contract_id', $id); $stmt->bindParam(':mid', $id);
$stmt->execute(); $stmt->execute();
$files = $stmt->fetchAll(PDO::FETCH_ASSOC); $files = $stmt->fetchAll(PDO::FETCH_ASSOC);
print_r($files);
echo "count=>" . count($files);
$files_count = count($files); $files_count = count($files);
} }
catch (PDOException $e ){ catch (PDOException $e ){
@ -355,6 +354,7 @@ if(isset($_GET['id']) && $_GET['id']!=""){
</div> </div>
<form action="prviewPdf.php?id=<?php echo $id; ?>&<?php echo $token_link; ?>" id="form" method="post" x-ref="form" style="display:none"> <form action="prviewPdf.php?id=<?php echo $id; ?>&<?php echo $token_link; ?>" id="form" method="post" x-ref="form" style="display:none">
<input type="hidden" name="contract_apply_id" id="contract_apply_id" value="<?php echo $contract_apply_id; ?>" />
<input type="hidden" name="list" id="prview-list" /> <input type="hidden" name="list" id="prview-list" />
<input type="hidden" name="prviewType" id="prview-type" /> <input type="hidden" name="prviewType" id="prview-type" />
<input type="hidden" name="standardList" id="standard-prview-list" /> <input type="hidden" name="standardList" id="standard-prview-list" />

8
wms/contract/js/alpine.js

@ -686,8 +686,8 @@ const contractDownload = ()=> {
alert('請輸入免費保養月數'); alert('請輸入免費保養月數');
return; return;
} }
if(this.installfill1 < 45){ if(this.installfill1 < 10){
alert('安裝試車期限不得低於45日'); alert('安裝試車期限不得低於10日');
return; return;
} }
if(this.installfill1 < 1){ if(this.installfill1 < 1){
@ -1305,11 +1305,11 @@ const contractNewApply = ()=>{
if(res.status === 201){ if(res.status === 201){
alert('暫存成功'); alert('暫存成功');
console.log(res.data); console.log(res.data);
// window.location.reload(); window.location.reload();
}else if(res.status === 200){ }else if(res.status === 200){
alert('更新成功'); alert('更新成功');
console.log(res.data); console.log(res.data);
// window.location.reload(); window.location.reload();
} }
this.isLoading = false this.isLoading = false
}).catch(error=>{ }).catch(error=>{

6
wms/contract/prviewPdf.php

@ -2,7 +2,7 @@
include "../header.php"; include "../header.php";
require_once('./conn.php'); require_once('./conn.php');
if($_POST['list']){ if($_POST['list']){
$contract_id = $_GET['id']; $contract_id = $_POST['contract_apply_id'];
if($_POST['prviewType'] == 1){ if($_POST['prviewType'] == 1){
$isStand = ($_POST['buystandard']=="true") ? 1 : 0; $isStand = ($_POST['buystandard']=="true") ? 1 : 0;
}else{ }else{
@ -51,7 +51,6 @@ if($_POST['list']){
window.history.back(); window.history.back();
</script>"; </script>";
} }
$sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL"; $sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL";
$stmt = $conn->prepare($sql_str); $stmt = $conn->prepare($sql_str);
$stmt->bindParam(':contract_id', $contract_id); $stmt->bindParam(':contract_id', $contract_id);
@ -164,7 +163,6 @@ if($_POST['list']){
background-color: #40C474; background-color: #40C474;
} }
</style> </style>
<div>123132132132</div>
<div class="container" x-data="{ <div class="container" x-data="{
css:'', css:'',
@ -625,7 +623,7 @@ if($_POST['list']){
const btn =document.getElementById('btn') const btn =document.getElementById('btn')
console.log(<?php echo $contract_id; ?>);
</script> </script>
<?php <?php
}else{ }else{

Loading…
Cancel
Save