Commit fc0fe11a by 江和松

Merge remote-tracking branch 'origin/dev' into dev

parents 81cdef7c a3d96d06
......@@ -32,6 +32,9 @@ public class HGCW007 extends DaoEPBase {
public static final String FIELD_UNIT_PRICE = "unitPrice"; /* 单价*/
public static final String FIELD_DAY_NUMBER = "dayNumber"; /* 天数*/
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_NAME = "createdName"; /* 记录创建名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 记录创建时间*/
......@@ -51,6 +54,8 @@ public class HGCW007 extends DaoEPBase {
public static final String COL_UNIT_PRICE = "UNIT_PRICE"; /* 单价*/
public static final String COL_DAY_NUMBER = "DAY_NUMBER"; /* 天数*/
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_NAME = "CREATED_NAME"; /* 记录创建名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 记录创建时间*/
......@@ -75,6 +80,8 @@ public class HGCW007 extends DaoEPBase {
private BigDecimal unitPrice = new BigDecimal("0"); /* 单价*/
private BigDecimal dayNumber = 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 createdName = " "; /* 记录创建名称*/
private String createdTime = " "; /* 记录创建时间*/
......@@ -142,6 +149,20 @@ public class HGCW007 extends DaoEPBase {
eiColumn.setDescName("总价");
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.setDescName("记录创建者");
eiMetadata.addMeta(eiColumn);
......@@ -470,6 +491,8 @@ public class HGCW007 extends DaoEPBase {
setUnitPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UNIT_PRICE)), unitPrice));
setDayNumber(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_DAY_NUMBER)), dayNumber));
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));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
......@@ -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_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_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_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
......@@ -506,4 +531,20 @@ public class HGCW007 extends DaoEPBase {
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;
}
}
......@@ -35,7 +35,7 @@ public class HGCW051 extends DaoEPBase {
public static final String FIELD_YEAR = "year"; /* 年份*/
public static final String FIELD_MONTH = "month"; /* 月份*/
public static final String FIELD_AMOUNT = "amount"; /* 费用金额*/
public static final String FIELD_ACCOUNT = "account"; /* 企业编码*/
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String COL_ID = "ID";
......@@ -51,7 +51,7 @@ public class HGCW051 extends DaoEPBase {
public static final String COL_YEAR = "YEAR"; /* 年份*/
public static final String COL_MONTH = "MONTH"; /* 月份*/
public static final String COL_AMOUNT = "AMOUNT"; /* 费用金额*/
public static final String COL_ACCOUNT = "ACCOUNT"; /* 企业编码*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String QUERY = "HGCW051.query";
......@@ -73,7 +73,7 @@ public class HGCW051 extends DaoEPBase {
private String year = " "; /* 年份*/
private String month = " "; /* 月份*/
private BigDecimal amount = new BigDecimal("0"); /* 费用金额*/
private String account = " "; /* 企业编码*/
private String accountCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
/**
......@@ -138,7 +138,7 @@ public class HGCW051 extends DaoEPBase {
eiColumn.setDescName("费用金额");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
......@@ -368,17 +368,17 @@ public class HGCW051 extends DaoEPBase {
* get the account - 企业编码.
* @return the account
*/
public String getAccount() {
return this.account;
public String getAccountCode() {
return this.accountCode;
}
/**
* set the account - 企业编码.
* set the accountCode - 企业编码.
*
* @param account - 企业编码
* @param accountCode - 企业编码
*/
public void setAccount(String account) {
this.account = account;
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the depCode - 部门编码.
......@@ -417,7 +417,7 @@ public class HGCW051 extends DaoEPBase {
setYear(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_YEAR)), year));
setMonth(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_MONTH)), month));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setAccount(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT)), account));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
}
......@@ -441,7 +441,7 @@ public class HGCW051 extends DaoEPBase {
map.put(FIELD_YEAR, StringUtils.toString(year, eiMetadata.getMeta(FIELD_YEAR)));
map.put(FIELD_MONTH, StringUtils.toString(month, eiMetadata.getMeta(FIELD_MONTH)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_ACCOUNT, StringUtils.toString(account, eiMetadata.getMeta(FIELD_ACCOUNT)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
return map;
......
......@@ -41,7 +41,7 @@ public class HGCW052 extends DaoEPBase {
public static final String FIELD_ITEM_NAME = "itemName"; /* 项目名称*/
public static final String FIELD_ITEM_CODE = "itemCode"; /* 项目编号*/
public static final String FIELD_IS_SHARE = "isShare"; /* 是否分摊费用*/
public static final String FIELD_ACCOUNT = "account"; /* 企业编码*/
public static final String FIELD_ACCOUNT_CODE = "accountCode"; /* 企业编码*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String COL_ID = "ID";
......@@ -63,7 +63,7 @@ public class HGCW052 extends DaoEPBase {
public static final String COL_ITEM_NAME = "ITEM_NAME"; /* 项目名称*/
public static final String COL_ITEM_CODE = "ITEM_CODE"; /* 项目编号*/
public static final String COL_IS_SHARE = "IS_SHARE"; /* 是否分摊费用*/
public static final String COL_ACCOUNT = "ACCOUNT"; /* 企业编码*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String QUERY = "HGCW052.query";
......@@ -91,7 +91,7 @@ public class HGCW052 extends DaoEPBase {
private String itemName = " "; /* 项目名称*/
private String itemCode = " "; /* 项目编号*/
private String isShare = " "; /* 是否分摊费用*/
private String account = " "; /* 企业编码*/
private String accountCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
/**
......@@ -180,7 +180,7 @@ public class HGCW052 extends DaoEPBase {
eiColumn.setDescName("是否分摊费用");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ACCOUNT);
eiColumn = new EiColumn(FIELD_ACCOUNT_CODE);
eiColumn.setDescName("企业编码");
eiMetadata.addMeta(eiColumn);
......@@ -506,8 +506,8 @@ public class HGCW052 extends DaoEPBase {
* get the account - 企业编码.
* @return the account
*/
public String getAccount() {
return this.account;
public String getAccountCode() {
return this.accountCode;
}
/**
......@@ -515,8 +515,8 @@ public class HGCW052 extends DaoEPBase {
*
* @param account - 企业编码
*/
public void setAccount(String account) {
this.account = account;
public void setAccountCode(String account) {
this.accountCode = account;
}
/**
* get the depCode - 部门编码.
......@@ -561,7 +561,7 @@ public class HGCW052 extends DaoEPBase {
setItemName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ITEM_NAME)), itemName));
setItemCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ITEM_CODE)), itemCode));
setIsShare(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_IS_SHARE)), isShare));
setAccount(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT)), account));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ACCOUNT_CODE)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
}
......@@ -591,7 +591,7 @@ public class HGCW052 extends DaoEPBase {
map.put(FIELD_ITEM_NAME, StringUtils.toString(itemName, eiMetadata.getMeta(FIELD_ITEM_NAME)));
map.put(FIELD_ITEM_CODE, StringUtils.toString(itemCode, eiMetadata.getMeta(FIELD_ITEM_CODE)));
map.put(FIELD_IS_SHARE, StringUtils.toString(isShare, eiMetadata.getMeta(FIELD_IS_SHARE)));
map.put(FIELD_ACCOUNT, StringUtils.toString(account, eiMetadata.getMeta(FIELD_ACCOUNT)));
map.put(FIELD_ACCOUNT_CODE, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_ACCOUNT_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
return map;
......
......@@ -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.vo.UserVO;
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.Org;
import com.baosight.hggp.util.CommonMethod;
......@@ -100,28 +102,33 @@ public class ServiceHGCW002 extends ServiceBase {
if (CollectionUtils.isNotEmpty(resultRows)) {
HGCW002 HGCW002 = new HGCW002();
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) {
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
String contractNumber =userVO.getUsercode() +
String contractNumber =HGCW002.getCompanyCode() +
HGCW002.getContractType() +
SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_CONTRACT_NO);
HGCW002.setCompanyCode(userVO.getUsercode());
HGCW002.setCompanyName(userVO.getUsername());
HGCW002.setContractNumber(contractNumber);
HGCW002.setReviewStatus(0);
HGCW002.setBalanceStatus(1);
HGCW002.setPlanStartDate(DateUtils.formatShort(HGCW002.getPlanStartDate()));
HGCW002.setPlanEndDate(DateUtils.formatShort(HGCW002.getPlanEndDate()));
HGCW002.setSigningDate(DateUtils.formatShort(HGCW002.getSigningDate()));
this.add(HGCW002);
// 写入其他数据
HGCWTools.HgCw003.save(detail1Rows,contractNumber,userVO);
HGCWTools.HgCw003.save(detail1Rows,contractNumber,HGCW002);
HGCWTools.HgCw999.batchUpdate(detail2Rows,HGCW002.getId());
} 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 totalContractPriceIncluding = new BigDecimal(0);
BigDecimal valueAddedTax = new BigDecimal(0);
......@@ -244,6 +251,10 @@ public class ServiceHGCW002 extends ServiceBase {
}
map.put("contractTyps", contractTypArray);
}
//增加根据当前登录人所属公司进行过滤
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
map.put("companyCode", userVO.getUsercode());
List<HGCW002> HGCW002List = dao.query("HGCW002.queryProjectComboBox", map);
inInfo.addBlock("projcet_combo_box").setRows(HGCW002List);
return inInfo;
......
......@@ -96,9 +96,9 @@ public class ServiceHGCW003 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) {
HGCW003 HGCW003 = new HGCW003();
HGCW003.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW003.setCompanyCode(userVO.getUsercode());
HGCW003.setCompanyName(userVO.getUsername());
// UserVO userVO = HGCWTools.HgCw002.getUserCompany();
// HGCW003.setCompanyCode(userVO.getUsercode());
// HGCW003.setCompanyName(userVO.getUsername());
contractNumber = HGCW003.getContractNumber();
if (HGCW003.getId() == null || HGCW003.getId() == 0) {
this.add(HGCW003);
......
......@@ -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.sb.domain.HGSB003;
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.Org;
import com.baosight.hggp.util.CommonMethod;
......@@ -100,10 +102,16 @@ public class ServiceHGCW004 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) {
HGCW004 HGCW004 = new HGCW004();
HGCW004.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW004.setCompanyCode(userVO.getUsercode());
HGCW004.setCompanyName(userVO.getUsername());
HGCW004.setContractName(userVO.getUsername());
//获取项目所属公司
String projCode = HGCW004.getProjCode();
HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(projCode);
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) {
this.add(HGCW004);
} else {
......
......@@ -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.vo.UserVO;
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.Org;
import com.baosight.hggp.util.CommonMethod;
......@@ -99,10 +101,16 @@ public class ServiceHGCW005 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) {
HGCW005 HGCW005 = new HGCW005();
HGCW005.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW005.setCompanyCode(userVO.getUsercode());
HGCW005.setCompanyName(userVO.getUsername());
HGCW005.setContractName(userVO.getUsername());
//获取项目所属公司
String projCode = HGCW005.getProjCode();
HGSC001 HGSC001 = HGSCTools.Hgsc001.queryByCode(projCode);
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) {
this.add(HGCW005);
} else {
......
......@@ -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.tools.HGCWTools;
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.DateUtils;
import com.baosight.hggp.util.LogUtils;
......@@ -83,28 +85,33 @@ public class ServiceHGCW006 extends ServiceBase {
if (CollectionUtils.isNotEmpty(resultRows)) {
HGCW006 HGCW006 = new HGCW006();
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) {
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
String contractNumber =userVO.getUsercode() +
String contractNumber =HGCW006.getCompanyCode() +
"5" +
SequenceGenerator.getNextSequence(HGConstant.SequenceId.CW_CONTRACT_NO);
HGCW006.setCompanyCode(userVO.getUsercode());
HGCW006.setCompanyName(userVO.getUsername());
HGCW006.setContractNumber(contractNumber);
HGCW006.setReviewStatus(0);
HGCW006.setLeaseStartDate(DateUtils.formatShort(HGCW006.getLeaseStartDate()));
HGCW006.setLeaseEndDate(DateUtils.formatShort(HGCW006.getLeaseEndDate()));
HGCW006.setSigningDate(DateUtils.formatShort(HGCW006.getSigningDate()));
this.add(HGCW006);
// 写入其他数据
HGCWTools.HgCw007.save(detail1Rows,contractNumber,userVO);
HGCWTools.HgCw007.save(detail1Rows,contractNumber,HGCW006);
HGCWTools.HgCw999.batchUpdate(detail2Rows,HGCW006.getId());
} 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 totalContractPriceIncluding = new BigDecimal(0);
BigDecimal valueAddedTax = new BigDecimal(0);
......
......@@ -73,9 +73,6 @@ public class ServiceHGCW007 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) {
HGCW007 HGCW007 = new HGCW007();
HGCW007.fromMap(resultRows.get(i));
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW007.setCompanyCode(userVO.getUsercode());
HGCW007.setCompanyName(userVO.getUsername());
contractNumber = HGCW007.getContractNumber();
if (HGCW007.getId() == null || HGCW007.getId() == 0) {
this.add(HGCW007);
......
......@@ -56,6 +56,12 @@
<isNotEmpty prepend=" AND " property="totalPrice">
TOTAL_PRICE = #totalPrice#
</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">
CREATED_BY = #createdBy#
</isNotEmpty>
......@@ -95,6 +101,8 @@
UNIT_PRICE as "unitPrice", <!-- 单价 -->
DAY_NUMBER as "dayNumber", <!-- 天数 -->
TOTAL_PRICE as "totalPrice", <!-- 总价 -->
TAX_AMOUNT as "taxAmount",
TOTAL_PRICE_INCLUDING as "totalPriceIncluding",
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
......@@ -185,6 +193,8 @@
UNIT_PRICE, <!-- 单价 -->
DAY_NUMBER, <!-- 天数 -->
TOTAL_PRICE, <!-- 总价 -->
TAX_AMOUNT,
TOTAL_PRICE_INCLUDING,
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
......@@ -193,7 +203,7 @@
UPDATED_TIME, <!-- 记录修改时间 -->
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>
<delete id="delete">
......@@ -213,6 +223,8 @@
UNIT_PRICE = #unitPrice#, <!-- 单价 -->
DAY_NUMBER = #dayNumber#, <!-- 天数 -->
TOTAL_PRICE = #totalPrice#, <!-- 总价 -->
TAX_AMOUNT = #taxAmount#
TOTAL_PRICE_INCLUDING = #totalPriceIncluding#,
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
......
......@@ -70,7 +70,7 @@
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
COMPANY_NAME like ('%$companyName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="settlementNumber">
SETTLEMENT_NUMBER = #settlementNumber#
......@@ -79,7 +79,7 @@
BILL_TYBE = #billTybe#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="billNumber">
BILL_NUMBER = #billNumber#
BILL_NUMBER like ('%$billNumber$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="billState">
BILL_STATE = #billState#
......@@ -88,7 +88,7 @@
SIGNING_DATE = #signingDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partyA">
PARTY_A = #partyA#
PARTY_A like ('%$partyA$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="reviewStatus">
REVIEW_STATUS = #reviewStatus#
......@@ -135,6 +135,15 @@
<isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</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>
<select id="query" parameterClass="java.util.HashMap"
......
......@@ -62,8 +62,8 @@
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="account">
ACCOUNT = #account#
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
......@@ -159,10 +159,10 @@
YEAR, <!-- 年份 -->
MONTH, <!-- 月份 -->
AMOUNT, <!-- 费用金额 -->
ACCOUNT, <!-- 企业编码 -->
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE <!-- 部门编码 -->
)
VALUES (#id#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #year#, #month#, #amount#, #account#, #depCode#)
VALUES (#id#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #year#, #month#, #amount#, #accountCode#, #depCode#)
</insert>
<delete id="delete">
......@@ -185,7 +185,7 @@
YEAR = #year#, <!-- 年份 -->
MONTH = #month#, <!-- 月份 -->
AMOUNT = #amount#, <!-- 费用金额 -->
ACCOUNT = #account#, <!-- 企业编码 -->
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
DEP_CODE = #depCode# <!-- 部门编码 -->
WHERE
ID = #id#
......
......@@ -86,8 +86,8 @@
<isNotEmpty prepend=" AND " property="isShare">
IS_SHARE = #isShare#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="account">
ACCOUNT = #account#
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
......@@ -116,7 +116,7 @@
ITEM_NAME as "itemName", <!-- 项目名称 -->
ITEM_CODE as "itemCode", <!-- 项目编号 -->
IS_SHARE as "isShare", <!-- 是否分摊费用 -->
ACCOUNT as "account", <!-- 企业编码 -->
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode" <!-- 部门编码 -->
FROM ${hggpSchema}.HGCW052 WHERE 1=1
<include refid="condition" />
......@@ -239,10 +239,10 @@
ITEM_NAME, <!-- 项目名称 -->
ITEM_CODE, <!-- 项目编号 -->
IS_SHARE, <!-- 是否分摊费用 -->
ACCOUNT, <!-- 企业编码 -->
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE <!-- 部门编码 -->
)
VALUES (#id#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #year#, #month#, #amount#, #hgcw051Id#, #costType#, #costItem#, #itemName#, #itemCode#, #isShare#, #account#, #depCode#)
VALUES (#id#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #year#, #month#, #amount#, #hgcw051Id#, #costType#, #costItem#, #itemName#, #itemCode#, #isShare#, #accountCode#, #depCode#)
</insert>
<delete id="delete">
......@@ -271,7 +271,7 @@
ITEM_NAME = #itemName#, <!-- 项目名称 -->
ITEM_CODE = #itemCode#, <!-- 项目编号 -->
IS_SHARE = #isShare#, <!-- 是否分摊费用 -->
ACCOUNT = #account#, <!-- 企业编码 -->
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
DEP_CODE = #depCode# <!-- 部门编码 -->
WHERE
ID = #id#
......
......@@ -101,13 +101,13 @@ public class HGCWTools {
}
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, "合同号不能为空!");
rows.forEach(row -> {
HGCW003 HGCW003 = new HGCW003();
HGCW003.fromMap(row);
HGCW003.setCompanyCode(userVO.getUsercode());
HGCW003.setCompanyName(userVO.getUsername());
HGCW003.setCompanyCode(HGCW002.getCompanyCode());
HGCW003.setCompanyName(HGCW002.getCompanyName());
HGCW003.setContractNumber(contractNumber);
DaoUtils.insert(HGCW003.INSERT, HGCW003);
});
......@@ -139,13 +139,13 @@ public class HGCWTools {
}
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, "合同号不能为空!");
rows.forEach(row -> {
HGCW007 hgcw007 = new HGCW007();
hgcw007.fromMap(row);
hgcw007.setCompanyCode(userVO.getUsercode());
hgcw007.setCompanyName(userVO.getUsername());
hgcw007.setCompanyCode(HGCW006.getCompanyCode());
hgcw007.setCompanyName(HGCW006.getCompanyName());
hgcw007.setContractNumber(contractNumber);
DaoUtils.insert(HGCW007.INSERT, hgcw007);
});
......
......@@ -1082,9 +1082,9 @@ public class HGSCTools {
private static void checkAddDate(HGSC008 hgsc008){
List<String> orgIdList = UserSessionUtils.getOrgId();
AssertUtils.isEmpty(hgsc008.getGroupCode(),"生产任务班组信息异常,请联系管理员!");
AssertUtils.isTrue(!orgIdList.contains(hgsc008.getGroupCode()),"非当前任务生产组用户,无法报工此任务!");
// List<String> orgIdList = UserSessionUtils.getOrgId();
// AssertUtils.isEmpty(hgsc008.getGroupCode(),"生产任务班组信息异常,请联系管理员!");
// AssertUtils.isTrue(!orgIdList.contains(hgsc008.getGroupCode()),"非当前任务生产组用户,无法报工此任务!");
AssertUtils.isNull(hgsc008.getQuantity(),"报工数量不能为空!");
}
......
......@@ -312,7 +312,7 @@ public class HGXSTools {
queryMap.put("orgId", orgId);
queryMap.put("orgType", OrgTypeEnum.COMPANY.getCode());
List<Org> results = DaoBase.getInstance().query(HGSqlConstant.HgXsOrg.QUERY_PARENT, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(results.size() - 1);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
......
......@@ -12,6 +12,24 @@ $(function() {
pageSize: 20,
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: [
],
loadComplete: function (grid) {
......@@ -20,7 +38,14 @@ $(function() {
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) {
......@@ -28,7 +53,29 @@ $(function() {
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 {
}
}
});
},
......@@ -42,6 +89,13 @@ $(function() {
e.preventDefault();
deleteResult1Func();
},
beforeAdd: function (e) {
var pricingMethod = $("#result-0-pricingMethod").val();
if (!pricingMethod) {
e.preventDefault();
message("请先选择计价方式!");
}
}
}
$("#UPLOAD_FILE").on("click", function () {
......@@ -377,6 +431,14 @@ function deleteResult1Func() {
detail1Grid.removeRows([rows.rowNo]);// 刷新行号
})
refreshRowNo();
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(null);
} else if (pricingMethod == 2){
calculateUnitAmount(null);
} else {
}
}
let refreshRowNo = function () {
......@@ -432,16 +494,57 @@ function fieldValidation() {
}
}
/**
* 根据单价数量计算总金额
* @param item
*/
function calculateAmount(item) {
// 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var provisionalQuantity = item.provisionalQuantity || 0;
var unitPriceExcludingTax = item.unitPriceExcludingTax || 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 totalPriceExcluding = 0;
var totalPriceIncluding = 0;
......
......@@ -102,7 +102,7 @@
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.paymentMethod"/>
</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:EFCodeOption codeName="hggp.cw.pricingMethod"/>
</EF:EFSelect>
......@@ -130,7 +130,7 @@
<EF:EFColumn ename="supplyMethod" cname="材料供应方式" 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="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:EFGrid>
</EF:EFRegion>
......
......@@ -13,6 +13,24 @@ $(function() {
pageSize: 20,
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: [
],
loadComplete: function (grid) {
......@@ -21,13 +39,44 @@ $(function() {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
// 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var totalPriceExcluding = item.provisionalQuantity * item.unitPriceExcludingTax;
var totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
detail1Grid.setCellValue(item, 'totalPriceExcluding', totalPriceExcluding);
detail1Grid.setCellValue(item, 'totalPriceIncluding', totalPriceIncluding);
calculateAmount();
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 == "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() {
......@@ -53,6 +102,13 @@ $(function() {
e.preventDefault();
deleteResult1Func();
},
beforeAdd: function (e) {
var pricingMethod = $("#result-0-pricingMethod").val();
if (!pricingMethod) {
e.preventDefault();
message("请先选择计价方式!");
}
}
}
$("#UPLOAD_FILE").on("click", function () {
......@@ -486,7 +542,7 @@ function deleteResult1Func() {
}
if (IPLAT.isAvailable("detail1")) {
window['detail1Grid'].setEiInfo(ei);
calculateAmount();
calculateAmount(null);
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
......@@ -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 totalPriceExcluding = 0;
var totalPriceIncluding = 0;
......
......@@ -104,7 +104,7 @@
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.paymentMethod"/>
</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:EFCodeOption codeName="hggp.cw.pricingMethod"/>
</EF:EFSelect>
......@@ -132,7 +132,7 @@
<EF:EFColumn ename="supplyMethod" cname="材料供应方式" 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="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:EFGrid>
</EF:EFRegion>
......
......@@ -14,16 +14,46 @@ $(function() {
},
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) {
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;
// 获取此model元素信息
var item = e.items[0];
// 计算总金额
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(item);
} else if (pricingMethod == 2) {
calculateUnitAmount(item);
} else {
}
}
});
},
onSave: function (e) {
......@@ -78,18 +108,39 @@ $(function() {
"result-0-taxPoints": {
// 点击下拉选项时触发
select: function (e) { //获取勾选值
var allRows = detail1Grid.getDataItems();
if (allRows.length > 0) {
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
if (valueField) {
var taxPoints = valueField / 100;
var totalContractPriceExcluding = $("#result-0-totalContractPriceExcluding").val();
var totalContractPriceIncluding = totalContractPriceExcluding * (1 + taxPoints);
var totalContractPriceIncluding = 0;
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-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 {
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-valueAddedTax").val(0)
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
}
}
}
},
......@@ -261,6 +312,14 @@ function deleteResult1Func() {
detail1Grid.removeRows([rows.rowNo]);// 刷新行号
})
refreshRowNo();
var pricingMethod = $("#result-0-pricingMethod").val();
if (pricingMethod == 1) {
calculateAmount(null);
} else if (pricingMethod == 2){
calculateUnitAmount(null);
} else {
}
}
let refreshRowNo = function () {
......@@ -301,13 +360,26 @@ $(window).load(function () {
refreshRowNo();
});
/**
* 计算总价
* @param item
*/
function calculateAmount(item) {
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var deviceNumber = parseFloat(item.deviceNumber) || 0;
var unitPrice = parseFloat(item.unitPrice) || 0;
var dayNumber = parseFloat(item.dayNumber) || 0;
var deviceNumber = item != null ? parseFloat(item.deviceNumber) || 0 : 0;
var unitPrice = item != null ? parseFloat(item.unitPrice) || 0 : 0;
var dayNumber = item != null ? parseFloat(item.dayNumber) || 0 : 0;
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, 'totalPriceIncluding', parseFloat(totalPriceIncluding));
detail1Grid.setCellValue(item, 'taxAmount', parseFloat(taxAmount));
}
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
......@@ -320,6 +392,7 @@ function calculateAmount(item) {
});
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))
......@@ -327,4 +400,41 @@ function calculateAmount(item) {
$("#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 @@
<EF:EFColumn ename="deviceNumber" 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="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:EFRegion>
<EF:EFRegion id="detail2" title="附件信息">
......
......@@ -165,8 +165,8 @@ function windowCallback() {
function submitFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length != 1) {
message("请选择一条数据");
if (rows.length < 1) {
message("请至少选择一条数据");
return;
}
var flag = true;
......@@ -218,8 +218,8 @@ function submitFunc() {
function writeoffFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length != 1) {
message("请选择一条数据");
if (rows.length < 1) {
message("请至少选择一条数据");
return;
}
var flag = true;
......
......@@ -164,8 +164,8 @@ function windowCallback() {
function submitFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length != 1) {
message("请选择一条数据");
if (rows.length < 1) {
message("请至少选择一条数据");
return;
}
var flag = true;
......@@ -217,8 +217,8 @@ function submitFunc() {
function writeoffFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length != 1) {
message("请选择一条数据");
if (rows.length < 1) {
message("请至少选择一条数据");
return;
}
var flag = true;
......
......@@ -10,14 +10,15 @@
<EF:EFRegion id="inqu" title="查询条件">
<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:EFDateSpan startCname="付款日期(从)" endCname="至" blockId="inqu_status"
startName="signingDateFrom" endName="signingDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</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:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.cw.billTybe"/>
......@@ -31,7 +32,7 @@
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<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="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:EFComboColumn ename="billTybe" cname="票据类型" width="100" align="center"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" >
......@@ -42,7 +43,7 @@
<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="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: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