消费税,反倾销税的修改

/**
* 计算分录的消费税、反倾销税金额????/
* @return
* @throws BOSException
* @throws EASBizException
*/
public IObjectValue calcCustomExciseTaxAmount() throws BOSException, EASBizException {
CustomsBillInfo info =  (CustomsBillInfo) model;
int es = info.getEntrys().size();
BigDecimal exciseTax = BigDecimal.ZERO;//消费税
BigDecimal exciseTaxRate = BigDecimal.ZERO;//消费税率
BigDecimal countervailingTariff = BigDecimal.ZERO;//反消费税
BigDecimal countervailingTariffRate = BigDecimal.ZERO;//反消费税率
BigDecimal dealAmount = BigDecimal.ZERO;//成交金额
BigDecimal dealAmountRmb = BigDecimal.ZERO;//成交金额
BigDecimal customsExchangeRate = BigDecimal.ZERO;//汇率表
BigDecimal eTarifAmount = BigDecimal.ZERO;//关税
Date d1 = info.getDeclarationDate();
//customsExchangeRate = DCUtil.emptyToValue(info.getCustomsExchangeRate(),BigDecimal.ZERO);
if(info.getCustomsAmountCy()!=null){
customsExchangeRate = DCUtil.getCustomsRate(ctx, info.getCustomsAmountCy().getId().toString(), d1);
}
if(customsExchangeRate.compareTo(BigDecimal.ZERO)==0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000005", "报关金额无币别或海关汇率,请维护!")) ;
}
SysParameterInfo sInfo=null;
String name="";
if(info.getDealType()!=null){
SysParameterInfo dealType = (SysParameterInfo) DCUtil.getObjectValue(ctx, info.getDealType().getId().toString());
name = dealType.getName();
if(dealType.getIntPara1()==1){//通过现有的系统参数的数值参数1来控制,1:FOB;2:CIF 
name = "FOB";
}
else{
name = "CIF";
}
}
if(name.trim().length()==0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000005", "成交方式为空,请检查!")) ;
}
BigDecimal hundred = new BigDecimal(100);
for (int i = 0; i < es; i++) {
CustomsBillEntryInfo entry = info.getEntrys().get(i);
countervailingTariffRate = DCUtil.emptyToValue(entry.getCountervailingTariffRate(),BigDecimal.ZERO);//反倾销税率
exciseTaxRate = DCUtil.emptyToValue(entry.getExciseTaxRate(),BigDecimal.ZERO);//消费税率
exciseTaxRate = exciseTaxRate.divide(hundred);
dealAmount = DCUtil.emptyToValue(entry.getDealAmount(),BigDecimal.ZERO);//成交金额
eTarifAmount = DCUtil.emptyToValue(entry.getTariff(),BigDecimal.ZERO);//关税
if("FOB".equals(name)){
BigDecimal freigth = entry.getFreight();
if(freigth == null){
freigth = BigDecimal.ZERO;
}
BigDecimal insurance = entry.getInsurance();
if(insurance == null){
insurance = BigDecimal.ZERO;
}
BigDecimal incidentals = entry.getIncidentals();
if(incidentals == null){
incidentals = BigDecimal.ZERO;
}
BigDecimal ybzAmount = freigth.add(insurance).add(incidentals);
//消费税(FOB):round((round(round(进口金额*海关汇率,2)+运杂费+保费,0)+关税)/(1-消费税率)*消费税率,2)
dealAmountRmb = dealAmount.multiply(customsExchangeRate).setScale(2, RoundingMode.HALF_UP);
dealAmountRmb = dealAmountRmb.add(ybzAmount).setScale(0,RoundingMode.HALF_UP);
dealAmountRmb = dealAmountRmb.add(eTarifAmount);
BigDecimal xfsRate = new BigDecimal("0");
xfsRate = BigDecimal.ONE.subtract(exciseTaxRate);
xfsRate = xfsRate.multiply(exciseTaxRate);
if (xfsRate.compareTo(BigDecimal.ZERO) == 0) {
exciseTax = BigDecimal.ZERO;
}else {
exciseTax = dealAmountRmb.divide(xfsRate,2,RoundingMode.HALF_UP);//消费税
}
entry.setExciseTax(exciseTax);
}else{
//消费税(CIF)=round((进口金额*海关汇率+关税)/(1-消费税率)*消费税率,2)
dealAmountRmb = dealAmount.multiply(customsExchangeRate).setScale(0, RoundingMode.HALF_UP);
dealAmountRmb = dealAmountRmb.add(eTarifAmount);
BigDecimal xfsRate = new BigDecimal("0");
xfsRate = BigDecimal.ONE.subtract(exciseTaxRate);
xfsRate = xfsRate.multiply(exciseTaxRate);
if (xfsRate.compareTo(BigDecimal.ZERO)==0) {
exciseTax = BigDecimal.ZERO;
}else {
exciseTax = dealAmountRmb.divide(xfsRate, 2, RoundingMode.HALF_UP);//消费税
}
entry.setExciseTax(exciseTax);
}
//反倾销税=round(完税价格*反倾销税率,2)
BigDecimal dealPrice = DCUtil.emptyToValue(entry.getDealPrice(), BigDecimal.ZERO);//完税价格-成交单价
countervailingTariff = dealPrice.multiply(countervailingTariffRate).divide(hundred, 2,RoundingMode.HALF_UP);
entry.setCountervailingTariff(countervailingTariff);
}
return info;
}

/**
* 计算分录的消费税、反倾销税金额????/
* @return
* @throws BOSException
* @throws EASBizException
*/
public IObjectValue calcCustomExciseTaxAmountE4() throws BOSException, EASBizException {
CustomsBillInfo info =  (CustomsBillInfo) model;
int es = info.getE4().size();
BigDecimal exciseTax = BigDecimal.ZERO;//消费税
BigDecimal exciseTaxRate = BigDecimal.ZERO;//消费税率
BigDecimal countervailingTariff = BigDecimal.ZERO;//反消费税
BigDecimal countervailingTariffRate = BigDecimal.ZERO;//反消费税率
BigDecimal dealAmount = BigDecimal.ZERO;//成交金额
BigDecimal dealAmountRmb = BigDecimal.ZERO;//成交金额
BigDecimal customsExchangeRate = BigDecimal.ZERO;//汇率表
BigDecimal eTarifAmount = BigDecimal.ZERO;//关税
Date d1 = info.getDeclarationDate();
//customsExchangeRate = DCUtil.emptyToValue(info.getCustomsExchangeRate(),BigDecimal.ZERO);
if(info.getCustomsAmountCy()!=null){
customsExchangeRate = DCUtil.getCustomsRate(ctx, info.getCustomsAmountCy().getId().toString(), d1);
}
if(customsExchangeRate.compareTo(BigDecimal.ZERO)==0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000005", "报关金额无币别或海关汇率,请维护!")) ;
}
SysParameterInfo sInfo=null;
String name="";
if(info.getDealType()!=null){
SysParameterInfo dealType = (SysParameterInfo) DCUtil.getObjectValue(ctx, info.getDealType().getId().toString());
name = dealType.getName();
if(dealType.getIntPara1()==1){//通过现有的系统参数的数值参数1来控制,1:FOB;2:CIF 
name = "FOB";
}
else{
name = "CIF";
}
}
if(name.trim().length()==0){
throw new EASBizException(new NumericExceptionSubItem("0xE0000005", "成交方式为空,请检查!")) ;
}
BigDecimal hundred = new BigDecimal(100);
for (int i = 0; i < es; i++) {
CustomsBillE4Info e4 = info.getE4().get(i);
countervailingTariffRate = DCUtil.emptyToValue(e4.getCountervailingTariffRate(),BigDecimal.ZERO);//反倾销税率
exciseTaxRate = DCUtil.emptyToValue(e4.getExciseTaxRate(),BigDecimal.ZERO);//消费税率
exciseTaxRate = exciseTaxRate.divide(hundred);
dealAmount = DCUtil.emptyToValue(e4.getDealAmount(),BigDecimal.ZERO);//成交金额
eTarifAmount = DCUtil.emptyToValue(e4.getTariff(),BigDecimal.ZERO);//关税
if("FOB".equals(name)){
BigDecimal freigth = e4.getFreight();
if(freigth == null){
freigth = BigDecimal.ZERO;
}
BigDecimal insurance = e4.getInsurance();
if(insurance == null){
insurance = BigDecimal.ZERO;
}
BigDecimal incidentals = e4.getIncidentals();
if(incidentals == null){
incidentals = BigDecimal.ZERO;
}
BigDecimal ybzAmount = freigth.add(insurance).add(incidentals);
//消费税(FOB):round((round(round(进口金额*海关汇率,2)+运杂费+保费,0)+关税)/(1-消费税率)*消费税率,2)
dealAmountRmb = dealAmount.multiply(customsExchangeRate).setScale(2, RoundingMode.HALF_UP);
dealAmountRmb = dealAmountRmb.add(ybzAmount).setScale(0,RoundingMode.HALF_UP);
dealAmountRmb = dealAmountRmb.add(eTarifAmount);
BigDecimal xfsRate = new BigDecimal("0");
xfsRate = BigDecimal.ONE.subtract(exciseTaxRate);
xfsRate = xfsRate.multiply(exciseTaxRate);
if (xfsRate.compareTo(BigDecimal.ZERO) == 0) {
exciseTax = BigDecimal.ZERO;
}else {
exciseTax = dealAmountRmb.divide(xfsRate,2,RoundingMode.HALF_UP);//消费税
}
e4.setExciseTax(exciseTax);
}else{
//消费税(CIF)=round((进口金额*海关汇率+关税)/(1-消费税率)*消费税率,2)
dealAmountRmb = dealAmount.multiply(customsExchangeRate).setScale(0, RoundingMode.HALF_UP);
dealAmountRmb = dealAmountRmb.add(eTarifAmount);
BigDecimal xfsRate = new BigDecimal("0");
xfsRate = BigDecimal.ONE.subtract(exciseTaxRate);
xfsRate = xfsRate.multiply(exciseTaxRate);
if (xfsRate.compareTo(BigDecimal.ZERO) == 0) {
exciseTax = BigDecimal.ZERO;
}else {
exciseTax = dealAmountRmb.divide(xfsRate, 2, RoundingMode.HALF_UP);//消费税
}
e4.setExciseTax(exciseTax);
}
//反倾销税=round(完税价格*反倾销税率,2)
BigDecimal dealPrice = DCUtil.emptyToValue(e4.getDealPrice(), BigDecimal.ZERO);//完税价格-成交单价
countervailingTariff = dealPrice.multiply(countervailingTariffRate).divide(hundred, 2,RoundingMode.HALF_UP);
e4.setCountervailingTariff(countervailingTariff);
}
return info;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值