Commit 4b8e0a4d by liuyang

2024-07-22 采购收票 1、选择结算单字段显示调整 2、结算日期显示调整为日期格式 3、查询条件修复 4、采购收票发票金额计算逻辑bug修复

5、采购收货添加是否开票字段,采购开票之后不再显示对应的采购收货
parent 68124012
...@@ -67,6 +67,8 @@ public class HGSqlConstant { ...@@ -67,6 +67,8 @@ public class HGSqlConstant {
public static final String UPDATE_QTY = MODULE_NAME + "updateQty"; public static final String UPDATE_QTY = MODULE_NAME + "updateQty";
// 收货完成 // 收货完成
public static final String UPDATE_CONFIRM = MODULE_NAME + "updateConfirm"; public static final String UPDATE_CONFIRM = MODULE_NAME + "updateConfirm";
public static final String UPDATE_IS_INVOICING = MODULE_NAME + "updateIsInvoicing";
} }
public class HgCw012 { public class HgCw012 {
......
...@@ -119,7 +119,7 @@ public class HGCW012 extends DaoEPBase { ...@@ -119,7 +119,7 @@ public class HGCW012 extends DaoEPBase {
private BigDecimal remainingAmount = new BigDecimal("0"); /* 剩余开票/收票金额*/ private BigDecimal remainingAmount = new BigDecimal("0"); /* 剩余开票/收票金额*/
private String receiveDate = " "; /* 收票日期*/ private String receiveDate = " "; /* 收票日期*/
private Integer contractType = new Integer(0); /* 合同类型;1.采购收货2.劳务3.租赁*/ private Integer contractType = new Integer(0); /* 合同类型;1.采购收货2.劳务3.租赁*/
private Boolean inventTypeDetail; /* 存货大类*/ private Integer inventTypeDetail; /* 存货大类*/
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
private String spec = " "; /* 规格*/ private String spec = " "; /* 规格*/
...@@ -683,7 +683,7 @@ public class HGCW012 extends DaoEPBase { ...@@ -683,7 +683,7 @@ public class HGCW012 extends DaoEPBase {
* get the inventTypeDetail - 存货大类. * get the inventTypeDetail - 存货大类.
* @return the inventTypeDetail * @return the inventTypeDetail
*/ */
public Boolean getInventTypeDetail() { public Integer getInventTypeDetail() {
return this.inventTypeDetail; return this.inventTypeDetail;
} }
...@@ -692,7 +692,7 @@ public class HGCW012 extends DaoEPBase { ...@@ -692,7 +692,7 @@ public class HGCW012 extends DaoEPBase {
* *
* @param inventTypeDetail - 存货大类 * @param inventTypeDetail - 存货大类
*/ */
public void setInventTypeDetail(Boolean inventTypeDetail) { public void setInventTypeDetail(Integer inventTypeDetail) {
this.inventTypeDetail = inventTypeDetail; this.inventTypeDetail = inventTypeDetail;
} }
/** /**
...@@ -808,7 +808,7 @@ public class HGCW012 extends DaoEPBase { ...@@ -808,7 +808,7 @@ public class HGCW012 extends DaoEPBase {
setRemainingAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_REMAINING_AMOUNT)), remainingAmount)); setRemainingAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_REMAINING_AMOUNT)), remainingAmount));
setReceiveDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_DATE)), receiveDate)); setReceiveDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_DATE)), receiveDate));
setContractType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_CONTRACT_TYPE)), contractType)); setContractType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_CONTRACT_TYPE)), contractType));
setInventTypeDetail(NumberUtils.toBoolean(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail)); setInventTypeDetail(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode)); setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName)); setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec)); setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec));
......
...@@ -5,15 +5,14 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -5,15 +5,14 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.domain.HGCW012; import com.baosight.hggp.hg.cw.domain.HGCW012;
import com.baosight.hggp.hg.cw.domain.HGCW013; import com.baosight.hggp.hg.cw.domain.HGCW013;
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.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.*;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -22,6 +21,7 @@ import com.baosight.iplat4j.core.util.NumberUtils; ...@@ -22,6 +21,7 @@ import com.baosight.iplat4j.core.util.NumberUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
...@@ -83,9 +83,9 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -83,9 +83,9 @@ public class ServiceHGCW012 extends ServiceBase {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据 // 写入数据
for (int i = 0; i < resultRows.size(); i++) { for (Map resultRow : resultRows) {
HGCW012 HGCW012 = new HGCW012(); HGCW012 HGCW012 = new HGCW012();
HGCW012.fromMap(resultRows.get(i)); HGCW012.fromMap(resultRow);
UserVO userVO = HGCWTools.HgCw002.getUserCompany(); UserVO userVO = HGCWTools.HgCw002.getUserCompany();
HGCW012.setCompanyCode(userVO.getUsercode()); HGCW012.setCompanyCode(userVO.getUsercode());
HGCW012.setCompanyName(userVO.getUsername()); HGCW012.setCompanyName(userVO.getUsername());
...@@ -99,6 +99,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -99,6 +99,7 @@ public class ServiceHGCW012 extends ServiceBase {
this.add(HGCW012); this.add(HGCW012);
} else { } else {
this.modify(HGCW012); this.modify(HGCW012);
this.updateHGCW013(HGCW012);
} }
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -259,7 +260,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -259,7 +260,7 @@ public class ServiceHGCW012 extends ServiceBase {
} }
//获取相应的数据 //获取相应的数据
List<HGCW013> hgcw013List = HGCWTools.HgCw013.mapToeList(resultRows, NumberUtils.toLong(mainId)); List<HGCW013> hgcw013List = HGCWTools.HgCw013.mapToeList(resultRows, NumberUtils.toLong(mainId));
DecimalFormat decimalFormat = new DecimalFormat("#.000"); //DecimalFormat decimalFormat = new DecimalFormat("#.000");
if (CollectionUtils.isNotEmpty(hgcw013List)) { if (CollectionUtils.isNotEmpty(hgcw013List)) {
if (StringUtils.isEmpty(mainId)) { if (StringUtils.isEmpty(mainId)) {
//先生成主表 //先生成主表
...@@ -272,10 +273,12 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -272,10 +273,12 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setBillTybe(1); hgcw012.setBillTybe(1);
//hgcw012.setSigningDate(DateUtils.shortDate()); //hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate()); hgcw012.setReceiveDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; hgcw012.setPartyA(hgcw013List.get(0).getPartyA());
StringBuffer settlementNumber = new StringBuffer(); //BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
//StringBuffer settlementNumber = new StringBuffer();
Map<String, BigDecimal> rowMap = new HashMap<>(); Map<String, BigDecimal> rowMap = new HashMap<>();
for (HGCW013 hgcw013 : hgcw013List) { HGCWTools.HgCw013.countTaxAmount(resultRows, hgcw012, rowMap);
/*for (HGCW013 hgcw013 : hgcw013List) {
settlementNumber.append(hgcw013.getSettlementNumber()).append(","); settlementNumber.append(hgcw013.getSettlementNumber()).append(",");
} }
for (Map m : resultRows) { for (Map m : resultRows) {
...@@ -283,20 +286,23 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -283,20 +286,23 @@ public class ServiceHGCW012 extends ServiceBase {
BigDecimal remainingAmount = new BigDecimal(m.get("thisSettlementAmount").toString()); BigDecimal remainingAmount = new BigDecimal(m.get("thisSettlementAmount").toString());
rowMap.put(c, remainingAmount); rowMap.put(c, remainingAmount);
totalContractPriceIncluding = totalContractPriceIncluding.add(remainingAmount); totalContractPriceIncluding = totalContractPriceIncluding.add(remainingAmount);
} }*/
hgcw012.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); //hgcw012.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
hgcw012.setPartyA(hgcw013List.get(0).getPartyA());
hgcw012.setTaxPoints(hgcw013List.get(0).getTaxPoints()); //hgcw012.setTaxPoints(hgcw013List.get(0).getTaxPoints());
hgcw012.setThisSettlementTax(hgcw013List.get(0).getThisSettlementTax()); //hgcw012.setThisSettlementTax(hgcw013List.get(0).getThisSettlementTax());
hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount()); //hgcw012.setThisSettlementAmount(hgcw013List.get(0).getThisSettlementAmount());
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); //hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1));
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding))); //hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
this.add(hgcw012); this.add(hgcw012);
//生成明细表 //生成明细表
for (HGCW013 hgcw013 : hgcw013List) { for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(hgcw012.getId()); hgcw013.setMainId(hgcw012.getId());
hgcw013.setId(null); hgcw013.setId(null);
HGCGTools.HgCg003.updateIsInvoicing(hgcw013.getSettlementNumber(), HGConstant.CgIsInvoicing.S_1);
this.addHGCW013(hgcw013);
} }
} else { } else {
HGCW012 hgcw012 = HGCWTools.HgCw012.getId(mainId); HGCW012 hgcw012 = HGCWTools.HgCw012.getId(mainId);
...@@ -438,6 +444,24 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -438,6 +444,24 @@ public class ServiceHGCW012 extends ServiceBase {
public void addHGCW013(HGCW013 HGCW013) { public void addHGCW013(HGCW013 HGCW013) {
DaoUtils.insert("HGCW013.insert", HGCW013); DaoUtils.insert("HGCW013.insert", HGCW013);
} }
public void updateHGCW013(HGCW012 hgcw012) {
List<HGCW013> hgcw013s = HGCWTools.HgCw013.getMainId(hgcw012.getId());
for (HGCW013 hgcw013 : hgcw013s) {
hgcw013.setBillNumber(hgcw012.getBillNumber());
hgcw013.setTaxPoints(hgcw012.getTaxPoints());
BigDecimal taxPoints = new BigDecimal(hgcw012.getTaxPoints()); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal thisAmount = hgcw013.getTotalContractPriceIncluding(); //开票总额
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率转换为小数形式
BigDecimal thisSettlementAmount = thisAmount.divide(taxRateAsDecimal, 2, RoundingMode.HALF_UP);
BigDecimal thisSettlementTax = thisAmount.subtract(thisSettlementAmount); // 计算税额
hgcw013.setThisSettlementTax(thisSettlementTax.toString());
hgcw013.setThisSettlementAmount(thisSettlementAmount.toString());
DaoUtils.update(HGCW013.UPDATE, hgcw013);
}
}
/** /**
* 提交操作 * 提交操作
* @param inInfo * @param inInfo
......
...@@ -61,6 +61,7 @@ public class ServiceHGCW012A extends ServiceBase { ...@@ -61,6 +61,7 @@ public class ServiceHGCW012A extends ServiceBase {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"signingDateTo", DateUtils.formatShort(signingDateTo)); inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"signingDateTo", DateUtils.formatShort(signingDateTo));
} }
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGCG003.FIELD_STATUS, HGConstant.CgReceiveStatus.S_5); inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGCG003.FIELD_STATUS, HGConstant.CgReceiveStatus.S_5);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGCG003.FIELD_IS_INVOICING, HGConstant.CgIsInvoicing.S_0);
inInfo = super.query(inInfo, HGCG003.QUERY, new HGCG003()); inInfo = super.query(inInfo, HGCG003.QUERY, new HGCG003());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.cw.service; ...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.hg.cw.domain.HGCW012; import com.baosight.hggp.hg.cw.domain.HGCW012;
import com.baosight.hggp.hg.cw.domain.HGCW013;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -51,7 +52,7 @@ public class ServiceHGCW012C extends ServiceBase { ...@@ -51,7 +52,7 @@ public class ServiceHGCW012C extends ServiceBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, HGCW012.QUERY, new HGCW012()); inInfo = super.query(inInfo, HGCW013.QUERY, new HGCW012());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,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 CONCAT('%',#billNumber#,'%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="billState"> <isNotEmpty prepend=" AND " property="billState">
BILL_STATE = #billState# BILL_STATE = #billState#
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,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 CONCAT('%',#partyA#,'%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="reviewStatus"> <isNotEmpty prepend=" AND " property="reviewStatus">
REVIEW_STATUS = #reviewStatus# REVIEW_STATUS = #reviewStatus#
...@@ -319,6 +319,9 @@ ...@@ -319,6 +319,9 @@
RECEIVE_WEIGHT <!-- 收货重量 --> RECEIVE_WEIGHT <!-- 收货重量 -->
) )
VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #settlementNumber#, #billTybe#, #billNumber#, #billState#, #signingDate#, #partyA#, #reviewStatus#, #taxPoints#, #thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#, #remainingAmount#, #receiveDate#, #contractType#, #inventTypeDetail#, #inventCode#, #inventName#, #spec#, #depositQty#, #receiveWeight#) VALUES (#id#, #accountCode#, #companyCode#, #companyName#, #settlementNumber#, #billTybe#, #billNumber#, #billState#, #signingDate#, #partyA#, #reviewStatus#, #taxPoints#, #thisSettlementTax#, #thisSettlementAmount#, #totalContractPriceIncluding#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #depCode#, #remainingAmount#, #receiveDate#, #contractType#, #inventTypeDetail#, #inventCode#, #inventName#, #spec#, #depositQty#, #receiveWeight#)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCW012
</selectKey>
</insert> </insert>
<delete id="delete"> <delete id="delete">
......
...@@ -865,7 +865,31 @@ public class HGCWTools { ...@@ -865,7 +865,31 @@ public class HGCWTools {
return results; return results;
} }
public static void countTaxAmount(List<Map> rows,HGCW012 hgcw012,Map<String, BigDecimal> rowMap) {
DecimalFormat decimalFormat = new DecimalFormat("#.000");
StringBuffer settlementNumber = new StringBuffer();
BigDecimal thisAmount = BigDecimal.ZERO;
BigDecimal taxPoints = new BigDecimal("13"); // 假设这是以整数形式给出的税率,比如17表示17%
BigDecimal taxRateAsDecimal = taxPoints.divide(new BigDecimal("100")).add(new BigDecimal("1")); // 将税率 转换为小数形式
if (CollectionUtils.isNotEmpty(rows)) {
for (Map row : rows) {
String amount = row.get("thisSettlementAmount").toString();
BigDecimal remainingAmount = new BigDecimal(amount);//发票总额
thisAmount = thisAmount.add(remainingAmount);
String c = row.get("receiveNo").toString();
settlementNumber.append(c).append(",");
rowMap.put(c, remainingAmount);
}
}
BigDecimal thisSettlementAmount = thisAmount.divide(taxRateAsDecimal, 2, RoundingMode.HALF_UP); //不含税金额
BigDecimal thisSettlementTax = thisAmount.subtract(thisSettlementAmount); // 计算 税额
hgcw012.setTaxPoints(new Integer(String.valueOf(taxPoints))); //税率
hgcw012.setThisSettlementTax(thisSettlementTax.toString()); //税额
hgcw012.setThisSettlementAmount(thisSettlementAmount.toString()); //不含税金额
hgcw012.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(thisAmount))); //发票总额
hgcw012.setRemainingAmount(new BigDecimal(decimalFormat.format(thisAmount))); //剩余发票金额
hgcw012.setSettlementNumber(settlementNumber.toString().substring(0, settlementNumber.length() - 1)); //来源单号
}
} }
public static class HgCw014 { public static class HgCw014 {
......
...@@ -151,7 +151,7 @@ function windowCallback() { ...@@ -151,7 +151,7 @@ function windowCallback() {
function contractDetailFunc(id) { function contractDetailFunc(id) {
JSColorbox.open({ JSColorbox.open({
href: "HGCW012C?methodName=initLoad&inqu_status-0-id=" + id + "&efParentFormEname=HGCW012", href: "HGCW012C?methodName=initLoad&inqu_status-0-mainId=" + id + "&efParentFormEname=HGCW012",
title: "<div style='text-align: center;'>明细详情</div>", title: "<div style='text-align: center;'>明细详情</div>",
width: "90%", width: "90%",
height: "90%", height: "90%",
......
...@@ -76,7 +76,6 @@ function btnSaveFunc(btnNode, gridNode) { ...@@ -76,7 +76,6 @@ function btnSaveFunc(btnNode, gridNode) {
} }
let flag = true; let flag = true;
if(gridNode == 'resultA'){ if(gridNode == 'resultA'){
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let thisAmount = item['thisAmount']; let thisAmount = item['thisAmount'];
let remainingAmount = item['remainingAmount']; let remainingAmount = item['remainingAmount'];
...@@ -90,7 +89,8 @@ function btnSaveFunc(btnNode, gridNode) { ...@@ -90,7 +89,8 @@ function btnSaveFunc(btnNode, gridNode) {
flag = false; flag = false;
return false; return false;
} }
})}; })
}
if (flag){ if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成票据吗?", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成票据吗?", {
ok: function () { ok: function () {
...@@ -201,6 +201,7 @@ $(function () { ...@@ -201,6 +201,7 @@ $(function () {
field: "receiveWeight", field: "receiveWeight",
title: "重量", title: "重量",
headerTemplate: "<span style='color: '>重量 </span>", headerTemplate: "<span style='color: '>重量 </span>",
format:"{0:N3}",
enable: false, enable: false,
locked: false locked: false
}, },
...@@ -209,12 +210,16 @@ $(function () { ...@@ -209,12 +210,16 @@ $(function () {
title: "收货日期", title: "收货日期",
headerTemplate: "<span style='color: '>收货日期 </span>", headerTemplate: "<span style='color: '>收货日期 </span>",
enable: false, enable: false,
locked: false locked: false,
template: function (date) {
return date.receiveDate ? convertToDate(date.receiveDate, "yyyy-MM-dd"):" ";
}
}, },
{ {
field: "amount", field: "amount",
title: "收货金额", title: "收货金额",
headerTemplate: "<span style='color: '>收货金额 </span>", headerTemplate: "<span style='color: '>收货金额 </span>",
format:"{0:N2}",
enable: false, enable: false,
locked: false locked: false
}, },
...@@ -222,7 +227,12 @@ $(function () { ...@@ -222,7 +227,12 @@ $(function () {
field: "thisSettlementAmount", field: "thisSettlementAmount",
title: "收票总额", title: "收票总额",
headerTemplate: "<span style='color: '>收票总额 </span>", headerTemplate: "<span style='color: '>收票总额 </span>",
locked: false format:"{0:N2}",
locked: false,
template: function (date) {
date.thisSettlementAmount = date.amount;
return date.amount
}
}], }],
loadComplete: function(grid) { loadComplete: function(grid) {
// 此 grid 对象 // 此 grid 对象
...@@ -286,7 +296,10 @@ $(function () { ...@@ -286,7 +296,10 @@ $(function () {
field: "contractDate", field: "contractDate",
title: "结算日期", title: "结算日期",
headerTemplate: "<span style='color: '>结算日期 </span>", headerTemplate: "<span style='color: '>结算日期 </span>",
locked: false locked: false,
template: function (date) {
return date.contractDate ? convertToDate(date.contractDate, "yyyy-MM-dd"):" ";
}
}, },
{ {
field: "taxPoints", field: "taxPoints",
...@@ -296,32 +309,37 @@ $(function () { ...@@ -296,32 +309,37 @@ $(function () {
}, },
{ {
field: "thisPriceTax", field: "thisPriceTax",
title: "收款价税合计金额", title: "收票价税合计金额",
headerTemplate: "<span style='color: '>收款价税合计金额 </span>", headerTemplate: "<span style='color: '>收票价税合计金额 </span>",
format:"{0:N2}",
locked: false locked: false
}, },
{ {
field: "thisSettlementTax", field: "thisSettlementTax",
title: "收款税金", title: "收票税金",
headerTemplate: "<span style='color: '>收款税金 </span>", headerTemplate: "<span style='color: '>收票税金 </span>",
format:"{0:N2}",
locked: false locked: false
}, },
{ {
field: "thisSettlementAmount", field: "thisSettlementAmount",
title: "收款金额", title: "收票金额",
headerTemplate: "<span style='color: '>收款金额 </span>", headerTemplate: "<span style='color: '>收票金额 </span>",
format:"{0:N2}",
locked: false locked: false
}, },
{ {
field: "thisAmount", field: "thisAmount",
title: "本次收款金额", title: "本次收票金额",
headerTemplate: "<span style='color: '>本次收款金额 </span>", headerTemplate: "<span style='color: '>本次收票金额 </span>",
format:"{0:N2}",
locked: false locked: false
}, },
{ {
field: "remainingAmount", field: "remainingAmount",
title: "剩余收款金额", title: "剩余收票金额",
headerTemplate: "<span style='color: '>剩余收款金额 </span>", headerTemplate: "<span style='color: '>剩余收票金额 </span>",
format:"{0:N2}",
locked: false locked: false
}], }],
loadComplete: function(grid) { loadComplete: function(grid) {
...@@ -388,7 +406,10 @@ $(function () { ...@@ -388,7 +406,10 @@ $(function () {
field: "signingDate", field: "signingDate",
title: "结算日期", title: "结算日期",
headerTemplate: "<span style='color: '>结算日期 </span>", headerTemplate: "<span style='color: '>结算日期 </span>",
locked: false locked: false,
template: function (date) {
return date.signingDate ? convertToDate(date.signingDate, "yyyy-MM-dd"):" ";
}
}, },
{ {
field: "taxPoints", field: "taxPoints",
...@@ -398,25 +419,29 @@ $(function () { ...@@ -398,25 +419,29 @@ $(function () {
}, },
{ {
field: "totalContractPriceIncluding", field: "totalContractPriceIncluding",
title: "收款价税合计金额", title: "收票价税合计金额",
headerTemplate: "<span style='color: '>收款价税合计金额 </span>", headerTemplate: "<span style='color: '>收票价税合计金额 </span>",
format:"{0:N2}",
locked: false locked: false
}, },
{ {
field: "valueAddedTax", field: "valueAddedTax",
title: "收款税金", title: "收票税金",
headerTemplate: "<span style='color: '>收款税金 </span>", headerTemplate: "<span style='color: '>收票税金 </span>",
format:"{0:N2}",
locked: false locked: false
}, },
{ {
field: "totalContractPriceExcluding", field: "totalContractPriceExcluding",
title: "收款金额", title: "收票金额",
headerTemplate: "<span style='color: '>收款金额 </span>", headerTemplate: "<span style='color: '>收票金额 </span>",
format:"{0:N2}",
locked: false locked: false
},{ },{
field: "thisAmount", field: "thisAmount",
title: "本次收款金额", title: "本次收票金额",
headerTemplate: "<span style='color: '>本次收款金额 </span>", headerTemplate: "<span style='color: '>本次收票金额 </span>",
format:"{0:N2}",
locked: false locked: false
}], }],
loadComplete: function(grid) { loadComplete: function(grid) {
......
...@@ -7,10 +7,11 @@ ...@@ -7,10 +7,11 @@
<head> <head>
</head> </head>
<EF:EFPage title="详情清单"> <EF:EFPage title="详情清单">
<EF:EFInput blockId="inqu_status" row="0" ename="id" cname="隐藏条件" type="hidden"/> <EF:EFInput blockId="inqu_status" row="0" ename="mainId" cname="隐藏条件" type="hidden"/>
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="projName" 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"/>
......
...@@ -288,6 +288,12 @@ function currMonth(getYear) { ...@@ -288,6 +288,12 @@ function currMonth(getYear) {
return year + '-' + (month < 10 ? '0' + month : month); return year + '-' + (month < 10 ? '0' + month : month);
} }
// 日期格式化yyyyMMddz转yyyy-MM-dd
function convertToDate(dateString,format) {
var parts = dateString.match(/(\d{4})(\d{2})(\d{2})/);
return dateFormate(new Date(parts[1], parts[2] - 1, parts[3]),format); // 月份是从0开始的,所以减1
}
/** /**
* cookie 操作 * cookie 操作
* *
...@@ -324,8 +330,8 @@ function getCookie(c_name) { ...@@ -324,8 +330,8 @@ function getCookie(c_name) {
/** /**
* *
* @param date * @param date 日期时间
* @param fmt * @param fmt 时间格式
* @returns {*} * @returns {*}
*/ */
function dateFormate(date, fmt) { function dateFormate(date, fmt) {
......
...@@ -126,7 +126,12 @@ ...@@ -126,7 +126,12 @@
return false; return false;
} }
}; };
/**
* 判断value是否可以,不可用返回defaultValue
* @param value
* @param defaultValue 默认值
* @returns {*}
*/
var defaultIfEmpty = function (value, defaultValue) { var defaultIfEmpty = function (value, defaultValue) {
if (!IPLAT.isAvailable(value)) { if (!IPLAT.isAvailable(value)) {
return defaultValue; return defaultValue;
...@@ -439,6 +444,11 @@ ...@@ -439,6 +444,11 @@
return eiblock; return eiblock;
} }
/**
* 设置grid数据
* @param resultId 根据resultId的类型,获取Kendo UI Grid控件实例或数据源实例。
* @param eiInfo 从eiInfo中获取分页信息(限制条数和偏移量),将eiInfo设置到Grid控件实例中。
*/
var grid_setEiInfo = function (resultId, eiInfo) { var grid_setEiInfo = function (resultId, eiInfo) {
var r, n = null, result = resultId; var r, n = null, result = resultId;
if (resultId.constructor == String) { if (resultId.constructor == String) {
...@@ -464,6 +474,11 @@ ...@@ -464,6 +474,11 @@
} }
} }
/**
* 用于设置数据源的数据,并根据条件对数据进行处理和赋值
* @param eiBlock 获取相关数据,包括数据总数count、限制数量limit和偏移量offset
* @param dataSource 根据传入的数据源类型,如果为字符串,则通过该字符串获取Kendo Grid对象,并将其数据源保存在n中
*/
var grid_setData = function (eiBlock, dataSource) { var grid_setData = function (eiBlock, dataSource) {
var count = 0, e = [], limit = 0, offset = 0; var count = 0, e = [], limit = 0, offset = 0;
if (eiBlock != undefined) { if (eiBlock != undefined) {
...@@ -610,15 +625,15 @@ ...@@ -610,15 +625,15 @@
var obj = {isGetForm: true, isRefreshre: true, isProgress: true, isAlldata: false}; var obj = {isGetForm: true, isRefreshre: true, isProgress: true, isAlldata: false};
$.extend(obj, parameter); $.extend(obj, parameter);
var _IPLAT = IPLAT; var _IPLAT = IPLAT;
var $activeElement = $(document.activeElement); var $activeElement = $(document.activeElement);// 获取焦点的元素
$activeElement.attr("disabled", true); $activeElement.attr("disabled", true); //禁用按钮 防止重复提交
// 点击的按钮 // 点击的按钮
if (obj.isProgress) { if (obj.isProgress) {
_IPLAT.progress($("body"), true); _IPLAT.progress($("body"), true); //弹出页面遮盖层
} }
var eiInfo = __eiInfo var eiInfo = __eiInfo
var info = obj.eiinfo || new EiInfo(); var info = obj.eiinfo || new EiInfo();
if (!IPLAT.isAvailable(obj.isGetForm) || obj.isGetForm === true) { if (!IPLAT.isAvailable(obj.isGetForm) || obj.isGetForm === true) { //IPLAT.isAvailable 判断对象是否为空
info.setByNodeObject(document.body); info.setByNodeObject(document.body);
} }
if (IPLAT.isAvailable(grid_ids)) { if (IPLAT.isAvailable(grid_ids)) {
...@@ -658,9 +673,9 @@ ...@@ -658,9 +673,9 @@
} }
$activeElement.attr("disabled", false); $activeElement.attr("disabled", false);
if (obj.isProgress) { if (obj.isProgress) {
_IPLAT.progress($("body"), false); _IPLAT.progress($("body"), false); //关闭页面遮盖层
} }
if (typeof obj.onSuccessCallback === 'function') { if (typeof obj.onSuccessCallback === 'function') { //onSuccessCallback 类型是函数就执行函数
obj.onSuccessCallback(ei); obj.onSuccessCallback(ei);
} }
}, },
...@@ -668,7 +683,7 @@ ...@@ -668,7 +683,7 @@
// 发生异常 // 发生异常
$activeElement.attr("disabled", false); $activeElement.attr("disabled", false);
if (obj.isProgress) { if (obj.isProgress) {
_IPLAT.progress($("body"), false); _IPLAT.progress($("body"), false); //关闭页面遮盖层
} }
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
} }
......
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