diff --git a/application/controllers/report.php b/application/controllers/report.php
index 1c9546c3..c90a632f 100755
--- a/application/controllers/report.php
+++ b/application/controllers/report.php
@@ -523,460 +523,469 @@ class report extends BaseController
echo json_encode($data);
}
- public function ipurchase()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- if ($this->input->post('btn_submit')) {
- $cname = $this->input->post('client_name');
- $prod = $this->input->post('item_name');
- $ab=$this->input->post('financialyear');
- $cat = $this->input->get('cat');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- $m=$this->input->post('month');
- $frm = $this->input->post('from_date');
- $t = $this->input->post('to_date');
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['purchase']=$this->dahsboard_Model->ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat);
- $data['cashbookdatas']=$this->dahsboard_Model->report_inwardcashbook($cname,$fa,$aa,$m,$frm,$t,$cat);
- }
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
-
- $this->loadviews("Report_purchase_inward",$this->global,$data, NULL);
-
-
-
-
- }
- public function ilink_purchase()
- {
- if ($this->input->post('btn_submit')) {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //$this->input->post('btn_submit');
- $cname = $this->input->post('client_name');
- $prod = $this->input->post('item_name');
- $ab=$this->input->post('financialyear');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- $m=$this->input->post('month');
- $frm = $this->input->post('from_date');
- $t = $this->input->post('to_date');
- $sid=$this->input->get('sid');
- $mid = $this->input->get('mid');
- $d = $this->input->get('d');
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['purchase']=$this->dahsboard_Model->ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d);
-
-
- } else{
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //$this->input->post('btn_submit');
- $cat = $this->input->get('cat');
- $cname = $this->input->get('cname');
- $prod = $this->input->get('prod');
- $ab=$this->input->get('ab');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- $m=$this->input->get('m');
- $frm = $this->input->get('frm');
- $t = $this->input->get('t');
- $sid=$this->input->get('sid');
- $mid = $this->input->get('mid');
- $d = $this->input->get('d');
- $da = $this->input->get('da');
- $po = $this->input->get('po');
-
- //print_r($m);die();
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['purchase']=$this->dahsboard_Model->ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po);
- }
-
- $this->loadviews("Report_purchase_inward",$this->global,$data, NULL);
-
- }
- public function iattach()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- if ($this->input->post('btn_submit')) {
- $cname = $this->input->post('client_name');
- $ab=$this->input->post('financialyear');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- $m=$this->input->post('month');
- $frm = $this->input->post('from_date');
- $t = $this->input->post('to_date');
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['purchase']=$this->dahsboard_Model->ireport_attachment($cname,$fa,$aa,$m,$frm,$t);
- }
-
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- // if($this->DEPCode == MANAGEMENT)
- // {
- $this->loadviews("Report_attach_inward",$this->global,$data, NULL);
- // }
-
- // else
- // {
- // $this->loadViews("access", $this->global, $data, NULL);
- // }
-
-
-
- }
- public function iyear_wise()
- {
- $this->global['pageTitle'] = 'Siddharth : Reports';
-
-
- if ($this->input->post('financialyear')) {
- $ab=$this->input->post('financialyear');
- $a=substr($ab,0,-5);
- $b=substr($ab,5,5);
- $data['year']=$this->dahsboard_Model->ireport_year_wise($a,$b);
- $data['finyear']=$this->dahsboard_Model->report_finyear();
-
- //$this->loadviews("Report_year_wise",$this->global,$data, NULL);
- }
- $data['finyear']=$this->dahsboard_Model->report_finyear();
-
-
-
- $this->loadviews("Report_year_wise_inward",$this->global,$data, NULL);
-
- }
-
- public function imonth_wise()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
-
-
- $month=$this->input->get('dat');
- $mon= date("F",strtotime($month));
- //print_r($month);
- $data['mont']=$mon;
- $data['month']=$this->dahsboard_Model->ireport_month_wise($month);
- $this->loadviews("Report_month_wise_inward",$this->global,$data, NULL);
-
- }
- public function iyear_wise_total()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
-
- $last = $this->uri->total_segments();
- $month=$this->uri->segment($last);
- $a=substr($month,0,-5);
- $b=substr($month,5,5);
- //print_r($month);
- $data['year']=$month;
- $data['ytotal']=$this->dahsboard_Model->ireport_year_wise_total($a,$b);
- $this->loadviews("Report_year_wise_total_inward",$this->global,$data, NULL);
-
- }
-
- public function ipurchase_supplier()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- if ($this->input->post('btn_submit')) {
- $cname = $this->input->post('client_name');
- $ab=$this->input->post('financialyear');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- $m=$this->input->post('month');
- $frm = $this->input->post('from_date');
- $t = $this->input->post('to_date');
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['spurchse']=$this->dahsboard_Model->ireport_supplier($cname,$fa,$aa,$m,$frm,$t);
- }
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
-
-
-
- $this->loadviews("Report_supplier_inward",$this->global,$data, NULL);
-
-
-
-
-
- }
- public function iconsolidate()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- if ($this->input->post('btn_submit')) {
- $cname = $this->input->post('client_name');
- $ab=$this->input->post('financialyear');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['spurchse']=$this->dahsboard_Model->ireport_consolidate($cname,$fa,$aa);
- }
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
-
- $this->loadviews("Report_consolidate_inward",$this->global,$data, NULL);
-
- }
- public function i_consolidate_month()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //$this->input->post('btn_submit');
- $sid=$this->input->get('sid');
- $mid = $this->input->get('mid');
- $cname = $this->input->get('cname');
- $prod = $this->input->get('prod');
- //$mat = $this->input->get('mid');
- $m = $this->input->get('m');
- $ab=$this->input->get('ab');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['spurchse']=$this->dahsboard_Model->i_consolidate_month($m,$sid,$mid,$fa,$aa);
- // print_r( $data['spurchse']);
-
- $this->loadviews("Report_consolidate_month_inward",$this->global,$data, NULL);
-
-
- }
- public function i_consolidate_year()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //$this->input->post('btn_submit');
- $sid=$this->input->get('sid');
- $mid = $this->input->get('mid');
- $cname = $this->input->get('cname');
- $prod = $this->input->get('prod');
- //$mat = $this->input->get('mid');
- $ab=$this->input->get('ab');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['spurchse']=$this->dahsboard_Model->i_consolidate_year($sid,$mid,$fa,$aa);
- // print_r( $data['spurchse']);
-
- $this->loadviews("Report_consolidate_year_inward",$this->global,$data, NULL);
- // }
- // else
- // {
- // $this->loadViews("access", $this->global, $data, NULL);
- // }
-
- }
- public function icumulative()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
-
- //print_r($prod);
-
- $data['cum']=$this->dahsboard_Model->ireport_cumulative();
-
-
- $this->loadviews("Report_cumulative_inward",$this->global,$data, NULL);
-
-
-
- }
- public function icum_month()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- $last = $this->uri->segment_array();
-
- $sup = $last[3];
- $mat = $last[4];
- //print_r($prod);
-
- $data['cum_month']=$this->dahsboard_Model->ireport_cum_month($sup,$mat);
- $this->loadviews("Report_cumulative_month_inward",$this->global,$data, NULL);
-
- }
- public function icum_year()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- $last = $this->uri->segment_array();
-
- $sup = $last[3];
- $mat = $last[4];
+ public function ipurchase()
+ {
- //print_r($sup);
-
- $data['cum_year']=$this->dahsboard_Model->ireport_cum_year($sup,$mat);
- $this->loadviews("Report_cumulative_year_inward",$this->global,$data, NULL);
-
- }
- public function icum_day()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- $last = $this->uri->segment_array();
-
- $sup = $last[3];
- $mat = $last[4];
+ $this->global['pageTitle'] = 'Siddharth : Inward PO Reports';
+ if ($this->input->post('btn_submit')) {
+ $cname = $this->input->post('client_name');
+ $prod = $this->input->post('item_name');
+ $ab=$this->input->post('financialyear');
+ $cat = $this->input->get('cat');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ $m=$this->input->post('month');
+ $frm = $this->input->post('from_date');
+ $t = $this->input->post('to_date');
//print_r($prod);
-
- $data['cum_day']=$this->dahsboard_Model->ireport_cum_day($sup,$mat);
- $this->loadviews("Report_cumulative_day_inward",$this->global,$data, NULL);
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ // $data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['purchase']=$this->dahsboard_Model->ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat);
+ $data['cashbookdatas']=$this->dahsboard_Model->report_inwardcashbook($cname,$fa,$aa,$m,$frm,$t,$cat);
+ }
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+
+ $this->loadviews("Report_purchase_inward",$this->global,$data, NULL);
+
+ }
+ public function ilink_purchase()
+ {
+ if ($this->input->post('btn_submit')) {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward PO Reports';
+ //$this->input->post('btn_submit');
+ $cname = $this->input->post('client_name');
+ $prod = $this->input->post('item_name');
+ $ab=$this->input->post('financialyear');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ $m=$this->input->post('month');
+ $frm = $this->input->post('from_date');
+ $t = $this->input->post('to_date');
+ $sid=$this->input->get('sid');
+ $mid = $this->input->get('mid');
+ $d = $this->input->get('d');
+ //print_r($prod);
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['purchase']=$this->dahsboard_Model->ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d);
+
+
+ } else{
+ $this->global['pageTitle'] = 'Siddharth : Inward PO Reports';
+ //$this->input->post('btn_submit');
+ $cat = $this->input->get('cat');
+ $cname = $this->input->get('cname');
+ $prod = $this->input->get('prod');
+ $ab=$this->input->get('ab');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ $m=$this->input->get('m');
+ $frm = $this->input->get('frm');
+ $t = $this->input->get('t');
+ $sid=$this->input->get('sid');
+ $mid = $this->input->get('mid');
+ $d = $this->input->get('d');
+ $da = $this->input->get('da');
+ $po = $this->input->get('po');
+
+ //print_r($m);die();
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ $data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['purchase']=$this->dahsboard_Model->ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po);
+ }
+
+ $this->loadviews("Report_purchase_inward",$this->global,$data, NULL);
+
+ }
+ public function iattach()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Summary';
+ if ($this->input->post('btn_submit')) {
+ $cname = $this->input->post('client_name');
+ $ab=$this->input->post('financialyear');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ $m=$this->input->post('month');
+ $frm = $this->input->post('from_date');
+ $t = $this->input->post('to_date');
+ //print_r($prod);
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['purchase']=$this->dahsboard_Model->ireport_attachment($cname,$fa,$aa,$m,$frm,$t);
+ }
+
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ // if($this->DEPCode == MANAGEMENT)
+ // {
+ $this->loadviews("Report_attach_inward",$this->global,$data, NULL);
+ // }
+
+ // else
+ // {
+ // $this->loadViews("access", $this->global, $data, NULL);
+ // }
+
+
+
+ }
+ public function iyear_wise()
+ {
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Yearwise ';
+
+
+ if ($this->input->post('financialyear')) {
+ $ab=$this->input->post('financialyear');
+ $a=substr($ab,0,-5);
+ $b=substr($ab,5,5);
+ $data['year']=$this->dahsboard_Model->ireport_year_wise($a,$b);
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+
+ //$this->loadviews("Report_year_wise",$this->global,$data, NULL);
+ }
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+
+
+
+ $this->loadviews("Report_year_wise_inward",$this->global,$data, NULL);
+
+ }
+
+ public function imonth_wise()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Monthwise';
+
+
+ $month=$this->input->get('dat');
+ $mon= date("F",strtotime($month));
+ //print_r($month);
+ $data['mont']=$mon;
+ $data['month']=$this->dahsboard_Model->ireport_month_wise($month);
+ $this->loadviews("Report_month_wise_inward",$this->global,$data, NULL);
+
+ }
+ public function iyear_wise_total()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Yearwise';
+
+ $last = $this->uri->total_segments();
+ $month=$this->uri->segment($last);
+ $a=substr($month,0,-5);
+ $b=substr($month,5,5);
+ //print_r($month);
+ $data['year']=$month;
+ $data['ytotal']=$this->dahsboard_Model->ireport_year_wise_total($a,$b);
+ $this->loadviews("Report_year_wise_total_inward",$this->global,$data, NULL);
+
+ }
+
+ public function ipurchase_supplier()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Supplierwise';
+ if ($this->input->post('btn_submit')) {
+ $cname = $this->input->post('client_name');
+ $ab=$this->input->post('financialyear');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ $m=$this->input->post('month');
+ $frm = $this->input->post('from_date');
+ $t = $this->input->post('to_date');
+ //print_r($prod);
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['spurchse']=$this->dahsboard_Model->ireport_supplier($cname,$fa,$aa,$m,$frm,$t);
+ }
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+
+
+
+ $this->loadviews("Report_supplier_inward",$this->global,$data, NULL);
+
+ }
+
+ public function iconsolidate()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate';
+ if ($this->input->post('btn_submit')) {
+ $cname = $this->input->post('client_name');
+ $ab=$this->input->post('financialyear');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ //print_r($prod);
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['spurchse']=$this->dahsboard_Model->ireport_consolidate($cname,$fa,$aa);
+ }
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+
+ $this->loadviews("Report_consolidate_inward",$this->global,$data, NULL);
+
+ }
+ public function i_consolidate_month()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate-Monthwise';
+ //$this->input->post('btn_submit');
+ $sid=$this->input->get('sid');
+ $mid = $this->input->get('mid');
+ $cname = $this->input->get('cname');
+ $prod = $this->input->get('prod');
+ //$mat = $this->input->get('mid');
+ $m = $this->input->get('m');
+ $ab=$this->input->get('ab');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ //print_r($prod);
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['spurchse']=$this->dahsboard_Model->i_consolidate_month($m,$sid,$mid,$fa,$aa);
+ // print_r( $data['spurchse']);
+
+ $this->loadviews("Report_consolidate_month_inward",$this->global,$data, NULL);
+
+
+ }
+ public function i_consolidate_year()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate-Yearwise';
+ //$this->input->post('btn_submit');
+ $sid=$this->input->get('sid');
+ $mid = $this->input->get('mid');
+ $cname = $this->input->get('cname');
+ $prod = $this->input->get('prod');
+ //$mat = $this->input->get('mid');
+ $ab=$this->input->get('ab');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ //print_r($prod);
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['spurchse']=$this->dahsboard_Model->i_consolidate_year($sid,$mid,$fa,$aa);
+ // print_r( $data['spurchse']);
+
+ $this->loadviews("Report_consolidate_year_inward",$this->global,$data, NULL);
+ // }
+ // else
+ // {
+ // $this->loadViews("access", $this->global, $data, NULL);
+ // }
+
+ }
+ public function icumulative()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative ';
+
+ //print_r($prod);
+
+ $data['cum']=$this->dahsboard_Model->ireport_cumulative();
- }
- public function rawi_cumulative()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //print_r($prod);
-
- $data['cum']=$this->dahsboard_Model->rawi_report_cumulative();
+ $this->loadviews("Report_cumulative_inward",$this->global,$data, NULL);
+
-
- $this->loadviews("Report_cumulative_raw",$this->global,$data, NULL);
+
+ }
+ public function icum_month()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative-Monthwise';
+ $last = $this->uri->segment_array();
+
+ $sup = $last[3];
+ $mat = $last[4];
+ //print_r($prod);
+
+ $data['cum_month']=$this->dahsboard_Model->ireport_cum_month($sup,$mat);
+ $this->loadviews("Report_cumulative_month_inward",$this->global,$data, NULL);
+
+ }
+ public function icum_year()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative-Yearwise ';
+ $last = $this->uri->segment_array();
+
+ $sup = $last[3];
+ $mat = $last[4];
+
+ //print_r($sup);
+
+ $data['cum_year']=$this->dahsboard_Model->ireport_cum_year($sup,$mat);
+ $this->loadviews("Report_cumulative_year_inward",$this->global,$data, NULL);
+
+ }
+ public function icum_day()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative-Daywise ';
+ $last = $this->uri->segment_array();
+
+ $sup = $last[3];
+ $mat = $last[4];
+ //print_r($prod);
+
+ $data['cum_day']=$this->dahsboard_Model->ireport_cum_day($sup,$mat);
+ $this->loadviews("Report_cumulative_day_inward",$this->global,$data, NULL);
+
+ }
+ public function rawi_cumulative()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative Category-Wise';
+
+ //print_r($prod);
+
+ $data['cum']=$this->dahsboard_Model->rawi_report_cumulative();
+
+
+ $this->loadviews("Report_cumulative_raw",$this->global,$data, NULL);
+
+
+
+ }
+ public function rawi_cum_year()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative Year-Category-Wise';
+ //$mat=$this->input->get('mid');
+ $cat=$this->input->get('cat');
+ //print_r($sup);
+
+ $data['cum_year']=$this->dahsboard_Model->rawi_report_cum_year($cat);
+ $this->loadviews("Report_cumulative_year_raw",$this->global,$data, NULL);
+
+ }
+ public function rawi_cum_month()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Report - Cumulative Month-Category-Wise';
+ //$mat=$this->input->get('mid');
+ $cat=$this->input->get('cat');
+
+ //print_r($prod);
+
+ $data['cum_month']=$this->dahsboard_Model->rawi_report_cum_month($cat);
+ $this->loadviews("Report_cumulative_month_raw",$this->global,$data, NULL);
+
+ }
+ public function rawi_cum_day()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative Daily-Category-Wise';
+ //$mat=$this->input->get('mid');
+ $cat=$this->input->get('cat');
+ //print_r($prod);
+
+ $data['cum_day']=$this->dahsboard_Model->rawi_report_cum_day($cat);
+ $this->loadviews("Report_cumulative_day_raw",$this->global,$data, NULL);
+
+ }
+ public function rawi_consolidate()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Report - Consolidate ';
+ if ($this->input->post('btn_submit')) {
+ $cname = $this->input->post('client_name');
+ $ab=$this->input->post('financialyear');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ //print_r($prod);
+ $data['material']=$this->dahsboard_Model->category();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['spurchse']=$this->dahsboard_Model->rawi_report_consolidate($cname,$fa,$aa);
+ }
+ $data['material']=$this->dahsboard_Model->category();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+
+ $this->loadviews("Report_consolidate_raw",$this->global,$data, NULL);
-
- }
- public function rawi_cum_year()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //$mat=$this->input->get('mid');
- $cat=$this->input->get('cat');
- //print_r($sup);
-
- $data['cum_year']=$this->dahsboard_Model->rawi_report_cum_year($cat);
- $this->loadviews("Report_cumulative_year_raw",$this->global,$data, NULL);
-
- }
- public function rawi_cum_month()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //$mat=$this->input->get('mid');
- $cat=$this->input->get('cat');
-
- //print_r($prod);
-
- $data['cum_month']=$this->dahsboard_Model->rawi_report_cum_month($cat);
- $this->loadviews("Report_cumulative_month_raw",$this->global,$data, NULL);
-
- }
- public function rawi_cum_day()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //$mat=$this->input->get('mid');
- $cat=$this->input->get('cat');
- //print_r($prod);
-
- $data['cum_day']=$this->dahsboard_Model->rawi_report_cum_day($cat);
- $this->loadviews("Report_cumulative_day_raw",$this->global,$data, NULL);
-
- }
- public function rawi_consolidate()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- if ($this->input->post('btn_submit')) {
- $cname = $this->input->post('client_name');
- $ab=$this->input->post('financialyear');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->category();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['spurchse']=$this->dahsboard_Model->rawi_report_consolidate($cname,$fa,$aa);
- }
- $data['material']=$this->dahsboard_Model->category();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
-
- $this->loadviews("Report_consolidate_raw",$this->global,$data, NULL);
+ }
+ public function rawi_consolidate_month()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate Month-Wise';
+ //$this->input->post('btn_submit');
+ $cat = $this->input->get('cat');
+ $sup = $this->input->get('sup');
+ //$mat = $this->input->get('mid');
+ $m = $this->input->get('m');
+ $ab=$this->input->get('ab');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ //print_r($prod);
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_month($m,$cat,$sup,$fa,$aa);
+ // print_r( $data['spurchse']);
+ $this->loadviews("Report_consolidate_month",$this->global,$data, NULL);
+
- }
- public function rawi_consolidate_month()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //$this->input->post('btn_submit');
- $cat = $this->input->get('cat');
- $sup = $this->input->get('sup');
- //$mat = $this->input->get('mid');
- $m = $this->input->get('m');
- $ab=$this->input->get('ab');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_month($m,$cat,$sup,$fa,$aa);
- // print_r( $data['spurchse']);
-
- $this->loadviews("Report_consolidate_month",$this->global,$data, NULL);
-
+ }
+ public function rawi_consolidate_year()
+ {
+
+ $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate Year-Wise';
+ //$this->input->post('btn_submit');
+ $cat = $this->input->get('cat');
+ $sup = $this->input->get('sup');
+ //$mat = $this->input->get('mid');
+ $ab=$this->input->get('ab');
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ //print_r($prod);
+ $data['material']=$this->dahsboard_Model->material_name();
+ $data['cust']=$this->dahsboard_Model->customer_name();
+ //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
+ $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
+ $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_year($cat,$sup,$fa,$aa);
+ // print_r( $data['spurchse']);
+
+ $this->loadviews("Report_consolidate_year",$this->global,$data, NULL);
+
- }
- public function rawi_consolidate_year()
- {
-
- $this->global['pageTitle'] = 'Siddharth : Reports';
- //$this->input->post('btn_submit');
- $cat = $this->input->get('cat');
- $sup = $this->input->get('sup');
- //$mat = $this->input->get('mid');
- $ab=$this->input->get('ab');
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- //print_r($prod);
- $data['material']=$this->dahsboard_Model->material_name();
- $data['cust']=$this->dahsboard_Model->customer_name();
- $data['finyear']=$this->dahsboard_Model->report_finyear();
- $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_year($cat,$sup,$fa,$aa);
- // print_r( $data['spurchse']);
-
- $this->loadviews("Report_consolidate_year",$this->global,$data, NULL);
-
-
- }
- public function pending_purchase()
+ }
+ public function pending_purchase()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php
index 6ac05dde..8a8304ff 100755
--- a/application/models/dahsboard_model.php
+++ b/application/models/dahsboard_model.php
@@ -1092,6 +1092,21 @@ GROUP BY financial_year";
}
+
+ function ireport_finyear(){
+
+ $sql="SELECT
+ CASE WHEN MONTH(MaterialRcvdDate)>=4
+ THEN concat(YEAR(MaterialRcvdDate), '-',YEAR(MaterialRcvdDate)+1)
+ ELSE concat(YEAR(MaterialRcvdDate)-1,'-', YEAR(MaterialRcvdDate))
+ END AS financial_year
+ FROM T_IGR_Master
+ GROUP BY financial_year";
+ $query = $this->db->query($sql);
+ return $query->result();
+
+ }
+
function report_year_wise($a=null, $b=null){
@@ -1425,10 +1440,10 @@ group by supplier_name,material_name";
$query = $this->db->query($sql);
return $query->result();
}
- function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){
+ function ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat){
- $sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, sum(id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,
+ $sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, sum(id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,
round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
@@ -1448,27 +1463,27 @@ round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
round((
- if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
+if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
- round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
- im.file as ifile,pb.FilePath as file
+ sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
+ im.file as ifile,pb.FilePath as file
from T_IGR_Master im
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
@@ -1481,54 +1496,58 @@ left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
where pm.Status != 'ST030' ";
if ($cname!= ''){
+
+ $sql.="and sd.SupplierName = '".$cname."'";
- $sql.="and sd.SupplierName = '".$cname."'";
-
- }
-
-
-
- if ($fa and $aa != ''){
+ }
- $sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
-
- }
- if ($m!= ''){
- $sql.="and monthname(im.CreatedDate) = '".$m."'";
-
- }
-
- if ($frm and $t != ''){
- $fromd= date("Y-m-d",strtotime($frm));
- $tod=date("Y-m-d",strtotime($t));
- $sql.="and date(im.CreatedDate) >= '".$fromd."'
- and date(im.CreatedDate) <= '".$tod."'";
-
- }
- if ($prod!= ''){
+ if ($fa and $aa != ''){
+
+ //$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
+ $sql.=" and (im.MaterialRcvdDate >= '".$fa."-04-01' and im.MaterialRcvdDate <= '".$aa."-03-31')";
- $sql.=" and mm.MaterialName = '".$prod."' ";
-
- }
- if ($cat!= ''){
+ }
+ if ($m!= ''){
+
+ //$sql.="and monthname(im.CreatedDate) = '".$m."'";
+ $sql.="and monthname(im.MaterialRcvdDate) = '".$m."'";
+
+ }
+
+ if ($frm and $t != ''){
+ $fromd= date("Y-m-d",strtotime($frm));
+ $tod=date("Y-m-d",strtotime($t));
+
+ // $sql.="and date(im.CreatedDate) >= '".$fromd."'
+ // and date(im.CreatedDate) <= '".$tod."'";
+ $sql.="and date(im.MaterialRcvdDate) >= '".$fromd."'
+ and date(im.MaterialRcvdDate) <= '".$tod."'";
+
+ }
+ if ($prod!= ''){
+
+ $sql.=" and mm.MaterialName = '".$prod."' ";
+
+ }
+ if ($cat!= ''){
+
+ $sql.=" and mm.Category = '".$cat."' ";
+
+ }
- $sql.=" and mm.Category = '".$cat."' ";
-
- }
-
$sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
//echo $sql;
- $query = $this->db->query($sql);
- return $query->result();
- }
- function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po){
-
-
- $sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, sum(id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po){
+
+
+ $sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as pono,date_format(im.CreatedDate,'%d-%m-%Y') as created_date,TIME_FORMAT(im.CreatedDate,'%l:%i %p') as created_time,mm.MaterialName as material_name,mm.Category as category,sd.SupplierName as supplier_name,mm.UOM as UOM, sum(id.QuantityAsPerInvoice) as quantity,pl.Rate as rate,round(sum(id.QuantityAsPerInvoice) * pl.Rate,2) as value,if(POType = 'IMPORT' or POType = 'CAPITAL',sum(pm.ExchangeRate),0) as exchange_rate,date_format(im.MaterialRcvdDate,'%d-%m-%Y') as materialrcvddate,
round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst,
@@ -1548,27 +1567,27 @@ round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
round((
- if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
+if(POType = 'IMPORT',sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
+ sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
- round(ifnull(if(POType = 'REVENUE',
- sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
- sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
- im.file as ifile,pb.FilePath as file
+ sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
+ sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
+ im.file as ifile,pb.FilePath as file
from T_IGR_Master im
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
@@ -1581,164 +1600,188 @@ left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
where pm.Status != 'ST030' ";
if ($cname!= ''){
+
+ $sql.="and sd.SupplierName = '".$cname."'";
- $sql.="and sd.SupplierName = '".$cname."'";
-
- }
-
-
-
- if ($fa and $aa != ''){
+ }
- $sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
-
- }
- if ($m!= ''){
- $sql.="and monthname(im.CreatedDate) = '".$m."'";
-
- }
-
- if ($frm and $t != ''){
- $fromd= date("Y-m-d",strtotime($frm));
- $tod=date("Y-m-d",strtotime($t));
- $sql.="and date(im.CreatedDate) >= '".$fromd."'
- and date(im.CreatedDate) <= '".$tod."'";
-
- }
- if ($prod!= ''){
+ if ($fa and $aa != ''){
+
+ //$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
+ $sql.=" and (im.MaterialRcvdDate >= '".$fa."-04-01' and im.MaterialRcvdDate <= '".$aa."-03-31')";
- $sql.=" and mm.MaterialName = '".$prod."' ";
-
- }
- if ($sid!= ''){
+ }
+ if ($m!= ''){
+
+ //$sql.="and monthname(im.CreatedDate) = '".$m."'";
+ $sql.="and monthname(im.MaterialRcvdDate) = '".$m."'";
- $sql.=" and sd.SupplierID = '".$sid."' ";
-
- }
- if ($mid!= ''){
+ }
- $sql.=" and mm.MaterialCode = '".$mid."' ";
-
- }
- if ($d!= ''){
+ if ($frm and $t != ''){
+ $fromd= date("Y-m-d",strtotime($frm));
+ $tod=date("Y-m-d",strtotime($t));
+
+ // $sql.="and date(im.CreatedDate) >= '".$fromd."'
+ // and date(im.CreatedDate) <= '".$tod."'";
+
+ $sql.="and date(im.MaterialRcvdDate) >= '".$fromd."'
+ and date(im.MaterialRcvdDate) <= '".$tod."'";
- $sql.=" and date(im.CreatedDate) = '".$d."' ";
-
- }
- if ($cat!= ''){
+ }
+ if ($prod!= ''){
+
+ $sql.=" and mm.MaterialName = '".$prod."' ";
- $sql.=" and mm.Category = '".$cat."' ";
-
- }
- if ($da!= ''){
- $ddd= date("Y-m-d",strtotime($da));
- $sql.=" and date(im.CreatedDate) = '".$ddd."' ";
-
- }
- if ($po!= ''){
+ }
+ if ($sid!= ''){
+
+ $sql.=" and sd.SupplierID = '".$sid."' ";
- $sql.=" and im.PONO = '".$po."' ";
-
- }
+ }
+ if ($mid!= ''){
+
+ $sql.=" and mm.MaterialCode = '".$mid."' ";
+
+ }
+ if ($d!= ''){
+
+ //$sql.=" and date(im.CreatedDate) = '".$d."' ";
+ $sql.=" and date(im.MaterialRcvdDate) = '".$d."' ";
+
+ }
+ if ($cat!= ''){
+
+ $sql.=" and mm.Category = '".$cat."' ";
+
+ }
+ if ($da!= ''){
+ $ddd= date("Y-m-d",strtotime($da));
+ //$sql.=" and date(im.CreatedDate) = '".$ddd."' ";
+ $sql.=" and date(im.MaterialRcvdDate) = '".$ddd."' ";
+
+ }
+ if ($po!= ''){
+
+ $sql.=" and im.PONO = '".$po."' ";
+
+ }
+
$sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
// echo $m;
// echo $sid;
//echo $sql;
- $query = $this->db->query($sql);
- return $query->result();
- }
- function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){
-
-
- $sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name,
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){
+
+
+ $sql="select pono,potype,date_format(created_date,'%d-%m-%Y') as created_date,date_format(materialrcvddate,'%d-%m-%Y') as materialrcvddate,supplier_name,
sum(total) as total,file,ifile
from igr
where status != 'ST030'
";
if ($cname!= ''){
+
+ $sql.="and supplier_name = '".$cname."'";
- $sql.="and supplier_name = '".$cname."'";
-
- }
-
-
-
- if ($fa and $aa != ''){
+ }
- $sql.=" and (created_date >= '".$fa."-04-01' and created_date <= '".$aa."-03-31')";
-
- }
- if ($m!= ''){
- $sql.="and monthname(created_date) = '".$m."'";
-
- }
-
- if ($frm and $t != ''){
- $fromd= date("Y-m-d",strtotime($frm));
- $tod=date("Y-m-d",strtotime($t));
- $sql.="and date(created_date) >= '".$fromd."'
- and date(created_date) <= '".$tod."'";
-
- }
+ if ($fa and $aa != ''){
+
+ //$sql.=" and (created_date >= '".$fa."-04-01' and created_date <= '".$aa."-03-31')";
+ $sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
- $sql.="group by pono,igrn";
+ }
+ if ($m!= ''){
+
+ //$sql.="and monthname(created_date) = '".$m."'";
+ $sql.="and monthname(materialrcvddate) = '".$m."'";
+
+ }
+
+ if ($frm and $t != ''){
+ $fromd= date("Y-m-d",strtotime($frm));
+ $tod=date("Y-m-d",strtotime($t));
+
+ // $sql.="and date(created_date) >= '".$fromd."'
+ // and date(created_date) <= '".$tod."'";
+ $sql.="and date(materialrcvddate) >= '".$fromd."'
+ and date(materialrcvddate) <= '".$tod."'";
+
+ }
+
+ $sql.="group by pono,igrn";
// echo $m;
// echo $sid;
//echo $sql;
- $query = $this->db->query($sql);
- return $query->result();
- }
-
- function ireport_year_wise($a,$b){
-
-
- $sql="select dat as CreatedDate,sum(quantity)as quantity,sum(value) as value
-from year_inward
-where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31'
-group by month(CreatedDate)
-";
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+
+function ireport_year_wise($a,$b){
+
+
+// $sql="select dat as CreatedDate,sum(quantity)as quantity,sum(value) as value, materialrcvddate
+// from year_inward
+// where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31'
+// group by month(CreatedDate)
+// ";
//echo $sql;
- $query = $this->db->query($sql);
- return $query->result();
-
-
-
- }
+ $sql="select dat as CreatedDate,sum(quantity)as quantity,sum(value) as value,materialrcvddate
+ from year_inward
+ where status != 'ST030' and date(materialrcvddate) >= '$a-04-01' and date(materialrcvddate) <= '$b-03-31'
+ group by month(materialrcvddate)";
+ $query = $this->db->query($sql);
+ return $query->result();
+
+
+
+ }
+
+ function ireport_month_wise($mont){
+ $month= date("m",strtotime($mont));
+ $year = date("Y",strtotime($mont));
+
+ // $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total
+ // from year_inward
+ // where status != 'ST030' and month(dat)= ? and year(dat) = ?
+ // group by material_name,supplier_name";
+ $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total,materialrcvddate
+ from year_inward
+ where status != 'ST030' and month(materialrcvddate)= ? and year(materialrcvddate) = ?
+ group by material_name,supplier_name";
+ $query = $this->db->query($sql,array($month,$year));
+ return $query->result();
+ }
+ function ireport_year_wise_total($a,$b){
+
+// $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total
+// from year_inward
+// where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31'
+// group by material_name,supplier_name";
+ $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total,materialrcvddate
+ from year_inward
+ where status != 'ST030' and date(materialrcvddate) >= '$a-04-01' and date(materialrcvddate) <= '$b-03-31'
+ group by material_name,supplier_name";
+ $query = $this->db->query($sql,array());
+ return $query->result();
+ }
+
+function ireport_supplier($cname,$fa,$aa,$m,$frm,$t){
+
+
+ $sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(im.PONO) as counts,ifnull(sum(id.QuantityAsPerInvoice),0) as quantity,round(ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0),2) as value,
- function ireport_month_wise($mont){
- $month= date("m",strtotime($mont));
- $year = date("Y",strtotime($mont));
-
- $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total
-from year_inward
-where status != 'ST030' and month(dat)= ? and year(dat) = ?
-group by material_name,supplier_name";
- $query = $this->db->query($sql,array($month,$year));
- return $query->result();
- }
- function ireport_year_wise_total($a,$b){
-
- $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total
-from year_inward
-where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31'
-group by material_name,supplier_name";
- $query = $this->db->query($sql,array());
- return $query->result();
- }
-
- function ireport_supplier($cname,$fa,$aa,$m,$frm,$t){
-
-
- $sql="SELECT sd.SupplierID as sid,sd.SupplierName as supplier_name,count(im.PONO) as counts,ifnull(sum(id.QuantityAsPerInvoice),0) as quantity,round(ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0),2) as value,
-
case pm.POType
when 'IMPORT'
then ifnull((sum((id.QuantityAsPerInvoice * pl.Rate) * pm.ExchangeRate)
@@ -1775,55 +1818,59 @@ then ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)
+ ifnull(rt.Insurance,0)
end
- as total
+as total,im.MaterialRcvdDate
from T_IGR_Master im
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
- join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
- join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
- left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
- left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
- left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
- left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
- left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
- where pm.Status != 'ST030'";
+join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
+join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
+left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
+left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
+left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
+left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
+left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
+where pm.Status != 'ST030'";
if ($cname!= ''){
+
+ $sql.="and sd.SupplierName = '".$cname."'";
- $sql.="and sd.SupplierName = '".$cname."'";
-
- }
-
-
-
- if ($fa and $aa != ''){
+ }
- $sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
-
- }
- if ($m!= ''){
- $sql.="and monthname(im.CreatedDate) = '".$m."'";
-
- }
-
- if ($frm and $t != ''){
- $fromd= date("Y-m-d",strtotime($frm));
- $tod=date("Y-m-d",strtotime($t));
- $sql.="and date(im.CreatedDate) >= '".$fromd."'
- and date(im.CreatedDate) <= '".$tod."'";
-
- }
- $sql.= "group by supplier_name";
- //echo $sql;
- $query = $this->db->query($sql);
- return $query->result();
-
- }
- function ireport_consolidate($cname,$fa,$aa){
-
-
- $sql="select sid,mid,supplier_name,material_name,
+ if ($fa and $aa != ''){
+
+ //$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
+ $sql.=" and (im.MaterialRcvdDate >= '".$fa."-04-01' and im.MaterialRcvdDate <= '".$aa."-03-31')";
+
+ }
+ if ($m!= ''){
+
+ //$sql.="and monthname(im.CreatedDate) = '".$m."'";
+ $sql.="and monthname(im.MaterialRcvdDate) = '".$m."'";
+
+ }
+
+ if ($frm and $t != ''){
+ $fromd= date("Y-m-d",strtotime($frm));
+ $tod=date("Y-m-d",strtotime($t));
+
+ // $sql.="and date(im.CreatedDate) >= '".$fromd."'
+ // and date(im.CreatedDate) <= '".$tod."'";
+ $sql.="and date(im.MaterialRcvdDate) >= '".$fromd."'
+ and date(im.MaterialRcvdDate) <= '".$tod."'";
+
+ }
+ $sql.= "group by supplier_name";
+ //echo $sql;
+ $query = $this->db->query($sql);
+ return $query->result();
+
+ }
+function ireport_consolidate($cname,$fa,$aa){
+
+
+ $sql="select sid,mid,supplier_name,material_name,
SUM(IF(month(dat) = 4, quantity, 0)) AS April,
SUM(IF(month(dat) = 5, quantity, 0)) AS May,
SUM(IF(month(dat) = 6, quantity, 0)) AS June,
@@ -1854,206 +1901,209 @@ FROM year_inward
where status != 'ST030' ";
if ($cname!= ''){
+
+ $sql.="and supplier_name = '".$cname."'";
- $sql.="and supplier_name = '".$cname."'";
-
- }
-
-
-
- if ($fa and $aa != ''){
+ }
- $sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
-
- }
-
- $sql.= "group by supplier_name,material_name";
- // echo $sql;
- $query = $this->db->query($sql);
- return $query->result();
-
- }
- function i_consolidate_month($m=null,$sid=null,$mid=null,$fa=null,$aa=null){
-
- $sql="select sid,mid,supplier_name,material_name,sum(quantity) as quantity,sum(value) as total
+
+
+ if ($fa and $aa != ''){
+
+ // $sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
+ $sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
+
+ }
+
+ $sql.= "group by supplier_name,material_name";
+ // echo $sql;
+ $query = $this->db->query($sql);
+ return $query->result();
+
+ }
+function i_consolidate_month($m=null,$sid=null,$mid=null,$fa=null,$aa=null){
+
+ $sql="select sid,mid,supplier_name,material_name,sum(quantity) as quantity,sum(value) as total
from year_inward
where status != 'ST030' and
monthname(dat) = '".$m."' and sid = '".$sid."' and mid = '".$mid."' ";
if ($fa and $aa != ''){
+
+ //$sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
+ $sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
- $sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
-
- }
- $sql.= "group by supplier_name,material_name";
- $query = $this->db->query($sql);
- //echo $sql;
- return $query->result();
- }
- function i_consolidate_year($sid=null,$mid=null,$fa=null,$aa=null){
-
- $sql="select sid,mid,supplier_name,material_name,sum(quantity) as quantity,sum(value) as total
+ }
+ $sql.= "group by supplier_name,material_name";
+ $query = $this->db->query($sql);
+ //echo $sql;
+ return $query->result();
+ }
+ function i_consolidate_year($sid=null,$mid=null,$fa=null,$aa=null){
+
+ $sql="select sid,mid,supplier_name,material_name,sum(quantity) as quantity,sum(value) as total
from year_inward
where status != 'ST030' and sid = '".$sid."' and mid = '".$mid."' ";
if ($fa and $aa != ''){
+
+ //$sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
+ $sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
- $sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
-
- }
- $sql.= "group by supplier_name,material_name";
- $query = $this->db->query($sql);
- //echo $sql;
- return $query->result();
- }
- function ireport_cumulative(){
- if (date('m') >= 4) {
- $yearl = date('Y').'-'.(date('Y')+1);
- } else {
- $yearl = (date('Y')-1).'-'.date('Y');
- }
- $ab=$yearl;
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- $sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal
-FROM (SELECT sid,mid,supplier_name,material_name,sum(Quantity) as quantity,sum(value) as total
+ }
+ $sql.= "group by supplier_name,material_name";
+ $query = $this->db->query($sql);
+ //echo $sql;
+ return $query->result();
+ }
+ function ireport_cumulative(){
+ if (date('m') >= 4) {
+ $yearl = date('Y').'-'.(date('Y')+1);
+ } else {
+ $yearl = (date('Y')-1).'-'.date('Y');
+ }
+ $ab=$yearl;
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ $sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal
+FROM (SELECT sid,mid,supplier_name,material_name,sum(Quantity) as quantity,sum(value) as total,materialrcvddate
FROM year_inward
where status != 'ST030' and
-(dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')
+(materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
group by supplier_name,material_name
) as year left join
(SELECT sid,mid,supplier_name,material_name,sum(Quantity) as mquantity,sum(value) as mtotal
FROM year_inward
where status != 'ST030' and
-month(dat) = month(current_date())
+month(materialrcvddate) = month(current_date())
group by supplier_name,material_name
) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name
left join
(SELECT sid,mid,supplier_name,material_name,sum(Quantity) as tquantity,sum(value) as ttotal
FROM year_inward
where status != 'ST030' and
-date(dat) = current_date()
+date(materialrcvddate) = current_date()
group by supplier_name,material_name
) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name
group by supplier_name,material_name
";
- $query = $this->db->query($sql);
- return $query->result();
- }
- function ireport_cum_month($sup=null,$mat=null){
-
- $sql="SELECT sid,mid,supplier_name,material_name,sum(Quantity) as tquantity,sum(value) as ttotal
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ function ireport_cum_month($sup=null,$mat=null){
+
+ $sql="SELECT sid,mid,supplier_name,material_name,sum(Quantity) as tquantity,sum(value) as ttotal
FROM year_inward
where status != 'ST030' and
-month(dat) = month(current_date()) and sid = '".$sup."' and mid = '".$mat."'
+month(materialrcvddate) = month(current_date()) and sid = '".$sup."' and mid = '".$mat."'
group by supplier_name,material_name";
- $query = $this->db->query($sql);
- return $query->result();
- }
- function ireport_cum_year($sup=null,$mat=null){
- if (date('m') >= 4) {
- $yearl = date('Y').'-'.(date('Y')+1);
- } else {
- $yearl = (date('Y')-1).'-'.date('Y');
- }
- $ab=$yearl;
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- $sql="SELECT sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ function ireport_cum_year($sup=null,$mat=null){
+ if (date('m') >= 4) {
+ $yearl = date('Y').'-'.(date('Y')+1);
+ } else {
+ $yearl = (date('Y')-1).'-'.date('Y');
+ }
+ $ab=$yearl;
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ $sql="SELECT sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
FROM year_inward
where status != 'ST030' and
-(dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')
- and sid = '".$sup."' and mid= '".$mat."'
+(materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
+and sid = '".$sup."' and mid= '".$mat."'
group by supplier_name,material_name
";
- $query = $this->db->query($sql);
- return $query->result();
- }
- function ireport_cum_day($sup=null,$mat=null){
-
- $sql="SELECT sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ function ireport_cum_day($sup=null,$mat=null){
+
+ $sql="SELECT sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
FROM year_inward
where status != 'ST030' and
-date(dat) = current_date() and sid = '".$sup."' and mid = '".$mat."'
+date(materialrcvddate) = current_date() and sid = '".$sup."' and mid = '".$mat."'
group by supplier_name,material_name";
- $query = $this->db->query($sql);
- return $query->result();
- }
- function rawi_report_cumulative(){
- if (date('m') >= 4) {
- $yearl = date('Y').'-'.(date('Y')+1);
- } else {
- $yearl = (date('Y')-1).'-'.date('Y');
- }
- $ab=$yearl;
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- $sql="SELECT year.category as category,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ function rawi_report_cumulative(){
+ if (date('m') >= 4) {
+ $yearl = date('Y').'-'.(date('Y')+1);
+ } else {
+ $yearl = (date('Y')-1).'-'.date('Y');
+ }
+ $ab=$yearl;
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ $sql="SELECT year.category as category,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal
FROM (SELECT category,sum(Quantity) as quantity,sum(value) as total
FROM year_inward
where status != 'ST030' and
-(dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')
+(materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
group by category
) as year left join
(SELECT category,sum(Quantity) as mquantity,sum(value) as mtotal
FROM year_inward
where status != 'ST030' and
-month(dat) = month(current_date())
+month(materialrcvddate) = month(current_date())
group by category
) as month on month.category=year.category
left join
(SELECT category,sum(Quantity) as tquantity,sum(value) as ttotal
FROM year_inward
where status != 'ST030' and
-date(dat) = current_date()
+date(materialrcvddate) = current_date()
group by category
) as today on today.category=month.category
group by category ";
- $query = $this->db->query($sql);
- return $query->result();
- }
- function rawi_report_cum_year($cat=null){
- if (date('m') >= 4) {
- $yearl = date('Y').'-'.(date('Y')+1);
- } else {
- $yearl = (date('Y')-1).'-'.date('Y');
- }
- $ab=$yearl;
- $fa=substr($ab,0,-5);
- $aa=substr($ab,5,5);
- $sql="SELECT category,sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ function rawi_report_cum_year($cat=null){
+ if (date('m') >= 4) {
+ $yearl = date('Y').'-'.(date('Y')+1);
+ } else {
+ $yearl = (date('Y')-1).'-'.date('Y');
+ }
+ $ab=$yearl;
+ $fa=substr($ab,0,-5);
+ $aa=substr($ab,5,5);
+ $sql="SELECT category,sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
FROM year_inward
where status != 'ST030' and
-(dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')
- and category = '".$cat."'
+(materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
+and category = '".$cat."'
group by supplier_name,material_name";
- $query = $this->db->query($sql);
- //echo $sql;
- return $query->result();
- }
- function rawi_report_cum_month($cat=null){
-
- $sql="SELECT category,sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
+ $query = $this->db->query($sql);
+ //echo $sql;
+ return $query->result();
+ }
+ function rawi_report_cum_month($cat=null){
+
+ $sql="SELECT category,sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
FROM year_inward
where status != 'ST030' and
-month(dat) = month(current_date()) and category = '".$cat."'
+month(materialrcvddate) = month(current_date()) and category = '".$cat."'
group by supplier_name,material_name";
- $query = $this->db->query($sql);
- return $query->result();
- }
- function rawi_report_cum_day($cat=null){
-
- $sql="SELECT category,sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
+ $query = $this->db->query($sql);
+ return $query->result();
+ }
+ function rawi_report_cum_day($cat=null){
+
+ $sql="SELECT category,sid,mid,supplier_name,material_name,IF(Quantity IS NULL or Quantity = '', 0, sum(Quantity)) as tquantity,sum(value) as ttotal
FROM year_inward
where status != 'ST030' and
-date(dat) = current_date() and category = '".$cat."'
+date(materialrcvddate) = current_date() and category = '".$cat."'
group by supplier_name,material_name";
- $query = $this->db->query($sql);
- //echo $sql;
- return $query->result();
- }
- function rawi_report_consolidate($cname,$fa,$aa){
-
-
- $sql="select sid,mid,category,supplier_name,material_name,
+ $query = $this->db->query($sql);
+ //echo $sql;
+ return $query->result();
+ }
+ function rawi_report_consolidate($cname,$fa,$aa){
+
+
+ $sql="select sid,mid,category,supplier_name,material_name,
SUM(IF(month(dat) = 4, quantity, 0)) AS April,
SUM(IF(month(dat) = 5, quantity, 0)) AS May,
SUM(IF(month(dat) = 6, quantity, 0)) AS June,
@@ -2084,61 +2134,62 @@ FROM year_inward
where status != 'ST030' ";
if ($cname!= ''){
+
+ $sql.="and Category = '".$cname."'";
- $sql.="and Category = '".$cname."'";
-
- }
-
-
-
- if ($fa and $aa != ''){
+ }
- $sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
-
- }
-
- $sql.= "group by category";
- //echo $sql;
- $query = $this->db->query($sql);
- return $query->result();
-
- }
- function rawi_consolidate_month($m=null,$cat=null,$sup=null,$fa=null,$aa=null){
-
- $sql="select category,sid,supplier_name,mid,material_name,
+
+
+ if ($fa and $aa != ''){
+
+ //$sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
+ $sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
+
+ }
+
+ $sql.= "group by category";
+ //echo $sql;
+ $query = $this->db->query($sql);
+ return $query->result();
+
+ }
+function rawi_consolidate_month($m=null,$cat=null,$sup=null,$fa=null,$aa=null){
+
+ $sql="select category,sid,supplier_name,mid,material_name,
sum(Quantity) as quantity,
sum(value) as total
FROM year_inward
where status != 'ST030' and
-monthname(dat) = '".$m."' and category = '".$cat."' ";
+monthname(materialrcvddate) = '".$m."' and category = '".$cat."' ";
if ($fa and $aa != ''){
+
+ $sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
- $sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
-
- }
- $sql.= "group by category,supplier_name,material_name";
- $query = $this->db->query($sql);
- //echo $sql;
- return $query->result();
- }
- function rawi_consolidate_year($cat=null,$sup=null,$fa=null,$aa=null){
-
- $sql="select category,sid,supplier_name,mid,material_name,
+ }
+ $sql.= "group by category,supplier_name,material_name";
+ $query = $this->db->query($sql);
+ //echo $sql;
+ return $query->result();
+ }
+ function rawi_consolidate_year($cat=null,$sup=null,$fa=null,$aa=null){
+
+ $sql="select category,sid,supplier_name,mid,material_name,
sum(Quantity) as quantity,
sum(value) as total
FROM year_inward
where status != 'ST030' and
category = '".$cat."' ";
if ($fa and $aa != ''){
+
+ $sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
- $sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')";
-
- }
- $sql.= "group by category,supplier_name,material_name";
- $query = $this->db->query($sql);
- //echo $sql;
- return $query->result();
- }
+ }
+ $sql.= "group by category,supplier_name,material_name";
+ $query = $this->db->query($sql);
+ //echo $sql;
+ return $query->result();
+ }
function pending_purchase($cname,$prod,$fa,$aa,$m,$frm,$t){
$sql="select po.PONO as po,date_format(po.PODate,'%d-%m-%Y') as pdate,sup.SupplierName as supplier,mm.MaterialName as material,mm.Category as category,pl.Quantity as quantity,pl.ReceivedQuantity as received, (pl.Quantity - pl.ReceivedQuantity) as pending
diff --git a/application/views/Report_purchase_inward.php b/application/views/Report_purchase_inward.php
index b340fbee..146b512d 100755
--- a/application/views/Report_purchase_inward.php
+++ b/application/views/Report_purchase_inward.php
@@ -3,12 +3,10 @@
$("#client_name").select2();
$("#item_name").select2();
-
-
- });
+
+});
-