EVOLUTION-NINJA
Edit File: nandi_transaction.php
<style> .cure { width: 75px; } .modal_content_id { width: 246%; margin-left: -410px; } </style> <style> #other_charges_val { font-weight:bold; } </style> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <h3 class="page-title"> Nandi Transaction Details</h3> <?php // echo $this->load->view('templates/nav_menu'); ?> <div class="page-bar"> <ul class="page-breadcrumb"> <li><i class="fa fa-home"></i> <a href="https://swansilk.co/dashboard/dashboard_fun">Home</a> <i class="fa fa-angle-right"></i> <a href="#" >Nandi Transaction Details</a></li> </ul> </div> <form class="form-horizontal"> <input type="button" name="Add Transaction" value="Add Nandi Transaction" onclick="open_model();" /> <br><br> </form> <!-------------- grid data ------------------------------> <input type="hidden" id="refe_ids" name="refe_ids" class="refe_ids" > <div id="table_pending_indent" style="margin-top:20px;"> <div id = "jaytab" class="jaytab"> <table id="list2"></table> <div id="pager2"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> </div> </div> </div> <!-- End BEGIN CONTAINER --> <script src="<?php echo base_url(); ?>assets/js/sweetalert.min.js" type="text/javascript"></script> <!-- <script src="<?php echo base_url('assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> --><link href="<?php echo base_url(); ?>assets/css/sweetalert.min.css" rel="stylesheet" type="text/css" > <!-- <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.css'); ?>" /> --> <!-- The link to the CSS that the grid needs --> <!-- BEGIN FOOTER --> <!------------------------------------------------------------------------------> <!-- Modal --> <div class="modal fade" id="add_transaction" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Nandi Transaction</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form class="account_det"> <div class="modal-body"> <table border="1" style="width:100%;border-spacing:0;margin-top: 1%;" cellpadding="5px"> <thead> <thead> <tr> <th>Date</th> <th><input type="text" name="transaction_date" class="form-control" value="<?php echo date('d-m-Y');?>" readonly > </th></th> </tr> <tr> <th>Account</th> <th><select class="form-control" name="account" onchange="change_account(this.value)" required> <option value="" >Choose Account</option> <?php $acc = json_decode($account); foreach($acc as $get_account) {?> <option value="<?php echo $get_account->id; ?> "><?php echo $get_account->name;?> </option> <?php } ?> </select></th> </tr> <tr> <th>Type</th> <th> <select class="form-control" name="type" id="type" required readonly>Type <option disabled="disabled" value="" >----Select---</option> <option disabled="disabled" value="credit" >Credit</option> <option disabled="disabled" value="debit" >Debit</option> </select> </th> </tr> <input type="hidden" name="type" class="form-control type"> <tr> <th>Narration</th> <th height="50px"><textarea rows="4" cols="50" name="narration" class=" form-control" style="height:100px !important; text-transform: uppercase; required=""></textarea></th> </tr> <tr> <th>Debit</th> <th><input type="float" name="debit" class="form-control debit groupOfTexbox"></th> </tr> <tr> <th>Credit</th> <th><input type="float" name="credit" class="form-control credit groupOfTexbox"></th> </tr> <tr> <th>Created By</th> <th><input type="text" readonly name="user_name" readonly value="<?php echo $approved_by;?>" class=" form-control"></th> </tr> </thead> </table> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary submit" >Submit</button> </div> </form> </div> </div> </div> <!------------------------------------------------------------------------------> <!-- Modal --> <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Edit Nandi Transaction</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form class="update_account_det"> <div class="modal-body"> <table border="1" style="width:100%;border-spacing:0;margin-top: 1%;" cellpadding="5px"> <thead> <thead> <tr> <th>Date</th> <th><input type="hidden" name="id" class="form-control id" required="required"> <input type="text" name="transaction_date" class="form-control transaction_date_edit" id="transaction_date" required="required"></th> </tr> <tr> <th>Account</th> <th><select class="form-control account" onchange="change_account_edit(this.value)" name="account"> <option value="" >Choose Account</option> <?php $acc = json_decode($account); foreach($acc as $get_account) {?> <option value="<?php echo $get_account->id; ?> "><?php echo $get_account->name;?> </option> <?php } ?> </select></th> </tr> <tr> <th>Type</th> <th> <select class="form-control type" name="type" id="type_edit" >Type <option value="" disabled="disabled" >----Select---</option> <option disabled="disabled" value="credit" >Credit</option> <option disabled="disabled" value="debit" >Debit</option> </select> </th> </tr> <input type="hidden" name="type" class="form-control type"> <tr> <th>Narration</th> <th><input type="text" name="narration" style="height:150px !important; text-transform: uppercase;" class=" form-control narration"></th> </tr> <tr> <th>Debit</th> <th><input type="text" name="debit" class="groupOfTexbox form-control debit_edit"></th> </tr> <tr> <th>Credit</th> <th><input type="text" name="credit" class="groupOfTexbox form-control credit_edit"></th> </tr> <tr> <th>Created by</th> <th><input type="text" readonly name="user_name" class=" form-control approved_by_edit"></th> </tr> </thead> </table> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary submit" >Submit</button> </div> </form> </div> </div> </div> <!----------------------------------------------------------> <script> $(document).ready(function(){ // Date Object $('#datepicker').datepicker({ dateFormat: "dd-mm-yy", }); }); $(document).ready(function(){ // Date Object $('#transaction_date').datepicker({ dateFormat: "dd-mm-yy", }); }); function open_model() { $('#add_transaction').modal('show'); } $('.account_det').submit(function(e){ e.preventDefault(); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url('packing_list/add_nandi_transaction');?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('.account_det')[0].reset(); $('#add_transaction').modal('hide'); swal({ title: "Successfully Added", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else {$('.account_det')[0].reset(); $('#add_transaction').modal('hide'); swal({ title: "Fail To add, Try Again", text: "", }); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); $('.update_account_det').submit(function(e){ e.preventDefault(); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url('packing_list/update_nandi_transaction');?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('.update_account_det')[0].reset(); $('#exampleModal').modal('hide'); swal({ title: "Successfully Updated", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else {$('.update_account_det')[0].reset(); $('#add_master').modal('hide'); swal({ title: "Fail To add, Try Again", text: "", }); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); function deleted(rowId){ var id=rowId; $.ajax({ type:'post', url:'<?php echo site_url("packing_list/delete_nandi_transaction"); ?>', data:{'id':id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { swal({ title: "Successfully Deleted", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else { swal({ title: "Fail To add, Try Again", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } function change_account_edit(id) { $.ajax({ type:'post', url:'<?php echo site_url("packing_list/get_account_det"); ?>', data:{'id':id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('#type_edit option[value="'+response.message.type+'"').attr('selected','selected'); var type=response.message.type; $(".type").val(type); if(type=='credit') { $('.debit_edit').val(0); $('.credit_edit').attr('readonly', false); $('.debit_edit').attr('readonly', true); } else if(type=='debit') { $('.credit_edit').val(0); $('.debit_edit').attr('readonly', false); $('.credit_edit').attr('readonly', true); }else { $('.debit_edit').attr('readonly', false); $('.credit_edit').attr('readonly', false); } } else { swal({ title: "No data Found", text: "", }); } } }); } function change_account(id) { $.ajax({ type:'post', url:'<?php echo site_url("packing_list/get_account_det"); ?>', data:{'id':id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('#type option[value="'+response.message.type+'"').attr('selected','selected'); var type=response.message.type; $(".type").val(type); if(type=='credit') { $('.credit').attr('readonly', false); $('.debit').attr('readonly', true); } else if(type=='debit') { $('.debit').attr('readonly', false); $('.credit').attr('readonly', true); }else { $('.debit').attr('readonly', false); $('.credit').attr('readonly', false); } } else { swal({ title: "No data Found", text: "", }); } } }); } </script> <!-- BEGIN FOOTER --> <link rel="stylesheet" href="<?php echo base_url('assets/css/code_jquery.min.css');?>"> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.min.css'); ?>" /> <style> .tablediv { width:auto !important; overflow-x:scroll; } .ui-jqgrid { text-transform: capitalize !important; } .tablediv { text-transform: uppercase !important; } </style> <!-----------------datepicker-------------> <!-- The link to the CSS that the grid needs --> <link href="<?php echo base_url('assets/css/sweetalert2.min.css');?>" rel="stylesheet"/> <script src="<?php echo base_url('assets/js/sweetalert2.min.js');?>"></script> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <!-- This is the localization file of the grid controlling messages, labels, etc. We support more than 40 localizations --> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/i18n/grid.locale-en.min.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <!-- The link to the CSS that the grid needs --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid.min.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap.min.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap-ui.min.css'); ?>" /> <link rel="stylesheet" href="<?php echo base_url('assets/css/code_jquery.min.css');?>"> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.min.css'); ?>" /> <style> .ss{ padding-right: 0 !important; padding-left: 0 !important; } .form-control { //width:65% !important; height:27px !important; padding: 3px 12px !important; border-radius: 0px !important; //margin-bottom:15px; } label { font-weight: normal; text-align: left; } .hr-line{ border-top: 1px solid #465A81; } .well-sm { padding: 3px !important; border-radius: 0px !important; } input[type="file"] { padding-bottom: 28px !important; height: 25px !important; color:transparent; } .portlet.box.blue-madison { border: 1px solid #fff !important; border-top: 0; background:#fff !important; } #table_approved_indent { display:none; } #refresh_list3 { display:none !important; } @media only screen and (min-width:320px) and (max-width:640px) { } #more { display:none; } </style> <!-----------------datepicker-------------> <!-- The link to the CSS that the grid needs --> <script> $(document).ready(function (){ $('#more').hide(); var l=$("#ref_id").val(); jQuery("#list2").jqGrid({ url:"<?php echo base_url('packing_list/nandi_transation_list')?>", datatype: "json", colNames:['Id','Transaction Date','Account','Narration','Type','Debit','Credit','Created By','Action'], colModel:[ {name:'a_id',index:'a_id',hidden:true, width:100,editable:true}, {name:'transaction_date',index:'transaction_date', editable:true,editrules:{required: true},width:80,formatter: 'date', formatoptions: { newformat: 'd-m-Y'},searchoptions:{sopt:['eq']}}, {name:'b_name',index:'b_name', width:200,editable:true,editrules:{required: true}}, {name:'narration',index:'narration', width:300,editable:true,editrules:{required: true}}, {name:'type',index:'type', width:50,editable:true,editrules:{required: true}}, {name:'debit',index:'debit', width:80,editable:true,editrules:{required: true}}, {name:'credit',index:'credit', width:80,editable:true,editrules:{required: true}}, {name:'created_by',index:'created_by', editable:true,editrules:{required: true},width:70}, {name: '', index: '', width: 100, align: 'center',formatter: function (cellvalue, options, rowObject) { var retVal = ""; var retVal = '<input type="button" onclick="edit('+rowObject.a_id+')" value="Edit" \> <input type="button" onclick="deleted('+rowObject.a_id+')" value="Delete" \>'; return retVal; }}, ], height: 'auto', rowNum:50, rowTotal: 200000000000000000000000000, rowList : [50,100,200,300,500,1000,5000], rownumbers: true, rownumWidth: 40, pager:"#pager2", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", loadonce:true, caption:"Nandi Transaction", }); jQuery("#list2").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" }); $("#list2").jqGrid('navGrid','#pager2', {edit:false,add:false,del:false,search:false,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); }); function edit(id) { $.ajax({ type : 'post', url : '<?php echo site_url('packing_list/get_nandi_transaction_det');?>', data : {'id':id}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('#exampleModal').modal('show'); $('.id').val(response.message.id); $('.account option[value="'+response.message.account+'"]').attr('selected','selected'); //$(".account option:selected").val(response.message.account); $('.narration').val(response.message.narration); $('.type').val(response.message.type); $('.debit_edit').val(response.message.debit); $('.credit_edit').val(response.message.credit); var date_t=response.message.transaction_date.split("-"); $('.transaction_date_edit').val(date_t[2]+'-'+date_t[1]+'-'+date_t[0]); $('#type_edit option[value="'+response.message.type+'"').attr('selected','selected'); $('.approved_by_edit').val(response.message.created_by); var type=response.message.type; if(type=='credit') { $('.credit_edit').attr('readonly', false); $('.debit_edit').attr('readonly', true); } else if(type=='debit') { $('.debit_edit').attr('readonly', false); $('.credit_edit').attr('readonly', true); }else { $('.debit_edit').attr('readonly', false); $('.credit_edit').attr('readonly', false); } } else { swal({ title: "No data, Try Again", text: "", }); } } }); } $(document).ready(function() { $('.groupOfTexbox').keypress(function (event) { return isNumber(event, this) }); }); function isNumber(evt, element) { var charCode = (evt.which) ? evt.which : event.keyCode if ( (charCode != 45 || $(element).val().indexOf('-') != -1) && // “-” CHECK MINUS, AND ONLY ONE. (charCode != 46 || $(element).val().indexOf('.') != -1) && // “.” CHECK DOT, AND ONLY ONE. (charCode < 48 || charCode > 57)) return false; return true; } </script> <style type="text/css"> .ss{ padding-right: 0 !important; padding-left: 0 !important; } label { font-weight: normal; text-align: left; } .hr-line{ border-top: 1px solid #465A81; } .well-sm { padding: 3px !important; border-radius: 0px !important; } input[type="file"] { padding-bottom: 28px !important; height: 25px !important; color:transparent; } .portlet.box.blue-madison { border: 1px solid #fff !important; border-top: 0; background:#fff !important; } input[type=file] { display: none; } .ui-jqgrid .ui-jqgrid-caption { text-align: left; background: rgb(72,91,127); color: white; } .ui-jqdialog .ui-jqdialog-titlebar { padding: .1em .1em; min-height: 35px; background: rgb(72,91,127); color: white; } .ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: -9px; } #sData { height: 27px; } #cData { height: 27px; } #dData { height: 27px; } #eData { height: 27px; } .coledit { cursor:pointer; padding-right: 22px !important; padding-left: 23px !important; margin-top: 4px !important; color:bold !important; } .ui-jqgrid .ui-jqgrid-btable tbody tr.jqgrow td { overflow: hidden; white-space: pre; } </style> <style> #jaytab{ width:100%; overflow:auto; } #search_list2 { display:none !important; } #list2_122_t { height:0px !important; } list2_136_t { height:12px !important; } .scroll { height:12px !important; } .ui-jqgrid-btable { } .ui-common-table { height:12px !important; } #refresh_list2 { display:none !important; } #client_edit { padding-right:12px !important; } #list2 { width: 1050px; height: 0px !important; } #gbox_list2 { height: auto !important; } #gview_list2 { height: auto !important; } @media only screen and (min-width:320px) and (max-width:640px){ .ui-jqgrid { margin-left: 1px !important; } .radio-list { margin-left:7% !important; } #table_pending_indent{ overflow-x: scroll; } #jaytab{ margin-top: 0 !important; margin-left: 0 !important; //overflow-x: scroll !important; width:600px !important; padding-left: 0 !important; } #jaytab1 { margin-top: 0 !important; margin-left: 0 !important; overflow-x: scroll; width: 300px !important; padding-left: 0 !important; } #editmodlist2 { width:90% !important; } #sData span, #cData span { margin-left: 0 !important; } } @media only screen and (min-width:641px) and (max-width:991px){ .ui-jqgrid { margin-left: 1px !important; } #jaytab{ margin-top: 0 !important; margin-left: 0 !important; overflow-x: scroll; width: 100% !important; padding-left:0 !important; padding-right:9px !important; } } #sData span, #cData span { margin-left: 3px; } #sData { height: 29px; } #cData { height: 29px; } .jqgfirstrow { height: 0px !important; } </style>