package report_package;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

@ManagedBean(name="printDueNotice")
@ViewScoped
public class PrintDueNoticeBean implements Serializable
{
	String strNoticeDate, strDueDate, noticeLoanNo, noticeName, noticeAddress, noticeFHname, noticeMobile, noticeG1Name, noticeG1FHname, noticeG1Address;
	double principalOd, interestOd, totalAmountPaid, totalAmountDue, amountPaid;
	double penaltyOd;
	Date dueDate;
	SimpleDateFormat sf=new SimpleDateFormat("dd/MM/yyyy");

	
	
	public PrintDueNoticeBean() throws ParseException 
	{
		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		
		noticeName=(String) ss.getAttribute("noticeName");
		noticeFHname=(String) ss.getAttribute("noticeFHname");
		noticeMobile=(String) ss.getAttribute("noticeMobile");
		noticeAddress=(String) ss.getAttribute("noticeAddress");
		noticeLoanNo=(String) ss.getAttribute("noticeLoanNo");
		strNoticeDate=(String) ss.getAttribute("strNoticeDate");
		principalOd=(double) ss.getAttribute("principalOd");
		interestOd=(double) ss.getAttribute("interestOd");
		totalAmountPaid=(double) ss.getAttribute("totalAmountPaid");
		totalAmountDue=(double) ss.getAttribute("totalAmountDue");
		amountPaid=(double) ss.getAttribute("amountPaid");
		penaltyOd=(double) ss.getAttribute("penaltyOd");
		
		
		
		if(ss.getAttribute("noticeG1Name")!=null && ss.getAttribute("noticeG1FHname")!=null && ss.getAttribute("noticeG1Address")!=null)
		{
			noticeG1Name=(String) ss.getAttribute("noticeG1Name");
			noticeG1FHname=(String) ss.getAttribute("noticeG1FHname");
			noticeG1Address=(String) ss.getAttribute("noticeG1Address");
		}
		
		SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy");
		dueDate=f.parse(strNoticeDate);
		dueDate.setDate(dueDate.getDate()+15);
		strDueDate=sf.format(dueDate);
	}

	public String getStrNoticeDate() {
		return strNoticeDate;
	}

	public void setStrNoticeDate(String strNoticeDate) {
		this.strNoticeDate = strNoticeDate;
	}

	public double getPrincipalOd() {
		return principalOd;
	}

	public void setPrincipalOd(double principalOd) {
		this.principalOd = principalOd;
	}

	public double getInterestOd() {
		return interestOd;
	}

	public void setInterestOd(double interestOd) {
		this.interestOd = interestOd;
	}

	public double getTotalAmountPaid() {
		return totalAmountPaid;
	}

	public void setTotalAmountPaid(double totalAmountPaid) {
		this.totalAmountPaid = totalAmountPaid;
	}

	public double getTotalAmountDue() {
		return totalAmountDue;
	}

	public void setTotalAmountDue(double totalAmountDue) {
		this.totalAmountDue = totalAmountDue;
	}

	public double getAmountPaid() {
		return amountPaid;
	}

	public void setAmountPaid(double amountPaid) {
		this.amountPaid = amountPaid;
	}

	public String getNoticeLoanNo() {
		return noticeLoanNo;
	}

	public void setNoticeLoanNo(String noticeLoanNo) {
		this.noticeLoanNo = noticeLoanNo;
	}

	public String getNoticeName() {
		return noticeName;
	}

	public void setNoticeName(String noticeName) {
		this.noticeName = noticeName;
	}

	public String getNoticeAddress() {
		return noticeAddress;
	}

	public void setNoticeAddress(String noticeAddress) {
		this.noticeAddress = noticeAddress;
	}

	public String getNoticeFHname() {
		return noticeFHname;
	}

	public void setNoticeFHname(String noticeFHname) {
		this.noticeFHname = noticeFHname;
	}

	public String getNoticeMobile() {
		return noticeMobile;
	}

	public void setNoticeMobile(String noticeMobile) {
		this.noticeMobile = noticeMobile;
	}

	public String getNoticeG1Name() {
		return noticeG1Name;
	}

	public void setNoticeG1Name(String noticeG1Name) {
		this.noticeG1Name = noticeG1Name;
	}

	public String getNoticeG1FHname() {
		return noticeG1FHname;
	}

	public void setNoticeG1FHname(String noticeG1FHname) {
		this.noticeG1FHname = noticeG1FHname;
	}

	public String getNoticeG1Address() {
		return noticeG1Address;
	}

	public void setNoticeG1Address(String noticeG1Address) {
		this.noticeG1Address = noticeG1Address;
	}

	public Date getDueDate() {
		return dueDate;
	}

	public void setDueDate(Date dueDate) {
		this.dueDate = dueDate;
	}

	public String getStrDueDate() {
		return strDueDate;
	}

	public void setStrDueDate(String strDueDate) {
		this.strDueDate = strDueDate;
	}

	public double getPenaltyOd() {
		return penaltyOd;
	}

	public void setPenaltyOd(double penaltyOd) {
		this.penaltyOd = penaltyOd;
	}
	
	
}
