filter worhing based on bankdate
This commit is contained in:
parent
9d50b44b29
commit
c25cfeb78a
@ -315,9 +315,25 @@ class cashbook extends BaseController
|
||||
$debit =$sheet->getCell('F'.$x)->getValue();
|
||||
$credit=$sheet->getCell('G'.$x)->getValue();
|
||||
$balance=$sheet->getCell('H'.$x)->getValue();
|
||||
|
||||
if($debit==0)
|
||||
{
|
||||
$Status='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$Status='OPEN';
|
||||
}
|
||||
if ($credit==0)
|
||||
{
|
||||
$cstatus='';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// $IsActive=0;
|
||||
$filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'cbalancetocleared'=>$credit,'Balance'=>$balance,'Bankname'=>$bank);
|
||||
$filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'cbalancetocleared'=>$credit,'Balance'=>$balance,'Bankname'=>$bank,);
|
||||
|
||||
|
||||
|
||||
@ -492,7 +508,7 @@ class cashbook extends BaseController
|
||||
else
|
||||
{
|
||||
$cashbookstatus = array('Clearbalance'=>$total,'Balancetocleared'=>$updateBalancetocleared,'Status'=>$statu1,'IsActive'=>$isactive);
|
||||
$res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid);
|
||||
$res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid);
|
||||
|
||||
}
|
||||
|
||||
@ -901,8 +917,8 @@ class cashbook extends BaseController
|
||||
$updateaccount = array('type'=>$option,'account_code'=>$accountcode1,'date'=>$date,'towhom'=>$towhome1,'Supplier_id'=>$supplier,'invoice_no'=>$Invoiceno1,'merchant'=>$merchant1,'merchant_gst'=>$Merchantgst1,'HSN'=>$hsn1,'value_before_gst'=>$valuebeforegST1,'sgst'=>$SGST1,'cgst'=>$CGST1,'igst'=>$IGST1,'total'=>$totalamount1,'gststatus'=>(!empty($gsttoggle)?'1':'0'),'description'=>$description1,'document'=>$document);
|
||||
$res = $this->cashbook_model->updatedepartment($updateaccount,$id1);
|
||||
//print_r($updateaccount);die();
|
||||
$cashbookamount=$this->cashbook_model->cashbookamount($bankid);
|
||||
$invoiceamount=$this->cashbook_model->invoiceamonut($bankid);
|
||||
$cashbookamount=$this->cashbook_model->cashbookamount($bankid);
|
||||
$invoiceamount=$this->cashbook_model->invoiceamonut($bankid);
|
||||
$poamount=$this->cashbook_model->poamonut($bankid);
|
||||
foreach($invoiceamount as $ia)
|
||||
{
|
||||
@ -1126,6 +1142,9 @@ class cashbook extends BaseController
|
||||
$date = $this->input->post('podate');
|
||||
$date = date_create($date);
|
||||
$date = date_format($date,'Y-m-d');
|
||||
$bankdate =$this->input->post('bankdate');
|
||||
$bankdate = date_create($bankdate);//,'Y-m-d');
|
||||
$bankdate = date_format($bankdate,'Y-m-d');
|
||||
$pono = $this->input->post('pono');
|
||||
$igrno=$this->input->post('igrno');
|
||||
$igrlineitem=$this->input->post('igrlineitem');
|
||||
@ -1208,11 +1227,11 @@ class cashbook extends BaseController
|
||||
$amtpaid= ($ip+$ePay);
|
||||
$IsActive=1;
|
||||
|
||||
$podata1 = array('Podate'=>$date,'PONO'=>$pono,'IGRNO'=>$igrno,'Suppliername'=>$sname,'SupplierID'=>$sid,'Totalpoamount'=>$tot,'Amountpaid'=>$ip,'Balancetopay'=>$balancetopay,'mid'=>$bankid,'IGRLineItemNo'=>$igrlineitem,'IsActive'=>$IsActive);
|
||||
$podata1 = array('Podate'=>$date,'PONO'=>$pono,'IGRNO'=>$igrno,'Suppliername'=>$sname,'SupplierID'=>$sid,'Totalpoamount'=>$tot,'Amountpaid'=>$ip,'Balancetopay'=>$balancetopay,'mid'=>$bankid,'IGRLineItemNo'=>$igrlineitem,'IsActive'=>$IsActive,'BankDate'=>$bankdate);
|
||||
|
||||
$resultn = $this->cashbook_model->mappingpo($podata1);
|
||||
//print_r($podata1);
|
||||
$podata = array('Podate'=>$date,'PONO'=>$pono,'IGRNO'=>$igrno,'Suppliername'=>$sname,'SupplierID'=>$sid,'Totalpoamount'=>$tot,'Amountpaid'=>$amtpaid,'Balancetopay'=>$balancetopay,'mid'=>$bankid,'IGRLineItemNo'=>$igrlineitem,'IsActive'=>$IsActive);
|
||||
$podata = array('Podate'=>$date,'PONO'=>$pono,'IGRNO'=>$igrno,'Suppliername'=>$sname,'SupplierID'=>$sid,'Totalpoamount'=>$tot,'Amountpaid'=>$amtpaid,'Balancetopay'=>$balancetopay,'mid'=>$bankid,'IGRLineItemNo'=>$igrlineitem,'IsActive'=>$IsActive,'BankDate'=>$bankdate);
|
||||
//die();
|
||||
|
||||
$result3 = $this->cashbook_model->getpono($igrlineitem);
|
||||
@ -1236,7 +1255,7 @@ class cashbook extends BaseController
|
||||
}
|
||||
|
||||
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
if($balancetopay==0)
|
||||
{
|
||||
$igrstatus=AMOUNT_PAIDIGR;
|
||||
@ -1246,7 +1265,7 @@ class cashbook extends BaseController
|
||||
$igrstatus=PARTIALLY_PAIDIGR;
|
||||
|
||||
}
|
||||
$igrdetails=array('BankStatus'=>$igrstatus);
|
||||
$igrdetails=array('BankStatus'=>$igrstatus,'StatusUpdatedDate'=>$now);
|
||||
$result1 = $this->cashbook_model->igrdetailstatus($igrdetails,$igrlineitem);
|
||||
//$result1 = $this->cashbook_model->poamountstatus($pomaster,$pono);
|
||||
$this->loadViews("bankstatement", $this->global,$data, NULL);
|
||||
@ -1270,8 +1289,12 @@ class cashbook extends BaseController
|
||||
$totalpaidamount= $this->input->post('tpv');
|
||||
$bankcreditamount= $this->input->post('bda');
|
||||
$invoicetext=$this->input->post('invrec');
|
||||
$bankid =$this->input->post('bi');
|
||||
$bankid = $this->input->post('bi');
|
||||
$bankdate =$this->input->post('bankdate');
|
||||
$bankdate = date_create($bankdate);//,'Y-m-d');
|
||||
$bankdate = date_format($bankdate,'Y-m-d');
|
||||
$alreadyreceived = 0;
|
||||
|
||||
//echo $earlypaid;
|
||||
$alreadyreceived = $this->cashbook_model->getalreadyreceived($bankid);
|
||||
if(empty($alreadyreceived))
|
||||
@ -1357,9 +1380,9 @@ class cashbook extends BaseController
|
||||
|
||||
$updateamount=($totalpaidamount+$eRec);
|
||||
$IsActive=1;
|
||||
$invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'customerid'=>$cid,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid,'IsActive'=>$IsActive);
|
||||
$invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'customerid'=>$cid,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid,'IsActive'=>$IsActive,'BankDate'=>$bankdate);
|
||||
|
||||
$invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'customerid'=>$cid,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$ip,'bankid'=>$bankid,'IsActive'=>$IsActive);
|
||||
$invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'customerid'=>$cid,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$ip,'bankid'=>$bankid,'IsActive'=>$IsActive,'BankDate'=>$bankdate);
|
||||
|
||||
// //print_r ($invoicedata);
|
||||
// //die();
|
||||
@ -1378,6 +1401,7 @@ class cashbook extends BaseController
|
||||
$result3 = $this->cashbook_model->invoiceupdate1($invoicedata1,$invid);
|
||||
|
||||
}
|
||||
$now = date('Y-m-d H:i:s');
|
||||
if($balancetoreceived1==0)
|
||||
{
|
||||
$status=AMOUNT_RECEIVED;
|
||||
@ -1387,7 +1411,7 @@ class cashbook extends BaseController
|
||||
{
|
||||
$status=PARTIALLY_RECEIVED;
|
||||
}
|
||||
$invoicemaster= array('receivedstatus'=>$status);
|
||||
$invoicemaster= array('receivedstatus'=>$status,'StatusUpdatedDate'=>$now);
|
||||
|
||||
$result1 = $this->cashbook_model->invoiceamountstatus($invoicemaster,$invid);
|
||||
|
||||
@ -1743,7 +1767,8 @@ class cashbook extends BaseController
|
||||
$ab=$this->input->post('financialyear');
|
||||
$fa=substr($ab,0,-5);
|
||||
$aa=substr($ab,5,5);
|
||||
$m=$this->input->post('month');
|
||||
$m=$this->input->post('month');
|
||||
|
||||
//$Customer = $this->input->post('CustomerName');
|
||||
$fdate = $this->input->post('from_date');
|
||||
$tdate = $this->input->post('to_date');
|
||||
@ -1754,6 +1779,7 @@ class cashbook extends BaseController
|
||||
$data['tdate']=$tdate;
|
||||
|
||||
$data['amountreceivedsupplier'] = $this->cashbook_model->creditinvoicewisefilter($fdate,$tdate,$fa,$aa,$m);
|
||||
|
||||
$data['amountpaidcashbook']=$this->cashbook_model->amountreceivedcashbookfilter($fa,$aa,$m,$fdate,$tdate);
|
||||
}
|
||||
else
|
||||
|
||||
@ -354,10 +354,10 @@ function report_finyearamountreceived(){
|
||||
|
||||
|
||||
$sql="SELECT
|
||||
CASE WHEN MONTH(indate)>=4 THEN
|
||||
concat(YEAR(indate), '-',YEAR(indate)+1)
|
||||
ELSE concat(YEAR(indate)-1,'-', YEAR(indate)) END AS financial_year
|
||||
FROM T_Bankinvoicereport
|
||||
CASE WHEN MONTH(reportdate)>=4 THEN
|
||||
concat(YEAR(reportdate), '-',YEAR(reportdate)+1)
|
||||
ELSE concat(YEAR(reportdate)-1,'-', YEAR(reportdate)) END AS financial_year
|
||||
FROM T_bankreport
|
||||
GROUP BY financial_year";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
@ -1168,19 +1168,19 @@ function receiptdata()
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
//$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
|
||||
$year="(bm.indate >= '".$fa."-04-01' and bm.indate <= '".$aa."-03-31')";
|
||||
$year="(bm.BankDate >= '".$fa."-04-01' and bm.BankDate <= '".$aa."-03-31')";
|
||||
$this->db->where($year);
|
||||
}
|
||||
if ($m!= ''){
|
||||
|
||||
//$sql.="and monthname(im.CreatedDate) = '".$m."'";
|
||||
$month="monthname(bm.indate) = '".$m."'";
|
||||
$month="monthname(bm.BankDate) = '".$m."'";
|
||||
$this->db->where($month);
|
||||
|
||||
}
|
||||
if($fdate!='' && $tdate!='')
|
||||
{
|
||||
$this->db->where('bm.indate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"');
|
||||
$this->db->where('bm.BankDate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"');
|
||||
}
|
||||
|
||||
//$this->db->group_by('invoiceno');
|
||||
@ -1299,7 +1299,7 @@ function receiptdata()
|
||||
$this->db->select('ie.date,ie.bankid,ie.cashtype,ie.amounttype,ie.total,ac.name,totalbankamount,ie.id');
|
||||
$this->db->from ('t_income_expense as ie');
|
||||
$this->db->join ('t_accountcode ac ','ac.code = ie.account_code','left');
|
||||
$this->db->where('ie.bankid',$bankid);
|
||||
$this->db->where('ie.bankid',(int)$bankid);
|
||||
$this->db->where('ie.amounttype','DEBIT');
|
||||
$this->db->where('IsActive',1);
|
||||
//$this->db->group_by('mid');
|
||||
@ -1312,9 +1312,9 @@ function receiptdata()
|
||||
$this->db->select('ie.date,ie.bankid,ie.cashtype,ie.amounttype,ie.total,ac.name,totalbankamount,ie.id');
|
||||
$this->db->from ('t_income_expense as ie');
|
||||
$this->db->join ('t_accountcode ac ','ac.code = ie.account_code','left');
|
||||
$this->db->where('ie.bankid',$bankid);
|
||||
$this->db->where('ie.bankid',(int)$bankid);
|
||||
$this->db->where('ie.amounttype','CREDIT');
|
||||
$this->db->where('IsActive',1);
|
||||
$this->db->where('ie.IsActive',1);
|
||||
//$this->db->group_by('mid');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
@ -1885,19 +1885,19 @@ function receiptdata()
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
//$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
|
||||
$year="(bm.indate >= '".$fa."-04-01' and bm.indate <= '".$aa."-03-31')";
|
||||
$year="(bm.BankDate >= '".$fa."-04-01' and bm.BankDate <= '".$aa."-03-31')";
|
||||
$this->db->where($year);
|
||||
}
|
||||
if ($m!= ''){
|
||||
|
||||
//$sql.="and monthname(im.CreatedDate) = '".$m."'";
|
||||
$month="monthname(bm.indate) = '".$m."'";
|
||||
$month="monthname(bm.BankDate) = '".$m."'";
|
||||
$this->db->where($month);
|
||||
|
||||
}
|
||||
if($fdate!='' && $tdate!='')
|
||||
{
|
||||
$this->db->where('bm.indate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"');
|
||||
$this->db->where('bm.BankDate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"');
|
||||
}
|
||||
//$this->db->group_by('invoiceno');
|
||||
$query = $this->db->get();
|
||||
@ -1921,7 +1921,7 @@ function receiptdata()
|
||||
}
|
||||
function creditinvoicewisefilter($fdate,$tdate,$fa,$aa,$m)
|
||||
{
|
||||
$this->db->select('bm.indate,bm.invoiceno,bm.customername,bm.customerid as customerid,bm.totinvoiceamount,bm.bankid,ic.client_id,
|
||||
$this->db->select('bm.indate,bm.BankDate,bm.invoiceno,bm.customername,bm.customerid as customerid,bm.totinvoiceamount,bm.bankid,ic.client_id,
|
||||
bm.balancetoreceived,sum(bm.amountreceived)as amountreceived,bm.ID,br.Credit,br.cclearbalance,br.cbalancetocleared');
|
||||
$this->db->from ('T_Bankmappingiv bm');
|
||||
$this->db->join('ip_invoices iv','iv.invoice_number=bm.invoiceno');
|
||||
@ -1934,13 +1934,13 @@ function receiptdata()
|
||||
if ($fa and $aa != ''){
|
||||
|
||||
//$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')";
|
||||
$year="(bm.indate >= '".$fa."-04-01' and bm.indate <= '".$aa."-03-31')";
|
||||
$year="(bm.BankDate >= '".$fa."-04-01' and bm.BankDate <= '".$aa."-03-31')";
|
||||
$this->db->where($year);
|
||||
|
||||
}
|
||||
if ($m!= ''){
|
||||
//$this->db->where('MONTH(pel.tgl_pembelian)',$bulan);
|
||||
$month="monthname(bm.indate) = '".$m."'";
|
||||
$month="monthname(bm.BankDate) = '".$m."'";
|
||||
$this->db->where($month);
|
||||
// $sql.="and monthname(bm.Podate) = '".$m."'";
|
||||
|
||||
@ -1948,8 +1948,8 @@ function receiptdata()
|
||||
if ($fdate and $tdate != ''){
|
||||
$fromdate= date("Y-m-d",strtotime($fdate));
|
||||
$todate=date("Y-m-d",strtotime($tdate));
|
||||
$date = "date(bm.indate) >= '".$fromdate."'
|
||||
and date(bm.indate) <= '".$todate."'";
|
||||
$date = "date(bm.BankDate) >= '".$fromdate."'
|
||||
and date(bm.BankDate) <= '".$todate."'";
|
||||
$this->db->where($date);
|
||||
}
|
||||
|
||||
|
||||
@ -621,7 +621,7 @@ function calculategrandtotal(){
|
||||
|
||||
function Save()
|
||||
{
|
||||
|
||||
|
||||
$('#content').loader('show');
|
||||
var rowCount= $('#Rowid').val();
|
||||
var check= 0;
|
||||
@ -636,7 +636,7 @@ function Save()
|
||||
// alert('rwval'+'-'+rw);
|
||||
check = parseFloat(check)+1;
|
||||
var bankdebitamount=$('#debitamount').val();
|
||||
|
||||
var bankdate=localStorage.getItem('cddate');
|
||||
// alert('bankdebitamountval'+'-'+bankdebitamount);
|
||||
var bid =$('#bankid').val();
|
||||
|
||||
@ -674,7 +674,7 @@ function Save()
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
data:{podate:date,pono:pono,igrno:igrno,igrlineitem:igrlineitem,sname:suppliername,sid:supplierid,tot:totalordervalue,aa:amountpaid,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw},
|
||||
data:{bankdate:bankdate,podate:date,pono:pono,igrno:igrno,igrlineitem:igrlineitem,sname:suppliername,sid:supplierid,tot:totalordervalue,aa:amountpaid,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw},
|
||||
//alert(data);
|
||||
type:"POST",
|
||||
url:"<?php echo base_url() ?>cashbook/receipt",
|
||||
|
||||
@ -342,7 +342,7 @@ $Bankname = $t->Bankname;
|
||||
|
||||
<td align="left" id="credited<?php echo $i ?>"><span><?php echo ($t->Credit)-($t->cclearbalance);?></span></td>
|
||||
|
||||
<td align="left" id="csta<?php echo $i ?>"><span><?php echo $t->cstatus?><?php echo $t->Status?></span></td>
|
||||
<td align="left" id="csta<?php echo $i ?>"><span><?php echo $t->cstatus?><?php echo $t->Status?></span></td>
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user