yaoyu 1 rok pred
rodič
commit
a20df787be

+ 77 - 76
arap/arap/src/client/nc/ui/arap/actions/ImportBodyAction.java

@@ -26,6 +26,11 @@ import nc.ui.pub.report.ReportBaseClass;
 import nc.ui.pubapp.uif2app.actions.BodyAddLineAction;
 import nc.vo.arap.payable.PayableBillItemVO;
 
+/**
+ * 导入
+ * @author YY
+ *
+ */
 public class ImportBodyAction extends BodyAddLineAction{
 	private IUAPQueryBS iuap = (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
 	private final static long serialVersionUID = 3494691988067685023L;
@@ -110,9 +115,6 @@ public class ImportBodyAction extends BodyAddLineAction{
 		String type = sqlexecuteQuery("billtypename", "bd_billtype", "pk_billtypeid", cp.getHeadItem("pk_tradetypeid").getValueObject().toString(),null,0);
 		//应付单号
 		String billno = cp.getHeadItem("billno").getValueObject().toString();
-//		if(!"应付单(非项目)".equals(type) && !"应付单(项目)".equals(type)) {
-//			return;
-//		}
 		if(!"应付单(非项目)".equals(type) && !"应付单(项目)".equals(type) && !"预付核销单(非项目)".equals(type) && !"预付核销单(项目)".equals(type)) {
 			return;
 		}
@@ -154,6 +156,7 @@ public class ImportBodyAction extends BodyAddLineAction{
 
 		// 获取行数
 		int rowNum = sheet.getLastRowNum() + 1;
+
 		rowCount = cp.getRowCount();
 
 		//判断必填项
@@ -197,12 +200,7 @@ public class ImportBodyAction extends BodyAddLineAction{
 				cp.setBodyValueAt(price,count, "price");
 				//本币单价
 				cp.setBodyValueAt(price,count, "local_price");
-				Object taxprice = sheet.getRow(i).getCell(10).getCellType() == 1 ? sheet.getRow(i).getCell(10).getStringCellValue() : sheet.getRow(i).getCell(10).getNumericCellValue();
-				//含税单价
-				cp.setBodyValueAt(taxprice,count, "taxprice");
-				//本币含税单价
-				cp.setBodyValueAt(taxprice,count, "local_taxprice");
-				Object caltaxmny = sheet.getRow(i).getCell(11).getCellType() == 1 ? sheet.getRow(i).getCell(11).getStringCellValue() : sheet.getRow(i).getCell(11).getNumericCellValue();
+				Object caltaxmny = sheet.getRow(i).getCell(10).getCellType() == 1 ? sheet.getRow(i).getCell(10).getStringCellValue() : sheet.getRow(i).getCell(10).getNumericCellValue();
 				//计税金额
 				cp.setBodyValueAt(caltaxmny,count, "caltaxmny");
 				//贷方原币无税金额
@@ -210,9 +208,9 @@ public class ImportBodyAction extends BodyAddLineAction{
 				//组织本币无税金额
 				cp.setBodyValueAt(caltaxmny,count, "local_notax_cr");
 				//税额
-				cp.setBodyValueAt(sheet.getRow(i).getCell(12).getCellType() == 1 ? sheet.getRow(i).getCell(12).getStringCellValue() : sheet.getRow(i).getCell(12).getNumericCellValue(),count, "local_tax_cr");
+				cp.setBodyValueAt(sheet.getRow(i).getCell(11).getCellType() == 1 ? sheet.getRow(i).getCell(11).getStringCellValue() : sheet.getRow(i).getCell(11).getNumericCellValue(),count, "local_tax_cr");
 				//原币余额
-				Object money_bal = sheet.getRow(i).getCell(13).getCellType() == 1 ? sheet.getRow(i).getCell(13).getStringCellValue() : sheet.getRow(i).getCell(13).getNumericCellValue();
+				Object money_bal = sheet.getRow(i).getCell(12).getCellType() == 1 ? sheet.getRow(i).getCell(12).getStringCellValue() : sheet.getRow(i).getCell(12).getNumericCellValue();
 				cp.setBodyValueAt(money_bal,count, "money_bal");
 				//组织本币余额
 				cp.setBodyValueAt(money_bal,count, "local_money_bal");
@@ -223,21 +221,30 @@ public class ImportBodyAction extends BodyAddLineAction{
 				//预占用原币余额
 				cp.setBodyValueAt(money_bal,count, "occupationmny");
 				//民航发展基金
-				cp.setBodyValueAt(dateUnit(sheet,i,14), count, "def29");
+				cp.setBodyValueAt(dateUnit(sheet,i,13), count, "def29");
 				//汇款附言
-				cp.setBodyValueAt(dateUnit(sheet,i,15),count, "def21");
+				cp.setBodyValueAt(dateUnit(sheet,i,14),count, "def21");
 				//客户
-				cp.setBodyValueAt(dateUnit(sheet,i,16) == null ? null : sqlexecuteQueryDoc(sheet.getRow(i).getCell(16).getStringCellValue(), "CUST"),count, "def13");
+				cp.setBodyValueAt(dateUnit(sheet,i,15) == null ? null : sqlexecuteQueryDoc(sheet.getRow(i).getCell(15).getStringCellValue(), "CUST"),count, "def13");
 				//客户层级
-				cp.setBodyValueAt(dateUnit(sheet,i,17),count, "def22");
+				cp.setBodyValueAt(dateUnit(sheet,i,16),count, "def22");
 				//原发票日期
-				cp.setBodyValueAt(dateUnit(sheet,i,18),count, "def17");
+				cp.setBodyValueAt(dateUnit(sheet,i,17),count, "def17");
 				//备注
-				cp.setBodyValueAt(dateUnit(sheet,i,19),count, "def2");
+				cp.setBodyValueAt(dateUnit(sheet,i,18),count, "def2");
 				//人员
-				cp.setBodyValueAt(dateUnit(sheet,i,20),count, "def40");
+				cp.setBodyValueAt(dateUnit(sheet,i,19),count, "def40");
 				//成本归属部门
-				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(21).getStringCellValue(), pk_org,2),count, "def23");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(20).getStringCellValue(), pk_org,2),count, "def23");
+				String pk_material = sqlexecuteQuery("pk_material", "bd_material", "name", sheet.getRow(i).getCell(21).getStringCellValue(), null, 2);
+				//物料
+				cp.setBodyValueAt(pk_material,count, "material");
+				//原始物料
+				cp.setBodyValueAt(pk_material,count, "material_src");
+				//含税单价
+				cp.setBodyValueAt(PayableBillItemVO.getTaxprice(),count, "taxprice");
+				//本币含税单价
+				cp.setBodyValueAt(PayableBillItemVO.getLocal_taxprice(),count, "local_taxprice");
 				//资产合同号
 				cp.setBodyValueAt(PayableBillItemVO.getAssetpactno(),count, "assetpactno");
 				//  资金计划项目
@@ -298,10 +305,6 @@ public class ImportBodyAction extends BodyAddLineAction{
 				cp.setBodyValueAt(PayableBillItemVO.getInnerorderno(),count, "innerorderno");
 				//  发票号
 				cp.setBodyValueAt(PayableBillItemVO.getInvoiceno(),count, "invoiceno");
-				//  物料
-				cp.setBodyValueAt(PayableBillItemVO.getMaterial(),count, "material");
-				//  原始物料
-				cp.setBodyValueAt(PayableBillItemVO.getMaterial_src(),count, "material_src");
 				//  不可抵扣税额
 				cp.setBodyValueAt(PayableBillItemVO.getNosubtax(),count, "nosubtax");
 				//  不可抵扣税率
@@ -509,19 +512,14 @@ public class ImportBodyAction extends BodyAddLineAction{
 				//结算方式
 				cp.setBodyValueAt(sqlexecuteQuery("pk_balatype", "bd_balatype", "name", sheet.getRow(i).getCell(10).getStringCellValue(), null,2),count, "pk_balatype");
 				Object price = null;
-				if(dateUnit(sheet,i,9) != null) {
-					price = sheet.getRow(i).getCell(9).getCellType() == 1 ? sheet.getRow(i).getCell(9).getStringCellValue() : sheet.getRow(i).getCell(9).getNumericCellValue();
+				if(dateUnit(sheet,i,11) != null) {
+					price = sheet.getRow(i).getCell(11).getCellType() == 1 ? sheet.getRow(i).getCell(11).getStringCellValue() : sheet.getRow(i).getCell(11).getNumericCellValue();
 				}
 				//单价
 				cp.setBodyValueAt(price,count, "price");
 				//本币单价
 				cp.setBodyValueAt(price,count, "local_price");
-				Object taxprice = sheet.getRow(i).getCell(12).getCellType() == 1 ? sheet.getRow(i).getCell(12).getStringCellValue() : sheet.getRow(i).getCell(12).getNumericCellValue();
-				//含税单价
-				cp.setBodyValueAt(taxprice,count, "taxprice");
-				//本币含税单价
-				cp.setBodyValueAt(taxprice,count, "local_taxprice");
-				Object caltaxmny = sheet.getRow(i).getCell(13).getCellType() == 1 ? sheet.getRow(i).getCell(13).getStringCellValue() : sheet.getRow(i).getCell(13).getNumericCellValue();
+				Object caltaxmny = sheet.getRow(i).getCell(12).getCellType() == 1 ? sheet.getRow(i).getCell(12).getStringCellValue() : sheet.getRow(i).getCell(12).getNumericCellValue();
 				//计税金额
 				cp.setBodyValueAt(caltaxmny,count, "caltaxmny");
 				//贷方原币无税金额
@@ -529,10 +527,10 @@ public class ImportBodyAction extends BodyAddLineAction{
 				//组织本币无税金额
 				cp.setBodyValueAt(caltaxmny,count, "local_notax_cr");
 				//税额
-				cp.setBodyValueAt(sheet.getRow(i).getCell(14).getCellType() == 1 ? sheet.getRow(i).getCell(14).getStringCellValue() : sheet.getRow(i).getCell(14).getNumericCellValue() ,count, "local_tax_cr");
+				cp.setBodyValueAt(sheet.getRow(i).getCell(13).getCellType() == 1 ? sheet.getRow(i).getCell(13).getStringCellValue() : sheet.getRow(i).getCell(13).getNumericCellValue() ,count, "local_tax_cr");
 				//民航发展基金
-				cp.setBodyValueAt(dateUnit(sheet, i, 15),count, "def29");
-				Object money_bal = sheet.getRow(i).getCell(16).getCellType() == 1 ? sheet.getRow(i).getCell(16).getStringCellValue() : sheet.getRow(i).getCell(16).getNumericCellValue();
+				cp.setBodyValueAt(dateUnit(sheet, i, 14),count, "def29");
+				Object money_bal = sheet.getRow(i).getCell(15).getCellType() == 1 ? sheet.getRow(i).getCell(15).getStringCellValue() : sheet.getRow(i).getCell(15).getNumericCellValue();
 				//原币余额
 				cp.setBodyValueAt(money_bal,count, "money_bal");
 				//组织本币余额
@@ -544,15 +542,24 @@ public class ImportBodyAction extends BodyAddLineAction{
 				//预占用原币余额
 				cp.setBodyValueAt(money_bal,count, "occupationmny");
 				//汇款附言
-				cp.setBodyValueAt(dateUnit(sheet, i, 17),count, "def21");
+				cp.setBodyValueAt(dateUnit(sheet, i, 16),count, "def21");
 				//成本归属部门
-				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(18).getStringCellValue(), pk_org,2),count, "def22");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(17).getStringCellValue(), pk_org,2),count, "def22");
 				//票据号/保理申请编号
-				cp.setBodyValueAt(dateUnit(sheet, i, 19), count, "def5");
+				cp.setBodyValueAt(dateUnit(sheet, i, 18), count, "def5");
 				//备注
-				cp.setBodyValueAt(dateUnit(sheet, i, 20), count, "def2");
+				cp.setBodyValueAt(dateUnit(sheet, i, 19), count, "def2");
 				//预算名称
-				cp.setBodyValueAt(sqlexecuteQuery("pk_inoutbusiclass", "bd_inoutbusiclass", "name", sheet.getRow(i).getCell(21).getStringCellValue(), null,2),count, "pk_subjcode");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_inoutbusiclass", "bd_inoutbusiclass", "name", sheet.getRow(i).getCell(20).getStringCellValue(), null,2),count, "pk_subjcode");
+				String pk_material = sqlexecuteQuery("pk_material", "bd_material", "name", sheet.getRow(i).getCell(21).getStringCellValue(), null, 2);
+				//物料
+				cp.setBodyValueAt(pk_material,count, "material");
+				//原始物料
+				cp.setBodyValueAt(pk_material,count, "material_src");
+				//含税单价
+				cp.setBodyValueAt(PayableBillItemVO.getTaxprice(),count, "taxprice");
+				//本币含税单价
+				cp.setBodyValueAt(PayableBillItemVO.getLocal_taxprice(),count, "local_taxprice");
 				//资产合同号
 				cp.setBodyValueAt(PayableBillItemVO.getAssetpactno(),count, "assetpactno");
 				//  资金计划项目
@@ -613,10 +620,6 @@ public class ImportBodyAction extends BodyAddLineAction{
 				cp.setBodyValueAt(PayableBillItemVO.getInnerorderno(),count, "innerorderno");
 				//  发票号
 				cp.setBodyValueAt(PayableBillItemVO.getInvoiceno(),count, "invoiceno");
-				//  物料
-				cp.setBodyValueAt(PayableBillItemVO.getMaterial(),count, "material");
-				//  原始物料
-				cp.setBodyValueAt(PayableBillItemVO.getMaterial_src(),count, "material_src");
 				//  不可抵扣税额
 				cp.setBodyValueAt(PayableBillItemVO.getNosubtax(),count, "nosubtax");
 				//  不可抵扣税率
@@ -823,12 +826,7 @@ public class ImportBodyAction extends BodyAddLineAction{
 				cp.setBodyValueAt(price,count, "price");
 				//本币单价
 				cp.setBodyValueAt(price,count, "local_price");
-				Object taxprice = sheet.getRow(i).getCell(9).getCellType() == 1 ? sheet.getRow(i).getCell(9).getStringCellValue() : sheet.getRow(i).getCell(9).getNumericCellValue();
-				//含税单价
-				cp.setBodyValueAt(taxprice,count, "taxprice");
-				//本币含税单价
-				cp.setBodyValueAt(taxprice,count, "local_taxprice");
-				Object caltaxmny = sheet.getRow(i).getCell(10).getCellType() == 1 ? sheet.getRow(i).getCell(10).getStringCellValue() : sheet.getRow(i).getCell(10).getNumericCellValue();
+				Object caltaxmny = sheet.getRow(i).getCell(9).getCellType() == 1 ? sheet.getRow(i).getCell(9).getStringCellValue() : sheet.getRow(i).getCell(9).getNumericCellValue();
 				//计税金额
 				cp.setBodyValueAt(caltaxmny,count, "caltaxmny");
 				//贷方原币无税金额
@@ -836,9 +834,9 @@ public class ImportBodyAction extends BodyAddLineAction{
 				//组织本币无税金额
 				cp.setBodyValueAt(caltaxmny,count, "local_notax_cr");
 				//税额
-				cp.setBodyValueAt(sheet.getRow(i).getCell(11).getCellType() == 1 ? sheet.getRow(i).getCell(11).getStringCellValue() : sheet.getRow(i).getCell(11).getNumericCellValue(),count, "local_tax_cr");
+				cp.setBodyValueAt(sheet.getRow(i).getCell(10).getCellType() == 1 ? sheet.getRow(i).getCell(10).getStringCellValue() : sheet.getRow(i).getCell(10).getNumericCellValue(),count, "local_tax_cr");
 				//原币余额
-				Object money_bal = sheet.getRow(i).getCell(12).getCellType() == 1 ? sheet.getRow(i).getCell(12).getStringCellValue() : sheet.getRow(i).getCell(12).getNumericCellValue();
+				Object money_bal = sheet.getRow(i).getCell(11).getCellType() == 1 ? sheet.getRow(i).getCell(11).getStringCellValue() : sheet.getRow(i).getCell(11).getNumericCellValue();
 				cp.setBodyValueAt(money_bal,count, "money_bal");
 				//组织本币余额
 				cp.setBodyValueAt(money_bal,count, "local_money_bal");
@@ -849,20 +847,24 @@ public class ImportBodyAction extends BodyAddLineAction{
 				//预占用原币余额
 				cp.setBodyValueAt(money_bal,count, "occupationmny");
 				//扣税类别
-				cp.setBodyValueAt("应税内含".equals(sheet.getRow(i).getCell(13).getStringCellValue()) ? 0 : 1,count, "taxtype");
+				cp.setBodyValueAt("应税内含".equals(sheet.getRow(i).getCell(12).getStringCellValue()) ? 0 : 1,count, "taxtype");
 				//成本归属部门
-				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(14).getStringCellValue(), pk_org,2),count, "def23");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(13).getStringCellValue(), pk_org,2),count, "def23");
 				//往来对象
-				Object objtype = dateUnit(sheet,i,15);
+				Object objtype = dateUnit(sheet,i,14);
 				cp.setBodyValueAt("供应商".equals(objtype) ? 1 : "部门".equals(objtype) ? 2 : 3,count, "objtype");
 				//备注
-				cp.setBodyValueAt(dateUnit(sheet,i,16),count, "def2");
+				cp.setBodyValueAt(dateUnit(sheet,i,15),count, "def2");
 				//对方单位名称
-				cp.setBodyValueAt(sqlexecuteQuery("pk_supplier", "bd_supplier", "name", sheet.getRow(i).getCell(17).getStringCellValue(), null, 2),count,"supplier");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_supplier", "bd_supplier", "name", sheet.getRow(i).getCell(16).getStringCellValue(), null, 2),count,"supplier");
 				//部门
-				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(18).getStringCellValue(), pk_org, 2),count, "pk_deptid");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(17).getStringCellValue(), pk_org, 2),count, "pk_deptid");
 				//部 门
-				cp.setBodyValueAt(sqlexecuteQuery("pk_vid", "org_dept_v", "name", sheet.getRow(i).getCell(18).getStringCellValue(), pk_org, 2),count, "pk_deptid_v");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_vid", "org_dept_v", "name", sheet.getRow(i).getCell(17).getStringCellValue(), pk_org, 2),count, "pk_deptid_v");
+				//含税单价
+				cp.setBodyValueAt(PayableBillItemVO.getTaxprice(),count, "taxprice");
+				//本币含税单价
+				cp.setBodyValueAt(PayableBillItemVO.getLocal_taxprice(),count, "local_taxprice");
 				//数量余额
 				cp.setBodyValueAt(PayableBillItemVO.getQuantity_bal(),count, "quantity_bal");
 				//贷方数量
@@ -1136,12 +1138,7 @@ public class ImportBodyAction extends BodyAddLineAction{
 				cp.setBodyValueAt(price,count, "price");
 				//本币单价
 				cp.setBodyValueAt(price,count, "local_price");
-				Object taxprice = sheet.getRow(i).getCell(11).getCellType() == 1 ? sheet.getRow(i).getCell(11).getStringCellValue() : sheet.getRow(i).getCell(11).getNumericCellValue();
-				//含税单价
-				cp.setBodyValueAt(taxprice,count, "taxprice");
-				//本币含税单价
-				cp.setBodyValueAt(taxprice,count, "local_taxprice");
-				Object caltaxmny = sheet.getRow(i).getCell(12).getCellType() == 1 ? sheet.getRow(i).getCell(12).getStringCellValue() : sheet.getRow(i).getCell(12).getNumericCellValue();
+				Object caltaxmny = sheet.getRow(i).getCell(11).getCellType() == 1 ? sheet.getRow(i).getCell(11).getStringCellValue() : sheet.getRow(i).getCell(11).getNumericCellValue();
 				//计税金额
 				cp.setBodyValueAt(caltaxmny,count, "caltaxmny");
 				//贷方原币无税金额
@@ -1149,8 +1146,8 @@ public class ImportBodyAction extends BodyAddLineAction{
 				//组织本币无税金额
 				cp.setBodyValueAt(caltaxmny,count, "local_notax_cr");
 				//税额
-				cp.setBodyValueAt(sheet.getRow(i).getCell(13).getCellType() == 1 ? sheet.getRow(i).getCell(13).getStringCellValue() : sheet.getRow(i).getCell(13).getNumericCellValue() ,count, "local_tax_cr");
-				Object money_bal = sheet.getRow(i).getCell(14).getCellType() == 1 ? sheet.getRow(i).getCell(14).getStringCellValue() : sheet.getRow(i).getCell(14).getNumericCellValue();
+				cp.setBodyValueAt(sheet.getRow(i).getCell(12).getCellType() == 1 ? sheet.getRow(i).getCell(12).getStringCellValue() : sheet.getRow(i).getCell(12).getNumericCellValue() ,count, "local_tax_cr");
+				Object money_bal = sheet.getRow(i).getCell(13).getCellType() == 1 ? sheet.getRow(i).getCell(13).getStringCellValue() : sheet.getRow(i).getCell(13).getNumericCellValue();
 				//原币余额
 				cp.setBodyValueAt(money_bal,count, "money_bal");
 				//组织本币余额
@@ -1162,18 +1159,22 @@ public class ImportBodyAction extends BodyAddLineAction{
 				//预占用原币余额
 				cp.setBodyValueAt(money_bal,count, "occupationmny");
 				//成本归属部门
-				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(15).getStringCellValue(), pk_org,2),count, "def22");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_dept", "org_dept", "name", sheet.getRow(i).getCell(14).getStringCellValue(), pk_org,2),count, "def22");
 				//扣税类别
-				cp.setBodyValueAt("应税内含".equals(sheet.getRow(i).getCell(16).getStringCellValue()) ? 0 : 1,count, "taxtype");
+				cp.setBodyValueAt("应税内含".equals(sheet.getRow(i).getCell(15).getStringCellValue()) ? 0 : 1,count, "taxtype");
 				//往来对象
-				Object objtype = dateUnit(sheet,i,17);
+				Object objtype = dateUnit(sheet,i,16);
 				cp.setBodyValueAt("供应商".equals(objtype) ? 1 : "部门".equals(objtype) ? 2 : 3,count, "objtype");
 				//对方单位名称
-				cp.setBodyValueAt(sqlexecuteQuery("pk_supplier", "bd_supplier", "name", sheet.getRow(i).getCell(18).getStringCellValue(), null, 2),count,"supplier");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_supplier", "bd_supplier", "name", sheet.getRow(i).getCell(17).getStringCellValue(), null, 2),count,"supplier");
 				//备注
-				cp.setBodyValueAt(dateUnit(sheet, i, 19), count, "def2");
+				cp.setBodyValueAt(dateUnit(sheet, i, 18), count, "def2");
 				//预算名称
-				cp.setBodyValueAt(sqlexecuteQuery("pk_inoutbusiclass", "bd_inoutbusiclass", "name", sheet.getRow(i).getCell(20).getStringCellValue(), null,2),count, "pk_subjcode");
+				cp.setBodyValueAt(sqlexecuteQuery("pk_inoutbusiclass", "bd_inoutbusiclass", "name", sheet.getRow(i).getCell(19).getStringCellValue(), null,2),count, "pk_subjcode");
+				//含税单价
+				cp.setBodyValueAt(PayableBillItemVO.getTaxprice(),count, "taxprice");
+				//本币含税单价
+				cp.setBodyValueAt(PayableBillItemVO.getLocal_taxprice(),count, "local_taxprice");
 				//数量余额
 				cp.setBodyValueAt(PayableBillItemVO.getQuantity_bal(),count, "quantity_bal");
 				//贷方数量
@@ -1493,16 +1494,16 @@ public class ImportBodyAction extends BodyAddLineAction{
 			int[] index = null;
 			if("应付单(非项目)".equals(type)) {
 				//需要校验的Excle下标
-				index = new int[]{0,1,2,3,4,5,6,7,8,10,11,12,13,21};
+				index = new int[]{0,1,2,3,4,5,6,7,8,10,11,12,20,21};
 			}else if("应付单(项目)".equals(type)){
 				//需要校验的Excle下标
-				index = new int[]{0,1,2,3,4,5,6,7,8,9,10,12,13,14,16,18,21};
+				index = new int[]{0,1,2,3,4,5,6,7,8,9,10,12,13,15,17,20,21};
 			}else if("预付核销单(非项目)".equals(type)){
 				//需要校验的Excle下标
-				index = new int[]{0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,17,18,19};
+				index = new int[]{0,1,2,3,4,5,6,7,9,10,11,12,13,14,16,17,18};
 			}else {
 				//需要校验的Excle下标
-				index = new int[]{0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,20,21};
+				index = new int[]{0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,19,20};
 			}
 			for (int j = 0; j < index.length; j++) {
 				if(sheet.getRow(i).getCell(index[j])!= null) {

+ 59 - 62
arap/arap/src/client/nc/ui/arap/actions/OutputBodyAction.java

@@ -25,7 +25,11 @@ import nc.ui.arap.view.ArapBillCardForm;
 import nc.ui.pub.bill.BillCardPanel;
 import nc.ui.pubapp.uif2app.actions.BodyAddLineAction;
 
-
+/**
+ * 导出
+ * @author YY
+ *
+ */
 public class OutputBodyAction extends BodyAddLineAction{
 	private static final long serialVersionUID = 3494691988068685023L;
 	private ArapBillCardForm editorModel;
@@ -56,9 +60,6 @@ public class OutputBodyAction extends BodyAddLineAction{
 	public void doAction(ActionEvent e) throws Exception {
 		//只有应付单(非项目) 应付单(项目)可以使用
 		String type = sqlexecuteQuery("billtypename", "bd_billtype", "pk_billtypeid", this.editorModel.getBillCardPanel().getHeadItem("pk_tradetypeid").getValueObject().toString());		
-//		if(!"应付单(非项目)".equals(type) && !"应付单(项目)".equals(type)) {
-//			return;
-//		}
 		if(!"应付单(非项目)".equals(type) && !"应付单(项目)".equals(type) && !"预付核销单(非项目)".equals(type) && !"预付核销单(项目)".equals(type)) {
 			return;
 		}
@@ -116,8 +117,8 @@ public class OutputBodyAction extends BodyAddLineAction{
 		int count = cp.getRowCount();
 		if("应付单(非项目)".equals(type)) {
 			//非项目导出模板
-			createRowAndCells(sheet, 1, "摘要*", "费用归属*", "预算编号","预算名称*","发票号*","数量*","结算方式*","税码*","税率*","单价","含税单价*","金额*","税额*","价税合计*","民航发展基金",
-					"汇款附言","客户","客户层级","原发票日期yyyy-mm-dd hh:mm:ss","备注","人员","成本归属部门*");  
+			createRowAndCells(sheet, 1, "摘要*", "费用归属*", "预算编号*","预算名称*","发票号*","数量*","结算方式*","税码*","税率*","单价","金额*","税额*","价税合计*","民航发展基金",
+					"汇款附言","客户","客户层级","原发票日期yyyy-mm-dd hh:mm:ss","备注","人员","成本归属部门*","物料*");  
 			
 			for (int i = 0; i < count; i++) {
 				Row rows = sheet.createRow(i+2); 
@@ -141,36 +142,36 @@ public class OutputBodyAction extends BodyAddLineAction{
 		        rows.createCell(8).setCellValue(cp.getBodyValueAt(i, "taxrate") == null ? null : cp.getBodyValueAt(i, "taxrate").toString());
 		        //单价
 		        rows.createCell(9).setCellValue(cp.getBodyValueAt(i, "price") == null ? null : cp.getBodyValueAt(i, "price").toString());
-		        //含税单价
-		        rows.createCell(10).setCellValue(cp.getBodyValueAt(i, "taxprice") == null ? null : cp.getBodyValueAt(i, "taxprice").toString());
 		        //金额
-		        rows.createCell(11).setCellValue(cp.getBodyValueAt(i, "local_notax_cr") == null ? null : cp.getBodyValueAt(i, "local_notax_cr").toString());
+		        rows.createCell(10).setCellValue(cp.getBodyValueAt(i, "local_notax_cr") == null ? null : cp.getBodyValueAt(i, "local_notax_cr").toString());
 		        //税额
-		        rows.createCell(12).setCellValue(cp.getBodyValueAt(i, "local_tax_cr") == null ? null : cp.getBodyValueAt(i, "local_tax_cr").toString());
+		        rows.createCell(11).setCellValue(cp.getBodyValueAt(i, "local_tax_cr") == null ? null : cp.getBodyValueAt(i, "local_tax_cr").toString());
 		        //价税合计
-		        rows.createCell(13).setCellValue(cp.getBodyValueAt(i, "local_money_cr") == null ? null : cp.getBodyValueAt(i, "local_money_cr").toString());
+		        rows.createCell(12).setCellValue(cp.getBodyValueAt(i, "local_money_cr") == null ? null : cp.getBodyValueAt(i, "local_money_cr").toString());
 		        //民航发展基金
-		        rows.createCell(14).setCellValue(cp.getBodyValueAt(i, "def29") == null ? null : cp.getBodyValueAt(i, "def29").toString());
+		        rows.createCell(13).setCellValue(cp.getBodyValueAt(i, "def29") == null ? null : cp.getBodyValueAt(i, "def29").toString());
 		        //汇款附言
-		        rows.createCell(15).setCellValue(cp.getBodyValueAt(i, "def21") == null ? null : cp.getBodyValueAt(i, "def21").toString());
+		        rows.createCell(14).setCellValue(cp.getBodyValueAt(i, "def21") == null ? null : cp.getBodyValueAt(i, "def21").toString());
 		        //客户
-		        rows.createCell(16).setCellValue(getBodyValueAt(cp, i, "def13", "name", "bd_defdoc", "pk_defdoc"));
+		        rows.createCell(15).setCellValue(getBodyValueAt(cp, i, "def13", "name", "bd_defdoc", "pk_defdoc"));
 		        //客户层级
-		        rows.createCell(17).setCellValue(cp.getBodyValueAt(i, "def22") == null ? null : cp.getBodyValueAt(i, "def22").toString());
+		        rows.createCell(16).setCellValue(cp.getBodyValueAt(i, "def22") == null ? null : cp.getBodyValueAt(i, "def22").toString());
 		        //原发票日期
-		        rows.createCell(18).setCellValue(cp.getBodyValueAt(i, "def17") == null ? null : cp.getBodyValueAt(i, "def17").toString());
+		        rows.createCell(17).setCellValue(cp.getBodyValueAt(i, "def17") == null ? null : cp.getBodyValueAt(i, "def17").toString());
 		        //备注
-		        rows.createCell(19).setCellValue(cp.getBodyValueAt(i, "def2") == null ? null : cp.getBodyValueAt(i, "def2").toString());
+		        rows.createCell(18).setCellValue(cp.getBodyValueAt(i, "def2") == null ? null : cp.getBodyValueAt(i, "def2").toString());
 		        //人员
-		        rows.createCell(20).setCellValue(cp.getBodyValueAt(i, "def40") == null ? null : cp.getBodyValueAt(i, "def40").toString());
+		        rows.createCell(19).setCellValue(cp.getBodyValueAt(i, "def40") == null ? null : cp.getBodyValueAt(i, "def40").toString());
 		        //成本归属部门
-		        rows.createCell(21).setCellValue(getBodyValueAt(cp, i, "def23", "name", "org_dept", "pk_dept"));
+		        rows.createCell(20).setCellValue(getBodyValueAt(cp, i, "def23", "name", "org_dept", "pk_dept"));
+		        //物料
+		        rows.createCell(21).setCellValue(getBodyValueAt(cp, i, "material", "name", "bd_material", "pk_material"));
 		        
 			}
 		}else if("应付单(项目)".equals(type)){
 			//项目导出模板
-			createRowAndCells(sheet, 1, "摘要*", "费用归属*", "项目编号*","项目名称*","专业*","费用事项*","发票号*","数量*","税码*","税率*","结算方式*","单价","含税单价*","金额*","税额*","民航发展基金",
-					"价税合计*","汇款附言","成本归属部门*","票据号/保理申请编号","备注","预算名称*");  
+			createRowAndCells(sheet, 1, "摘要*", "费用归属*", "项目编号*","项目名称*","专业*","费用事项*","发票号*","数量*","税码*","税率*","结算方式*","单价","金额*","税额*","民航发展基金",
+					"价税合计*","汇款附言","成本归属部门*","票据号/保理申请编号","备注","预算名称*","物料*");  
 			for (int i = 0; i < count; i++) {
 				Row rows = sheet.createRow(i+2); 
 				//摘要
@@ -186,7 +187,7 @@ public class OutputBodyAction extends BodyAddLineAction{
 		        //费用事项
 		        rows.createCell(5).setCellValue(getBodyValueAt(cp, i, "def7", "name", "bd_defdoc", "pk_defdoc"));
 		        //发票号
-		        rows.createCell(6).setCellValue(cp.getBodyValueAt(i, "def12").toString());
+		        rows.createCell(6).setCellValue(cp.getBodyValueAt(i, "def12") == null ? null : cp.getBodyValueAt(i, "def12").toString());
 		        //数量
 		        rows.createCell(7).setCellValue(cp.getBodyValueAt(i, "quantity_cr") == null ? null : cp.getBodyValueAt(i, "quantity_cr").toString());
 		        //税码
@@ -197,30 +198,30 @@ public class OutputBodyAction extends BodyAddLineAction{
 		        rows.createCell(10).setCellValue(getBodyValueAt(cp, i, "pk_balatype", "name", "bd_balatype", "pk_balatype"));
 		        //单价
 		        rows.createCell(11).setCellValue(cp.getBodyValueAt(i, "price") == null ? null : cp.getBodyValueAt(i, "price").toString());
-		        //含税单价
-		        rows.createCell(12).setCellValue(cp.getBodyValueAt(i, "taxprice") == null ? null : cp.getBodyValueAt(i, "taxprice").toString());
 		        //金额
-		        rows.createCell(13).setCellValue(cp.getBodyValueAt(i, "local_notax_cr") == null ? null : cp.getBodyValueAt(i, "local_notax_cr").toString());
+		        rows.createCell(12).setCellValue(cp.getBodyValueAt(i, "local_notax_cr") == null ? null : cp.getBodyValueAt(i, "local_notax_cr").toString());
 		        //税额
-		        rows.createCell(14).setCellValue(cp.getBodyValueAt(i, "local_tax_cr") == null ? null : cp.getBodyValueAt(i, "local_tax_cr").toString());
+		        rows.createCell(13).setCellValue(cp.getBodyValueAt(i, "local_tax_cr") == null ? null : cp.getBodyValueAt(i, "local_tax_cr").toString());
 		        //民航发展基金
-		        rows.createCell(15).setCellValue(cp.getBodyValueAt(i, "def29") == null ? null : cp.getBodyValueAt(i, "def29").toString());
+		        rows.createCell(14).setCellValue(cp.getBodyValueAt(i, "def29") == null ? null : cp.getBodyValueAt(i, "def29").toString());
 		        //价税合计
-		        rows.createCell(16).setCellValue(cp.getBodyValueAt(i, "local_money_cr") == null ? null : cp.getBodyValueAt(i, "local_money_cr").toString());
+		        rows.createCell(15).setCellValue(cp.getBodyValueAt(i, "local_money_cr") == null ? null : cp.getBodyValueAt(i, "local_money_cr").toString());
 		        //汇款附言
-		        rows.createCell(17).setCellValue(cp.getBodyValueAt(i, "def21") == null ? null : cp.getBodyValueAt(i, "def21").toString());
+		        rows.createCell(16).setCellValue(cp.getBodyValueAt(i, "def21") == null ? null : cp.getBodyValueAt(i, "def21").toString());
 		        //成本归属部门
-		        rows.createCell(18).setCellValue(getBodyValueAt(cp, i, "def22", "name", "org_dept", "pk_dept"));
+		        rows.createCell(17).setCellValue(getBodyValueAt(cp, i, "def22", "name", "org_dept", "pk_dept"));
 		        //票据号/保理申请编号
-		        rows.createCell(19).setCellValue(cp.getBodyValueAt(i, "def5") == null ? null : cp.getBodyValueAt(i, "def5").toString());
+		        rows.createCell(18).setCellValue(cp.getBodyValueAt(i, "def5") == null ? null : cp.getBodyValueAt(i, "def5").toString());
 		        //备注
-		        rows.createCell(20).setCellValue(cp.getBodyValueAt(i, "def2") == null ? null : cp.getBodyValueAt(i, "def2").toString());
+		        rows.createCell(19).setCellValue(cp.getBodyValueAt(i, "def2") == null ? null : cp.getBodyValueAt(i, "def2").toString());
 		        //预算名称
-		        rows.createCell(21).setCellValue(getBodyValueAt(cp, i, "pk_subjcode", "name", "bd_inoutbusiclass", "pk_inoutbusiclass"));
+		        rows.createCell(20).setCellValue(getBodyValueAt(cp, i, "pk_subjcode", "name", "bd_inoutbusiclass", "pk_inoutbusiclass"));
+		        //物料
+		        rows.createCell(21).setCellValue(getBodyValueAt(cp, i, "material", "name", "bd_material", "pk_material"));
 			}
 		}else if("预付核销单(非项目)".equals(type)){
 			//项目导出模板
-			createRowAndCells(sheet,1,"摘要*","费用归属*","预算编号*","预算名称*","发票号*","物料*","税码*","税率*","单价","含税单价*","金额*","税额*","价税合计*","扣税类别*",
+			createRowAndCells(sheet,1,"摘要*","费用归属*","预算编号*","预算名称*","发票号*","物料*","税码*","税率*","单价","金额*","税额*","价税合计*","扣税类别*",
 					"成本归属部门*","往来对象*","备注","对方单位名称*","付款部门*","应付类型*");
 			for (int i = 0; i < count; i++) {
 				Row rows = sheet.createRow(i+2);
@@ -242,34 +243,32 @@ public class OutputBodyAction extends BodyAddLineAction{
 		        rows.createCell(7).setCellValue(cp.getBodyValueAt(i, "taxrate") == null ? null : cp.getBodyValueAt(i, "taxrate").toString());
 		        //单价
 		        rows.createCell(8).setCellValue(cp.getBodyValueAt(i, "price") == null ? null : cp.getBodyValueAt(i, "price").toString());
-		        //含税单价
-		        rows.createCell(9).setCellValue(cp.getBodyValueAt(i, "taxprice") == null ? null : cp.getBodyValueAt(i, "taxprice").toString());
 		        //金额
-		        rows.createCell(10).setCellValue(cp.getBodyValueAt(i, "local_notax_cr") == null ? null : cp.getBodyValueAt(i, "local_notax_cr").toString());
+		        rows.createCell(9).setCellValue(cp.getBodyValueAt(i, "local_notax_cr") == null ? null : cp.getBodyValueAt(i, "local_notax_cr").toString());
 		        //税额
-		        rows.createCell(11).setCellValue(cp.getBodyValueAt(i, "local_tax_cr") == null ? null : cp.getBodyValueAt(i, "local_tax_cr").toString());
+		        rows.createCell(10).setCellValue(cp.getBodyValueAt(i, "local_tax_cr") == null ? null : cp.getBodyValueAt(i, "local_tax_cr").toString());
 		        //价税合计
-		        rows.createCell(12).setCellValue(cp.getBodyValueAt(i, "local_money_cr") == null ? null : cp.getBodyValueAt(i, "local_money_cr").toString());
+		        rows.createCell(11).setCellValue(cp.getBodyValueAt(i, "local_money_cr") == null ? null : cp.getBodyValueAt(i, "local_money_cr").toString());
 		        //扣税类别
-		        rows.createCell(13).setCellValue("0".equals(cp.getBodyValueAt(i, "taxtype").toString()) ? "应税内含" : "应税外加");
+		        rows.createCell(12).setCellValue("0".equals(cp.getBodyValueAt(i, "taxtype").toString()) ? "应税内含" : "应税外加");
 		        //成本归属部门
-		        rows.createCell(14).setCellValue(getBodyValueAt(cp, i, "def23", "name", "org_dept", "pk_dept"));
+		        rows.createCell(13).setCellValue(getBodyValueAt(cp, i, "def23", "name", "org_dept", "pk_dept"));
 		        //往来对象
 		        int objtype = (Integer) (cp.getBodyValueAt(i, "objtype")  == null ? -1 : cp.getBodyValueAt(i, "objtype"));
-		        rows.createCell(15).setCellValue(objtype == 1 ? "供应商" : objtype == 2 ? "部门" : objtype == 3 ? "业务员" : null);
+		        rows.createCell(14).setCellValue(objtype == 1 ? "供应商" : objtype == 2 ? "部门" : objtype == 3 ? "业务员" : null);
 		        //备注
-		        rows.createCell(16).setCellValue(cp.getBodyValueAt(i, "def2") == null ? null : cp.getBodyValueAt(i, "def2").toString());
+		        rows.createCell(15).setCellValue(cp.getBodyValueAt(i, "def2") == null ? null : cp.getBodyValueAt(i, "def2").toString());
 		        //对方单位名称
-		        rows.createCell(17).setCellValue(getBodyValueAt(cp, i, "supplier", "name", "bd_supplier", "pk_supplier"));
+		        rows.createCell(16).setCellValue(getBodyValueAt(cp, i, "supplier", "name", "bd_supplier", "pk_supplier"));
 		        //付款部门
-		        rows.createCell(18).setCellValue(getBodyValueAt(cp, i, "pk_deptid", "name", "org_dept", "pk_dept"));
+		        rows.createCell(17).setCellValue(getBodyValueAt(cp, i, "pk_deptid", "name", "org_dept", "pk_dept"));
 		        //应付类型
-		        rows.createCell(19).setCellValue(getBodyValueAt(cp, i, "pk_tradetypeid", "billtypename", "bd_billtype", "pk_billtypeid"));
+		        rows.createCell(18).setCellValue(getBodyValueAt(cp, i, "pk_tradetypeid", "billtypename", "bd_billtype", "pk_billtypeid"));
 		        
 			}
 		}else {
 			//项目导出模板
-			createRowAndCells(sheet,1,"摘要*","费用归属*","项目编号*","项目名称*","专业*","费用事项*","发票号*","物料*","税码*","税率*","单价","含税单价*","金额*","税额*",
+			createRowAndCells(sheet,1,"摘要*","费用归属*","项目编号*","项目名称*","专业*","费用事项*","发票号*","物料*","税码*","税率*","单价","金额*","税额*",
 					"价税合计*","成本归属部门*","扣税类别*","往来对象*","对方单位名称*","备注","预算名称*","应付类型*");  
 			for (int i = 0; i < count; i++) {
 				Row rows = sheet.createRow(i+2);
@@ -285,8 +284,8 @@ public class OutputBodyAction extends BodyAddLineAction{
 		        rows.createCell(4).setCellValue(getBodyValueAt(cp, i, "def6", "name", "bd_defdoc", "pk_defdoc"));
 		        //费用事项
 		        rows.createCell(5).setCellValue(getBodyValueAt(cp, i, "def7", "name", "bd_defdoc", "pk_defdoc"));
-		     	//发票号
-		        rows.createCell(6).setCellValue(cp.getBodyValueAt(i, "def12").toString());
+		        //发票号
+		        rows.createCell(6).setCellValue(cp.getBodyValueAt(i, "def12") == null ? null : cp.getBodyValueAt(i, "def12").toString());
 		        //物料
 		        rows.createCell(7).setCellValue(getBodyValueAt(cp, i, "material", "name", "bd_material", "pk_material"));
 		        //税码
@@ -295,29 +294,27 @@ public class OutputBodyAction extends BodyAddLineAction{
 		        rows.createCell(9).setCellValue(cp.getBodyValueAt(i, "taxrate") == null ? null : cp.getBodyValueAt(i, "taxrate").toString());
 		        //单价
 		        rows.createCell(10).setCellValue(cp.getBodyValueAt(i, "price") == null ? null : cp.getBodyValueAt(i, "price").toString());
-		        //含税单价
-		        rows.createCell(11).setCellValue(cp.getBodyValueAt(i, "taxprice") == null ? null : cp.getBodyValueAt(i, "taxprice").toString());
-		        //金额
-		        rows.createCell(12).setCellValue(cp.getBodyValueAt(i, "local_notax_cr") == null ? null : cp.getBodyValueAt(i, "local_notax_cr").toString());
+		         //金额
+		        rows.createCell(11).setCellValue(cp.getBodyValueAt(i, "local_notax_cr") == null ? null : cp.getBodyValueAt(i, "local_notax_cr").toString());
 		        //税额
-		        rows.createCell(13).setCellValue(cp.getBodyValueAt(i, "local_tax_cr") == null ? null : cp.getBodyValueAt(i, "local_tax_cr").toString());
+		        rows.createCell(12).setCellValue(cp.getBodyValueAt(i, "local_tax_cr") == null ? null : cp.getBodyValueAt(i, "local_tax_cr").toString());
 		        //价税合计
-		        rows.createCell(14).setCellValue(cp.getBodyValueAt(i, "local_money_cr") == null ? null : cp.getBodyValueAt(i, "local_money_cr").toString());
+		        rows.createCell(13).setCellValue(cp.getBodyValueAt(i, "local_money_cr") == null ? null : cp.getBodyValueAt(i, "local_money_cr").toString());
 		        //成本归属部门
-		        rows.createCell(15).setCellValue(getBodyValueAt(cp, i, "def22", "name", "org_dept", "pk_dept"));
+		        rows.createCell(14).setCellValue(getBodyValueAt(cp, i, "def22", "name", "org_dept", "pk_dept"));
 		        //扣税类别
-		        rows.createCell(16).setCellValue("0".equals(cp.getBodyValueAt(i, "taxtype").toString()) ? "应税内含" : "应税外加");
+		        rows.createCell(15).setCellValue("0".equals(cp.getBodyValueAt(i, "taxtype").toString()) ? "应税内含" : "应税外加");
 		        //往来对象
 		        int objtype = (Integer) (cp.getBodyValueAt(i, "objtype")  == null ? -1 : cp.getBodyValueAt(i, "objtype"));
-		        rows.createCell(17).setCellValue(objtype == 1 ? "供应商" : objtype == 2 ? "部门" : objtype == 3 ? "业务员" : null);
+		        rows.createCell(16).setCellValue(objtype == 1 ? "供应商" : objtype == 2 ? "部门" : objtype == 3 ? "业务员" : null);
 		        //对方单位名称
-		        rows.createCell(18).setCellValue(getBodyValueAt(cp, i, "supplier", "name", "bd_supplier", "pk_supplier"));
+		        rows.createCell(17).setCellValue(getBodyValueAt(cp, i, "supplier", "name", "bd_supplier", "pk_supplier"));
 		        //备注
-		        rows.createCell(19).setCellValue(cp.getBodyValueAt(i, "def2") == null ? null : cp.getBodyValueAt(i, "def2").toString());
+		        rows.createCell(18).setCellValue(cp.getBodyValueAt(i, "def2") == null ? null : cp.getBodyValueAt(i, "def2").toString());
 		        //预算名称
-		        rows.createCell(20).setCellValue(getBodyValueAt(cp, i, "pk_subjcode", "name", "bd_inoutbusiclass", "pk_inoutbusiclass"));
+		        rows.createCell(19).setCellValue(getBodyValueAt(cp, i, "pk_subjcode", "name", "bd_inoutbusiclass", "pk_inoutbusiclass"));
 		        //应付类型
-		        rows.createCell(21).setCellValue(getBodyValueAt(cp, i, "pk_tradetypeid", "billtypename", "bd_billtype", "pk_billtypeid"));
+		        rows.createCell(20).setCellValue(getBodyValueAt(cp, i, "pk_tradetypeid", "billtypename", "bd_billtype", "pk_billtypeid"));
 			}
 		}
 	}

+ 1 - 1
arap/arap/src/client/nc/ui/arap/view/ArapBillListView.java

@@ -125,7 +125,7 @@ public class ArapBillListView extends ShowUpableBillListView {
 		
 		//处理特殊字段, 摘要
 		loadSpecialItem(null);
-		//2023/10/12 YY 添加超链接监听
+		//2023/10/12 YY 添加列表超链接监听
 		String tableName = bodyItem.getTableName();
 		if("应付单行".equals(tableName)) {
 			if(getBillListPanel().getBodyItem("def41") != null){

+ 4 - 22
arap/arap/src/private/nc/bs/arap/busireg/InitCloseCtrlListener.java

@@ -8,40 +8,22 @@ import nc.bs.businessevent.IBusinessListener;
 import nc.bs.framework.common.NCLocator;
 import nc.itf.uap.IUAPQueryBS;
 import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.jdbc.framework.processor.MapProcessor;
+import nc.vo.arap.payable.PayableBillItemVO;
 import nc.vo.pub.AggregatedValueObject;
 import nc.vo.pub.BusinessException;
 import nc.vo.pub.lang.UFDouble;
 
+import java.util.Map;
+
 import org.apache.commons.lang.ArrayUtils;
 
 public class InitCloseCtrlListener implements IBusinessListener {
 	
-	private IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
 	public void doAction(IBusinessEvent event) throws BusinessException {
 		if ("1001".equals(event.getEventType()) || "1003".equals(event.getEventType())
 				|| "1005".equals(event.getEventType())) {
 			AggregatedValueObject[] obills = this.getBills(event);
-			for (int i = 0; i < obills.length; i++) {
-				String pk_tradetypeid = (String) obills[i].getParentVO().getAttributeValue("pk_tradetypeid");
-				String sql = "select pk_billtypecode from bd_billtype where pk_billtypeid = '"+pk_tradetypeid+"'";
-				String type = (String) iuap.executeQuery(sql, new ColumnProcessor());
-				//2023/10/11 YY 校验应付单金额与采购发票是否一致
-				if("F1-Cxx-02".equals(type) || "D1".equals(type) || "F1-Cxx-04".equals(type) || "F1-Cxx-05".equals(type)) {
-					//价税合计
-					UFDouble local_money = (UFDouble) obills[i].getParentVO().getAttributeValue("local_money");
-					//上层单据主键
-					String top_billid = (String) obills[i].getChildrenVO()[0].getAttributeValue("top_billid");
-					if(top_billid != null) {
-						String sql1 = "select ntotalorigmny from po_invoice where pk_invoice = '"+top_billid+"' and nvl(dr,0)=0";
-						Object object = (Object) iuap.executeQuery(sql1, new ColumnProcessor());
-						UFDouble ntotalorigmny = new UFDouble(object.toString());
-						if(local_money.compareTo(new UFDouble(ntotalorigmny)) != 0) {
-							throw new BusinessException("与采购发票价税金额不一致!");
-						}
-					}
-				}
-			}
-			
 			if (!ArrayUtils.isEmpty(obills)) {
 				(new InitCloseCtrlBO()).checkIsInitClose(obills[0]);
 			}

+ 78 - 2
arap/arap/src/public/nc/bs/arap/actions/BillUpdateBatchBSAction.java

@@ -1,5 +1,6 @@
 package nc.bs.arap.actions;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -23,19 +24,27 @@ import nc.bs.businessevent.BdUpdateEvent;
 import nc.bs.businessevent.BusinessEvent;
 import nc.bs.businessevent.EventDispatcher;
 import nc.bs.businessevent.IEventType;
+import nc.bs.dao.BaseDAO;
+import nc.bs.framework.common.NCLocator;
 import nc.bs.pf.pub.PfDataCache;
 import nc.impl.pubapp.env.BSContext;
 import nc.itf.arap.fieldmap.IBillFieldGet;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.processor.BeanProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.jdbc.framework.processor.MapProcessor;
 import nc.pubitf.para.SysInitQuery;
 import nc.vo.arap.basebill.BaseAggVO;
 import nc.vo.arap.basebill.BaseBillVO;
 import nc.vo.arap.basebill.BaseItemVO;
 import nc.vo.arap.pay.PayBillVO;
+import nc.vo.arap.payable.PayableBillItemVO;
 import nc.vo.arap.pub.ArapConstant;
 import nc.vo.arap.pub.BillEnumCollection;
 import nc.vo.arap.pub.BillEnumCollection.BillSatus;
 import nc.vo.arap.pub.BillEnumCollection.FromSystem;
 import nc.vo.arap.sysinit.SysinitConst;
+import nc.vo.arap.termitem.TermVO;
 import nc.vo.arap.utils.StringUtil;
 import nc.vo.ml.NCLangRes4VoTransl;
 import nc.vo.pub.AggregatedValueObject;
@@ -147,7 +156,9 @@ public abstract class BillUpdateBatchBSAction extends UpdateBatchBSAction {
 
 	@Override
 	protected void doAfterUpdate(AggregatedValueObject[] bills, AggregatedValueObject[] orginBills) throws BusinessException {
-
+		IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
+		String sqlterm = "select * from arap_termitem where pk_bill='"+bills[0].getParentVO().getAttributeValue("pk_payablebill")+"'";
+		TermVO termVO = (TermVO) iuap.executeQuery(sqlterm, new BeanProcessor(TermVO.class));
 		// 修改保存所涉及的4中状态vo
 		BillTermUtils.dealBillTerm(bills, childvostatmap, orginBills);
 		BillTermUtils.retBodyTermVOS(bills);
@@ -155,6 +166,72 @@ public abstract class BillUpdateBatchBSAction extends UpdateBatchBSAction {
 		BillBankUtils.fillSettleBankrelated_code(bills);
 		// 录入业务日志
 		ArapBusiLogUtils.insertSmartBusiLogs(ArapConstant.ARAP_ACTION_EDIT, (BaseAggVO) bills[0], (BaseAggVO) orginBills[0], ArapConstant.SYS_NAME);
+		String top_billid = (String) bills[0].getChildrenVO()[0].getAttributeValue("top_billid");
+		if(top_billid != null) {
+			//String pk_tradetypeid = (String) bills[0].getParentVO().getAttributeValue("pk_tradetypeid");
+			//String sql = "select pk_billtypecode from bd_billtype where pk_billtypeid = '"+pk_tradetypeid+"'";
+			//String type = (String) iuap.executeQuery(sql, new ColumnProcessor());
+			//2023/10/11 YY 校验应付单金额与采购发票是否一致
+			String pk_billtype = (String) bills[0].getParentVO().getAttributeValue("pk_billtype");
+			//if("F1-Cxx-02".equals(type) || "D1".equals(type) || "F1-Cxx-04".equals(type) || "F1-Cxx-05".equals(type)) {
+			if("F1".equals(pk_billtype)) {
+				PayableBillItemVO[] payableBillItemVO = (PayableBillItemVO[]) bills[0].getChildrenVO();
+				for (int j = 0; j < payableBillItemVO.length; j++) {
+					String def12 = payableBillItemVO[j].getDef12();
+					//没有发票号的行不进行金额校验
+					if(def12 != null) {
+						//金额
+						UFDouble local_notax_cr = new UFDouble(0.00);
+						//税额
+						UFDouble local_tax_cr = new UFDouble(0.00);
+						//价税合计
+						UFDouble local_money_cr = new UFDouble(0.00);
+						for (int x = 0; x < payableBillItemVO.length; x++) {							
+							//取相应发票金额合计
+							if(def12.equals(payableBillItemVO[x].getDef12())) {
+								UFDouble notax_cr = payableBillItemVO[x].getLocal_notax_cr();
+								UFDouble tax_cr = payableBillItemVO[x].getLocal_tax_cr();
+								UFDouble money_cr = payableBillItemVO[x].getLocal_money_cr();
+								local_notax_cr = local_notax_cr.add(notax_cr);
+								local_tax_cr = local_tax_cr.add(tax_cr);
+								local_money_cr = local_money_cr.add(money_cr);
+							}
+						}
+						String sql1 = "select nmny,ntax,norigtaxmny from po_invoice_b where pk_invoice = (select pk_invoice from po_invoice where pk_invoice = '"+top_billid+"' and nvl(dr,0) = 0 ) and vbdef12 ='"+def12+"' and nvl(dr,0) = 0";
+						Map<Object,Object> map = (Map<Object, Object>) iuap.executeQuery(sql1, new MapProcessor());
+						//金额
+						UFDouble nmny = new UFDouble(map.get("nmny").toString());
+						//税额
+						UFDouble ntax = new UFDouble(map.get("ntax").toString());
+						//价税合计
+						UFDouble ntotalorigmny = new UFDouble(map.get("norigtaxmny").toString());
+						if(local_notax_cr.compareTo(new UFDouble(nmny)) != 0) {
+						throw new BusinessException("发票号:"+def12+"与采购发票金额不一致!");
+						}
+						if(local_tax_cr.compareTo(new UFDouble(ntax)) != 0) {
+						throw new BusinessException("发票号:"+def12+"与采购发票税额不一致!");
+						}
+						if(local_money_cr.compareTo(new UFDouble(ntotalorigmny)) != 0) {
+						throw new BusinessException("发票号:"+def12+"与采购发票价税合计不一致!");
+						}
+						if(payableBillItemVO[j].getTerm() == null) {
+							termVO.setPk_item(payableBillItemVO[j].getPk_payableitem());
+							termVO.setLocal_money_bal(payableBillItemVO[j].getLocal_money_cr());
+							termVO.setLocal_money_cr(payableBillItemVO[j].getLocal_money_cr());
+							termVO.setMoney_bal(payableBillItemVO[j].getLocal_money_cr());
+							termVO.setMoney_cr(payableBillItemVO[j].getLocal_money_cr());
+							termVO.setOccupationmny(payableBillItemVO[j].getLocal_money_cr());
+							termVO.setQuantity_bal(payableBillItemVO[j].getQuantity_cr());
+							termVO.setQuantity_cr(payableBillItemVO[j].getQuantity_cr());
+							List<TermVO> termList = new ArrayList<TermVO>();
+							termList.add(termVO);
+							(new BaseDAO()).insertVOList(termList);
+							payableBillItemVO[j].setTerm(new TermVO[] {termVO});
+						}
+					}
+				}
+			}
+		}
 	}
 
 	@Override
@@ -296,7 +373,6 @@ public abstract class BillUpdateBatchBSAction extends UpdateBatchBSAction {
 								IBillFieldGet.RECACCOUNT,
 								IBillFieldGet.MATCUSTCODE };
 					}
-					 
 					String[] s2 = new String[] {
 							nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001935")/* @res "往来对象" */,
 							nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("common", "UC000-0001755")/* @res "币种" */,

+ 35 - 29
pu/pu/src/client/nc/ui/pub/bill/LinkHyperListener.java

@@ -1,29 +1,35 @@
-package nc.ui.pub.bill;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import nc.sfbase.client.ClientToolKit;
-
-public class LinkHyperListener implements BillItemHyperlinkListener{
-
-	private BillCardPanel billCardPanel;
-	
-	public LinkHyperListener(BillCardPanel billCardPanel) {
-        this.billCardPanel = billCardPanel;
-    }
-	
-	@Override
-	public void hyperlink(BillItemHyperlinkEvent event) {
-		// TODO 自动生成的方法存根
-		if ("vbdef11".equals(event.getItem().getKey())) {
-			String val = event.getValue().toString();
-			try {
-				ClientToolKit.showDocument(new URL(val), "_blank");
-			} catch (MalformedURLException e) {
-				// TODO 自动生成的 catch 块
-				e.printStackTrace();
-			}
-		}
-	}
-
-}
+package nc.ui.pub.bill;
+import java.net.URL;
+
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.framework.common.NCLocator;
+import nc.itf.th.IThOcrService;
+import nc.sfbase.client.ClientToolKit;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+
+public class LinkHyperListener implements BillItemHyperlinkListener{
+
+	private BillCardPanel billCardPanel;
+	private String billmaker = InvocationInfoProxy.getInstance().getUserId();
+	public LinkHyperListener(BillCardPanel billCardPanel) {
+        this.billCardPanel = billCardPanel;
+    }
+	
+	@Override
+	public void hyperlink(BillItemHyperlinkEvent event) {
+		try {
+			if ("vbdef11".equals(event.getItem().getKey())) {
+				String val = event.getValue().toString();
+				if(val.indexOf("mypiaojia") != -1){
+					IThOcrService  ocrservice = (IThOcrService) NCLocator.getInstance().lookup(IThOcrService.class.getName());
+					val += "&token="+ocrservice.getToken(billmaker);
+				}
+				ClientToolKit.showDocument(new URL(val), "_blank");
+			}
+		} catch (Exception e) {
+			ExceptionUtils.wrappBusinessException(e.getMessage());
+
+		}
+	}
+
+}

+ 13 - 16
pu/pu/src/client/nc/ui/pubapp/uif2app/actions/MultiSelectDialog.java

@@ -73,7 +73,8 @@ public class MultiSelectDialog extends UIDialog {
 	private IFileSystemService fileservice = NCLocator.getInstance().lookup(IFileSystemService.class);
 	private IThOcrService  ocrservice = (IThOcrService) NCLocator.getInstance().lookup(IThOcrService.class.getName());
 	//获取发票附件地址
-	private String noauth = "https://dl.mypiaojia.com/api/noauth/?id=";
+	//private String noauth = "https://dl.mypiaojia.com/api/noauth/?id=";
+	private String noauth = "https://api.mypiaojia.com/api/invoiceApi/file/download?id=";
 	
 	public MultiSelectDialog(BillForm editor) throws Exception {
 		this.editor = editor;
@@ -130,16 +131,11 @@ public class MultiSelectDialog extends UIDialog {
 	    JPanel panel = new JPanel(new BorderLayout());
 	    IThOcrService  ocrservice=(IThOcrService) NCLocator.getInstance().lookup(IThOcrService.class.getName());
 	  //获取token
-	  	String token="";
+	  	final String token;
 	  	JSONObject json = null;
 	  	try {
-			token=ocrservice.getToken(billmaker);
+			token = ocrservice.getToken(billmaker);
 		} catch (Exception e) {
-			StringWriter stringWriter = new StringWriter();
-			e.printStackTrace(new PrintWriter(stringWriter));
-			//获取详细信息
-			String msg=stringWriter.getBuffer().toString();
-			NcLog.info("获取发票云token失败:"+msg);
 			throw new Exception("获取发票云token失败:"+e.getMessage());
 		} 	
 	  	try {
@@ -172,13 +168,15 @@ public class MultiSelectDialog extends UIDialog {
 					JSONObject extobj = JSONObject.parseObject(ext);
 					String trate = extobj.getString("trate");//税率
 					JSONObject modify_info = info.getJSONObject("modify_info");
-					String furl = modify_info.getString("furl");//发票图片id 或者链接
-					if(furl == null) {
-						furl = modify_info.getString("pdf");//发票图片pdf 或者链接
-					}
 					String name = modify_info.getString("fname");
 					JSONObject comm_info = info.getJSONObject("comm_info");
 					JSONObject pro = comm_info.getJSONObject("pro");
+					String furl = modify_info.getString("furl");//发票图片id 或者链接
+					if (furl == null) {
+					    String pdf = modify_info.getString("pdf");
+					    String pi = pro.getString("pi");
+					    furl = pdf != null ? pdf : pi;
+					}
 					String date = pro.getString("date");//发票日期
 					String type = pro.getString("type");//发票类型
 					String cname = pro.getString("cname");//发票类型名称
@@ -287,19 +285,18 @@ public class MultiSelectDialog extends UIDialog {
 		        }
 
 			    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
-			  
-			 // 添加鼠标点击事件监听器
+			    // 添加鼠标点击事件监听器
 			    table.addMouseListener(new MouseAdapter() {
 			        public void mouseClicked(MouseEvent e) {
 			            int row = table.rowAtPoint(e.getPoint());
 			            int column = table.columnAtPoint(e.getPoint());
-			            
+			           
 			            // 如果点击的是链接列
 			            if (column == 12) {
 			                String htmlLink = ((String) table.getValueAt(row, column)).replaceAll(".*<a href=(.*?)>.*", "$1");
 			                // 使用Desktop类打开默认浏览器
 			                try {
-			                    Desktop.getDesktop().browse(new URI(htmlLink));
+			                    Desktop.getDesktop().browse(new URI(htmlLink+"&token="+token));
 			                } catch (Exception ex) {
 			                    ex.printStackTrace();
 			                }