|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.gszc.service;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
@ -7,37 +8,43 @@ import java.math.BigDecimal;
|
|
|
|
|
@Service
|
|
|
|
|
public class CountService {
|
|
|
|
|
|
|
|
|
|
public BigDecimal VATCount(String companyType,String invoiceType,String specialInvoiceType,double money) throws Exception{
|
|
|
|
|
public JSONObject VATCount(String companyType,String invoiceType,String specialInvoiceType,double money) throws Exception{
|
|
|
|
|
|
|
|
|
|
double result = 0;
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
if(companyType.equals("1")){//有限公司
|
|
|
|
|
result = VATCountDetail(invoiceType, money, result, specialInvoiceType);
|
|
|
|
|
result = VATCountDetail(invoiceType, money, specialInvoiceType);
|
|
|
|
|
|
|
|
|
|
}else if(companyType.equals("2")){//个独、合伙企业
|
|
|
|
|
result = VATCountDetail(invoiceType, money, result, specialInvoiceType);
|
|
|
|
|
result = VATCountDetail(invoiceType, money, specialInvoiceType);
|
|
|
|
|
} else {
|
|
|
|
|
throw new Exception("公司类型不正确");
|
|
|
|
|
}
|
|
|
|
|
BigDecimal b = new BigDecimal(result);
|
|
|
|
|
return b.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private double VATCountDetail(String invoiceType,double money,double result,String specialInvoiceType) throws Exception{
|
|
|
|
|
private JSONObject VATCountDetail(String invoiceType,double money,String specialInvoiceType) throws Exception{
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
double result = 0;
|
|
|
|
|
if(invoiceType.equals("1")){//普票类型
|
|
|
|
|
result = money/1.03*0.03;
|
|
|
|
|
|
|
|
|
|
jsonObject.put("rate",3);
|
|
|
|
|
}else if(invoiceType.equals("2")){//专票类型
|
|
|
|
|
if(specialInvoiceType.equals("1")){
|
|
|
|
|
result = money/1.06*0.06;
|
|
|
|
|
jsonObject.put("rate",6);
|
|
|
|
|
}else if(specialInvoiceType.equals("2")){
|
|
|
|
|
result = money/1.13*0.13;
|
|
|
|
|
jsonObject.put("rate",13);
|
|
|
|
|
}else {
|
|
|
|
|
throw new Exception("专票类型不正确");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
throw new Exception("发票类型不正确");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
BigDecimal b = new BigDecimal(result);
|
|
|
|
|
BigDecimal keep = b.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
jsonObject.put("money",keep);
|
|
|
|
|
return jsonObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BigDecimal PITCount(String type,String produceType,double money) throws Exception{
|
|
|
|
|