佣金凭证

This commit is contained in:
amarsoft 2018-08-20 16:17:06 +08:00
parent 3f1a3f6b9f
commit b3de1ab96d
2 changed files with 95 additions and 45 deletions

View File

@ -49,8 +49,8 @@ public class ContractOnhireVoucher extends BaseBussiness {
cvhl.CreateVoucher(FlowUnid, "PZ2018080300000073");//给经销商放款冲抵确认收到手续费按月分摊收入--直租
CreateVoucherToCommission cvtc = new CreateVoucherToCommission();
cvtc.CreateVoucher(FlowUnid, "");// ¼Ç¼ӽð--»Ø×â
cvtc.CreateVoucher(FlowUnid, "");// ¼Ç¼ӽð--Ö±×â
cvtc.CreateVoucher(FlowUnid, "PZ2018082000000140");// ¼Ç¼ӽð--»Ø×â
cvtc.CreateVoucher(FlowUnid, "PZ2018082000000141");// ¼Ç¼ӽð--Ö±×â
//CreateVoucherCustCautionMoneyIncome cvci=new CreateVoucherCustCautionMoneyIncome();
return "true";
}

View File

@ -1,12 +1,15 @@
package com.tenwa.voucher.CreateVoucherProcess;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jbo.app.LB_PRODUCT_SALVAGE;
import jbo.voucher.LV_VOUCHER_CONFIG;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.awe.util.Transaction;
import com.amarsoft.dict.als.cache.CacheLoaderFactory;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
@ -25,6 +28,7 @@ public String CreateVoucher(String FlowUnid,String VOUCHERNO) throws Exception {
String MONEY=null;
String MONEYNOTAX=null;
String MONEYTAX=null;
String start_date=null;
String ACCOUNT_DATE=null;
String FACT_DATE=null;
String CONTRACT_ID=null;
@ -44,7 +48,7 @@ public String CreateVoucher(String FlowUnid,String VOUCHERNO) throws Exception {
//String VOUCHERNO=this.getAttribute("VoucherNo").toString();
param.clear();
map.put("FlowUnid", FlowUnid);
sql= "SELECT LCCT.HANDLING_CHARGE_MONEY AS MONEY,LCCT.HANDLING_CHARGE_MONEY/1.06 AS HANDLFEENOTAX,(LCCT.HANDLING_CHARGE_MONEY-ROUND(LCCT.HANDLING_CHARGE_MONEY/1.06,2))AS HANDLTAX,DATE_FORMAT(SYSDATE(),'%Y/%m/%d')AS ACCOUNT_DATE,DATE_FORMAT(SYSDATE(),'%Y/%m/%d') AS FACT_DATE,LCCT.CONTRACT_ID,LCI.CONTRACT_NUMBER,LCI.PROJECT_NAME,LCI.LEAS_FORM,DI.DISTRIBUTOR_CODING DISTRIBUTOR_ID,DI.DISTRIBUTOR_NAME,LEC.ID AS CARID,LEC.MODEL ,CIF.CERTID AS CUSTOMERID,CIF.CUSTOMERNAME,CIF.CUSTOMERTYPE,LPI.BUSINESSTYPE FROM LC_CALC_CONDITION LCCT INNER JOIN lc_fund_income_temp lfit ON lfit.contract_id=lcct.contract_id AND lfit.fee_type='feetype10' LEFT JOIN LB_CONTRACT_INFO LCI ON LCCT.CONTRACT_ID=LCI.ID LEFT JOIN DISTRIBUTOR_INFO DI ON DI.DISTRIBUTOR_NO=LCI.DISTRIBUTOR_ID LEFT JOIN LB_EQUIPMENT_CAR LEC ON LEC.CONTRACT_ID=LCI.ID LEFT JOIN lb_union_lessee lul ON lul.contract_id=lci.id LEFT JOIN customer_info cif ON cif.customerid=lul.customer_id LEFT JOIN LB_PROJECT_INFO LPI ON LPI.ID = LUL.PROJECT_ID WHERE lfit.FLOWUNID=:FLOWUNID";
sql= "SELECT lcct.clean_lease_money as MONEY,lcct.START_DATE,DATE_FORMAT(SYSDATE(),'%Y/%m/%d') AS ACCOUNT_DATE,DATE_FORMAT(SYSDATE(),'%Y/%m/%d') AS FACT_DATE,LCCT.CONTRACT_ID,LCI.CONTRACT_NUMBER,LCI.PROJECT_NAME,LCI.LEAS_FORM,DI.DISTRIBUTOR_CODING DISTRIBUTOR_ID,DI.DISTRIBUTOR_NAME,LEC.ID AS CARID,LEC.MODEL,CIF.CERTID AS CUSTOMERID,CIF.CUSTOMERNAME,CIF.CUSTOMERTYPE,LPI.BUSINESSTYPE FROM LC_CALC_CONDITION LCCT INNER JOIN (select contract_id,FLOWUNID from lc_fund_income_temp where fee_type='feetype10' group by contract_id,FLOWUNID) lfit ON lfit.contract_id=lcct.contract_id LEFT JOIN LB_CONTRACT_INFO LCI ON LCCT.CONTRACT_ID=LCI.ID LEFT JOIN DISTRIBUTOR_INFO DI ON DI.DISTRIBUTOR_NO=LCI.DISTRIBUTOR_ID LEFT JOIN LB_EQUIPMENT_CAR LEC ON LEC.CONTRACT_ID=LCI.ID LEFT JOIN lb_union_lessee lul ON lul.contract_id=lci.id LEFT JOIN customer_info cif ON cif.customerid=lul.customer_id LEFT JOIN LB_PROJECT_INFO LPI ON LPI.ID = LUL.PROJECT_ID WHERE lfit.FLOWUNID=:FLOWUNID";
List<Map<String,String>> dataList=DataOperatorUtil.getDataBySql(Sqlca, sql, map);
@ -56,9 +60,9 @@ public String CreateVoucher(String FlowUnid,String VOUCHERNO) throws Exception {
if("".equals(MONEY)||MONEY==null) MONEY="0.00";
double mon=Double.parseDouble(MONEY);
if(mon>0){
MONEYNOTAX=dataList.get(i).get("HANDLFEENOTAX").toString();
MONEYTAX=dataList.get(i).get("HANDLTAX").toString();
//MONEYNOTAX=dataList.get(i).get("HANDLFEENOTAX").toString();
//MONEYTAX=dataList.get(i).get("HANDLTAX").toString();
start_date=dataList.get(i).get("START_DATE").toString();
ACCOUNT_DATE=dataList.get(i).get("ACCOUNT_DATE").toString();
FACT_DATE =dataList.get(i).get("FACT_DATE").toString();
CONTRACT_ID=dataList.get(i).get("CONTRACT_ID").toString();
@ -74,45 +78,91 @@ public String CreateVoucher(String FlowUnid,String VOUCHERNO) throws Exception {
CUSTOMERTYPE=dataList.get(i).get("CUSTOMERTYPE");
BUSINESSTYPE=dataList.get(i).get("BUSINESSTYPE");
param.put("FACT_MONEY",MONEY);
param.put("INTERESTNOTAX",MONEYNOTAX);
param.put("TAX",MONEYTAX);
param.put("ACCOUNT_DATE",ACCOUNT_DATE);
param.put("FACT_DATE",FACT_DATE);
param.put("CONTRACT_ID",CONTRACT_ID);
param.put("CONTRACT_NUMBER",CONTRACT_NUMBER);
param.put("PROJECT_NAME",PROJECT_NAME);
param.put("LEAS_FORM",leas_form);
param.put("DISTRIBUTOR_ID",DISTRIBUTOR_ID);
param.put("DISTRIBUTOR_NAME",DISTRIBUTOR_NAME);
param.put("CARID",CARID);
param.put("CARMODEL",CARMODEL);
param.put("CUSTID",DISTRIBUTOR_ID);
param.put("CUSTNAME",DISTRIBUTOR_NAME);
param.put("CUSTOMERTYPE",CUSTOMERTYPE);
param.put("BUSINESSTYPE",BUSINESSTYPE);
if("1".equals(BUSINESSTYPE)){
param.put("LEASFORMASSET", "04"); // 融资租赁资产
param.put("DEPT", "02"); // 部门
if("03".equals(CUSTOMERTYPE)){ // 如果是个人业务
param.put("LEASINCOMEFORM", "02"); // C端
}else if("01".equals(CUSTOMERTYPE)){
param.put("LEASINCOMEFORM", "01"); // B端
}
}
//param.put("FUNDTYPE", ""); // 主营类型
param.put("BUSINESSTYPE", "06");
param.put("FlowUnid", FlowUnid);
map.clear();
map.put("PROJ_TYPE", leas_form);
map.put("VOUCHER_NO", VOUCHERNO);
BizObject vouch=DataOperatorUtil.getSingleJBO(LV_VOUCHER_CONFIG.CLASS_NAME, map, Sqlca);
if(vouch!=null){
vs.createVoucher(vouch.getAttribute("MODULAR_NUMBER").getString(), vouch.getAttribute("OWNED_COMPANY").getString(), leas_form, VOUCHER_TYPE, userid,param, Sqlca);
}}
Map<String,String> map1=new HashMap<String, String>();
map1.put("leas_form", leas_form);
map1.put("startdate", start_date);
String sql1 ="SELECT DIS_ATTRIBUTE,FIX_AMOUNT,DIS_RATIO,PRODUCT_ID FROM LB_PRODUCT_SALVAGE WHERE DATE_FORMAT(effect_start,'%Y/%m/%d')>DATE_FORMAT(:startdate,'%Y/%m/%d') AND DATE_FORMAT(effect_end,'%Y/%m/%d')>DATE_FORMAT(:startdate,'%Y/%m/%d') AND product_id =:leas_form";
List<Map<String,String>> dataList1=DataOperatorUtil.getDataBySql(Sqlca, sql1, map1);
BigDecimal bigMoney=null;
BigDecimal bigMoneyNoTax=null;
BigDecimal bigMoneyTax=null;
BigDecimal taxRate=null;
if(dataList1.size()>0){
String disAttribute=dataList1.get(0).get("DIS_ATTRIBUTE");
String fixAmount=dataList1.get(0).get("FIX_AMOUNT");
String disRatio=dataList1.get(0).get("DIS_RATIO");
if("01".equals(leas_form)){
taxRate=new BigDecimal("1.16");
}else {
taxRate=new BigDecimal("1.06");
}
if(disAttribute!=null&&!"".equals(disAttribute)){
if("1".equals(disAttribute)){
param.put("FACT_MONEY",MONEY);
bigMoneyNoTax=new BigDecimal(MONEY).divide(taxRate,2, BigDecimal.ROUND_HALF_UP);
bigMoneyTax=new BigDecimal(MONEY).subtract(new BigDecimal(MONEY).divide(taxRate,2, BigDecimal.ROUND_HALF_UP));
param.put("INTERESTNOTAX",bigMoneyNoTax.toString());
param.put("TAX",bigMoneyTax.toString());
}
if("2".equals(disAttribute)){
bigMoney=new BigDecimal(MONEY)
.multiply(new BigDecimal(disRatio))
.divide(new BigDecimal("100"),2, BigDecimal.ROUND_HALF_UP);
bigMoneyNoTax=bigMoney.divide(taxRate,2,BigDecimal.ROUND_HALF_UP);
bigMoneyTax=bigMoney.subtract(bigMoneyNoTax);
param.put("FACT_MONEY",bigMoney.toString());
param.put("INTERESTNOTAX",bigMoneyNoTax.toString());
param.put("TAX",bigMoneyTax.toString());
}
}
param.put("ACCOUNT_DATE",ACCOUNT_DATE);
param.put("FACT_DATE",FACT_DATE);
param.put("CONTRACT_ID",CONTRACT_ID);
param.put("CONTRACT_NUMBER",CONTRACT_NUMBER);
param.put("PROJECT_NAME",PROJECT_NAME);
param.put("LEAS_FORM",leas_form);
param.put("DISTRIBUTOR_ID",DISTRIBUTOR_ID);
param.put("DISTRIBUTOR_NAME",DISTRIBUTOR_NAME);
param.put("CARID",CARID);
param.put("CARMODEL",CARMODEL);
param.put("CUSTID",DISTRIBUTOR_ID);
param.put("CUSTNAME",DISTRIBUTOR_NAME);
param.put("CUSTOMERTYPE",CUSTOMERTYPE);
param.put("BUSINESSTYPE",BUSINESSTYPE);
if("1".equals(BUSINESSTYPE)){
param.put("LEASFORMASSET", "04"); // 融资租赁资产
param.put("DEPT", "02"); // 部门
if("03".equals(CUSTOMERTYPE)){ // 如果是个人业务
param.put("LEASINCOMEFORM", "02"); // C端
}else if("01".equals(CUSTOMERTYPE)){
param.put("LEASINCOMEFORM", "01"); // B端
}
}
//param.put("FUNDTYPE", ""); // 主营类型
param.put("BUSINESSTYPE", "06");
param.put("FlowUnid", FlowUnid);
map.clear();
map.put("PROJ_TYPE", leas_form);
map.put("VOUCHER_NO", VOUCHERNO);
BizObject vouch=DataOperatorUtil.getSingleJBO(LV_VOUCHER_CONFIG.CLASS_NAME, map, Sqlca);
if(vouch!=null){
vs.createVoucher(vouch.getAttribute("MODULAR_NUMBER").getString(), vouch.getAttribute("OWNED_COMPANY").getString(), leas_form, VOUCHER_TYPE, userid,param, Sqlca);
}
}
}
}