You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
313 lines
13 KiB
313 lines
13 KiB
<?php
|
|
include "header.php";
|
|
|
|
$category_arr = ["A" => "生產設備", "B" => "建築工程類", "C" => "工業工程規劃", "D" => "修繕維保服務", "E" => "儀器設備", "F" => "辦公設備", "G" => "辦公家具", "H" => "IT類產品", "I" => "諮詢服務", "J" => "維保電梯配件"];
|
|
|
|
$sql = "select max(bargainno) as maxno from bargain";
|
|
$res = mysqli_query($link, $sql);
|
|
$row = mysqli_fetch_row($res);
|
|
$bargainno = $row[0] ? $row[0]+1 : date("Ym")."001";
|
|
|
|
$sql = "select department_id from account where accountid = '$user_id'";
|
|
$res = mysqli_query($link, $sql);
|
|
$row = mysqli_fetch_row($res);
|
|
list($department_id) = $row;
|
|
mysqli_free_result($res);
|
|
|
|
$department_arr = [];
|
|
$sql = "select department_id, name from department";
|
|
$res = mysqli_query($link, $sql);
|
|
while ($row = mysqli_fetch_row($res)) {
|
|
$department_arr[$row[0]] = $row[1];
|
|
}
|
|
mysqli_free_result($res);
|
|
?>
|
|
<style>
|
|
|
|
</style>
|
|
<script>
|
|
function commafy(num) {
|
|
num = num + "";
|
|
var re = /(-?\d+)(\d{3})/
|
|
while (re.test(num)) {
|
|
num = num.replace(re, "$1,$2")
|
|
}
|
|
return num;
|
|
}
|
|
|
|
$(function(){
|
|
$('#quantity').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); })
|
|
$('#lead_time').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); })
|
|
$('#margin_day').keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); })
|
|
$("input[name=quote_amt_be]").each(function(){
|
|
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); });
|
|
});
|
|
$("input[name=quote_amt_ar]").each(function(){
|
|
$(this).keyup(function(){ $(this).val($(this).val().replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); });
|
|
});
|
|
$('#btnadd').click(function(){
|
|
$('#tb1 tr:last').prev().after($("tr[name='supplier_templ']").eq(0).clone().find('input').val('').end());
|
|
$('#tb1 tr:last').prev().find('td').first().html($("tr[name='supplier_templ']").length);
|
|
});
|
|
$('#submit').click(function(){
|
|
var supIdArr = [];
|
|
$("input[name='sup_id']").each(function(){ supIdArr.push($(this).val()); })
|
|
$('#sup_id_all').val(supIdArr);
|
|
var supplierArr = [];
|
|
$("input[name='supplier']").each(function(){ supplierArr.push($(this).val()); })
|
|
$('#supplier_all').val(supplierArr);
|
|
var quoteAmtBeArr = [];
|
|
$("input[name='quote_amt_be']").each(function(){ quoteAmtBeArr.push($(this).val().replace(/[,]+/g,"")); })
|
|
$('#quote_amt_be_all').val(quoteAmtBeArr);
|
|
var noteBeArr = [];
|
|
$("input[name='note_be']").each(function(){ noteBeArr.push($(this).val()); })
|
|
$('#note_be_all').val(noteBeArr);
|
|
var quoteAmtArArr = [];
|
|
$("input[name='quote_amt_ar']").each(function(){ quoteAmtArArr.push($(this).val().replace(/[,]+/g,"")); })
|
|
$('#quote_amt_ar_all').val(quoteAmtArArr);
|
|
var noteArArr = [];
|
|
$("input[name='note_ar']").each(function(){ noteArArr.push($(this).val()); })
|
|
$('#note_ar_all').val(noteArArr);
|
|
//console.log(itemNameArr);
|
|
//return false;
|
|
});
|
|
});
|
|
</script>
|
|
<div class="container">
|
|
<?php
|
|
include "bargain-record-submit.php";
|
|
/*
|
|
if($_SERVER["REQUEST_METHOD"] == "POST"){
|
|
if(empty($_POST["id"]) && empty($_POST["expert_id"]) && empty($_POST["personal_id"])){
|
|
echo "<p class='error'>Please fill up the required field!</p>";
|
|
} else {
|
|
echo "<p class='success'>Record has added successfully</p>";
|
|
}
|
|
}
|
|
*/
|
|
?>
|
|
|
|
<form class="form-inline" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" enctype="multipart/form-data">
|
|
<div>
|
|
<label for="bargainno">申請單號</label>
|
|
<input type="text" name="bargainno" id="bargainno" value="<?php echo $bargainno; ?>" readonly>
|
|
</div>
|
|
<div>
|
|
<label for="department">作成單位</label>
|
|
<input type="text" name="department" id="department" value="<?php echo $department_arr[$department_id]; ?>" readonly>
|
|
<input type="hidden" name="department_id" id="department_id" value="<?php echo $department_id; ?>">
|
|
</div>
|
|
<div>
|
|
<label for="proposer">作成者</label>
|
|
<input type="text" name="proposer" id="proposer" value="<?php echo $user_name; ?>" readonly>
|
|
</div>
|
|
<div>
|
|
<label for="receiver">收文單位</label>
|
|
<select name="receiver" id="receiver" required>
|
|
<option value="">請選擇</option>
|
|
<?php
|
|
foreach ($department_arr as $k => $v) {
|
|
echo "<option value=\"".$k."\">".$v."</option>";
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="response_dt">回答期限</label><br>
|
|
<input type="date" name="response_dt" id="response_dt" required>
|
|
</div>
|
|
<div>
|
|
<label for="item">項目名稱</label>
|
|
<input type="text" name="item" id="item" size="60" maxlength="50" required>
|
|
</div>
|
|
<div>
|
|
<label for="annual">年度議價件</label>
|
|
<select name="annual" id="annual">
|
|
<option value="Y">是</option>
|
|
<option value="N">否</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="urgent">緊急件</label>
|
|
<select name="urgent" id="urgent">
|
|
<option value="Y">是</option>
|
|
<option value="N">否</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="vendor">指定廠商</label>
|
|
<select name="vendor" id="vendor">
|
|
<option value="Y">是</option>
|
|
<option value="N">否</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="prospecting">現場勘查</label>
|
|
<select name="prospecting" id="prospecting">
|
|
<option value="Y">是</option>
|
|
<option value="N">否</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="category">類別</label>
|
|
<select name="category" id="category" required>
|
|
<option value="">請選擇</option>
|
|
<?php
|
|
foreach ($category_arr as $k => $v) {
|
|
echo "<option value=\"".$k."\">".$v."</option>";
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="dealer">原廠或原代理商</label>
|
|
<select name="dealer" id="dealer" required>
|
|
<option value="Y">是</option>
|
|
<option value="N">否</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="reason">理由</label>
|
|
<input type="text" name="reason" id="reason" size="60" maxlength="50">
|
|
</div>
|
|
<div>
|
|
<label for="brand">品牌</label>
|
|
<input type="text" name="brand" id="brand" maxlength="25">
|
|
</div>
|
|
<div>
|
|
<label for="model">型號</label>
|
|
<input type="text" name="model" id="model" maxlength="25">
|
|
</div>
|
|
<div>
|
|
<label for="quantity">預估數量</label>
|
|
<input type="text" name="quantity" id="quantity" required>
|
|
</div>
|
|
<div>
|
|
<label for="brandkeep">備選品牌</label>
|
|
<input type="text" name="brandkeep" id="brandkeep" size="60" maxlength="25">
|
|
</div>
|
|
<div>
|
|
<label for="lead_time">交期/施工期(天)</label>
|
|
<input type="text" name="lead_time" id="lead_time">
|
|
</div>
|
|
<div>
|
|
<label for="margin">質保金</label>
|
|
<select name="margin" id="margin">
|
|
<option value="Y">是</option>
|
|
<option value="N">否</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="margin_day">質保期限(天)</label>
|
|
<input type="text" name="margin_day" id="margin_day" required>
|
|
</div>
|
|
<div>
|
|
<label for="acceptance">驗收標準</label>
|
|
<input type="text" name="acceptance" id="acceptance" size="104" maxlength="50">
|
|
</div>
|
|
<div>
|
|
<label for="purchase_history">歷史購買記錄</label>
|
|
<select name="purchase_history" id="purchase_history">
|
|
<option value="Y">是</option>
|
|
<option value="N">否</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="attatch1">附件1</label>
|
|
<div>
|
|
<input type="file" name="attatch1" id="attatch1">
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label for="attatch2">附件2</label>
|
|
<div>
|
|
<input type="file" name="attatch2" id="attatch2">
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label for="item_description">項目描述</label>
|
|
<input type="text" name="item_description" id="item_description" size="80" maxlength="120">
|
|
</div>
|
|
<div>
|
|
<label for="repairno">設備維修單號</label>
|
|
<input type="text" name="repairno" id="repairno" maxlength="20">
|
|
</div>
|
|
<div>
|
|
<label for="category_repair">類別</label>
|
|
<select name="category_repair" id="category_repair" required>
|
|
<option value="">請選擇</option>
|
|
<?php
|
|
foreach ($category_arr as $k => $v) {
|
|
echo "<option value=\"".$k."\">".$v."</option>";
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="content">內容</label><br>
|
|
<textarea class="form-control2" name="content" id="content" rows="4" cols="100"></textarea>
|
|
</div>
|
|
<div>
|
|
<label for="quotation">採購報價單</label>
|
|
<input type="text" name="quotation" id="quotation" readonly>
|
|
</div>
|
|
|
|
<div class="table-responsive" style="width:100%;margin-top:10px;">
|
|
<table id="tb1" class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="8"><h4>附件上傳及信息維護</h4></th>
|
|
</tr>
|
|
<tr>
|
|
<th rowspan="2" nowrap>序號</th>
|
|
<th colspan="4">作成單位提供◎維護信息</th>
|
|
<th colspan="3">配合單位提供◎維護信息</th>
|
|
</tr>
|
|
<tr>
|
|
<th nowrap>供應商名稱</th>
|
|
<th nowrap>供應商報價單上傳</th>
|
|
<th nowrap>報價</th>
|
|
<th nowrap>備註</th>
|
|
<th nowrap>議價後報價單上傳</th>
|
|
<th nowrap>議價後報價</th>
|
|
<th nowrap>備註</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr name="supplier_templ">
|
|
<td>1</td>
|
|
<td><input type="text" name="supplier" class="form-control input-sm" size="10"></td>
|
|
<td><input type="file" name="supplier_attatch_be[]" multiple></td>
|
|
<td><input type="text" name="quote_amt_be" class="form-control input-sm" size="3"></td>
|
|
<td><input type="text" name="note_be" class="form-control input-sm" size="10"></td>
|
|
<td><input type="file" name="supplier_attatch_ar[]" multiple></td>
|
|
<td><input type="text" name="quote_amt_ar" class="form-control input-sm" size="3"></td>
|
|
<td><input type="text" name="note_ar" class="form-control input-sm" size="10"><input type="hidden" name="sup_id"></td>
|
|
</tr>
|
|
<td colspan="8"><button type="button" id="btnadd" class="btn btn-primary btn-sm" style="float:left;">+供應商</button></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<div>
|
|
<!-- <label for="create_at">create_at</label> -->
|
|
<input type="hidden" name="create_at" id="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>">
|
|
<p class="error"><?php echo $create_at_error; ?></p>
|
|
</div>
|
|
<div>
|
|
<br>
|
|
<button type="submit" name="submit" id="submit">確定</button>
|
|
</div>
|
|
<input type="hidden" name="sup_id_all" id="sup_id_all">
|
|
<input type="hidden" name="supplier_all" id="supplier_all">
|
|
<input type="hidden" name="quote_amt_be_all" id="quote_amt_be_all">
|
|
<input type="hidden" name="note_be_all" id="note_be_all">
|
|
<input type="hidden" name="quote_amt_ar_all" id="quote_amt_ar_all">
|
|
<input type="hidden" name="note_ar_all" id="note_ar_all">
|
|
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
|
</form>
|
|
</div>
|
|
|
|
<?php include "footer.php"; ?>
|