103 lines
3.1 KiB
PHP
103 lines
3.1 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/auth/auth.php');
|
|
|
|
include_once('access.php');
|
|
//include('configuration.php');
|
|
|
|
?>
|
|
<?php
|
|
|
|
|
|
$page = 1; // The current page
|
|
$sortname = 'drawing_details'; // Sort column
|
|
$sortorder = 'asc'; // Sort order
|
|
$qtype = ''; // Search column
|
|
|
|
$query = ''; // Search string
|
|
// Get posted data
|
|
if (isset($_POST['page'])) {
|
|
$page = mysqli_real_escape_string($conn,$_POST['page']);
|
|
}
|
|
if (isset($_POST['sortname'])) {
|
|
$sortname = mysqli_real_escape_string($conn,$_POST['sortname']);
|
|
}
|
|
if (isset($_POST['sortorder'])) {
|
|
$sortorder = mysqli_real_escape_string($conn,$_POST['sortorder']);
|
|
}
|
|
if (isset($_POST['qtype'])) {
|
|
$qtype = mysqli_real_escape_string($conn,$_POST['qtype']);
|
|
}
|
|
if (isset($_POST['query'])) {
|
|
$query = mysqli_real_escape_string($conn,$_POST['query']);
|
|
}
|
|
if (isset($_POST['rp'])) {
|
|
$rp = mysqli_real_escape_string($conn,$_POST['rp']);
|
|
}
|
|
// Setup sort and search SQL using posted data
|
|
$sortSql = "order by $sortname $sortorder";
|
|
$searchSql = ($qtype != '' && $query != '') ? " where $qtype = '$query'" : '';
|
|
if($searchSql!=''){
|
|
if($qtype=='remarks'){
|
|
$searchSql=" where remarks like '%$query%' ";
|
|
// due_date between str_to_date('".$date_from."','%d/%m/%Y') and str_to_date('".$date_to."','%d/%m/%Y')
|
|
}
|
|
else if($qtype=='drawing_details')
|
|
{
|
|
$searchSql=" where drawing_details like '%$query%' ";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
// Get total count of records
|
|
$sql = "select count(*) from vender_tbl_po_code $searchSql";
|
|
$result = mysqli_query($conn,$sql);
|
|
$row = mysqli_fetch_array($result);
|
|
$total = $row[0];
|
|
// Setup paging SQL
|
|
if(!isSet($rp)){
|
|
$rp=25;
|
|
}
|
|
$pageStart = ($page-1)*$rp;
|
|
$limitSql = "limit $pageStart, $rp";
|
|
// Return JSON data
|
|
$data = array();
|
|
$data['page'] = $page;
|
|
$data['total'] = $total;
|
|
$data['rows'] = array();
|
|
$sql = "SELECT a.drawing_id,a.drawing_details,a.remarks,a.unit_id,a.item_basic_rate,a.last_modified FROM vender_tbl_po_code a $searchSql $sortSql $limitSql";
|
|
$results = @mysqli_query($conn,$sql);
|
|
$count=1;
|
|
//echo "data : $sql<br>";
|
|
while ($row = @mysqli_fetch_assoc($results)) {
|
|
|
|
$codeId=$row['drawing_id'];
|
|
$itemCode=$row['drawing_details'];
|
|
$description=$row['remarks'];
|
|
$unitName = "";
|
|
if($row['unit_id'] != null){
|
|
$unitName=getUnitName($row['unit_id']);
|
|
}
|
|
else{
|
|
$unitName = "";
|
|
}
|
|
|
|
$basicRate = $row['item_basic_rate'];
|
|
$lastModified=$row['last_modified'];
|
|
|
|
|
|
//$view_link="<a href='#' onclick=\"window.open('rate_master.php?acn=view&rate_id=$rate_id','mywindow','menubar=0,resizable=0,status=0,scrollbars=1,width=450,height=290,top=150,left=450')\"><img src='images/view.jpg' border=\"0\" /></a>";
|
|
//$edit_link="<a href='#' onclick=\"window.open('rate_master.php?acn=update&rate_id=$rate_id','mywindow','menubar=0,resizable=0,status=0,scrollbars=1,width=450,height=290,top=150,left=450')\"><img src='images/edit.png' border=\"0\" /></a>";
|
|
//$delete_link="<a href='#' onclick=deleterecord('rate_master.php?acn=delete&rate_id=$rate_id')><img src='images/drop.png' border=\"0\" /></a>";
|
|
|
|
|
|
|
|
$data['rows'][] = array(
|
|
'id' => $row['id'],
|
|
'cell' => array($count++, $codeId, $itemCode, $description,$unitName,$basicRate, $lastModified,)
|
|
);
|
|
}
|
|
|
|
echo json_encode($data);
|
|
?>
|