3 changed files with 531 additions and 8 deletions
@ -0,0 +1,523 @@ |
|||
<?php |
|||
include "header.php"; |
|||
include "css/view/wipwhole-index.php"; |
|||
// 設置一個空陣列來放資料 |
|||
$data = array(); |
|||
$start_date = empty($_POST['date_start']) ? null : $_POST['date_start']; |
|||
$end_date = empty($_POST['date_end']) ? null : $_POST['date_end']; |
|||
$start_SignDate = empty($_POST['date_Signstart']) ? null : $_POST['date_Signstart']; |
|||
$end_SignDate = empty($_POST['date_Signend']) ? null : $_POST['date_Signend']; |
|||
|
|||
$sql = " |
|||
SELECT |
|||
siam.PersonId, |
|||
cp.PersonName, |
|||
cd.DeptId, |
|||
cd.DeptName, |
|||
cd.LeaderId, |
|||
lcp.PersonName AS LeaderName, |
|||
siam.BizPartnerId, |
|||
cbp.BizPartnerName, |
|||
siamd.RowCode, |
|||
siam.BillNo, |
|||
siamd.ProjectId, |
|||
siamd.CU_EstPayDate, |
|||
siamd.UnTransCheckBLAmtWTax , |
|||
siamd.HadTransCheckBLAmtWTax, |
|||
siamd.OAmountWithTax, |
|||
siamd.CU_MaterialId, |
|||
acb_tmp.BillNo2, |
|||
acb_tmp.RowCode2, |
|||
acb_tmp.checkOAmount, |
|||
asim.BillNo AS BillNo3, |
|||
asim.InvoiceName, |
|||
asim.OAmountWithTax AS InvoiceOAmount, |
|||
asi.InvoiceNo, |
|||
asi.InvoiceTime, |
|||
writeoff.BillDate AS WriteOffDate, |
|||
SUM(arwobd.CurrStandOffOAmount) AS TotalCurrStandOffOAmount |
|||
FROM salIncomeApplyMaster AS siam -- 收入申請單 |
|||
LEFT JOIN salIncomeApplyDetail AS siamd -- 收入申請單明細 |
|||
ON siam.BillNo = siamd.BillNo |
|||
LEFT JOIN comGroupPerson AS cp -- 員工主檔 |
|||
ON siam.PersonId = cp.PersonId |
|||
LEFT JOIN comDepartment AS cd -- 部門主檔 |
|||
ON siam.DeptId = cd.DeptId |
|||
LEFT JOIN comGroupPerson AS lcp |
|||
ON lcp.PersonId= cd.LeaderId |
|||
LEFT JOIN ( |
|||
SELECT |
|||
acbd.FromRowCode, |
|||
acb.FromBillNo, |
|||
acbd.BillNo AS BillNo2, |
|||
acbd.RowCode AS RowCode2, |
|||
acbd.LAmountWithTax AS checkOAmount |
|||
FROM arCheckBill AS acb -- 應收確認單 |
|||
LEFT JOIN arCheckBillDetail AS acbd -- 應收確認單明細 |
|||
ON acb.BillNo = acbd.BillNo |
|||
WHERE 1 = 1 |
|||
AND acb.TypeId = 'RVS') AS acb_tmp |
|||
ON siamd.RowCode = acb_tmp.FromRowCode |
|||
AND siamd.BillNo = acb_tmp.FromBillNo |
|||
LEFT JOIN arSellInvoiceMaterial AS asim -- 買賣發票明細 |
|||
ON asim.FromBillNo = acb_tmp.BillNo2 |
|||
AND asim.RowCode = acb_tmp.RowCode2 |
|||
LEFT JOIN arSellInvoice AS asi |
|||
ON asim.BillNo = asi.BillNo |
|||
LEFT JOIN comBusinessPartner AS cbp |
|||
ON siam.BizPartnerId = cbp.BizPartnerId |
|||
LEFT JOIN |
|||
arWriteOffBillDetail AS arwobd |
|||
ON acb_tmp.BillNo2 = arwobd.FromBillNo |
|||
LEFT JOIN |
|||
arWriteOffBill AS writeoff ON arwobd.BillNo = writeoff.BillNo |
|||
WHERE 1 = 1 |
|||
"; |
|||
$follower = find_follow($user_id); |
|||
if ((in_array($user_id, array('M0008', 'M0012'))) || (in_array(accountidToDepartId($user_id), array('220', '210', '501')))) { |
|||
} else { |
|||
$sql .= " AND (siam.PersonId = '$user_id'"; |
|||
if (count($follower) > 0) { |
|||
$column_str = "('$user_id'" . ",'"; |
|||
$column_str .= implode("','", $follower); |
|||
$column_str .= "')"; |
|||
$sql .= " OR siam.PersonId IN $column_str OR cd.LeaderId = '$user_id')"; |
|||
} else { |
|||
$sql .= " OR cd.LeaderId = '$user_id')"; |
|||
}; |
|||
} |
|||
if (!is_null($start_date)) { |
|||
$start_date = (int)date('Ymd', strtotime($start_date)); |
|||
$sql .= " AND siam.CU_ContractStart >= $start_date "; |
|||
} |
|||
if (!is_null($end_date)) { |
|||
$end_date = (int)date('Ymd', strtotime($end_date)); |
|||
$sql .= " AND siam.CU_ContractStart <= $end_date "; |
|||
} |
|||
if (!is_null($start_SignDate)) { |
|||
$start_SignDate = (int)date('Ymd', strtotime($start_SignDate)); |
|||
$sql .= " AND siam.BillDate >= $start_SignDate "; |
|||
} |
|||
if (!is_null($end_SignDate)) { |
|||
$end_SignDate = (int)date('Ymd', strtotime($end_SignDate)); |
|||
$sql .= " AND siam.BillDate <= $end_SignDate "; |
|||
} |
|||
$sql .= " GROUP BY |
|||
siam.PersonId, |
|||
cp.PersonName, |
|||
cd.DeptId, |
|||
cd.DeptName, |
|||
cd.LeaderId, |
|||
lcp.PersonName, |
|||
siam.BizPartnerId, |
|||
cbp.BizPartnerName, |
|||
siamd.RowCode, |
|||
siam.BillNo, |
|||
siamd.ProjectId, |
|||
siamd.CU_EstPayDate, |
|||
siamd.UnTransCheckBLAmtWTax, |
|||
siamd.HadTransCheckBLAmtWTax, |
|||
siamd.OAmountWithTax, |
|||
siamd.CU_MaterialId, |
|||
acb_tmp.BillNo2, |
|||
acb_tmp.RowCode2, |
|||
acb_tmp.checkOAmount, |
|||
asim.BillNo, |
|||
asim.InvoiceName, |
|||
asim.OAmountWithTax, |
|||
asi.InvoiceNo, |
|||
asi.InvoiceTime, |
|||
writeoff.BillDate |
|||
ORDER BY |
|||
siam.PersonId ASC, |
|||
siam.BillNo ASC, |
|||
siamd.RowCode ASC"; |
|||
|
|||
$query_T8 = $conn->query($sql); |
|||
$rows = $query_T8->fetchAll(PDO::FETCH_ASSOC); |
|||
$today = strtotime(date('Ymt')); |
|||
$table = ""; |
|||
for ($i = 0; $i < count($rows); $i++) { |
|||
$row = $rows[$i]; |
|||
$tmpname = $row['ProjectId'] . $row['RowCode']; |
|||
$data[$tmpname] = $row; |
|||
$data[$tmpname]['CU_EstPayDate'] = date('Y-m-d', strtotime($row['CU_EstPayDate'])); |
|||
$data[$tmpname]['havetopay'] = strtotime($row['CU_EstPayDate']) > $today ? '--' : 'V'; |
|||
$datahavetopay = $row['CU_EstPayDate'] > $today ? 0 : 1; |
|||
$data[$tmpname]['collecttime'] = collect_month(strtotime($row['CU_EstPayDate'])); |
|||
$invoicedate = is_null($row['InvoiceTime']) ? null : date('Y-m-d', strtotime($row['InvoiceTime'])); |
|||
$tableinvoice_state = is_null($invoicedate) ? 0 : 1; |
|||
$contract_no = $row['ProjectId']; |
|||
$facility_no = $row['CU_MaterialId']; |
|||
$RowCode = $row['RowCode']; |
|||
$BillNo = $row['BillNo']; |
|||
$receivable_date = date('Y-m-d', strtotime($row['CU_EstPayDate'])); |
|||
$budget = $row['OAmountWithTax']; |
|||
$invoiceNo = $row['InvoiceNo']; |
|||
$invoice_budget = is_null($row['InvoiceOAmount']) ? 0 : $row['InvoiceOAmount']; |
|||
$table_writeoff_date = is_null($row['WriteOffDate']) ? null : date('Y-m-d', strtotime($row['WriteOffDate'])); |
|||
$table_writeoff_amount = is_null($row['TotalCurrStandOffOAmount']) ? 0 : $row['TotalCurrStandOffOAmount']; |
|||
$table1 = "INSERT INTO account_receivable_maintainance( |
|||
`contract_no`, |
|||
`facility_no`, |
|||
`RowCode`, |
|||
`BillNo`, |
|||
`receivable_date`, |
|||
`budget`, |
|||
`receivable`, |
|||
`invoice_state`, |
|||
`invoice_budget`, |
|||
`received_budget` |
|||
"; |
|||
$table2 = ") VALUES( |
|||
'$contract_no', |
|||
'$facility_no', |
|||
'$RowCode', |
|||
'$BillNo', |
|||
'$receivable_date', |
|||
$budget, |
|||
$datahavetopay, |
|||
$tableinvoice_state, |
|||
$invoice_budget, |
|||
$table_writeoff_amount |
|||
"; |
|||
$table1 .= is_null($invoicedate) ? "" : ",`invoice_date`"; |
|||
$table2 .= is_null($invoicedate) ? "" : ",'$invoicedate'"; |
|||
$table1 .= is_null($table_writeoff_date) ? "" : ",`received_date`"; |
|||
$table2 .= is_null($table_writeoff_date) ? "" : ",'$table_writeoff_date'"; |
|||
$table1 .= is_null($invoiceNo) ? "" : ",`invoice_no`"; |
|||
$table2 .= is_null($invoiceNo) ? "" : ",'$invoiceNo'"; |
|||
$table .= $table1 . $table2 . "); \n"; |
|||
} |
|||
// $file_path = 'account_receivable_maintainance_sql.sql'; |
|||
// if (file_put_contents($file_path, $table) !== false) { |
|||
// echo "SQL文件已成功生成:{$file_path}"; |
|||
// } else { |
|||
// echo "生成SQL文件时出现错误。"; |
|||
// } |
|||
|
|||
// foreach ($data as $key => $row) { |
|||
// echo $key . "<br>"; |
|||
// print_r($row); |
|||
// echo "<br>------------<br>"; |
|||
// } |
|||
// exit(); |
|||
?> |
|||
<style> |
|||
table { |
|||
table-layout: fixed; |
|||
width: 100%; |
|||
} |
|||
|
|||
td { |
|||
word-wrap: break-word; |
|||
} |
|||
|
|||
img { |
|||
width: 125px; |
|||
} |
|||
|
|||
.width_style_1 { |
|||
width: 125px; |
|||
} |
|||
|
|||
table { |
|||
width: 100%; |
|||
} |
|||
|
|||
#table_index_filter { |
|||
float: right; |
|||
} |
|||
|
|||
#table_index_paginate { |
|||
float: right; |
|||
} |
|||
|
|||
label { |
|||
display: inline-flex; |
|||
margin-bottom: .5rem; |
|||
margin-top: .5rem; |
|||
|
|||
} |
|||
|
|||
.hiddenTable { |
|||
display: none; |
|||
} |
|||
|
|||
.hidden { |
|||
display: none; |
|||
} |
|||
</style> |
|||
|
|||
<div style="width: 98%;margin: 1%;"> |
|||
<div class="btn-group btn-group-md " style="padding:10 px; width: 100%;"> |
|||
<button type="button" style="width: 12%;" onclick="downloadData()" class="btn btn-success">下載 <span class="glyphicon glyphicon-download-alt"></span></button> |
|||
</div> |
|||
</div> |
|||
<div class="container"> |
|||
<div class="text-center" style="margin-bottom: 20px;"> |
|||
<h3><strong>應收帳款(保養)</strong></h3> |
|||
</div> |
|||
<hr> |
|||
<form class="form-horizontal" id='myForm' method='post' action='account-receivable-new-index.php?<?= $token_link ?>'> |
|||
<table class="table table-striped table-bordered" style='width:98%;text-align:center;margin:0 auto'> |
|||
<tbody> |
|||
<tr> |
|||
<th class="text-center" style="vertical-align: middle;">簽約日期</th> |
|||
<td colspan="2"> |
|||
<input type="date" class='form-control' id='date_Signstart' name='date_Signstart' style='width:40%;display:inline;'> |
|||
~ |
|||
<input type="date" class='form-control' id='date_Signend' name='date_Signend' style='width:40%;display:inline;'> |
|||
|
|||
</td> |
|||
<td rowspan="2"> |
|||
<button type="submit" class="btn btn-primary btn-sm">搜尋</button> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<th class="text-center" style="vertical-align: middle;">合約日期</th> |
|||
<td colspan="2"> |
|||
<input type="date" class='form-control' id='date_start' name='date_start' style='width:40%;display:inline;'> |
|||
~ |
|||
<input type="date" class='form-control' id='date_end' name='date_end' style='width:40%;display:inline;'> |
|||
<!-- <button type="submit" class="btn btn-primary btn-sm">搜尋</button> --> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<th class="text-center" style="vertical-align: middle;">催收次數</th> |
|||
<td colspan="3"> |
|||
<input type="text" class='form-control' id='search_collectstart' name='collect_time_start' style='width:30%;display:inline;' oninput="searchFront('collectstart')"> |
|||
≤ 催收次數 ≤ |
|||
<input type="text" class='form-control' id='search_collectend' name='collect_time_end' style='width:30%;display:inline;' oninput="searchFront('collectend')"> |
|||
<!-- <button type="submit" class="btn btn-primary btn-sm">搜尋</button> --> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<th class="text-center" style="vertical-align: middle;">催收金額</th> |
|||
<td colspan="3"> |
|||
<input type="text" class='form-control' id='search_CBudgetstart' name='collect_budget_start' style='width:30%;display:inline;' onblur="searchFront('CBudgetstart')"> |
|||
≤ 催收金額 ≤ |
|||
<input type="text" class='form-control' id='search_CBudgetend' name='collect_budget_end' style='width:30%;display:inline;' onblur="searchFront('CBudgetend')"> |
|||
<!-- <button type="submit" class="btn btn-primary btn-sm">搜尋</button> --> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</form> |
|||
<hr> |
|||
<div class="form-group"> |
|||
<div class="col-md-4"> |
|||
<label for="search_contract">查詢合約號</label> |
|||
<input type="text" id="search_contract" name="search_contract" class="form-control" placeholder="請輸入合約號" onblur="searchFront('contract')"> |
|||
</div> |
|||
<div class="col-md-4"> |
|||
<label for="search_dept">查詢部門</label> |
|||
<input type="text" id="search_dept" name="search_dept" class="form-control" placeholder="請輸入部門" onblur="searchFront('dept')"> |
|||
</div> |
|||
<div class="col-md-4"> |
|||
<label for="search_manager">查詢主管</label> |
|||
<input type="text" id="search_manager" name="search_manager" class="form-control" placeholder="請輸入主管工號/姓名" onblur="searchFront('manager')"> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="form-group"> |
|||
|
|||
<div class="col-md-4"> |
|||
<label for="search_personId">查詢契約員</label> |
|||
<input type="text" id="search_personId" name="search_personId" class="form-control" placeholder="請輸入契約員工號/姓名" onblur="searchFront('personId')"> |
|||
</div> |
|||
<div class="col-md-4"> |
|||
<label for="search_customerid">查詢客戶名稱</label> |
|||
<input type="text" id="search_customerid" name="search_customerid" class="form-control" placeholder="請輸入客戶名稱" onblur="searchFront('customerid')"> |
|||
</div> |
|||
<div class="col-md-4"> |
|||
<label for="search_facility">查詢作番號</label> |
|||
<input type="text" id="search_facility" name="search_facility" class="form-control" placeholder="請輸入作番號" onblur="searchFront('facility')"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<?php |
|||
include "./footer.php"; |
|||
?> |
|||
<div style="width: 20%;float:right;margin-right:5%; "> |
|||
<label>查詢條件</label> |
|||
<input type="text" id="search" name="search" class="form-control" placeholder="請輸入合約號/作番號/客戶名稱" oninput="searchData()"> |
|||
</div> |
|||
<div style="width: 98%; margin:1%;" style="overflow-x:auto;"> |
|||
<table class="table table-striped table-bordered" style="width:100%"> |
|||
<thead> |
|||
<tr> |
|||
<th style='text-align:center;vertical-align: middle;width:100px'>合約號</th> |
|||
<th style='text-align:center;vertical-align: middle;'>序號</th> |
|||
<th style='text-align:center;vertical-align: middle;width:100px'>作番號</th> |
|||
<th style='text-align:center;vertical-align: middle;width:110px'>部門</th> |
|||
<th style='text-align:center;vertical-align: middle;'>主管</th> |
|||
<th style='text-align:center;vertical-align: middle;'>契約員</th> |
|||
<th style='text-align:center;vertical-align: middle;width:120px'>客戶名稱</th> |
|||
|
|||
<th style='text-align:center;vertical-align: middle;'>應收日期</th> |
|||
<th style='text-align:center;vertical-align: middle;'>是否應收</th> |
|||
<th style='text-align:center;vertical-align: middle;'>應收金額</th> |
|||
<!-- |
|||
<th style='text-align:end;vertical-align: middle;'>已開金額</th> |
|||
<th style='text-align:end;vertical-align: middle;'>未開金額</th> --> |
|||
<th style='text-align:center;vertical-align: middle;'>已收金額</th> |
|||
<th style='text-align:center;vertical-align: middle;'>催收金額</th> |
|||
<th style='text-align:center;vertical-align: middle;'>催收次數</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php foreach ($data as $key => $row) { ?> |
|||
<tr class="data-row" style="display: '';" id="<?= $key; ?>"> |
|||
<td class="contract"><?= $row['ProjectId']; ?></td> |
|||
<td><?= $row['RowCode']; ?></td> |
|||
<td class="facility"><?= $row['CU_MaterialId']; ?></td> |
|||
<td class="dept"><?= $row['DeptId'] . "<br>" . $row['DeptName']; ?></td> |
|||
<td class="manager"><?= $row['LeaderId'] . "<br>" . $row['LeaderName']; ?></td> |
|||
<td class="personId"><?= $row['PersonId'] . "<br>" . $row['PersonName']; ?></td> |
|||
<td class="customerid"><?= $row['BizPartnerId'] . "<br>" . $row['BizPartnerName']; ?></td> |
|||
|
|||
<td><?= $row['CU_EstPayDate']; ?></td> |
|||
<td><?= $row['havetopay']; ?></td> |
|||
<td><?= number_format(round($row['OAmountWithTax'])); ?></td> |
|||
|
|||
<td><?= is_null($row['TotalCurrStandOffOAmount']) ? 0 : number_format(round($row['TotalCurrStandOffOAmount'])); ?></td> |
|||
<td class="CBudget"><?= ($row['havetopay'] == "V")? (number_format(round($row['OAmountWithTax'] - $row['TotalCurrStandOffOAmount']))) :0; ?></td> |
|||
<td class="collect"><?= (($row['havetopay'] == "V") && ($row['OAmountWithTax'] - $row['TotalCurrStandOffOAmount'] >1))? $row['collecttime']:0; ?></td> |
|||
</tr> |
|||
<?php } ?> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
|
|||
<script> |
|||
function searchData() { |
|||
var searchTerm = document.getElementById('search').value.toLowerCase(); |
|||
var rows = document.getElementsByClassName('data-row'); |
|||
for (var i = 0; i < rows.length; i++) { |
|||
var rowText = rows[i].textContent.toLowerCase(); |
|||
// var rowText = rows[i].id.toLowerCase(); |
|||
if (rowText.includes(searchTerm)) { |
|||
console.log(rowText); |
|||
rows[i].style.display = ''; |
|||
} else { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
} |
|||
} |
|||
|
|||
function downloadData() { |
|||
var xhr = new XMLHttpRequest(); |
|||
var url = window.location.origin + "/wms/account-receivable-renovate-excel.php?type=all&<?= $token_link ?>"; |
|||
xhr.open('POST', url, true); |
|||
xhr.setRequestHeader('Content-Type', 'application/json'); |
|||
xhr.onreadystatechange = function() { |
|||
if (xhr.readyState === 4 && xhr.status === 200) { |
|||
var file_path = xhr.responseText; |
|||
var link = document.createElement('a'); |
|||
var name = "汰改應收帳款" + "<?= date('Y-m-d-Hm') ?>" + ".xlsx"; |
|||
link.setAttribute('href', window.location.origin + "/wms/account-receivable-renovate.xlsx"); |
|||
link.setAttribute('download', name); |
|||
link.style.display = 'none'; |
|||
document.body.appendChild(link); |
|||
link.click(); |
|||
document.body.removeChild(link); |
|||
} |
|||
} |
|||
xhr.send(JSON.stringify({ |
|||
Bill: <?= $total_data ?> |
|||
})); |
|||
|
|||
} |
|||
|
|||
function searchFront(area) { |
|||
var term = 'search_' + area; |
|||
|
|||
if (area == 'collectstart') { |
|||
var searchTerm = parseInt(document.getElementById(term).value); |
|||
var searchArea = document.getElementsByClassName('collect'); |
|||
var rows = document.getElementsByClassName('data-row'); |
|||
var criterion = parseInt(document.getElementById('search_collectend').value); |
|||
for (var i = 0; i < rows.length; i++) { |
|||
var rowText = parseInt(searchArea[i].textContent); |
|||
if (rowText >= searchTerm) { |
|||
rows[i].style.display = ''; |
|||
} else { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
if (criterion !== '' && rowText > criterion) { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
} |
|||
} else if (area == 'collectend') { |
|||
var searchTerm = parseInt(document.getElementById(term).value); |
|||
var searchArea = document.getElementsByClassName('collect'); |
|||
var rows = document.getElementsByClassName('data-row'); |
|||
var criterion = parseInt(document.getElementById('search_collectstart').value); |
|||
for (var i = 0; i < rows.length; i++) { |
|||
var rowText = parseInt(searchArea[i].textContent); |
|||
if (rowText <= searchTerm) { |
|||
rows[i].style.display = ''; |
|||
} else { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
if (criterion !== '' && rowText < criterion) { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
} |
|||
} else if (area == 'CBudgetstart') { |
|||
var searchTerm = parseInt(document.getElementById(term).value); |
|||
var searchArea = document.getElementsByClassName('CBudget'); |
|||
var rows = document.getElementsByClassName('data-row'); |
|||
var criterion = parseInt(document.getElementById('search_CBudgetend').value); |
|||
for (var i = 0; i < rows.length; i++) { |
|||
var rowText = parseInt(searchArea[i].textContent.replace(/,/g, '')); |
|||
if (isNaN(searchTerm) || searchTerm == 0) { |
|||
rows[i].style.display = ''; |
|||
} else if (rowText >= searchTerm) { |
|||
rows[i].style.display = ''; |
|||
} else { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
if (criterion !== '' && rowText > criterion) { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
} |
|||
} else if (area == 'CBudgetend') { |
|||
var searchTerm = parseInt(document.getElementById(term).value); |
|||
var searchArea = document.getElementsByClassName('CBudget'); |
|||
var rows = document.getElementsByClassName('data-row'); |
|||
var criterion = parseInt(document.getElementById('search_CBudgetstart').value); |
|||
for (var i = 0; i < rows.length; i++) { |
|||
var rowText = parseInt(searchArea[i].textContent.replace(/,/g, '')); |
|||
if (isNaN(searchTerm) || searchTerm == 0) { |
|||
rows[i].style.display = ''; |
|||
} else if (rowText <= searchTerm) { |
|||
rows[i].style.display = ''; |
|||
} else { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
if (!isNaN(criterion) && rowText < criterion) { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
} |
|||
} else { |
|||
var searchTerm = document.getElementById(term).value.toLowerCase(); |
|||
var searchArea = document.getElementsByClassName(area); |
|||
var rows = document.getElementsByClassName('data-row'); |
|||
for (var i = 0; i < rows.length; i++) { |
|||
var rowText = searchArea[i].textContent.toLowerCase(); |
|||
if (rowText.includes(searchTerm)) { |
|||
rows[i].style.display = ''; |
|||
} else { |
|||
rows[i].style.display = 'none'; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
function check(searchname) { |
|||
console.log(searchname); |
|||
|
|||
} |
|||
</script> |
Loading…
Reference in new issue