diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index bf83b9fc..a2db93e8 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -313,9 +313,10 @@ class cashbook extends BaseController { $stat='OPEN'; } - $creditbalance=$totalbankamount-$totalamount; + $creditbalance=$totalbankamount-$ctotal; //echo $creditbalance; - if($creditbalance=='0') + //die(); + if($creditbalance==0) { $statu='CLOSE'; @@ -328,6 +329,8 @@ class cashbook extends BaseController if($amounttype=='CREDIT') { $cashbookstatus1= array('cclearbalance'=>$ctotal,'cstatus'=>$statu); + //print_r($cashbookstatus1); + //die(); $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); } else @@ -707,13 +710,12 @@ class cashbook extends BaseController { if ($this->input->post('btn_submit')) { - $SupplierName = $this->input->post('SupplierName'); + $Supplierid = $this->input->post('SupplierName'); $fdate = $this->input->post('from_date'); $tdate = $this->input->post('to_date'); //$data['cash'] = $_GET['sid']; //$data['bankid'] = $_GET['d']; - - $data['bankdepit'] = $this->cashbook_model->debitbankstatemet($SupplierName,$fdate,$tdate); + $data['bankdepit'] = $this->cashbook_model->debitbankstatemet($Supplierid,$fdate,$tdate); } $data['getsupplier'] = $this->cashbook_model->getsupplier(); @@ -764,7 +766,7 @@ class cashbook extends BaseController $tdate = $this->input->post('to_date'); $bankid= $_GET['d']; $data['mappingcashbook']=$this->cashbook_model->mappingcash($SupplierName,$fdate,$tdate,$bankid); - $data['mappingiv'] = $this->cashbook_model->creditinvoicelist($SupplierName,$fdate,$tdate,$bankid); + $data['mappingiv'] = $this->cashbook_model->creditinvoicelist($bankid); $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); $data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid); $data['supplier'] = $this->cashbook_model->getsupplier(); @@ -804,7 +806,11 @@ class cashbook extends BaseController $check = $this->input->post('check'); $rw = $this->input->post('rw'); $this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; - $date = $this->input->post('date'); + $date = $this->input->post('podate'); + $date = date_create($date);//,'Y-m-d'); + $date = date_format($date,'Y-m-d'); + //echo $date; + $pono = $this->input->post('pono'); $sname = $this->input->post('sname'); $tot = $this->input->post('tot'); @@ -987,9 +993,9 @@ class cashbook extends BaseController $updateamount=($totalpaidamount+$eRec); - $invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$totalpaidamount,'bankid'=>$bankid); + $invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid); - $invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid); + $invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$ip,'bankid'=>$bankid); // //print_r ($invoicedata); // //die(); @@ -1005,7 +1011,7 @@ class cashbook extends BaseController else { //echo "update"; - $result3 = $this->cashbook_model->invoiceupdate1($invoicedata,$invid); + $result3 = $this->cashbook_model->invoiceupdate1($invoicedata1,$invid); } if($balancetoreceived1==0) diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 4e6fd03c..85f4f745 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -19,7 +19,7 @@ class cashbook_model extends CI_Model } function getAccounTypes1() { - $this->db->select('name.type'); + $this->db->select('name,type'); $r = $this->db->get('t_accountcode'); return $r->result(); @@ -150,11 +150,12 @@ class cashbook_model extends CI_Model } - function debitbankstatemet($SupplierName,$fdate,$tdate) + function debitbankstatemet($Supplierid,$fdate,$tdate) { $status='ST057'; //echo $tdate; //die(); + //$Supplierid; $this->db->distinct(); $this->db->select('POM.PONO,POM.Paymentstatus,supp.SupplierName, POM.TotalOrderValue,POM.ServiceDescription,BR.Balancetopay,BR.Amountpaid, @@ -170,10 +171,11 @@ class cashbook_model extends CI_Model $this->db->where_in('POM.Status',[ST044,ST056]); $this->db->where('POM.Paymentstatus !=','ST057'); //$this->db->or_where('POM.Status',ST056); - $this->db->where('supp.SupplierName',$SupplierName); + - $this->db->or_where('POM.PODate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"'); + $this->db->where('POM.PODate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"'); + $this->db->or_where('supp.SupplierID',$Supplierid); $this->db->group_by('POM.PONO'); $query = $this->db->get(); @@ -191,8 +193,9 @@ class cashbook_model extends CI_Model $this->db->join ('T_Bankinvoicereport BI','BI.invoiceno = iv.invoice_number','left'); $this->db->where('iv.invoice_status_id','2'); $this->db->where('iva.receivedstatus !=','ST065'); - $this->db->where('ic.client_name',$Customer); - $this->db->or_where('iv.invoice_date_created BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"'); + $this->db->where('iv.invoice_date_created BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"'); + $this->db->or_where('ic.client_id',$Customer); + $this->db->group_by('iva.invoice_id'); //$this->db->where('inc.type','PAYMENT'); $query = $this->db->get(); @@ -236,13 +239,13 @@ function debitpolist($bankid) } - function creditinvoicelist($SupplierName,$fdate,$tdate,$bankid) + function creditinvoicelist($bankid) { - $this->db->select('indate,invoiceno,customername,totinvoiceamount,bankid as id, + $this->db->select('indate,invoiceno,customername,totinvoiceamount,bankid, balancetoreceived,amountreceived'); - $this->db->from ('T_Bankinvoicereport'); + $this->db->from ('T_Bankmappingiv'); $this->db->where('bankid',$bankid); - $this->db->group_by('invoiceno'); + //$this->db->group_by('invoiceno'); $query = $this->db->get(); return $query->result(); @@ -318,7 +321,7 @@ function newcashbook() function debitlistpo($SupplierName,$fdate,$tdate,$pono) { - $this->db->select('bmp.mid,bmp.PONO,bmp.Amountpaid,br.Narration'); + $this->db->select('bmp.mid,bmp.PONO,bmp.Amountpaid,br.Narration'); $this->db->from ('T_Bankmappingpo as bmp'); $this->db->join('T_bankreport br','br.ID = bmp.mid'); @@ -332,9 +335,8 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono) function creditlistinv($invno) { $this->db->select('bmp.bankid,bmp.invoiceno,bmp.amountreceived,br.Narration'); - $this->db->from ('T_Bankinvoicereport as bmp'); - - $this->db->join('T_bankreport br','br.ID = bmp.bankid'); + $this->db->from ('T_Bankmappingiv as bmp'); + $this->db->join('T_bankreport br','br.ID = bmp.bankid'); $this->db->where('invoiceno',$invno); // $this->db->group_by('PONO'); $query = $this->db->get(); @@ -344,7 +346,7 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono) function getsupplier() { - $this->db->select('SupplierName'); + $this->db->select('SupplierName,SupplierID'); $this->db->from('T_SupplierDetailsN'); //$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code'); //$this->db->where('t_income_expense.id') @@ -354,7 +356,7 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono) } function getcustomer() { - $this->db->select('client_name'); + $this->db->select('client_name,client_id'); $this->db->from('ip_clients'); //$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code'); //$this->db->where('t_income_expense.id') @@ -376,12 +378,12 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono) $r = $this->db->affected_rows(); return $r; } - function invicedata($invoicedata) - { - $this->db->insert('T_Bankinvoicereport',$invoicedata); - $r = $this->db->affected_rows(); - return $r; - } + // function invicedata($invoicedata) + // { + // $this->db->insert('T_Bankinvoicereport',$invoicedata); + // $r = $this->db->affected_rows(); + // return $r; + // } function mappingpo($podata) { $this->db->insert('T_Bankmappingpo',$podata); diff --git a/application/views/bankdebit.php b/application/views/bankdebit.php index 9258e394..fac40df0 100644 --- a/application/views/bankdebit.php +++ b/application/views/bankdebit.php @@ -118,7 +118,7 @@ {?> - + @@ -189,7 +189,8 @@ $tvt=0.00; if(!empty($bankdepit)){ foreach($bankdepit as $t) - { + { + //print_r($bankdepit); $status=$t->Paymentstatus; $balancetopay=$t->Balancetopay; //print_r($$status); @@ -202,7 +203,7 @@ - PODate?> + PODate),'d-m-Y');?> PONO?> @@ -278,7 +279,7 @@
- + @@ -355,6 +356,7 @@ var intex=1; var row=0; var j=1; var tott=0; +var total=0; function GetPayment(i) { @@ -363,13 +365,14 @@ function GetPayment(i) var balanceamount=bankdebitamount-totalvalue; var x = document.getElementById('checkboxcheckbox'+i).checked; + var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val()) var negative=0; if(amount<0) { - negative=1; - alert("Invalid Amount") - $('#invoicepaymet'+i).val(''); + negative=1; + alert("Invalid Amount") + $('#invoicepaymet'+i).val(''); } temp=intex; @@ -409,11 +412,12 @@ if(x==true) var totalordervalue =document.getElementById ("tov"+i ).innerText; //var advanceamount =document.getElementById ( "aa"+i ).innerText; var invoicepayment =document.getElementById ( "qw"+i ).innerText; - $('#invoicepaymet'+i).val(invoicepayment); + //alert(invoicepayment+'ipa'); + $('#invoicepaymet'+i).val(invoicepayment); var RowCount= $('#Rowid').val(); //alert(RowCount); //alert('advance' + advanceamount); - + //alert(j+'j'); $('').attr({ type:'hidden', name:'date1'+j, @@ -458,7 +462,6 @@ if(x==true) if(negative==1) { - // alert() for(o=1;ocashbook/receipt", success:function(data) diff --git a/application/views/bankinvoice.php b/application/views/bankinvoice.php index 8ca5866a..6fb1ea72 100644 --- a/application/views/bankinvoice.php +++ b/application/views/bankinvoice.php @@ -119,7 +119,7 @@ {?> - + @@ -205,7 +205,7 @@ - invoice_date_created?> + invoice_date_created),'d-m-Y');?> invoice_number?> client_name?> invoice_total?> diff --git a/application/views/bankinvoicesettlement.php b/application/views/bankinvoicesettlement.php index c9e78062..b69fafa3 100644 --- a/application/views/bankinvoicesettlement.php +++ b/application/views/bankinvoicesettlement.php @@ -200,8 +200,8 @@ if(!empty($debitmapping)) - indate?> - invoiceno?> + indate),'d-m-Y');?> + invoiceno?> customername?> totinvoiceamount?> balancetoreceived?> diff --git a/application/views/banksettlement.php b/application/views/banksettlement.php index c50effe4..7cae11e2 100644 --- a/application/views/banksettlement.php +++ b/application/views/banksettlement.php @@ -209,7 +209,7 @@ if(!empty($mapping)) - Podate?> + Podate),'d-m-Y');?> PONO?>