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

@ -526,7 +526,7 @@ class report extends BaseController
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');
@ -540,25 +540,24 @@ class report extends BaseController
//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['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['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['cashbookdatas']=$this->dahsboard_Model->report_inwardcashbook($cname,$fa,$aa,$m,$frm,$t,$cat);
} }
$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['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() public function ilink_purchase()
{ {
if ($this->input->post('btn_submit')) { if ($this->input->post('btn_submit')) {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward PO Reports';
//$this->input->post('btn_submit'); //$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');
@ -574,12 +573,13 @@ class report extends BaseController
//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['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); $data['purchase']=$this->dahsboard_Model->ireport_purchase($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d);
} else{ } else{
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward PO Reports';
//$this->input->post('btn_submit'); //$this->input->post('btn_submit');
$cat = $this->input->get('cat'); $cat = $this->input->get('cat');
$cname = $this->input->get('cname'); $cname = $this->input->get('cname');
@ -599,7 +599,8 @@ class report extends BaseController
//print_r($m);die(); //print_r($m);die();
$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['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); $data['purchase']=$this->dahsboard_Model->ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d,$cat,$da,$po);
} }
@ -609,7 +610,7 @@ class report extends BaseController
public function iattach() public function iattach()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Summary';
if ($this->input->post('btn_submit')) { if ($this->input->post('btn_submit')) {
$cname = $this->input->post('client_name'); $cname = $this->input->post('client_name');
$ab=$this->input->post('financialyear'); $ab=$this->input->post('financialyear');
@ -621,12 +622,13 @@ class report extends BaseController
//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['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['purchase']=$this->dahsboard_Model->ireport_attachment($cname,$fa,$aa,$m,$frm,$t);
} }
$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->ireport_finyear();/* year based on material rcvd date */
// if($this->DEPCode == MANAGEMENT) // if($this->DEPCode == MANAGEMENT)
// { // {
$this->loadviews("Report_attach_inward",$this->global,$data, NULL); $this->loadviews("Report_attach_inward",$this->global,$data, NULL);
@ -642,7 +644,7 @@ class report extends BaseController
} }
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')) {
@ -650,11 +652,12 @@ class report extends BaseController
$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->report_finyear(); $data['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
@ -665,7 +668,7 @@ class report extends BaseController
public function imonth_wise() public function imonth_wise()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Monthwise';
$month=$this->input->get('dat'); $month=$this->input->get('dat');
@ -679,7 +682,7 @@ class report extends BaseController
public function iyear_wise_total() public function iyear_wise_total()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Yearwise';
$last = $this->uri->total_segments(); $last = $this->uri->total_segments();
$month=$this->uri->segment($last); $month=$this->uri->segment($last);
@ -695,7 +698,7 @@ class report extends BaseController
public function ipurchase_supplier() public function ipurchase_supplier()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Supplierwise';
if ($this->input->post('btn_submit')) { if ($this->input->post('btn_submit')) {
$cname = $this->input->post('client_name'); $cname = $this->input->post('client_name');
$ab=$this->input->post('financialyear'); $ab=$this->input->post('financialyear');
@ -707,26 +710,24 @@ class report extends BaseController
//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['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['spurchse']=$this->dahsboard_Model->ireport_supplier($cname,$fa,$aa,$m,$frm,$t);
} }
$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->ireport_finyear();/* year based on material rcvd date */
$this->loadviews("Report_supplier_inward",$this->global,$data, NULL); $this->loadviews("Report_supplier_inward",$this->global,$data, NULL);
} }
public function iconsolidate() public function iconsolidate()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate';
if ($this->input->post('btn_submit')) { if ($this->input->post('btn_submit')) {
$cname = $this->input->post('client_name'); $cname = $this->input->post('client_name');
$ab=$this->input->post('financialyear'); $ab=$this->input->post('financialyear');
@ -735,12 +736,14 @@ class report extends BaseController
//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['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
$data['spurchse']=$this->dahsboard_Model->ireport_consolidate($cname,$fa,$aa); $data['spurchse']=$this->dahsboard_Model->ireport_consolidate($cname,$fa,$aa);
} }
$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['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
$this->loadviews("Report_consolidate_inward",$this->global,$data, NULL); $this->loadviews("Report_consolidate_inward",$this->global,$data, NULL);
@ -748,7 +751,7 @@ class report extends BaseController
public function i_consolidate_month() public function i_consolidate_month()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate-Monthwise';
//$this->input->post('btn_submit'); //$this->input->post('btn_submit');
$sid=$this->input->get('sid'); $sid=$this->input->get('sid');
$mid = $this->input->get('mid'); $mid = $this->input->get('mid');
@ -762,7 +765,8 @@ class report extends BaseController
//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['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); $data['spurchse']=$this->dahsboard_Model->i_consolidate_month($m,$sid,$mid,$fa,$aa);
// print_r( $data['spurchse']); // print_r( $data['spurchse']);
@ -773,7 +777,7 @@ class report extends BaseController
public function i_consolidate_year() public function i_consolidate_year()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Consolidate-Yearwise';
//$this->input->post('btn_submit'); //$this->input->post('btn_submit');
$sid=$this->input->get('sid'); $sid=$this->input->get('sid');
$mid = $this->input->get('mid'); $mid = $this->input->get('mid');
@ -786,7 +790,8 @@ class report extends BaseController
//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['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
$data['spurchse']=$this->dahsboard_Model->i_consolidate_year($sid,$mid,$fa,$aa); $data['spurchse']=$this->dahsboard_Model->i_consolidate_year($sid,$mid,$fa,$aa);
// print_r( $data['spurchse']); // print_r( $data['spurchse']);
@ -801,7 +806,7 @@ class report extends BaseController
public function icumulative() public function icumulative()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative ';
//print_r($prod); //print_r($prod);
@ -816,7 +821,7 @@ class report extends BaseController
public function icum_month() public function icum_month()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative-Monthwise';
$last = $this->uri->segment_array(); $last = $this->uri->segment_array();
$sup = $last[3]; $sup = $last[3];
@ -830,7 +835,7 @@ class report extends BaseController
public function icum_year() public function icum_year()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative-Yearwise ';
$last = $this->uri->segment_array(); $last = $this->uri->segment_array();
$sup = $last[3]; $sup = $last[3];
@ -845,7 +850,7 @@ class report extends BaseController
public function icum_day() public function icum_day()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative-Daywise ';
$last = $this->uri->segment_array(); $last = $this->uri->segment_array();
$sup = $last[3]; $sup = $last[3];
@ -859,7 +864,7 @@ class report extends BaseController
public function rawi_cumulative() public function rawi_cumulative()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative Category-Wise';
//print_r($prod); //print_r($prod);
@ -874,7 +879,7 @@ class report extends BaseController
public function rawi_cum_year() public function rawi_cum_year()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative Year-Category-Wise';
//$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($sup);
@ -886,7 +891,7 @@ class report extends BaseController
public function rawi_cum_month() public function rawi_cum_month()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Report - Cumulative Month-Category-Wise';
//$mat=$this->input->get('mid'); //$mat=$this->input->get('mid');
$cat=$this->input->get('cat'); $cat=$this->input->get('cat');
@ -899,7 +904,7 @@ class report extends BaseController
public function rawi_cum_day() public function rawi_cum_day()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Reports - Cumulative Daily-Category-Wise';
//$mat=$this->input->get('mid'); //$mat=$this->input->get('mid');
$cat=$this->input->get('cat'); $cat=$this->input->get('cat');
//print_r($prod); //print_r($prod);
@ -911,7 +916,7 @@ class report extends BaseController
public function rawi_consolidate() public function rawi_consolidate()
{ {
$this->global['pageTitle'] = 'Siddharth : Reports'; $this->global['pageTitle'] = 'Siddharth : Inward Report - Consolidate ';
if ($this->input->post('btn_submit')) { if ($this->input->post('btn_submit')) {
$cname = $this->input->post('client_name'); $cname = $this->input->post('client_name');
$ab=$this->input->post('financialyear'); $ab=$this->input->post('financialyear');
@ -920,12 +925,14 @@ class report extends BaseController
//print_r($prod); //print_r($prod);
$data['material']=$this->dahsboard_Model->category(); $data['material']=$this->dahsboard_Model->category();
$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['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
$data['spurchse']=$this->dahsboard_Model->rawi_report_consolidate($cname,$fa,$aa); $data['spurchse']=$this->dahsboard_Model->rawi_report_consolidate($cname,$fa,$aa);
} }
$data['material']=$this->dahsboard_Model->category(); $data['material']=$this->dahsboard_Model->category();
$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['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
$this->loadviews("Report_consolidate_raw",$this->global,$data, NULL); $this->loadviews("Report_consolidate_raw",$this->global,$data, NULL);
@ -934,7 +941,7 @@ class report extends BaseController
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');
@ -946,7 +953,8 @@ class report extends BaseController
//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['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); $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_month($m,$cat,$sup,$fa,$aa);
// print_r( $data['spurchse']); // print_r( $data['spurchse']);
@ -957,7 +965,7 @@ class report extends BaseController
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');
@ -968,7 +976,8 @@ class report extends BaseController
//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['finyear']=$this->dahsboard_Model->ireport_finyear();/* year based on material rcvd date */
$data['spurchse']=$this->dahsboard_Model->rawi_consolidate_year($cat,$sup,$fa,$aa); $data['spurchse']=$this->dahsboard_Model->rawi_consolidate_year($cat,$sup,$fa,$aa);
// print_r( $data['spurchse']); // print_r( $data['spurchse']);

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){
@ -1448,7 +1463,7 @@ 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',
@ -1490,12 +1505,14 @@ if ($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."'";
} }
@ -1503,8 +1520,10 @@ if ($cname!= ''){
$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!= ''){
@ -1548,7 +1567,7 @@ 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',
@ -1590,12 +1609,14 @@ if ($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."'";
} }
@ -1603,8 +1624,11 @@ if ($cname!= ''){
$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!= ''){
@ -1624,7 +1648,8 @@ if ($cname!= ''){
} }
if ($d!= ''){ if ($d!= ''){
$sql.=" and date(im.CreatedDate) = '".$d."' "; //$sql.=" and date(im.CreatedDate) = '".$d."' ";
$sql.=" and date(im.MaterialRcvdDate) = '".$d."' ";
} }
if ($cat!= ''){ if ($cat!= ''){
@ -1634,7 +1659,9 @@ if ($cname!= ''){
} }
if ($da!= ''){ if ($da!= ''){
$ddd= date("Y-m-d",strtotime($da)); $ddd= date("Y-m-d",strtotime($da));
$sql.=" and date(im.CreatedDate) = '".$ddd."' ";
//$sql.=" and date(im.CreatedDate) = '".$ddd."' ";
$sql.=" and date(im.MaterialRcvdDate) = '".$ddd."' ";
} }
if ($po!= ''){ if ($po!= ''){
@ -1671,12 +1698,14 @@ if ($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."'";
} }
@ -1684,8 +1713,10 @@ if ($cname!= ''){
$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."'";
} }
@ -1697,15 +1728,19 @@ if ($cname!= ''){
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;
$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); $query = $this->db->query($sql);
return $query->result(); return $query->result();
@ -1717,24 +1752,32 @@ group by month(CreatedDate)
$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";
$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)); $query = $this->db->query($sql,array($month,$year));
return $query->result(); return $query->result();
} }
function ireport_year_wise_total($a,$b){ 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";
$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()); $query = $this->db->query($sql,array());
return $query->result(); 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,
@ -1775,17 +1818,17 @@ 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!= ''){
@ -1797,12 +1840,14 @@ if ($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."'";
} }
@ -1810,8 +1855,10 @@ if ($cname!= ''){
$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";
@ -1820,7 +1867,7 @@ if ($cname!= ''){
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,
@ -1863,7 +1910,8 @@ if ($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')";
} }
@ -1873,7 +1921,7 @@ if ($cname!= ''){
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
@ -1881,7 +1929,8 @@ 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";
@ -1896,7 +1945,8 @@ 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";
@ -1914,23 +1964,23 @@ if ($fa and $aa != ''){
$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
@ -1943,7 +1993,7 @@ group by supplier_name,material_name
$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();
@ -1960,8 +2010,8 @@ group by supplier_name,material_name";
$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);
@ -1972,7 +2022,7 @@ group by supplier_name,material_name
$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();
@ -1990,20 +2040,20 @@ group by supplier_name,material_name";
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 ";
@ -2022,8 +2072,8 @@ group by category ";
$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;
@ -2034,7 +2084,7 @@ group by supplier_name,material_name";
$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();
@ -2044,7 +2094,7 @@ group by supplier_name,material_name";
$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;
@ -2093,7 +2143,8 @@ if ($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')";
} }
@ -2103,17 +2154,17 @@ if ($cname!= ''){
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";
@ -2131,7 +2182,7 @@ 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";

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,15 +349,6 @@ 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);
@ -366,24 +356,15 @@ table.dataTable thead > tr > td.sorting {
?></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->created_date;?></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:center"><span><?php echo $cb->Date;?></span></td> <td style="text-align:center"><span><?php echo $cb->Date;?></span></td>
<td style="text-align:right"><span><?php echo '-';?></span></td>
<td style="text-align:right"><span><?php echo '-';?></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>