149 lines
4.1 KiB
PHP
149 lines
4.1 KiB
PHP
<?php include('top.php');?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(function() {
|
|
$("#flex1").flexigrid({
|
|
url: 'item_stock_list_script.php',
|
|
dataType: 'json',
|
|
colModel : [
|
|
{display: 'Sr', name : 'count', width : 20, sortable : false, align: 'left'},
|
|
{display: 'Warehouse', name : 'warehouse', width : 100, sortable : true, align: 'left'},
|
|
{display: 'Item Code', name : 'itemCode', width : 160, sortable : true, align: 'left'},
|
|
{display: 'Item Desc', name : 'itemdesc', width : 350, sortable : false, align: 'left'},
|
|
{display: 'Inven Qty', name : 'avail_qty', width : 50, sortable : false, align: 'left'},
|
|
{display: 'AvailQty', name : 'avail_qty', width : 50, sortable : false, align: 'left'},
|
|
|
|
],
|
|
buttons : [
|
|
|
|
],
|
|
searchitems : [
|
|
{display: 'Item Code', name : 'itemCode', isdefault: true},
|
|
{display: 'Item Desc', name : 'itemDesc'},
|
|
{display: 'Warehouse', name : 'warehouse'},
|
|
|
|
],
|
|
sortname: "warehouse_id",
|
|
sortorder: "asc",
|
|
usepager: true,//pagination
|
|
title: "Item Stock",
|
|
useRp: true,
|
|
rp: 50,//records per page
|
|
showTableToggleBtn: false,//toggle button for the whole table
|
|
resizable: false,
|
|
width: window.innerWidth,
|
|
height: window.innerHeight-130,
|
|
singleSelect: true
|
|
});
|
|
});
|
|
|
|
function doCommand(com, grid) {
|
|
if (com == 'Add') {
|
|
location.href="";
|
|
}
|
|
if (com == 'Print') {
|
|
|
|
}
|
|
if (com == 'Edit') {
|
|
$('.trSelected', grid).each(function() {
|
|
var id = $(this).attr('id');
|
|
id = id.substring(id.lastIndexOf('row')+3);
|
|
alert("Edit row " + id);
|
|
});
|
|
location.href="store_item.php?acn=update";
|
|
|
|
} else if (com == 'Delete') {
|
|
$('.trSelected', grid).each(function() {
|
|
var id = $(this).attr('id');
|
|
alert((this));
|
|
alert(id);
|
|
id = id.substring(id.lastIndexOf('row')+3);
|
|
alert("Delete row " + id);
|
|
});
|
|
}
|
|
}
|
|
|
|
function delete_menu(button, grid) {
|
|
var total_count = $('.trSelected', grid).length;
|
|
var deleted = 0;
|
|
|
|
$.each($('.trSelected', grid), function() {
|
|
var id = $('td:nth-child(1) div', this).html();
|
|
$.ajax({
|
|
url: '/api/book/' + id,
|
|
type: 'DELETE',
|
|
data: {},
|
|
dataType: 'json',
|
|
success: function() {
|
|
deleted++;
|
|
if (deleted == total_count) {
|
|
$('#books_grid').flexReload();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
function add_menu(button, grid) {
|
|
var form_div = $('#book_form');
|
|
|
|
form_div.load('/ajax/book_form_add', null, function() {
|
|
$('#book_form form').ajaxForm({
|
|
url: '/ajax/book_form_add',
|
|
success: function() {
|
|
form_div.hide();
|
|
$('#books_grid').flexReload();
|
|
}
|
|
});
|
|
form_div.show();
|
|
});
|
|
}
|
|
|
|
function edit_menu(button, grid) {
|
|
var id = $('.trSelected td:nth-child(1) div', grid).html();
|
|
var form_div = $('#book_form');
|
|
var url = '/ajax/book_form_edit/' + id;
|
|
|
|
form_div.load(url, null, function() {
|
|
$('#book_form form').ajaxForm({
|
|
url: url,
|
|
success: function() {
|
|
form_div.hide();
|
|
$('#books_grid').flexReload();
|
|
}
|
|
});
|
|
form_div.show();
|
|
});
|
|
}
|
|
|
|
</script>
|
|
|
|
<tr>
|
|
|
|
<td height="450" valign="top" align="center">
|
|
<table width="800px" border="0" cellspacing="0" cellpadding="0"
|
|
align="center">
|
|
<tr height="3px"></tr>
|
|
<tr>
|
|
<td align="justify">
|
|
<form name="f1" method="post" action="<?php echo $this_script?>">
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="4"
|
|
id="flex1">
|
|
</table>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|