From 900804cb913c1455d992145609c79dc51912af4f Mon Sep 17 00:00:00 2001 From: gayathri1990 Date: Tue, 12 Dec 2017 12:57:38 +0530 Subject: [PATCH] capital po & cashbook --- application/controllers/cashbook.php | 18 +++- application/controllers/report.php | 25 ++++- application/logs/log-2017-12-12.php | 3 + application/models/dahsboard_model.php | 48 +++++++-- application/views/addnewIncomeExpense.php | 10 +- application/views/cashbookdepday.php | 116 ++++++++++++++++++++ application/views/cashbookdepmenu.php | 119 +++++++++++++++++++++ application/views/cashbooklisting.php | 4 +- application/views/editCapitalPo.php | 15 +++ application/views/income_expense_list.php | 15 ++- application/views/reportcashbook.php | 57 +++++++--- application/views/viewIndIncomeExpense.php | 2 +- 12 files changed, 398 insertions(+), 34 deletions(-) create mode 100644 application/logs/log-2017-12-12.php create mode 100644 application/views/cashbookdepday.php create mode 100644 application/views/cashbookdepmenu.php diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index a216dd5b..24bc878b 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -93,11 +93,11 @@ class cashbook extends BaseController $accounttype = $this->input->post('myradio'); if($accounttype == 1) { - $accounttype = 'INCOME'; + $accounttype = 'RECEIPT'; } else { - $accounttype = 'EXPENSE'; + $accounttype = 'PAYMENT'; } $accountcode = $this->input->post('accode'); $date = $this->input->post('Date'); @@ -264,6 +264,20 @@ class cashbook extends BaseController + } + + public function editcashbook() + { + + + $this->load->model('cashbook_model'); + + // $data['cashbook'] = $this->cashbook_model->Selectcash(); + + // $this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; + + $this->loadViews("editincomeexpenses", $this->global, NULL); + } diff --git a/application/controllers/report.php b/application/controllers/report.php index 38a24c9c..ea54f018 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -904,8 +904,8 @@ class report extends BaseController $data['getTotalrevenuePoCount'] = $this->dahsboard_Model->getTotalrevenuePoCount(); $data['cashbook']=$this->dahsboard_Model->cashbook(); - $income="INCOME"; - $expense="EXPENSE"; + $income="RECEIPT"; + $expense="PAYMENT"; $data['monthlywiseincome']=$this->dahsboard_Model->monthwise_data($income); $data['monthlywiseexpense']=$this->dahsboard_Model->monthwise_data($expense); $data['todayincome']=$this->dahsboard_Model->today_data($income); @@ -1005,14 +1005,31 @@ class report extends BaseController //print_r($data['departmentwise']); $this->loadviews("cashbookyearmonthwise",$this->global,$data, NULL); } -public function Viewtoday() + 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); } - + public function depmenu() + { + $this->global['pageTitle'] = 'Cashbook - viewtoday '; + $data['depmenu']=$this->dahsboard_Model->departmentmenu(); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + $this->loadviews("cashbookdepmenu",$this->global,$data, NULL); + } + public function cashbookmenudepartment() + { + $sid=$_GET['sid']; + + $this->global['pageTitle'] = 'Cashbook - department - '; + $data['menudepartmentwise']=$this->dahsboard_Model->menudepartmentwise($sid); + $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); + //print_r($data['departmentwise']); + $this->loadviews("cashbookdepday",$this->global,$data, NULL); + } } ?> + diff --git a/application/logs/log-2017-12-12.php b/application/logs/log-2017-12-12.php new file mode 100644 index 00000000..23ebc0e6 --- /dev/null +++ b/application/logs/log-2017-12-12.php @@ -0,0 +1,3 @@ + + +ERROR - 2017-12-12 08:24:42 --> Severity: Warning --> mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given C:\xampp\htdocs\siddharth_application\system\database\drivers\mysqli\mysqli_result.php 38 diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 68184035..a55f7c3b 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -1687,14 +1687,31 @@ if ($fa and $aa != ''){ } function cashbook() { - $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 where tinc.type='EXPENSE'"; + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date, + ifnull(case + when tinc.type = 'PAYMENT' + then tinc.total + end,'0') as expense, + ifnull(case + when tinc.type = 'RECEIPT' + then tinc.total + end, '0') as income, + ifnull(case + when tinc.type = 'PAYMENT' + then tinc.towhom + end,'-') as paymentname, + ifnull(case + when tinc.type = 'RECEIPT' + then tinc.towhom + end, '-') as receiptname, + tinc.total,tinc.towhom,tinc.description,tinc.type,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 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,monthname(tinc.date)as month,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,tinc.towhom,tinc.description,tinc.account_code,monthname(tinc.date)as month,ac.name FROM t_income_expense as tinc join t_accountcode ac on ac.code=tinc.account_code where tinc.type='PAYMENT' 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(); @@ -1702,7 +1719,7 @@ if ($fa and $aa != ''){ function yearexpensereport() { - $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 "; + $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='PAYMENT' and year(date)= year(current_date()) group by month order by total desc limit 10 "; $query = $this->db->query($sql); return $query->result(); @@ -1736,7 +1753,7 @@ if ($fa and $aa != ''){ { $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 tinc.type='EXPENSE' and account_code = '$sid' and monthname(date)='$d'"; + WHERE tinc.type='PAYMENT' and account_code = '$sid' and monthname(date)='$d'"; $query = $this->db->query($sql); //print_r($this->db->last_query()); //echo $sql; @@ -1747,7 +1764,7 @@ if ($fa and $aa != ''){ { $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,monthname(tinc.date)as month,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 tinc.type='EXPENSE' and monthname(date) = ? group by account_code"; + WHERE tinc.type='PAYMENT' and monthname(date) = ? group by account_code"; $query = $this->db->query($sql,array($sid)); //print_r($this->db->last_query()); return $query->result(); @@ -1796,6 +1813,25 @@ function INRSymbol() return $query->result(); } - + function departmentmenu() + { + $sql="SELECT tinc.type,sum(tinc.total)as total,tinc.account_code,ac.name FROM t_income_expense tinc + join t_accountcode ac on ac.code=tinc.account_code + group by account_code"; + $query = $this->db->query($sql); + //print_r($this->db->last_query()); + return $query->result(); + + } + function menudepartmentwise($sid='') + { + $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 = '$sid'"; + $query = $this->db->query($sql); + //print_r($this->db->last_query()); + //echo $sql; + return $query->result(); + + } } ?> \ No newline at end of file diff --git a/application/views/addnewIncomeExpense.php b/application/views/addnewIncomeExpense.php index 7c887e79..f395d5d7 100755 --- a/application/views/addnewIncomeExpense.php +++ b/application/views/addnewIncomeExpense.php @@ -11,7 +11,7 @@ $(function() { var inc = []; t= ; $.each(t,function(i,item){ - if(item.type == 'INCOME') + if(item.type == 'RECEIPT') { $("#accode").append( $('').val(item.code).html(item.name)); } @@ -82,7 +82,7 @@ function loadAccountType(id) $('#accode').find('option').remove().end().append('').val('Select Account Code'); $.each(t,function(i,item){ - if(item.type == 'INCOME') + if(item.type == 'RECEIPT') { $("#accode").append( $('').val(item.code).html(item.name)); } @@ -97,7 +97,7 @@ function loadAccountType(id) $('#accode').find('option').remove().end().append('').val('Select Account Code'); $.each(t,function(i,item){ - if(item.type == 'EXPENSE') + if(item.type == 'PAYMENT') { $("#accode").append( $('').val(item.code).html(item.name)); } @@ -144,8 +144,8 @@ function loadAccountType(id)
Select Accounut type:

- Income         - Expense + RECEIPT         + PAYMENT
diff --git a/application/views/cashbookdepday.php b/application/views/cashbookdepday.php new file mode 100644 index 00000000..43b2ecc0 --- /dev/null +++ b/application/views/cashbookdepday.php @@ -0,0 +1,116 @@ +FontCode2000; + }} +?> + + + +
+
+
+
+

Department Based Report

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
dateAccount NamePaid Type Amount Description
date?>name?>type?>total,2,'.','');?>description?>
+ +
+
+
+
+
+
+ + + + + + + + diff --git a/application/views/cashbookdepmenu.php b/application/views/cashbookdepmenu.php new file mode 100644 index 00000000..3fc17fdd --- /dev/null +++ b/application/views/cashbookdepmenu.php @@ -0,0 +1,119 @@ +FontCode2000; + }} +?> + + + +
+
+
+
+

Cashbook Department

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Account NamePaid Type Amount
name?>type?>total,2,'.','');?>
+ +
+
+
+
+
+
+ + + + + + + + diff --git a/application/views/cashbooklisting.php b/application/views/cashbooklisting.php index 0da75ff6..c5659f4e 100755 --- a/application/views/cashbooklisting.php +++ b/application/views/cashbooklisting.php @@ -20,8 +20,8 @@
Account Type :  *
- Income
- Expense
+ RECEIPT
+ PAYMENT

Account Code :  * diff --git a/application/views/editCapitalPo.php b/application/views/editCapitalPo.php index 1e308214..5206e515 100755 --- a/application/views/editCapitalPo.php +++ b/application/views/editCapitalPo.php @@ -3143,6 +3143,20 @@ $("#PaymentMethod").select2();
+
+
+ +
+
+
+ 'ViewTotalAmountlocal','value' => set_value('ViewTotalAmountlocal'),'id'=>'ViewTotalAmountlocal', 'class' => 'form-control num' ,'placeholder' => 'Total Amount','readonly' => 'true'); + echo form_input($data); + ?> +
+
+ +

@@ -5884,6 +5898,7 @@ function DeleteRow(rowid) $('#ViewAfterSgst').val($('#AfterSgst'+userid).val()); $('#ViewAfterIgst').val($('#AfterIgst'+userid).val()); $('#ViewOtherAllowances').val($('#OtherAmt'+userid).val()); + $('#ViewTotalAmountlocal').val(cellval[9].innerHTML); $('#drpFreightviewloc').val($("#Ftype"+userid).val()); diff --git a/application/views/income_expense_list.php b/application/views/income_expense_list.php index d9594bdb..fde90f4d 100755 --- a/application/views/income_expense_list.php +++ b/application/views/income_expense_list.php @@ -29,7 +29,7 @@ Account Name Amount Details - + @@ -41,7 +41,18 @@ { ?> - id.'">'.$l->type.'';?> date),'d-m-Y');?> name;?> total;?> description;?> + + id.'">'.$l->type.'';?> + date),'d-m-Y');?> + name;?> + total;?> + description;?> + +
-
+
- + Receipt : Payments : @@ -164,7 +164,7 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:
-
+
@@ -177,11 +177,22 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:
-
+
- + + Receipt : + Payments : +
+
+
+
+
+
+ +
+ Receipt : Payments :
@@ -225,9 +236,13 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled: Date Account Name + Type + Received From Paid To - Paid Type - Amount + + + Receipt + Payments Description @@ -236,7 +251,9 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled: @@ -244,11 +261,17 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled: date?> name?> - towhom?> - type?> + type?> + receiptname?> + paymentname?> + + total,2,'.',''); - echo number_format($cash->total,2,'.','');?> + $ti= $ti + number_format($cash->income,2,'.',''); + echo number_format($cash->income,2,'.','');?> + expense,2,'.',''); + echo number_format($cash->expense,2,'.','');?> description?> @@ -263,10 +286,20 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled: - Total + Total       +   + + + +