From 3a820ca3b1db866fd0b549d9558832bc922d848e Mon Sep 17 00:00:00 2001 From: gayathri1990 Date: Tue, 27 Mar 2018 15:13:37 +0530 Subject: [PATCH] bankreport --- application/controllers/cashbook.php | 46 ++++++++- application/models/cashbook_model.php | 38 +++++++- application/views/bankcashnew.php | 67 +++++++++++-- application/views/bankstatement.php | 7 +- application/views/editincomeexpenses.php | 10 ++ application/views/includes/header.php | 114 +++++----------------- application/views/income_expense_list.php | 2 + 7 files changed, 182 insertions(+), 102 deletions(-) diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index d0ca44c1..341e8a89 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -514,6 +514,7 @@ class cashbook extends BaseController $cashbookdatas = array('type'=>$acc_type,'code'=>$acc_code,'name'=>$acc_name,'accountname'=>$acc_pname,'categories'=>$acc_categories,'description'=>$acc_desc,'status'=>$acc_status,'created_on'=>$acc_createddt); // print_r($cashbookdatas); + $result = $this->cashbook_model->Cashbook($cashbookdatas); } } @@ -544,6 +545,7 @@ class cashbook extends BaseController $this->load->model('cashbook_model'); $data['DepDetails'] = $this->cashbook_model->viewdepartment($cash); + //$data['deletefile'] = $this->cashbook-model->deletefile($cash); $data['dropdownvalues'] = $this->cashbook_model->getAccounTypes(); //print_r( $data['DepDetails']);die(); @@ -603,6 +605,9 @@ class cashbook extends BaseController $description1 = $this->input->post('description'); $deleteflag = $this->input->post('deleteflag'); $oldfile = $this->input->post('oldfile'); + $amounttype = $this->input->post('amounttype'); + $bankid=$this->input->post('bankid'); + $normalid=$this->input->post('normalid'); $document =null; //$document1=$this->input->post('myfile'); @@ -632,9 +637,48 @@ class cashbook extends BaseController $document = null; } } + + $updateaccount = array('type'=>$option,'account_code'=>$accountcode1,'date'=>$date,'towhom'=>$towhome1,'invoice_no'=>$Invoiceno1,'merchant'=>$merchant1,'merchant_gst'=>$Merchantgst1,'HSN'=>$hsn1,'value_before_gst'=>$valuebeforegST1,'sgst'=>$SGST1,'cgst'=>$CGST1,'igst'=>$IGST1,'total'=>$totalamount1,'description'=>$description1,'document'=>$document); + $res = $this->cashbook_model->updatedepartment($updateaccount,$id1); //print_r($updateaccount);die(); - $res = $this->cashbook_model->updatedepartment($updateaccount,$id1); + $cashbookamount=$this->cashbook_model->cashbookamount($bankid); + $invoiceamount=$this->cashbook_model->invoiceamonut($bankid); + $poamount=$this->cashbook_model->poamonut($bankid); + foreach($invoiceamount as $ia) + { + $invam=$ia->amountreceived; + } + foreach($poamount as $pa) + { + $poamnt=$pa->amountpaid; + } + foreach($cashbookamount as $ca) + { + $cashamnt=$ca->total; + } + + //print_r($invoiceamount); + if($amounttype=='CREDIT') + { + $updatecredit=$invam+$cashamnt; + //print_r($updateamount); + $cashbookstatus1= array('cclearbalance'=>$updatecredit,'cstatus'=>$statu); + //print_r($cashbookstatus1); + //die(); + $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); + } + + else + { + $updatedepit=$poamnt+$cashamnt; + $cashbookstatus = array('Clearbalance'=>$updatedepit,'Status'=>$stat); + print_r($cashbookstatus); + //die(); + $res = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); + + } + //if( $res == 1 ){ echo ""; diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 996afdc8..74f173c6 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -87,8 +87,9 @@ class cashbook_model extends CI_Model } function viewdepartment($sid='') { - $sql="SELECT ie.*,ac.name,date_format(ie.date,'%d-%m-%Y')as date FROM t_income_expense ie + $sql="SELECT ie.*,br.ID,ac.name,ie.id,date_format(ie.date,'%d-%m-%Y')as date FROM t_income_expense ie join t_accountcode ac on ac.code=ie.account_code + join T_bankreport br on br.ID=ie.bankid WHERE ie.id = ?"; $query = $this->db->query($sql,array($sid)); //print_r($this->db->last_query()); @@ -234,8 +235,39 @@ function debitpolist($bankid) balancetoreceived,amountreceived'); $this->db->from ('T_Bankinvoicereport'); $this->db->where('bankid',$bankid); - - $this->db->group_by('invoiceno'); + $this->db->group_by('invoiceno'); + $query = $this->db->get(); + return $query->result(); + + } + //for cashbook edit screen and update bankreport// + function invoiceamonut($bankid) + { + $this->db->select('sum(amountreceived)as amountreceived'); + $this->db->from ('T_Bankinvoicereport'); + $this->db->where('bankid',$bankid); + //$this->db->group_by('invoiceno'); + $query = $this->db->get(); + return $query->result(); + + } + //for cashbook edit screen and update bankreport// + function poamonut($bankid) + { + $this->db->select('sum(Amountpaid)as amountpaid'); + $this->db->from ('T_Bankporeport'); + $this->db->where('mid',$bankid); + //$this->db->group_by('invoiceno'); + $query = $this->db->get(); + return $query->result(); + + } + function cashbookamount($bankid) + { + $this->db->select('sum(total)as total'); + $this->db->from ('t_income_expense'); + $this->db->where('bankid',$bankid); + //$this->db->group_by('invoiceno'); $query = $this->db->get(); return $query->result(); diff --git a/application/views/bankcashnew.php b/application/views/bankcashnew.php index a8c66e44..67c37153 100644 --- a/application/views/bankcashnew.php +++ b/application/views/bankcashnew.php @@ -15,9 +15,13 @@ $(function() { { $("#accode").append( $('').val(item.code).html(item.name)); } + else(item.type == 'PAYMENT') + { + $("#accode").append( $('').val(item.code).html(item.name)); + } }); - + $('#gst').click(function(){ $('#gstarea').toggle(); @@ -65,7 +69,7 @@ function isNumberKey(evt) return true; } - +//$(document).ready(function(id) function loadAccountType(id) { //alert('called'+id); @@ -337,6 +341,11 @@ if(!empty($cashbanking)) +
+ File Upload: + your image
+ +
@@ -387,7 +396,18 @@ if(!empty($cashbanking)) - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/application/views/bankstatement.php b/application/views/bankstatement.php index e164dc22..114682dd 100644 --- a/application/views/bankstatement.php +++ b/application/views/bankstatement.php @@ -477,7 +477,7 @@ if (x==true) var text = e.options[e.selectedIndex].text; var camount =$('#credit'+i).text(); var RowCount= $('#Rowid').val(); - var id=document.getElementById ("bankid"+value).innerText; + var id=document.getElementById ("bankid"+bankid).innerText; var date=document.getElementById ("date"+value).innerText; var debit=document.getElementById ("debit"+value ).innerText; var idvalue = id+'-'+debit; @@ -521,8 +521,7 @@ if (x==true) } else if(value=='3' && (type=='0' ||type=='1')) { - alert(value+'cash'); - alert(amounttype); + if(avalue>0) { $('#content').loader('show'); @@ -530,7 +529,7 @@ if (x==true) { data:{bankdate:date,bankid:id,type:amounttype,bankamount:avalue,forstatus:avalue,alreadypaid:tpaid,alreadycreditpaid:tcpaid,debitamount:debit1,creditamount:credit1}, type:"POST", - url:"cashbook/cashpayment", + url:"Payment", success:function(data) { diff --git a/application/views/editincomeexpenses.php b/application/views/editincomeexpenses.php index 09a21324..c49260e2 100755 --- a/application/views/editincomeexpenses.php +++ b/application/views/editincomeexpenses.php @@ -30,8 +30,13 @@ if(!empty($DepDetails)) $final = base_url().$document; //echo $final; // print_r( $DepDetails);die(); + $bankid=$ded->ID; + $normalid=$ded->id; $accountcode1=$ded->account_code; $id=$ded->id; + $amounttype=$ded->amounttype; + $alreadypaid=$ded->Clearbalance; + $alreadyreceived=$ded->cclearbalance; $type1=$ded->type; $viewdep=$ded->total; $dropdown=$ded->name; @@ -390,6 +395,11 @@ function loadAccountType(id) + + + + +
diff --git a/application/views/includes/header.php b/application/views/includes/header.php index 3a3cd943..062b1fbd 100755 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -1118,6 +1118,16 @@ $(function() { Receipt and Payment + + + + + + +
  • + Banking + @@ -1218,6 +1187,16 @@ $(function() { Receipt and Payment
  • + + + + + + +
  • + Banking + -
  • + + + + + diff --git a/application/views/income_expense_list.php b/application/views/income_expense_list.php index 9a75c570..c8c0f159 100755 --- a/application/views/income_expense_list.php +++ b/application/views/income_expense_list.php @@ -29,6 +29,7 @@ Account Type DATE Account Name + Cash Type Amount Details Action @@ -47,6 +48,7 @@ id.'">'.$l->type.'';?> date),'d-m-Y');?> name;?> + cashtype;?> total;?> description;?>