diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index afd892e7..fa2156bb 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -495,11 +495,11 @@ class cashbook extends BaseController //echo ""; echo ""; - if($amounttype == ' ')//Redirct To Listing Screen + if($amounttype == '')//Redirct To Listing Screen { redirect('ViewIncomeExpense','refresh'); } - else if($amounttype != ' ')//Redirct To Bank Report Screen + else if($amounttype != '')//Redirct To Bank Report Screen { redirect('Bankingstatement','refresh'); } diff --git a/application/controllers/report.php b/application/controllers/report.php index c90a632f..225e9fef 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -1418,16 +1418,19 @@ public function per() //echo $sid; $d=$_GET['d']; $c=$_GET['c']; + $finyear=$_GET['finyear']; + $fy=substr( $finyear,0,-5); + $ty=substr( $finyear,5,5); + if ($c=='PAYMENT') { - $data['departmentwise']=$this->dahsboard_Model->departmentwise($sid,$d,$c); + $data['departmentwise']=$this->dahsboard_Model->departmentwise($sid,$d,$c,$fy,$ty); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); - //print_r($data['departmentwise']); $this->loadviews("cashbookmonthlydep",$this->global,$data, NULL); } else{ - $data['departmentwise']=$this->dahsboard_Model->departmentwise($sid,$d,$c); + $data['departmentwise']=$this->dahsboard_Model->departmentwise($sid,$d,$c,$fy,$ty); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); $this->loadviews("cashbookmonthlyexp",$this->global,$data, NULL); } diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index a7862d07..2db75185 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -2420,7 +2420,7 @@ if (date('m') >= 4) { return $query->result(); } - function departmentwise($sid='',$d='',$c='') + function departmentwise($sid,$d,$c='',$fy,$ty) { $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date, ifnull(case @@ -2441,10 +2441,20 @@ if (date('m') >= 4) { end, '-') as receiptname, date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.document,tinc.towhom,.tinc.description, ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code - WHERE account_code = '$sid' and monthname(date)='$d' and tinc.type='$c'"; + WHERE tinc.type='$c'"; + if ($sid != ''){ + $sql.="and account_code = '".$sid."'"; + } + if ($d != ''){ + $sql.="and monthname(date)='".$d."'"; + } + if ($fy and $ty != ''){ + + $sql.=" and (tinc.date >= '".$fy."-04-01' and tinc.date <= '".$ty."-03-31')"; + + } + // -- WHERE account_code = '$sid' and monthname(date)='$d' and tinc.type='$c'"; $query = $this->db->query($sql); - //print_r($this->db->last_query()); - //echo $sql; return $query->result(); } @@ -2773,7 +2783,7 @@ function getDailyOpeningAmt($yesterday){ $aa=$yr2; } - $sql = "select tinc.account_code,ac.name, + $sql = "select tinc.account_code,ac.name,tinc.type, SUM(IF(month(tinc.date) = 4, IF(tinc.type = 'PAYMENT', tinc.total, 0), 0)) AS AprilExpense, SUM(IF(month(tinc.date) = 4, IF(tinc.type = 'RECEIPT', tinc.total, 0), 0)) AS AprilIncome, SUM(IF(month(tinc.date) = 5, IF(tinc.type = 'PAYMENT', tinc.total, 0), 0)) AS MayExpense, diff --git a/application/views/cashbook_cumulative_month_report.php b/application/views/cashbook_cumulative_month_report.php index ddd762ba..201edff8 100755 --- a/application/views/cashbook_cumulative_month_report.php +++ b/application/views/cashbook_cumulative_month_report.php @@ -181,64 +181,64 @@ if (date('m') >= 4) { ?> name; ?> - AprilIncome,2,'.',''); echo number_format($d->AprilIncome,2,'.',''); ?> - AprilExpense,2,'.',''); echo number_format($d->AprilExpense,2,'.',''); ?> - MayIncome,2,'.',''); echo number_format($d->MayIncome,2,'.',''); ?> - MayExpense,2,'.',''); echo number_format($d->MayExpense,2,'.',''); ?> - JuneIncome,2,'.',''); echo number_format($d->JuneIncome,2,'.',''); ?> - JuneExpense,2,'.',''); echo number_format($d->JuneExpense,2,'.',''); ?> - JulyIncome,2,'.',''); echo number_format($d->JulyIncome,2,'.',''); ?> - JulyExpense,2,'.',''); echo number_format($d->JulyExpense,2,'.',''); ?> - AugustIncome,2,'.',''); echo number_format($d->AugustIncome,2,'.',''); ?> - AugustExpense,2,'.',''); echo number_format($d->AugustExpense,2,'.',''); ?> - SepIncome,2,'.',''); echo number_format($d->SepIncome,2,'.',''); ?> - SepExpense,2,'.',''); echo number_format($d->SepExpense,2,'.',''); ?> - OctIncome,2,'.',''); echo number_format($d->OctIncome,2,'.',''); ?> - OctExpense,2,'.',''); echo number_format($d->OctExpense,2,'.',''); ?> - NovIncome,2,'.',''); echo number_format($d->NovIncome,2,'.',''); ?> - NovExpense,2,'.',''); echo number_format($d->NovExpense,2,'.',''); ?> - DecIncome,2,'.',''); echo number_format($d->DecIncome,2,'.',''); ?> - DecExpense,2,'.',''); echo number_format($d->DecExpense,2,'.',''); ?> - JanIncome,2,'.',''); echo number_format($d->JanIncome,2,'.',''); ?> - JanExpense,2,'.',''); echo number_format($d->JanExpense,2,'.',''); ?> - FebIncome,2,'.',''); echo number_format($d->FebIncome,2,'.',''); ?> - FebExpense,2,'.',''); echo number_format($d->FebExpense,2,'.',''); ?> - MarIncome,2,'.',''); echo number_format($d->MarIncome,2,'.',''); ?> - MarExpense,2,'.',''); echo number_format($d->MarExpense,2,'.',''); ?> - receiptoverall,2,'.',''); echo number_format($d->receiptoverall,2,'.',''); ?> - paymentoverall,2,'.',''); echo number_format($d->paymentoverall,2,'.',''); ?> + AprilIncome,2,'.',''); echo number_format($d->AprilIncome,2,'.',''); ?> + AprilExpense,2,'.',''); echo number_format($d->AprilExpense,2,'.',''); ?> + MayIncome,2,'.',''); echo number_format($d->MayIncome,2,'.',''); ?> + MayExpense,2,'.',''); echo number_format($d->MayExpense,2,'.',''); ?> + JuneIncome,2,'.',''); echo number_format($d->JuneIncome,2,'.',''); ?> + JuneExpense,2,'.',''); echo number_format($d->JuneExpense,2,'.',''); ?> + JulyIncome,2,'.',''); echo number_format($d->JulyIncome,2,'.',''); ?> + JulyExpense,2,'.',''); echo number_format($d->JulyExpense,2,'.',''); ?> + AugustIncome,2,'.',''); echo number_format($d->AugustIncome,2,'.',''); ?> + AugustExpense,2,'.',''); echo number_format($d->AugustExpense,2,'.',''); ?> + SepIncome,2,'.',''); echo number_format($d->SepIncome,2,'.',''); ?> + SepExpense,2,'.',''); echo number_format($d->SepExpense,2,'.',''); ?> + OctIncome,2,'.',''); echo number_format($d->OctIncome,2,'.',''); ?> + OctExpense,2,'.',''); echo number_format($d->OctExpense,2,'.',''); ?> + NovIncome,2,'.',''); echo number_format($d->NovIncome,2,'.',''); ?> + NovExpense,2,'.',''); echo number_format($d->NovExpense,2,'.',''); ?> + DecIncome,2,'.',''); echo number_format($d->DecIncome,2,'.',''); ?> + DecExpense,2,'.',''); echo number_format($d->DecExpense,2,'.',''); ?> + JanIncome,2,'.',''); echo number_format($d->JanIncome,2,'.',''); ?> + JanExpense,2,'.',''); echo number_format($d->JanExpense,2,'.',''); ?> + FebIncome,2,'.',''); echo number_format($d->FebIncome,2,'.',''); ?> + FebExpense,2,'.',''); echo number_format($d->FebExpense,2,'.',''); ?> + MarIncome,2,'.',''); echo number_format($d->MarIncome,2,'.',''); ?> + MarExpense,2,'.',''); echo number_format($d->MarExpense,2,'.',''); ?> + receiptoverall,2,'.',''); echo number_format($d->receiptoverall,2,'.',''); ?> + paymentoverall,2,'.',''); echo number_format($d->paymentoverall,2,'.',''); ?> - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/application/views/cashbookall.php b/application/views/cashbookall.php index 5d10ba93..283409d7 100755 --- a/application/views/cashbookall.php +++ b/application/views/cashbookall.php @@ -1,17 +1,4 @@ - - - - - - - - - - -
@@ -133,16 +106,12 @@ if(!empty($depmenu)) Date - Account Name Type Received From Paid To - - - Receipt - Payment - + Receipt + Payment Description Action @@ -163,8 +132,6 @@ if(!empty($depmenu)) type?> receiptname?> paymentname?> - - income,2,'.',''); echo number_format($t->income,2,'.','');?> @@ -178,11 +145,10 @@ if(!empty($depmenu)) if(!empty($t->document)) { ?> - +