suseendhiran : add delete button

This commit is contained in:
suseendhiran17 2023-04-20 15:48:24 +05:30
parent f5cff42b81
commit 14267187e2
23 changed files with 432 additions and 17 deletions

View File

@ -41,6 +41,11 @@ class Corporate extends CI_Controller {
$this->checksess();
$this->load->view('corporate/dashboard');
}
public function tmc_dashboard(){
$this->checksess();
$this->load->view('corporate/tmc');
}
public function get_alike_tkts($gid = null){
$this->checksess();
@ -379,7 +384,7 @@ class Corporate extends CI_Controller {
// if($gid)
// $res = $this->db->query('select *,am_code as supplier_code from gstr2a_data gd left join (select *,group_concat(td_gst_inv) g_td_gst_inv,sum(td_net) td_net_ref from tmc_data where td_show_status = 1 group by td_tkt) td on gd.gd_id=td.td_gstr2a_match_id left join airline_master am on am.am_name=gd.gd_supplier_type where gd_id = "'.$gid.'"');
// else
$res = $this->db->query('select * from tmc_data td left join (select *,sum(ti_amount) s_amt from airline_invoice group by ti_tdid) ti on ti.ti_tdid = td.td_id where td_inv_date between "'.$fromdate.'" and "'.$todate.'" order by td_id desc');
$res = $this->db->query('select * from tmc_data td left join (select *,sum(ti_amount) s_amt from airline_invoice group by ti_tdid) ti on ti.ti_tdid = td.td_id where is_active = 1 and td_inv_date between "'.$fromdate.'" and "'.$todate.'" order by td_id desc');
$fres['data'] = array();
$res2 = new stdClass();
foreach($res->result() as $res1){
@ -416,12 +421,12 @@ class Corporate extends CI_Controller {
$fromdate = $this->input->post('fromdate');
$todate = $this->input->post('todate');
if($gid)
$res = $this->db->query('select *,am_code as supplier_code from gstr2a_data gd left join (select *,group_concat(td_gst_inv) g_td_gst_inv,sum(td_net) td_net_ref from tmc_data where td_show_status = 1 group by td_tkt) td on gd.gd_id=td.td_gstr2a_match_id left join airline_master am on am.am_name=gd.gd_supplier_type left join airline_invoice ai on gd.gd_id=ai.ti_gdid or gd.gd_inv_no=ai.ti_gst_nub where gd_id = "'.$gid.'"');
$res = $this->db->query('select *,am_code as supplier_code from gstr2a_data where is_active = 1 gd left join (select *,group_concat(td_gst_inv) g_td_gst_inv,sum(td_net) td_net_ref from tmc_data where td_show_status = 1 group by td_tkt) td on gd.gd_id=td.td_gstr2a_match_id left join airline_master am on am.am_name=gd.gd_supplier_type left join airline_invoice ai on gd.gd_id=ai.ti_gdid or gd.gd_inv_no=ai.ti_gst_nub where gd_id = "'.$gid.'" and gd.is_active = 1');
// $res = $this->db->query('select *,am_code as supplier_code from gstr2a_data gd left join (select *,group_concat(td_gst_inv) g_td_gst_inv,sum(td_net) td_net_ref from tmc_data where td_show_status = 1 group by td_tkt) td on gd.gd_id=td.td_gstr2a_match_id left join airline_master am on am.am_name=gd.gd_supplier_type left join airline_invoice ai on gd.gd_id=ai.ti_gdid where gd_id = "'.$gid.'"');
// $res = $this->db->query('select * from gstr2a_data gd left join (select *,group_concat(td_gst_inv) g_td_gst_inv from tmc_data group by td_tkt) td on gd.gd_tkt_no=td.td_tkt where gd_id = "'.$gid.'"');
else
$res = $this->db->query('select *,am_code as supplier_code from gstr2a_data gd left join (select *,group_concat(td_gst_inv) g_td_gst_inv,sum(td_net) td_net_ref from tmc_data where td_show_status = 1 group by td_tkt) td on gd.gd_id=td.td_gstr2a_match_id left join airline_master am on am.am_name=gd.gd_supplier_type left join airline_invoice ai on gd.gd_id=ai.ti_gdid or gd.gd_inv_no=ai.ti_gst_nub where gd_inv_date between "'.$fromdate.'" and "'.$todate.'" order by gd_id desc');
$res = $this->db->query('select *,am_code as supplier_code from gstr2a_data gd left join (select *,group_concat(td_gst_inv) g_td_gst_inv,sum(td_net) td_net_ref from tmc_data where td_show_status = 1 group by td_tkt) td on gd.gd_id=td.td_gstr2a_match_id left join airline_master am on am.am_name=gd.gd_supplier_type left join airline_invoice ai on gd.gd_id=ai.ti_gdid or gd.gd_inv_no=ai.ti_gst_nub where gd.is_active = 1 and gd_inv_date between "'.$fromdate.'" and "'.$todate.'" order by gd_id desc');
// $res = $this->db->query('select * from gstr2a_data gd left join (select *,group_concat(td_gst_inv) g_td_gst_inv from tmc_data group by td_tkt) td on gd.gd_tkt_no=td.td_tkt where gd_inv_date between "'.$fromdate.'" and "'.$todate.'"');
$fres['data'] = array();
$res2 = new stdClass();

View File

@ -467,5 +467,65 @@ class Tmc extends CI_Controller {
echo json_encode($data);
}
public function delete_tmc(){
$update_data['is_active'] = 0;
$this->db->where('f_id', $this->input->post('id'));
$data = $this->db->update('files',$update_data);
if ($data) {
$this->db->where('td_tfid', $this->input->post('id'));
$data1 = $this->db->update('tmc_data',$update_data);
if ($data1) {
echo 1;
} else {
echo 0;
}
} else {
echo 0;
}
}
public function delete_tmc_recon(){
$update_data['is_active'] = 0;
$this->db->where('td_id', $this->input->post('id'));
$data = $this->db->update('tmc_data',$update_data);
if ($data) {
echo 1;
} else {
echo 0;
}
}
public function delete_gst2ra(){
$update_data['is_active'] = 0;
$this->db->where('f_id', $this->input->post('id'));
$data = $this->db->update('files',$update_data);
if ($data) {
$this->db->where('gd_gid', $this->input->post('id'));
$data1 = $this->db->update('gstr2a_data',$update_data);
if ($data1) {
echo 1;
} else {
echo 0;
}
} else {
echo 0;
}
}
public function delete_gst2ra_recon(){
$update_data['is_active'] = 0;
$this->db->where('gd_id', $this->input->post('id'));
$data = $this->db->update('gstr2a_data',$update_data);
if ($data) {
echo 1;
} else {
echo 0;
}
}
}

View File

@ -48,6 +48,7 @@ class Corporate_model extends CI_Model {
function get_tmc(){
$con['f_type'] = 'tmc';
$con['is_active'] = 1;
$con['f_corporateid'] = $this->session->userdata['recon_sess_i']['u_corporateid'];
$this->db->from('files tmc');
$this->db->join('corporates c','c.c_id=tmc.f_corporateid','inner');

View File

@ -618,7 +618,8 @@
"render": function ( data, type, full, meta ) {
// return '<a target="_blank" href="<?php echo base_url('corporate/gstr2a_file_download/'); ?>'+data+'" style="font-size:16px;"><i class="fa fa-download" title="Download file"></i></a> &nbsp;&nbsp;&nbsp;<a target="_blank" href="<?php echo base_url('corporate/gstr2a_valid_download/'); ?>'+data+'" style="font-size:16px;color:green"><i class="fa fa-download" title="Download Valid Records"></i></a>';
return '<a href="javascript:void(0)" onclick="downloadfn('+data+')" style="font-size:16px;"><i class="fa fa-download" title="Download file"></i></a>';
return `<a href="javascript:void(0)" onclick="downloadfn('+data+')" style="font-size:16px;"><i class="fa fa-download" title="Download file"></i></a>
&nbsp; <a id="${data}" onclick="deletetmc(${data})" style="font-size:16px;"><i class="fa fa-trash" title="Delete"></i></a>`;
}
}
@ -674,6 +675,40 @@
$('#download_modal').modal('show');
}
function deletetmc(data)
{
console.log(data);
var r=confirm("Are you sure you want to delte this");
if (r==true)
{
//User Pressed okay. Delete
$.ajax({
url: '<?php echo base_url('Tmc/delete_gst2ra') ?>',
type: 'POST',
data: { id : data },
success: function(data) {
if (data == 1) {
alert("Deleted")
location.reload();
}
else{
alert("Request failed. Kindly try after sometime")
}
},
error: function() {
alert('Request failed. Kindly try after sometime.');
}
});
}
else
{
//user pressed cancel. Do nothing
console.log("done");
}
}
</script>
<!-- App js -->

View File

@ -741,13 +741,16 @@ function() {
"targets": 20,
"width": 300,
"render": function ( data, type, full, meta ) {
console.log(data,"kkkkk");
return '<button type="text" class="form-control" data-refid="'+full['gd_id']+'" value="'+data+'" onclick="viewfn('+full['gd_id']+',0)" >View</button>';
}
},
{
"targets": 22,
"render": function ( data, type, full, meta ) {
return '<button class="form-control buttons tktdelredraw td_'+data+'" id="td_'+data+'">Search</button>';
console.log(data);
return '<button class="form-control buttons tktdelredraw td_'+data+'" id="td_'+data+'">Search</button>' +
'&nbsp;<a onclick="deletegst2rarecon('+data+')" style="font-size:16px;"><i class="fa fa-trash" title="Delete"></i></a>'
}
}
]
@ -916,6 +919,41 @@ function() {
})
}
*/
function deletegst2rarecon(data)
{
console.log(data,"data");
var r=confirm("Are you sure you want to delete this");
if (r==true)
{
//User Pressed okay. Delete
$.ajax({
url: '<?php echo base_url('Tmc/delete_gst2ra_recon') ?>',
type: 'POST',
data: { id : data },
success: function(data) {
if (data == 1) {
alert("Deleted")
// location.reload();
$("#formid").submit()
}
else{
alert("Request failed. Kindly try after sometime")
}
},
error: function() {
alert('Request failed. Kindly try after sometime.');
}
});
}
else
{
//user pressed cancel. Do nothing
console.log("done");
}
}
</script>
</body>

View File

@ -82,7 +82,8 @@
<i class="ri-dashboard-line mr-1"></i> Files <div class="arrow-down"></div>
</a>
<div class="dropdown-menu" aria-labelledby="topnav-dashboard">
<a href="<?php echo site_url('corporate/dashboard'); ?>" class="dropdown-item">Dashboard</a>
<a href="<?php echo site_url('corporate/dashboard'); ?>" class="dropdown-item">Corporate Dashboard</a>
<a href="<?php echo site_url('corporate/tmc_dashboard'); ?>" class="dropdown-item">TMC Dashboard</a>
<a href="<?php echo site_url('corporate/gstr2a'); ?>" class="dropdown-item">GSTR2A</a>
<a href="<?php echo site_url('corporate/tmc'); ?>" class="dropdown-item">TMC</a>
</div>

View File

@ -228,6 +228,47 @@
</div>
</div>
<div class="modal" id="upload_modal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<!-- <h4 class="modal-title">Forgot Password</h4> -->
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<form id="usrformb" enctype="multipart/form-data" target="_blank" class="form-horizontal" style="padding:10px;">
<div class="form-group">
<div class="row">
<input type="hidden" name="condition_check" value="condition_check"/>
<input type="hidden" id="f_agent" name="usr[f_agent]">
<input type="hidden" id="f_year" name="usr[f_year]">
<input type="hidden" id="f_month" name="usr[f_month]">
<input type="hidden" id="upload_id" name="td_tfid">
<div class="col-md-6 mb25">
<label>File<span class="required">*</span></label>
<input required type="file" name="tmc_file" />
</div>
</div>
</div>
<div class="modal-footer" style="margin-top:20px;">
<button type="submit" id="submit1" class="btn btn-primary">Submit</button>
<button type="button" class="btn btn-danger" id="btn_close" data-dismiss="modal">Close</button>
</div>
</form>
</div>
<!-- Modal footer -->
</div>
</div>
</div>
<button id="responsemref" style="display:none" type="button" data-toggle='modal' data-target="#response_modal"><i class="fa fa-upload"></i>&nbsp;&nbsp;Upload TMC Data</button>
<div id="response_modal" class="modal fade" role="dialog">
@ -375,6 +416,10 @@
</div>
</div>
<!-- third party js -->
<script src="<?php echo base_url(); ?>assets/libs/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url(); ?>assets/libs/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script>
@ -485,7 +530,7 @@
});
$("#usrforma").submit(function(e) {
console.log("aaaaaaaa");
$('#loading1').show();
$('#submit1').hide();
e.preventDefault(); // avoid to execute the actual submit of the form.
@ -493,17 +538,90 @@
var formData = new FormData($("#usrforma")[0]);
$.ajax({
type: "POST",
url: '<?php echo base_url('corporate/upload_tmc'); ?>',
url: '<?php echo base_url('tmc/upload_tmc'); ?>',
data: formData,
processData: false,
contentType: false,
cache: false,
async: false,
success: function(data) {
$('#loading1').hide();
$('#submit1').show();
var pdata = JSON.parse(data);
if (pdata.status == 1) {
$('#addclose').trigger('click');
usrforma.reset();
alert('File uploaded successfully.');
// alert('File uploaded successfully. Records insertred - ' + pdata.added_records);
// getcorplisting();
location.reload();
} else if (pdata.status == 31) {
alert('File already uploaded for this criteria.');
} else if (pdata.status == 13) {
alert('Error. Column mismatch.');
} else if (pdata.status == 0) {
$('#fileref').val(pdata.insref);
var content = 'Total Records - '+pdata.ttlrows+'<br/>Invalid Records - '+pdata.invalidrows;
if(pdata.duprecords != 0)
content += '<br/>Duplicate Records - '+pdata.duprecords;
// var content = 'Error in <br/>';
// var row = 1;
// $.each(pdata.error, function(k, v){
// $.each(v, function(kk, vv) {
// var l = 0;
// if (kk == 'column') {
// if (l == 0) {
// content += 'Row ' + row + ' - ';
// l = l + 1;
// }
// for (var i = 0; i < vv.length; i++) {
// content += vv[i] + ',';
// }
// content += '<br/>';
// row = row + 1;
// }
// })
// })
$('#addclose').trigger('click');
$('#responsecontent').html(content+'<br/><span style="color:red">*</span>Note : If you proceed only valid records will be uploaded.');
$('#responsemref').trigger('click');
// console.log(content);
// var content='Error in \n';
// $.each(pdata.error,function(k,v){
// var sary = v.split('-');
// content += 'Row '+sary[0]+' - Column - '+sary[1]+'\n';
// })
// content += 'Kindly correct the data and upload';
// alert(content);
} else {
alert('Request failed. Kindly try after sometime');
}
},
error: function() {
alert('Request failed. Kindly try after sometime');
}
});
});
$("#usrformb").submit(function(e) {
$('#loading1').show();
$('#submit1').hide();
e.preventDefault(); // avoid to execute the actual submit of the form.
// var form = $(this);
var formData = new FormData($("#usrformb")[0]);
$.ajax({
type: "POST",
url: '<?php echo base_url('tmc/upload_tmc'); ?>',
data: formData,
processData: false,
contentType: false,
cache: false,
async: false,
success: function(data) {
$('#loading1').hide();
$('#submit1').show();
var pdata = JSON.parse(data);
if (pdata.status == 1) {
$('#addclose').trigger('click');
@ -607,7 +725,9 @@
"render": function(data, type, full, meta) {
// return '<a target="_blank" href="<?php echo base_url('corporate/tmc_file_download/'); ?>' + data + '" style="font-size:16px;"><i class="fa fa-download" title="Download file"></i></a> &nbsp;&nbsp;&nbsp;<a target="_blank" href="<?php echo base_url('corporate/tmc_valid_download/'); ?>'+data+'" style="font-size:16px;color:green"><i class="fa fa-download" title="Download Valid Records"></i></a>';
return '<a href="javascript:void(0)" onclick="downloadfn('+data+')" style="font-size:16px;"><i class="fa fa-download" title="Download file"></i></a>';
return `<a href="javascript:void(0)" onclick="downloadfn(${data})" style="font-size:16px;"><i class="fa fa-download" title="Download file"></i></a>
&nbsp; <a href="javascript:void(0)" onclick="uploadfn(${full.f_id},${full.f_month},${full.f_year});" style="font-size:16px;"><i class="fa fa-upload" title="Upload file"></i></a>
&nbsp; <a id="${data}" onclick="deletetmc(${data})" style="font-size:16px;"><i class="fa fa-trash" title="Delete"></i></a>`;
}
}
@ -655,10 +775,11 @@
type: "POST",
url: url,
success: function(data) {
console.log(data);
if(data.length > 2){
oTable.clear();
var jsonData = JSON.parse(data);
// console.log(jsonData.data[0].f_id);
// console.log(jsonData);
var jd = jsonData.data;
var htmlData = '';
var i = 0;
@ -681,6 +802,49 @@
$('#download_modal').modal('show');
}
function deletetmc(data)
{
console.log(data);
var r=confirm("Are you sure you want to delte this");
if (r==true)
{
//User Pressed okay. Delete
$.ajax({
url: '<?php echo base_url('Tmc/delete_tmc') ?>',
type: 'POST',
data: { id : data },
success: function(data) {
if (data == 1) {
alert("Deleted")
location.reload();
}
else{
alert("Request failed. Kindly try after sometime")
}
},
error: function() {
alert('Request failed. Kindly try after sometime.');
}
});
}
else
{
//user pressed cancel. Do nothing
console.log("done");
}
}
function uploadfn(data1,data2,data3,data4)
{
console.log(data1);
$("#upload_id").val(data1);
$("#f_month").val(data2);
$("#f_year").val(data3);
$("#f_agent").val("dummy");
$('#upload_modal').modal('show');
}
</script>
<!-- App js -->

View File

@ -684,7 +684,8 @@ function() {
"targets": 13,
"width": 300,
"render": function ( data, type, full, meta ) {
return '<button type="text" class="form-control" data-refid="'+data+'" value="'+data+'" onclick="viewfn('+data+',1)" >View</button>';
return `<button type="text" class="form-control" data-refid="${data}" value="${data}" onclick="viewfn(${data},1)" >View</button>
&nbsp;<a id="${data}" onclick="deletetmcrecon(${data})" style="font-size:16px;"><i class="fa fa-trash" title="Delete"></i></a>`;
}
}
]
@ -713,6 +714,41 @@ function() {
oTable.columns(remaining_column).visible(true);
});
function deletetmcrecon(data)
{
var r=confirm("Are you sure you want to delete this");
if (r==true)
{
//User Pressed okay. Delete
$.ajax({
url: '<?php echo base_url('Tmc/delete_tmc_recon') ?>',
type: 'POST',
data: { id : data },
success: function(data) {
if (data == 1) {
alert("Deleted")
// location.reload();
$("#formid").submit()
}
else{
alert("Request failed. Kindly try after sometime")
}
},
error: function() {
alert('Request failed. Kindly try after sometime.');
}
});
}
else
{
//user pressed cancel. Do nothing
console.log("done");
}
}
</script>
</body>

View File

@ -726,7 +726,8 @@
// return '<a target="_blank" href="<?php echo base_url('corporate/tmc_file_download/'); ?>' + data + '" style="font-size:16px;"><i class="fa fa-download" title="Download file"></i></a> &nbsp;&nbsp;&nbsp;<a target="_blank" href="<?php echo base_url('corporate/tmc_valid_download/'); ?>'+data+'" style="font-size:16px;color:green"><i class="fa fa-download" title="Download Valid Records"></i></a>';
return `<a href="javascript:void(0)" onclick="downloadfn(${data})" style="font-size:16px;"><i class="fa fa-download" title="Download file"></i></a>
&nbsp; <a href="javascript:void(0)" onclick="uploadfn(${full.f_id},${full.f_month},${full.f_year});" style="font-size:16px;"><i class="fa fa-upload" title="Upload file"></i></a>`;
&nbsp; <a href="javascript:void(0)" onclick="uploadfn(${full.f_id},${full.f_month},${full.f_year});" style="font-size:16px;"><i class="fa fa-upload" title="Upload file"></i></a>
&nbsp; <a id="${data}" onclick="deletetmc(${data})" style="font-size:16px;"><i class="fa fa-trash" title="Delete"></i></a>`;
}
}
@ -801,6 +802,39 @@
$('#download_modal').modal('show');
}
function deletetmc(data)
{
console.log(data);
var r=confirm("Are you sure you want to delte this");
if (r==true)
{
//User Pressed okay. Delete
$.ajax({
url: '<?php echo base_url('Tmc/delete_tmc') ?>',
type: 'POST',
data: { id : data },
success: function(data) {
if (data == 1) {
alert("Deleted")
location.reload();
}
else{
alert("Request failed. Kindly try after sometime")
}
},
error: function() {
alert('Request failed. Kindly try after sometime.');
}
});
}
else
{
//user pressed cancel. Do nothing
console.log("done");
}
}
function uploadfn(data1,data2,data3,data4)
{
console.log(data1);

View File

@ -116,7 +116,7 @@
</div>
<div class="form-group col-md-2">
<label for="inputPassword4" class="col-form-label"></label>
<button style="margin-top:35px" type="submit" class="btn btn-primary">Submit</button>
<button style="margin-top:35px" type="submit" id="submit_1" class="btn btn-primary">Submit</button>
</div>
<div class="col-md-2"></div>
<div class="form-group col-md-4" style="margin-top:35px;">
@ -162,7 +162,7 @@
<tbody>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
@ -391,6 +391,8 @@ function() {
</script>
<script>
var fromdate_for_deleterow = convert($("#fromdate").val());
var todate_for_deleterow = convert($("#todate").val());
$('#usrforma').on('submit',function(e){
e.preventDefault();
@ -523,6 +525,8 @@ function() {
$('#formid').submit(function(e){
e.preventDefault();
fromdate_for_deleterow = convert($("#fromdate").val());
todate_for_deleterow = convert($("#todate").val());
$.ajax({
url:'<?php echo base_url('corporate/gen_tmc_recon'); ?>',
type:'POST',
@ -685,7 +689,8 @@ function() {
"targets": 13,
"width": 300,
"render": function ( data, type, full, meta ) {
return '<button type="text" class="form-control" data-refid="'+data+'" value="'+data+'" onclick="viewfn('+data+',1)" >View</button>';
return `<button type="text" class="form-control" data-refid="${data}" value="${data}" onclick="viewfn(${data},1)" >View</button>
&nbsp;<a id="${data}" onclick="deletetmcrecon(${data})" style="font-size:16px;"><i class="fa fa-trash" title="Delete"></i></a>`;
}
}
]
@ -714,6 +719,42 @@ function() {
oTable.columns(remaining_column).visible(true);
});
function deletetmcrecon(data)
{
var r=confirm("Are you sure you want to delete this");
if (r==true)
{
//User Pressed okay. Delete
$.ajax({
url: '<?php echo base_url('Tmc/delete_tmc_recon') ?>',
type: 'POST',
data: { id : data },
success: function(data) {
if (data == 1) {
alert("Deleted")
// location.reload();
$("#formid").submit()
}
else{
alert("Request failed. Kindly try after sometime")
}
},
error: function() {
alert('Request failed. Kindly try after sometime.');
}
});
}
else
{
//user pressed cancel. Do nothing
console.log("done");
}
}
</script>
</body>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.