|
@@ -34,16 +34,18 @@ public class VoucherAdd {
|
|
* @param biz_id 唯一来源id
|
|
* @param biz_id 唯一来源id
|
|
* @param type 数据源 1昆山,3潍坊
|
|
* @param type 数据源 1昆山,3潍坊
|
|
*/
|
|
*/
|
|
- public static String addVoucher(Map<String,Object> map,String biz_id,String type) {
|
|
|
|
|
|
+ public static String addVoucher(Map<String,Object> map,String biz_id,String type,String upTime) {
|
|
|
|
|
|
Map<String,Object> jsonBodyMap = new HashMap<>();
|
|
Map<String,Object> jsonBodyMap = new HashMap<>();
|
|
Map<String,Object> voucher = new HashMap<>();//凭证数据详情
|
|
Map<String,Object> voucher = new HashMap<>();//凭证数据详情
|
|
String sqr = map.get("申请人").toString();
|
|
String sqr = map.get("申请人").toString();
|
|
-
|
|
|
|
|
|
+ String[] da = upTime.split("-");
|
|
voucher.put("voucher_type","记");//凭证类别
|
|
voucher.put("voucher_type","记");//凭证类别
|
|
-// voucher.put("fiscal_year","2021");//凭证所属的会计年度,不填写取当前年
|
|
|
|
-// voucher.put("accounting_period","1");//所属的会计期间,不填写取当前月份
|
|
|
|
- voucher.put("date", DateUtils.format(new Date()));//制单日期
|
|
|
|
|
|
+ voucher.put("fiscal_year",da[0]);//凭证所属的会计年度,不填写取当前年
|
|
|
|
+ voucher.put("accounting_period",da[1]);//所属的会计期间,不填写取当前月份
|
|
|
|
+ voucher.put("date", upTime);//制单日期
|
|
|
|
+// voucher.put("date", DateUtils.format(new Date()));//制单日期
|
|
|
|
+
|
|
// voucher.put("enter","DingDing_"+map.get("申请人"));//制单人名称
|
|
// voucher.put("enter","DingDing_"+map.get("申请人"));//制单人名称
|
|
voucher.put("enter","OA");//制单人名称
|
|
voucher.put("enter","OA");//制单人名称
|
|
// voucher.put("cashier",map.get("出纳"));//出纳名称
|
|
// voucher.put("cashier",map.get("出纳"));//出纳名称
|
|
@@ -152,13 +154,18 @@ public class VoucherAdd {
|
|
* @param biz_id 唯一来源id
|
|
* @param biz_id 唯一来源id
|
|
* @param type 数据源 1昆山,3潍坊
|
|
* @param type 数据源 1昆山,3潍坊
|
|
*/
|
|
*/
|
|
- public static String addVoucherNew(Map<String,Object> map,String biz_id,String type) {
|
|
|
|
|
|
+ public static String addVoucherNew(Map<String,Object> map,String biz_id,String type,String upTime) {
|
|
//1昆山,3潍坊
|
|
//1昆山,3潍坊
|
|
Map<String,Object> jsonBodyMap = new HashMap<>();
|
|
Map<String,Object> jsonBodyMap = new HashMap<>();
|
|
- Map<String,Object> voucher = new HashMap<>();//凭证数据详情
|
|
|
|
|
|
|
|
|
|
+ Map<String,Object> voucher = new HashMap<>();//凭证数据详情
|
|
|
|
+ String[] da = upTime.split("-");
|
|
voucher.put("voucher_type","记");//凭证类别
|
|
voucher.put("voucher_type","记");//凭证类别
|
|
- voucher.put("date", DateUtils.format(new Date()));//制单日期
|
|
|
|
|
|
+ voucher.put("fiscal_year",da[0]);//凭证所属的会计年度,不填写取当前年
|
|
|
|
+ voucher.put("accounting_period",da[1]);//所属的会计期间,不填写取当前月份
|
|
|
|
+ voucher.put("date", upTime);//制单日期
|
|
|
|
+// voucher.put("date", DateUtils.format(new Date()));//制单日期
|
|
|
|
+
|
|
voucher.put("enter","OA");//制单人名称
|
|
voucher.put("enter","OA");//制单人名称
|
|
|
|
|
|
BigDecimal allNum = new BigDecimal("0");//总金额(所有未税金额和税额之和,用作贷方金额)
|
|
BigDecimal allNum = new BigDecimal("0");//总金额(所有未税金额和税额之和,用作贷方金额)
|
|
@@ -209,11 +216,14 @@ public class VoucherAdd {
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
String seCode = getCodeSE(bxKm);
|
|
String seCode = getCodeSE(bxKm);
|
|
entryDebitMap.put("account_code",seCode);
|
|
entryDebitMap.put("account_code",seCode);
|
|
-//
|
|
|
|
- entryDebitMap.put("natural_debit_currency",se.multiply(sl));//(税额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
|
|
|
|
+ BigDecimal natural_debit_currency = se.multiply(sl);
|
|
|
|
+ natural_debit_currency = natural_debit_currency.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ entryDebitMap.put("natural_debit_currency",natural_debit_currency);//(税额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
|
|
+ System.out.println(natural_debit_currency);
|
|
if(se.compareTo(new BigDecimal("0")) != 0){
|
|
if(se.compareTo(new BigDecimal("0")) != 0){
|
|
entryDebit.add(entryDebitMap);
|
|
entryDebit.add(entryDebitMap);
|
|
- allNum = allNum.add(se.multiply(sl));
|
|
|
|
|
|
+// allNum = allNum.add(se.multiply(sl));
|
|
|
|
+ allNum = allNum.add(natural_debit_currency);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -241,9 +251,13 @@ public class VoucherAdd {
|
|
entryDebitMap.put("abstract",sqr+"/其他报销/"+bxKm+"/"+mingC);
|
|
entryDebitMap.put("abstract",sqr+"/其他报销/"+bxKm+"/"+mingC);
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
entryDebitMap.put("account_code",account_code);
|
|
entryDebitMap.put("account_code",account_code);
|
|
- entryDebitMap.put("natural_debit_currency",jinE.multiply(sl));//(末税金额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
|
|
|
|
+ BigDecimal natural_debit_currency = jinE.multiply(sl);
|
|
|
|
+ natural_debit_currency = natural_debit_currency.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ entryDebitMap.put("natural_debit_currency",natural_debit_currency);//(末税金额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
entryDebit.add(entryDebitMap);
|
|
entryDebit.add(entryDebitMap);
|
|
- allNum = allNum.add(jinE.multiply(sl));
|
|
|
|
|
|
+ System.out.println(natural_debit_currency);
|
|
|
|
+// allNum = allNum.add(jinE.multiply(sl));
|
|
|
|
+ allNum = allNum.add(natural_debit_currency);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -290,11 +304,13 @@ public class VoucherAdd {
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
String seCode = getCodeSE(bxKm);
|
|
String seCode = getCodeSE(bxKm);
|
|
entryDebitMap.put("account_code",seCode);
|
|
entryDebitMap.put("account_code",seCode);
|
|
-//
|
|
|
|
- entryDebitMap.put("natural_debit_currency",se.multiply(sl));//(税额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
|
|
|
|
+ BigDecimal natural_debit_currency = se.multiply(sl);
|
|
|
|
+ natural_debit_currency = natural_debit_currency.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ entryDebitMap.put("natural_debit_currency",natural_debit_currency);//(税额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
if(se.compareTo(new BigDecimal("0")) != 0){
|
|
if(se.compareTo(new BigDecimal("0")) != 0){
|
|
entryDebit.add(entryDebitMap);
|
|
entryDebit.add(entryDebitMap);
|
|
- allNum = allNum.add(se.multiply(sl));
|
|
|
|
|
|
+// allNum = allNum.add(se.multiply(sl));
|
|
|
|
+ allNum = allNum.add(natural_debit_currency);
|
|
}
|
|
}
|
|
|
|
|
|
}else{
|
|
}else{
|
|
@@ -315,7 +331,8 @@ public class VoucherAdd {
|
|
entryDebitMap.put("account_code",seCode);
|
|
entryDebitMap.put("account_code",seCode);
|
|
//当报销科目为火车,飞机时,税率自动计算(税额=未税金额*9%)
|
|
//当报销科目为火车,飞机时,税率自动计算(税额=未税金额*9%)
|
|
BigDecimal lv = new BigDecimal("0.09");
|
|
BigDecimal lv = new BigDecimal("0.09");
|
|
- BigDecimal multiply = jinE.multiply(lv).multiply(sl);
|
|
|
|
|
|
+ BigDecimal lv2 = new BigDecimal("1.09");
|
|
|
|
+ BigDecimal multiply = jinE.multiply(sl).divide(lv2).multiply(lv);
|
|
multiply = multiply.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
multiply = multiply.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
entryDebitMap.put("natural_debit_currency", multiply);//(税额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
entryDebitMap.put("natural_debit_currency", multiply);//(税额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
|
|
|
|
@@ -339,9 +356,19 @@ public class VoucherAdd {
|
|
entryDebitMap.put("abstract",sqr+"/差旅报销/"+bxKm+"/"+mingC);
|
|
entryDebitMap.put("abstract",sqr+"/差旅报销/"+bxKm+"/"+mingC);
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
entryDebitMap.put("account_code",account_code);
|
|
entryDebitMap.put("account_code",account_code);
|
|
- entryDebitMap.put("natural_debit_currency",jinE.multiply(sl));//(末税金额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
|
|
|
|
+
|
|
|
|
+ BigDecimal natural_debit_currency = new BigDecimal("0");// jinE.multiply(sl);
|
|
|
|
+ if("飞机、火车".contains(bxKm)){
|
|
|
|
+ BigDecimal lv = new BigDecimal("1.09");
|
|
|
|
+ natural_debit_currency = jinE.multiply(sl).divide(lv);
|
|
|
|
+ }else{
|
|
|
|
+ natural_debit_currency = jinE.multiply(sl);
|
|
|
|
+ }
|
|
|
|
+ natural_debit_currency = natural_debit_currency.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ entryDebitMap.put("natural_debit_currency",natural_debit_currency);//(末税金额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
entryDebit.add(entryDebitMap);
|
|
entryDebit.add(entryDebitMap);
|
|
- allNum = allNum.add(jinE.multiply(sl));
|
|
|
|
|
|
+// allNum = allNum.add(jinE.multiply(sl));
|
|
|
|
+ allNum = allNum.add(natural_debit_currency);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -382,12 +409,42 @@ public class VoucherAdd {
|
|
String seCode = getCodeSE(bxKm);
|
|
String seCode = getCodeSE(bxKm);
|
|
entryDebitMap.put("account_code",seCode);
|
|
entryDebitMap.put("account_code",seCode);
|
|
//
|
|
//
|
|
- entryDebitMap.put("natural_debit_currency",se.multiply(sl));//(税额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
|
|
|
|
+ BigDecimal natural_debit_currency = se.multiply(sl);
|
|
|
|
+ natural_debit_currency = natural_debit_currency.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ entryDebitMap.put("natural_debit_currency",natural_debit_currency);//(税额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
if(se.compareTo(new BigDecimal("0")) != 0){
|
|
if(se.compareTo(new BigDecimal("0")) != 0){
|
|
entryDebit.add(entryDebitMap);
|
|
entryDebit.add(entryDebitMap);
|
|
- allNum = allNum.add(se.multiply(sl));
|
|
|
|
|
|
+// allNum = allNum.add(se.multiply(sl));
|
|
|
|
+ allNum = allNum.add(natural_debit_currency);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ }else{
|
|
|
|
+ if("高速通行费".contains(bxKm)){
|
|
|
|
+ Map<String,Object> entryDebitMap = new HashMap<>(); //voucher > debit > entryDebit > entryDebitMap
|
|
|
|
+
|
|
|
|
+ Map<String,Object> auxiliaryDebit = new HashMap<>();
|
|
|
|
+ auxiliaryDebit.put("dept_id",map.get("dept_code"));
|
|
|
|
+ auxiliaryDebit.put("personnel_id",map.get("job_number"));
|
|
|
|
+
|
|
|
|
+ if(map.containsKey("item_class")){
|
|
|
|
+ auxiliaryDebit.put("item_class","00");//项目大类
|
|
|
|
+ auxiliaryDebit.put("item_id","YFYYYY00001-99");//项目档案
|
|
|
|
+ }
|
|
|
|
+ entryDebitMap.put("auxiliary",auxiliaryDebit);
|
|
|
|
+ entryDebitMap.put("abstract",sqr+"/私车公用/"+bxKm+"/税额");
|
|
|
|
+ String seCode = getCodeSE(bxKm);
|
|
|
|
+ entryDebitMap.put("account_code",seCode);
|
|
|
|
+ //当报销科目为火车,飞机时,税率自动计算(税额=未税金额*9%)
|
|
|
|
+ BigDecimal lv = new BigDecimal("0.03");
|
|
|
|
+ BigDecimal lv2 = new BigDecimal("1.03");
|
|
|
|
+ BigDecimal multiply = jinE.multiply(sl).divide(lv2).multiply(lv);
|
|
|
|
+ multiply = multiply.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ entryDebitMap.put("natural_debit_currency", multiply);//(税额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
|
|
+
|
|
|
|
+ entryDebit.add(entryDebitMap);
|
|
|
|
+ allNum = allNum.add(multiply);
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
Map<String,Object> entryDebitMap = new HashMap<>(); //voucher > debit > entryDebit > entryDebitMap
|
|
Map<String,Object> entryDebitMap = new HashMap<>(); //voucher > debit > entryDebit > entryDebitMap
|
|
@@ -404,9 +461,20 @@ public class VoucherAdd {
|
|
entryDebitMap.put("abstract",sqr+"/私车公用/"+bxKm);
|
|
entryDebitMap.put("abstract",sqr+"/私车公用/"+bxKm);
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
// entryDebitMap.put("account_code",map.get("account_code"));
|
|
entryDebitMap.put("account_code",account_code);
|
|
entryDebitMap.put("account_code",account_code);
|
|
- entryDebitMap.put("natural_debit_currency",jinE.multiply(sl));//(末税金额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
|
|
|
|
+
|
|
|
|
+ BigDecimal natural_debit_currency = new BigDecimal("0");// jinE.multiply(sl);
|
|
|
|
+ if("高速通行费".contains(bxKm)){
|
|
|
|
+ BigDecimal lv = new BigDecimal("1.03");
|
|
|
|
+ natural_debit_currency = jinE.multiply(sl).divide(lv);
|
|
|
|
+ }else{
|
|
|
|
+ natural_debit_currency = jinE.multiply(sl);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ natural_debit_currency = natural_debit_currency.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ entryDebitMap.put("natural_debit_currency",natural_debit_currency);//(末税金额*数量) 本币贷方发生额*与本币借方发生额不能同时为空
|
|
entryDebit.add(entryDebitMap);
|
|
entryDebit.add(entryDebitMap);
|
|
- allNum = allNum.add(jinE.multiply(sl));
|
|
|
|
|
|
+// allNum = allNum.add(jinE.multiply(sl));
|
|
|
|
+ allNum = allNum.add(natural_debit_currency);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|