ソースを参照

插入自定义档案更新

pancy 1 年間 前
コミット
c252d3e026
1 ファイル変更29 行追加3 行削除
  1. 29 3
      pu/pu/src/client/nc/pub/filesystem/newui/ThOCRAction.java

+ 29 - 3
pu/pu/src/client/nc/pub/filesystem/newui/ThOCRAction.java

@@ -134,6 +134,10 @@ public class ThOCRAction extends AbstractNCAction{
 			for(int j = 0;j < infos.size();j++){
 				JSONObject info = infos.getJSONObject(j).getJSONObject("info");
 				String code = info.getString("code");//发票代码
+				String ext = info.getString("ext");
+				JSONObject extobj = JSONObject.parseObject(ext);
+				String trate = extobj.getString("trate");//税率
+				
 				JSONArray flist = info.getJSONArray("flist");
 				String name = "";
 				for(int k = 0;k < flist.size();k++){
@@ -141,10 +145,26 @@ public class ThOCRAction extends AbstractNCAction{
 				}
 				String memo = info.getString("number");//发票号
 				JSONObject comm_info = info.getJSONObject("comm_info");
+				JSONObject pro = comm_info.getJSONObject("pro");
+				String date = pro.getString("date");//发票日期
+				String type = pro.getString("type");//发票类型
+				String cname = pro.getString("cname");//发票类型名称
 				JSONObject price = comm_info.getJSONObject("price");
-				String amount = price.getString("amount");//无税金额
-				String total = price.getString("total");//价税合计
-				String dtax = price.getString("dtax");//可抵扣税额
+				String amount = "";
+				String total = "";
+				String dtax = "";
+				//专票带税额,不是专票无税金额=价税合计
+				if(type.equals("1")||type.equals("28")){
+					amount = price.getString("amount");//无税金额
+					total = price.getString("total");//价税合计
+					dtax = price.getString("dtax");//可抵扣税额
+				}
+				else{
+					amount = price.getString("total");//无税金额
+					total = amount;//价税合计
+					dtax = "0";//可抵扣税额
+					trate = "0";//非专票税率也为0
+				}
 				JSONObject buyer = comm_info.getJSONObject("buyer");
 				String mnecode = buyer.getString("tcode");//购买方纳税人识别号
 				String name2 = buyer.getString("company");//购买方公司名称
@@ -172,6 +192,9 @@ public class ThOCRAction extends AbstractNCAction{
 					defvo.setAttributeValue("shortname", amount);
 					defvo.setAttributeValue("shortname2", total);
 					defvo.setAttributeValue("shortname3", dtax);
+					defvo.setAttributeValue("shortname4", date);
+					defvo.setAttributeValue("shortname5", cname);
+					defvo.setAttributeValue("shortname6", trate);
 					defvo.setAttributeValue("enablestate", 2);
 					try {
 						idefservice.updateDefdocs(pk_group,updatevos);
@@ -203,6 +226,9 @@ public class ThOCRAction extends AbstractNCAction{
 					defvo.setAttributeValue("shortname", amount);
 					defvo.setAttributeValue("shortname2", total);
 					defvo.setAttributeValue("shortname3", dtax);
+					defvo.setAttributeValue("shortname4", date);
+					defvo.setAttributeValue("shortname5", cname);
+					defvo.setAttributeValue("shortname6", trate);
 					vos[0] = defvo;
 					try {
 				//		idefservice.insertDefdocs(pk_org, vos);