
package com.kingdee.eas.custom.projectbonus.web;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import org.operamasks.faces.annotation.Inject;
import org.operamasks.faces.annotation.ManagedBean;
import org.operamasks.faces.annotation.ManagedBeanScope;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.MetaDataPK;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.bos.waf.annotation.IBOSBizCtrl;
import com.kingdee.bos.waf.util.OperateState;
import com.kingdee.bos.waf.winlet.edit.EditBean;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.framework.ICoreBase;
import org.operamasks.faces.annotation.Accessible;
import org.operamasks.faces.component.form.impl.*;
import com.kingdee.bos.waf.action.AbstractWebAction;
import javax.faces.event.AbortProcessingException;
import javax.faces.context.FacesContext;
import org.operamasks.faces.component.action.ActionEvent;
import org.operamasks.faces.annotation.Action;
import com.kingdee.bos.waf.winlet.BaseBean;
import com.kingdee.bos.metadata.entity.SelectorItemInfo;

import com.kingdee.eas.custom.projectbonus.IBonusCycle;
import com.kingdee.eas.custom.projectbonus.BonusCycleInfo;
import com.kingdee.eas.custom.projectbonus.BonusCycleBusDepProjectInfo;
import com.kingdee.eas.custom.projectbonus.BonusCycleBusDepProjectCollection;

public abstract class AbstractBonusCycleEditUIBean extends com.kingdee.bos.waf.winlet.edit.EditBean {

	@IBOSBizCtrl
	protected com.kingdee.eas.custom.projectbonus.IBonusCycle service;

	@Inject("custom.projectbonus.BonusCycleBusDepProjectBean")
	protected BonusCycleBusDepProjectBean bonusCycleBusDepProjectBean;
	public AbstractBonusCycleEditUIBean() {
		super();
	}

	
	
	@Override
	public void createNewModel() {
		model = new BonusCycleInfo();
	}

	@Override
	public void pageOnload() {
		super.pageOnload();
		
		BonusCycleBusDepProjectCollection entryCol_0 = ((BonusCycleInfo) model).getBusDepProject();

		List<CoreBaseInfo> listModel_0 = new LinkedList<CoreBaseInfo>();
		if (entryCol_0 != null)
		{
			for (int i = 0, n = entryCol_0.size(); i < n; i++) {
				listModel_0.add(entryCol_0.get(i));
			}
	
			bonusCycleBusDepProjectBean.setListModel(listModel_0);
		}

		
	}

	@Override
	public void saveModel() {
		updateModel();
		super.saveModel();
	}

	@Override
	public void submitModel() {
		updateModel();
		super.submitModel();
	}


	protected void updateModel() {
		
		if (bonusCycleBusDepProjectBean == null)
			bonusCycleBusDepProjectBean = (BonusCycleBusDepProjectBean) com.kingdee.bos.waf.util.BeanUtil
					.getBean("custom.projectbonus.BonusCycleBusDepProjectBean");

		bonusCycleBusDepProjectBean.updataModel();
		List<CoreBaseInfo> entryModel_0 = bonusCycleBusDepProjectBean.getListModel();
		((BonusCycleInfo) model).getBusDepProject().clear();
		if (entryModel_0 != null) {
			for (CoreBaseInfo entryInfo : entryModel_0) {
				((BonusCycleInfo) model).getBusDepProject().add(
						(BonusCycleBusDepProjectInfo) entryInfo);
			}
		}

	}
	
	
	//entry
	public void bonusCycleBusDepProjectBean_apendRow(){
		bonusCycleBusDepProjectBean.appendRow();
	}
	public void bonusCycleBusDepProjectBean_removeRow(){
		bonusCycleBusDepProjectBean.removeRow();
	}
		

	@Override
	protected ICoreBase getBizInterface() {
		return service;
	}
	
	@Override
	public IMetaDataPK getMetaDataPK() {
		return new MetaDataPK("com.kingdee.eas.custom.projectbonus.web.BonusCycleEditUI");
	}
	
	@Override
	protected String getEntryPKName() {
	
		return "BusDepProject.id";
	
	}

	@Override
	public SelectorItemCollection getSelectors() {
		SelectorItemCollection sic = super.getSelectors();
        sic.add(new SelectorItemInfo("BusDepProject.id"));
        sic.add(new SelectorItemInfo("BusDepProject.seq"));
        sic.add(new SelectorItemInfo("BusDepProject.principal.*"));
        sic.add(new SelectorItemInfo("BusDepProject.notPrincipalPropor"));
        sic.add(new SelectorItemInfo("BusDepProject.principalPropor"));
        sic.add(new SelectorItemInfo("BusDepProject.bonusAmount"));
        sic.add(new SelectorItemInfo("BusDepProject.totalBonusHalf"));
        sic.add(new SelectorItemInfo("BusDepProject.totalBonusReal"));
        sic.add(new SelectorItemInfo("BusDepProject.directManProjBonus"));
        sic.add(new SelectorItemInfo("BusDepProject.contraManProjBonus"));
        sic.add(new SelectorItemInfo("BusDepProject.condManProjectBonus"));
        sic.add(new SelectorItemInfo("BusDepProject.straManProjectBonus"));
        sic.add(new SelectorItemInfo("BusDepProject.bonusAdjustment"));
        sic.add(new SelectorItemInfo("BusDepProject.bonusAdjustmentDesc"));
        sic.add(new SelectorItemInfo("BusDepProject.initialAllocationRatio1"));
        sic.add(new SelectorItemInfo("BusDepProject.initialAllocationRatio2"));
        sic.add(new SelectorItemInfo("BusDepProject.initialAllocationRatio3"));
        sic.add(new SelectorItemInfo("BusDepProject.busDep.*"));
        sic.add(new SelectorItemInfo("BusDepProject.type"));
        sic.add(new SelectorItemInfo("BusDepProject.project.*"));
        sic.add(new SelectorItemInfo("BusDepProject.state"));
        sic.add(new SelectorItemInfo("BusDepProject.secondcenter.*"));
        sic.add(new SelectorItemInfo("BusDepProject.projectPrincipal.*"));
        sic.add(new SelectorItemInfo("number"));
        sic.add(new SelectorItemInfo("bizDate"));
        sic.add(new SelectorItemInfo("handler.*"));
        sic.add(new SelectorItemInfo("description"));
        sic.add(new SelectorItemInfo("auditor.*"));
        sic.add(new SelectorItemInfo("cycleName"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.id"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.seq"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.person.*"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.position.*"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.indivBonusAmount"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.bonusProportion"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.attendanceRate"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.functionCoefficient"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.energyInputCoeff"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.grade.*"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.rankCoefficient"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.performanceGradeQ1"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.performanceGradeQ2"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.performanceCoeffQ1"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.performanceCoeffQ2"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.assessmentCoeff"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.cumulative"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.remarks"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.bonusDueDate"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.bonusStartingDate"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.initialProportion"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.bonusSubcontract"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.approvalAmount"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.adjustmentDesc"));
        sic.add(new SelectorItemInfo("BusDepProject.AssPersonnelDetail.opinionAmount"));
        sic.add(new SelectorItemInfo("state"));
        sic.add(new SelectorItemInfo("name"));
        sic.add(new SelectorItemInfo("reminderContent"));
	
		return sic;
	}			
    	protected String getTDTemplateName() {
	    	return "/bim/custom/projectbonus/BonusCycle";
		}
	    protected com.kingdee.bos.metadata.IMetaDataPK getTDQueryPK() {
	    	return new com.kingdee.bos.metadata.MetaDataPK("com.kingdee.eas.custom.projectbonus.app.BonusCycleQuery");
	    }

}
