bankstatement changes

This commit is contained in:
gayathri1990 2018-11-21 18:10:21 +05:30
parent c5cfcd8a53
commit c9b113ada5
8 changed files with 313 additions and 147 deletions

View File

@ -1002,11 +1002,11 @@ class cashbook extends BaseController
//$data['bankid'] = $_GET['d']; //$data['bankid'] = $_GET['d'];
$data['bankdepitpaid'] = $this->cashbook_model->debitbankstatemet($Supplierid,$fdate,$tdate); $data['bankdepitpaid'] = $this->cashbook_model->debitbankstatemet($Supplierid,$fdate,$tdate);
} }
else // else
{ // {
$data['bankdepitpaid'] = $this->cashbook_model->debitbankstatemet1(); // $data['bankdepitpaid'] = $this->cashbook_model->debitbankstatemet1();
//print_r($data['bankdepit']); // //print_r($data['bankdepit']);
} // }
$data['getsupplier'] = $this->cashbook_model->getsupplier(); $data['getsupplier'] = $this->cashbook_model->getsupplier();
$this->loadViews("bankdebit",$this->global,$data,NULL); $this->loadViews("bankdebit",$this->global,$data,NULL);
//die(); //die();
@ -1021,6 +1021,8 @@ class cashbook extends BaseController
$fdate = $this->input->post('from_date'); $fdate = $this->input->post('from_date');
$tdate = $this->input->post('to_date'); $tdate = $this->input->post('to_date');
$data['bankinvoicedata'] = $this->cashbook_model->bankinvoice($Customer,$fdate,$tdate); $data['bankinvoicedata'] = $this->cashbook_model->bankinvoice($Customer,$fdate,$tdate);
// $data['bankreceivedamount']= $this->cashbook_model->receivedamount($Customer,$fdate,$tdate);
// print_r($data['bankreceivedamount']);
//$data['supplier'] = $this->cashbook_model->getsupplier(); //$data['supplier'] = $this->cashbook_model->getsupplier();
} }
$data['getcustomer'] = $this->cashbook_model->getcustomer(); $data['getcustomer'] = $this->cashbook_model->getcustomer();
@ -1612,14 +1614,14 @@ class cashbook extends BaseController
$data['bankdebitsupp'] = $this->cashbook_model->amountpaidsupplierwisefilter($fa,$aa,$m,$fdate,$tdate); $data['bankdebitsupp'] = $this->cashbook_model->amountpaidsupplierwisefilter($fa,$aa,$m,$fdate,$tdate);
$data['amountpaidcashbook']=$this->cashbook_model->amountpaidcashbookfilter($fa,$aa,$m,$fdate,$tdate); $data['amountpaidcashbook']=$this->cashbook_model->amountpaidcashbookfilter($fa,$aa,$m,$fdate,$tdate);
} }
else // else
{ // {
$data['bankdebitsupp'] = $this->cashbook_model->amountpaidsupplierwise(); // $data['bankdebitsupp'] = $this->cashbook_model->amountpaidsupplierwise();
$data['amountpaidcashbook']=$this->cashbook_model->amountpaidcashbook(); // $data['amountpaidcashbook']=$this->cashbook_model->amountpaidcashbook();
} // }
$data['finyear']=$this->cashbook_model->report_amountpaid(); $data['finyear']=$this->cashbook_model->report_amountpaid();
$data['supplier'] = $this->cashbook_model->getsupplier(); $data['supplier'] = $this->cashbook_model->getsupplier();
$this->loadViews("bankpaidsupp", $this->global,$data, NULL); $this->loadViews("bankpaidsupp", $this->global,$data, NULL);
@ -1890,14 +1892,20 @@ class cashbook extends BaseController
$clearedbalance=$this->input->post('clearbalance'); $clearedbalance=$this->input->post('clearbalance');
$updateamount=$clearedbalance-$Amount; $updateamount=$clearedbalance-$Amount;
$updatebalancetoclear=$Amount+$balancetoclear; $updatebalancetoclear=$Amount+$balancetoclear;
$data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($igrno); $data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($id);
$amountpaid=$data['$bankmappingamount'][0]->Amountpaid; $amountpaid=$data['$bankmappingamount'][0]->Amountpaid;
$data['$bankmappingamountcount'] = $this->cashbook_model->gettotalbankmappingpocount($igrno);
$count= $data['$bankmappingamountcount'][0]->countAmountpaid;
//$data['$totallineitemamount']=$this->cashbook_model->gettotallineitem($igrno); //$data['$totallineitemamount']=$this->cashbook_model->gettotallineitem($igrno);
if($amountpaid==$totalamount || $amountpaid!=$totalamount) if($count==1)
{ {
$BankStatus=NO_PAIDIGR; $BankStatus=NO_PAIDIGR;
} }
else
{
$BankStatus=PARTIALLY_PAIDIGR;
}
@ -1910,16 +1918,27 @@ class cashbook extends BaseController
//$updateamount=0; //$updateamount=0;
$IsActive=0; $IsActive=0;
$result2= $this->cashbook_model->deleteBankmappingpo($id,$IsActive); $result2= $this->cashbook_model->deleteBankmappingpo($id,$IsActive);
//for update mapping amount inT_Bankporeport table// $data['$poreportamount'] = $this->cashbook_model->gettotalbankpoamount($igrno);
//die(); $amountpaidpo= $data['$poreportamount'][0]->Amountpaid;
$result3= $this->cashbook_model->updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid,$IsActive); $balancetopay= $data['$poreportamount'][0]->Balancetopay;
$amountpaidupdate=$amountpaidpo-$Amount;
$balancetopayupdate=$balancetopay+$Amount;
if($amountpaidupdate==0)
{
$IsAct=0;
}
else
{
$IsAct=1;
}
$result3= $this->cashbook_model->updateBankporeportpo($igrno,$balancetopayupdate,$amountpaidupdate,$Bankid,$IsAct);
$this->loadViews("bankstatement", $this->global,$data, NULL); $this->loadViews("bankstatement", $this->global,$data, NULL);
} }
public function Deletemappingpo() public function Deletemappingpo()
{ {
$totalamount = $_GET['totalpoamount']; $totalamount = $_GET['totalpoamount'];//totalpoamount
$Bankid = $_GET['bankid']; $Bankid = $_GET['bankid'];
$Amount = $_GET['amount']; $Amount = $_GET['amount'];//paid amount
$igrno = $_GET['igrno']; $igrno = $_GET['igrno'];
$balancetoclear=$_GET['balancetoclear']; $balancetoclear=$_GET['balancetoclear'];
//for T_Bankreport IsActive// //for T_Bankreport IsActive//
@ -1927,37 +1946,53 @@ class cashbook extends BaseController
$mapped= $Amount+$balancetoclear; $mapped= $Amount+$balancetoclear;
/////////////////
$id=$_GET['id']; $id=$_GET['id'];
$bankamount=$_GET['bankamount']; $bankamount=$_GET['bankamount'];
$updateamount=$bankamount-$Amount; $updateamount=$bankamount-$Amount;
$updatebalancetoclear=$Amount+$balancetoclear; $updatebalancetoclear=$Amount+$balancetoclear;
$data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($igrno); $data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($id);
$amountpaid=$data['$bankmappingamount'][0]->Amountpaid; $amountpaid=$data['$bankmappingamount'][0]->Amountpaid;
$data['$bankmappingamountcount'] = $this->cashbook_model->gettotalbankmappingpocount($igrno);
$count= $data['$bankmappingamountcount'][0]->countAmountpaid;
if($count==1)
if($amountpaid==$totalamount || $amountpaid!= $totalamount)
{ {
$BankStatus=NO_PAIDIGR; $BankStatus=NO_PAIDIGR;
} }
else
{
$BankStatus=PARTIALLY_PAIDIGR;
}
$result= $this->cashbook_model->IgrDetailsStatusUpdate($igrno,$BankStatus); $result= $this->cashbook_model->IgrDetailsStatusUpdate($igrno,$BankStatus);
$result1= $this->cashbook_model->deletemapping($Bankid,$updateamount,$updatebalancetoclear); $result1= $this->cashbook_model->deletemapping($Bankid,$updateamount,$updatebalancetoclear);
//for update mapping amount in t_bankmappingpo table// //for update mapping amount in t_bankreport table//
$balancetopay=$_GET['balancetopay']; $balancetopay=$_GET['balancetopay'];//balancetopay
$totalbalancetopay=$Amount + $balancetopay; $totalbalancetopay=$Amount + $balancetopay;
$IsActive=0; $IsActive=0;
$updatebankpoamount=$totalamount-$totalbalancetopay; $updatebankpoamount=$totalamount-$totalbalancetopay;
$result2= $this->cashbook_model->deleteBankmappingpo($id,$IsActive); $result2= $this->cashbook_model->deleteBankmappingpo($id,$IsActive);
//for update mapping amount inT_Bankporeport table// //$result3= $this->cashbook_model->updatemappingamount($igrno,$amountpaid);
$result3= $this->cashbook_model->updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid,$IsActive); $data['$poreportamount'] = $this->cashbook_model->gettotalbankpoamount($igrno);
$amountpaidpo= $data['$poreportamount'][0]->Amountpaid;
$balancetopay= $data['$poreportamount'][0]->Balancetopay;
$amountpaidupdate=$amountpaidpo-$Amount;
$balancetopayupdate=$balancetopay+$Amount;
if(count($result2)>0) //die();
if($amountpaidupdate==0)
{
$IsAct=0;
}
else
{
$IsAct=1;
}
$result3= $this->cashbook_model->updateBankporeportpo($igrno,$balancetopayupdate,$amountpaidupdate,$Bankid,$IsAct);
if(count($result3)>0)
{ {
redirect('Bankingstatement','refresh'); redirect('Bankingstatement','refresh');
} }
@ -1971,12 +2006,15 @@ class cashbook extends BaseController
$invoiceno = $this->input->post('invoiceno'); $invoiceno = $this->input->post('invoiceno');
$bankid = $this->input->post('bankid'); $bankid = $this->input->post('bankid');
$mappingid=$this->input->post('mappingid'); $mappingid=$this->input->post('mappingid');
$amountreceived = $this->input->post('amountreceived'); $amountreceived = $this->input->post('amountreceived');
$bankingclear = $this->input->post('bankingclear'); $bankingclear = $this->input->post('bankingclear');
$bankingbalclear = $this->input->post('bankingbalclear'); $bankingbalclear = $this->input->post('bankingbalclear');
$totinvoiceamount = $this->input->post('totinvoiceamount'); $totinvoiceamount = $this->input->post('totinvoiceamount');
$balancetoreceived = $this->input->post('balancetoreceived'); $balancetoreceived = $this->input->post('balancetoreceived');
$updatebalancetoclear=$amountreceived+$bankingbalclear; $updatebalancetoclear=$amountreceived+$bankingbalclear;
if($amountreceived<0) if($amountreceived<0)
{ {
$updateclearbalance=$bankingclear-($amountreceived);//450-(-250) $updateclearbalance=$bankingclear-($amountreceived);//450-(-250)
@ -2001,15 +2039,39 @@ class cashbook extends BaseController
$bankstatement=array('cbalancetocleared'=>$updatebalancetoclear,'cclearbalance'=>$updateclearbalance,'IsActive'=>$active); $bankstatement=array('cbalancetocleared'=>$updatebalancetoclear,'cclearbalance'=>$updateclearbalance,'IsActive'=>$active);
$result1= $this->cashbook_model->updatebankreportiv($bankid,$bankstatement); $result1= $this->cashbook_model->updatebankreportiv($bankid,$bankstatement);
$receivedstatus=NO_RECEIVED;
$data['$invoicereportamount'] = $this->cashbook_model->gettotalbankreceivedamount($invoiceno);
$amountreceivedinvoice= $data['$invoicereportamount'][0]->amountreceived;
$$balancetoreceived= $data['$invoicereportamount'][0]->balancetoreceived;
$amountreceivedupdate=$amountreceivedinvoice-$amountreceived;
$balancetoreceivedupdate=$balancetoreceived+$amountreceived;
if($amountreceivedupdate==0)
{
$IsAct=0;
}
else
{
$IsAct=1;
}
// $updatebalancetoreceived=$balancetoreceived+$amountreceived;
// $updateamountreceived=$totinvoiceamount-$updatebalancetoreceived;
$result3= $this->cashbook_model->updatebankinvoicereport($invoiceno,$bankid,$balancetoreceivedupdate,$amountreceivedupdate,$IsAct);
$IsActive=0; $IsActive=0;
$updatebalancetoreceived=$balancetoreceived+$amountreceived;
$updateamountreceived=$totinvoiceamount-$updatebalancetoreceived;
$result3= $this->cashbook_model->updatebankinvoicereport($invoiceno,$bankid,$updatebalancetoreceived,$updateamountreceived,$IsActive);
if(count($result3)>0) if(count($result3)>0)
{ {
$data['$bankreceivedamountcount'] = $this->cashbook_model->gettotalbankmappinginvoicecount($invoiceno);
$counting= $data['$bankreceivedamountcount'][0]->countamountreceived;
if($counting==1)
{
$receivedstatus=NO_RECEIVED;
}
else
{
$receivedstatus=PARTIALLY_RECEIVED;
}
$result1=$this->cashbook_model->UpdateIpinvoiceStatus($invoiceno,$receivedstatus); $result1=$this->cashbook_model->UpdateIpinvoiceStatus($invoiceno,$receivedstatus);
$result2= $this->cashbook_model->deletemappinginvoice($mappingid,$IsActive); $result2= $this->cashbook_model->deletemappinginvoice($mappingid,$IsActive);
// if(count($result2)>0) // if(count($result2)>0)

View File

@ -480,11 +480,12 @@ join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
left join T_Bankporeport br on br.IGRLineItemNo=id.IGRItemNo left join T_Bankporeport br on br.IGRLineItemNo=id.IGRItemNo and br.IsActive = 1
where im.IGRStatus = 'ST027' and id.BankStatus!='ST070' "; where im.IGRStatus = 'ST027' and id.BankStatus!='ST070'";
if ($Supplierid!= ''){ if ($Supplierid!= '')
{
$sql.="and sd.SupplierID = '".$Supplierid."'"; $sql.="and sd.SupplierID = '".$Supplierid."'";
@ -506,78 +507,78 @@ $sql.="group by id.IGRItemNo";
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
} }
function debitbankstatemet1(){ // function debitbankstatemet1(){
$sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as PONO,im.IGRNO,id.IGRItemNo,im.MaterialRcvdDate as CreatedDate,br.Balancetopay,br.Amountpaid,sd.SupplierName as SupplierName,sd.SupplierID as SupplierID, // $sql="select im.IGRNO as igrn,pm.POType as potype,im.PONO as PONO,im.IGRNO,id.IGRItemNo,im.MaterialRcvdDate as CreatedDate,br.Balancetopay,br.Amountpaid,sd.SupplierName as SupplierName,sd.SupplierID as SupplierID,
round(ifnull(if(POType = 'REVENUE', // round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(rt.SGST/100)), // (id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(rt.SGST/100)),
(id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(st.SGST /100))),0),2) as sgst, // (id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(st.SGST /100))),0),2) as sgst,
round(ifnull(if(POType = 'REVENUE', // round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(rt.CGST/100)), // (id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(rt.CGST/100)),
(id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(st.CGST /100))),0),2) as cgst, // (id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(st.CGST /100))),0),2) as cgst,
round(ifnull(if(POType = 'REVENUE', // round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(rt.IGST/100)), // (id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(rt.IGST/100)),
(id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(st.IGST /100))),0),2) as igst, // (id.QuantityAsPerInvoice * pl.Rate)+((id.QuantityAsPerInvoice * pl.Rate)*(st.IGST /100))),0),2) as igst,
round(ifnull(if(POType = 'REVENUE', // round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * pl.Rate)- (rt.AfterDiscount), // (id.QuantityAsPerInvoice * pl.Rate)- (rt.AfterDiscount),
(id.QuantityAsPerInvoice * pl.Rate)- (st.Afterdiscountval)),0),2) as discount, // (id.QuantityAsPerInvoice * pl.Rate)- (st.Afterdiscountval)),0),2) as discount,
round(ifnull(if(POType = 'REVENUE', // round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * pl.Rate) + (rt.AfterFreightValue), // (id.QuantityAsPerInvoice * pl.Rate) + (rt.AfterFreightValue),
(id.QuantityAsPerInvoice * pl.Rate) + (st.AfterFreightValue)),0),2) as freight, // (id.QuantityAsPerInvoice * pl.Rate) + (st.AfterFreightValue)),0),2) as freight,
round(ifnull(if(POType = 'REVENUE', // round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * pl.Rate) +(rt.AfterPackagingValue),0),0),2) as Package, // (id.QuantityAsPerInvoice * pl.Rate) +(rt.AfterPackagingValue),0),0),2) as Package,
round(( // round((
if(POType = 'IMPORT',(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)), // if(POType = 'IMPORT',(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
if(POType = 'CAPITAL' && CapitalRange = 0,(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)), // if(POType = 'CAPITAL' && CapitalRange = 0,(pm.ExchangeRate * (id.QuantityAsPerInvoice * pl.Rate)),
ifnull((id.QuantityAsPerInvoice * pl.Rate),0))) // ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
+ round(ifnull(if(POType = 'REVENUE', // + round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity), // (id.QuantityAsPerInvoice * rt.AfterSGST / pl.Quantity),
(id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2) // (id.QuantityAsPerInvoice * st.After_SGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', // + round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity), // (id.QuantityAsPerInvoice * rt.AfterCGST / pl.Quantity),
(id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2) // (id.QuantityAsPerInvoice * st.After_CGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', // + round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity), // (id.QuantityAsPerInvoice * rt.AfterIGST / pl.Quantity),
(id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2) // (id.QuantityAsPerInvoice * st.After_IGST / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', // + round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity), // (id.QuantityAsPerInvoice * rt.AfterFreightValue / pl.Quantity),
(id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2) // (id.QuantityAsPerInvoice * st.AfterFreightValue / pl.Quantity)),0),2)
+ round(ifnull(if(POType = 'REVENUE', // + round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2) // (id.QuantityAsPerInvoice * rt.AfterPackagingValue / pl.Quantity),0),0),2)
- round(ifnull(if(POType = 'REVENUE', // - round(ifnull(if(POType = 'REVENUE',
(id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity), // (id.QuantityAsPerInvoice * rt.AfterDiscount / pl.Quantity),
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total // (id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total
from T_IGR_Master im // from T_IGR_Master im
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO // left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode // join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO // join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID // left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo // left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo // left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
left join T_Bankporeport br on br.IGRLineItemNo=id.IGRItemNo // left join T_Bankporeport br on br.IGRLineItemNo=id.IGRItemNo
where im.IGRStatus = 'ST027' and id.BankStatus !='ST070'"; // where im.IGRStatus = 'ST027' and id.BankStatus !='ST070'";
$sql.=" group by id.IGRItemNo"; // $sql.=" group by id.IGRItemNo";
//echo $sql; // //echo $sql;
$query = $this->db->query($sql); // $query = $this->db->query($sql);
return $query->result(); // return $query->result();
} // }
function bank_finyear(){ // function bank_finyear(){
$sql="SELECT // $sql="SELECT
CASE WHEN MONTH(MaterialRcvdDate)>=4 // CASE WHEN MONTH(MaterialRcvdDate)>=4
THEN concat(YEAR(MaterialRcvdDate), '-',YEAR(MaterialRcvdDate)+1) // THEN concat(YEAR(MaterialRcvdDate), '-',YEAR(MaterialRcvdDate)+1)
ELSE concat(YEAR(MaterialRcvdDate)-1,'-', YEAR(MaterialRcvdDate)) // ELSE concat(YEAR(MaterialRcvdDate)-1,'-', YEAR(MaterialRcvdDate))
END AS financial_year // END AS financial_year
FROM T_IGR_Master // FROM T_IGR_Master
GROUP BY financial_year"; // GROUP BY financial_year";
$query = $this->db->query($sql); // $query = $this->db->query($sql);
return $query->result(); // return $query->result();
} // }
// function debitbankstatemet($Supplierid,$fdate,$tdate) // function debitbankstatemet($Supplierid,$fdate,$tdate)
// { // {
@ -687,7 +688,7 @@ if ($Supplierid!= ''){
} }
$sql.="group by sd.SupplierName"; $sql.="group by sd.SupplierID";
//echo $sql; //echo $sql;
$query = $this->db->query($sql); $query = $this->db->query($sql);
return $query->result(); return $query->result();
@ -948,16 +949,15 @@ $sql.="group by id.IGRItemNo";
} }
function bankinvoice($Customer,$fdate,$tdate) function bankinvoice($Customer,$fdate,$tdate)
{ {
// $status='ST065';
$this->db->distinct();
$this->db->select('iva.invoice_id,iva.invoice_total,iv.invoice_date_created,iv.invoice_number,iva.invoice_paid,ic.client_name,ic.client_id,BI.balancetoreceived,BI.amountreceived'); $this->db->select('iva.invoice_id,iva.invoice_total,iv.invoice_date_created,iv.invoice_number,iva.invoice_paid,ic.client_name,ic.client_id,BI.balancetoreceived,BI.amountreceived');
$this->db->from ('ip_invoice_amounts iva'); $this->db->from ('ip_invoice_amounts iva');
$this->db->join ('ip_invoices iv','iva.invoice_id = iv.invoice_id'); $this->db->join ('ip_invoices iv','iva.invoice_id = iv.invoice_id');
$this->db->join ('ip_clients ic','iv.client_id = ic.client_id','left'); $this->db->join ('ip_clients ic','iv.client_id = ic.client_id','left');
$this->db->join ('T_Bankinvoicereport BI',' iv.invoice_number =BI.invoiceno','left'); $this->db->join ('T_Bankinvoicereport BI','iv.invoice_number = BI.invoiceno and BI.IsActive= 1','left');
//$this->db->where('iva.receivedstatus !=','ST065');
$this->db->where('iv.invoice_status_id','2'); $this->db->where('iv.invoice_status_id','2');
$this->db->where('iv.receivedstatus !=','ST065'); $this->db->where('iv.receivedstatus !=','ST065');
// $this->db->where('BI.IsActive',1);
if ($fdate and $tdate != ''){ if ($fdate and $tdate != ''){
$fromdate= date("Y-m-d",strtotime($fdate)); $fromdate= date("Y-m-d",strtotime($fdate));
$todate=date("Y-m-d",strtotime($tdate)); $todate=date("Y-m-d",strtotime($tdate));
@ -969,8 +969,34 @@ $sql.="group by id.IGRItemNo";
$this->db->where('ic.client_id',$Customer); $this->db->where('ic.client_id',$Customer);
} }
$this->db->group_by('iva.invoice_id'); $this->db->group_by('iva.invoice_id');
//$this->db->where('inc.type','PAYMENT');
$query = $this->db->get(); $query = $this->db->get();
return $query->result();
}
function receivedamount($Customer,$fdate,$tdate)
{
// $status='ST065';
// $this->db->distinct();
$this->db->select('BI.balancetoreceived,BI.amountreceived');
$this->db->from ('T_Bankinvoicereport BI');
//$this->db->where('BI.IsActive',1);
if ($fdate and $tdate != ''){
$fromdate= date("Y-m-d",strtotime($fdate));
$todate=date("Y-m-d",strtotime($tdate));
$date = "date(BI.BankDate) >= '".$fromdate."'
and date(BI.BankDate) <= '".$todate."'";
$this->db->where($date);
}
if ($Customer != ''){
$this->db->where('BI.client_id',$Customer);
}
$this->db->group_by('BI.invoiceno');
//$this->db->where('inc.type','PAYMENT');
//print_r($this->db->last_query());
//die();
$query = $this->db->get();
return $query->result(); return $query->result();
} }
@ -1761,6 +1787,7 @@ function receiptdata()
$this->db->from ('t_income_expense tie'); $this->db->from ('t_income_expense tie');
$this->db->join('t_accountcode tac','tac.code=tie.account_code'); $this->db->join('t_accountcode tac','tac.code=tie.account_code');
$this->db->where('tie.amounttype','DEBIT'); $this->db->where('tie.amounttype','DEBIT');
$this->db->where('tie.cashtype','BANK');
$this->db->where('tie.IsActive',1); $this->db->where('tie.IsActive',1);
//$this->db->where('t_income_expense.account_code !=','ADV001'); //$this->db->where('t_income_expense.account_code !=','ADV001');
if ($fa and $aa != ''){ if ($fa and $aa != ''){
@ -1828,9 +1855,9 @@ function receiptdata()
{ {
$this->db->select('bm.id,bm.mid,bm.PONO,bm.Suppliername,bm.SupplierID,sum(bm.Totalpoamount)as Totalpoamount, $this->db->select('bm.id,bm.mid,bm.PONO,bm.Suppliername,bm.SupplierID,sum(bm.Totalpoamount)as Totalpoamount,
bm.Balancetopay,sum(bm.Amountpaid) as Amountpaid,bm.Podate,bm.BankDate,bm.IGRLineItemNo,bm.BankDate'); bm.Balancetopay,sum(bm.Amountpaid) as Amountpaid,bm.Podate,bm.IGRLineItemNo,bm.BankDate');
$this->db->from ('T_Bankmappingpo bm'); $this->db->from ('T_Bankmappingpo bm');
$this->db->join('T_bankreport br','br.ID=bm.mid'); //$this->db->join('T_bankreport br','br.ID=bm.mid');
//$this->db->join('T_IGR_Details igr','igr.IGRItemNo=bm.IGRLineItemNo'); //$this->db->join('T_IGR_Details igr','igr.IGRItemNo=bm.IGRLineItemNo');
//$this->db->where('igr.BankStatus !=',ST072); //$this->db->where('igr.BankStatus !=',ST072);
$this->db->where('bm.IsActive',1); $this->db->where('bm.IsActive',1);
@ -2151,6 +2178,22 @@ function receiptdata()
$r = $this->db->affected_rows(); $r = $this->db->affected_rows();
return $r; return $r;
} }
// function updatemappingamount($igrno,$amountpaid)
// {
// $sql="update T_Bankmappingpo set Balancetopay=$amountpaid+Balancetopay where IGRLineItemNo='$igrno' and
// IsActive='1'";
// $query = $this->db->query($sql);
// return $query->result();
// // $this->db->set('Balancetopay',$amountpaid+'Balancetopay');
// // //$this->db->set('Balancetopay',$amountpaid);
// // $this->db->where('IGRLineItemNo',$igrno);
// // $this->db->where('IsActive',1);
// // $this->db->update('T_Bankmappingpo');
// // $r = $this->db->affected_rows();
// // return $r;
// }
function UpdateIpinvoiceStatus($invoiceno,$receivedstatus) function UpdateIpinvoiceStatus($invoiceno,$receivedstatus)
{ {
$this->db->set('receivedstatus',$receivedstatus); $this->db->set('receivedstatus',$receivedstatus);
@ -2179,11 +2222,11 @@ function receiptdata()
// $r = $this->db->affected_rows(); // $r = $this->db->affected_rows();
// return $r; // return $r;
// } // }
function updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid,$IsActive) function updateBankporeportpo($igrno,$balancetopayupdate,$amountpaidupdate,$Bankid,$IsAct)
{ {
$this->db->set('Balancetopay',$totalbalancetopay); $this->db->set('Balancetopay',$balancetopayupdate);
$this->db->set('Amountpaid',$updatebankpoamount); $this->db->set('Amountpaid',$amountpaidupdate);
$this->db->set('IsActive',$IsActive); $this->db->set('IsActive',$IsAct);
$this->db->where('IGRLineItemNo',$igrno); $this->db->where('IGRLineItemNo',$igrno);
$this->db->where('mid',$Bankid); $this->db->where('mid',$Bankid);
$this->db->update('T_Bankporeport'); $this->db->update('T_Bankporeport');
@ -2191,24 +2234,74 @@ function receiptdata()
return $r; return $r;
} }
function updatebankinvoicereport($invoiceno,$bankid,$updatebalancetoreceived,$updateamountreceived,$IsActive) function updatebankinvoicereport($invoiceno,$bankid,$balancetoreceivedupdate,$amountreceivedupdate,$IsAct)
{ {
$this->db->set('balancetoreceived',$updatebalancetoreceived); $this->db->set('balancetoreceived',$balancetoreceivedupdate);
$this->db->set('amountreceived',$updateamountreceived); $this->db->set('amountreceived',$amountreceivedupdate);
$this->db->set('IsActive',$IsActive); $this->db->set('IsActive',$IsAct);
$this->db->where('invoiceno',$invoiceno); $this->db->where('invoiceno',$invoiceno);
$this->db->where('bankid',$bankid); $this->db->where('bankid',$bankid);
$this->db->update('T_Bankinvoicereport'); $this->db->update('T_Bankinvoicereport');
$r = $this->db->affected_rows(); $r = $this->db->affected_rows();
return $r; return $r;
} }
function gettotalbankmappingpo($igrno) function gettotalbankmappingpo($id)
{ {
$this->db->select('sum(Amountpaid)as Amountpaid'); $this->db->select('sum(Amountpaid)as Amountpaid');
$this->db->from ('T_Bankmappingpo');
$this->db->where('id',$id);
$this->db->where('IsActive',1);
//$this->db->group_by('T_Bankmappingpo.IGRLineItemNo');
$query = $this->db->get();
return $query->result();
}
function gettotalbankmappingpocount($igrno)
{
$this->db->select('count(Amountpaid)as countAmountpaid');
$this->db->from ('T_Bankmappingpo'); $this->db->from ('T_Bankmappingpo');
$this->db->where('IGRLineItemNo',$igrno); $this->db->where('IGRLineItemNo',$igrno);
$this->db->where('IsActive',1); $this->db->where('IsActive',1);
$this->db->group_by('T_Bankmappingpo.IGRLineItemNo'); //$this->db->group_by('T_Bankmappingpo.IGRLineItemNo');
$query = $this->db->get();
return $query->result();
}
function gettotalbankmappinginvoicecount($invoiceno)
{
$this->db->select('count(amountreceived)as countamountreceived');
$this->db->from ('T_Bankmappingiv');
$this->db->where('invoiceno',$invoiceno);
$this->db->where('IsActive',1);
//$this->db->group_by('T_Bankmappingpo.IGRLineItemNo');
$query = $this->db->get();
return $query->result();
}
function gettotalbankpoamount($igrno)
{
$this->db->select('Amountpaid,Balancetopay');
$this->db->from ('T_Bankporeport');
$this->db->where('IGRLineItemNo',$igrno);
$this->db->where('IsActive',1);
//$this->db->group_by('T_Bankmappingpo.IGRLineItemNo');
$query = $this->db->get();
return $query->result();
}
function gettotalbankreceivedamount($invoiceno)
{
$this->db->select('amountreceived,balancetoreceived');
$this->db->from ('T_Bankinvoicereport');
$this->db->where('invoiceno',$invoiceno);
$this->db->where('IsActive',1);
//$this->db->group_by('T_Bankmappingpo.IGRLineItemNo');
$query = $this->db->get();
return $query->result();
}
function gettotalbankporeport($igrno)
{
$this->db->select('Amountpaid');
$this->db->from ('T_Bankporeport');
$this->db->where('IGRLineItemNo',$igrno);
$this->db->where('IsActive',1);
//$this->db->group_by('T_Bankmappingpo.IGRLineItemNo');
$query = $this->db->get(); $query = $this->db->get();
return $query->result(); return $query->result();
} }

View File

@ -2,7 +2,7 @@
<?php <?php
echo $suppliername; //echo $suppliername;
if(!empty($amountpaid)) if(!empty($amountpaid))
{ {
@ -274,7 +274,7 @@ if(!empty($amountpaid))
<td align="left" id="igritemno<?php echo $i ?>"><a href="<?= base_url() ?>cashbook/mappingdebit?sid=<?php echo $ap->IGRLineItemNo;?>"><span><?php echo $ap->IGRLineItemNo?></span></a></td> <td align="left" id="igritemno<?php echo $i ?>"><a href="<?= base_url() ?>cashbook/mappingdebit?sid=<?php echo $ap->IGRLineItemNo;?>"><span><?php echo $ap->IGRLineItemNo?></span></a></td>
<!--<td align="left" id="sn<?php echo $i ?>"><span><?php echo $ap->Suppliername?></span></td>--> <!--<td align="left" id="sn<?php echo $i ?>"><span><?php echo $ap->Suppliername?></span></td>-->
<td align="left" id="tpoa<?php echo $i ?>"><span><?php echo $ap->Totalpoamount?></span></td> <td align="left" id="tpoa<?php echo $i ?>"><span><?php echo $ap->Totalpoamount?></span></td>
<td align="left" id="btp<?php echo $i ?>"><span><?php echo $ap->Balancetopay?></span></td> <td align="left" id="btp<?php echo $i ?>"><span><?php echo $ap->Totalpoamount-$ap->Amountpaid;?></span></td>
<td align="left" id="ap<?php echo $i ?>"><span><?php $tot_amount=$tot_amount+round($rate)?> <?php echo round($rate,2)?></span></td> <td align="left" id="ap<?php echo $i ?>"><span><?php $tot_amount=$tot_amount+round($rate)?> <?php echo round($rate,2)?></span></td>
<?php <?php
if($ap->igrfile !='') if($ap->igrfile !='')
@ -374,28 +374,25 @@ if(!empty($amountpaid))
<script> <script>
function podelete(i) function podelete(i)
{ {
alert('ok');
$('#content').loader('show'); $('#content').loader('show');
var totalamount=$('#tpoa'+i).text(); var totalamount=$('#tpoa'+i).text();//totalpoamount
var paidamount=$('#ap'+i).text();//amountpaid
var paidamount=$('#ap'+i).text();//amount var balancetopay=$('#btp'+i).text();//balancetopay
var balancetopay=$('#btp'+i).text(); var Igritemno=$('#igritemno'+i).text();//igritemno
var bankid=$('#bankingid'+i).val();//bankid
var Igritemno=$('#igritemno'+i).text();
var bankid=$('#bankingid'+i).val();
var mappingid=$('#mapid'+i).val(); var mappingid=$('#mapid'+i).val();
var bankingclear=$('#bankingbalclear'+i).val(); var bankingclear=$('#bankingbalclear'+i).val();
var clearedbalance=$('#clearbal'+i).val(); var clearedbalance=$('#clearbal'+i).val();
$.ajax({ $.ajax({
data:{mappingid:mappingid,Totalpoamount:totalamount,paidamount:paidamount,balancetopay:balancetopay,IGRItemNo:Igritemno,bankid:bankid,balancetobankingclear:bankingclear,clearbalance:clearedbalance}, data:{mappingid:mappingid,Totalpoamount:totalamount,paidamount:paidamount,balancetopay:balancetopay,IGRItemNo:Igritemno,bankid:bankid,balancetobankingclear:bankingclear,clearbalance:clearedbalance},
type:"POST", type:"POST",
@ -407,7 +404,7 @@ $.ajax({
{ {
$('#content').loader('hide'); $('#content').loader('hide');
window.location.href ="amountpaid"; window.location.href ="amountpaidsupplier";
//location.reload(); //location.reload();
} }

View File

@ -385,9 +385,11 @@ function invoice(i)
$('#content').loader('show'); $('#content').loader('show');
var totinvoiceamount=$('#totinvoiceamount'+i).text(); var totinvoiceamount=$('#totinvoiceamount'+i).text();
var balancetoreceived=$('#balancetoreceived'+i).text(); var balancetoreceived=$('#balancetoreceived'+i).text();
var invoiceno=$('#invno'+i).text(); var invoiceno=$('#invno'+i).text();
var amountreceived=$('#amountreceived'+i).text(); var amountreceived=$('#amountreceived'+i).text();
var bankid=$('#bankid'+i).val(); var bankid=$('#bankid'+i).val();
var mappingid=$('#mapid'+i).val(); var mappingid=$('#mapid'+i).val();

View File

@ -634,8 +634,8 @@ function Save()
var invoicereceived=$('#invoicereceived'+number).val(); var invoicereceived=$('#invoicereceived'+number).val();
//var payment = parseFloat(invoiceamount); //var payment = parseFloat(invoiceamount);
// if(parseFloat(bankdebitamount) > parseFloat(totalvalue)) if(parseFloat(bankdebitamount) > parseFloat(totalvalue))
// { {
$.ajax( $.ajax(
{ {
data:{bankdate:bankdate,date:date,invid:invid,cname:customername,cid:customerid,invamount:invoiceamount,ar:amountreceived,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw,invrec:invoicereceived}, data:{bankdate:bankdate,date:date,invid:invid,cname:customername,cid:customerid,invamount:invoiceamount,ar:amountreceived,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw,invrec:invoicereceived},
@ -651,12 +651,12 @@ function Save()
} }
} }
}); });
// } }
// else else
// { {
// alert('Your payment exceeding '); alert('Your Amount Is Not Match');
// location.reload(); location.reload();
// } }
// j=j+1; // j=j+1;
} }
} }

View File

@ -298,6 +298,8 @@ var bankingclear=$('#bankingclear'+i).val();
var mappingid=$('#mappingid'+i).val(); var mappingid=$('#mappingid'+i).val();
var credit=$('#credit'+i).val(); var credit=$('#credit'+i).val();
var bankingbalclear=$('#bankingbalclear'+i).val(); var bankingbalclear=$('#bankingbalclear'+i).val();
$.ajax( $.ajax(
{ {

View File

@ -256,7 +256,17 @@ foreach($financialyear as $item)
</tr> </tr>
</tfoot> </tfoot>
<?php } ?> <?php }
else
{
?>
<tr>
<td><span style="text-align:right;">No Records Found!!!</span></td>
<td></td>
</tr>
<?php
}
?>
</table> </table>
<center><h3 class="box-title"><p style="color:#3c8dbc; font-size: 18px;">CashBook &nbsp;&nbsp;<?php if(!empty($ab)){ <center><h3 class="box-title"><p style="color:#3c8dbc; font-size: 18px;">CashBook &nbsp;&nbsp;<?php if(!empty($ab)){
echo $ab; echo $ab;

View File

@ -290,7 +290,7 @@ if(!empty($mapping))
<!--<a target="_blank" href="<?php echo base_url().'uploads/BillFiles/'?><?php echo $rel->file ?>"--> <!--<a target="_blank" href="<?php echo base_url().'uploads/BillFiles/'?><?php echo $rel->file ?>"-->
<td align="left" id="sn<?php echo $i ?>"><span><?php echo $ap->Suppliername?></span></td> <td align="left" id="sn<?php echo $i ?>"><span><?php echo $ap->Suppliername?></span></td>
<td align="left" id="tov<?php echo $i ?>"><span><?php echo $ap->Totalpoamount?></span></td> <td align="left" id="tov<?php echo $i ?>"><span><?php echo $ap->Totalpoamount?></span></td>
<td align="left" id="aa<?php echo $i ?>"><span><?php echo $ap->Balancetopay?></span></td> <td align="left" id="aa<?php echo $i ?>"><span><?php echo $ap->Totalpoamount-$ap->Amountpaid;?></span></td>
<td align="left" id="aa<?php echo $i ?>"><span><?php $tot_amount=$tot_amount+round($total);?><?php echo round($total,2)?></span></td> <td align="left" id="aa<?php echo $i ?>"><span><?php $tot_amount=$tot_amount+round($total);?><?php echo round($total,2)?></span></td>
<?php <?php
if($ap->file !='') if($ap->file !='')