diff --git a/application/controllers/report.php b/application/controllers/report.php index 9db8e21e..63bafd6b 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -354,7 +354,7 @@ class report extends BaseController $this->global['pageTitle'] = 'Cashbook - Cashbook Reports - '; - + $data['gettoptotal1'] = $this->dahsboard_Model->gettoptotal(); $data['getTotalServicePoCount'] = $this->dahsboard_Model->getTotalServicePoCount(); $data['getTotalimportPoCount'] = $this->dahsboard_Model->getTotalimportPoCount(); $data['getTotalcapitalPoCount'] = $this->dahsboard_Model->getTotalcapitalPoCount(); @@ -369,12 +369,14 @@ class report extends BaseController $data['todayexpense']=$this->dahsboard_Model->today_data($expense); $data['yearincome']=$this->dahsboard_Model->yearwise_data($income); $data['yearexpense']=$this->dahsboard_Model->yearwise_data($expense); - + $data['gettoptotal1'] = $this->dahsboard_Model->gettoptotal(); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + //print_r($data['gettoptotal1']); // $data['monthlywiseincome']=$this->dahsboard_Model->monthwise_data_income(); // $data['monthlywiseexpense']=$this->dahsboard_Model->monthwise_data_expense(); // $data['todayincome']=$this->dahsboard_Model->today_data_income(); // $data['todayexpense']=$this->dahsboard_Model->today_data_expense(); - $this->loadviews("Reportcashbook",$this->global,$data, NULL); + $this->loadviews("reportcashbook",$this->global,$data, NULL); } @@ -387,7 +389,7 @@ class report extends BaseController $data['monthlyreport']=$this->dahsboard_Model->monthexpensereport(); // $data['monthlyincreport']=$this->dahsboard_Model->monthincomereport(); - + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); $this->loadviews("cashbookmonthlyexpenses",$this->global,$data, NULL); } @@ -399,7 +401,7 @@ class report extends BaseController //$data['yearlyincreport']=$this->dahsboard_Model->yearincomereport(); $data['yearlyreport']=$this->dahsboard_Model->yearexpensereport(); - + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); $this->loadviews("cashbookyearlyexpenses",$this->global,$data, NULL); @@ -409,18 +411,37 @@ class report extends BaseController $sid=$_GET['sid']; $this->global['pageTitle'] = 'Cashbook - department - '; $data['departmentwise']=$this->dahsboard_Model->departmentwise($sid); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); //print_r($data['departmentwise']); $this->loadviews("cashbookmonthlydep",$this->global,$data, NULL); } + //for cashbook menu link// + public function cashbookmonthmenu() + { + + $this->global['pageTitle'] = 'Cashbook - department - '; + $data['monthlymenupayments']=$this->dahsboard_Model->monthlypayments(); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + //print_r($data['departmentwise']); + $this->loadviews("cashbookmonthmenu",$this->global,$data, NULL); + } public function yearmonthwise() { $sid=$_GET['sid']; $this->global['pageTitle'] = 'Cashbook - yearmonthwise - '; $data['yearmonthwise']=$this->dahsboard_Model->yearmonthwise($sid); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); //print_r($data['departmentwise']); $this->loadviews("cashbookyearmonthwise",$this->global,$data, NULL); } - +public function Viewtoday() + { + $this->global['pageTitle'] = 'Cashbook - viewtoday '; + $data['tdy']=$this->dahsboard_Model->today(); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + $this->loadviews("cashbooktoday",$this->global,$data, NULL); + } } -?> \ No newline at end of file +?> + diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 00abcc4a..32be8e25 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -951,42 +951,29 @@ group by supplier_name,material_name"; } function cashbook() { - $sql="SELECT date,type,total,towhom,description,account_code FROM kasiram9_SIADEV.t_income_expense"; + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,tinc.description,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code "; $query = $this->db->query($sql); return $query->result(); } - // function monthincomereport() - // { - // $sql="SELECT date,type,sum(total)as total,towhom,description,account_code FROM kasiram9_SIADEV.t_income_expense where type='INCOME' and month(date)= month(current_date()) group by account_code order by total desc limit 10 "; - // $query = $this->db->query($sql); - // //echo $query; - // return $query->result(); - // } function monthexpensereport() { - $sql="SELECT date,type,sum(total)as total,towhom,description,account_code FROM kasiram9_SIADEV.t_income_expense where type='EXPENSE' and month(date)= month(current_date()) group by account_code order by total desc limit 10 "; + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,tinc.towhom,tinc.description,tinc.account_code, ac.name FROM t_income_expense as tinc join t_accountcode ac on ac.code=tinc.account_code where tinc.type='EXPENSE' and month(tinc.date)= month(current_date()) group by account_code order by total desc limit 10 "; $query = $this->db->query($sql); return $query->result(); } - // function yearincomereport() - // { - // $sql="SELECT date,type,sum(total)as total,towhom,description,account_code FROM kasiram9_SIADEV.t_income_expense where type='INCOME' and year(date)= year(current_date()) group by account_code order by total desc limit 10 "; - // $query = $this->db->query($sql); - // return $query->result(); - // } function yearexpensereport() { - $sql="SELECT date,type,sum(total)as total,towhom,description,account_code,monthname(date)as month FROM kasiram9_SIADEV.t_income_expense where type='EXPENSE' and year(date)= year(current_date()) group by month order by total desc limit 10 "; + $sql="SELECT date_format(date,'%d-%m-%Y')as date,type,sum(total)as total,towhom,description,account_code,monthname(date)as month FROM t_income_expense where type='EXPENSE' and year(date)= year(current_date()) group by month order by total desc limit 10 "; $query = $this->db->query($sql); return $query->result(); } function today_data($value='') { - $sql="SELECT type,Sum(total) as todaydata FROM kasiram9_SIADEV.t_income_expense WHERE type = ? AND DATE(date) = CURRENT_DATE"; + $sql="SELECT type,Sum(total) as todaydata FROM t_income_expense WHERE type = ? AND DATE(date) = CURRENT_DATE"; $query = $this->db->query($sql,array($value)); return $query->result(); @@ -994,7 +981,7 @@ group by supplier_name,material_name"; function monthwise_data($value='') { - $sql="SELECT type,Sum(total) as monthlydata FROM kasiram9_SIADEV.t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())"; + $sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())"; $query = $this->db->query($sql,array($value)); return $query->result(); @@ -1011,7 +998,9 @@ group by supplier_name,material_name"; } function departmentwise($sid='') { - $sql="SELECT date,type,total,towhom,description,account_code FROM t_income_expense WHERE account_code = ?"; + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM + t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code + WHERE account_code = ?"; $query = $this->db->query($sql,array($sid)); //print_r($this->db->last_query()); return $query->result(); @@ -1019,13 +1008,57 @@ group by supplier_name,material_name"; } function yearmonthwise($sid='') { - $sql="SELECT date,type,total,description,towhom,account_code FROM t_income_expense WHERE monthname(date) = ? group by account_code"; + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,tinc.description,tinc.towhom,tinc.account_code,ac.name FROM t_income_expense tinc + join t_accountcode ac on ac.code=tinc.account_code + WHERE monthname(date) = ? group by account_code"; $query = $this->db->query($sql,array($sid)); //print_r($this->db->last_query()); return $query->result(); } - + //for dashboard graph in cashbook// + function gettoptotal(){ + $i=1; + + while($i<=12){ + $sql="SELECT sum(total) as tot FROM t_income_expense where month(date)= $i"; + // $sql="SELECT sum(total)as ttl,concat(sum(total),'-',account_code)as atotal FROM t_income_expense where month(date)= $i + // group by account_code order by ttl desc limit 4"; + + $query = $this->db->query($sql); + //print_r($this->db->last_query()); + //return $query->result(); + $array_result[]=$query->result(); + $i++; + + } + + return $array_result; + +} +function INRSymbol() + { + $sql='select FontCode2000 from T_Currency_Details where Currency_Code="INR"'; + $query=$this->db->query($sql); + return $query->result(); + } + function today() + { + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,tinc.description,tinc.account_code,tac.name FROM t_income_expense tinc + LEFT JOIN t_accountcode tac ON tac.code = tinc.account_code + WHERE DATE(date) = CURRENT_DATE"; + $query = $this->db->query($sql); + return $query->result(); + } + //for menu link in monthly payments// + function monthlypayments() + { + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code WHERE MONTH(date) = MONTH(curdate()) group by account_code"; + $query = $this->db->query($sql); + //print_r($this->db->last_query()); + return $query->result(); + + } } -?>zz \ No newline at end of file +?> \ No newline at end of file diff --git a/application/views/cashbookmonthlydep.php b/application/views/cashbookmonthlydep.php index a3e73769..2ac565d9 100644 --- a/application/views/cashbookmonthlydep.php +++ b/application/views/cashbookmonthlydep.php @@ -7,7 +7,16 @@ if(!empty($departmentwise)) } -?> + + $inrsymbol=''; +if(!empty($Indiancurrency)) + { + foreach ($Indiancurrency as $inr) + { + $inrsymbol = $inr->FontCode2000; + }} + ?> +