diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index e31aba40..421b2927 100644 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -2146,7 +2146,15 @@ function addNewImportPurchaseOrder() $userID = $this->session->userdata ( 'userId' ); //print_r($data['Status']);echo "CON"; $data['AppList'] = $this->purchaseorder_model->getPOList($q); - $this->loadViews("poapproval_view", $this->global,$data, NULL); + if($this->DEPCode == FINANCE) + { + $this->loadViews("poapproval_view", $this->global,$data, NULL); + } + + else + { + $this->loadViews("access", $this->global, $data, NULL); + } } @@ -2202,7 +2210,14 @@ function addNewImportPurchaseOrder() $userID = $this->session->userdata ( 'userId' ); //print_r($data['Status']);echo "CON"; $data['AppList'] = $this->purchaseorder_model->getPOList($q); - $this->loadViews("porelease_view", $this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadViews("porelease_view", $this->global,$data, NULL); + } + else + { + $this->loadViews("access", $this->global, $data, NULL); + } } diff --git a/application/controllers/report.php b/application/controllers/report.php index 8b083577..6f304d3a 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -29,8 +29,13 @@ class report extends BaseController $data['pending_list']=$this->dahsboard_Model->req_list(); - + if($this->DEPCode == MANAGEMENT) + { $this->loadviews("report_pendingreqst",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function releasedPO() @@ -42,8 +47,13 @@ class report extends BaseController $data['rel_po']=$this->dahsboard_Model->report_relpo(); - + if($this->DEPCode == MANAGEMENT) + { $this->loadviews("Report_POreleased",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function openorderPO() @@ -53,10 +63,16 @@ class report extends BaseController - $data['open_po']=$this->dahsboard_Model->report_openpending(); - + $data['open_po']=$this->dahsboard_Model->report_openpending(); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_openorder",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function TotalOrd() @@ -72,7 +88,13 @@ class report extends BaseController $data['Total']=$this->dahsboard_Model->report_total($fa,$aa); } $data['finyear']=$this->dahsboard_Model->report_finyear(); - $this->loadviews("Report_totalorders",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_totalorders",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function ccr() @@ -91,7 +113,13 @@ class report extends BaseController } $data['finyear']=$this->dahsboard_Model->report_finyear(); - $this->loadviews("Report_costcenter",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_costcenter",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } @@ -106,7 +134,13 @@ class report extends BaseController $data['mms']=$this->dahsboard_Model->report_MMSupplier(); - $this->loadviews("Report_Material_Master_SupplierWise",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_Material_Master_SupplierWise",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function MM_Item() @@ -119,7 +153,13 @@ class report extends BaseController $data['mmi']=$this->dahsboard_Model->report_MMItem(); - $this->loadviews("Report_Material_Master_ItemWise",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_Material_Master_ItemWise",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function MM_ReceiptValue() @@ -132,7 +172,13 @@ class report extends BaseController $data['mmr']=$this->dahsboard_Model->report_MMReceiptValue(); - $this->loadviews("Report_Material_Master_ReceiptValue",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_Material_Master_ReceiptValue",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } @@ -156,7 +202,13 @@ class report extends BaseController $data['purchase']=$this->dahsboard_Model->report_purchase($cname,$prod,$fa,$aa,$m,$frm,$t); - $this->loadviews("Report_purchase",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_purchase",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function link_purchase() @@ -202,7 +254,13 @@ class report extends BaseController $data['purchase']=$this->dahsboard_Model->report_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d); } - $this->loadviews("Report_purchase",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_purchase",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function year_wise() @@ -219,7 +277,13 @@ class report extends BaseController } $data['finyear']=$this->dahsboard_Model->report_finyear(); - $this->loadviews("Report_year_wise",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_year_wise",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function month_wise() @@ -233,7 +297,13 @@ class report extends BaseController //print_r($month); $data['mont']=$mon; $data['month']=$this->dahsboard_Model->report_month_wise($month); - $this->loadviews("Report_month_wise",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_month_wise",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function year_wise_total() @@ -248,7 +318,13 @@ class report extends BaseController //print_r($month); $data['year']=$month; $data['ytotal']=$this->dahsboard_Model->report_year_wise_total($a,$b); - $this->loadviews("Report_year_wise_total",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_year_wise_total",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } @@ -271,7 +347,13 @@ class report extends BaseController $data['spurchse']=$this->dahsboard_Model->report_supplier($cname,$fa,$aa,$m,$frm,$t); - $this->loadviews("Report_supplier",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_supplier",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function consolidate() @@ -290,7 +372,13 @@ class report extends BaseController $data['spurchse']=$this->dahsboard_Model->report_consolidate($cname,$fa,$aa); - $this->loadviews("Report_consolidate",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_consolidate",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function cumulative() @@ -301,7 +389,13 @@ class report extends BaseController //print_r($prod); $data['cum']=$this->dahsboard_Model->report_cumulative(); - $this->loadviews("Report_cumulative",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_cumulative",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function cum_month() @@ -315,7 +409,13 @@ class report extends BaseController //print_r($prod); $data['cum_month']=$this->dahsboard_Model->report_cum_month($sup,$mat); - $this->loadviews("Report_cumulative_month",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_cumulative_month",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function cum_year() @@ -330,7 +430,13 @@ class report extends BaseController //print_r($sup); $data['cum_year']=$this->dahsboard_Model->report_cum_year($sup,$mat); - $this->loadviews("Report_cumulative_year",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_cumulative_year",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function cum_day() @@ -344,7 +450,13 @@ class report extends BaseController //print_r($prod); $data['cum_day']=$this->dahsboard_Model->report_cum_day($sup,$mat); - $this->loadviews("Report_cumulative_day",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_cumulative_day",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function ipurchase() @@ -422,7 +534,13 @@ class report extends BaseController $data['purchase']=$this->dahsboard_Model->ireport_purchase_link($cname,$prod,$fa,$aa,$m,$frm,$t,$sid,$mid,$d); } - $this->loadviews("Report_purchase_inward",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_purchase_inward",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function iyear_wise() @@ -462,7 +580,13 @@ class report extends BaseController //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); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_month_wise_inward",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function iyear_wise_total() @@ -477,7 +601,13 @@ class report extends BaseController //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); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_year_wise_total_inward",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } @@ -571,8 +701,15 @@ class report extends BaseController $mat = $last[4]; //print_r($prod); - $data['cum_month']=$this->dahsboard_Model->ireport_cum_month($sup,$mat); + $data['cum_month']=$this->dahsboard_Model->ireport_cum_month($sup,$mat); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_cumulative_month_inward",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function icum_year() @@ -587,7 +724,13 @@ class report extends BaseController //print_r($sup); $data['cum_year']=$this->dahsboard_Model->ireport_cum_year($sup,$mat); - $this->loadviews("Report_cumulative_year_inward",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_cumulative_year_inward",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function icum_day() @@ -601,7 +744,13 @@ class report extends BaseController //print_r($prod); $data['cum_day']=$this->dahsboard_Model->ireport_cum_day($sup,$mat); - $this->loadviews("Report_cumulative_day_inward",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Report_cumulative_day_inward",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function cashbook() @@ -627,7 +776,13 @@ class report extends BaseController $data['yearincome']=$this->dahsboard_Model->yearwise_data($income); $data['yearexpense']=$this->dahsboard_Model->yearwise_data($expense); - $this->loadviews("Reportcashbook",$this->global,$data, NULL); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("Reportcashbook",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function monthexpenses() @@ -640,7 +795,13 @@ class report extends BaseController $data['monthlyreport']=$this->dahsboard_Model->monthexpensereport(); // $data['monthlyincreport']=$this->dahsboard_Model->monthincomereport(); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + if($this->DEPCode == MANAGEMENT) + { $this->loadviews("cashbookmonthlyexpenses",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function yearexpenses() @@ -652,18 +813,32 @@ class report extends BaseController //$data['yearlyincreport']=$this->dahsboard_Model->yearincomereport(); $data['yearlyreport']=$this->dahsboard_Model->yearexpensereport(); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); - + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("cashbookyearlyexpenses",$this->global,$data, NULL); + } + else{ + $this->loadViews("access", $this->global, $data, NULL); + } } public function cashbookdepartment() { - $sid=$_GET['sid']; + $sid=$_GET['sid']; + $d=$_GET['d']; $this->global['pageTitle'] = 'Cashbook - department - '; - $data['departmentwise']=$this->dahsboard_Model->departmentwise($sid); + $data['departmentwise']=$this->dahsboard_Model->departmentwise($sid,$d); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); //print_r($data['departmentwise']); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("cashbookmonthlydep",$this->global,$data, NULL); +} +else{ + $this->loadViews("access", $this->global, $data, NULL); +} } //for cashbook menu link// public function cashbookmonthmenu() @@ -673,7 +848,14 @@ class report extends BaseController $data['monthlymenupayments']=$this->dahsboard_Model->monthlypayments(); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); //print_r($data['departmentwise']); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("cashbookmonthmenu",$this->global,$data, NULL); +} +else{ + $this->loadViews("access", $this->global, $data, NULL); +} } public function yearmonthwise() { @@ -682,14 +864,28 @@ class report extends BaseController $data['yearmonthwise']=$this->dahsboard_Model->yearmonthwise($sid); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); //print_r($data['departmentwise']); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("cashbookyearmonthwise",$this->global,$data, NULL); +} +else{ + $this->loadViews("access", $this->global, $data, NULL); +} } public function Viewtoday() { $this->global['pageTitle'] = 'Cashbook - viewtoday '; $data['tdy']=$this->dahsboard_Model->today(); - $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + if($this->DEPCode == MANAGEMENT) + { + $this->loadviews("cashbooktoday",$this->global,$data, NULL); +} +else{ + $this->loadViews("access", $this->global, $data, NULL); +} } } diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 025823ed..368af01f 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -1389,7 +1389,7 @@ group by supplier_name,material_name"; function monthexpensereport() { - $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 "; + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,monthname(tinc.date)as month,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(); @@ -1427,11 +1427,11 @@ group by supplier_name,material_name"; return $query->result(); } - function departmentwise($sid='') + function departmentwise($sid='',$d='') { $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 = ?"; + WHERE account_code = '$sid' and monthname(date)='$d'"; $query = $this->db->query($sql,array($sid)); //print_r($this->db->last_query()); return $query->result(); diff --git a/application/views/Report_purchase.php b/application/views/Report_purchase.php index 3c0574d1..ab23ad6f 100755 --- a/application/views/Report_purchase.php +++ b/application/views/Report_purchase.php @@ -231,7 +231,7 @@ if(!empty($mms))