public void addCMPBill(HYBillVO billvo, String tally_corp, String tallyman, UFDate tallydate) throws BusinessException { if (!isTogatherWithCMP(tally_corp)) { return; } RegisterVO headvo = (RegisterVO) billvo.getParentVO(); if (headvo.getSfflag().booleanValue()) { // 如果已付票则不记票据账 return; } SettlementBodyVO[] rvo = new SettlementBodyVO[1]; initSettlementBodyVO(rvo, headvo); CommonDAO commonDAO = new CommonDAO(); BaseinfoVO baseVO = commonDAO.queryBaseinfoByPK(headvo.getPk_baseinfo()); rvo[0].setPk_corp(tally_corp); rvo[0].setPk_currtype(baseVO.getPk_curr()); rvo[0].setTallydate(headvo.getInvoicedate()); rvo[0].setSigndate(headvo.getInvoicedate()); rvo[0].setFundformcode(CmpConst.BILL_DEPOSIT); rvo[0].setBilldate(headvo.getInvoicedate()); rvo[0].setReceive(baseVO.getMoneyy()); rvo[0].setFundsflag(CmpConst.CASH_FLOW_IN); rvo[0].setDirection(CmpConst.Direction_Receive); rvo[0].setPk_notetype(baseVO.getFbmbilltype()); // suzhzh 201106171021595038 回写票据号 rvo[0].setNotenumber(baseVO.getFbmbillno()); // add by ouyangzhb 2011-06-24 回写票据类型 rvo[0].setPk_notetype(baseVO.getFbmbilltype()); rvo[0].setTradertype(CmpConst.TradeObjType_Bank); rvo[0].setPk_trader(baseVO.getPaybank()); buildOppInfo(rvo[0]); rvo[0].setMemo(headvo.getNote()); rvo[0].setFracrate(headvo.getFrate()); // 辅币汇率 rvo[0].setLocalrate(headvo.getBrate()); // 本币汇率 fillCurrKeyValue(rvo[0]); getBankTallyService().writeBankacc(rvo); }
// 根据清算单自动生成清算回单 private void insertReckonReceipt(PfParameterVO vo) throws UifException, BusinessException { HYBillVO reckonreceiptvo = new HYBillVO(); AggregatedValueObject billvo = vo.m_preValueVo; reckonreceiptvo.setParentVO((CircularlyAccessibleValueObject) billvo.getParentVO().clone()); ((ReckonVO) reckonreceiptvo.getParentVO()) .setPk_billtypecode(FbmBusConstant.BILLTYPE_RECKON_RECIEPT); ((ReckonVO) reckonreceiptvo.getParentVO()).setPk_reckon(null); CommonDAO commdao = new CommonDAO(); String pkcorp = commdao.queryCorpByCust(((ReckonVO) reckonreceiptvo.getParentVO()).getReckonunit()); String billcode = ((IUifService) NCLocator.getInstance().lookup(IUifService.class.getName())) .getBillNo(FbmBusConstant.BILLTYPE_RECKON_RECIEPT, pkcorp, null, null); ((ReckonVO) reckonreceiptvo.getParentVO()).setVbillno(billcode); ((ReckonVO) reckonreceiptvo.getParentVO()).setPk_corp(pkcorp); ((ReckonVO) reckonreceiptvo.getParentVO()).setVoperatorid(vo.m_operator); ((ReckonVO) reckonreceiptvo.getParentVO()) .setDoperatedate(new UFDate(vo.m_currentDate.substring(0, 10))); ((ReckonVO) reckonreceiptvo.getParentVO()) .setDef1(((ReckonVO) (billvo.getParentVO())).getPk_reckon()); ((ReckonVO) reckonreceiptvo.getParentVO()).setVouchermanid(null); ((ReckonVO) reckonreceiptvo.getParentVO()).setVoucherdate(null); ((ReckonVO) reckonreceiptvo.getParentVO()).setUnitvoucherdate(null); ((ReckonVO) reckonreceiptvo.getParentVO()).setUnitvouchermanid(null); ((ReckonVO) reckonreceiptvo.getParentVO()).setUnittally(new UFBoolean(false)); ((ReckonVO) reckonreceiptvo.getParentVO()).setUnitvoucher(new UFBoolean(false)); ((ReckonVO) reckonreceiptvo.getParentVO()).setCentervoucher(new UFBoolean(false)); ReckonBVO[] childvos = (ReckonBVO[]) billvo.getChildrenVO(); ReckonBVO[] childreceiptvos = new ReckonBVO[childvos.length]; for (int i = 0; i < childvos.length; i++) { childreceiptvos[i] = (ReckonBVO) childvos[i].clone(); childreceiptvos[i].setPk_reckon(null); childreceiptvos[i].setPk_reckon_b(null); } reckonreceiptvo.setChildrenVO(childreceiptvos); HYPubBO hypubbo = new HYPubBO(); hypubbo.saveBill(reckonreceiptvo); }
@Override public void dealAccount(String pk_action, BusiActionParamVO<T> param) throws BusinessException { // TODO Auto-generated method stub CommonDAO dao = new CommonDAO(); dao.delAccountDetailByActionPK(pk_action); }
/** * 将收付款单据VO转换为票据处理的参数对象 * * @param param * @return */ public static ArapBillParamVO buildBillParam( SettlementAggVO param, SettlementBodyVO item, int row) throws BusinessException { SettlementHeadVO vo = (SettlementHeadVO) param.getParentVO(); ArapBillParamVO arapParam = new ArapBillParamVO(); String djdl = vo.getDef11(); // 取得前面getClass中放置的单据大类,临时存储 String djlxbm = vo.getPk_tradetype(); // 具体的单据小类 arapParam = new ArapBillParamVO(); if (item.getNotenumber() != null) { arapParam.setFbmbillno(item.getNotenumber().trim()); } arapParam.setPk_curr(item.getPk_currtype()); arapParam.setDjrq(vo.getBusi_billdate()); // 业务单据日期 arapParam.setMemo(item.getMemo()); // 摘要 // 金额合并处理 Map<String, UFDouble> mapMoneyy = null; Map<String, UFDouble> mapMoneyf = null; Map<String, UFDouble> mapMoneyb = null; mapMoneyy = sumMoney((SettlementBodyVO[]) param.getChildrenVO(), djdl, YB); mapMoneyf = sumMoney((SettlementBodyVO[]) param.getChildrenVO(), djdl, FB); mapMoneyb = sumMoney((SettlementBodyVO[]) param.getChildrenVO(), djdl, BB); arapParam.setMoneyy(mapMoneyy.get(arapParam.getFbmbillno())); arapParam.setMoneyf(mapMoneyf.get(arapParam.getFbmbillno())); arapParam.setMoneyb(mapMoneyb.get(arapParam.getFbmbillno())); arapParam.setFrate(item.getFracrate()); // 辅币汇率 arapParam.setBrate(item.getLocalrate()); // 本币汇率 arapParam.setPk_bill_h(vo.getPrimaryKey()); arapParam.setPk_bill_b(item.getPrimaryKey()); arapParam.setOuterbilltype(djlxbm); // 单据类型编码 arapParam.setOuterdjdl(djdl); // 设置单据大类 arapParam.setRow(row + 1); // arapParam.setSkbankacc(item.getSkyhzh());// 收款银行账号 // arapParam.setFkbankacc(item.getFkyhzh());// 付款银行账号 arapParam.setVoperator(vo.getPk_billoperator()); // 录入人 arapParam.setDoperatdate(vo.getBusi_billdate()); // 录入日期,取单据日期 arapParam.setVeffector(vo.getPk_signer()); // 生效人,取确认人(签字人) arapParam.setDeffectdate(vo.getSigndate()); // 生效日期 arapParam.setPk_plansubj(item.getPk_plansubj()); String pk_corp = vo.getPk_corp(); CommonDAO dao = new CommonDAO(); String pk_cust = dao.queryCustByCorp(pk_corp); if (pk_cust == null) { throw new BusinessException( nc.vo.ml.NCLangRes4VoTransl.getNCLangRes() .getStrByID("fbmcomm", "UPPFBMComm-000224") /* @res"公司未对应客商" */); } arapParam.setCurrentunit(pk_cust); // 本方单位,取公司对应客商 arapParam.setTradertype(item.getTradertype()); // 对方类型 if (item.getTradertype() != 0) { throw new BusinessException( nc.vo.ml.NCLangRes4VoTransl.getNCLangRes() .getStrByID("fbmcode112", "UPPFBMCODE112-000037") /*@res "使用票据进行结算往来对象必须是客商"*/); } arapParam.setOtherunit(item.getPk_trader()); // 对方单位,取伙伴编码 arapParam.setPk_corp(pk_corp); // 查询票据基本信息VO if (arapParam.getFbmbillno() != null && arapParam.getFbmbillno().length() > 0) { BaseInfoBO baseBO = new BaseInfoBO(); arapParam.setBaseinfoVO(baseBO.queryByFbmbillno(arapParam.getFbmbillno())); // 查询票据最新动作VO ActionQueryDAO actionDao = new ActionQueryDAO(); arapParam.setNewActionVO(actionDao.queryNewestByFbmBillno(arapParam.getFbmbillno(), pk_corp)); if (arapParam.getPk_busbill() == null) { arapParam.setPk_busbill(arapParam.getNewActionVO().getPk_source()); } // 查询当前单据关联 OuterRelationDAO relDao = new OuterRelationDAO(); arapParam.setOuterVO(relDao.queryBypk_b(item.getPrimaryKey())); } return arapParam; }
/** * 核销减少票据账 * * @param billvo * @param tally_corp * @param tallyman * @param tallydate * @throws BusinessException */ public void addCMPBill4Destory( HYBillVO billvo, String tally_corp, String tallyman, UFDate tallydate) throws BusinessException { if (!isTogatherWithCMP(tally_corp)) { return; } RegisterVO headvo = (RegisterVO) billvo.getParentVO(); // 付票退票核销 ActionQueryDAO actionDAO = new ActionQueryDAO(); ActionVO newActionVO = actionDAO.queryNewestByPk_baseinfo(headvo.getPk_baseinfo(), headvo.getPk_corp()); if (newActionVO.getActioncode().equals(FbmActionConstant.AUDIT) && newActionVO.getBilltype().equals(FbmBusConstant.BILLTYPE_RETURN)) { // 如果没有在fbm_outer表里,说明付票没有走收付报,而是直接已付票打勾,返回 SuperVO[] outers = FBMProxy.getUifService() .queryByCondition( OuterVO.class, "isnull(dr,0)=0 and pk_billtypecode='36GL' and pk_busibill='" + headvo.getPrimaryKey() + "'"); if (outers == null || outers.length == 0) { return; } } else if (newActionVO.getActioncode().equals(FbmActionConstant.AUDIT) && newActionVO.getBilltype().equals(FbmBusConstant.BILLTYPE_GATHER)) { SuperVO[] outers = FBMProxy.getUifService() .queryByCondition( OuterVO.class, "isnull(dr,0)=0 and pk_billtypecode='36GA' and pk_busibill='" + newActionVO.getPk_source() + "'"); if (outers == null || outers.length == 0) { return; } } SettlementBodyVO[] rvo = new SettlementBodyVO[1]; initSettlementBodyVO(rvo, headvo); CommonDAO commonDAO = new CommonDAO(); BaseinfoVO baseVO = commonDAO.queryBaseinfoByPK(headvo.getPk_baseinfo()); rvo[0].setPk_corp(tally_corp); rvo[0].setPk_currtype(baseVO.getPk_curr()); rvo[0].setTallydate(tallydate); rvo[0].setSigndate(tallydate); rvo[0].setFundformcode(CmpConst.BILL_DEPOSIT); rvo[0].setBilldate(tallydate); rvo[0].setPay(baseVO.getMoneyy()); rvo[0].setFundsflag(CmpConst.CASH_FLOW_OUT); rvo[0].setDirection(CmpConst.Direction_Pay); rvo[0].setPk_notetype(baseVO.getFbmbilltype()); // suzhzh 201106171021595038 回写票据号 rvo[0].setNotenumber(baseVO.getFbmbillno()); // add by ouyangzhb 2011-06-24 回写票据类型 rvo[0].setPk_notetype(baseVO.getFbmbilltype()); rvo[0].setTradertype(CmpConst.TradeObjType_KeShang); // 对方为客商 rvo[0].setPk_trader(baseVO.getReceiveunit()); rvo[0].setPk_oppaccount(baseVO.getReceivebankacc()); buildOppInfo(rvo[0]); rvo[0].setMemo( nc.vo.ml.NCLangRes4VoTransl.getNCLangRes() .getStrByID("36201505", "UPP36201505-000006") /* @res"核销付票登记单开票业务"*/); rvo[0].setFracrate(headvo.getFrate()); // 辅币汇率 rvo[0].setLocalrate(headvo.getBrate()); // 本币汇率 fillCurrKeyValue(rvo[0]); getBankTallyService().writeBankacc(rvo); }
public void addCMPBank(HYBillVO billvo, String tally_corp, String tallyman, UFDate tallydate) throws BusinessException { if (!isTogatherWithCMP(tally_corp)) { return; } RegisterVO vo = (RegisterVO) billvo.getParentVO(); List<SettlementBodyVO> retList = new ArrayList<SettlementBodyVO>(); CommonDAO commonDAO = new CommonDAO(); BaseinfoVO baseVO = commonDAO.queryBaseinfoByPK(vo.getPk_baseinfo()); SettlementBodyVO rvo = new SettlementBodyVO(); rvo.setPk_corp(tally_corp); // 公司 rvo.setSystemcode(ProductInfo.pro_FBM); // 来源系统 rvo.setPk_bill(vo.getPrimaryKey()); // 业务单据主键 rvo.setBillcode(vo.getVbillno()); // 单据编号 rvo.setBilldate(vo.getInvoicedate()); // 业务日期取实际放款日期 rvo.setTallystatus(new Integer(CMPaccStatus.SUCCESSACCOUNT.getStatus())); // 记账状态,设置为结算成功日期 rvo.setTallydate(vo.getInvoicedate()); rvo.setSigndate(vo.getInvoicedate()); rvo.setFundformcode(CmpConst.BANK_DEPOSIT); // 银行存款 String selfAcc = baseVO.getPaybankacc(); UFDouble securitymoney = vo.getSecuritymoney() == null ? new UFDouble(0) : vo.getSecuritymoney(); rvo.setPay(vo.getPoundagemoney().add(securitymoney)); UFDouble securitymoneyf = vo.getSecuritymoneyf() == null ? new UFDouble(0) : vo.getSecuritymoneyf(); rvo.setPayfrac(vo.getPoundagemoneyf().add(securitymoneyf)); UFDouble securitymoneyb = vo.getSecuritymoneyb() == null ? new UFDouble(0) : vo.getSecuritymoneyb(); rvo.setPaylocal(vo.getPoundagemoneyb().add(securitymoneyb)); // rvo.setFundsflag(CmpConst.CASH_FLOW_OUT); // 资金流向(0 资金流入1 资金流出2 转账出) rvo.setDirection( CmpConst.Direction_Pay); // CmpConst.Direction_Receive=0收款;CmpConst.Direction_Receive=1付款; rvo.setPk_account(selfAcc); // 本方帐 rvo.setPk_currtype(baseVO.getPk_curr()); // 币种 rvo.setFracrate(vo.getFrate()); // 辅币汇率 rvo.setLocalrate(vo.getBrate()); // 本币汇率 rvo.setTradertype(CmpConst.TradeObjType_Bank); // 对方类型为银行 rvo.setPk_trader(baseVO.getPaybank()); // suzhzh 201106171021595038 回写票据号 rvo.setNotenumber(baseVO.getFbmbillno()); // add by ouyangzhb 2011-06-24 回写票据类型 rvo.setPk_notetype(baseVO.getFbmbilltype()); buildOppInfo(rvo); rvo.setPk_billtype(vo.getPk_billtypecode()); rvo.setMemo(vo.getNote()); retList.add(rvo); // 处理保证金 if (FbmBusConstant.ASSURETYPE_BAIL.equals(vo.getImpawnmode())) { BankaccbasVO bankaccvo = (BankaccbasVO) FBMProxy.getUAPQuery().retrieveByPK(BankaccbasVO.class, vo.getSecurityaccount()); SettlementBodyVO rvo1 = new SettlementBodyVO(); rvo1.setPk_corp(tally_corp); // 公司 rvo1.setSystemcode(ProductInfo.pro_FBM); // 来源系统 rvo1.setPk_bill(vo.getPrimaryKey()); // 业务单据主键 rvo1.setPk_account(bankaccvo.getPrimaryKey()); rvo1.setBillcode(vo.getVbillno()); // 单据编号 rvo1.setBilldate(vo.getInvoicedate()); // 业务日期取实际放款日期 rvo1.setTallydate(vo.getInvoicedate()); rvo1.setSigndate(vo.getInvoicedate()); rvo1.setTallystatus(new Integer(CMPaccStatus.SUCCESSACCOUNT.getStatus())); // 记账状态,设置为结算成功日期 rvo1.setFundformcode(1); // 银行存款 selfAcc = null; selfAcc = vo.getSecurityaccount(); rvo1.setReceive(vo.getSecuritymoney()); rvo1.setReceivefrac(vo.getSecuritymoneyf()); rvo1.setReceivelocal(vo.getSecuritymoneyb()); // rvo1.setFundsflag(CmpConst.CASH_FLOW_IN); // 资金流向(0 资金流入1 资金流出2 转账出) rvo1.setDirection( CmpConst .Direction_Receive); // CmpConst.Direction_Receive=0收款;CmpConst.Direction_Receive=1付款; rvo1.setPk_account(selfAcc); // 本方帐 rvo1.setPk_currtype(baseVO.getPk_curr()); // 币种 rvo1.setFracrate(vo.getFrate()); // 辅币汇率 rvo1.setLocalrate(vo.getBrate()); // 本币汇率 rvo1.setTradertype(CmpConst.TradeObjType_Bank); // 对方类型为银行 rvo1.setPk_trader(baseVO.getPaybank()); // suzhzh 201106171021595038 回写票据号 rvo1.setNotenumber(baseVO.getFbmbillno()); // add by ouyangzhb 2011-06-24 回写票据类型 rvo.setPk_notetype(baseVO.getFbmbilltype()); buildOppInfo(rvo1); rvo1.setPk_billtype(vo.getPk_billtypecode()); rvo1.setMemo(vo.getNote()); retList.add(rvo1); } getBankTallyService() .writeBankacc((SettlementBodyVO[]) retList.toArray(new SettlementBodyVO[0])); }
/* * (non-Javadoc) * * @see nc.bs.fbm.pub.action.AbstractAction#dealAccount(java.lang.String, * nc.vo.fbm.pub.ActionParamVO) */ @Override public void dealAccount(String pk_action, BusiActionParamVO<T> param) throws BusinessException { CommonDAO dao = new CommonDAO(); BaseinfoVO baseinfoVO = dao.queryBaseinfoByPK(param.getPk_baseinfo()); /** 将A单位票据调剂给C单位 生成三条虚拟账户记录: A单位调剂存放户减少 C单位内部存放户增加 A和C的清算户 */ boolean isSelf = false; AccountDetailVO[] vos = null; if (BusiReliefUtil.isSelfBill(param)) { vos = new AccountDetailVO[2]; isSelf = true; } else { vos = new AccountDetailVO[4]; } // A调剂存放户减少 vos[0] = new AccountDetailVO(); vos[0].setPk_org(param.getUnit_a()); // 调出的单位 vos[0].setMoneyy(baseinfoVO.getMoneyy().multiply(-1)); vos[0].setPk_baseinfo(param.getPk_baseinfo()); vos[0].setPk_action(pk_action); vos[0].setPk_type(FbmBusConstant.ACCOUNT_TYPE_RELIEF); // 中心调剂户减少 vos[0].setReason(FbmBusConstant.ACCOUNT_REASON_RELIEF_USE); vos[0].setIsliquid(UFBoolean.FALSE); // 是否清算,默认false vos[0].setLiquidationdate(baseinfoVO.getEnddate()); // 清算日期 vos[0].setPk_register(param.getRegisterVO().getPrimaryKey()); // 设置pk_register // C内部存放户增加 vos[1] = new AccountDetailVO(); vos[1].setPk_org(param.getUnit_b()); // 调入的单位 vos[1].setMoneyy(baseinfoVO.getMoneyy()); vos[1].setPk_baseinfo(param.getPk_baseinfo()); vos[1].setPk_action(pk_action); vos[1].setPk_type(FbmBusConstant.ACCOUNT_TYPE_CENTER); // 中心存放户增加 vos[1].setReason(FbmBusConstant.ACCOUNT_REASON_RELIEF_USE); vos[1].setIsliquid(UFBoolean.FALSE); // 是否清算,默认false vos[1].setLiquidationdate(baseinfoVO.getEnddate()); // 清算日期 vos[1].setPk_register(param.getRegisterVO().getPrimaryKey()); // 设置pk_register if (!isSelf) { // A的清算户减少 vos[2] = new AccountDetailVO(); vos[2].setPk_org(param.getRegisterVO().getHoldunit()); // 调出的单位减少 vos[2].setMoneyy(baseinfoVO.getMoneyy()); vos[2].setPk_baseinfo(param.getPk_baseinfo()); vos[2].setPk_action(pk_action); vos[2].setPk_type(FbmBusConstant.ACCOUNT_TYPE_LIQUID); // A单位清算户减少 vos[2].setReason(FbmBusConstant.ACCOUNT_REASON_RELIEF_USE); vos[2].setIsliquid(UFBoolean.FALSE); // 是否清算,默认false vos[2].setLiquidationdate(baseinfoVO.getEnddate()); // 清算日期 vos[2].setPk_register(param.getRegisterVO().getPrimaryKey()); // 设置pk_register // C的清算户增加 vos[3] = new AccountDetailVO(); vos[3].setPk_org(param.getUnit_b()); // 调到的单位增加 vos[3].setMoneyy(baseinfoVO.getMoneyy().multiply(-1)); vos[3].setPk_baseinfo(param.getPk_baseinfo()); vos[3].setPk_action(pk_action); vos[3].setPk_type(FbmBusConstant.ACCOUNT_TYPE_LIQUID); // C单位清算户增加 vos[3].setReason(FbmBusConstant.ACCOUNT_REASON_RELIEF_USE); vos[3].setIsliquid(UFBoolean.FALSE); // 是否清算,默认false vos[3].setLiquidationdate(baseinfoVO.getEnddate()); // 清算日期 vos[3].setPk_register(param.getRegisterVO().getPrimaryKey()); // 设置pk_register } dao.getBaseDAO().insertVOArray(vos); }