From d5d0c044aadf343334294b8a73b392dff230a0b5 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Jun 2018 16:58:17 +0530 Subject: [PATCH] gst report bugs fixes --- application/controllers/report.php | 14 +- application/models/dahsboard_model.php | 37 ++- application/views/Report_monthly_gst.php | 38 ++- .../views/Report_monthly_gst_table.php | 297 +++++++++++++++--- 4 files changed, 330 insertions(+), 56 deletions(-) diff --git a/application/controllers/report.php b/application/controllers/report.php index e8117720..827e67aa 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -1024,10 +1024,13 @@ class report extends BaseController $m=$this->input->post('month'); $frm = $this->input->post('from_date'); $t = $this->input->post('to_date'); + $ab=$this->input->post('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); //print_r($prod); - $data['monthly_gst_purchase']=$this->dahsboard_Model->monthly_gst_purchase($m,$frm,$t); - $data['monthly_gst_sales']=$this->dahsboard_Model->monthly_gst_sales($m,$frm,$t); + $data['monthly_gst_purchase']=$this->dahsboard_Model->monthly_gst_purchase($m,$frm,$t,$fa,$aa); + $data['monthly_gst_sales']=$this->dahsboard_Model->monthly_gst_sales($m,$frm,$t,$fa,$aa); } $data['finyear']=$this->dahsboard_Model->report_finyear(); @@ -1043,12 +1046,15 @@ class report extends BaseController $m=$this->input->get('m'); $frm = $this->input->get('frm'); $t = $this->input->get('t'); + $ab=$this->input->get('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); // print_r($frm); // print_r($t); // print_r($m);die(); - $data['monthly_gst_purchase']=$this->dahsboard_Model->purchase_gst($m,$frm,$t); - $data['monthly_gst_sales']=$this->dahsboard_Model->sales_gst($m,$frm,$t); + $data['monthly_gst_purchase']=$this->dahsboard_Model->purchase_gst($m,$frm,$t,$fa,$aa); + $data['monthly_gst_sales']=$this->dahsboard_Model->sales_gst($m,$frm,$t,$fa,$aa); $this->loadviews("Report_monthly_gst_table",$this->global,$data, NULL); diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 76d2f96d..0aef6fa8 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -2274,7 +2274,7 @@ if ($cname!= ''){ //echo $sql; return $query->result(); } - function monthly_gst_purchase($m,$frm,$t){ + function monthly_gst_purchase($m,$frm,$t,$fa,$aa){ $sql="select g.doc_no,g.date,g.doc_type,g.hsn_code,sum(g.value) as value,sum(g.others) as others,sum(g.sgst) as sgst,sum(g.cgst) as cgst,sum(g.igst) as igst,sum(g.total) as total from (SELECT pm.PONO as doc_no,date_format(pm.PODate,'%d-%m-%Y') as date, @@ -2313,20 +2313,25 @@ where g.doc_no != 'null' "; } if ($frm and $t != ''){ - // $fromd= date("Y-m-d",strtotime($frm)); - // $tod=date("Y-m-d",strtotime($t)); + $fromd= date("Y-m-d",strtotime($frm)); + $tod=date("Y-m-d",strtotime($t)); - $sql.="and g.date >= '".$frm."' - and g.date <= '".$t."'"; + $sql.="and p.PODate >= '".$fromd."' + and p.PODate <= '".$tod."'"; + + } + if ($fa and $aa != ''){ + + $sql.=" and (p.PODate >= '".$fa."-04-01' and p.PODate <= '".$aa."-03-31')"; } - //echo $sql; + //echo $sql; $query = $this->db->query($sql); return $query->result(); } - public function monthly_gst_sales($m=null,$frm=null,$t=null) + public function monthly_gst_sales($m=null,$frm=null,$t=null,$fa=null,$aa=null) { $sql = "select ii.invoice_id as invoice_id,ii.invoice_number as invoice_number,date_format(ii.invoice_date_created,'%d-%m-%Y') as dates, @@ -2370,13 +2375,18 @@ where g.doc_no != 'null' "; and ii.invoice_date_created <= '".$todate."'"; } + if ($fa and $aa != ''){ + + $sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')"; + + } //echo $sql; $query = $this->db->query($sql); return $query->result(); } - function sales_gst($m=null,$frm=null,$t=null) + function sales_gst($m=null,$frm=null,$t=null,$fa=null,$aa=null) { $sql = "select ii.invoice_id as invoice_id,ii.client_id as client_id,ip.product_sku as hsn_code,ii.invoice_number as doc_no,date_format(ii.invoice_date_created,'%d-%m-%Y') as date,'Sales' as doc_type,TIME_FORMAT(ii.invoice_time_created,'%l:%i %p') as invoice_time_created,icf.invoice_custom_fieldvalue as vehicle_no,ip.product_description as product_description,concat(ic.client_name,'-',ic.client_surname)as client_name,sum(iit.item_quantity) as item_quantity,sum(iit.item_price) as item_price,sum(iia.item_subtotal) as value, @@ -2419,6 +2429,11 @@ where g.doc_no != 'null' "; and ii.invoice_date_created <= '".$todate."'"; } + if ($fa and $aa != ''){ + + $sql.=" and (ii.invoice_date_created >= '".$fa."-04-01' and ii.invoice_date_created <= '".$aa."-03-31')"; + + } // echo $fromdate; @@ -2429,7 +2444,7 @@ where g.doc_no != 'null' "; } - function purchase_gst($m,$frm,$t){ + function purchase_gst($m,$frm,$t,$fa,$aa){ $sql="SELECT pm.PONO as doc_no,pm.POType as potype,date_format(pm.PODate,'%d-%m-%Y') as date, @@ -2480,7 +2495,11 @@ pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' "; and date(pm.PODate) <= '".$tod."'"; } + if ($fa and $aa != ''){ + + $sql.=" and (pm.PODate >= '".$fa."-04-01' and pm.PODate <= '".$aa."-03-31')"; + } $sql.="group by doc_no,material_name,supplier_name"; diff --git a/application/views/Report_monthly_gst.php b/application/views/Report_monthly_gst.php index 764cabe6..99bdf216 100644 --- a/application/views/Report_monthly_gst.php +++ b/application/views/Report_monthly_gst.php @@ -51,7 +51,12 @@ table.dataTable thead > tr > td.sorting {

Report - Monthly GST

input->post('financialyear')){ + $ab=$this->input->post('financialyear'); + echo '('.$ab.')'; + echo ' '; + + } if($this->input->post('month')){ $m=$this->input->post('month'); echo '('.$m.')'; @@ -73,7 +78,29 @@ table.dataTable thead > tr > td.sorting {

-
+
+ +
+ +
+
+
@@ -86,7 +113,7 @@ table.dataTable thead > tr > td.sorting {
-
+
@@ -99,7 +126,7 @@ table.dataTable thead > tr > td.sorting {
-

- +
diff --git a/application/views/Report_monthly_gst_table.php b/application/views/Report_monthly_gst_table.php index 50a551e7..ccc1d098 100644 --- a/application/views/Report_monthly_gst_table.php +++ b/application/views/Report_monthly_gst_table.php @@ -38,6 +38,12 @@

Monthly GST Summary Report

+

+
+ + + +

@@ -45,8 +51,152 @@
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DateDocument NumberDocument TypeHSN CODEValue  (₹)Others  (₹)SGST  (₹)CGST  (₹)IGST  (₹)Total  (₹)
date;?>doc_no;?>doc_type;?>hsn_code;?>value,2); + echo round($rel->value,2); + ?>sgst,2); + echo round($rel->sgst,2); + ?>cgst,2); + echo round($rel->cgst,2); + ?>igst,2); + echo round($rel->igst,2); + ?>total,2); + echo round($rel->total,2); + ?>
Total    + + + + + + + + + + + + + + + + + +
+ +
+ +