From 14267187e21f6f446ad8fb8745c55fc0bc23832c Mon Sep 17 00:00:00 2001
From: suseendhiran17 <58357088+suseendhiran17@users.noreply.github.com>
Date: Thu, 20 Apr 2023 15:48:24 +0530
Subject: [PATCH] suseendhiran : add delete button
---
application/controllers/Corporate.php | 11 +-
application/controllers/Tmc.php | 60 ++++++
application/models/Corporate_model.php | 1 +
application/views/corporate/gstr2a.php | 37 +++-
application/views/corporate/gstr2a_recon.php | 40 +++-
.../views/corporate/includes/top_nav.php | 3 +-
application/views/corporate/tmc.php | 176 +++++++++++++++++-
application/views/corporate/tmc_recon.php | 38 +++-
application/views/tmc/tmc.php | 36 +++-
application/views/tmc/tmc_recon.php | 47 ++++-
.../GSTR2A-ASAASA-Jan-2023-1681897945.xlsx | Bin 0 -> 25763 bytes
.../GSTR2A-ASAASA-Jan-2023-1681898212.xlsx | Bin 0 -> 19659 bytes
.../GSTR2A-ASAASA-Jan-2023-1681984011.xlsx | Bin 0 -> 25763 bytes
uploads/2/tmc/TMC-A-Jan-2020-1681887908.xlsx | Bin 0 -> 9432 bytes
.../2/tmc/TMC-TEST-Jan-2020-1681887516.xlsx | Bin 0 -> 9432 bytes
.../2/tmc/TMC-TEST-Jan-2020-1681887603.xlsx | Bin 0 -> 9432 bytes
.../2/tmc/TMC-TEST-Jan-2020-1681890292.xlsx | Bin 0 -> 9445 bytes
.../2/tmc/TMC-dummy-Jan-2020-1681890129.xlsx | Bin 0 -> 9445 bytes
.../2/tmc/TMC-dummy-Jan-2020-1681890402.xlsx | Bin 0 -> 9534 bytes
.../2/tmc/TMC-dummy-Jan-2020-1681897749.xlsx | Bin 0 -> 9639 bytes
.../TMC-testagent-Jan-2020-1681887718.xlsx | Bin 0 -> 9432 bytes
.../TMC-testagent-Jan-2020-1681889907.xlsx | Bin 0 -> 9432 bytes
.../TMC-testagent-Jan-2020-1681972327.xlsx | Bin 0 -> 9639 bytes
23 files changed, 432 insertions(+), 17 deletions(-)
create mode 100644 uploads/2/gstr2a/GSTR2A-ASAASA-Jan-2023-1681897945.xlsx
create mode 100644 uploads/2/gstr2a/GSTR2A-ASAASA-Jan-2023-1681898212.xlsx
create mode 100644 uploads/2/gstr2a/GSTR2A-ASAASA-Jan-2023-1681984011.xlsx
create mode 100644 uploads/2/tmc/TMC-A-Jan-2020-1681887908.xlsx
create mode 100644 uploads/2/tmc/TMC-TEST-Jan-2020-1681887516.xlsx
create mode 100644 uploads/2/tmc/TMC-TEST-Jan-2020-1681887603.xlsx
create mode 100644 uploads/2/tmc/TMC-TEST-Jan-2020-1681890292.xlsx
create mode 100644 uploads/2/tmc/TMC-dummy-Jan-2020-1681890129.xlsx
create mode 100644 uploads/2/tmc/TMC-dummy-Jan-2020-1681890402.xlsx
create mode 100644 uploads/2/tmc/TMC-dummy-Jan-2020-1681897749.xlsx
create mode 100644 uploads/2/tmc/TMC-testagent-Jan-2020-1681887718.xlsx
create mode 100644 uploads/2/tmc/TMC-testagent-Jan-2020-1681889907.xlsx
create mode 100644 uploads/2/tmc/TMC-testagent-Jan-2020-1681972327.xlsx
diff --git a/application/controllers/Corporate.php b/application/controllers/Corporate.php
index bce0ac9..a317d4c 100644
--- a/application/controllers/Corporate.php
+++ b/application/controllers/Corporate.php
@@ -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();
diff --git a/application/controllers/Tmc.php b/application/controllers/Tmc.php
index c7c4421..505d5a0 100644
--- a/application/controllers/Tmc.php
+++ b/application/controllers/Tmc.php
@@ -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;
+ }
+
+ }
}
diff --git a/application/models/Corporate_model.php b/application/models/Corporate_model.php
index c5e20fa..ee10281 100644
--- a/application/models/Corporate_model.php
+++ b/application/models/Corporate_model.php
@@ -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');
diff --git a/application/views/corporate/gstr2a.php b/application/views/corporate/gstr2a.php
index b906a05..cd97945 100644
--- a/application/views/corporate/gstr2a.php
+++ b/application/views/corporate/gstr2a.php
@@ -618,7 +618,8 @@
"render": function ( data, type, full, meta ) {
// return ' ';
- return '';
+ return `
+ `;
}
}
@@ -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: '',
+ 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");
+ }
+
+ }
+
diff --git a/application/views/corporate/gstr2a_recon.php b/application/views/corporate/gstr2a_recon.php
index 74355b8..9aca9c8 100644
--- a/application/views/corporate/gstr2a_recon.php
+++ b/application/views/corporate/gstr2a_recon.php
@@ -741,13 +741,16 @@ function() {
"targets": 20,
"width": 300,
"render": function ( data, type, full, meta ) {
+ console.log(data,"kkkkk");
return '';
}
},
{
"targets": 22,
"render": function ( data, type, full, meta ) {
- return '';
+ console.log(data);
+ return '' +
+ ' '
}
}
]
@@ -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: '',
+ 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");
+ }
+
+ }