EVOLUTION-NINJA
Edit File: payment_master.php
<?php $this->load->view('includes/header'); ?> <div class="content-wrapper"> <div class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="#">Accounts</a></li> <li class="breadcrumb-item"><a href="#">Masters</a></li> <li class="breadcrumb-item"><a href="#">HR</a></li> <li class="breadcrumb-item"> Payment Master </li> </ol> </div> </div> </div> </div> <div class="row"> <div class="col-md-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <form id="payment_submit"> <div class="row" style="background-color:#f8f8f8;padding-top: 10px;padding-bottom: 10px;"> <div class="col-sm-12 col-md-3"> <span style="font-size:25px;">Payment Master</span> </div> <div class="col-sm-6"></div> </div> <div class="form-group" > <div class="row" > <div class="col-sm-3"> <label class="col-sm-12" style="padding-top: 20px;padding-left: 0px;">Employee Type<span style="color:red">*</span></label> <select name="employee_type" class="form-control col-sm-12" required="required"> <option value="">Select</option> <option value="Permanent">Permanent</option> <option value="On_Contract">Contract</option> </select> </div> <div class="col-sm-3"> <label class="col-sm-12" style="padding-top: 20px;padding-left: 0px;">Effect From<span style="color:red">*</span></label> <input type="text" class="form-control col-sm-12" name="effect_from" id="datepick" required> </div> <div class="col-sm-3"> <label class="col-sm-12" style="padding-top: 20px;padding-left: 0px;">ESI Above Gross Earnings(Rs)<span style="color:red">*</span></label> <input type="text" class="form-control col-sm-12 esi_above" name="esi_above" id="esi_above" required> </div> <div class="col-sm-3"> <label class="col-sm-12" style="padding-top: 20px;padding-left: 0px;">ESI (%)<span style="color:red">*</span></label> <input type="text" class="form-control col-sm-12 esi" name="esi" id="esi"required> </div> </div> <!--row--> </div> <br> <div class="form-group" > <!-- <label >Professional Tax <span style="color:red">*</span></label> --> <div class="row"> <div class="col-sm-3"> <label class="col-sm-12" style="padding-top: 20px;padding-left: 0px;">Prof Tax Above Gross Earnings(Rs)<span style="color:red">*</span></label> <input type="text" class="form-control col-sm-12 prof_tax_above" name="prof_tax_above" id="prof_tax_above" required> </div> <div class="col-sm-3"> <label class="col-sm-12" style="padding-top: 20px;padding-left: 0px;">Amount (Rs)<span style="color:red">*</span></label> <input type="text" class="form-control col-sm-12 prof_tax" name="prof_tax" id="prof_tax"required> </div> <div class="col-sm-3"> <label class="col-sm-12" style="padding-top: 20px;padding-left: 0px;">PF (%)<span style="color:red">*</span></label> <input type="text" class="form-control col-sm-12 pf" name="pf" id="pf" required> </div> <div class="col-sm-3"> <label class="col-sm-12" style="padding-top: 20px;padding-left: 0px;">HRA (%)<span style="color:red">*</span></label> <input type="text" class="form-control col-sm-12 hra" name="hra" id="hra"required> </div> </div> <!--row--> </div> <div class="row"> <div class="col-sm-1"> </div> <div class="col-sm-10" id="sub_close"> <button type="submit" class="btn btn-primary submit">Save</button> <button type="reset" class="btn btn-light">Clear</button> </div> <div class="col-sm-1"> </div> </div> </form> </div> </div> </div> <!-- --------------------------Latest Payment Master------------------------- --> <!-- <div class="col-sm-1"></div> --> <!-- <div class="col-sm-10"> <div class="grid_div"></div> <table id="list1"> </table> <div id="pager1"></div> <div id="dialogSelectRow3" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> --> <div class="col-sm-12"> <div id ="jaytab" style="margin-top:3%" class="grid table-responsive"> <table id="list1"></table> <div id="pager1"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <!-- <div class="col-sm-1"></div> --> <!-- --------------------------Payment Master Complete List------------------------- --> <div class="col-sm-12"> <div id ="jaytab1" style="margin-top:3%" class="grid table-responsive"> <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 class="modal fade" id="edit_modal" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true"> <div class="modal-dialog modal-xl" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="ModalLabel">Edit Payment Details</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form class="forms-sample update_form"> <input type="hidden" class="form-control updated_id" name="updated_id" /> <div class="form-group" > <div class="row"> <div class="col-sm-6"> <div class="row"> <div class="col-sm-6"> <label>Employee Type</label> <select name="m_employee_type" class="form-control m_employee_type" required="required"> <option value="">Select</option> <option value="Permanent">Permanent</option> <option value="On_Contract">Contract</option> </select> </div> <div class="col-sm-6"> <label>Effect From</label> <input type="text" class="form-control m_effect_from" name="m_effect_from" id="datepick" required readonly > </div> </div> </div> <div class="col-sm-6"> <div class="row"> <!-- <div class="col-sm-6"> <select name="m_pf_type" class="form-control m_pf_type" required="required"> <option value="">Select</option> <option value="percentage">Percentage</option> <option value="amount">Amount</option> </select> </div> --> <!-- <div class="col-sm-6"> <label >ESI (%)</label> <input type="text" class="form-control m_esi" name="m_esi" id="m_esi" required> </div> --> <div class="col-sm-6"> <label >ESI Above Gross Earnings(Rs)</label> <input type="text" class="form-control m_esi_above" name="m_esi_above" id="m_esi_above" required> </div> <div class="col-sm-6"> <label >ESI (%)</label> <input type="text" class="form-control m_esi" name="m_esi" id="m_esi" required> </div> </div> </div> </div> </div> <div class="row"> <!-- <div class="col-sm-6"> <div class="form-group" > <label >ESI Type</label> <div class="row"> <div class="col-sm-6"> <select name="m_esi_type" class="form-control m_esi_type" required="required"> <option value="">Select</option> <option value="percentage">Percentage</option> <option value="amount">Amount</option> </select> </div> <div class="col-sm-6"> <input type="text" class="form-control m_esi" name="m_esi" id="m_esi" required> </div> </div> </div> </div> --> <div class="col-sm-6"> <div class="form-group" > <div class="row"> <!-- <div class="col-sm-6"> <select name="m_prof_tax_type" class="form-control m_prof_tax_type" required> <option value="">Select</option> <option value="percentage">Percentage</option> <option value="amount">Amount</option> </select> </div> --> <div class="col-sm-6"> <label >Prof Tax Above Gross Earnings(Rs)</label> <input type="text" class="form-control m_prof_tax_above" name="m_prof_tax_above" id="m_prof_tax_above" required> </div> <div class="col-sm-6"> <label >Amount (Rs)</label> <input type="text" class="form-control m_prof_tax" name="m_prof_tax" id="m_prof_tax" required> </div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group" > <div class="row"> <div class="col-sm-6"> <label >PF (%)</label> <input type="text" class="form-control m_pf" name="m_pf" id="m_pf"required> </div> <div class="col-sm-6"> <label >HRA (%)</label> <input type="text" class="form-control m_hra" name="m_hra" id="m_hra" required> </div> <div class="col-sm-6"> </div> </div> </div> </div> </div> <!-- <div class="row"> <div class="col-sm-6"> <div class="form-group" > <div class="row"> <div class="col-sm-6"> <select name="m_hra_type" class="form-control m_hra_type" required> <option value="">Select</option> <option value="percentage">Percentage</option> <option value="amount">Amount</option> </select> </div> <div class="col-sm-6"> <label >HRA (%)</label> <input type="text" class="form-control m_hra" name="m_hra" id="m_hra" required> </div> </div> </div> </div> <div class="col-sm-6"> <div class="form-group" > <label >Travel & Other Allowance Type</label> <div class="row"> <div class="col-sm-6"> <select name="m_allowance_type" class="form-control m_allowance_type" required > <option value="">Select</option> <option value="percentage">Percentage</option> <option value="amount">Amount</option> </select> </div> <div class="col-sm-6"> <input type="text" class="form-control m_travel_allowance" name="m_travel_allowance" required> </div> </div> </div> </div> </div> --> <!-- <div class="row"> <div class="col-sm-10"> <div class="form-group" > <div class="row"> <div class="col-sm-5"> <label>Travel & Other Allowance</label> <input type="text" name="m_travel_allowance" class="form-control m_travel_allowance" required> </div> <div class="col-sm-5"> <label>Other Allowance</label> <input type="text" name="m_other_allowance" class="form-control m_other_allowance" required> </div> </div> </div> </div> </div> --> <div class="modal-footer"> <button type="submit" class="btn btn-primary update">Update</button> <button type="button" class="btn btn-light" data-dismiss="modal">Close</button> </div> </form> </div> </div> </div> </div> <link rel="stylesheet" href="<?php echo base_url('assets/css/jquery-ui.css');?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/grid_style.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/jqgrid/css/ui.jqgrid.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/jqgrid/css/ui.jqgrid-bootstrap.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/jqgrid/css/ui.jqgrid-bootstrap-ui.css'); ?>" /> <script src="<?php echo base_url('assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> <script type="text/ecmascript" src="<?php echo base_url('assets/jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <script type="text/ecmascript" src="<?php echo base_url('assets/jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <script type="text/javascript"> $('#datepick').datepicker({ changeMonth:true, changeYear:true, yearRange: "1940:c", // dateFormat: 'yy-mm-dd' dateFormat: 'dd-mm-yy' }); CallGrid(); function CallGrid() { /*--------------------------Latest Payment Master-------------------------*/ jQuery("#list1").jqGrid({ url:"<?php echo site_url('latest-payment-list')?>", mtype : "get", datatype: "json", colNames:['ID','Employee Type','PF','ESI Above Gross Earnings(Rs)','ESI','Prof Tax Above Gross Earnings(Rs)','Prof Tax','HRA','Effect From','Action'], colModel:[ {name:'id',index:'id', width:100, hidden:true,editable:false}, {name:'employee_type',index:'employee_type', width:150, hidden:false,editable:false}, //{name:'pf_type',index:'pf_type', width:150, hidden:false,editable:false}, {name:'pf',index:'pf', width:150, hidden:false,editable:false}, //{name:'esi_type',index:'esi_type', width:150, hidden:false,editable:false}, {name:'esi_above',index:'esi_above', width:150, hidden:false,editable:false}, {name:'esi',index:'esi', width:150, hidden:false,editable:false}, //{name:'prof_tax_type',index:'prof_tax_type', width:150, hidden:false,editable:false}, {name:'prof_tax_above',index:'prof_tax_above', width:150, hidden:false,editable:false}, {name:'prof_tax',index:'prof_tax', width:150, hidden:false,editable:false}, // {name:'hra_type',index:'hra_type', width:150, hidden:false,editable:false}, {name:'hra',index:'hra', width:150, hidden:false,editable:false}, /*{name:'allowance_type',index:'allowance_type', width:150, hidden:false,editable:false}, {name:'travel_allowance',index:'travel_allowance', width:150, hidden:false,editable:false},*/ //{name:'other_allowance',index:'other_allowance', width:150, hidden:false,editable:false}, {name:'effect_from',index:'effect_from', width:150, hidden:false,editable:false,formatter: 'date', formatoptions: { srcformat: 'Y-m-d', newformat: 'd-m-Y'}}, {name:'',index:'',search:false, width:100, editable:false,formatter: function (cellvalue, options, rowObject) { var retVal = ""; var retVal = '<b><a href="javascript:void(0);" onclick="fun_edit_latest('+rowObject.id+');"><i class="fa fa-pencil-square-o" style="color:blue;" aria-hidden="true"></i></a> <a onclick="fun_delete_latest('+rowObject.id+')"; href="javascript:void(0);"><i class="fa fa-trash" style="color:red;" aria-hidden="true"></i></a></b>'; return retVal; }}, ], rowNum:20, rowTotal: 2000, rowList : [20,30], rownumbers: true, //rownumWidth: 60, pager:"#pager1", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", shrinkToFit: true, loadonce:true, autoencode: true, caption:"Latest Payment Master", //Subgrid1... subGrid: false, }); $("#list1").jqGrid("setLabel", "rn", "SL"); $("#list1").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list1").jqGrid('navGrid','#pager1', {edit:false,add:false,del:false,search:false,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true, closeAfterDelete:true, closeAfterEdit:true }, ); /*------------------------------Payment Master Complete List-----------------------------*/ jQuery("#list2").jqGrid({ url:"<?php echo site_url('get-payment-list')?>", mtype : "get", datatype: "json", colNames:['ID','Employee Type','PF','ESI Above Gross Earnings(Rs)','ESI','Prof Tax Above Gross Earnings(Rs)','Prof Tax','HRA','Effect From','Action'], colModel:[ {name:'id',index:'id', width:100, hidden:true,editable:false}, {name:'employee_type',index:'employee_type', width:150, hidden:false,editable:false}, //{name:'pf_type',index:'pf_type', width:150, hidden:false,editable:false}, {name:'pf',index:'pf', width:150, hidden:false,editable:false}, //{name:'esi_type',index:'esi_type', width:150, hidden:false,editable:false}, {name:'esi_above',index:'esi_above', width:150, hidden:false,editable:false}, {name:'esi',index:'esi', width:150, hidden:false,editable:false}, //{name:'prof_tax_type',index:'prof_tax_type', width:150, hidden:false,editable:false}, {name:'prof_tax_above',index:'prof_tax_above', width:150, hidden:false,editable:false}, {name:'prof_tax',index:'prof_tax', width:150, hidden:false,editable:false}, //{name:'hra_type',index:'hra_type', width:150, hidden:false,editable:false}, {name:'hra',index:'hra', width:150, hidden:false,editable:false}, /*{name:'allowance_type',index:'allowance_type', width:150, hidden:false,editable:false}, {name:'travel_allowance',index:'travel_allowance', width:150, hidden:false,editable:false},*/ //{name:'other_allowance',index:'other_allowance', width:150, hidden:false,editable:false}, {name:'effect_from',index:'effect_from', width:150, hidden:false,editable:false,formatter: 'date', formatoptions: { srcformat: 'Y-m-d', newformat: 'd-m-Y'}}, {name:'',index:'',search:false, width:100, editable:false,formatter: function (cellvalue, options, rowObject) { var retVal = ""; var retVal = ' <a data-toggle="tooltip" title="Edit" class="" href="javascript:void(0);"><span class="fa fa-pencil" onclick="fun_edit($(this))" style="color:blue;"></span></a> <a data-toggle="tooltip" title="Delete" onclick="fun_delete($(this))"; href="javascript:void(0);"><span class="fa fa-trash" style="color:red;"></span></a>'; return retVal; }}, ], rowNum:20, rowTotal: 2000, rowList : [20,30], rownumbers: true, //rownumWidth: 60, pager:"#pager2", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", shrinkToFit: true, loadonce:true, autoencode: true, caption:"Payment Master list", //Subgrid1... subGrid: false, }); $("#list2").jqGrid("setLabel", "rn", "SL"); $("#list2").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#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, closeAfterDelete:true, closeAfterEdit:true }, ); } $('#payment_submit').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").text("Submitting..."); $(".submit").attr("disabled", true); $.ajax({ type : 'post', url : '<?php echo site_url("add-payment")?>', data : formdata, contentType: false, processData: false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { swal({ title: "Are you sure?", text: "Added Succesfully", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, Add it!", closeOnConfirm: true, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $('.submit').removeAttr("disabled"); $('#payment_submit')[0].reset(); $(".submit").text("Submit"); location.reload(); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { toastr["error"](response.message); } } }); }); function fun_edit_latest(rowId) { var id = rowId; //alert(id); $.ajax({ url:"<?php echo site_url("Edit-payment-list")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { $("#edit_modal").modal("show"); $(".updated_id").val(response.message.id); $(".m_employee_type").val(response.message.employee_type); $(".m_effect_from").val(response.message.effect_from); //$(".m_pf_type").val(response.message.pf_type); $(".m_pf").val(response.message.pf); //$(".m_esi_type").val(response.message.esi_type); $(".m_esi_above").val(response.message.esi_above); $(".m_esi").val(response.message.esi); //$(".m_prof_tax_type").val(response.message.prof_tax_type); $(".m_prof_tax_above").val(response.message.prof_tax_above); $(".m_prof_tax").val(response.message.prof_tax); //$(".m_hra_type").val(response.message.hra_type); $(".m_hra").val(response.message.hra); //$(".m_allowance_type").val(response.message.allowance_type); //$(".m_travel_allowance").val(response.message.travel_allowance); //$(".m_other_allowance").val(response.message.other_allowance); } else { toastr["error"](response.message); $(".update").attr("disabled", true); } } }); } function fun_delete_latest(id) { /*var id = rowId; var id = id;*/ alert(id); swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ url:"<?php echo site_url("delete-payment-list")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"]("Deleted successfully"); $("#list1").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function fun_edit(rowId) { var id = rowId.closest('tr').attr('id'); $.ajax({ url:"<?php echo site_url("Edit-payment-list")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { $("#edit_modal").modal("show"); $(".updated_id").val(response.message.id); $(".m_employee_type").val(response.message.employee_type); $(".m_effect_from").val(response.message.effect_from); //$(".m_pf_type").val(response.message.pf_type); $(".m_pf").val(response.message.pf); //$(".m_esi_type").val(response.message.esi_type); $(".m_esi").val(response.message.esi); //$(".m_prof_tax_type").val(response.message.prof_tax_type); $(".m_prof_tax_above").val(response.message.prof_tax_above); $(".m_prof_tax").val(response.message.prof_tax); //$(".m_hra_type").val(response.message.hra_type); $(".m_hra").val(response.message.hra); //$(".m_allowance_type").val(response.message.allowance_type); //$(".m_travel_allowance").val(response.message.travel_allowance); //$(".m_other_allowance").val(response.message.other_allowance); } else { toastr["error"](response.message); $(".update").attr("disabled", true); } } }); } function fun_delete(rowId) { var id = rowId.closest('tr').attr('id'); var id = id; swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ url:"<?php echo site_url("delete-payment-list")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"]("Deleted successfully"); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } $('.update_form').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".update").text("Updating..."); $(".update").attr("disabled", true); $.ajax({ type : 'post', url : '<?php echo site_url("update-payment-details")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { swal({ title: "Are you sure?", text: "Updated Succesfully", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, Upadte it!", closeOnConfirm: true, closeOnCancel: false }, function(isConfirm) { if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $('.update').removeAttr("disabled"); $(".update").text("Update"); $("#edit_modal").modal("hide"); $("#list1").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { $('.update').removeAttr("disabled"); $(".update").text("Update"); } } }); }); </script> <style type="text/css"> #sub_close{ padding-bottom: 20px; text-align: center !important; } #sub_close button{ } </style>