package main_package;

import java.io.Serializable;
import java.sql.Connection;
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="recoveryNoticeBean")
@ViewScoped
   
public class RecoveryNoticeBean implements Serializable
{   
	private static final long serialVersionUID = 1L;
	
	String name,companyName,empName;
	
	String designation,branchName,department,address,lastWorkingDate;
	
	String adminSign,mobileNo,emailId;
	
	String noticeDate= new SimpleDateFormat("dd-MM-yyyy").format(new Date());
	
	
	double totalAmountforNotice, noticdPeriodShortFallAmount, companyPropertyAmount, salaryOverPaymentAmount, totalAmountDue;
	
	
	EmpInfo selected;
	
	BankInfo bi = new BankInfo();
	
	
	DataBaseMethods obj=new DataBaseMethods();
	
	DataBaseMethodTaheer dbmt = new DataBaseMethodTaheer();
    
    
	
	public RecoveryNoticeBean()
	{   
		Connection conn=DataBaseConnection.JAVAConnection();
		HttpSession ss=(HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
		selected=(EmpInfo) ss.getAttribute("selectedRow");
		companyName=(String) ss.getAttribute("companyName");
		totalAmountforNotice =(double) ss.getAttribute("totalAmountForNotice");
		System.out.println(totalAmountforNotice);
		noticdPeriodShortFallAmount= (double) ss.getAttribute("noticdPeriodShortFallAmount");
		companyPropertyAmount= (double) ss.getAttribute("companyPropertyAmount");
		salaryOverPaymentAmount= (double) ss.getAttribute("salaryOverPaymentAmount");
		
	   adminSign=	(String) ss.getAttribute("adminSign");
		 branchName = obj.branchNameByBranchId(selected.getBranchId(), conn);
	      mobileNo= selected.getMobile();
	      System.out.println("mobile no is:"+mobileNo);
	     emailId= selected.getEmailId();
		 designation  = selected.getDesignation();
		 department= selected.getDepartment();
		 empName= selected.getName();
		 address = selected.getAddress();
         lastWorkingDate= (String) ss.getAttribute("lastWorkingDays");	
         System.out.println("lastWorkingDate"+lastWorkingDate);
         
         totalAmountDue = noticdPeriodShortFallAmount + companyPropertyAmount + salaryOverPaymentAmount;
         
         bi = dbmt.fetchBankInfo();
         
	}



	public EmpInfo getSelected() {
		return selected;
	}



	public void setSelected(EmpInfo selected) {
		this.selected = selected;
	}



	public String getName() {
		return name;
	}



	public void setName(String name) {
		this.name = name;
	}



	public String getCompanyName() {
		return companyName;
	}



	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}



	public String getEmpName() {
		return empName;
	}



	public void setEmpName(String empName) {
		this.empName = empName;
	}



	public String getDesignation() {
		return designation;
	}



	public void setDesignation(String designation) {
		this.designation = designation;
	}



	public String getBranchName() {
		return branchName;
	}



	public void setBranchName(String branchName) {
		this.branchName = branchName;
	}



	public String getDepartment() {
		return department;
	}



	public void setDepartment(String department) {
		this.department = department;
	}
    
	public DataBaseMethods getObj() {
		return obj;
	}
    
	public void setObj(DataBaseMethods obj) {
		this.obj = obj;
	}



	public static long getSerialversionuid() {
		return serialVersionUID;
	}



	public String getAddress() {
		return address;
	}



	public void setAddress(String address) {
		this.address = address;
	}



	public String getNoticeDate() {
		return noticeDate;
	}



	public void setNoticeDate(String noticeDate) {
		this.noticeDate = noticeDate;
	}



	public String getLastWorkingDate() {
		return lastWorkingDate;
	}



	public void setLastWorkingDate(String lastWorkingDate) {
		this.lastWorkingDate = lastWorkingDate;
	}



	public double getTotalAmountforNotice() {
		return totalAmountforNotice;
	}



	public void setTotalAmountforNotice(double totalAmountforNotice) {
		this.totalAmountforNotice = totalAmountforNotice;
	}



	public double getNoticdPeriodShortFallAmount() {
		return noticdPeriodShortFallAmount;
	}



	public void setNoticdPeriodShortFallAmount(double noticdPeriodShortFallAmount) {
		this.noticdPeriodShortFallAmount = noticdPeriodShortFallAmount;
	}



	public double getCompanyPropertyAmount() {
		return companyPropertyAmount;
	}



	public void setCompanyPropertyAmount(double companyPropertyAmount) {
		this.companyPropertyAmount = companyPropertyAmount;
	}



	public double getSalaryOverPaymentAmount() {
		return salaryOverPaymentAmount;
	}



	public void setSalaryOverPaymentAmount(double salaryOverPaymentAmount) {
		this.salaryOverPaymentAmount = salaryOverPaymentAmount;
	}



	public String getAdminSign() {
		return adminSign;
	}



	public void setAdminSign(String adminSign) {
		this.adminSign = adminSign;
	}



	public String getMobileNo() {
		return mobileNo;
	}



	public void setMobileNo(String mobileNo) {
		this.mobileNo = mobileNo;
	}



	public String getEmailId() {
		return emailId;
	}



	public void setEmailId(String emailId) {
		this.emailId = emailId;
	}



	public double getTotalAmountDue() {
		return totalAmountDue;
	}



	public void setTotalAmountDue(double totalAmountDue) {
		this.totalAmountDue = totalAmountDue;
	}



	public BankInfo getBi() {
		return bi;
	}



	public void setBi(BankInfo bi) {
		this.bi = bi;
	}

}