85 lines
2.8 KiB
PHP
85 lines
2.8 KiB
PHP
|
<?php
|
||
|
include('includes/config/config.php');
|
||
|
include('includes/auth/auth.php');
|
||
|
|
||
|
?>
|
||
|
<?php
|
||
|
// Connect to mysqli database
|
||
|
|
||
|
$page = 1; // The current page
|
||
|
$sortname = 'warehouse_id'; // 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==''){
|
||
|
|
||
|
$searchSql=" ";
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
$sql="select count(*) from item_stock $searchSql";
|
||
|
|
||
|
$result = mysqli_query($conn,$sql);
|
||
|
$row = mysqli_fetch_array($result);
|
||
|
$total = $row[0];
|
||
|
// Setup paging SQL
|
||
|
$pageStart = ($page-1)*$rp;
|
||
|
$limitSql = "limit $pageStart, $rp";
|
||
|
// Return JSON data
|
||
|
$data = array();
|
||
|
$data['page'] = $page;
|
||
|
$data['total'] = $total;
|
||
|
$data['rows'] = array();
|
||
|
|
||
|
$sql="select warehouse_id, item_code_id,InventoryQty,available_qty from item_stock $searchSql";
|
||
|
$results = mysqli_query($conn,$sql);
|
||
|
$count=1;
|
||
|
while ($row = mysqli_fetch_assoc($results))
|
||
|
{
|
||
|
$warehouse_id=$row['warehouse_id'];
|
||
|
$code_id=$row['item_code_id'];
|
||
|
$avail_qty=$row['available_qty'];
|
||
|
|
||
|
|
||
|
$sqlrslt=@mysqli_query($conn,"select warehouse_name from warehouse_master where ware_id = '".$warehouse_id."'");
|
||
|
$row_warehouse=@mysqli_fetch_array($sqlrslt);
|
||
|
|
||
|
$sql1=@mysqli_query($conn,"select drawing_details,remarks from vender_tbl_po_code where drawing_id='".$code_id."'");
|
||
|
$row1=@mysqli_fetch_array($sql1);
|
||
|
|
||
|
//$view_link="<a href='stock_entry.php?acn=view&firm_id=$firm_id&store_id=$store_id&new_item_code=$new_itemcode'><img src='images/view.jpg' border=\"0\" /></a>";
|
||
|
//$edit_link="<a href='stock_entry.php?acn=update&firm_id=$firm_id&store_id=$store_id&new_item_code=$new_itemcode'><img src='images/edit.png' border=\"0\" /></a>";
|
||
|
// $delete_link="<a href='#' onclick=deleterecord('stock_entry.php?acn=delete&firm_id=$firm_id&store_id=$store_id&new_item_code=$new_itemcode')><img src='images/drop.png' border=\"0\" /></a>";
|
||
|
|
||
|
|
||
|
$data['rows'][] = array('id' => $row[''],'cell' => array($count++,$row_warehouse['warehouse_name'],$row1['drawing_details'],$row1['remarks'],$row['InventoryQty'],$row['available_qty']));
|
||
|
}
|
||
|
|
||
|
echo json_encode($data);
|
||
|
?>
|