diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index f5810400..1e5861fd 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -69,9 +69,36 @@ class cashbook extends BaseController } else{ //$data['list'] = $this->cashbook_model->getIncomeExpenseList(); - $data['list'] = $this->cashbook_model->getreceiptpaymentlist(); + //$data['list'] = $this->cashbook_model->getreceiptpaymentlist(); //$this->global['pageTitle'] = 'Resico : Cash Book: Listing'; $this->global['pageTitle'] = $this->CompanyName.': Receipt and Payment Details'; + if ($this->input->post('btn_submit')) { + + $fromdt = $this->input->post('from_date'); + $todt = $this->input->post('to_date'); + $ab=$this->input->post('financialyear'); + + $fromyear=substr($ab,0,-5); + $toyear=substr($ab,5,5); + + + $data['finyear']=$this->cashbook_model->finyear(); + $data['list'] = $this->cashbook_model->getIncomeExpense($fromyear,$toyear,$fromdt,$todt); + + } + else{ + + if (date('m') <= 3) { + $preyear = (date('Y')-1); + $currentyear = date('Y'); + } else { + $preyear = date('Y') ; + $currentyear = (date('Y') + 1); + } + + $data['list'] = $this->cashbook_model->getIncomeExpense($preyear,$currentyear); + $data['finyear']=$this->cashbook_model->finyear(); + } $this->loadViews("income_expense_list", $this->global, $data , NULL); } diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index eb93bafa..4adfc5a1 100644 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -1062,7 +1062,7 @@ class purchaseorder extends BaseController $SupplierID = $this->input->post('drpSupplier'); $newsup=$this->input->post('newsup'); - $newSupId = split("[ - ]+", $newsup); + $newSupId = preg_split("[ - ]", $newsup); $DeliveryAddr = $this->input->post('txtDeliveryAddress'); $dt = $this->input->post('Deliverydt'); @@ -1142,7 +1142,6 @@ class purchaseorder extends BaseController } } - for($i = 1; $i <= $RowCount; $i++) { diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index f90169eb..7019f7c2 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -71,8 +71,44 @@ class cashbook_model extends CI_Model $query = $this->db->query($sql); return $query->result(); } - + function getIncomeExpense($firstyear,$secondyear,$frmdt,$todt) + { + $this->db->select('t_accountcode.name,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*'); + $this->db->from('t_income_expense'); + $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left'); + $this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId','left'); + $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left'); + + if ($firstyear and $secondyear != ''){ + $finyear = "t_income_expense.date >= '".$firstyear."-04-01' and t_income_expense.date <= '".$secondyear."-03-31'"; + $this->db->where($finyear); + } + if ($frmdt and $todt != ''){ + $fromdate= date("Y-m-d",strtotime($frmdt)); + $todate=date("Y-m-d",strtotime($todt)); + $date = "date(t_income_expense.date) >= '".$fromdate."' + and date(t_income_expense.date) <= '".$todate."'"; + $this->db->where($date); + } + $this->db->order_by("date","desc"); + $r = $this->db->get(); + return $r->result(); + } + + function finyear(){ + + + $sql="SELECT + CASE WHEN MONTH(date)>=4 THEN + concat(YEAR(date), '-',YEAR(date)+1) + ELSE concat(YEAR(date)-1,'-', YEAR(date)) END AS financial_year + FROM t_income_expense + GROUP BY financial_year"; + $query = $this->db->query($sql); + return $query->result(); + + } function getCompany() { diff --git a/application/views/income_expense_list.php b/application/views/income_expense_list.php index d769a1ae..b1243389 100755 --- a/application/views/income_expense_list.php +++ b/application/views/income_expense_list.php @@ -1,23 +1,86 @@ -
- -
-

- -
-

-
+
+ -
-
-
-
- Add New - -
-
- +
+ +
+ +
+

+
+ Add New +
+
+ +
+
+ +
+ + +
+ +
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+
+ +
+ + + + + + +
+ + +
+
+ + + +
+
+ +
+ +
+ + +
+ +