ESH/flexi_wtc.php
2024-10-23 18:28:06 +05:30

168 lines
5.9 KiB
PHP

<title>WTC</title>
<?php
include('top.php');
?>
<script type="text/javascript">
$(function() {
var w=screen.width-25;
$("#flex1").flexigrid({
url: 'flexi_wtc_script.php',
dataType: 'json',
colModel : [
{display: 'Sr', name : 'count', width : w*0.010, sortable : false, align: 'left'},
{display: 'Client', name : 'client', width : w*0.080, sortable : true, align: 'left'},
{display: 'Date', name : 'curr_date', width : w*0.041, sortable : true, align: 'left'},
{display: 'Sales Order No', name : 'po_no', width : w*0.075, sortable : true, align: 'left'},
{display: 'Order File No', name : 'pf_no', width : w*0.060, sortable : true, align: 'left'},
{display: 'PL No', name : 'pf_no', width : w*0.0450, sortable : false, align: 'left'},
{display: 'Item No', name : 'inspected_total', width : w*0.030, sortable : false, align: 'left'},
{display: 'Item', name : 'item_id', width : w*0.0450, sortable : true, align: 'left'},
{display: 'Item Description', name : 'item_desc', width : w*0.180, sortable : true, align: 'left'},
{display: 'Drawing', name : 'drawing_id', width : w*0.0450, sortable : true, align: 'left'},
{display: 'Order Qty', name : 'inspected_total', width : w*0.043, sortable : false, align: 'right'},
{display: 'WTC Qty', name : 'returnqty', width : w*0.043, sortable : false, align: 'right'},
{display: 'Installment No', name : 'id', width : w*0.020, sortable : true, align: 'left'},
//{display: 'Rites Case No', name : 'orderqty', width : w*0.043, sortable : false, align: 'left'},
{display: 'PDF', name : 'print_link', width : w*0.018, sortable : false, align: 'left'},
{display: 'ADD', name : 'view_link', width : w*0.018, sortable : false, align: 'left'}
],
buttons : [
{name:'<b><font size="2">WTC</font></b>'},
//{name: 'Add', bclass: 'add', onpress : doCommand},
{name: 'Print', bclass: 'print_excel', onpress : doCommand},
{separator: true}
],
searchitems : [
{display: 'Tender No', name : 'tender_no', isdefault: true},
{display: 'Quotation No', name : 'internal_ref_no'},
{display: 'Order File No', name : 'pf_no'},
{display: 'Sales Order No', name : 'po_no'},
{display: 'Date (DD/MM/YYYY)', name : 'curr_date'},
{display: 'Date Spread (DD/MM/YYYY, DD/MM/YYYY)', name : 'curr_date_between'},
{display: 'Item', name : 'item_name'},
{display: 'Item Description', name : 'item_desc'},
{display: 'PL No', name : 'pl_no'},
{display: 'Client', name : 'client'},
{display: 'Firm', name : 'firm_code'},
{display: 'Item No', name : 'id'}
],
sortname: "inspection_date",
sortorder: "desc",
usepager: true,//pagination
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="manage_tender_entry.php?acn=add";
}
if (com == 'Print') {
window.open('ajax_pdf.php','Order List');
}
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="menu_master.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="350" valign="top" align="center">
<table width="700px" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="justify">
<form name="f1" method="post" action="<?php echo $this_script?>">
<input type="hidden" name="pdf_action" id="pdf_action" value="excel_pending_rites.php"/>
<table width="100%" border="0" cellspacing="0" cellpadding="4" id="flex1" >
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>