From 588715f3507cb287341d20cbf82e7c27ad39732e Mon Sep 17 00:00:00 2001 From: gayathri1990 Date: Wed, 5 Dec 2018 16:07:16 +0530 Subject: [PATCH] ledgerstatement --- application/config/routes.php | 3 +- application/controllers/cashbook.php | 66 +++- application/models/cashbook_model.php | 183 +++++++++ application/views/bankcustomerledger.php | 484 +++++++++++++++++++++++ application/views/banksupplierledger.php | 448 +++++++++++++++++++++ 5 files changed, 1182 insertions(+), 2 deletions(-) create mode 100644 application/views/bankcustomerledger.php create mode 100644 application/views/banksupplierledger.php diff --git a/application/config/routes.php b/application/config/routes.php index c356293c..05d1b7e4 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -237,7 +237,8 @@ $route['BankingFile']= "cashbook/bankfileupload"; $route['MappingPo']="cashbook/mappingpo"; //$route['Filelist']="cashbook/filelist"; //$route['Bankingrecord']= "cashbook/bankdata"; - +$route['Bankledgersupplier']="cashbook/supplierledger"; +$route['Bankledgercustomer']="cashbook/customerledger"; $route['Bankamountpaid']= "cashbook/amountpaidsupplier"; $route['Bankamountunpaid']= "cashbook/amountunpaid"; //$route['Bankamountreceived']= "cashbook/amountreceived"; diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 723d7c9a..fed89157 100644 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -1675,7 +1675,71 @@ class cashbook extends BaseController // } - + function supplierledger() + { + $this->global['pageTitle'] = 'Siddharth : Bank Report - Amount Payment Details'; + //$suppliername= $_GET['sid']; + if ($this->input->post('btn_submit')) + { + $ab=$this->input->post('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $m=$this->input->post('month'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('to_date'); + $supplierID= $this->input->post('supplier'); + $data['supplierid']=$supplierID; + $suppliername= $this->input->post('SupplierName'); + $data['suppliername']=$suppliername; + $data['fa']=$fa; + $data['aa']=$aa; + $data['m']=$m; + $data['fdate']=$fdate; + $data['tdate']=$tdate; + $data['suppliername']= $suppliername; + $data['supplierledger'] = $this->cashbook_model->supplierledger($suppliername,$fdate,$tdate,$fa,$aa,$m); + $data['openingbalancesupplier'] = $this->cashbook_model->openingbalancesupplier($customer,$fdate,$tdate,$fa,$aa,$m); + //print_r($data['supplierledger']); + } + + $data['finyear']=$this->cashbook_model->report_amountpaid(); + $data['getsupplier'] = $this->cashbook_model->getsupplier(); + $this->loadViews("banksupplierledger", $this->global,$data, NULL); + + } + function customerledger() + { + $this->global['pageTitle'] = 'Siddharth : Bank Report - Amount Payment Details'; + //$suppliername= $_GET['sid']; + if ($this->input->post('btn_submit')) + { + $ab=$this->input->post('financialyear'); + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + $m=$this->input->post('month'); + $fdate = $this->input->post('from_date'); + $tdate = $this->input->post('to_date'); + $supplierID= $this->input->post('supplier'); + $data['supplierid']=$supplierID; + $customer = $this->input->post('Customer'); + $data['suppliername']=$suppliername; + $data['fa']=$fa; + $data['aa']=$aa; + $data['m']=$m; + $data['fdate']=$fdate; + $data['tdate']=$tdate; + $data['customername']= $Customer; + $data['customerledger'] = $this->cashbook_model->customerledger($customer,$fdate,$tdate,$fa,$aa,$m); + $data['openingbalance'] = $this->cashbook_model->openingbalance($customer,$fdate,$tdate,$fa,$aa,$m); + + } + + $data['finyear']=$this->cashbook_model->report_amountpaid(); + $data['getcustomer'] = $this->cashbook_model->getcustomer(); + $this->loadViews("bankcustomerledger", $this->global,$data, NULL); + + } + public function amountunpaid() diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 681cb570..fe51ea82 100644 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -611,6 +611,189 @@ function amountunpaid($supplierid1,$fa,$aa,$m,$fdate,$tdate) } + function supplierledger($suppliername,$fdate,$tdate,$fa,$aa,$m) + { + + + $sql="select date,igrn,ID,narration,sid,supplier_name,amountpaid, + sum(total) as total + from ledgersupplier + where ID != 'null' and Status != 'ST030'"; + + + + if ($suppliername!= ''){ + + $sql.="and sid = '".$suppliername."'"; + + } + + + if ($fa and $aa != ''){ + + //$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; + $sql.=" and (date >= '".$fa."-04-01' and date <= '".$aa."-03-31')"; + + } + if ($m!= ''){ + + //$sql.="and monthname(im.CreatedDate) = '".$m."'"; + $sql.="and monthname(date) = '".$m."'"; + + } + + + if ($fdate and $tdate != ''){ + $fromd= date("Y-m-d",strtotime($fdate)); + $tod=date("Y-m-d",strtotime($tdate)); + + $sql.="and date(date) >= '".$fromd."' + and date(date) <= '".$tod."'"; + + + } + + $sql.="group by igrn"; + $query = $this->db->query($sql); + return $query->result(); + + + } + function customerledger($customer,$fdate,$tdate,$fa,$aa,$m) + { + + + $sql="select date,id,amount,invoice_number,invoice_status_id,customername,customerid,payment,id + from ledgercustomer + where invoice_number != 'null' "; + + + + if ($customer!= ''){ + + $sql.="and customerid = '".$customer."'"; + + } + + if ($fa and $aa != ''){ + + //$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; + $sql.=" and (date >= '".$fa."-04-01' and date <= '".$aa."-03-31')"; + + } + if ($m!= ''){ + + //$sql.="and monthname(im.CreatedDate) = '".$m."'"; + $sql.="and monthname(date) = '".$m."'"; + + } + + + if ($fdate and $tdate != ''){ + $fromd= date("Y-m-d",strtotime($fdate)); + $tod=date("Y-m-d",strtotime($tdate)); + + $sql.="and date(date) >= '".$fromd."' + and date(date) <= '".$tod."'"; + + + } + + + + + + $query = $this->db->query($sql); + return $query->result(); + + + } + function openingbalance($customer,$fdate,$tdate,$fa,$aa,$m) + { + + $sql="select date as date,sum(payment) as payment + from ledgercustomer + where invoice_number != 'null' "; + + + if ($customer!= ''){ + + $sql.="and customerid = '".$customer."'"; + + } + + if ($fa and $aa != ''){ + + //$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; + $sql.=" and (date >= '".$fa."-04-01' and date <= '".$aa."-03-31')"; + + } + if ($m!= ''){ + + //$sql.="and monthname(im.CreatedDate) = '".$m."'"; + $sql.="and monthname(date) >= '".$m."'"; + + } + + if ($fdate and $tdate != ''){ + $fromd= date("Y-m-d",strtotime($fdate)); + $tod=date("Y-m-d",strtotime('01-04-2018')); + + $sql.="and date(date) >= '".$tod."' + and date(date) <= '".$fromd."'"; + //$sql.="and date('2018-04-01') <= '".$fromd."'"; + + + } + $query = $this->db->query($sql); + // print_r($this->db->last_query()); + // die(); + + return $query->result(); + } + function openingbalancesupplier($customer,$fdate,$tdate,$fa,$aa,$m) + { + + $sql="select date as date,sum(amountpaid) as amountpaid + from ledgersupplier + where ID != 'null' "; + + + if ($customer!= ''){ + + $sql.="and customerid = '".$customer."'"; + + } + + if ($fa and $aa != ''){ + + //$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; + $sql.=" and (date >= '".$fa."-04-01' and date <= '".$aa."-03-31')"; + + } + if ($m!= ''){ + + //$sql.="and monthname(im.CreatedDate) = '".$m."'"; + $sql.="and monthname(date) >= '".$m."'"; + + } + + if ($fdate and $tdate != ''){ + $fromd= date("Y-m-d",strtotime($fdate)); + $tod=date("Y-m-d",strtotime('01-04-2018')); + + $sql.="and date(date) >= '".$tod."' + and date(date) <= '".$fromd."'"; + //$sql.="and date('2018-04-01') <= '".$fromd."'"; + + + } + $query = $this->db->query($sql); + // print_r($this->db->last_query()); + // die(); + + return $query->result(); + } function receivedamount($Customer,$fdate,$tdate) { // $status='ST065'; diff --git a/application/views/bankcustomerledger.php b/application/views/bankcustomerledger.php new file mode 100644 index 00000000..3e6d4ebf --- /dev/null +++ b/application/views/bankcustomerledger.php @@ -0,0 +1,484 @@ + + +payment; +} + foreach($financialyear as $item) + + { + $finyear = $item->financial_year; + + } ?> + + + + + + + + + + + + +
+
+
+ + +
+ +
+
+ + + + + + + +
+ +

Customer Ledger +    + + + +

+ client_name; + } + ?> +

+

+
+
+ + + + +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ + amount; + $total_invoice=$total_invoice+$totalinvoice; + $amountreceived=$cls->payment; + $amount_receive= $amount_receive+$amountreceived; + $balance_due=$total_invoice-$amount_receive; + } + $i++; + ?> +

Opening Balance    :    (₹)

+

Invoiced Amount :    (₹)

+

Amount Paid         :    (₹)

+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + amount; + $payments=$cl->payment; + $amountreceived=$cl->amountreceived; + $Balance=$total-$amountreceived; + $invoice_status_idcheck=$cl->invoice_status_id; + // $id=$ap->id; + //print_r($ap); + ?> + + + + + + + + + + + + invoice_status_id; + } + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DateTransactionsDocument NoAmountPayments(₹)Balance (₹)
date),'d-m-Y'); ?>id?>
Balance Due   + + + +  
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + diff --git a/application/views/banksupplierledger.php b/application/views/banksupplierledger.php new file mode 100644 index 00000000..fcfa5f6a --- /dev/null +++ b/application/views/banksupplierledger.php @@ -0,0 +1,448 @@ + + +amountpaid; +} + foreach($financialyear as $item) + + { + $finyear = $item->financial_year; + + } ?> + + + + + + + + + + + +
+
+
+ + +
+ +
+
+ + + + + + + +
+ +

Supplier Ledger +    + + + +

+ supplier_name; + } + ?> +

+

+
+
+ + + + +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ + + + +
+
+ + +
+ +
+ + + + +
+
+
+ + +
+ +
+ + +
+ +
+ +
+
+ total; + $total_po=$total_po+$totalpo; + $amountpaid=$sls->amountpaid; + $amount_paid= $amount_paid+$amountpaid; + $balance_due=$total_po-$amount_paid; + } + $i++; + ?> +

Opening Balnce       :    (₹)

+

Purchased Amount :    (₹)

+

Amount Paid             :    (₹)

+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + total; + $payments=$sl->amountpaid; + $Balance=$total-$payments; + $Bankdate=$sl->bankdate; + $narration=$sl->narration + // $id=$ap->id; + //print_r($ap); + ?> + + + + + + + + + + + + + total; + } + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DateSupplier NameTransactionsDocument NoAmountPayments(₹)Balance (₹)
date),'d-m-Y'); ?>supplier_name?>narration?>ID?>amountpaid)?>
Balance Due     + + + +
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + +