| Server IP : 104.21.37.246 / Your IP : 172.71.28.146 [ 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 : /home/cp648411/www/ilawasia.onnud20.com/themes/ |
Upload File : |
<input type="hidden" id="page-menu-id" name="" value="#menu_case" />
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Case > Case List</h1>
</div>
<?php if($_SESSION['Success']!=''){ //@if (TempData["Success"] != null){ ?>
<div class="alert alert-success">
<?php echo $_SESSION['Success']; //@TempData["Success"] ?>
</div>
<?php } ?>
<?php if($_SESSION['Error']!=''){ //@if (TempData["Error"] != null) ?>
<div class="alert alert-danger">
<?php echo $_SESSION['Error']; //@TempData["Error"] ?>
</div>
<?php } ?>
<form action="index.php" method="get">
<div class="row">
<div class="col-md-1">
Country:
</div>
<div class="col-md-3">
<select class="form-control" name="CountryId" onchange="loadCaseType(this.value)">
<option value="">All Country</option>
<?php
$secrch_country = " Status = 1 ";
$list_country = array('table'=>$name_table10,'where'=>$secrch_country);
$view_country = $view_db->view($list_country);
$result_country = $view_db->q_re($view_country);
?>
<?php while($row_country = $view_db->q_ro($result_country)){ ?>
<option value="<?php echo $row_country['CountryId']; ?>"
<?php echo (@$_GET['CountryId']==@$row_country['CountryId'])?'selected':''; ?>>
<?php echo $row_country['CountryCode']; ?>
</option>
<?php } ?>
</select>
</div>
<div class="col-md-1">
Case Type:
</div>
<div class="col-md-3">
<select class="form-control" name="CaseTypeId" id="ddl_case_type">
<option value="">All Case Type</option>
<?php
$secrch_case_type = " CountryId = '".@$_GET['CountryId']."'";
if(@$_GET['CaseTypeId'] && @$_GET['CountryId']==''){
$secrch_case_type = "1=1";
}
$list_case_type = array('table'=>$name_table14,'where'=>$secrch_case_type);
$view_case_type = $view_db->view($list_case_type);
$result_case_type = $view_db->q_re($view_case_type);
?>
<?php while($row_case_type = $view_db->q_ro($result_case_type)){ ?>
<option value="<?php echo $row_case_type['CaseTypeId']; ?>"
<?php echo (@$_GET['CaseTypeId']==@$row_case_type['CaseTypeId'])?'selected':''; ?>>
<?php echo $row_case_type['CaseTypeName']; ?>
</option>
<?php } ?>
</select>
</div>
<div class="col-md-1">
Case Number:
</div>
<div class="col-md-3">
<input class="form-control" name="CaseNumber" value="<?php echo $_GET['CaseNumber']; ?>" />
</div>
</div>
<div class="row mt-2">
<div class="col-md-1">
Customer:
</div>
<div class="col-md-3">
<?php
$count_customer= "
distinct T2.NamesId as custId,T2.NamesName as custName, T2.NamesCode as custCode,T2.PostalAddress as address,T2.TaxID as taxId
";
$name_table_edit = 't_names_mas T2';
$list_customer = array('table'=>$name_table_edit,'count' => $count_customer,'where'=>" 1=1 AND Deleted = 0");
$view_customer = $view_db->view($list_customer);
$result_customer = $view_db->q_re($view_customer);
//print_r($view_country);
?>
<input type="text" class="form-control" list="datalistOptions" id="customer-filter"
name="CustomerName" value="<?php echo $_GET['CustomerName']; ?>" autocomplete="off" />
<datalist id="datalistOptions">
<?php while($row_customer = $view_db->q_ro($result_customer)){ ?>
<option value="<?php echo $row_customer['custName']; ?>" >
<?php } ?>
</datalist>
<input type="hidden" value="<?php echo $_GET['CustomerName']; ?>" name="CustomerId" id="hd-customer-id" />
</div>
<div class="col-md-1">
Status:
</div>
<div class="col-md-3">
<select class="form-control" name="Status">
<option value="0">All Status</option>
<option value="1" <?php echo $_GET['Status']== 1? "selected" : ""; ?>>Opening</option>
<option value="2" <?php echo $_GET['Status']== 2? "selected" : ""; ?>>Completed</option>
</select>
</div>
<div class="col-md-1">
Person Name:
</div>
<div class="col-md-3">
<input class="form-control" name="PersonName" value="<?php echo $_GET['PersonName']; ?>" />
</div>
</div>
<div class="row mt-2">
<div class="col-md-1">
Due Date
</div>
<div class="col-md-4">
<div class="input-group input-daterange mb-2">
<input type="date" id="due-start-date" class="form-control" name="DueDateStart" value="<?php echo $_GET['DueDateStart']; ?>"
autocomplete="off" onchange="dateSet(this.value,'due-end-date')">
<div class="input-group-text" style="border-radius:0px">to</div>
<input type="date" id="due-end-date" class="form-control" name="DueDateEnd"
value="<?php echo $_GET['DueDateEnd']; ?>" autocomplete="off">
</div>
</div>
<div class="col-md-1">
Event Date
</div>
<div class="col-md-4">
<div class="input-group input-daterange mb-2">
<input type="date" id="event-start-date" class="form-control" name="EventDateStart" value="<?php echo $_GET['EventDateStart']; ?>"
autocomplete="off" onchange="dateSet(this.value,'event-end-date')">
<div class="input-group-text" style="border-radius:0px">to</div>
<input type="date" id="event-end-date" class="form-control" name="EventDateEnd" value="<?php echo $_GET['EventDateEnd']; ?>" autocomplete="off">
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-md-1">Responsibility</div>
<div class="col-md-4">
<input type="text" value="<?php echo $_GET['Responsibility']; ?>" name="Responsibility" class="form-control" />
</div>
</div>
<div class="row col-md-12"> </div>
<div class="row">
<div class="col-md-12 text-right">
<button class="btn btn-success" type="submit"><i class="fa fa-search"></i> Search</button>
</div>
</div>
</form>
<div class="row col-md-12"> </div>
<p>
<a class="btn btn-danger" href="create.php"><i class="fas fa-plus-square"></i> Add Case</a>
<!--<a href="#" id="link_export_excel" target="_blank" class="btn btn-success"><i class="fas fa-file-excel"></i> Export Excel</a>-->
</p>
<div id="case_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('#case_pagination',this,'loadCaseList')" data-by="CaseId" data-direction="" class="order sorting">No.</a></th>
<th><a href="javascript:;" onclick="sortTable('#case_pagination',this,'loadCaseList')" data-by="CaseNumber" data-direction="" class="order sorting">Case Number</a></th>
<th>Due Date</th>
<th>Case Type</th>
<th>Customer Name</th>
<th>Responsibility</th>
<th>Last Event</th>
<th style="width:100px;">-</th>
</tr>
</thead>
<tbody>
<?php
$count_LoadCaseList ="
c.CaseId,c.CaseNumber,'' as DueDate
,(SELECT CaseTypeName FROM ct_master_case_type WHERE CaseTypeId = c.CaseTypeId) as CaseType
,(SELECT NamesName FROM t_names_mas WHERE NamesId = c.CustomerId) as CustomerName
,(SELECT CONCAT(Name, ' ', SurName) FROM t_system_users WHERE Id = c.ResponseId) as Responsibility
,(SELECT UserName FROM t_system_users WHERE Id = c.CreateBy) as Creator
,'' as LastEvent
";
$table_LoadCaseList = " ct_case c ";
$search_LoadCaseList = "1=1 ";
//echo $_GET['Responsibility'];
if($_GET['CaseTypeId']!=''){$search_LoadCaseList = $search_LoadCaseList." AND c.CaseTypeId = '".$_GET['CaseTypeId']."'"; }
if($_GET['CaseNumber']!=''){$search_LoadCaseList = $search_LoadCaseList." AND c.CaseNumber LIKE '".$_GET['CaseNumber']."'"; }
if($_GET['Status']>0){
if($_GET['Status']==1){
$search_LoadCaseList = $search_LoadCaseList." AND (SELECT Count(*) FROM ct_case_event WHERE EventId = 1 AND CaseId=c.CaseId) > 0";
$search_LoadCaseList = $search_LoadCaseList." AND (SELECT Count(*) FROM ct_case_event WHERE EventId = 2 AND CaseId=c.CaseId) = 0";
}
else if($_GET['Status']==2){
$search_LoadCaseList = $search_LoadCaseList." AND (SELECT Count(*) FROM ct_case_event WHERE EventId = 2 AND CaseId=c.CaseId) > 0";
}
}
if($_GET['CustomerId']>0){$search_LoadCaseList = $search_LoadCaseList." AND c.CustomerId = '".$_GET['CustomerId']."'"; }
if($_GET['DueDateStart']!=''&&$_GET['DueDateEnd']!=''){
$search_LoadCaseList = $search_LoadCaseList." AND (SELECT Count(*) FROM ct_case_event WHERE DueDate BETWEEN '".$_GET['DueDateStart']."' AND '".$_GET['DueDateEnd']."' AND CaseId=c.CaseId) > 0";
}
if($_GET['EventDateStart']!=''&&$_GET['EventDateEnd']!=''){
$search_LoadCaseList = $search_LoadCaseList." AND (SELECT Count(*) FROM ct_case_event WHERE (EventDate BETWEEN '".$_GET['EventDateStart']."' AND '".$_GET['EventDateEnd']."') AND CaseId=c.CaseId) > 0";
}
if($_GET['PersonName']!=''){
$search_LoadCaseList = $search_LoadCaseList." AND (SELECT CONCAT(Name, ' ', SurName) as Name FROM t_system_users WHERE Id = c.CreateBy) LIKE '".$_GET['PersonName']."' ";
}
if($_GET['Responsibility']!=''){
$search_LoadCaseList = $search_LoadCaseList." AND (SELECT CONCAT(Name, ' ', SurName) as Name FROM t_system_users WHERE Id = c.ResponseId) LIKE '".$_GET['Responsibility']."'";
}
$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'=>$table_LoadCaseList,'count'=>$count_LoadCaseList,'where'=>$search_LoadCaseList); //,'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;
$sql_LoadCaseList = array("table"=>$table_LoadCaseList,'count'=>$count_LoadCaseList , 'where'=>$search_LoadCaseList, 'limit'=> "$start_count,$max_rows",'order'=>"ORDER BY `CaseId` DESC");
$view_LoadCaseList = $view_db->view($sql_LoadCaseList);
$result_LoadCaseList = $view_db->q_re($view_LoadCaseList);
$count_LoadCaseList = $view_db->q_nr($result_LoadCaseList);
//print_r($view_LoadCaseList);
if($count_LoadCaseList>0){
while($row_LoadCaseList = $view_db->q_ro($result_LoadCaseList))
{
?>
<tr>
<td><?php echo $row_LoadCaseList['CaseId']; ?></td>
<td><?php echo $row_LoadCaseList['CaseNumber']; ?></td>
<td><?php echo $row_LoadCaseList['DueDate']; ?></td>
<td><?php echo $row_LoadCaseList['CaseType']; ?></td>
<td><?php echo $row_LoadCaseList['CustomerName']; ?></td>
<td>
<?php echo $row_LoadCaseList['Responsibility']; ?>
<?php echo ($row_LoadCaseList['Responsibility']!='')?'<br/>' : ''; ?>
<?php echo ($row_LoadCaseList['Creator']!=NULL)?'<span style="color: #2653d4;"><i>(create by: ' .$row_LoadCaseList['Creator']. ')</i></span>' : ''; ?>
</td>
<td><?php echo $row_LoadCaseList['LastEvent']; ?></td>
<td>
<a href="edit.php?Type=Edit&id=<?php echo $row_LoadCaseList['CaseId']; ?>" class="btn btn-info btn-sm"><i class="fa fa-search"></i> View</a>
</td>
</tr>
<?php } ?>
<?php }else{ ?>
<tr><td colspan="8" class="text-center">Not found data</td></tr>
<?php } ?>
</tbody>
</table>
<br /><br />
<div class="supplierPager">
<div class="row">
<div class="col-md-6">
<input type="hidden" class="page" value="@Model.PageNumber" />
<input type="hidden" class="page-size" value="@Model.PageSize" />
<input type="hidden" class="numrows" value="0" />
<input type="hidden" class="orderBy" value="@Model.Request.OrderBy" />
<input type="hidden" class="orderDirection" value="@Model.Request.OrderDirection" />
<input type="hidden" class="params" value="@Model.QueryString" />
แสดงรายการ <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 echo page_news1($page_number,$respons_pages); ?>
</ul>
</div>
</div>
</div>
</div>