package com.reallinkbilling.ajax;

import java.text.DecimalFormat;

import com.opensymphony.xwork2.ActionSupport;

public class GetMakingLaborCharges extends ActionSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = 7726427536520141834L;
	
	private Float amountAfterDiscount;
	private Float makingChargeRate;
	private Float quantity;
	private String labourChargeType;
	private String makingLabourAmount;

	@Override
	public String execute() throws Exception {
		
	
		try
		{
			DecimalFormat df = new DecimalFormat("##.##");
			
			if(this.getLabourChargeType().equals("QUANTITYWISE"))
			{
				this.setMakingLabourAmount(df.format(this.getQuantity()*this.getMakingChargeRate()));
			}
			
			if(this.getLabourChargeType().equals("PERCENTAGEWISE"))
			{
				float mkAmount = 0.0F;
				
				mkAmount = this.getAmountAfterDiscount() * (this.getMakingChargeRate()/100.0F);
				this.setMakingLabourAmount(df.format(mkAmount));
			}
			
		}
		catch(Exception e)
		{
			//e.printStackTrace();
		}
		return SUCCESS;
	}


	public Float getAmountAfterDiscount() {
		return amountAfterDiscount;
	}


	public void setAmountAfterDiscount(Float amountAfterDiscount) {
		this.amountAfterDiscount = amountAfterDiscount;
	}


	public Float getMakingChargeRate() {
		return makingChargeRate;
	}


	public void setMakingChargeRate(Float makingChargeRate) {
		this.makingChargeRate = makingChargeRate;
	}


	public Float getQuantity() {
		return quantity;
	}


	public void setQuantity(Float quantity) {
		this.quantity = quantity;
	}




	public String getMakingLabourAmount() {
		return makingLabourAmount;
	}


	public void setMakingLabourAmount(String makingLabourAmount) {
		this.makingLabourAmount = makingLabourAmount;
	}


	public String getLabourChargeType() {
		return labourChargeType;
	}


	public void setLabourChargeType(String labourChargeType) {
		this.labourChargeType = labourChargeType;
	}


	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	
}
