package main_package;

import java.io.IOException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import javax.servlet.http.HttpSession;

import org.primefaces.context.RequestContext;

import report_package.DataBaseReportMethods;

@ManagedBean(name="balanceSheet")
@ViewScoped

public class BalanceSheetBean implements Serializable
{
	double shareCapital=0, tdsPayable, ddSum=0, misSum=0,rdSum=0,fdSum=0,ddInterest=0,rdInterest=0,fdInterest=0,savingsAmount=0,savingsDeposit=0,savingsWithdrawl=0,savingsInterest=0,
			bankBalance=0,cashBalance=0,goodsAmount=0,goodsSaleAmount=0,fdrAmount=0,loanAmount=0,fdrInterestAmount=0, emiReceiveAmount=0, 
			instantBorrowAmount=0, instantLoanAmount, preMatCharge, stationaryCharge, otherCharge, bookedExpense, bookedIncome, bookedExpenseBS;
	Date startDate,endDate=new Date();
	ArrayList<UserInfo> rdFdList,particularList, bsList;
	ArrayList<InstallmentInfo> paidInstallmentList,interestList;
	ArrayList<InstallmentInfo>finalList;
	Date tdyDate,standard,date1,date2,date3,date4,date5,date6,date7,date8;
	Timestamp tdydt,stndrd,dt1,dt2,dt3,dt4,dt5,dt6,dt7,dt8;
	boolean show, showFinalizeBtn, disEndDate, booleanAccuredDeposit,booleanAccuredLoan;
	double totalDr, totalCr;
	String strTotalDr, strTotalCr;
	String strEndDate, strStartDate;
	ArrayList<UserInfo> returnedRdList,returnedFdList,paidRdAmountList,paidFdAmountList;
	ArrayList<SelectItem> bankList;
	double totalAccruedLoanInterset;
	ArrayList<String> loanList;
	ArrayList<LoanInfo> loanEMIList;
	ArrayList<InstallmentInfo> lastList;
	//int branchId;
	double applicantFee=0, odLoanAmount=0,loanInterestAmount=0,otherIncome=0,paidRdInterest,paidFdInterest,otherExpense=0,paidRdAmount=0,paidFdAmount=0,totalIncome=0,
			totalExpense=0,totalRdInterest=0,totalFdInterest=0,totalProfit=0,goodsDepreciationAmount=0, salaryExp=0, promotorCapital,totalDepositPaidInterest,
			paidDdInterest,totalDepositAccruedInterest=0, openingDrTotal, openingCrTotal, misAmt,tds;
	
	DataBaseMethods obj=new DataBaseMethods();
	DecimalFormat dc=new DecimalFormat("##.##");
	DataBaseReportMethods dbmr=new DataBaseReportMethods();
	SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy");
	
	
	public BalanceSheetBean() throws ParseException 
	{
//		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
//		int branchId = (int) ss.getAttribute("branchId");
		HeaderBean hh=new HeaderBean();
		
		if(!obj.previousFinancialYear(-1).equals(hh.getSelectedSession()))
        {
            if(hh.getSelectedSession().contains("-"))
            {
                String aa[]=hh.getSelectedSession().split("-");
                Date dt=new Date();
                dt.setDate(31);
                dt.setMonth(2);
                dt.setYear(Integer.parseInt(aa[1])-1900);
                dt.setHours(0);
                dt.setMinutes(0);
                dt.setSeconds(0);
                endDate=dt;
            }
        }
		else
		{
			endDate=new Date();
		}
		
		if(!hh.getSelectedSession().equals(hh.getCurrentSession()))
		{
			disEndDate=true;
			String eDate="31-03-"+hh.getEndFinYear();
			SimpleDateFormat f = new SimpleDateFormat("dd-MM-yyyy");
			endDate=f.parse(eDate);
		}
		else
		{
			disEndDate=false;
		}
	}
	
	
	
	public void showBalanceSheet() throws ParseException
	{
//		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
//		int branchId = (int) ss.getAttribute("branchId");
		Connection conn=DataBaseConnection.JAVAConnection();
		shareCapital=rdSum=fdSum=rdInterest=fdInterest=savingsAmount=savingsDeposit=savingsWithdrawl=savingsInterest=bankBalance=cashBalance=goodsAmount=
				fdrAmount=loanAmount=fdrInterestAmount=instantLoanAmount=emiReceiveAmount=tdsPayable=instantBorrowAmount=0;
		totalDr= totalCr=0;
		bookedExpense=bookedIncome=bookedExpenseBS=0;
		
		HeaderBean hh=new HeaderBean();
		
		System.out.println("hitt1");
		
		boolean chk=obj.checkDataFreezing(-1,hh.getSelectedSession(), conn);
		System.out.println(chk);
		String fy="";
		if(chk==true)
		{
			fy=hh.getSelectedSession();
			bsList=dbmr.createBalanceSheetList(-1,fy, conn);
			if(bsList.size()>0)
			{
				totalCr=totalDr=0;
				for(UserInfo uu: bsList)
				{
					totalCr+=uu.getCrAmount();
					totalDr+=uu.getDrAmount();
					openingCrTotal+=uu.getOpeningCr();
					openingDrTotal+=uu.getOpeningDr();
				}
				totalCr= Double.parseDouble(dc.format(totalCr));
				totalDr= Double.parseDouble(dc.format(totalDr));
				
				openingCrTotal=Double.parseDouble(dc.format(openingCrTotal));
				openingDrTotal=Double.parseDouble(dc.format(openingDrTotal));
			}
			show=true;
		}
		else
		{
			String arr[]=hh.getSelectedSession().split("-");
			int sy=Integer.parseInt(arr[0]);
			int ey=Integer.parseInt(arr[1]);
			fy=String.valueOf(sy-1)+"-"+String.valueOf(ey-1);
			
			bsList=dbmr.createBalanceSheetList(-1,fy, conn);
			if(bsList.size()>0)
			{
				String sDate="01-04-"+hh.getStartFinYear();
				show=true;
				strEndDate=new SimpleDateFormat("yyyy-MM-dd").format(endDate);
				SimpleDateFormat f = new SimpleDateFormat("dd-MM-yyyy");
				String eDate=new SimpleDateFormat("yyyy-MM-dd").format(endDate);
				startDate=f.parse(sDate);
				strStartDate=new SimpleDateFormat("yyyy-MM-dd").format(startDate);
				totalCr=totalDr=0;
				if(startDate.after(endDate))
				{
					FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Wrong Date Selection."));
				}
				else
				{
					double pIn=obj.promotorAmount(-1,"-1", strStartDate, strEndDate);
					double preturn=obj.returnAmountPromotorWise(-1,"-1", strStartDate, strEndDate);
					
					promotorCapital=pIn-preturn;
				
					shareCapital=dbmr.companyIssueShareCapital(-1,strStartDate, "all", conn, strEndDate);//obj.extractTotalShares();
					shareCapital+=dbmr.companyIssueShareCapitalFromShareInfoTable(-1,strStartDate, "all", conn, strEndDate);//obj.extractTotalShares();
					
					ddSum=obj.totalActiveDepositAmountTaken(-1,"DD",conn,strStartDate ,eDate);
					rdSum=obj.totalActiveDepositAmountTaken(-1,"RD",conn,strStartDate, eDate);
					fdSum=obj.totalActiveDepositAmountTaken(-1,"FD",conn,strStartDate, eDate);
					misSum=obj.totalActiveDepositAmountTaken(-1,"MIS",conn,strStartDate, eDate);
					//Deposit Total
					
					double ddReturn=obj.totalDDRDFDAmountReturnSchemeTypeWise(-1,startDate, endDate, "DD", conn);
					double rdReturn=obj.totalDDRDFDAmountReturnSchemeTypeWise(-1,startDate, endDate, "RD", conn);
					double fdReturn=obj.totalDDRDFDAmountReturnSchemeTypeWise(-1,startDate, endDate, "FD", conn);
					double misReturn=obj.totalDDRDFDAmountReturnSchemeTypeWise(-1,startDate, endDate, "MIS", conn);
					//Deposit Return
					
					ddSum-=ddReturn;
					rdSum-=rdReturn;
					fdSum-=fdReturn;
					misSum-=misReturn;
					
					ddSum=Double.parseDouble(dc.format(ddSum));
					rdSum=Double.parseDouble(dc.format(rdSum));
					fdSum=Double.parseDouble(dc.format(fdSum));
					misSum=Double.parseDouble(dc.format(misSum));
					
					
					
					tds=obj.calculateTdsPayableAmount(startDate, endDate, conn);
					if(tds>0)
					{
						tdsPayable=tds;
					}
					else
					{
						tds=Math.abs(tds);
					}
					
					//ddInterest=Double.parseDouble(dc.format(view("DD")));
					//rdInterest=Double.parseDouble(dc.format(view("RD")));
					//fdInterest=Double.parseDouble(dc.format(view("FD")));
					//Accrued Interest already calculate on P&L
					//double savingAccOp=obj.openingSavingAccountForBalanceSheet(startDate, conn);
					savingsDeposit=obj.totalDepositedAmount(-1,startDate,endDate,conn);
					savingsWithdrawl=obj.totalWithdrawlAmount(-1,startDate,endDate,conn);
				//	System.out.println(savingsDeposit+"===="+savingsWithdrawl);
					savingsAmount=Double.parseDouble(dc.format(savingsDeposit-savingsWithdrawl));
					savingsInterest=obj.totalSavingsInterestAmount(-1,startDate,endDate,conn);
					instantBorrowAmount=obj.totalInstantBorrowAmount(startDate, endDate,-1,conn);
					//tdsPayable=obj.calculateTdsPayableAmount(-1,conn);
					profitLoss();
					bookedExpenseBS=obj.bookedEntryAmountByTransTypeForBalanceSheet("Liability", conn);
					bookedExpenseBS+=obj.bookedEntryAmountByTransTypeForBalanceSheet("Debit", conn); // add this line on 12 april 2025
					totalDr= (tdsPayable+shareCapital+ddSum+rdSum+rdInterest+ddInterest+fdSum+misSum+fdInterest+savingsAmount+savingsInterest+instantBorrowAmount
							+totalProfit+promotorCapital+bookedExpenseBS);
					totalDr= Double.parseDouble(dc.format(totalDr));
					strTotalDr=String.valueOf(totalDr);
					
			//		System.out.println("2: "+strEndDate);
					//***********************************************************************
						// current Date Cash and Bank Balance Method 
					/*bankBalance=obj.allBankBalance(conn);
					cashBalance=obj.remainingCompanyCapitalAmount(conn);
					cashBalance=Double.parseDouble(dc.format(cashBalance));*/
					
					//***********************************************************************
					// dynamic Search Date Cash and Bank Balance calculate Method 
					/*Date closeDate=endDate;
					closeDate.setDate(endDate.getDate()+1);
					String closeDt=new SimpleDateFormat("yyyy-MM-dd").format(closeDate);*/
					
					
					Date closeDate=endDate;
					Calendar cal = Calendar.getInstance();
			        cal.setTime(closeDate);
			        cal.add(Calendar.DATE, 1);
			        closeDate = cal.getTime();
			        String closeDt=new SimpleDateFormat("yyyy-MM-dd").format(closeDate);
			    	
			        String startDt=new SimpleDateFormat("yyyy-MM-dd").format(startDate);
			        
					//System.out.println(endDate+"end ==="+closeDt+"=========close date: "+closeDate);
					bankList=obj.bankNameFromBankTable(conn);
					
				//	System.out.println("3: "+strEndDate);
					if(bankList.size()>0)
					{
						for(SelectItem bb: bankList)
						{
							double capital=dbmr.companyIssueShareCapital(-1,startDt, String.valueOf(bb.getValue()), conn, strEndDate);
							capital=capital+dbmr.companyIssueShareCapitalFromShareInfoTable(-1,startDt,  String.valueOf(bb.getValue()), conn, strEndDate);
							double amt=obj.calculateBankBalance(-1,closeDate, conn, String.valueOf(bb.getValue()));
							bankBalance=bankBalance+(amt+capital);
						}
					}
					cashBalance=obj.calculateCashBalance(-1,closeDate, conn);
					cashBalance+=dbmr.companyIssueShareCapital(-1,startDt, "cash", conn, strEndDate);  // Company Share Capital
					cashBalance+=dbmr.companyIssueShareCapitalFromShareInfoTable(-1,startDt, "cash", conn, strEndDate);  // Company Share Capital
					
					loanAmount=obj.totalLoanAmount(-1,startDate,endDate);
					emiReceiveAmount=obj.totalEmiReceiveAmount(startDate,endDate,-1,conn);
					// // System.out.println("emi : "+emiReceiveAmount);
					loanAmount-=emiReceiveAmount;
					double odLoan =obj.odLoanTotalAmount(conn, startDate, endDate);
					double odReturnLoan =obj.odLoanReturnTotalAmount(-1,conn, startDate, endDate);
					odLoanAmount=odLoan-odReturnLoan;
					loanAmount=Double.parseDouble(dc.format(loanAmount));
					goodsAmount=obj.totalGoodsExpenseAmount(-1,startDate,endDate,conn);
					goodsSaleAmount=obj.totalGoodsIncomeAmount(-1,startDate,endDate,conn);
					goodsAmount=goodsAmount-goodsSaleAmount;
					double depAmount=obj.depreciationAmount(hh.getEndFinYear(), conn);
					goodsAmount-=depAmount;
					fdrAmount=obj.totalFdrBalanceAmountForBalanceSheet(-1,startDate,endDate,conn);
					fdrInterestAmount=obj.totalFdrInterestAmount(-1,startDate,endDate,conn);
					strEndDate=new SimpleDateFormat("dd/MM/yyyy").format(endDate);
					instantLoanAmount=obj.totalInstantLoanAmount(startDate, endDate,-1,conn);
					//totalAccruedLoanInterset=viewAccruedLoanReport();
					
					
					totalCr= (bankBalance+cashBalance+loanAmount+goodsAmount+fdrInterestAmount+fdrAmount+instantLoanAmount+odLoanAmount
							+totalAccruedLoanInterset+bookedIncome);
					totalCr= Double.parseDouble(dc.format(totalCr));
					
					strTotalCr=String.valueOf(totalCr);
					if(!hh.getSelectedSession().equals(hh.getCurrentSession()) && totalCr==totalDr)
					{
						showFinalizeBtn=true;
					}
					
					for(UserInfo uu: bsList)
					{
						if(uu.getLiabilitiesHead().equalsIgnoreCase("Share Capital"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+shareCapital)));
						}
						
						if(uu.getAssetsHead().equalsIgnoreCase("Fixed Asset(Goods)"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+goodsAmount)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("Promotor Capital"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+promotorCapital)));
						}
						
						if(uu.getAssetsHead().equalsIgnoreCase("Investment"))
						{
							System.out.println(uu.getOpeningCr()+"==="+fdrAmount);
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+fdrAmount)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("Net Profit"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+totalProfit)));
						}
						
						if(uu.getAssetsHead().equalsIgnoreCase("Current Asset(Loan)"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+loanAmount)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("RD Amount"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+rdSum)));
						}
						if(uu.getAssetsHead().equalsIgnoreCase("Bank Balance"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+bankBalance)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("DD Amount"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+ddSum)));
						}
						if(uu.getAssetsHead().equalsIgnoreCase("Cash Balance"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+cashBalance)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("FD Amount"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+fdSum)));
						}
						if(uu.getAssetsHead().equalsIgnoreCase("Accrued Interest On Loan"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+totalAccruedLoanInterset)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("MIS Amount"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+misSum)));
						}
						if(uu.getAssetsHead().equalsIgnoreCase("Accrued Interest On Loan"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+totalAccruedLoanInterset)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("Accrued Interest On Deposit"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+totalDepositAccruedInterest)));
						}
						if(uu.getAssetsHead().equalsIgnoreCase("Instant Loan Amount"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+instantLoanAmount)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("Instant Borrow Amount"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+instantBorrowAmount)));
						}
						if(uu.getAssetsHead().equalsIgnoreCase("OD Loan Amount"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+odLoanAmount)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("Savings Acc. Amount"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+savingsAmount)));
						}
						if(uu.getAssetsHead().equalsIgnoreCase("Fixed Asset Interest(Bank)"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+fdrInterestAmount)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("Booked Expense"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(bookedExpenseBS)));
						}
						if(uu.getAssetsHead().equalsIgnoreCase("Booked Income"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+bookedIncome)));
						}
						
						if(uu.getAssetsHead().equalsIgnoreCase("TDS"))
						{
							uu.setCrAmount(Double.parseDouble(dc.format(uu.getOpeningCr()+tds)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("Savings Acc. Interest"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+savingsInterest)));
						}
						
						if(uu.getLiabilitiesHead().equalsIgnoreCase("TDS Payable"))
						{
							uu.setDrAmount(Double.parseDouble(dc.format(uu.getOpeningDr()+tdsPayable)));
						}
					}
					
					openingCrTotal=openingDrTotal=totalCr=totalDr=0;
					for(UserInfo uu: bsList)
					{
						openingCrTotal+=uu.getOpeningCr();
						openingDrTotal+=uu.getOpeningDr();
						totalCr+=uu.getCrAmount();
						totalDr+=uu.getDrAmount();
					}
					totalCr= Double.parseDouble(dc.format(totalCr));
					totalDr= Double.parseDouble(dc.format(totalDr));
					strTotalCr=String.valueOf(totalCr);
					strTotalDr=String.valueOf(totalDr);
					openingCrTotal=Double.parseDouble(dc.format(openingCrTotal));
					openingDrTotal=Double.parseDouble(dc.format(openingDrTotal));
				}
			}	
		
			else	
			{
				show=false;
				RequestContext.getCurrentInstance().showMessageInDialog(new FacesMessage(FacesMessage.SEVERITY_INFO, "Balance Sheet Detail", "Dear User, Balance Sheet of Current Financial Year "+hh.getCurrentSession()+ " Will Be Shown after The Finalize Balance Sheet of Last Financal Year "+fy +". Thank You..."));
			}
		}	
		
		try {
			conn.close();
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	
	public void insertBalanceSheet() throws IOException
	{
//		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
//		int branchId = (int) ss.getAttribute("branchId");
		HeaderBean hh=new HeaderBean();
		Connection conn=DataBaseConnection.JAVAConnection();
		int i=obj.insertBalanceSheetData(-1,bsList, hh.getSelectedSession(), conn);
		if(i>0)
		{
			obj.updateDataFreezeStatus(-1,hh.getSelectedSession(),"yes", conn);
			RequestContext.getCurrentInstance().showMessageInDialog(new FacesMessage(FacesMessage.SEVERITY_INFO, "Balance Sheet Data Finalization", "Balance Sheet Data Finalize Sucessfully."));
			//FacesContext.getCurrentInstance().getExternalContext().redirect("mainDashBoard.xhtml");
			NavigationBean nn=new NavigationBean();
			nn.logout();
		}
		else
		{
			FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Something Went Wrong??? Please Contact to Administrator..."));
		}
		
		try {
			conn.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void profitLoss() throws NumberFormatException, ParseException
	{
		Connection conn=DataBaseConnection.JAVAConnection();
		HeaderBean hh=new HeaderBean();
		
		preMatCharge=stationaryCharge=otherCharge=applicantFee=loanInterestAmount=fdrInterestAmount=fdrAmount=otherIncome=rdInterest=fdInterest=savingsInterest=
					paidRdInterest=paidFdInterest=otherExpense=paidRdAmount=paidFdAmount=totalIncome=totalExpense=totalRdInterest=misAmt=
					totalFdInterest=totalProfit=goodsAmount=goodsDepreciationAmount=salaryExp=ddInterest=totalDepositPaidInterest=paidDdInterest=totalDepositAccruedInterest=0;
		bookedExpense=bookedIncome=0;
		applicantFee=Double.parseDouble(dc.format(obj.totalApplicantFee(-1,startDate,endDate,conn)));
		loanInterestAmount=Double.parseDouble(dc.format(obj.totalLoanInterest(-1,startDate,endDate,conn)));
		fdrInterestAmount=Double.parseDouble(dc.format(obj.totalFdrInterestAmount(-1,startDate, endDate,conn)));
		fdrAmount=Double.parseDouble(dc.format(obj.totalFdrInterestAmountFromFdrIncomeTable(-1,startDate,endDate,conn)));
		fdrInterestAmount=Double.parseDouble(dc.format(fdrInterestAmount+fdrAmount));
		otherIncome=Double.parseDouble(dc.format(obj.totalOtherIncomeAmount(-1,startDate,endDate,conn))); 
		
		if(booleanAccuredLoan==true)
		{
			totalAccruedLoanInterset=viewAccruedLoanReport();
		}
		else
		{
			totalAccruedLoanInterset=0;
		}
		// Charges on Deposit Pre-Maturity from Return Amount Info table
		/*preMatCharge=Double.parseDouble(dc.format(obj.totalPreMaturityChargesOnDeposit(startDate,endDate,conn, "pre_maturity_charge"))); 
		stationaryCharge=Double.parseDouble(dc.format(obj.totalPreMaturityChargesOnDeposit(startDate,endDate,conn, "stationary_charge"))); 
		otherCharge=Double.parseDouble(dc.format(obj.totalPreMaturityChargesOnDeposit(startDate,endDate,conn, "other_charge")));*/ 
		bookedIncome=obj.bookedIncomeExpenseAmount("Credit",-1,startDate,endDate, conn);
		totalIncome=Double.parseDouble(dc.format(applicantFee+loanInterestAmount+fdrInterestAmount+otherIncome+totalAccruedLoanInterset+bookedIncome));
		
		//***********************************************************************************
		savingsInterest=Double.parseDouble(dc.format(obj.totalSavingsInterestAmount(-1,startDate,endDate,conn)));
		
		if(!hh.getSelectedSession().equals(hh.getCurrentSession()))
		{
			if(booleanAccuredDeposit==true)
			{
				ddInterest=Double.parseDouble(dc.format(view("DD")));
				rdInterest=Double.parseDouble(dc.format(view("RD")));
				fdInterest=Double.parseDouble(dc.format(view("FD")));
			}
			else
			{
				ddInterest=rdInterest=fdInterest=0;
			}
		}
		
		//Accrued Interest
		
		paidDdInterest=Double.parseDouble(dc.format(paidDD(startDate,endDate, conn)));
		paidRdInterest=Double.parseDouble(dc.format(paidRD(startDate,endDate, conn)));
		paidFdInterest=Double.parseDouble(dc.format(paidFD(startDate,endDate, conn)));
		//Paid RD/DD/FD Interest
		
		otherExpense=Double.parseDouble(dc.format(obj.totalOtherExpenseAmount(-1,startDate,endDate,conn)));
		salaryExp=Double.parseDouble(dc.format(obj.salaryExpenseAmount(-1,startDate,endDate,conn)));
		misAmt = obj.paidMISInterestBetweenDates(-1,startDate,endDate, conn);
		
		double dsaCommExp=Double.parseDouble(dc.format(obj.dsaCommissionExpenseAmount(-1,startDate,endDate,conn)));
		otherExpense=otherExpense+salaryExp+dsaCommExp+misAmt;
		//goodsAmount=Double.parseDouble(dc.format(obj.totalGoodsExpenseAmount(startDate,endDate)));
		
		
		totalDepositAccruedInterest=ddInterest+rdInterest+fdInterest;
		totalDepositAccruedInterest=Double.parseDouble(dc.format(totalDepositAccruedInterest));
		totalDepositPaidInterest=paidDdInterest+paidFdInterest+paidRdInterest;
		
		totalDepositPaidInterest=Math.abs(totalDepositPaidInterest);
		double bookedExpensePL=obj.bookedEntryAmountByTransTypeForProfitLoss("Debit", conn);
		double depAmount=obj.depreciationAmount(hh.getEndFinYear(), conn);
		totalExpense=Double.parseDouble(dc.format(savingsInterest+otherExpense+totalDepositAccruedInterest+totalDepositPaidInterest+bookedExpense+bookedExpensePL+depAmount));
		totalProfit=Double.parseDouble(dc.format(totalIncome-totalExpense));
		try {
			conn.close();
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	public double paidDD(Date startDate2, Date endDate2, Connection conn)
	{
//		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
//		int branchId = (int) ss.getAttribute("branchId");
		paidRdInterest=0;
		returnedRdList=obj.returnedRdAmountList(-1,startDate2,endDate2,"DD",conn);
		for(UserInfo uu : returnedRdList)
		{
			
			paidRdAmount=obj.paidAmountForRdList(startDate,endDate,uu.getUser_no(),conn);
			
			paidRdInterest=paidRdInterest+(uu.getAmount()-paidRdAmount);
		}
		
		return paidRdInterest;
	}
	
	public double paidRD(Date startDate2, Date endDate2, Connection conn)
	{
//		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
//		int branchId = (int) ss.getAttribute("branchId");
		paidRdInterest=0;
		returnedRdList=obj.returnedRdAmountList(-1,startDate2,endDate2,"RD",conn);
		for(UserInfo uu : returnedRdList)
		{
			paidRdAmount=obj.paidAmountForRdList(startDate,endDate,uu.getUser_no(),conn);
			//System.out.println(uu.getUser_no()+"Return Amount :  "+uu.getAmount()+" ================== "+paidRdAmount);
			paidRdInterest=paidRdInterest+(uu.getAmount()-paidRdAmount);
		}
		return paidRdInterest;
	}
	
	public double paidFD(Date startDate3, Date endDate3, Connection conn)
	{
//		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
//		int branchId = (int) ss.getAttribute("branchId");
		paidFdInterest=0;
		returnedFdList=obj.returnedRdAmountList(-1,startDate3,endDate3,"FD",conn);
		for(UserInfo uu : returnedFdList)
		{
			paidFdAmount=Double.parseDouble(dc.format(obj.paidAmountForFdList(startDate,endDate,uu.getUser_no())));
			paidFdInterest=Double.parseDouble(dc.format(paidFdInterest+(uu.getAmount()-paidFdAmount)));
		}
		return paidFdInterest;
	}
	
	
	/*public double paidRD(Date startDate2, Date endDate2, Connection conn)
	{
		paidRdInterest=0;
		returnedRdList=obj.returnedRdAmountList(startDate2,endDate2,"RD",conn);
		for(UserInfo uu : returnedRdList)
		{
			paidRdAmount=obj.paidAmountForRdList(startDate,endDate,uu.getUser_no(),conn);
			paidRdInterest=paidRdInterest+(uu.getAmount()-paidRdAmount);
		}
		
		return paidRdInterest;
	}
	
	public double paidDD(Date startDate2, Date endDate2, Connection conn)
	{
		paidRdInterest=0;
		returnedRdList=obj.returnedRdAmountList(startDate2,endDate2,"DD",conn);
		for(UserInfo uu : returnedRdList)
		{
			paidRdAmount=obj.paidAmountForRdList(startDate,endDate,uu.getUser_no(),conn);
			paidRdInterest=paidRdInterest+(uu.getAmount()-paidRdAmount);
		}
		
		return paidRdInterest;
	}
	
	public double paidFD(Date startDate3, Date endDate3, Connection conn)
	{
		paidFdInterest=0;
		returnedFdList=obj.returnedRdAmountList(startDate3,endDate3,"FD",conn);
		for(UserInfo uu : returnedFdList)
		{
			paidFdAmount=Double.parseDouble(dc.format(obj.paidAmountForFdList(startDate,endDate,uu.getUser_no())));
			paidFdInterest=Double.parseDouble(dc.format(paidFdInterest+(uu.getAmount()-paidFdAmount)));
		}
		
		return paidFdInterest;
	}*/
	
	
	private double viewAccruedLoanReport() 
	{
		System.out.println("viewAccruedLoanReport mehtod call ");
//		HttpSession ss0=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
//		int branchId = (int) ss0.getAttribute("branchId");
		HeaderBean hh=new HeaderBean();
	//	if(hh.getName().equals(""))
		{
			Connection conn=DataBaseConnection.JAVAConnection();
			lastList=new ArrayList<>();
			double totIntr=0,totalCrIntr=0;
			ArrayList<SelectItem> loanTypeList=obj.loanTypeList1();
			for(SelectItem ss: loanTypeList)
			{
				loanList=obj.allActiveLoanForAccruedLoan(String.valueOf(ss.getValue()),startDate,endDate,-1);
				for(String vv: loanList)
				{
					loanEMIList=obj.loanInstallment(String.valueOf(ss.getValue()), vv, conn);
					for(int l=0;l<loanEMIList.size();l++)
					{
						//if(loanEMIList.get(l).getStatus().equalsIgnoreCase("due"))
						{
							if((loanEMIList.get(l).getInstallDate().after(startDate) || loanEMIList.get(l).getInstallDate().equals(startDate)) && (loanEMIList.get(l).getInstallDate().before(endDate) || loanEMIList.get(l).getInstallDate().equals(endDate)))
							{
								//if(loanEMIList.get(l).getPaidAmount()<Double.parseDouble(loanEMIList.get(l).getInterestAmount()))
								{
									totIntr+=(Double.parseDouble(loanEMIList.get(l).getInterestAmount()));
								}
							}
						}
					}
					totalCrIntr+=obj.totalLoanInterestByLoanNo(startDate, endDate, conn, vv);
					System.out.println("=========="+totIntr+"=========="+totalCrIntr+"=="+vv);
				}
			}
			totalAccruedLoanInterset=totIntr-totalCrIntr;
			totalAccruedLoanInterset=Double.parseDouble(dc.format(totalAccruedLoanInterset));
			
			try {
				conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			return totalAccruedLoanInterset;
		}
		/*else
		{
			totalAccruedLoanInterset=0;
			return totalAccruedLoanInterset;
		}*/
		
		
	}
	 
	public void print()
    {
        HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
        ss.setAttribute("openingCrTotal", openingCrTotal);
        ss.setAttribute("openingDrTotal", openingDrTotal);
        ss.setAttribute("strTotalCr", strTotalCr);
        ss.setAttribute("strTotalDr", strTotalDr);
        ss.setAttribute("strEndDate", strEndDate);
        ss.setAttribute("bsList", bsList);


        RequestContext.getCurrentInstance().execute("window.open('printBalanceSheet.xhtml')");
    }
	
	double total=0;
	public double view(String type) throws ParseException
	{
		Connection conn=DataBaseConnection.JAVAConnection();
		total=0;
		setAllDates(type);
		interestList=new ArrayList<>();
		particularList=new ArrayList<>();
		paidInstallmentList=new ArrayList<>();
		finalList=new ArrayList<>();
		boolean intfirst=false,intsecond=false,intthird=false,intfourth=false;
		for(UserInfo info : rdFdList)
		{
			UserInfo ii=new UserInfo();
			if(info.getScheme_type().equals(type))
			{
				ii.setScheme_type(info.getScheme_type());
				ii.setUser_no(info.getUser_no());
				ii.setOffice_date(info.getOffice_date());
				ii.setFirst_applicantName(info.getFirst_applicantName());
				ii.setInstallment_amount(info.getInstallment_amount());
				ii.setStrMatDate(info.getStrMatDate());
				
				particularList.add(ii);
				
			}
		}
		
		for(UserInfo uu : particularList)
		{
			
			paidInstallmentList=obj.showInstallment(uu.getUser_no(),conn);
			if(paidInstallmentList!=null)
			{
				for(InstallmentInfo ll : paidInstallmentList)
				{
					InstallmentInfo oo=new InstallmentInfo();
					if(ll.getStatus().equals("Paid"))
					{
						oo.setUser_no(ll.getUser_no());
						oo.setCalc_interest(Double.parseDouble(dc.format(ll.getCalc_interest())));
						oo.setOffice_date(uu.getOffice_date());
						oo.setStatus(ll.getStatus());
						oo.setInstlmntDate(ll.getInstlmntDate());
						oo.setIns_date(ll.getIns_date()); 
						interestList.add(oo);
						
					}
					
				}
			}
			
		}
		
		int i=0;
		int j=0;
		int year=0;
		for(InstallmentInfo ff : interestList)
		{
			String usercode="";
			
			
			double interest1=0,interest2=0,interest3=0,interest4=0;
			InstallmentInfo ss=new InstallmentInfo();
			Timestamp insdt=new Timestamp(ff.getInstlmntDate().getTime());

			if(i>0)
			{
				usercode=interestList.get(i-1).getUser_no();
			}
			
			if(!(usercode.equals(ff.getUser_no())))
			{
				j=0;
			}
			
			if(j==0)
			{
				year=ff.getOffice_date().getYear();
			}
			
			dt1.setYear(year);dt2.setYear(year);dt3.setYear(year);
			dt4.setYear(year);dt5.setYear(year);dt6.setYear(year);
			dt7.setYear(year);dt8.setYear(year);
			
			
			if((insdt.equals(dt1) || insdt.after(dt1)) && (insdt.equals(dt2) || insdt.before(dt2)))
			{
				
				if(intfirst==false || !(usercode.equals(ff.getUser_no())))
				{
				
					for(InstallmentInfo rr : interestList)
					{
				
						Timestamp insdt1=new Timestamp(rr.getInstlmntDate().getTime());
						if((ff.getUser_no().equals(rr.getUser_no()) && (insdt1.equals(dt1) || insdt1.after(dt1)) && (insdt1.equals(dt2) || insdt1.before(dt2)) ))
						{
							interest1=interest1+rr.getCalc_interest();
						}
					}

					intsecond=false;
					intfirst=true;
					intthird=false;
					intfourth=false;
					
					ss.setUser_no(ff.getUser_no());
					ss.setPayoutDate(dt2);
					ss.setInterest(Double.parseDouble(dc.format(interest1)));
					ss.setStrPayOutDate(new SimpleDateFormat("dd/MM/yyyy").format(ss.getPayoutDate()));
				}
				
				
			}
			else if((insdt.equals(dt3) || insdt.after(dt3)) && (insdt.equals(dt4) || insdt.before(dt4)))
			{
				if(intsecond==false || !(usercode.equals(ff.getUser_no())))
				{
					for(InstallmentInfo rr : interestList)
					{
				
						Timestamp insdt1=new Timestamp(rr.getInstlmntDate().getTime());
						if((ff.getUser_no().equals(rr.getUser_no()) && (insdt1.equals(dt3) || insdt1.after(dt3)) && (insdt1.equals(dt4) || insdt1.before(dt4)) ))
						{
							interest2=interest2+rr.getCalc_interest();
						}
					}
					
					intsecond=true;
					intfirst=false;
					intthird=false;
					intfourth=false;
					
					ss.setUser_no(ff.getUser_no());
					ss.setPayoutDate(dt4);
					ss.setInterest(Double.parseDouble(dc.format(interest2)));
					ss.setStrPayOutDate(new SimpleDateFormat("dd/MM/yyyy").format(ss.getPayoutDate()));

				}

			}
			else if((insdt.equals(dt5) || insdt.after(dt5)) && (insdt.equals(dt6) || insdt.before(dt6)))
			{	
				if(intthird==false || !(usercode.equals(ff.getUser_no())))
				{
					for(InstallmentInfo rr : interestList)
					{
				
						Timestamp insdt1=new Timestamp(rr.getInstlmntDate().getTime());
						if((ff.getUser_no().equals(rr.getUser_no()) && (insdt1.equals(dt5) || insdt1.after(dt5)) && (insdt1.equals(dt6) || insdt1.before(dt6)) ))
						{
							interest3=interest3+rr.getCalc_interest();
						}
					}
					
					intsecond=false;
					intfirst=false;
					intthird=true;
					intfourth=false;
					
					ss.setUser_no(ff.getUser_no());
					ss.setPayoutDate(dt6);
					ss.setInterest(Double.parseDouble(dc.format(interest3)));
					ss.setStrPayOutDate(new SimpleDateFormat("dd/MM/yyyy").format(ss.getPayoutDate()));

				}
				year++;

			}
			else if((insdt.equals(dt7) || insdt.after(dt7)) && (insdt.equals(dt8) || insdt.before(dt8)))
			{
				if(intfourth==false || !(usercode.equals(ff.getUser_no())))
				{
					for(InstallmentInfo rr : interestList)
					{
				
						Timestamp insdt1=new Timestamp(rr.getInstlmntDate().getTime());
						if((ff.getUser_no().equals(rr.getUser_no()) && (insdt1.equals(dt7) || insdt1.after(dt7)) && (insdt1.equals(dt8) || insdt1.before(dt8)) ))
						{
							interest4=interest4+rr.getCalc_interest();
						}
					}
					
					intsecond=false;
					intfirst=false;
					intthird=false;
					intfourth=true;
					
					ss.setUser_no(ff.getUser_no());
					ss.setPayoutDate(dt8);
					ss.setInterest(Double.parseDouble(dc.format(interest4)));
					ss.setStrPayOutDate(new SimpleDateFormat("dd/MM/yyyy").format(ss.getPayoutDate()));

				}

			}
				
			//****
			i++;j++;
			if(ss.getInterest()>0 && (ss.getPayoutDate().before(tdydt) || ss.getPayoutDate().equals(tdydt)))
			{
				finalList.add(ss);
						
			}
			
		}
		int k=0;
		for(InstallmentInfo tt : finalList)
		{
			tt.setSno(++k);
			total+=Double.parseDouble(dc.format(tt.getInterest()));
			//// System.out.println(Double.parseDouble(dc.format(total)));
		}
		total=Double.parseDouble(dc.format(total));
		try {
			conn.close();
		} catch (Exception e) {
			// TODO: handle exception
		}
		return total;
		
	}
	
	public void setAllDates(String type) throws ParseException
	{
//		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
//		int branchId = (int) ss.getAttribute("branchId");
		HeaderBean hh=new HeaderBean();
		
		Date currDate=new Date();
		
		String eDate="31-03-"+hh.getStartFinYear();
		
		
		
		if(!hh.getSelectedSession().equals(hh.getCurrentSession()))
		{
			SimpleDateFormat f = new SimpleDateFormat("dd-MM-yyyy");
			
			Date finLastDate;
			
			finLastDate=f.parse(eDate);
			standard=tdyDate=date1=date2=date3=date4=date5=date6=date7=date8=finLastDate;
		}
		else
		{
			
			date1=date2=date3=date4=date5=date6=date7=date8=standard=tdyDate=currDate;			
		}
		
		
		dt1=new Timestamp(date1.getTime());dt2=new Timestamp(date2.getTime());
		dt3=new Timestamp(date3.getTime());dt4=new Timestamp(date4.getTime());
		dt5=new Timestamp(date5.getTime());dt6=new Timestamp(date6.getTime());
		dt7=new Timestamp(date7.getTime());dt8=new Timestamp(date8.getTime());
		

		
		tdydt=new Timestamp(endDate.getTime());
		tdydt.setHours(0);tdydt.setMinutes(0);tdydt.setSeconds(0);tdydt.setNanos(0);
		
		stndrd=new Timestamp(endDate.getTime());
		stndrd.setDate(30);
		stndrd.setMonth(5);
		stndrd.setYear(endDate.getYear());
		stndrd.setHours(0);stndrd.setMinutes(0);stndrd.setSeconds(0);stndrd.setNanos(0);
		
		dt1.setDate(1);
		dt1.setMonth(3);
		dt1.setHours(0);dt1.setMinutes(0);dt1.setSeconds(0);dt1.setNanos(0);
		
		dt2.setDate(30);
		dt2.setMonth(5);
		dt2.setHours(0);dt2.setMinutes(0);dt2.setSeconds(0);dt2.setNanos(0);

		dt3.setDate(1);
		dt3.setMonth(6);
		dt3.setHours(0);dt3.setMinutes(0);dt3.setSeconds(0);dt3.setNanos(0);

		dt4.setDate(30);
		dt4.setMonth(8);
		dt4.setHours(0);dt4.setMinutes(0);dt4.setSeconds(0);dt4.setNanos(0);

		dt5.setDate(1);
		dt5.setMonth(9);
		dt5.setHours(0);dt5.setMinutes(0);dt5.setSeconds(0);dt5.setNanos(0);

		dt6.setDate(31);
		dt6.setMonth(11);
		dt6.setHours(0);dt6.setMinutes(0);dt6.setSeconds(0);dt6.setNanos(0);

		dt7.setDate(1);
		dt7.setMonth(0);
		dt7.setHours(0);dt7.setMinutes(0);dt7.setSeconds(0);dt7.setNanos(0);

		dt8.setDate(31);
		dt8.setMonth(2);
		dt8.setHours(0);dt8.setMinutes(0);dt8.setSeconds(0);dt8.setNanos(0);

		
		rdFdList=obj.showUser(-1,type);
	}

	public double getShareCapital() {
		return shareCapital;
	}

	public void setShareCapital(double shareCapital) {
		this.shareCapital = shareCapital;
	}

	public double getRdSum() {
		return rdSum;
	}

	public void setRdSum(double rdSum) {
		this.rdSum = rdSum;
	}

	public double getFdSum() {
		return fdSum;
	}

	public void setFdSum(double fdSum) {
		this.fdSum = fdSum;
	}

	public double getRdInterest() {
		return rdInterest;
	}

	public void setRdInterest(double rdInterest) {
		this.rdInterest = rdInterest;
	}

	public double getFdInterest() {
		return fdInterest;
	}

	public void setFdInterest(double fdInterest) {
		this.fdInterest = fdInterest;
	}

	public double getSavingsAmount() {
		return savingsAmount;
	}

	public void setSavingsAmount(double savingsAmount) {
		this.savingsAmount = savingsAmount;
	}

	public double getSavingsDeposit() {
		return savingsDeposit;
	}

	public void setSavingsDeposit(double savingsDeposit) {
		this.savingsDeposit = savingsDeposit;
	}

	public double getSavingsWithdrawl() {
		return savingsWithdrawl;
	}

	public void setSavingsWithdrawl(double savingsWithdrawl) {
		this.savingsWithdrawl = savingsWithdrawl;
	}

	public double getSavingsInterest() {
		return savingsInterest;
	}

	public void setSavingsInterest(double savingsInterest) {
		this.savingsInterest = savingsInterest;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public double getTotal() {
		return total;
	}

	public void setTotal(double total) {
		this.total = total;
	}

	public boolean isShow() {
		return show;
	}

	public void setShow(boolean show) {
		this.show = show;
	}

	public double getBankBalance() {
		return bankBalance;
	}

	public void setBankBalance(double bankBalance) {
		this.bankBalance = bankBalance;
	}

	public double getCashBalance() {
		return cashBalance;
	}

	public void setCashBalance(double cashBalance) {
		this.cashBalance = cashBalance;
	}

	public double getGoodsAmount() {
		return goodsAmount;
	}

	public void setGoodsAmount(double goodsAmount) {
		this.goodsAmount = goodsAmount;
	}

	public double getFdrAmount() {
		return fdrAmount;
	}

	public void setFdrAmount(double fdrAmount) {
		this.fdrAmount = fdrAmount;
	}

	public double getLoanAmount() {
		return loanAmount;
	}

	public void setLoanAmount(double loanAmount) {
		this.loanAmount = loanAmount;
	}

	public double getFdrInterestAmount() {
		return fdrInterestAmount;
	}

	public void setFdrInterestAmount(double fdrInterestAmount) {
		this.fdrInterestAmount = fdrInterestAmount;
	}

	public String getStrEndDate() {
		return strEndDate;
	}

	public void setStrEndDate(String strEndDate) {
		this.strEndDate = strEndDate;
	}

	

	public double getTotalProfit() {
		return totalProfit;
	}

	public void setTotalProfit(double totalProfit) {
		this.totalProfit = totalProfit;
	}

	public double getEmiReceiveAmount() {
		return emiReceiveAmount;
	}

	public void setEmiReceiveAmount(double emiReceiveAmount) {
		this.emiReceiveAmount = emiReceiveAmount;
	}

	public double getInstantBorrowAmount() {
		return instantBorrowAmount;
	}

	public void setInstantBorrowAmount(double instantBorrowAmount) {
		this.instantBorrowAmount = instantBorrowAmount;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public ArrayList<UserInfo> getRdFdList() {
		return rdFdList;
	}

	public void setRdFdList(ArrayList<UserInfo> rdFdList) {
		this.rdFdList = rdFdList;
	}

	public ArrayList<UserInfo> getParticularList() {
		return particularList;
	}

	public void setParticularList(ArrayList<UserInfo> particularList) {
		this.particularList = particularList;
	}

	public ArrayList<InstallmentInfo> getPaidInstallmentList() {
		return paidInstallmentList;
	}

	public void setPaidInstallmentList(
			ArrayList<InstallmentInfo> paidInstallmentList) {
		this.paidInstallmentList = paidInstallmentList;
	}

	public ArrayList<InstallmentInfo> getInterestList() {
		return interestList;
	}

	public void setInterestList(ArrayList<InstallmentInfo> interestList) {
		this.interestList = interestList;
	}

	public ArrayList<InstallmentInfo> getFinalList() {
		return finalList;
	}

	public void setFinalList(ArrayList<InstallmentInfo> finalList) {
		this.finalList = finalList;
	}

	public Date getTdyDate() {
		return tdyDate;
	}

	public void setTdyDate(Date tdyDate) {
		this.tdyDate = tdyDate;
	}

	public Date getStandard() {
		return standard;
	}

	public void setStandard(Date standard) {
		this.standard = standard;
	}

	public Date getDate1() {
		return date1;
	}

	public void setDate1(Date date1) {
		this.date1 = date1;
	}

	public Date getDate2() {
		return date2;
	}

	public void setDate2(Date date2) {
		this.date2 = date2;
	}

	public Date getDate3() {
		return date3;
	}

	public void setDate3(Date date3) {
		this.date3 = date3;
	}

	public Date getDate4() {
		return date4;
	}

	public void setDate4(Date date4) {
		this.date4 = date4;
	}

	public Date getDate5() {
		return date5;
	}

	public void setDate5(Date date5) {
		this.date5 = date5;
	}

	public Date getDate6() {
		return date6;
	}

	public void setDate6(Date date6) {
		this.date6 = date6;
	}

	public Date getDate7() {
		return date7;
	}

	public void setDate7(Date date7) {
		this.date7 = date7;
	}

	public Date getDate8() {
		return date8;
	}

	public void setDate8(Date date8) {
		this.date8 = date8;
	}

	public Timestamp getTdydt() {
		return tdydt;
	}

	public void setTdydt(Timestamp tdydt) {
		this.tdydt = tdydt;
	}

	public Timestamp getStndrd() {
		return stndrd;
	}

	public void setStndrd(Timestamp stndrd) {
		this.stndrd = stndrd;
	}

	public Timestamp getDt1() {
		return dt1;
	}

	public void setDt1(Timestamp dt1) {
		this.dt1 = dt1;
	}

	public Timestamp getDt2() {
		return dt2;
	}

	public void setDt2(Timestamp dt2) {
		this.dt2 = dt2;
	}

	public Timestamp getDt3() {
		return dt3;
	}

	public void setDt3(Timestamp dt3) {
		this.dt3 = dt3;
	}

	public Timestamp getDt4() {
		return dt4;
	}

	public void setDt4(Timestamp dt4) {
		this.dt4 = dt4;
	}

	public Timestamp getDt5() {
		return dt5;
	}

	public void setDt5(Timestamp dt5) {
		this.dt5 = dt5;
	}

	public Timestamp getDt6() {
		return dt6;
	}

	public void setDt6(Timestamp dt6) {
		this.dt6 = dt6;
	}

	public Timestamp getDt7() {
		return dt7;
	}

	public void setDt7(Timestamp dt7) {
		this.dt7 = dt7;
	}

	public Timestamp getDt8() {
		return dt8;
	}

	public void setDt8(Timestamp dt8) {
		this.dt8 = dt8;
	}

	public ArrayList<UserInfo> getReturnedRdList() {
		return returnedRdList;
	}

	public void setReturnedRdList(ArrayList<UserInfo> returnedRdList) {
		this.returnedRdList = returnedRdList;
	}

	public ArrayList<UserInfo> getReturnedFdList() {
		return returnedFdList;
	}

	public void setReturnedFdList(ArrayList<UserInfo> returnedFdList) {
		this.returnedFdList = returnedFdList;
	}

	public ArrayList<UserInfo> getPaidRdAmountList() {
		return paidRdAmountList;
	}

	public void setPaidRdAmountList(ArrayList<UserInfo> paidRdAmountList) {
		this.paidRdAmountList = paidRdAmountList;
	}

	public ArrayList<UserInfo> getPaidFdAmountList() {
		return paidFdAmountList;
	}

	public void setPaidFdAmountList(ArrayList<UserInfo> paidFdAmountList) {
		this.paidFdAmountList = paidFdAmountList;
	}

	public double getApplicantFee() {
		return applicantFee;
	}

	public void setApplicantFee(double applicantFee) {
		this.applicantFee = applicantFee;
	}

	public double getLoanInterestAmount() {
		return loanInterestAmount;
	}

	public void setLoanInterestAmount(double loanInterestAmount) {
		this.loanInterestAmount = loanInterestAmount;
	}

	public double getOtherIncome() {
		return otherIncome;
	}

	public void setOtherIncome(double otherIncome) {
		this.otherIncome = otherIncome;
	}

	public double getPaidRdInterest() {
		return paidRdInterest;
	}

	public void setPaidRdInterest(double paidRdInterest) {
		this.paidRdInterest = paidRdInterest;
	}

	public double getPaidFdInterest() {
		return paidFdInterest;
	}

	public void setPaidFdInterest(double paidFdInterest) {
		this.paidFdInterest = paidFdInterest;
	}

	public double getOtherExpense() {
		return otherExpense;
	}

	public void setOtherExpense(double otherExpense) {
		this.otherExpense = otherExpense;
	}

	public double getPaidRdAmount() {
		return paidRdAmount;
	}

	public void setPaidRdAmount(double paidRdAmount) {
		this.paidRdAmount = paidRdAmount;
	}

	public double getPaidFdAmount() {
		return paidFdAmount;
	}

	public void setPaidFdAmount(double paidFdAmount) {
		this.paidFdAmount = paidFdAmount;
	}

	public double getTotalIncome() {
		return totalIncome;
	}

	public void setTotalIncome(double totalIncome) {
		this.totalIncome = totalIncome;
	}

	public double getTotalExpense() {
		return totalExpense;
	}

	public void setTotalExpense(double totalExpense) {
		this.totalExpense = totalExpense;
	}

	public double getTotalRdInterest() {
		return totalRdInterest;
	}

	public void setTotalRdInterest(double totalRdInterest) {
		this.totalRdInterest = totalRdInterest;
	}

	public double getTotalFdInterest() {
		return totalFdInterest;
	}

	public void setTotalFdInterest(double totalFdInterest) {
		this.totalFdInterest = totalFdInterest;
	}

	public double getGoodsDepreciationAmount() {
		return goodsDepreciationAmount;
	}

	public void setGoodsDepreciationAmount(double goodsDepreciationAmount) {
		this.goodsDepreciationAmount = goodsDepreciationAmount;
	}

	public double getSalaryExp() {
		return salaryExp;
	}

	public void setSalaryExp(double salaryExp) {
		this.salaryExp = salaryExp;
	}

	public double getInstantLoanAmount() {
		return instantLoanAmount;
	}

	public void setInstantLoanAmount(double instantLoanAmount) {
		this.instantLoanAmount = instantLoanAmount;
	}

	public double getDdSum() {
		return ddSum;
	}

	public void setDdSum(double ddSum) {
		this.ddSum = ddSum;
	}

	public double getDdInterest() {
		return ddInterest;
	}

	public void setDdInterest(double ddInterest) {
		this.ddInterest = ddInterest;
	}

	public double getPromotorCapital() {
		return promotorCapital;
	}

	public void setPromotorCapital(double promotorCapital) {
		this.promotorCapital = promotorCapital;
	}

	public double getTotalDepositPaidInterest() {
		return totalDepositPaidInterest;
	}

	public void setTotalDepositPaidInterest(double totalDepositPaidInterest) {
		this.totalDepositPaidInterest = totalDepositPaidInterest;
	}

	public double getPaidDdInterest() {
		return paidDdInterest;
	}

	public void setPaidDdInterest(double paidDdInterest) {
		this.paidDdInterest = paidDdInterest;
	}

	public double getTotalDepositAccruedInterest() {
		return totalDepositAccruedInterest;
	}

	public void setTotalDepositAccruedInterest(double totalDepositAccruedInterest) {
		this.totalDepositAccruedInterest = totalDepositAccruedInterest;
	}

	public double getTdsPayable() {
		return tdsPayable;
	}

	public void setTdsPayable(double tdsPayable) {
		this.tdsPayable = tdsPayable;
	}

	public double getOdLoanAmount() {
		return odLoanAmount;
	}

	public void setOdLoanAmount(double odLoanAmount) {
		this.odLoanAmount = odLoanAmount;
	}



	public boolean isDisEndDate() {
		return disEndDate;
	}



	public void setDisEndDate(boolean disEndDate) {
		this.disEndDate = disEndDate;
	}



	public double getTotalAccruedLoanInterset() {
		return totalAccruedLoanInterset;
	}



	public void setTotalAccruedLoanInterset(double totalAccruedLoanInterset) {
		this.totalAccruedLoanInterset = totalAccruedLoanInterset;
	}



	public ArrayList<UserInfo> getBsList() {
		return bsList;
	}



	public void setBsList(ArrayList<UserInfo> bsList) {
		this.bsList = bsList;
	}



	public boolean isShowFinalizeBtn() {
		return showFinalizeBtn;
	}



	public void setShowFinalizeBtn(boolean showFinalizeBtn) {
		this.showFinalizeBtn = showFinalizeBtn;
	}



	public double getOpeningDrTotal() {
		return openingDrTotal;
	}



	public void setOpeningDrTotal(double openingDrTotal) {
		this.openingDrTotal = openingDrTotal;
	}



	public double getOpeningCrTotal() {
		return openingCrTotal;
	}



	public void setOpeningCrTotal(double openingCrTotal) {
		this.openingCrTotal = openingCrTotal;
	}



	public double getTotalDr() {
		return totalDr;
	}



	public void setTotalDr(double totalDr) {
		this.totalDr = totalDr;
	}



	public double getTotalCr() {
		return totalCr;
	}



	public void setTotalCr(double totalCr) {
		this.totalCr = totalCr;
	}



	public String getStrTotalDr() {
		return strTotalDr;
	}



	public void setStrTotalDr(String strTotalDr) {
		this.strTotalDr = strTotalDr;
	}



	public String getStrTotalCr() {
		return strTotalCr;
	}



	public void setStrTotalCr(String strTotalCr) {
		this.strTotalCr = strTotalCr;
	}



	public boolean isBooleanAccuredDeposit() {
		return booleanAccuredDeposit;
	}



	public void setBooleanAccuredDeposit(boolean booleanAccuredDeposit) {
		this.booleanAccuredDeposit = booleanAccuredDeposit;
	}



	public boolean isBooleanAccuredLoan() {
		return booleanAccuredLoan;
	}



	public void setBooleanAccuredLoan(boolean booleanAccuredLoan) {
		this.booleanAccuredLoan = booleanAccuredLoan;
	}



	




	
	
}
