| Server IP : 104.21.37.246 / Your IP : 172.71.28.145 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/ilawasia.onnud20.com/themes/ |
Upload File : |
<input type="hidden" id="page-menu-id" name="" value="#menu_customer" />
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Case > Quotation List</h1>
</div>
<?php if(@$_SESSION['Success']!=''){ ?>
<div class="alert alert-success">
<?php echo @$_SESSION['Success']; ?>
</div>
<?php } ?>
<form action="#" method="get">
<div class="row align-items-end">
<div class="col-md-4 mb-3">
<label for="" class="form-label">Quotation No.:</label>
<input class="form-control" name="QuotationNumber" value="<?php echo @$_GET['AttachmentNumber']; ?>" />
</div>
<div class="col-md-4 mb-3">
<label for="" class="form-label">Customer:</label>
<input type="text" class="form-control" id="customer-filter" name="CustomerName" value="<?php echo @$_GET['DocumentName']; ?>" autocomplete="off" />
<input type="hidden" value="<?php echo (@$_POST['CustomerId'] > 0)?'CustomerId':''; ?>" name="CustomerId" id="hd-customer-id" />
</div>
<div class="col-md-4 mb-3">
<button class="btn btn-success"><i class="fa fa-search"></i> Search</button>
</div>
</div>
</form>
<p><a class="btn btn-danger" href="create.php"><i class="fas fa-plus-square"></i> เพิ่มรายการ</a></p>
<div id="quotation_pagination" style="position:relative;">
<div class="table-loader text-center" style="display:none;">
<div class="overlay">
<i class="fas fa-3x fa-spinner fa-pulse"></i>
</div>
</div>
<table class="table table-hover table-bordered ">
<thead>
<tr>
<th><a href="javascript:;" onclick="sortTable('#quotation_pagination',this,'loadQuotationList')" data-by="QuotationNo" data-direction="" class="order sorting">Quotation No.</a></th>
<th><a href="javascript:;" onclick="sortTable('#quotation_pagination',this,'loadQuotationList')" data-by="CustomerCode" data-direction="" class="order sorting">Customer No.</a></th>
<th><a href="javascript:;" onclick="sortTable('#quotation_pagination',this,'loadQuotationList')" data-by="CustomerName" data-direction="" class="order sorting">Customer Name</a></th>
<th>Contact Person</th>
<th>Country</th>
<th>Status</th>
<th>Budget/Paid</th>
<th style="width:173px;">-</th>
</tr>
</thead>
<tbody>
<?php
$name_table_quotation = "(
SELECT q.*,c.NamesName as CustomerName,c.NamesCode as CustomerCode
,(SELECT CountryName FROM ct_country WHERE CountryId=q.CountryId) as Country
,CASE WHEN q.Status = 1 THEN 'Draft' ELSE 'Approved' END as StatusText
,(SELECT SUM(Amount) FROM ct_quotation_item WHERE QuotationId = q.QuotationId) as Amount
,c.PostalAddress as Address,ct.Department
,(SELECT COUNT(*) FROM ct_case WHERE QuotationId = q.QuotationId) + (SELECT COUNT(*) FROM ct_case_quotation WHERE QuotationId = q.QuotationId) as IsEdit
FROM ct_quotation q
INNER JOIN t_names_mas c ON q.CustomerId=c.NamesId
INNER JOIN ct_master_case_type ct ON ct.CaseTypeId = q.CaseTypeId
) A
";
$secrch_quotation = "1=1 AND Deleted = 0";
if(@$_GET['QuotationNumber']!=''){$secrch_quotation =$secrch_quotation." AND QuotationNo LIKE '".$_GET['QuotationNumber']."'";}
if(@$_GET['CustomerName']!=''){$secrch_quotation =$secrch_quotation." AND CustomerName LIKE '".$_GET['CustomerName']."'";}
if(@$_GET['CustomerId']>0){$secrch_quotation =$secrch_quotation." AND CustomerName LIKE AND CustomerId = '".$_GET['CustomerId']."'";}
$max_rows = 15; // แสดงจำนวนแถวต่อหน้า
if(isset($_SESSION['max_number'])){$max_rows = $_SESSION['max_number'];}
$page_number = 0;
if(isset($_GET['page_number'])){$page_number = $_GET['page_number'];}
$list_count = array('table'=>$name_table_quotation,'where'=>$secrch_quotation); //,'order' => 'ORDER BY `QuotationId` DESC '
$start_count = $page_number * $max_rows;
$view_count = $view_db->view($list_count);
$result_count = $view_db->q_re($view_count);
$respons_count = $view_db->q_nr($result_count);
$respons_count_num = mysqli_num_rows($result_count);
$respons_pages = ceil($respons_count/$max_rows)-1;
//print_r($view_count);
$list_quotation = array('table'=>$name_table_quotation,'where'=>$secrch_quotation, 'limit'=> "$start_count,$max_rows",'order'=>"ORDER BY `QuotationId` DESC");
$view_list_quotation = $view_db->view($list_quotation);
$result_list_quotation_count = $view_db->q_re($view_list_quotation);
//print_r($view_list_quotation);
while($row_list_quotation = $view_db->q_ro($result_list_quotation_count))
{
?>
<tr>
<td><?php echo $row_list_quotation['QuotationNo']; ?></td>
<td><?php echo $row_list_quotation['CustomerCode']; ?></td>
<td><?php echo $row_list_quotation['CustomerName']; ?></td>
<td><?php echo $row_list_quotation['ContactPerson']; ?></td>
<td><?php echo $row_list_quotation['Country']; ?></td>
<td><?php echo $row_list_quotation['StatusText']; ?></td>
<td><?php echo number_format($row_list_quotation['Amount'],2)."/".number_format($row_list_quotation['PaidAmount'],2); ?></td>
<td>
<a href="edit.php?Type=Edit&id=<?php echo $row_list_quotation['QuotationId']; ?>" class="btn btn-info btn-sm" value="<?php echo $row_list_quotation['QuotationId']; ?>">
<i class="fa fa-search"></i>View
</a>
<?php if($row_list_quotation['IsEdit']==0){ ?>
<a href="javascript:;" class="btn btn-danger btn-sm" onclick="deleteQuotation(' + value.QuotationId + ')" >
<i class="fa fa-trash"></i>Delete
</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<br /><br />
<div class="supplierPager">
<div class="row align-items-center">
<div class="col-md-6">
<input type="hidden" class="page" value="" />
<input type="hidden" class="page-size" value="" />
<input type="hidden" class="numrows" value="0" />
<input type="hidden" class="orderBy" value="" />
<input type="hidden" class="orderDirection" value="" />
<input type="hidden" class="params" value="" />
แสดงรายการ <span class="start-record">
<?php echo $start_count+1; ?></span> ถึง
<span class="end-record"><?php echo ($page_number == $respons_pages)?$respons_count:$start_count+$max_rows; ?></span>
จากทั้งหมด <span class="total-record"><?php echo @$respons_count_num; ?></span> รายการ
</div>
<div class="col-md-6 text-right pagination-zone">
<ul class="pagination justify-content-end mb-0">
<?php
if($respons_pages >= 7)
{
$n = $page_number-1;
if($n < 0){$n = 0;}
?>
<li class="page-item <?php if($page_number == 0){?>disabled<?php }?>">
<a href="<?php echo $url; ?>?page_number=<?php echo '0' ?><?php echo $get; ?>" class="page-link">
<i class="fas fa-angle-double-left"></i>
</a>
<span class="sr-only">First</span>
</li>
<?php } ?>
<li class="page-item <?php if($page_number == 0){?>disabled<?php }?>">
<a href="<?php echo $url; ?>?page_number=<?php echo $page_number-1 ?><?php echo $get; ?>" class="page-link">
<i class="fas fa-angle-left"></i>
</a>
<span class="sr-only">Previous</span>
</li>
<?php
if($respons_pages >= 7)
{
$p_end = $respons_pages - 3;
if($page_number > 3 && $page_number < $p_end)
{
$lop_p = $page_number+3;
$start_p = $page_number-3;
}elseif($page_number >= $p_end ){
$lop_p = $respons_pages-0;
$start_p = $p_end-3;
}
else{
if($page_number < 4){
$start_p = 0;
$lop_p = 7;
}else{
$start_p = $page_number-3;
$lop_p = $page_number+3;
}
}
}else{
$lop_p = $respons_pages - 1;
$start_p = 0;
}
for($a=$start_p;$a<=$lop_p;++$a)
{
$b = $a + 1 ;
?>
<li class="page-item <?php if($page_number == $a){?>active<?php }?>">
<a href="<?php echo $url; ?>?page_number=<?php echo $a?><?php echo $get; ?>" class="page-link">
<?php echo $b; ?>
<span class="sr-only">page</span>
</a>
</li>
<?php
}
if($respons_pages >= 7)
{
$p = $page_number+1;
if($p >= $respons_pages){$p = $respons_pages;}
?>
<li class="page-item <?php if($page_number == $respons_pages){?>disabled<?php }?>">
<a href="<?php echo $url; ?>?page_number=<?php echo $page_number+1; ?><?php echo $get; ?>" class="page-link">
<i class="fas fa-angle-right"></i>
<span class="sr-only">Next</span>
</a>
</li>
<?php
}if($respons_pages > 0){
?>
<li class="page-item <?php if($page_number == $respons_pages){?>disabled<?php }?>">
<a href="<?php echo $url; ?>?page_number=<?php echo $respons_pages?><?php echo $get; ?>" class="page-link">
<i class="fas fa-angle-double-right"></i>
<span class="sr-only">Last</span>
</a>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
<?php unset($_SESSION['Success']); ?>