material rcvd date change in inward report screen

This commit is contained in:
venbatechnologies@gmail.com 2018-06-04 10:40:15 +05:30
parent 8a1f14ef39
commit e5e20c226a
3 changed files with 934 additions and 893 deletions

View File

@ -523,460 +523,469 @@ class report extends BaseController
echo json_encode($data); echo json_encode($data);
} }
public function ipurchase() public function ipurchase()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward PO Reports';
if ($this->input->post('btn_submit')) { if ($this->input->post('btn_submit')) {
$cname = $this->input->post('client_name'); $cname = $this->input->post('client_name');
$prod = $this->input->post('item_name'); $prod = $this->input->post('item_name');
$ab=$this->input->post('financialyear'); $ab=$this->input->post('financialyear');
$cat = $this->input->get('cat'); $cat = $this->input->get('cat');
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,5); $aa=substr($ab,5,5);
$m=$this->input->post('month'); $m=$this->input->post('month');
$frm = $this->input->post('from_date'); $frm = $this->input->post('from_date');
$t = $this->input->post('to_date'); $t = $this->input->post('to_date');
//print_r($prod); //print_r($prod);
$data['material']=$this->dahsboard_Model->material_name(); $data['material']=$this->dahsboard_Model->material_name();
$data['cust']=$this->dahsboard_Model->customer_name(); $data['cust']=$this->dahsboard_Model->customer_name();
$data['finyear']=$this->dahsboard_Model->report_finyear(); // $data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
$data['purchase']=$this->dahsboard_Model->ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$cat); $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
$data['cashbookdatas']=$this->dahsboard_Model->report_inwardcashbook($cname,$fa,$aa,$m,$frm,$t,$cat); $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['material']=$this->dahsboard_Model->material_name();
$data['finyear']=$this->dahsboard_Model->report_finyear(); $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); $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 ilink_purchase()
{
if ($this->input->post('btn_submit')) {
$this->global['pageTitle'] = 'Siddharth : Reports'; }
//$this->input->post('btn_submit'); public function iattach()
$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);
$this->global['pageTitle'] = 'Siddharth : Inward Reports - Summary';
} else{ if ($this->input->post('btn_submit')) {
$this->global['pageTitle'] = 'Siddharth : Reports'; $cname = $this->input->post('client_name');
//$this->input->post('btn_submit'); $ab=$this->input->post('financialyear');
$cat = $this->input->get('cat'); $fa=substr($ab,0,-5);
$cname = $this->input->get('cname'); $aa=substr($ab,5,5);
$prod = $this->input->get('prod'); $m=$this->input->post('month');
$ab=$this->input->get('ab'); $frm = $this->input->post('from_date');
$fa=substr($ab,0,-5); $t = $this->input->post('to_date');
$aa=substr($ab,5,5); //print_r($prod);
$m=$this->input->get('m'); $data['material']=$this->dahsboard_Model->material_name();
$frm = $this->input->get('frm'); $data['cust']=$this->dahsboard_Model->customer_name();
$t = $this->input->get('t'); //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
$sid=$this->input->get('sid'); $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
$mid = $this->input->get('mid'); $data['purchase']=$this->dahsboard_Model->ireport_attachment($cname,$fa,$aa,$m,$frm,$t);
$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); $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
public function iattach() // {
{ // $this->loadViews("access", $this->global, $data, NULL);
// }
$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() public function iyear_wise()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Yearwise ';
if ($this->input->post('financialyear')) { if ($this->input->post('financialyear')) {
$ab=$this->input->post('financialyear'); $ab=$this->input->post('financialyear');
$a=substr($ab,0,-5); $a=substr($ab,0,-5);
$b=substr($ab,5,5); $b=substr($ab,5,5);
$data['year']=$this->dahsboard_Model->ireport_year_wise($a,$b); $data['year']=$this->dahsboard_Model->ireport_year_wise($a,$b);
$data['finyear']=$this->dahsboard_Model->report_finyear(); //$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); //$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['finyear']=$this->dahsboard_Model->report_finyear(); $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);
$this->loadviews("Report_year_wise_inward",$this->global,$data, NULL); }
public function i_consolidate_year()
} {
public function imonth_wise()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$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']);
$month=$this->input->get('dat'); $this->loadviews("Report_consolidate_year_inward",$this->global,$data, NULL);
$mon= date("F",strtotime($month)); // }
//print_r($month); // else
$data['mont']=$mon; // {
$data['month']=$this->dahsboard_Model->ireport_month_wise($month); // $this->loadViews("access", $this->global, $data, NULL);
$this->loadviews("Report_month_wise_inward",$this->global,$data, NULL); // }
} }
public function iyear_wise_total() public function icumulative()
{ {
$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->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative ';
//print_r($prod);
$this->loadviews("Report_supplier_inward",$this->global,$data, NULL); $data['cum']=$this->dahsboard_Model->ireport_cumulative();
$this->loadviews("Report_cumulative_inward",$this->global,$data, NULL);
} }
public function iconsolidate() public function icum_month()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative-Monthwise';
if ($this->input->post('btn_submit')) { $last = $this->uri->segment_array();
$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); $sup = $last[3];
$mat = $last[4];
//print_r($prod);
} $data['cum_month']=$this->dahsboard_Model->ireport_cum_month($sup,$mat);
public function i_consolidate_month() $this->loadviews("Report_cumulative_month_inward",$this->global,$data, NULL);
{
$this->global['pageTitle'] = 'Siddharth : Reports'; }
//$this->input->post('btn_submit'); public function icum_year()
$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); $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative-Yearwise ';
$last = $this->uri->segment_array();
$sup = $last[3];
$mat = $last[4];
} //print_r($sup);
public function i_consolidate_year()
{
$this->global['pageTitle'] = 'Siddharth : Reports'; $data['cum_year']=$this->dahsboard_Model->ireport_cum_year($sup,$mat);
//$this->input->post('btn_submit'); $this->loadviews("Report_cumulative_year_inward",$this->global,$data, NULL);
$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); }
// } public function icum_day()
// else {
// {
// $this->loadViews("access", $this->global, $data, NULL);
// }
} $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative-Daywise ';
public function icumulative() $last = $this->uri->segment_array();
{
$this->global['pageTitle'] = 'Siddharth : Reports'; $sup = $last[3];
$mat = $last[4];
//print_r($prod);
//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['cum']=$this->dahsboard_Model->ireport_cumulative(); }
public function rawi_cumulative()
{
$this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative Category-Wise';
$this->loadviews("Report_cumulative_inward",$this->global,$data, NULL); //print_r($prod);
$data['cum']=$this->dahsboard_Model->rawi_report_cumulative();
} $this->loadviews("Report_cumulative_raw",$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 rawi_cum_year()
{
} $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative Year-Category-Wise';
public function icum_year()
{
$this->global['pageTitle'] = 'Siddharth : Reports';
$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 : Reports';
$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 : Reports';
//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 : 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'); //$mat=$this->input->get('mid');
$cat=$this->input->get('cat'); $cat=$this->input->get('cat');
//print_r($sup);
//print_r($prod); $data['cum_year']=$this->dahsboard_Model->rawi_report_cum_year($cat);
$this->loadviews("Report_cumulative_year_raw",$this->global,$data, NULL);
$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_month()
{
} $this->global['pageTitle'] = 'Siddharth : Inward Report - Cumulative Month-Category-Wise';
public function rawi_cum_day() //$mat=$this->input->get('mid');
{ $cat=$this->input->get('cat');
$this->global['pageTitle'] = 'Siddharth : Reports'; //print_r($prod);
//$mat=$this->input->get('mid');
$cat=$this->input->get('cat');
//print_r($prod);
$data['cum_day']=$this->dahsboard_Model->rawi_report_cum_day($cat); $data['cum_month']=$this->dahsboard_Model->rawi_report_cum_month($cat);
$this->loadviews("Report_cumulative_day_raw",$this->global,$data, NULL); $this->loadviews("Report_cumulative_month_raw",$this->global,$data, NULL);
} }
public function rawi_consolidate() public function rawi_cum_day()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative Daily-Category-Wise';
if ($this->input->post('btn_submit')) { //$mat=$this->input->get('mid');
$cname = $this->input->post('client_name'); $cat=$this->input->get('cat');
$ab=$this->input->post('financialyear'); //print_r($prod);
$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); $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_consolidate_month() public function rawi_consolidate_month()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate Month-Wise';
//$this->input->post('btn_submit'); //$this->input->post('btn_submit');
$cat = $this->input->get('cat'); $cat = $this->input->get('cat');
$sup = $this->input->get('sup'); $sup = $this->input->get('sup');
//$mat = $this->input->get('mid'); //$mat = $this->input->get('mid');
$m = $this->input->get('m'); $m = $this->input->get('m');
$ab=$this->input->get('ab'); $ab=$this->input->get('ab');
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,5); $aa=substr($ab,5,5);
//print_r($prod); //print_r($prod);
$data['material']=$this->dahsboard_Model->material_name(); $data['material']=$this->dahsboard_Model->material_name();
$data['cust']=$this->dahsboard_Model->customer_name(); $data['cust']=$this->dahsboard_Model->customer_name();
$data['finyear']=$this->dahsboard_Model->report_finyear(); //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
$data['spurchse']=$this->dahsboard_Model->rawi_consolidate_month($m,$cat,$sup,$fa,$aa); $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
// print_r( $data['spurchse']); $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); $this->loadviews("Report_consolidate_month",$this->global,$data, NULL);
} }
public function rawi_consolidate_year() public function rawi_consolidate_year()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate Year-Wise';
//$this->input->post('btn_submit'); //$this->input->post('btn_submit');
$cat = $this->input->get('cat'); $cat = $this->input->get('cat');
$sup = $this->input->get('sup'); $sup = $this->input->get('sup');
//$mat = $this->input->get('mid'); //$mat = $this->input->get('mid');
$ab=$this->input->get('ab'); $ab=$this->input->get('ab');
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,5); $aa=substr($ab,5,5);
//print_r($prod); //print_r($prod);
$data['material']=$this->dahsboard_Model->material_name(); $data['material']=$this->dahsboard_Model->material_name();
$data['cust']=$this->dahsboard_Model->customer_name(); $data['cust']=$this->dahsboard_Model->customer_name();
$data['finyear']=$this->dahsboard_Model->report_finyear(); //$data['finyear']=$this->dahsboard_Model->report_finyear();/* finyear based on po date */
$data['spurchse']=$this->dahsboard_Model->rawi_consolidate_year($cat,$sup,$fa,$aa); $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
// print_r( $data['spurchse']); $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); $this->loadviews("Report_consolidate_year",$this->global,$data, NULL);
} }
public function pending_purchase() public function pending_purchase()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Reports';

View File

@ -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){ function report_year_wise($a=null, $b=null){
@ -1425,10 +1440,10 @@ group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); 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', round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst, 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, sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
round(( 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)), if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0))) ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
+ round(ifnull(if(POType = 'REVENUE', + round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', + round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', + round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', + round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', + 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', - round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total, sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file im.file as ifile,pb.FilePath as file
from T_IGR_Master im from T_IGR_Master im
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO 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_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
@ -1482,53 +1497,57 @@ where pm.Status != 'ST030' ";
if ($cname!= ''){ if ($cname!= ''){
$sql.="and sd.SupplierName = '".$cname."'"; $sql.="and sd.SupplierName = '".$cname."'";
} }
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; //$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!= ''){ if ($m!= ''){
$sql.="and monthname(im.CreatedDate) = '".$m."'"; //$sql.="and monthname(im.CreatedDate) = '".$m."'";
$sql.="and monthname(im.MaterialRcvdDate) = '".$m."'";
} }
if ($frm and $t != ''){ if ($frm and $t != ''){
$fromd= date("Y-m-d",strtotime($frm)); $fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t)); $tod=date("Y-m-d",strtotime($t));
$sql.="and date(im.CreatedDate) >= '".$fromd."' // $sql.="and date(im.CreatedDate) >= '".$fromd."'
and date(im.CreatedDate) <= '".$tod."'"; // and date(im.CreatedDate) <= '".$tod."'";
$sql.="and date(im.MaterialRcvdDate) >= '".$fromd."'
and date(im.MaterialRcvdDate) <= '".$tod."'";
} }
if ($prod!= ''){ if ($prod!= ''){
$sql.=" and mm.MaterialName = '".$prod."' "; $sql.=" and mm.MaterialName = '".$prod."' ";
} }
if ($cat!= ''){ if ($cat!= ''){
$sql.=" and mm.Category = '".$cat."' "; $sql.=" and mm.Category = '".$cat."' ";
} }
$sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo"; $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po){ 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, $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', round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) as sgst, 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, sum(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) as Package,
round(( 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)), if(POType = 'CAPITAL' && CapitalRange = 0,sum(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0))) ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)))
+ round(ifnull(if(POType = 'REVENUE', + round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) sum(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', + round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) sum(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', + round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) sum(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', + round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) sum(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', + 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', - round(ifnull(if(POType = 'REVENUE',
sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity), sum(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total, sum(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file im.file as ifile,pb.FilePath as file
from T_IGR_Master im from T_IGR_Master im
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO 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_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
@ -1582,66 +1601,74 @@ where pm.Status != 'ST030' ";
if ($cname!= ''){ if ($cname!= ''){
$sql.="and sd.SupplierName = '".$cname."'"; $sql.="and sd.SupplierName = '".$cname."'";
} }
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; //$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!= ''){ if ($m!= ''){
$sql.="and monthname(im.CreatedDate) = '".$m."'"; //$sql.="and monthname(im.CreatedDate) = '".$m."'";
$sql.="and monthname(im.MaterialRcvdDate) = '".$m."'";
} }
if ($frm and $t != ''){ if ($frm and $t != ''){
$fromd= date("Y-m-d",strtotime($frm)); $fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t)); $tod=date("Y-m-d",strtotime($t));
$sql.="and date(im.CreatedDate) >= '".$fromd."' // $sql.="and date(im.CreatedDate) >= '".$fromd."'
and date(im.CreatedDate) <= '".$tod."'"; // and date(im.CreatedDate) <= '".$tod."'";
} $sql.="and date(im.MaterialRcvdDate) >= '".$fromd."'
if ($prod!= ''){ and date(im.MaterialRcvdDate) <= '".$tod."'";
$sql.=" and mm.MaterialName = '".$prod."' "; }
if ($prod!= ''){
} $sql.=" and mm.MaterialName = '".$prod."' ";
if ($sid!= ''){
$sql.=" and sd.SupplierID = '".$sid."' "; }
if ($sid!= ''){
} $sql.=" and sd.SupplierID = '".$sid."' ";
if ($mid!= ''){
$sql.=" and mm.MaterialCode = '".$mid."' "; }
if ($mid!= ''){
} $sql.=" and mm.MaterialCode = '".$mid."' ";
if ($d!= ''){
$sql.=" and date(im.CreatedDate) = '".$d."' "; }
if ($d!= ''){
} //$sql.=" and date(im.CreatedDate) = '".$d."' ";
if ($cat!= ''){ $sql.=" and date(im.MaterialRcvdDate) = '".$d."' ";
$sql.=" and mm.Category = '".$cat."' "; }
if ($cat!= ''){
} $sql.=" and mm.Category = '".$cat."' ";
if ($da!= ''){
$ddd= date("Y-m-d",strtotime($da));
$sql.=" and date(im.CreatedDate) = '".$ddd."' ";
} }
if ($po!= ''){ if ($da!= ''){
$ddd= date("Y-m-d",strtotime($da));
$sql.=" and im.PONO = '".$po."' "; //$sql.=" and date(im.CreatedDate) = '".$ddd."' ";
$sql.=" and date(im.MaterialRcvdDate) = '".$ddd."' ";
} }
if ($po!= ''){
$sql.=" and im.PONO = '".$po."' ";
}
@ -1649,13 +1676,13 @@ $sql.="group by pono,material_name,category,supplier_name,id.IGRItemNo";
// echo $m; // echo $m;
// echo $sid; // echo $sid;
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function ireport_attachment($cname,$fa,$aa,$m,$frm,$t){ 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, $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 sum(total) as total,file,ifile
from igr from igr
where status != 'ST030' where status != 'ST030'
@ -1663,81 +1690,97 @@ where status != 'ST030'
if ($cname!= ''){ if ($cname!= ''){
$sql.="and supplier_name = '".$cname."'"; $sql.="and supplier_name = '".$cname."'";
} }
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (created_date >= '".$fa."-04-01' and created_date <= '".$aa."-03-31')"; //$sql.=" and (created_date >= '".$fa."-04-01' and created_date <= '".$aa."-03-31')";
$sql.=" and (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')";
} }
if ($m!= ''){ if ($m!= ''){
$sql.="and monthname(created_date) = '".$m."'"; //$sql.="and monthname(created_date) = '".$m."'";
$sql.="and monthname(materialrcvddate) = '".$m."'";
} }
if ($frm and $t != ''){ if ($frm and $t != ''){
$fromd= date("Y-m-d",strtotime($frm)); $fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t)); $tod=date("Y-m-d",strtotime($t));
$sql.="and date(created_date) >= '".$fromd."' // $sql.="and date(created_date) >= '".$fromd."'
and date(created_date) <= '".$tod."'"; // and date(created_date) <= '".$tod."'";
$sql.="and date(materialrcvddate) >= '".$fromd."'
and date(materialrcvddate) <= '".$tod."'";
} }
$sql.="group by pono,igrn"; $sql.="group by pono,igrn";
// echo $m; // echo $m;
// echo $sid; // echo $sid;
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function ireport_year_wise($a,$b){ function ireport_year_wise($a,$b){
$sql="select dat as CreatedDate,sum(quantity)as quantity,sum(value) as value // $sql="select dat as CreatedDate,sum(quantity)as quantity,sum(value) as value, materialrcvddate
from year_inward // from year_inward
where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31' // where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31'
group by month(CreatedDate) // group by month(CreatedDate)
"; // ";
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $sql="select dat as CreatedDate,sum(quantity)as quantity,sum(value) as value,materialrcvddate
return $query->result(); 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){ function ireport_month_wise($mont){
$month= date("m",strtotime($mont)); $month= date("m",strtotime($mont));
$year = date("Y",strtotime($mont)); $year = date("Y",strtotime($mont));
$sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total // $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total
from year_inward // from year_inward
where status != 'ST030' and month(dat)= ? and year(dat) = ? // where status != 'ST030' and month(dat)= ? and year(dat) = ?
group by material_name,supplier_name"; // group by material_name,supplier_name";
$query = $this->db->query($sql,array($month,$year)); $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total,materialrcvddate
return $query->result(); from year_inward
} where status != 'ST030' and month(materialrcvddate)= ? and year(materialrcvddate) = ?
function ireport_year_wise_total($a,$b){ 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 // $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total
from year_inward // from year_inward
where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31' // where status != 'ST030' and date(dat) >= '$a-04-01' and date(dat) <= '$b-03-31'
group by material_name,supplier_name"; // group by material_name,supplier_name";
$query = $this->db->query($sql,array()); $sql="select sid,mid,supplier_name,material_name,sum(quantity)as quantity,sum(value) as total,materialrcvddate
return $query->result(); 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){ 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, $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 case pm.POType
when 'IMPORT' when 'IMPORT'
@ -1775,55 +1818,59 @@ then ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)
+ ifnull(rt.Insurance,0) + ifnull(rt.Insurance,0)
end end
as total as total,im.MaterialRcvdDate
from T_IGR_Master im from T_IGR_Master im
join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO 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_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo 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_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO left join T_PurchaseOrder_BillUpload pb on pb.IGRNO=im.IGRNO
where pm.Status != 'ST030'"; where pm.Status != 'ST030'";
if ($cname!= ''){ if ($cname!= ''){
$sql.="and sd.SupplierName = '".$cname."'"; $sql.="and sd.SupplierName = '".$cname."'";
} }
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; //$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!= ''){ if ($m!= ''){
$sql.="and monthname(im.CreatedDate) = '".$m."'"; //$sql.="and monthname(im.CreatedDate) = '".$m."'";
$sql.="and monthname(im.MaterialRcvdDate) = '".$m."'";
} }
if ($frm and $t != ''){ if ($frm and $t != ''){
$fromd= date("Y-m-d",strtotime($frm)); $fromd= date("Y-m-d",strtotime($frm));
$tod=date("Y-m-d",strtotime($t)); $tod=date("Y-m-d",strtotime($t));
$sql.="and date(im.CreatedDate) >= '".$fromd."' // $sql.="and date(im.CreatedDate) >= '".$fromd."'
and date(im.CreatedDate) <= '".$tod."'"; // and date(im.CreatedDate) <= '".$tod."'";
$sql.="and date(im.MaterialRcvdDate) >= '".$fromd."'
and date(im.MaterialRcvdDate) <= '".$tod."'";
} }
$sql.= "group by supplier_name"; $sql.= "group by supplier_name";
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function ireport_consolidate($cname,$fa,$aa){ function ireport_consolidate($cname,$fa,$aa){
$sql="select sid,mid,supplier_name,material_name, $sql="select sid,mid,supplier_name,material_name,
SUM(IF(month(dat) = 4, quantity, 0)) AS April, SUM(IF(month(dat) = 4, quantity, 0)) AS April,
SUM(IF(month(dat) = 5, quantity, 0)) AS May, SUM(IF(month(dat) = 5, quantity, 0)) AS May,
SUM(IF(month(dat) = 6, quantity, 0)) AS June, SUM(IF(month(dat) = 6, quantity, 0)) AS June,
@ -1855,205 +1902,208 @@ where status != 'ST030' ";
if ($cname!= ''){ if ($cname!= ''){
$sql.="and supplier_name = '".$cname."'"; $sql.="and supplier_name = '".$cname."'";
} }
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')"; // $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"; $sql.= "group by supplier_name,material_name";
// echo $sql; // echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function i_consolidate_month($m=null,$sid=null,$mid=null,$fa=null,$aa=null){ 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 $sql="select sid,mid,supplier_name,material_name,sum(quantity) as quantity,sum(value) as total
from year_inward from year_inward
where status != 'ST030' and where status != 'ST030' and
monthname(dat) = '".$m."' and sid = '".$sid."' and mid = '".$mid."' "; monthname(dat) = '".$m."' and sid = '".$sid."' and mid = '".$mid."' ";
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')"; //$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"; $sql.= "group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
//echo $sql; //echo $sql;
return $query->result(); return $query->result();
} }
function i_consolidate_year($sid=null,$mid=null,$fa=null,$aa=null){ 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="select sid,mid,supplier_name,material_name,sum(quantity) as quantity,sum(value) as total
from year_inward from year_inward
where status != 'ST030' and sid = '".$sid."' and mid = '".$mid."' "; where status != 'ST030' and sid = '".$sid."' and mid = '".$mid."' ";
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')"; //$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"; $sql.= "group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
//echo $sql; //echo $sql;
return $query->result(); return $query->result();
} }
function ireport_cumulative(){ function ireport_cumulative(){
if (date('m') >= 4) { if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
$yearl = (date('Y')-1).'-'.date('Y'); $yearl = (date('Y')-1).'-'.date('Y');
} }
$ab=$yearl; $ab=$yearl;
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,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 $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 FROM (SELECT sid,mid,supplier_name,material_name,sum(Quantity) as quantity,sum(value) as total,materialrcvddate
FROM year_inward FROM year_inward
where status != 'ST030' and 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 group by supplier_name,material_name
) as year left join ) as year left join
(SELECT sid,mid,supplier_name,material_name,sum(Quantity) as mquantity,sum(value) as mtotal (SELECT sid,mid,supplier_name,material_name,sum(Quantity) as mquantity,sum(value) as mtotal
FROM year_inward FROM year_inward
where status != 'ST030' and where status != 'ST030' and
month(dat) = month(current_date()) month(materialrcvddate) = month(current_date())
group by supplier_name,material_name group by supplier_name,material_name
) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name ) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name
left join left join
(SELECT sid,mid,supplier_name,material_name,sum(Quantity) as tquantity,sum(value) as ttotal (SELECT sid,mid,supplier_name,material_name,sum(Quantity) as tquantity,sum(value) as ttotal
FROM year_inward FROM year_inward
where status != 'ST030' and where status != 'ST030' and
date(dat) = current_date() date(materialrcvddate) = current_date()
group by supplier_name,material_name group by supplier_name,material_name
) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name ) as today on today.supplier_name=month.supplier_name and today.material_name=month.material_name
group by supplier_name,material_name group by supplier_name,material_name
"; ";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function ireport_cum_month($sup=null,$mat=null){ function ireport_cum_month($sup=null,$mat=null){
$sql="SELECT sid,mid,supplier_name,material_name,sum(Quantity) as tquantity,sum(value) as ttotal $sql="SELECT sid,mid,supplier_name,material_name,sum(Quantity) as tquantity,sum(value) as ttotal
FROM year_inward FROM year_inward
where status != 'ST030' and 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"; group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function ireport_cum_year($sup=null,$mat=null){ function ireport_cum_year($sup=null,$mat=null){
if (date('m') >= 4) { if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
$yearl = (date('Y')-1).'-'.date('Y'); $yearl = (date('Y')-1).'-'.date('Y');
} }
$ab=$yearl; $ab=$yearl;
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,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 $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 FROM year_inward
where status != 'ST030' and where status != 'ST030' and
(dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31') (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
and sid = '".$sup."' and mid= '".$mat."' and sid = '".$sup."' and mid= '".$mat."'
group by supplier_name,material_name group by supplier_name,material_name
"; ";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function ireport_cum_day($sup=null,$mat=null){ 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 $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 FROM year_inward
where status != 'ST030' and 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"; group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function rawi_report_cumulative(){ function rawi_report_cumulative(){
if (date('m') >= 4) { if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
$yearl = (date('Y')-1).'-'.date('Y'); $yearl = (date('Y')-1).'-'.date('Y');
} }
$ab=$yearl; $ab=$yearl;
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,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 $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 (SELECT category,sum(Quantity) as quantity,sum(value) as total
FROM year_inward FROM year_inward
where status != 'ST030' and 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 group by category
) as year left join ) as year left join
(SELECT category,sum(Quantity) as mquantity,sum(value) as mtotal (SELECT category,sum(Quantity) as mquantity,sum(value) as mtotal
FROM year_inward FROM year_inward
where status != 'ST030' and where status != 'ST030' and
month(dat) = month(current_date()) month(materialrcvddate) = month(current_date())
group by category group by category
) as month on month.category=year.category ) as month on month.category=year.category
left join left join
(SELECT category,sum(Quantity) as tquantity,sum(value) as ttotal (SELECT category,sum(Quantity) as tquantity,sum(value) as ttotal
FROM year_inward FROM year_inward
where status != 'ST030' and where status != 'ST030' and
date(dat) = current_date() date(materialrcvddate) = current_date()
group by category group by category
) as today on today.category=month.category ) as today on today.category=month.category
group by category "; group by category ";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function rawi_report_cum_year($cat=null){ function rawi_report_cum_year($cat=null){
if (date('m') >= 4) { if (date('m') >= 4) {
$yearl = date('Y').'-'.(date('Y')+1); $yearl = date('Y').'-'.(date('Y')+1);
} else { } else {
$yearl = (date('Y')-1).'-'.date('Y'); $yearl = (date('Y')-1).'-'.date('Y');
} }
$ab=$yearl; $ab=$yearl;
$fa=substr($ab,0,-5); $fa=substr($ab,0,-5);
$aa=substr($ab,5,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 $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 FROM year_inward
where status != 'ST030' and where status != 'ST030' and
(dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31') (materialrcvddate >= '".$fa."-04-01' and materialrcvddate <= '".$aa."-03-31')
and category = '".$cat."' and category = '".$cat."'
group by supplier_name,material_name"; group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
//echo $sql; //echo $sql;
return $query->result(); return $query->result();
} }
function rawi_report_cum_month($cat=null){ 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 $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 FROM year_inward
where status != 'ST030' and 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"; group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function rawi_report_cum_day($cat=null){ 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 $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 FROM year_inward
where status != 'ST030' and where status != 'ST030' and
date(dat) = current_date() and category = '".$cat."' date(materialrcvddate) = current_date() and category = '".$cat."'
group by supplier_name,material_name"; group by supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
//echo $sql; //echo $sql;
return $query->result(); return $query->result();
} }
function rawi_report_consolidate($cname,$fa,$aa){ function rawi_report_consolidate($cname,$fa,$aa){
$sql="select sid,mid,category,supplier_name,material_name, $sql="select sid,mid,category,supplier_name,material_name,
SUM(IF(month(dat) = 4, quantity, 0)) AS April, SUM(IF(month(dat) = 4, quantity, 0)) AS April,
SUM(IF(month(dat) = 5, quantity, 0)) AS May, SUM(IF(month(dat) = 5, quantity, 0)) AS May,
SUM(IF(month(dat) = 6, quantity, 0)) AS June, SUM(IF(month(dat) = 6, quantity, 0)) AS June,
@ -2085,45 +2135,46 @@ where status != 'ST030' ";
if ($cname!= ''){ if ($cname!= ''){
$sql.="and Category = '".$cname."'"; $sql.="and Category = '".$cname."'";
} }
if ($fa and $aa != ''){ if ($fa and $aa != ''){
$sql.=" and (dat >= '".$fa."-04-01' and dat <= '".$aa."-03-31')"; //$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"; $sql.= "group by category";
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function rawi_consolidate_month($m=null,$cat=null,$sup=null,$fa=null,$aa=null){ function rawi_consolidate_month($m=null,$cat=null,$sup=null,$fa=null,$aa=null){
$sql="select category,sid,supplier_name,mid,material_name, $sql="select category,sid,supplier_name,mid,material_name,
sum(Quantity) as quantity, sum(Quantity) as quantity,
sum(value) as total sum(value) as total
FROM year_inward FROM year_inward
where status != 'ST030' and where status != 'ST030' and
monthname(dat) = '".$m."' and category = '".$cat."' "; monthname(materialrcvddate) = '".$m."' and category = '".$cat."' ";
if ($fa and $aa != ''){ 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,supplier_name,material_name"; $sql.= "group by category,supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
//echo $sql; //echo $sql;
return $query->result(); return $query->result();
} }
function rawi_consolidate_year($cat=null,$sup=null,$fa=null,$aa=null){ function rawi_consolidate_year($cat=null,$sup=null,$fa=null,$aa=null){
$sql="select category,sid,supplier_name,mid,material_name, $sql="select category,sid,supplier_name,mid,material_name,
sum(Quantity) as quantity, sum(Quantity) as quantity,
sum(value) as total sum(value) as total
FROM year_inward FROM year_inward
@ -2131,14 +2182,14 @@ where status != 'ST030' and
category = '".$cat."' "; category = '".$cat."' ";
if ($fa and $aa != ''){ 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,supplier_name,material_name"; $sql.= "group by category,supplier_name,material_name";
$query = $this->db->query($sql); $query = $this->db->query($sql);
//echo $sql; //echo $sql;
return $query->result(); return $query->result();
} }
function pending_purchase($cname,$prod,$fa,$aa,$m,$frm,$t){ 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 $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

View File

@ -4,11 +4,9 @@
$("#client_name").select2(); $("#client_name").select2();
$("#item_name").select2(); $("#item_name").select2();
});
});
</script> </script>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<style> <style>
@ -286,6 +284,7 @@ table.dataTable thead > tr > td.sorting {
<th>Freight &nbsp;(<i class="fa fa-rupee " ></i>)</th> <th>Freight &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th>Package &nbsp;(<i class="fa fa-rupee " ></i>)</th> <th>Package &nbsp;(<i class="fa fa-rupee " ></i>)</th>
<th>Total &nbsp;(<i class="fa fa-rupee "></i>)</th> <th>Total &nbsp;(<i class="fa fa-rupee "></i>)</th>
<th>Attachments</th>
</tr> </tr>
</thead> </thead>
@ -350,40 +349,22 @@ table.dataTable thead > tr > td.sorting {
$tot_pac= $tot_pac + $rel->Package; $tot_pac= $tot_pac + $rel->Package;
echo $rel->Package;?></span></td> echo $rel->Package;?></span></td>
<!-- <td style="text-align:right"><span><?php
$tot_tot= $tot_tot + round($rel->total,2);
?>
<?php
if(!empty($rel->file)){ ?>
<a target="_blank" href="<?php echo base_url().'uploads/BillFiles/'?><?php echo $rel->file ?>" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><?php echo number_format($rel->total,2,'.','');?></a>
<?php }else if(!empty($rel->ifile)) { ?><a target="_blank" href="<?php echo base_url().''.$rel->ifile ?>" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><?php echo number_format($rel->total,2,'.','');?></a>
<?php } else { echo number_format($rel->total,2,'.',''); } ?>
</span></td> -->
<td style="text-align:right"><span><?php <td style="text-align:right"><span><?php
$tot_tot= $tot_tot + round($rel->total,2); $tot_tot= $tot_tot + round($rel->total,2);
echo number_format($rel->total,2,'.',''); echo number_format($rel->total,2,'.','');
?></span></td> ?></span></td>
<td id="download<?php echo $key?>" style="text-align:center"><span>
<td id="download<?php echo $key?>" style="text-align:right"><span><?php <?php
$tot_tot= $tot_tot + round($rel->total,2);
?><?php
if(!empty($rel->file)){ ?><!-- if for Inward po file --> if(!empty($rel->file)){ ?><!-- if for Inward po file -->
<a target="_blank" class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm" id="files<?php echo $rel->pono;?>">Download</button></a>
<!-- href="<?php echo base_url().'uploads/BillFiles/'?><?php echo $rel->file ?>"
href="<?php echo base_url().'report/filedownload?pono ='.$rel->pono ?>"-->
<a target="_blank"
class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm" id="files<?php echo $rel->pono;?>">Download</button></a>
<?php }else if(!empty($rel->ifile)) { ?><!-- else if for igr file --> <?php }else if(!empty($rel->ifile)) { ?><!-- else if for igr file -->
<a target="_blank" class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"> <a target="_blank" class="yourlink" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button class="btn btn-info btn-sm" id="files<?php echo $rel->pono;?>">Download</button></a>
<button class="btn btn-info btn-sm" id="files<?php echo $rel->pono;?>">Download</button></a>
<?php } else { echo 'N/A'; } ?><!-- both inwardpo file and Igr file empty means --> <?php } else { echo 'N/A'; } ?><!-- both inwardpo file and Igr file empty means -->
</span></td> </span></td>
</tr> </tr>
<?php <?php
}} }}
@ -394,9 +375,10 @@ table.dataTable thead > tr > td.sorting {
?> ?>
<tr> <tr>
<td style="text-align:left"><span><?php echo $cb->AccountCode;?></span></td> <td style="text-align:left"><span><?php echo $cb->AccountCode;?></span></td>
<td style="text-align:center"><span><?php echo $cb->Date;?></span></td> <td style="text-align:center"><span><?php echo $cb->created_date;?></span></td>
<td style="text-align:right"><span><?php echo '-';?></span></td> <!-- <td style="text-align:right"><span><?php echo $cb->created_time;?></span></td> -->
<td style="text-align:right"><span><?php echo '-';?></span></td> <td style="text-align:right"><span><?php echo '-';?></span></td>
<td style="text-align:center"><span><?php echo $cb->Date;?></span></td>
<td><span><?php echo $cb->AccountName;?></span></td> <td><span><?php echo $cb->AccountName;?></span></td>
<td><span><?php echo $cb->type.'-'.$cb->category;?></span></td> <td><span><?php echo $cb->type.'-'.$cb->category;?></span></td>
<td><span><?php echo $cb->Suppliername;?></span></td> <td><span><?php echo $cb->Suppliername;?></span></td>
@ -425,18 +407,19 @@ table.dataTable thead > tr > td.sorting {
</span></td> --> </span></td> -->
<td style="text-align:right"><span><?php <td style="text-align:right"><span><?php
$tot_tot= $tot_tot + round($cb->Total,2); $tot_tot= $tot_tot + round($cb->Total,2);
?> echo number_format($cb->Total,2,'.','');?></span></td>
<td style="text-align:center"><span>
<?php <?php
if(!empty($cb->cashbookfile)){ ?> if(!empty($cb->cashbookfile)){ ?>
<a target="_blank" href="<?php echo base_url().''. $cb->cashbookfile ?>" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><?php echo number_format($cb->Total,2,'.','');?></a> <a target="_blank" href="<?php echo base_url().''. $cb->cashbookfile ?>" data-toggle="tooltip" data-placement="left" title="Attachment Available for Download/View"><button>File Available</button></a>
<?php <?php }else
}else
{ {
echo number_format($cb->Total,2,'.',''); echo 'N/A';
} }
?> ?>
</span></td> </span></td>
</tr> </tr>
<?php } } ?> <?php } } ?>
@ -581,7 +564,7 @@ $("#Fileshow").modal("show");
$.fn.dataTable.moment( 'DD-MM-YYYY' ); $.fn.dataTable.moment( 'DD-MM-YYYY' );
table = $('#cc').DataTable( { table = $('#cc').DataTable( {
"aaSorting": [[ 3, "asc" ]],
"autoWidth": false, "autoWidth": false,
orderCellsTop: true, orderCellsTop: true,
@ -662,7 +645,5 @@ $("#Fileshow").modal("show");
$(document).ready(function(){ $(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
}); });
</script>
</script>