/**
 *
 */
package nc.itf.hr.wa;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import nc.bs.dao.DAOException;
import nc.vo.hr.append.AppendableVO;
import nc.vo.hr.datainterface.FormatItemVO;
import nc.vo.hr.datainterface.HrIntfaceVO;
import nc.vo.hrp.budgetmgt.BudgetWarnMessageVo;
import nc.vo.pub.BusinessException;
import nc.vo.wa.classitem.WaClassItemVO;
import nc.vo.wa.paydata.AggPayDataVO;
import nc.vo.wa.paydata.DataSVO;
import nc.vo.wa.paydata.DataVO;
import nc.vo.wa.paydata.WaClassItemShowInfVO;
import nc.vo.wa.paydata.WaPaydataDspVO;
import nc.vo.wa.payfile.PayfileVO;
import nc.vo.wa.pub.WaLoginContext;
import nc.vo.wa.pub.WaLoginVO;

/**
 * 薪资发放查询
 * 
 * @author: zhangg
 * @date: 2009-11-23 下午01:19:29
 * @since: eHR V6.0
 * @走查人:
 * @走查日期:
 * @修改人:
 * @修改日期:
 */
public interface IPaydataQueryService {

	/**
	 * 得到该用户有权限的的薪资项目
	 * 
	 * @author zhangg on 2009-12-1
	 * @param loginVO
	 * @return
	 * @throws BusinessException
	 */
	public abstract WaClassItemVO[] getUserClassItemVOs(
			WaLoginContext loginContext) throws BusinessException;

	/**
	 * 得到该用户有权限的的薪资项目
	 * 
	 * @author zhangg on 2009-12-1
	 * @param loginVO
	 * @return
	 * @throws BusinessException
	 */
	public abstract WaClassItemVO[] getUserShowClassItemVOs(
			WaLoginContext loginContext) throws BusinessException;

	/**
	 * 得到该用户有权限的的薪资项目. 并且是补发期间与被补发期间都具有的项目。 如果是补发期间是补发汇总或者补发期间为空， 则选择所有的项目
	 * 
	 * @author zhangg on 2009-12-1
	 * @param loginVO
	 * @return
	 * @throws BusinessException
	 */
	public abstract WaClassItemVO[] getRepayUserShowClassItemVOs(
			WaLoginContext loginContext) throws BusinessException;

	/**
	 * 为减少连接数专门提供的方法 同时查找 薪资发放项目,薪资项目展现信息
	 * 
	 * @param loginContext
	 * @return
	 * @throws BusinessException
	 */
	public abstract WaClassItemShowInfVO getWaClassItemShowInfVO(
			WaLoginContext loginContext) throws BusinessException;

	public abstract WaClassItemShowInfVO getWaClassItemShowInfVO4PayLeave(
			WaLoginContext loginContext) throws BusinessException;

	/**
	 * 得到该设置审批的薪资项目
	 * 
	 * @author zhangg on 2009-12-1
	 * @param loginVO
	 * @return
	 * @throws BusinessException
	 */
	public abstract WaClassItemVO[] getApprovalClassItemVOs(
			WaLoginContext loginContext) throws BusinessException;

	/**
	 * 在一次查询后需要获得的数据： loginVO薪资类别（状态） classItemVOs有权限的薪资项目 dataVOs查询出的薪资数据 目的：
	 * 降低连接数
	 * 
	 * @author zhangg on 2009-12-10
	 * @param loginContext
	 * @param condition
	 * @return
	 * @throws BusinessException
	 */
	public abstract AggPayDataVO queryAggPayDataVOByCondition(
			WaLoginContext loginContext, String condition, String orderCondtion)
			throws BusinessException;

	/**
	 * 查询申请单包含的薪资数据 审批项目
	 * 
	 * @author liangxr on 2010-7-2
	 * @param loginContext
	 * @param condition
	 * @param orderCondtion
	 * @return
	 * @throws BusinessException
	 */

	public abstract AggPayDataVO queryAggPayDataVOForroll(
			WaLoginContext loginContext) throws BusinessException;

	public abstract Map<String, AggPayDataVO> queryItemAndSumDataVOForroll(
			WaLoginContext loginContext) throws BusinessException;

	/**
	 * 根据PK查询薪资数据
	 * 
	 * @author liangxr on 2010-5-24
	 * @param pk_wa_data
	 * @return
	 * @throws BusinessException
	 */
	public abstract DataVO getDataVOByPk(String pk_wa_data)
			throws BusinessException;

	/**
	 * 根据PK查询薪资数据
	 * 
	 * @author liangxr on 2010-5-24
	 * @param pk_wa_data
	 * @return
	 * @throws BusinessException
	 */
	public abstract DataVO[] queryDataVOByPks(String[] pk_wa_data)
			throws BusinessException;

	/**
	 * 根据PK查询薪资数据
	 *
	 * @author liangxr on 2010-5-24
	 * @param pk_wa_data
	 * @return
	 * @throws BusinessException
	 */
	public abstract DataVO[] queryDataVOByInsql(String insql)
			throws BusinessException;

	/**
	 * 根据context查询薪资数据
	 * 
	 * @author liangxr on 2010-5-24
	 * @param loginContext
	 * @return
	 * @throws BusinessException
	 */
	public abstract DataSVO[] getDataSVOs(WaLoginContext loginContext)
			throws BusinessException;

	/**
	 * 根据条件查询薪资数据
	 * 
	 * @author liangxr on 2010-5-24
	 * @param loginContext
	 * @param condition
	 * @param orderCondtion
	 * @return
	 * @throws BusinessException
	 */
	DataVO[] queryDataVOsByCond(WaLoginContext loginContext, String condition,
			String orderCondtion) throws BusinessException;

	
	/**
	 * 前台查询比较,下行流量较大,移至后台处理
	 * @param loginContext
	 * @param vo
	 * @param appendVOs
	 * @param itemVOs
	 * @return
	 * @throws Exception
	 */
	public abstract Map<String, AppendableVO> campareDateVOsByCond(WaLoginContext loginContext,
			HrIntfaceVO vo, AppendableVO[] appendVOs, FormatItemVO[] itemVOs)
			throws Exception;

	/**
	 * 明细对比
	 * 
	 * @author liangxr on 2010-5-24
	 * @param loginVO
	 * @param whereCondition
	 * @return
	 * @throws BusinessException
	 */
	public DataVO[] getContractDataVOs(WaLoginContext loginVO,
			String whereCondition, String orderCondition)
			throws BusinessException;

	/**
	 * 当前方案是否提交
	 * 
	 * @author liangxr on 2010-6-1
	 * @param waLoginVO
	 * @return
	 * @throws BusinessException
	 */
	boolean isPayrollSubmit(WaLoginVO waLoginVO) throws BusinessException;

	/**
	 * 当前方案是否存在自由态审批单
	 * 
	 * @author liangxr on 2010-6-1
	 * @param waLoginVO
	 * @return
	 * @throws BusinessException
	 */
	boolean isPayrollFree(WaLoginVO waLoginVO) throws BusinessException;

	/**
	 * 计算当前选中没有的审核人员数据
	 * 
	 * @author liangxr on 2010-7-12
	 * @param cacuItem
	 * @param whereStr
	 * @return
	 * @throws BusinessException
	 */
	public BigDecimal getOrgTmSelected(String cacuItem, String whereStr)
			throws BusinessException;

	/**
	 * 计算当前选中没有的审核人员数据
	 * 
	 * @author liangxr on 2010-7-12
	 * @param cacuItem
	 * @param whereStr
	 * @return
	 * @throws BusinessException
	 */
	public Map<String, BigDecimal> getDeptTmSelected(String cacuItem,
			String whereStr) throws BusinessException;

	/**
	 * 按组织计算工资总额
	 * 
	 * @author liangxr on 2010-7-12
	 * @param cacuItem
	 * @param pk_org
	 * @param accYear
	 * @param pk_wa_class
	 * @return
	 * @throws SQLException
	 */
	public BigDecimal getOrgTm(String cacuItem, String pk_org, String accYear,
			String accPeriod, String pk_wa_class, int sumType)
			throws BusinessException;

	/**
	 * 按部门计算工资总额
	 * 
	 * @author liangxr on 2010-7-12
	 * @param cacuItem
	 * @param pk_org
	 * @param accYear
	 * @param accPeriod
	 * @param gzlbId
	 * @return
	 * @throws DAOException
	 */
	public Map<String, BigDecimal> getDeptTm(String cacuItem, String pk_org,
			String accYear, String accPeriod, String gzlbId, int sumType)
			throws BusinessException;

	/**
	 * 薪资总额预警查询接口
	 * 
	 * @author liangxr on 2010-7-23
	 * @param context
	 * @param whereStr
	 * @return
	 * @throws nc.vo.pub.BusinessException
	 */
	public BudgetWarnMessageVo budgetAlarm4Pay(WaLoginContext context,
			String whereStr) throws nc.vo.pub.BusinessException;

	/**
	 * 查找薪资档案的显示设置
	 * 
	 * @param context
	 * @return
	 * @throws BusinessException
	 */
	public List<WaPaydataDspVO> queryPaydataDisplayInfo(WaLoginContext context)
			throws BusinessException;

	/**
	 * 查找离职结薪的显示设置
	 * 
	 * @param context
	 * @return
	 * @throws BusinessException
	 */
	public List<WaPaydataDspVO> queryPaydataDisplayInfo4Payleave(
			WaLoginContext context) throws BusinessException;

	/**
	 * 取消审核时校验离职发薪
	 * 
	 * @param waLoginVO
	 * @param whereCondition
	 * @param isRangeAll
	 * @return
	 * @throws DAOException
	 */
	public PayfileVO[] getInPayLeavePsn(WaLoginVO waLoginVO,
			String whereCondition, boolean isRangeAll) throws BusinessException;

	/**
	 * 判断一个方案（无论是单次还是多次，还是多次中的一次）是否已经发放过（一次）
	 * 
	 * @param pk_wa_data
	 * @return
	 * @throws BusinessException
	 */
	public boolean isAnyTimesPayed(String pk_wa_class, String cyear,
			String cperiod) throws BusinessException;

}
