Commit 0d712d8c by yukang

相关BUG处理

parent 1d9ad0b9
...@@ -32,6 +32,9 @@ public class HGCW007 extends DaoEPBase { ...@@ -32,6 +32,9 @@ public class HGCW007 extends DaoEPBase {
public static final String FIELD_UNIT_PRICE = "unitPrice"; /* 单价*/ public static final String FIELD_UNIT_PRICE = "unitPrice"; /* 单价*/
public static final String FIELD_DAY_NUMBER = "dayNumber"; /* 天数*/ public static final String FIELD_DAY_NUMBER = "dayNumber"; /* 天数*/
public static final String FIELD_TOTAL_PRICE = "totalPrice"; /* 总价*/ public static final String FIELD_TOTAL_PRICE = "totalPrice"; /* 总价*/
public static final String FIELD_TAX_AMOUNT = "taxAmount"; /* 税额*/
public static final String FIELD_TOTAL_PRICE_INCLUDING = "totalPriceIncluding"; /* 含税总价*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 记录创建者*/ public static final String FIELD_CREATED_BY = "createdBy"; /* 记录创建者*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 记录创建名称*/ public static final String FIELD_CREATED_NAME = "createdName"; /* 记录创建名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 记录创建时间*/ public static final String FIELD_CREATED_TIME = "createdTime"; /* 记录创建时间*/
...@@ -51,6 +54,8 @@ public class HGCW007 extends DaoEPBase { ...@@ -51,6 +54,8 @@ public class HGCW007 extends DaoEPBase {
public static final String COL_UNIT_PRICE = "UNIT_PRICE"; /* 单价*/ public static final String COL_UNIT_PRICE = "UNIT_PRICE"; /* 单价*/
public static final String COL_DAY_NUMBER = "DAY_NUMBER"; /* 天数*/ public static final String COL_DAY_NUMBER = "DAY_NUMBER"; /* 天数*/
public static final String COL_TOTAL_PRICE = "TOTAL_PRICE"; /* 总价*/ public static final String COL_TOTAL_PRICE = "TOTAL_PRICE"; /* 总价*/
public static final String COL_TAX_AMOUNT = "TAX_AMOUNT"; /* 税额*/
public static final String COL_TOTAL_PRICE_INCLUDING = "TOTAL_PRICE_INCLUDING"; /* 含税总价*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 记录创建者*/ public static final String COL_CREATED_BY = "CREATED_BY"; /* 记录创建者*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 记录创建名称*/ public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 记录创建名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 记录创建时间*/ public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 记录创建时间*/
...@@ -75,6 +80,8 @@ public class HGCW007 extends DaoEPBase { ...@@ -75,6 +80,8 @@ public class HGCW007 extends DaoEPBase {
private BigDecimal unitPrice = new BigDecimal("0"); /* 单价*/ private BigDecimal unitPrice = new BigDecimal("0"); /* 单价*/
private BigDecimal dayNumber = new BigDecimal("0"); /* 天数*/ private BigDecimal dayNumber = new BigDecimal("0"); /* 天数*/
private BigDecimal totalPrice = new BigDecimal("0"); /* 总价*/ private BigDecimal totalPrice = new BigDecimal("0"); /* 总价*/
private BigDecimal taxAmount = new BigDecimal("0"); /* 税额*/
private BigDecimal totalPriceIncluding = new BigDecimal("0"); /* 含税总价*/
private String createdBy = " "; /* 记录创建者*/ private String createdBy = " "; /* 记录创建者*/
private String createdName = " "; /* 记录创建名称*/ private String createdName = " "; /* 记录创建名称*/
private String createdTime = " "; /* 记录创建时间*/ private String createdTime = " "; /* 记录创建时间*/
...@@ -142,6 +149,20 @@ public class HGCW007 extends DaoEPBase { ...@@ -142,6 +149,20 @@ public class HGCW007 extends DaoEPBase {
eiColumn.setDescName("总价"); eiColumn.setDescName("总价");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_TAX_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("税额");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_TOTAL_PRICE_INCLUDING);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("含税总价");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY); eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("记录创建者"); eiColumn.setDescName("记录创建者");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -470,6 +491,8 @@ public class HGCW007 extends DaoEPBase { ...@@ -470,6 +491,8 @@ public class HGCW007 extends DaoEPBase {
setUnitPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UNIT_PRICE)), unitPrice)); setUnitPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UNIT_PRICE)), unitPrice));
setDayNumber(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_DAY_NUMBER)), dayNumber)); setDayNumber(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_DAY_NUMBER)), dayNumber));
setTotalPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TOTAL_PRICE)), totalPrice)); setTotalPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TOTAL_PRICE)), totalPrice));
setTaxAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TAX_AMOUNT)), taxAmount));
setTotalPriceIncluding(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TOTAL_PRICE_INCLUDING)), totalPriceIncluding));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy)); setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName)); setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime)); setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
...@@ -496,6 +519,8 @@ public class HGCW007 extends DaoEPBase { ...@@ -496,6 +519,8 @@ public class HGCW007 extends DaoEPBase {
map.put(FIELD_UNIT_PRICE, StringUtils.toString(unitPrice, eiMetadata.getMeta(FIELD_UNIT_PRICE))); map.put(FIELD_UNIT_PRICE, StringUtils.toString(unitPrice, eiMetadata.getMeta(FIELD_UNIT_PRICE)));
map.put(FIELD_DAY_NUMBER, StringUtils.toString(dayNumber, eiMetadata.getMeta(FIELD_DAY_NUMBER))); map.put(FIELD_DAY_NUMBER, StringUtils.toString(dayNumber, eiMetadata.getMeta(FIELD_DAY_NUMBER)));
map.put(FIELD_TOTAL_PRICE, StringUtils.toString(totalPrice, eiMetadata.getMeta(FIELD_TOTAL_PRICE))); map.put(FIELD_TOTAL_PRICE, StringUtils.toString(totalPrice, eiMetadata.getMeta(FIELD_TOTAL_PRICE)));
map.put(FIELD_TAX_AMOUNT, StringUtils.toString(taxAmount, eiMetadata.getMeta(FIELD_TAX_AMOUNT)));
map.put(FIELD_TOTAL_PRICE_INCLUDING, StringUtils.toString(totalPriceIncluding, eiMetadata.getMeta(FIELD_TOTAL_PRICE_INCLUDING)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY))); map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME))); map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME))); map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
...@@ -506,4 +531,20 @@ public class HGCW007 extends DaoEPBase { ...@@ -506,4 +531,20 @@ public class HGCW007 extends DaoEPBase {
return map; return map;
} }
public BigDecimal getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(BigDecimal taxAmount) {
this.taxAmount = taxAmount;
}
public BigDecimal getTotalPriceIncluding() {
return totalPriceIncluding;
}
public void setTotalPriceIncluding(BigDecimal totalPriceIncluding) {
this.totalPriceIncluding = totalPriceIncluding;
}
} }
...@@ -12,6 +12,8 @@ import com.baosight.hggp.hg.cw.domain.HGCW999; ...@@ -12,6 +12,8 @@ import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO; import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.sb.tools.HGSBTools; import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
...@@ -100,28 +102,33 @@ public class ServiceHGCW002 extends ServiceBase { ...@@ -100,28 +102,33 @@ public class ServiceHGCW002 extends ServiceBase {
if (CollectionUtils.isNotEmpty(resultRows)) { if (CollectionUtils.isNotEmpty(resultRows)) {
HGCW002 HGCW002 = new HGCW002(); HGCW002 HGCW002 = new HGCW002();
HGCW002.fromMap(resultRows.get(0)); HGCW002.fromMap(resultRows.get(0));
//获取项目所属公司
String projCode = HGCW002.getProjCode();
HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(projCode);
if (HGSC001 != null) {
HGCW002.setCompanyCode(HGSC001.getCompanyCode());
HGCW002.setCompanyName(HGSC001.getCompanyName());
} else {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!项目编码:[" + projCode + "]未找到对应的项目信息!");
}
HGCW002.setPlanStartDate(DateUtils.formatShort(HGCW002.getPlanStartDate()));
HGCW002.setPlanEndDate(DateUtils.formatShort(HGCW002.getPlanEndDate()));
HGCW002.setSigningDate(DateUtils.formatShort(HGCW002.getSigningDate()));
if (HGCW002.getId() == null || HGCW002.getId() == 0) { if (HGCW002.getId() == null || HGCW002.getId() == 0) {
UserVO userVO = HGCWTools.HgCw002.getUserCompany(); String contractNumber =HGCW002.getCompanyCode() +
String contractNumber =userVO.getUsercode() +
HGCW002.getContractType() + HGCW002.getContractType() +
SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_CONTRACT_NO); SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_CONTRACT_NO);
HGCW002.setCompanyCode(userVO.getUsercode());
HGCW002.setCompanyName(userVO.getUsername());
HGCW002.setContractNumber(contractNumber); HGCW002.setContractNumber(contractNumber);
HGCW002.setReviewStatus(0); HGCW002.setReviewStatus(0);
HGCW002.setBalanceStatus(1); HGCW002.setBalanceStatus(1);
HGCW002.setPlanStartDate(DateUtils.formatShort(HGCW002.getPlanStartDate()));
HGCW002.setPlanEndDate(DateUtils.formatShort(HGCW002.getPlanEndDate()));
HGCW002.setSigningDate(DateUtils.formatShort(HGCW002.getSigningDate()));
this.add(HGCW002); this.add(HGCW002);
// 写入其他数据 // 写入其他数据
HGCWTools.HgCw003.save(detail1Rows,contractNumber,userVO); HGCWTools.HgCw003.save(detail1Rows,contractNumber,HGCW002);
HGCWTools.HgCw999.batchUpdate(detail2Rows,HGCW002.getId()); HGCWTools.HgCw999.batchUpdate(detail2Rows,HGCW002.getId());
} else { } else {
HGCW002.setPlanStartDate(DateUtils.formatShort(HGCW002.getPlanStartDate()));
HGCW002.setPlanEndDate(DateUtils.formatShort(HGCW002.getPlanEndDate()));
HGCW002.setSigningDate(DateUtils.formatShort(HGCW002.getSigningDate()));
BigDecimal totalContractPriceExcluding = new BigDecimal(0); BigDecimal totalContractPriceExcluding = new BigDecimal(0);
BigDecimal totalContractPriceIncluding = new BigDecimal(0); BigDecimal totalContractPriceIncluding = new BigDecimal(0);
BigDecimal valueAddedTax = new BigDecimal(0); BigDecimal valueAddedTax = new BigDecimal(0);
...@@ -244,6 +251,10 @@ public class ServiceHGCW002 extends ServiceBase { ...@@ -244,6 +251,10 @@ public class ServiceHGCW002 extends ServiceBase {
} }
map.put("contractTyps", contractTypArray); map.put("contractTyps", contractTypArray);
} }
//增加根据当前登录人所属公司进行过滤
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
map.put("companyCode", userVO.getUsercode());
List<HGCW002> HGCW002List = dao.query("HGCW002.queryProjectComboBox", map); List<HGCW002> HGCW002List = dao.query("HGCW002.queryProjectComboBox", map);
inInfo.addBlock("projcet_combo_box").setRows(HGCW002List); inInfo.addBlock("projcet_combo_box").setRows(HGCW002List);
return inInfo; return inInfo;
......
...@@ -96,9 +96,9 @@ public class ServiceHGCW003 extends ServiceBase { ...@@ -96,9 +96,9 @@ public class ServiceHGCW003 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGCW003 HGCW003 = new HGCW003(); HGCW003 HGCW003 = new HGCW003();
HGCW003.fromMap(resultRows.get(i)); HGCW003.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany(); // UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW003.setCompanyCode(userVO.getUsercode()); // HGCW003.setCompanyCode(userVO.getUsercode());
HGCW003.setCompanyName(userVO.getUsername()); // HGCW003.setCompanyName(userVO.getUsername());
contractNumber = HGCW003.getContractNumber(); contractNumber = HGCW003.getContractNumber();
if (HGCW003.getId() == null || HGCW003.getId() == 0) { if (HGCW003.getId() == null || HGCW003.getId() == 0) {
this.add(HGCW003); this.add(HGCW003);
......
...@@ -12,6 +12,8 @@ import com.baosight.hggp.hg.cw.tools.HGCWTools; ...@@ -12,6 +12,8 @@ import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO; import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.sb.domain.HGSB003; import com.baosight.hggp.hg.sb.domain.HGSB003;
import com.baosight.hggp.hg.sb.tools.HGSBTools; import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
...@@ -100,10 +102,16 @@ public class ServiceHGCW004 extends ServiceBase { ...@@ -100,10 +102,16 @@ public class ServiceHGCW004 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGCW004 HGCW004 = new HGCW004(); HGCW004 HGCW004 = new HGCW004();
HGCW004.fromMap(resultRows.get(i)); HGCW004.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany(); //获取项目所属公司
HGCW004.setCompanyCode(userVO.getUsercode()); String projCode = HGCW004.getProjCode();
HGCW004.setCompanyName(userVO.getUsername()); HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(projCode);
HGCW004.setContractName(userVO.getUsername()); if (HGSC001 != null) {
HGCW004.setCompanyCode(HGSC001.getCompanyCode());
HGCW004.setCompanyName(HGSC001.getCompanyName());
} else {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!项目编码:[" + projCode + "]未找到对应的项目信息!");
}
if (HGCW004.getId() == null || HGCW004.getId() == 0) { if (HGCW004.getId() == null || HGCW004.getId() == 0) {
this.add(HGCW004); this.add(HGCW004);
} else { } else {
......
...@@ -10,6 +10,8 @@ import com.baosight.hggp.hg.cw.domain.HGCW005; ...@@ -10,6 +10,8 @@ import com.baosight.hggp.hg.cw.domain.HGCW005;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO; import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.sb.tools.HGSBTools; import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
...@@ -99,10 +101,16 @@ public class ServiceHGCW005 extends ServiceBase { ...@@ -99,10 +101,16 @@ public class ServiceHGCW005 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGCW005 HGCW005 = new HGCW005(); HGCW005 HGCW005 = new HGCW005();
HGCW005.fromMap(resultRows.get(i)); HGCW005.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany(); //获取项目所属公司
HGCW005.setCompanyCode(userVO.getUsercode()); String projCode = HGCW005.getProjCode();
HGCW005.setCompanyName(userVO.getUsername()); HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(projCode);
HGCW005.setContractName(userVO.getUsername()); if (HGSC001 != null) {
HGCW005.setCompanyCode(HGSC001.getCompanyCode());
HGCW005.setCompanyName(HGSC001.getCompanyName());
} else {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!项目编码:[" + projCode + "]未找到对应的项目信息!");
}
if (HGCW005.getId() == null || HGCW005.getId() == 0) { if (HGCW005.getId() == null || HGCW005.getId() == 0) {
this.add(HGCW005); this.add(HGCW005);
} else { } else {
......
...@@ -9,6 +9,8 @@ import com.baosight.hggp.hg.cw.domain.HGCW003; ...@@ -9,6 +9,8 @@ import com.baosight.hggp.hg.cw.domain.HGCW003;
import com.baosight.hggp.hg.cw.domain.HGCW007; import com.baosight.hggp.hg.cw.domain.HGCW007;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO; import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils; import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
...@@ -83,28 +85,33 @@ public class ServiceHGCW006 extends ServiceBase { ...@@ -83,28 +85,33 @@ public class ServiceHGCW006 extends ServiceBase {
if (CollectionUtils.isNotEmpty(resultRows)) { if (CollectionUtils.isNotEmpty(resultRows)) {
HGCW006 HGCW006 = new HGCW006(); HGCW006 HGCW006 = new HGCW006();
HGCW006.fromMap(resultRows.get(0)); HGCW006.fromMap(resultRows.get(0));
//获取项目所属公司
String projCode = HGCW006.getProjCode();
HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(projCode);
if (HGSC001 != null) {
HGCW006.setCompanyCode(HGSC001.getCompanyCode());
HGCW006.setCompanyName(HGSC001.getCompanyName());
} else {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!项目编码:[" + projCode + "]未找到对应的项目信息!");
}
HGCW006.setLeaseStartDate(DateUtils.formatShort(HGCW006.getLeaseStartDate()));
HGCW006.setLeaseEndDate(DateUtils.formatShort(HGCW006.getLeaseEndDate()));
HGCW006.setSigningDate(DateUtils.formatShort(HGCW006.getSigningDate()));
if (HGCW006.getId() == null || HGCW006.getId() == 0) { if (HGCW006.getId() == null || HGCW006.getId() == 0) {
UserVO userVO = HGCWTools.HgCw002.getUserCompany(); String contractNumber =HGCW006.getCompanyCode() +
String contractNumber =userVO.getUsercode() +
"5" + "5" +
SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_CONTRACT_NO); SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_CONTRACT_NO);
HGCW006.setCompanyCode(userVO.getUsercode());
HGCW006.setCompanyName(userVO.getUsername());
HGCW006.setContractNumber(contractNumber); HGCW006.setContractNumber(contractNumber);
HGCW006.setReviewStatus(0); HGCW006.setReviewStatus(0);
HGCW006.setLeaseStartDate(DateUtils.formatShort(HGCW006.getLeaseStartDate()));
HGCW006.setLeaseEndDate(DateUtils.formatShort(HGCW006.getLeaseEndDate()));
HGCW006.setSigningDate(DateUtils.formatShort(HGCW006.getSigningDate()));
this.add(HGCW006); this.add(HGCW006);
// 写入其他数据 // 写入其他数据
HGCWTools.HgCw007.save(detail1Rows,contractNumber,userVO); HGCWTools.HgCw007.save(detail1Rows,contractNumber,HGCW006);
HGCWTools.HgCw999.batchUpdate(detail2Rows,HGCW006.getId()); HGCWTools.HgCw999.batchUpdate(detail2Rows,HGCW006.getId());
} else { } else {
HGCW006.setLeaseStartDate(DateUtils.formatShort(HGCW006.getLeaseStartDate()));
HGCW006.setLeaseEndDate(DateUtils.formatShort(HGCW006.getLeaseEndDate()));
HGCW006.setSigningDate(DateUtils.formatShort(HGCW006.getSigningDate()));
BigDecimal totalContractPriceExcluding = new BigDecimal(0); BigDecimal totalContractPriceExcluding = new BigDecimal(0);
BigDecimal totalContractPriceIncluding = new BigDecimal(0); BigDecimal totalContractPriceIncluding = new BigDecimal(0);
BigDecimal valueAddedTax = new BigDecimal(0); BigDecimal valueAddedTax = new BigDecimal(0);
......
...@@ -73,9 +73,6 @@ public class ServiceHGCW007 extends ServiceBase { ...@@ -73,9 +73,6 @@ public class ServiceHGCW007 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGCW007 HGCW007 = new HGCW007(); HGCW007 HGCW007 = new HGCW007();
HGCW007.fromMap(resultRows.get(i)); HGCW007.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW007.setCompanyCode(userVO.getUsercode());
HGCW007.setCompanyName(userVO.getUsername());
contractNumber = HGCW007.getContractNumber(); contractNumber = HGCW007.getContractNumber();
if (HGCW007.getId() == null || HGCW007.getId() == 0) { if (HGCW007.getId() == null || HGCW007.getId() == 0) {
this.add(HGCW007); this.add(HGCW007);
......
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
<isNotEmpty prepend=" AND " property="totalPrice"> <isNotEmpty prepend=" AND " property="totalPrice">
TOTAL_PRICE = #totalPrice# TOTAL_PRICE = #totalPrice#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="taxAmount">
TAX_AMOUNT = #taxAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="totalPriceIncluding">
TOTAL_PRICE_INCLUDING = #totalPriceIncluding#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy"> <isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy# CREATED_BY = #createdBy#
</isNotEmpty> </isNotEmpty>
...@@ -95,6 +101,8 @@ ...@@ -95,6 +101,8 @@
UNIT_PRICE as "unitPrice", <!-- 单价 --> UNIT_PRICE as "unitPrice", <!-- 单价 -->
DAY_NUMBER as "dayNumber", <!-- 天数 --> DAY_NUMBER as "dayNumber", <!-- 天数 -->
TOTAL_PRICE as "totalPrice", <!-- 总价 --> TOTAL_PRICE as "totalPrice", <!-- 总价 -->
TAX_AMOUNT as "taxAmount",
TOTAL_PRICE_INCLUDING as "totalPriceIncluding",
CREATED_BY as "createdBy", <!-- 记录创建者 --> CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 --> CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 --> CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
...@@ -185,6 +193,8 @@ ...@@ -185,6 +193,8 @@
UNIT_PRICE, <!-- 单价 --> UNIT_PRICE, <!-- 单价 -->
DAY_NUMBER, <!-- 天数 --> DAY_NUMBER, <!-- 天数 -->
TOTAL_PRICE, <!-- 总价 --> TOTAL_PRICE, <!-- 总价 -->
TAX_AMOUNT,
TOTAL_PRICE_INCLUDING,
CREATED_BY, <!-- 记录创建者 --> CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 --> CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 --> CREATED_TIME, <!-- 记录创建时间 -->
...@@ -193,7 +203,7 @@ ...@@ -193,7 +203,7 @@
UPDATED_TIME, <!-- 记录修改时间 --> UPDATED_TIME, <!-- 记录修改时间 -->
DEP_CODE <!-- 部门编码 --> DEP_CODE <!-- 部门编码 -->
) )
VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #contractNumber#, #deviceName#, #deviceNumber#, #unitPrice#, #dayNumber#, #totalPrice#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#) VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #contractNumber#, #deviceName#, #deviceNumber#, #unitPrice#, #dayNumber#, #totalPrice#, #taxAmount#, #totalPriceIncluding#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
...@@ -213,6 +223,8 @@ ...@@ -213,6 +223,8 @@
UNIT_PRICE = #unitPrice#, <!-- 单价 --> UNIT_PRICE = #unitPrice#, <!-- 单价 -->
DAY_NUMBER = #dayNumber#, <!-- 天数 --> DAY_NUMBER = #dayNumber#, <!-- 天数 -->
TOTAL_PRICE = #totalPrice#, <!-- 总价 --> TOTAL_PRICE = #totalPrice#, <!-- 总价 -->
TAX_AMOUNT = #taxAmount#
TOTAL_PRICE_INCLUDING = #totalPriceIncluding#,
CREATED_BY = #createdBy#, <!-- 记录创建者 --> CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 --> CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 --> CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName"> <isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName# COMPANY_NAME like ('%$companyName$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="settlementNumber"> <isNotEmpty prepend=" AND " property="settlementNumber">
SETTLEMENT_NUMBER = #settlementNumber# SETTLEMENT_NUMBER = #settlementNumber#
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
BILL_TYBE = #billTybe# BILL_TYBE = #billTybe#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="billNumber"> <isNotEmpty prepend=" AND " property="billNumber">
BILL_NUMBER = #billNumber# BILL_NUMBER like ('%$billNumber$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="billState"> <isNotEmpty prepend=" AND " property="billState">
BILL_STATE = #billState# BILL_STATE = #billState#
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
SIGNING_DATE = #signingDate# SIGNING_DATE = #signingDate#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="partyA"> <isNotEmpty prepend=" AND " property="partyA">
PARTY_A = #partyA# PARTY_A like ('%$partyA$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="reviewStatus"> <isNotEmpty prepend=" AND " property="reviewStatus">
REVIEW_STATUS = #reviewStatus# REVIEW_STATUS = #reviewStatus#
...@@ -135,6 +135,15 @@ ...@@ -135,6 +135,15 @@
<isNotEmpty prepend=" AND " property="companyCodes"> <isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate> COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="hiddenConditions">
REMAINING_AMOUNT > 0
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateFrom">
SIGNING_DATE &gt;= REPLACE(#signingDateFrom#, '-', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateTo">
SIGNING_DATE &lt;= REPLACE(#signingDateTo#, '-', '')
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
......
...@@ -101,13 +101,13 @@ public class HGCWTools { ...@@ -101,13 +101,13 @@ public class HGCWTools {
} }
public static class HgCw003{ public static class HgCw003{
public static void save(List<Map> rows, String contractNumber, UserVO userVO) { public static void save(List<Map> rows, String contractNumber, HGCW002 HGCW002) {
AssertUtils.isNull(contractNumber, "合同号不能为空!"); AssertUtils.isNull(contractNumber, "合同号不能为空!");
rows.forEach(row -> { rows.forEach(row -> {
HGCW003 HGCW003 = new HGCW003(); HGCW003 HGCW003 = new HGCW003();
HGCW003.fromMap(row); HGCW003.fromMap(row);
HGCW003.setCompanyCode(userVO.getUsercode()); HGCW003.setCompanyCode(HGCW002.getCompanyCode());
HGCW003.setCompanyName(userVO.getUsername()); HGCW003.setCompanyName(HGCW002.getCompanyName());
HGCW003.setContractNumber(contractNumber); HGCW003.setContractNumber(contractNumber);
DaoUtils.insert(HGCW003.INSERT, HGCW003); DaoUtils.insert(HGCW003.INSERT, HGCW003);
}); });
...@@ -139,13 +139,13 @@ public class HGCWTools { ...@@ -139,13 +139,13 @@ public class HGCWTools {
} }
public static class HgCw007 { public static class HgCw007 {
public static void save(List<Map> rows, String contractNumber, UserVO userVO) { public static void save(List<Map> rows, String contractNumber, HGCW006 HGCW006) {
AssertUtils.isNull(contractNumber, "合同号不能为空!"); AssertUtils.isNull(contractNumber, "合同号不能为空!");
rows.forEach(row -> { rows.forEach(row -> {
HGCW007 hgcw007 = new HGCW007(); HGCW007 hgcw007 = new HGCW007();
hgcw007.fromMap(row); hgcw007.fromMap(row);
hgcw007.setCompanyCode(userVO.getUsercode()); hgcw007.setCompanyCode(HGCW006.getCompanyCode());
hgcw007.setCompanyName(userVO.getUsername()); hgcw007.setCompanyName(HGCW006.getCompanyName());
hgcw007.setContractNumber(contractNumber); hgcw007.setContractNumber(contractNumber);
DaoUtils.insert(HGCW007.INSERT, hgcw007); DaoUtils.insert(HGCW007.INSERT, hgcw007);
}); });
......
...@@ -12,6 +12,24 @@ $(function() { ...@@ -12,6 +12,24 @@ $(function() {
pageSize: 20, pageSize: 20,
pageSizes: [10,20,30,50,100,200], pageSizes: [10,20,30,50,100,200],
}, },
beforeEdit: function (e) {
console.log("正准备编辑第" + e.row + "行数据");
//编辑unitPriceExcludingTax totalPriceIncluding 判断计价方式result-0-pricingMethod
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
if (e.field === "totalPriceIncluding") {
// 判断单元格 field 禁止编辑
e.preventDefault();
}
} else if (pricingMethod == 2){
if (e.field === "unitPriceExcludingTax") {
// 判断单元格 field 禁止编辑
e.preventDefault();
}
} else {
}
},
columns: [ columns: [
], ],
loadComplete: function (grid) { loadComplete: function (grid) {
...@@ -20,7 +38,14 @@ $(function() { ...@@ -20,7 +38,14 @@ $(function() {
var tr,index; var tr,index;
// 获取此model元素信息 // 获取此model元素信息
var item = e.items[0]; var item = e.items[0];
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(item); calculateAmount(item);
} else if (pricingMethod == 2) {
calculateUnitAmount(item);
} else {
}
} }
}); });
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
...@@ -28,7 +53,29 @@ $(function() { ...@@ -28,7 +53,29 @@ $(function() {
var tr,index; var tr,index;
// 获取此model元素信息 // 获取此model元素信息
var item = e.items[0]; var item = e.items[0];
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(item);
} else if (pricingMethod == 2) {
calculateUnitAmount(item);
} else {
}
}
});
grid.dataSource.bind("change", function(e) {
if (e.field == "totalPriceIncluding") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(item); calculateAmount(item);
} else if (pricingMethod == 2) {
calculateUnitAmount(item);
} else {
}
} }
}); });
}, },
...@@ -42,6 +89,13 @@ $(function() { ...@@ -42,6 +89,13 @@ $(function() {
e.preventDefault(); e.preventDefault();
deleteResult1Func(); deleteResult1Func();
}, },
beforeAdd: function (e) {
var pricingMethod = $("#result-0-pricingMethod").val();
if (!pricingMethod) {
e.preventDefault();
message("请先选择计价方式!");
}
}
} }
$("#UPLOAD_FILE").on("click", function () { $("#UPLOAD_FILE").on("click", function () {
...@@ -377,6 +431,14 @@ function deleteResult1Func() { ...@@ -377,6 +431,14 @@ function deleteResult1Func() {
detail1Grid.removeRows([rows.rowNo]);// 刷新行号 detail1Grid.removeRows([rows.rowNo]);// 刷新行号
}) })
refreshRowNo(); refreshRowNo();
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(null);
} else if (pricingMethod == 2){
calculateUnitAmount(null);
} else {
}
} }
let refreshRowNo = function () { let refreshRowNo = function () {
...@@ -432,16 +494,57 @@ function fieldValidation() { ...@@ -432,16 +494,57 @@ function fieldValidation() {
} }
} }
/**
* 根据单价数量计算总金额
* @param item
*/
function calculateAmount(item) { function calculateAmount(item) {
// 计算总金额 // 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0; var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var provisionalQuantity = item.provisionalQuantity || 0; var provisionalQuantity = item != null ? item.provisionalQuantity || 0 : 0;
var unitPriceExcludingTax = item.unitPriceExcludingTax || 0; var unitPriceExcludingTax = item != null ? item.unitPriceExcludingTax || 0 : 0;
var totalPriceExcluding = provisionalQuantity * unitPriceExcludingTax; var totalPriceExcluding = provisionalQuantity * unitPriceExcludingTax;
var totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints)); var totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
if (item != null) {
detail1Grid.setCellValue(item, 'totalPriceExcluding', totalPriceExcluding); detail1Grid.setCellValue(item, 'totalPriceExcluding', totalPriceExcluding);
detail1Grid.setCellValue(item, 'totalPriceIncluding', totalPriceIncluding); detail1Grid.setCellValue(item, 'totalPriceIncluding', totalPriceIncluding);
}
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
allRows.forEach(function (row, index) {
totalPriceExcluding += parseFloat(row.totalPriceExcluding);
totalPriceIncluding += parseFloat(row.totalPriceIncluding);
});
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(totalPriceExcluding.toFixed(3))
$("#result-0-totalContractPriceIncluding").val(totalPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
}
/**
* 根据总金额数量算单价
* @param item
*/
function calculateUnitAmount(item) {
// 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
// 含税总金额
var totalPriceIncluding = item != null ? item.totalPriceIncluding || 0 : 0;
// 数量
var provisionalQuantity = item != null ? item.provisionalQuantity || 0 : 0;
//不含税
var totalPriceExcluding = totalPriceIncluding / (1 + parseFloat(taxPoints));
// 单价
var unitPriceExcludingTax = provisionalQuantity == 0 ? 0 : totalPriceExcluding / provisionalQuantity;
if (item != null) {
detail1Grid.setCellValue(item, 'totalPriceExcluding', totalPriceExcluding);
detail1Grid.setCellValue(item, 'unitPriceExcludingTax', unitPriceExcludingTax);
}
var allRows = detail1Grid.getDataItems(); var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0; var totalPriceExcluding = 0;
var totalPriceIncluding = 0; var totalPriceIncluding = 0;
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<EF:EFOption label="-- 请选择 --" value=""/> <EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.paymentMethod"/> <EF:EFCodeOption codeName="hggp.cw.paymentMethod"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="计价方式" ename="result-0-pricingMethod" colWidth="4" filter="contains"> <EF:EFSelect cname="计价方式" ename="result-0-pricingMethod" colWidth="4" filter="contains" required="true">
<EF:EFOption label="-- 请选择 --" value=""/> <EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.pricingMethod"/> <EF:EFCodeOption codeName="hggp.cw.pricingMethod"/>
</EF:EFSelect> </EF:EFSelect>
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
<EF:EFColumn ename="supplyMethod" cname="材料供应方式" align="center"/> <EF:EFColumn ename="supplyMethod" cname="材料供应方式" align="center"/>
<EF:EFColumn ename="unitPriceExcludingTax" cname="除税单价/元" format="{0:N3}" align="center"/> <EF:EFColumn ename="unitPriceExcludingTax" cname="除税单价/元" format="{0:N3}" align="center"/>
<EF:EFColumn ename="totalPriceExcluding" cname="不含税总价" enable="false" format="{0:N3}" align="center"/> <EF:EFColumn ename="totalPriceExcluding" cname="不含税总价" enable="false" format="{0:N3}" align="center"/>
<EF:EFColumn ename="totalPriceIncluding" cname="含税总价" enable="false" format="{0:N3}" align="center"/> <EF:EFColumn ename="totalPriceIncluding" cname="含税总价" format="{0:N3}" align="center"/>
<EF:EFColumn ename="laborCosts" cname="其中人工费、元" format="{0:N3}" align="center"/> <EF:EFColumn ename="laborCosts" cname="其中人工费、元" format="{0:N3}" align="center"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
...@@ -13,6 +13,24 @@ $(function() { ...@@ -13,6 +13,24 @@ $(function() {
pageSize: 20, pageSize: 20,
pageSizes: [10,20,30,50,100,200], pageSizes: [10,20,30,50,100,200],
}, },
beforeEdit: function (e) {
console.log("正准备编辑第" + e.row + "行数据");
//编辑unitPriceExcludingTax totalPriceIncluding 判断计价方式result-0-pricingMethod
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
if (e.field === "totalPriceIncluding") {
// 判断单元格 field 禁止编辑
e.preventDefault();
}
} else if (pricingMethod == 2){
if (e.field === "unitPriceExcludingTax") {
// 判断单元格 field 禁止编辑
e.preventDefault();
}
} else {
}
},
columns: [ columns: [
], ],
loadComplete: function (grid) { loadComplete: function (grid) {
...@@ -21,13 +39,44 @@ $(function() { ...@@ -21,13 +39,44 @@ $(function() {
var tr,index; var tr,index;
// 获取此model元素信息 // 获取此model元素信息
var item = e.items[0]; var item = e.items[0];
// 计算总金额 var pricingMethod = $("#result-0-pricingMethod").val();
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0; if (pricingMethod == 1) {
var totalPriceExcluding = item.provisionalQuantity * item.unitPriceExcludingTax; calculateAmount(item);
var totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints)); } else if (pricingMethod == 2) {
detail1Grid.setCellValue(item, 'totalPriceExcluding', totalPriceExcluding); calculateUnitAmount(item);
detail1Grid.setCellValue(item, 'totalPriceIncluding', totalPriceIncluding); } else {
calculateAmount();
}
}
});
grid.dataSource.bind("change", function(e) {
if (e.field == "provisionalQuantity") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(item);
} else if (pricingMethod == 2) {
calculateUnitAmount(item);
} else {
}
}
});
grid.dataSource.bind("change", function(e) {
if (e.field == "totalPriceIncluding") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(item);
} else if (pricingMethod == 2) {
calculateUnitAmount(item);
} else {
}
} }
}); });
setTimeout(function() { setTimeout(function() {
...@@ -53,6 +102,13 @@ $(function() { ...@@ -53,6 +102,13 @@ $(function() {
e.preventDefault(); e.preventDefault();
deleteResult1Func(); deleteResult1Func();
}, },
beforeAdd: function (e) {
var pricingMethod = $("#result-0-pricingMethod").val();
if (!pricingMethod) {
e.preventDefault();
message("请先选择计价方式!");
}
}
} }
$("#UPLOAD_FILE").on("click", function () { $("#UPLOAD_FILE").on("click", function () {
...@@ -486,7 +542,7 @@ function deleteResult1Func() { ...@@ -486,7 +542,7 @@ function deleteResult1Func() {
} }
if (IPLAT.isAvailable("detail1")) { if (IPLAT.isAvailable("detail1")) {
window['detail1Grid'].setEiInfo(ei); window['detail1Grid'].setEiInfo(ei);
calculateAmount(); calculateAmount(null);
} }
if (ei.getStatus() == 0) { if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning'); NotificationUtil(ei, 'warning');
...@@ -507,8 +563,56 @@ function deleteResult1Func() { ...@@ -507,8 +563,56 @@ function deleteResult1Func() {
}); });
} }
function calculateAmount() { /**
* 根据单价数量计算总金额
* @param item
*/
function calculateAmount(item) {
// 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var provisionalQuantity = item != null ? item.provisionalQuantity || 0 : 0;
var unitPriceExcludingTax = item != null ? item.unitPriceExcludingTax || 0 : 0;
var totalPriceExcluding = provisionalQuantity * unitPriceExcludingTax;
var totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
if (item != null) {
detail1Grid.setCellValue(item, 'totalPriceExcluding', totalPriceExcluding);
detail1Grid.setCellValue(item, 'totalPriceIncluding', totalPriceIncluding);
}
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
allRows.forEach(function (row, index) {
totalPriceExcluding += parseFloat(row.totalPriceExcluding);
totalPriceIncluding += parseFloat(row.totalPriceIncluding);
});
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(totalPriceExcluding.toFixed(3))
$("#result-0-totalContractPriceIncluding").val(totalPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
}
/**
* 根据总金额数量算单价
* @param item
*/
function calculateUnitAmount(item) {
// 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
// 含税总金额
var totalPriceIncluding = item != null ? item.totalPriceIncluding || 0 : 0;
// 数量
var provisionalQuantity = item != null ? item.provisionalQuantity || 0 : 0;
//不含税
var totalPriceExcluding = totalPriceIncluding / (1 + parseFloat(taxPoints));
// 单价
var unitPriceExcludingTax = provisionalQuantity == 0 ? 0 : totalPriceExcluding / provisionalQuantity;
if (item != null) {
detail1Grid.setCellValue(item, 'totalPriceExcluding', totalPriceExcluding);
detail1Grid.setCellValue(item, 'unitPriceExcludingTax', unitPriceExcludingTax);
}
var allRows = detail1Grid.getDataItems(); var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0; var totalPriceExcluding = 0;
var totalPriceIncluding = 0; var totalPriceIncluding = 0;
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<EF:EFOption label="-- 请选择 --" value=""/> <EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.paymentMethod"/> <EF:EFCodeOption codeName="hggp.cw.paymentMethod"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="计价方式" ename="result-0-pricingMethod" colWidth="4" filter="contains"> <EF:EFSelect cname="计价方式" ename="result-0-pricingMethod" colWidth="4" filter="contains" required="true">
<EF:EFOption label="-- 请选择 --" value=""/> <EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.pricingMethod"/> <EF:EFCodeOption codeName="hggp.cw.pricingMethod"/>
</EF:EFSelect> </EF:EFSelect>
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
<EF:EFColumn ename="supplyMethod" cname="材料供应方式" align="center"/> <EF:EFColumn ename="supplyMethod" cname="材料供应方式" align="center"/>
<EF:EFColumn ename="unitPriceExcludingTax" cname="除税单价/元" format="{0:N3}" align="center"/> <EF:EFColumn ename="unitPriceExcludingTax" cname="除税单价/元" format="{0:N3}" align="center"/>
<EF:EFColumn ename="totalPriceExcluding" cname="不含税总价" enable="false" format="{0:N3}" align="center"/> <EF:EFColumn ename="totalPriceExcluding" cname="不含税总价" enable="false" format="{0:N3}" align="center"/>
<EF:EFColumn ename="totalPriceIncluding" cname="含税总价" enable="false" format="{0:N3}" align="center"/> <EF:EFColumn ename="totalPriceIncluding" cname="含税总价" format="{0:N3}" align="center"/>
<EF:EFColumn ename="laborCosts" cname="其中人工费、元" format="{0:N3}" align="center"/> <EF:EFColumn ename="laborCosts" cname="其中人工费、元" format="{0:N3}" align="center"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
...@@ -14,16 +14,46 @@ $(function() { ...@@ -14,16 +14,46 @@ $(function() {
}, },
columns: [ columns: [
], ],
beforeAdd: function (e) {
var pricingMethod = $("#result-0-pricingMethod").val();
if (!pricingMethod) {
e.preventDefault();
message("请先选择计价方式!");
}
},
beforeEdit: function (e) {
console.log("正准备编辑第" + e.row + "行数据");
//编辑unitPriceExcludingTax totalPriceIncluding 判断计价方式result-0-pricingMethod
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
if (e.field === "totalPrice") {
// 判断单元格 field 禁止编辑
e.preventDefault();
}
} else if (pricingMethod == 2){
if (e.field === "unitPrice") {
// 判断单元格 field 禁止编辑
e.preventDefault();
}
} else {
}
},
loadComplete: function (grid) { loadComplete: function (grid) {
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
if (e.field == "dayNumber" || e.field == "unitPrice" || e.field == "dayNumber") { if (e.field == "deviceNumber" || e.field == "unitPrice" || e.field == "dayNumber" || e.field == "totalPrice") {
var tr,index; var tr,index;
// 获取此model元素信息 // 获取此model元素信息
var item = e.items[0]; var item = e.items[0];
// 计算总金额 var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(item); calculateAmount(item);
} else if (pricingMethod == 2) {
calculateUnitAmount(item);
} else {
} }
}
}); });
}, },
onSave: function (e) { onSave: function (e) {
...@@ -78,18 +108,39 @@ $(function() { ...@@ -78,18 +108,39 @@ $(function() {
"result-0-taxPoints": { "result-0-taxPoints": {
// 点击下拉选项时触发 // 点击下拉选项时触发
select: function (e) { //获取勾选值 select: function (e) { //获取勾选值
var allRows = detail1Grid.getDataItems();
if (allRows.length > 0) {
var dataItem = e.dataItem; var dataItem = e.dataItem;
var valueField = dataItem['valueField']; var valueField = dataItem['valueField'];
if (valueField) { if (valueField) {
var taxPoints = valueField / 100; var taxPoints = valueField / 100;
var totalContractPriceExcluding = $("#result-0-totalContractPriceExcluding").val(); var totalContractPriceIncluding = 0;
var totalContractPriceIncluding = totalContractPriceExcluding * (1 + taxPoints); var valueAddedTax = 0;
//更新表格含税金额
for (var i = 0; i < allRows.length; i++) {
var row = allRows[i];
var totalPriceIncluding = row.totalPrice * (1 + parseFloat(taxPoints));
var taxAmount = totalPriceIncluding - row.totalPrice;
detail1Grid.setCellValue(row, 'totalPriceIncluding', parseFloat(totalPriceIncluding).toFixed(3));
detail1Grid.setCellValue(row, 'taxAmount', parseFloat(taxAmount).toFixed(3));
totalContractPriceIncluding += totalPriceIncluding;
}
$("#result-0-totalContractPriceIncluding").val(totalContractPriceIncluding.toFixed(3)) $("#result-0-totalContractPriceIncluding").val(totalContractPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val((totalContractPriceIncluding - totalContractPriceExcluding).toFixed(3)) var totalPriceExcluding = $("#result-0-totalContractPriceExcluding").val();
valueAddedTax = parseFloat(totalContractPriceIncluding.toFixed(3)) - parseFloat(totalPriceExcluding);
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
} else { } else {
var totalContractPriceExcluding = parseFloat($("#result-0-totalContractPriceExcluding").val()); var totalContractPriceExcluding = 0;
var valueAddedTax = 0;
for (var i = 0; i < allRows.length; i++) {
var row = allRows[i];
detail1Grid.setCellValue(row, 'totalPriceIncluding', row.totalPrice);
detail1Grid.setCellValue(row, 'taxAmount', 0);
totalContractPriceExcluding += parseFloat(row.totalPrice);
}
$("#result-0-totalContractPriceIncluding").val(totalContractPriceExcluding.toFixed(3)) $("#result-0-totalContractPriceIncluding").val(totalContractPriceExcluding.toFixed(3))
$("#result-0-valueAddedTax").val(0) $("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
}
} }
} }
}, },
...@@ -261,6 +312,14 @@ function deleteResult1Func() { ...@@ -261,6 +312,14 @@ function deleteResult1Func() {
detail1Grid.removeRows([rows.rowNo]);// 刷新行号 detail1Grid.removeRows([rows.rowNo]);// 刷新行号
}) })
refreshRowNo(); refreshRowNo();
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(null);
} else if (pricingMethod == 2){
calculateUnitAmount(null);
} else {
}
} }
let refreshRowNo = function () { let refreshRowNo = function () {
...@@ -301,13 +360,26 @@ $(window).load(function () { ...@@ -301,13 +360,26 @@ $(window).load(function () {
refreshRowNo(); refreshRowNo();
}); });
/**
* 计算总价
* @param item
*/
function calculateAmount(item) { function calculateAmount(item) {
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0; var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var deviceNumber = parseFloat(item.deviceNumber) || 0; var deviceNumber = item != null ? parseFloat(item.deviceNumber) || 0 : 0;
var unitPrice = parseFloat(item.unitPrice) || 0; var unitPrice = item != null ? parseFloat(item.unitPrice) || 0 : 0;
var dayNumber = parseFloat(item.dayNumber) || 0; var dayNumber = item != null ? parseFloat(item.dayNumber) || 0 : 0;
var totalPrice = deviceNumber * unitPrice * dayNumber; var totalPrice = deviceNumber * unitPrice * dayNumber;
var totalPriceIncluding = totalPrice * (1 + parseFloat(taxPoints));
var taxAmount = totalPriceIncluding - totalPrice
if (item) {
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice)); detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
detail1Grid.setCellValue(item, 'totalPriceIncluding', parseFloat(totalPriceIncluding));
detail1Grid.setCellValue(item, 'taxAmount', parseFloat(taxAmount));
}
var allRows = detail1Grid.getDataItems(); var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0; var totalPriceExcluding = 0;
var totalPriceIncluding = 0; var totalPriceIncluding = 0;
...@@ -320,6 +392,7 @@ function calculateAmount(item) { ...@@ -320,6 +392,7 @@ function calculateAmount(item) {
}); });
totalPriceExcluding = totalPrice; totalPriceExcluding = totalPrice;
totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints)); totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding); valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(parseFloat(totalPriceExcluding).toFixed(3)) $("#result-0-totalContractPriceExcluding").val(parseFloat(totalPriceExcluding).toFixed(3))
$("#result-0-totalContractPriceIncluding").val(parseFloat(totalPriceIncluding).toFixed(3)) $("#result-0-totalContractPriceIncluding").val(parseFloat(totalPriceIncluding).toFixed(3))
...@@ -327,4 +400,41 @@ function calculateAmount(item) { ...@@ -327,4 +400,41 @@ function calculateAmount(item) {
$("#result-0-totalQuantity").val(parseFloat(deviceNumber).toFixed(3)) $("#result-0-totalQuantity").val(parseFloat(deviceNumber).toFixed(3))
} }
/**
* 计算单价
*/
function calculateUnitAmount(item) {
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var deviceNumber = item != null ? parseFloat(item.deviceNumber) || 0 : 0;
var dayNumber = item != null ? parseFloat(item.dayNumber) || 0 : 0;
var totalPrice = item != null ? parseFloat(item.totalPrice) || 0 : 0;
var unitPrice = totalPrice / (deviceNumber * dayNumber);
var totalPriceIncluding = totalPrice * (1 + parseFloat(taxPoints));
var taxAmount = totalPriceIncluding - totalPrice
if (item) {
detail1Grid.setCellValue(item, 'unitPrice', parseFloat(unitPrice));
detail1Grid.setCellValue(item, 'totalPriceIncluding', parseFloat(totalPriceIncluding));
detail1Grid.setCellValue(item, 'taxAmount', parseFloat(taxAmount));
}
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
totalPrice = 0;
deviceNumber = 0
allRows.forEach(function (row, index) {
totalPrice += parseFloat(row.totalPrice);
deviceNumber += parseFloat(row.deviceNumber);
});
totalPriceExcluding = totalPrice;
totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(parseFloat(totalPriceExcluding).toFixed(3))
$("#result-0-totalContractPriceIncluding").val(parseFloat(totalPriceIncluding).toFixed(3))
$("#result-0-valueAddedTax").val(parseFloat(valueAddedTax).toFixed(3))
$("#result-0-totalQuantity").val(parseFloat(deviceNumber).toFixed(3))
}
...@@ -95,7 +95,10 @@ ...@@ -95,7 +95,10 @@
<EF:EFColumn ename="deviceNumber" cname="数量" format="{0:N3}" align="center"/> <EF:EFColumn ename="deviceNumber" cname="数量" format="{0:N3}" align="center"/>
<EF:EFColumn ename="unitPrice" cname="单价" format="{0:N3}" align="center"/> <EF:EFColumn ename="unitPrice" cname="单价" format="{0:N3}" align="center"/>
<EF:EFColumn ename="dayNumber" cname="天数" format="{0:N3}" align="center"/> <EF:EFColumn ename="dayNumber" cname="天数" format="{0:N3}" align="center"/>
<EF:EFColumn ename="totalPrice" cname="总价" enable="false" format="{0:N3}" align="center"/> <EF:EFColumn ename="totalPrice" cname="总价" format="{0:N3}" align="center"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" format="{0:N3}" align="center"/>
<EF:EFColumn ename="totalPriceIncluding" cname="含税总价" enable="false" format="{0:N3}" align="center"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="detail2" title="附件信息"> <EF:EFRegion id="detail2" title="附件信息">
......
...@@ -165,8 +165,8 @@ function windowCallback() { ...@@ -165,8 +165,8 @@ function windowCallback() {
function submitFunc() { function submitFunc() {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
if (rows.length != 1) { if (rows.length < 1) {
message("请选择一条数据"); message("请至少选择一条数据");
return; return;
} }
var flag = true; var flag = true;
...@@ -218,8 +218,8 @@ function submitFunc() { ...@@ -218,8 +218,8 @@ function submitFunc() {
function writeoffFunc() { function writeoffFunc() {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
if (rows.length != 1) { if (rows.length < 1) {
message("请选择一条数据"); message("请至少选择一条数据");
return; return;
} }
var flag = true; var flag = true;
......
...@@ -164,8 +164,8 @@ function windowCallback() { ...@@ -164,8 +164,8 @@ function windowCallback() {
function submitFunc() { function submitFunc() {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
if (rows.length != 1) { if (rows.length < 1) {
message("请选择一条数据"); message("请至少选择一条数据");
return; return;
} }
var flag = true; var flag = true;
...@@ -217,8 +217,8 @@ function submitFunc() { ...@@ -217,8 +217,8 @@ function submitFunc() {
function writeoffFunc() { function writeoffFunc() {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
if (rows.length != 1) { if (rows.length < 1) {
message("请选择一条数据"); message("请至少选择一条数据");
return; return;
} }
var flag = true; var flag = true;
......
...@@ -10,14 +10,15 @@ ...@@ -10,14 +10,15 @@
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFInput cname="隐藏条件" ename="partyA" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="隐藏条件" ename="hiddenConditions" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="隐藏条件" ename="billState" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="隐藏条件" ename="mainId" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="隐藏条件" ename="mainId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFDateSpan startCname="付款日期(从)" endCname="至" blockId="inqu_status" <EF:EFDateSpan startCname="付款日期(从)" endCname="至" blockId="inqu_status"
startName="signingDateFrom" endName="signingDateTo" row="0" role="date" startName="signingDateFrom" endName="signingDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true"> format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan> </EF:EFDateSpan>
<EF:EFInput cname="客户名称" ename="partyA" blockId="inqu_status" row="0" colWidth="3" /> <EF:EFInput cname="供应商名称" ename="partyA" blockId="inqu_status" row="0" colWidth="3" />
<EF:EFSelect cname="票据类型" ename="inqu_status-0-billTybe" colWidth="3" filter="contains"> <EF:EFSelect cname="票据类型" ename="inqu_status-0-billTybe" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.cw.billTybe"/> <EF:EFCodeOption codeName="hggp.cw.billTybe"/>
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="thisAmount" cname="本次付款金额" width="120" align="center"/> <EF:EFColumn ename="thisAmount" cname="本次付款金额" width="120" align="center"/>
<EF:EFColumn ename="remainingAmount" cname="剩余付款金额" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="remainingAmount" cname="剩余付款金额" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="partyA" cname="客户名称" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="partyA" cname="供应商名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="settlementNumber" cname="来源单号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="billTybe" cname="票据类型" width="100" align="center" <EF:EFComboColumn ename="billTybe" cname="票据类型" width="100" align="center"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" >
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
<EF:EFColumn ename="taxPoints" cname="税率(%)" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="taxPoints" cname="税率(%)" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="thisSettlementTax" cname="税额" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="totalContractPriceIncluding" cname="付款总额" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="totalContractPriceIncluding" cname="发票总额" width="120" enable="false" readonly="true" align="center"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment