//package main_package;
//
//import group_head_package.DataBaseIncomeExpense;
//
//import java.sql.Connection;
//import java.sql.ResultSet;
//import java.sql.Statement;
//import java.text.ParseException;
//import java.text.SimpleDateFormat;
//import java.util.ArrayList;
//import java.util.Date;
//
//import javax.faces.model.SelectItem;
//
//public class MyTest 
//{
//	static ArrayList<MyTestInfo> list;
//	
//	public static void main(String[] args) throws ParseException 
//	{
//		
//		ArrayList<MyTestInfo> fileChargeList=new ArrayList<>();
//		ArrayList<SelectItem> loanTypeList=new ArrayList<>();
//		HeaderBean hh=new HeaderBean();
//		loanTypeList=hh.getLoanTypeList();
//		Connection conn=DataBaseConnection.JAVAConnection();
//		//for File Charge and Insurance Fees
//		try
//		{
//			for(SelectItem tt: loanTypeList)
//			{
//				String qq="";
//				Statement st=conn.createStatement();
//				if(tt.getValue().equals("grouploan"))
//				{
//					qq="select filecharge,requestDate,sub_loan_no,insurance_fee from "+tt.getValue()+" ";
//				}
//				else
//				{
//					qq="select filecharge,requestDate,loanNo,insurance_fee from "+tt.getValue()+" ";
//				}
//				ResultSet rr=st.executeQuery(selectQueWithBranch(qq,branchId));
//				while(rr.next())
//				{
//					MyTestInfo ll=new MyTestInfo();
//					
//					ll.setFileCharge(rr.getDouble("filecharge"));
//					if(tt.getValue().equals("grouploan"))
//					{
//						ll.setLoanNo(rr.getString("sub_loan_no"));
//					}
//					else
//					{
//						ll.setLoanNo(rr.getString("loanNo"));
//					}
//					ll.setInsuranceFee(rr.getDouble("insurance_fee"));
//					ll.setEntryDate(rr.getDate("requestDate"));
//					ll.setLoanType(tt.getLabel());
//					
//					fileChargeList.add(ll);
//				}
//			}
//		}
//		catch(Exception e)
//		{
//			e.printStackTrace();
//		}
//		
//		//File Charge
//		for(MyTestInfo ii: fileChargeList)
//		{
//			if(ii.getFileCharge()>0)
//			{
//				String voucherNo=new DataBaseMethods().generateVoucherNo("income_table",conn);
//				new DataBaseIncomeExpense().addIncome(ii.getEntryDate(),"Other_Cr","cash",String.valueOf(ii.getFileCharge()),"","",
//						"",null,"File Charge Receive","File Charge",0,"N/A",
//						"0",0,ii.getLoanNo(),ii.getLoanType(), voucherNo,"",0,"active"); 
//			}
//		}
//		
//		//Insurance fees
//		for(MyTestInfo ii: fileChargeList)
//		{
//			if(ii.getInsuranceFee()>0)
//			{
//				String voucherNo=new DataBaseMethods().generateVoucherNo("income_table",conn);
//				new DataBaseIncomeExpense().addIncome(ii.getEntryDate(),"Other_Cr","cash",String.valueOf(ii.getInsuranceFee()),"","",
//						"",null,"Insurance Fee Receive","Insurance Fee",0,"N/A",
//						"0",0,ii.getLoanNo(),ii.getLoanType(), voucherNo,"",0,"active"); 
//			}
//		}
//		
//		///EMI NO. Set Method Due to Bulk Payment
//		/*list=new ArrayList<>();
//		try(Connection conn=DataBaseConnection.JAVAConnection())
//		{
//			Statement st=conn.createStatement();
//			String qq="select * from loanpayment where receipt_status='approved' order by loanNo, pay_date ";
//			ResultSet rr=st.executeQuery(selectQueWithBranch(qq,branchId));
//			while(rr.next())
//			{
//				UserInfo uu=new UserInfo();
//				
//				uu.setId(rr.getString("id"));
//				uu.setLoanNo(rr.getString("loanNo"));
//				
//				list.add(uu);
//			}
//		}
//		catch(Exception e)
//		{
//			e.printStackTrace();
//		}
//		
//		boolean chk=true;
//		int i=1;
//		String lno="";
//		System.out.println("list size: "+list.size());
//		for(UserInfo tt: list)
//		{
//			if(chk==true)
//			{
//				lno=tt.getLoanNo();
//				i=1;
//				chk=false;
//			}
//			
//			if(lno.equals(tt.getLoanNo()))
//			{
//				try(Connection conn=DataBaseConnection.JAVAConnection())
//				{
//					Statement st=conn.createStatement();
//					String qq="update loanpayment set emi_no='"+i+"' where id='"+tt.getId()+"'  ";
//					System.out.println(qq);
//					int k=st.executeUpdate(qq);
//					if(k>0)
//					{
//						i=i+1;
//					}
//				}
//				catch(Exception e)
//				{
//					e.printStackTrace();
//				}
//			}
//			else
//			{
//				lno=tt.getLoanNo();
//				i=1;
//				try(Connection conn=DataBaseConnection.JAVAConnection())
//				{
//					Statement st=conn.createStatement();
//					String qq="update loanpayment set emi_no='"+i+"' where id='"+tt.getId()+"'  ";
//					System.out.println(qq);
//					int k=st.executeUpdate(qq);
//					if(k>0)
//					{
//						i=i+1;
//					}
//				}
//				catch(Exception e)
//				{
//					e.printStackTrace();
//				}
//			}
//		}*/
//		
//		/*Date startDate, endDate;
//		
//		String sDate="01-04-2015";
//		String eDate="31-03-2016";
//		
//		SimpleDateFormat f = new SimpleDateFormat("dd-MM-yyyy");
//		startDate=f.parse(sDate);
//		endDate=f.parse(eDate);
//		
//		System.out.println(startDate+" == "+endDate);*/
//	}
//	
//	
//	
//	
//}
