diff --git a/application/config/constants.php b/application/config/constants.php index 4964acf8..c6530b14 100755 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -133,6 +133,9 @@ define('ST063', 'ST063'); define('AMOUNT_PAID', 'ST057'); define('NO_PAID', 'ST058'); define('PARTIALLY_PAID', 'ST059'); +define('AMOUNT_RECEIVED', 'ST065'); +define('NO_RECEIVED', 'ST066'); +define('PARTIALLY_RECEIVED', 'ST067'); /* Work status code */ define('SERVICE_COMPLETED', 'ST046'); diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 73ec5c52..d62ff935 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -221,7 +221,7 @@ class cashbook extends BaseController $total=$directamount+$alreadypaid; $ctotal=$directamount+$alreadycreditpaid; //echo $totalbankamount; - if($amounttype==0) + if($amounttype==CREDIT) { $type=RECEIPT; $bankamounttype=CREDIT; @@ -338,7 +338,7 @@ class cashbook extends BaseController { $cashbookstatus = array('Clearbalance'=>$total,'Status'=>$stat); //print_r($cashbookstatus); - $res = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); + $res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); } @@ -608,6 +608,7 @@ class cashbook extends BaseController $amounttype = $this->input->post('amounttype'); $bankid=$this->input->post('bankid'); $normalid=$this->input->post('normalid'); + $bankamount=$this->input->post('bankamount'); $document =null; //$document1=$this->input->post('myfile'); @@ -657,13 +658,20 @@ class cashbook extends BaseController { $cashamnt=$ca->total; } - + if($bankamount==$cashamnt) + { + $status='CLOSE'; + } + else + { + $status='OPEN'; + } //print_r($invoiceamount); if($amounttype=='CREDIT') { $updatecredit=$invam+$cashamnt; //print_r($updateamount); - $cashbookstatus1= array('cclearbalance'=>$updatecredit,'cstatus'=>$statu); + $cashbookstatus1= array('cclearbalance'=>$updatecredit,'cstatus'=>$status); //print_r($cashbookstatus1); //die(); $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); @@ -672,7 +680,7 @@ class cashbook extends BaseController else { $updatedepit=$poamnt+$cashamnt; - $cashbookstatus = array('Clearbalance'=>$updatedepit,'Status'=>$stat); + $cashbookstatus = array('Clearbalance'=>$updatedepit,'Status'=>$status); // print_r($cashbookstatus); //die(); $res = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); @@ -744,6 +752,8 @@ class cashbook extends BaseController $bankid= $_GET['d']; $data['mappingcashbook']=$this->cashbook_model->mappingcash($SupplierName,$fdate,$tdate,$bankid); $data['mapping'] = $this->cashbook_model->debitpolist($bankid); + $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); + $data['paidpoamount'] = $this->cashbook_model->poamonut($bankid); $data['supplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("banksettlement", $this->global,$data,NULL); @@ -759,6 +769,8 @@ class cashbook extends BaseController $bankid= $_GET['d']; $data['mappingcashbook']=$this->cashbook_model->mappingcash($SupplierName,$fdate,$tdate,$bankid); $data['mappingiv'] = $this->cashbook_model->creditinvoicelist($SupplierName,$fdate,$tdate,$bankid); + $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); + $data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid); $data['supplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("bankinvoicesettlement", $this->global,$data,NULL); @@ -1000,6 +1012,17 @@ class cashbook extends BaseController $result3 = $this->cashbook_model->invoiceupdate1($invoicedata,$invid); } + if($balancetoreceived1==0) + { + $status=AMOUNT_RECEIVED; + + } + else + { + $status=PARTIALLY_RECEIVED; + } + $invoicemaster= array('receivedstatus'=>$status); + $result1 = $this->cashbook_model->invoiceamountstatus($invoicemaster,$invid); echo ""; diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index d18c54d0..3c5538fc 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -87,9 +87,9 @@ class cashbook_model extends CI_Model } function viewdepartment($sid='') { - $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 + $sql="SELECT ie.*,br.ID,ie.totalbankamount,ac.name,ie.id,date_format(ie.date,'%d-%m-%Y')as date FROM t_income_expense ie + left join t_accountcode ac on ac.code=ie.account_code + left 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()); @@ -189,6 +189,7 @@ class cashbook_model extends CI_Model $this->db->join ('ip_invoices iv','iv.invoice_id = iva.invoice_id','left'); $this->db->join ('ip_clients ic','ic.client_id = iv.client_id','left'); $this->db->join ('T_Bankinvoicereport BI','BI.invoiceno = iva.invoice_id','left'); + $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->group_by('iva.invoice_id'); @@ -223,7 +224,7 @@ function receiptdata() function debitpolist($bankid) { - $this->db->select('mid,Podate,PONO,Suppliername,Totalpoamount, + $this->db->select('mid,Podate,PONO,Suppliername,Totalpoamount, Balancetopay,Amountpaid'); $this->db->from ('T_Bankmappingpo'); $this->db->where('mid',$bankid); @@ -233,9 +234,13 @@ function debitpolist($bankid) return $query->result(); } + function paidcbook($bankid) + { + + } function creditinvoicelist($SupplierName,$fdate,$tdate,$bankid) { - $this->db->select('indate,invoiceno,customername,totinvoiceamount, + $this->db->select('indate,invoiceno,customername,totinvoiceamount,bankid as id, balancetoreceived,amountreceived'); $this->db->from ('T_Bankinvoicereport'); $this->db->where('bankid',$bankid); @@ -433,7 +438,7 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono) } public function cashbankupdate($cashbookstatus,$bankid) { - + echo $bankid; $this->db->where('ID',$bankid); $this->db->update('T_bankreport',$cashbookstatus); return TRUE; @@ -549,6 +554,14 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono) $r = $this->db->affected_rows(); return $r; + } + function invoiceamountstatus($invoicemaster,$invid) + { + $this->db->where('invoice_id',$invid); + $this->db->update('ip_invoice_amounts',$invoicemaster); + $r = $this->db->affected_rows(); + return $r; + } // function poamountstatus1($pomaster1,$pono) // { diff --git a/application/views/bankcashnew.php b/application/views/bankcashnew.php index 6721654c..5a22200b 100644 --- a/application/views/bankcashnew.php +++ b/application/views/bankcashnew.php @@ -1,5 +1,8 @@ + +
@@ -351,7 +379,7 @@ if(!empty($cashbanking)) @@ -405,8 +433,26 @@ if(!empty($cashbanking)) // $('#towhom').text('Received From:'); // } // } ); +function amountcheck() +{ + var bankamount=$('#totalbankamount').val(); + var total = $('#totalamount').val(); + if(parseFloat(bankamount)>=parseFloat(total)) + { + validate(); + } + else + { + alert('your mapping amount is large') + } + +} + + function validate() { + + //var paidcash=$('#totalbankamount').val(); var accode = $('#accode').val(); var date = $('#Date').val(); var towhome = $('#towhome').val(); @@ -419,6 +465,7 @@ function validate() var cgst = $('#CGST').val(); var igst = $('#IGST').val(); var total = $('#totalamount').val(); + var errorflag = 0; @@ -510,19 +557,19 @@ function calculateTotal() $('#totalamount').val((total.toFixed(2))); } -$('#myradio1').click(function(){ +// $('#myradio1').ready(function(){ - $('#towhom').ready('Received From:'); + // $('#towhom').ready('Received From:'); -}); +// }); -$('#myradio2').ready(function(){ +// $('#myradio2').ready(function(){ - $('#towhom').text('Paid To:'); + // $('#towhom').text('Paid To:'); -}); +// }); @@ -531,15 +578,3 @@ $('#myradio2').ready(function(){ - \ No newline at end of file diff --git a/application/views/bankingfile.php b/application/views/bankingfile.php index 830e95ec..b1d773bf 100644 --- a/application/views/bankingfile.php +++ b/application/views/bankingfile.php @@ -72,7 +72,7 @@ function checkYearMonthAsEmpty()
- + @@ -95,10 +95,11 @@ function checkYearMonthAsEmpty()