package com.tenwa.reckon.action; import java.util.List; import jbo.app.tenwa.calc.LC_CALC_PERIOD_TEMP; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.JBOException; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.tenwa.reckon.bean.TabCalBean; import com.tenwa.reckon.help.CalcConditionCopyService; import com.tenwa.reckon.util.TbBeanTools; public class CalcAction { public String planlist; public String flowunid; public String planCName; public String planCValue; private String calType; private String quotid; public String getNextPlanDate(JBOTransaction tx) throws Exception{ TabCalBean tcb=TbBeanTools.getTabInfo(this.calType); BizObject bo=JBOFactory.createBizObjectQuery(tcb.getPeriodTb(),"flowunid=:flowunid and "+planCName+"='"+planCValue+"' and plan_list="+(Integer.parseInt(this.planlist)+1)).setParameter("flowunid", flowunid).getSingleResult(false); if(bo!=null){ return bo.getAttribute("plan_date").getString(); } return ""; } public String getUpperPlanDate(JBOTransaction tx) throws Exception{ TabCalBean tcb=TbBeanTools.getTabInfo(this.calType); BizObject bo=JBOFactory.createBizObjectQuery(tcb.getPeriodTb(),"flowunid=:flowunid and "+planCName+"='"+planCValue+"' and plan_list="+(Integer.parseInt(this.planlist)-1)).setParameter("flowunid", flowunid).getSingleResult(false); if(bo!=null){ return bo.getAttribute("plan_date").getString(); } return ""; } public String getLastPlanList(JBOTransaction tx) throws Exception{ TabCalBean tcb=TbBeanTools.getTabInfo(this.calType); List list=JBOFactory.createBizObjectQuery(tcb.getPeriodTb(),"flowunid=:flowunid and "+planCName+"='"+planCValue+"' order by plan_list").setParameter("flowunid", flowunid).getResultList(false); if(list.size()>0){ return list.get(list.size()-1).getAttribute("plan_list").getString(); } return ""; } public void copyCustomerQuotToTemp(JBOTransaction tx) throws Exception{ CalcConditionCopyService co=new CalcConditionCopyService(); co.custToTemp(flowunid, quotid, planCName, planCValue, tx); } public String getPlanlist() { return planlist; } public void setPlanlist(String planlist) { this.planlist = planlist; } public String getFlowunid() { return flowunid; } public void setFlowunid(String flowunid) { this.flowunid = flowunid; } public String getPlanCName() { return planCName; } public void setPlanCName(String planCName) { this.planCName = planCName; } public String getPlanCValue() { return planCValue; } public void setPlanCValue(String planCValue) { this.planCValue = planCValue; } public String getCalType() { return calType; } public void setCalType(String calType) { this.calType = calType; } public String getQuotid() { return quotid; } public void setQuotid(String quotid) { this.quotid = quotid; } }