Commit 9c61e8bd by liuyang

2024-08-05 销售开票 1.选择合同逻辑调整 2.查询条件界面调整

parent 9e0a6706
...@@ -609,4 +609,15 @@ ...@@ -609,4 +609,15 @@
</isNotEqual> </isNotEqual>
ORDER BY a.CONTRACT_NUMBER ORDER BY a.CONTRACT_NUMBER
</select> </select>
<update id="updateDeductionAmount">
UPDATE ${hggpSchema}.HGCW002
SET
REMAINING_AMOUNT = #remainingAmount#, <!-- 剩余金额-->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
WHERE
ID = #id#
</update>
</sqlMap> </sqlMap>
...@@ -408,7 +408,7 @@ ...@@ -408,7 +408,7 @@
<update id="updateDeductionAmount"> <update id="updateDeductionAmount">
UPDATE ${hggpSchema}.HGCW006 UPDATE ${hggpSchema}.HGCW006
SET SET
REMAINING_AMOUNT = #remainingAmount#, <!-- 审核状态 --> REMAINING_AMOUNT = #remainingAmount#, <!-- 剩余金额 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 --> UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 --> UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime# <!-- 记录修改时间 --> UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
......
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
ON T1.PROJ_CODE = B.PROJ_CODE ON T1.PROJ_CODE = B.PROJ_CODE
AND T1.CONTRACT_NUMBER = B.CONTRACT_NUMBER AND T1.CONTRACT_NUMBER = B.CONTRACT_NUMBER
AND T1.COMPANY_CODE = B.COMPANY_CODE AND T1.COMPANY_CODE = B.COMPANY_CODE
WHERE 1=1 AND B.CONTRACT_TYPE = 1 AND T1.REMAINING_AMOUNT != 0 WHERE 1=1 AND B.CONTRACT_TYPE = 1 AND T1.REMAINING_AMOUNT != 0 AND T1.REVIEW_STATUS = '3'
<include refid="condition" /> <include refid="condition" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
......
...@@ -311,6 +311,34 @@ public class HGCWTools { ...@@ -311,6 +311,34 @@ public class HGCWTools {
}); });
return results.get(0); return results.get(0);
} }
public static void deductionAmount(String contractNumber, BigDecimal deductionAmount) {
AssertUtils.isNull(contractNumber, "合同不能为空!");
// if (deductionAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!");
// }
List<HGCW002> results = DaoBase.getInstance().query(HGCW002.QUERY,new HashMap<String,Object>(){
{put("contractNumber",contractNumber);}
});
BigDecimal totalAmount = HgCw011.sumSettlementNumber(contractNumber);
if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的合同!");
}
DecimalFormat decimalFormat = new DecimalFormat("#.000");
HGCW002 hgcw002 = results.get(0);
List<HGCW002> hgcw002List = DaoBase.getInstance().query("HGCW010D.sumContractPrice",new HashMap<String,Object>(){
{put("contractNumberStr",contractNumber);}
});
BigDecimal remaining = hgcw002List.get(0).getTotalContractPriceIncluding().add(hgcw002List.get(0).getTotalContractPriceIncluding().multiply(new BigDecimal("0.2")));
BigDecimal remainingAmount = new BigDecimal(decimalFormat.format(remaining.subtract(deductionAmount.add(totalAmount))));
if (remainingAmount.compareTo(new BigDecimal(BigInteger.ZERO)) < 0) {
throw new PlatException("本次开票金额加累计开票金额超出销售合同金额20%,超出20%需要业务新增补充协议");
}
BigDecimal remainingCount = new BigDecimal(decimalFormat.format(hgcw002.getRemainingAmount().subtract(deductionAmount)));
hgcw002.setRemainingAmount(remainingCount);
DaoUtils.update("HGCW002.updateDeductionAmount", hgcw002);
}
} }
public static class HgCw003{ public static class HgCw003{
...@@ -355,7 +383,7 @@ public class HGCWTools { ...@@ -355,7 +383,7 @@ public class HGCWTools {
// if (deductionAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) { // if (deductionAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!"); // throw new PlatException("扣款金额不能小于等于0!");
// } // }
List<HGCW006> results = DaoBase.getInstance().query(HGCW008.QUERY,new HashMap<String,Object>(){ List<HGCW006> results = DaoBase.getInstance().query(HGCW006.QUERY,new HashMap<String,Object>(){
{put("contractNumber",settlementNumber);} {put("contractNumber",settlementNumber);}
}); });
if (CollectionUtils.isEmpty(results)) { if (CollectionUtils.isEmpty(results)) {
...@@ -694,6 +722,19 @@ public class HGCWTools { ...@@ -694,6 +722,19 @@ public class HGCWTools {
}); });
return results; return results;
} }
public static BigDecimal sumSettlementNumber(String settlementNumber) {
AssertUtils.isNull(settlementNumber, "来源单号不能为空!");
List<HGCW011> results = DaoBase.getInstance().query(HGCW011.QUERY,new HashMap<String,Object>(){
{put("settlementNumber",settlementNumber);}
});
AssertUtils.isEmpty(results, "找不到对应的销售开票记录!");
BigDecimal totalAmount = new BigDecimal("0");
for (HGCW011 hgcw011: results) {
totalAmount = totalAmount.add(hgcw011.getTotalContractPriceIncluding());
}
return totalAmount;
}
} }
/** /**
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
<EF:EFColumn ename="companyName" cname="所属公司" align="center" enable="false"/> <EF:EFColumn ename="companyName" cname="所属公司" align="center" enable="false"/>
<EF:EFColumn ename="projCode" cname="项目编号" align="center" enable="false"/> <EF:EFColumn ename="projCode" cname="项目编号" align="center" enable="false"/>
<EF:EFColumn ename="projName" cname="项目名称" align="center" enable="false"/> <EF:EFColumn ename="projName" cname="项目名称" align="center" enable="false"/>
<EF:EFColumn ename="signingDate" cname="签订日期" align="center" enable="false"/> <EF:EFColumn ename="signingDate" cname="签订日期" align="center" enable="false"
editType="date" parseFormats="['yyyyMMdd']" parseFormat="yyyy-MM-dd"/>
<EF:EFColumn ename="contractNumber" cname="合同号" align="center" enable="false"/> <EF:EFColumn ename="contractNumber" cname="合同号" align="center" enable="false"/>
<EF:EFColumn ename="contractName" cname="合同名称" align="center" enable="false"/> <EF:EFColumn ename="contractName" cname="合同名称" align="center" enable="false"/>
<EF:EFColumn ename="partyA" cname="甲方名称" align="center" enable="false"/> <EF:EFColumn ename="partyA" cname="甲方名称" align="center" enable="false"/>
......
...@@ -26,6 +26,8 @@ $(function() { ...@@ -26,6 +26,8 @@ $(function() {
loadComplete: function (grid) { loadComplete: function (grid) {
//此grid对象 //此grid对象
$("#SELECT_BILL").on("click",addFunc); $("#SELECT_BILL").on("click",addFunc);
$("#SELECT_CONT").on("click",add1Func);
$("#SELECT_LEASE").on("click",add2Func);
$("#SUBMIT").on("click",submitFunc); $("#SUBMIT").on("click",submitFunc);
$("#BTN_BILL").on("click",billFunc); $("#BTN_BILL").on("click",billFunc);
$("#BII_SAVE").on("click",saveFunc); $("#BII_SAVE").on("click",saveFunc);
...@@ -94,6 +96,24 @@ function addFunc() { ...@@ -94,6 +96,24 @@ function addFunc() {
callbackName: windowCallback callbackName: windowCallback
}); });
} }
function add1Func() {
JSColorbox.open({
href: "HGCW010D?methodName=initLoad&efParentFormEname=HGCW010",
title: "<div style='text-align: center;'>合同管理</div>",
width: "90%",
height: "90%",
callbackName: windowCallback
});
}
function add2Func() {
JSColorbox.open({
href: "HGCW010E?methodName=initLoad&efParentFormEname=HGCW010",
title: "<div style='text-align: center;'>租赁合同</div>",
width: "90%",
height: "90%",
callbackName: windowCallback
});
}
/** /**
* 保存 * 保存
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="false" readonly="true" align="center" <EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="false" readonly="true" align="center"
editType="date" parseFormats="['yyyyMMdd']" parseFormat="yyyy-MM-dd"/> editType="date" parseFormats="['yyyyMMdd']" parseFormat="yyyy-MM-dd"/>
<EF:EFColumn ename="billNumber" cname="发票号" width="120" format="{0:N3}" align="center"/> <EF:EFColumn ename="billNumber" cname="发票号" width="120" format="{0:N3}" align="center"/>
<EF:EFComboColumn ename="taxPoints" cname="税" width="120" align="center" required="true" <EF:EFComboColumn ename="taxPoints" cname="税" width="120" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" >
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/> <EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn> </EF:EFComboColumn>
......
...@@ -36,13 +36,13 @@ ...@@ -36,13 +36,13 @@
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/> <EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="partyA" cname="客户名称" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="partyA" cname="客户名称" width="160" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="projCode" cname="项目编号" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="projCode" cname="项目编号" width="130" 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="settlementNumber" 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="contractDate" cname="结算日期" width="120" enable="false" readonly="true" align="center" <EF:EFColumn ename="contractDate" cname="结算日期" width="120" enable="false" readonly="true" align="center"
editType="date" parseFormats="['yyyyMMdd']" parseFormat="yyyy-MM-dd"/> editType="date" parseFormats="['yyyyMMdd']" parseFormat="yyyy-MM-dd"/>
<EF:EFColumn ename="taxPoints" cname="税率(%)" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="taxPoints" cname="税率(%)" width="80" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="thisPriceTax" cname="结算价税合计金额" hidden="true"/> <EF:EFColumn ename="thisPriceTax" cname="结算价税合计金额" hidden="true"/>
<EF:EFColumn ename="thisSettlementTax" cname="结算税金" width="120" enable="false" readonly="true" format="{0:N3}" editType="text" <EF:EFColumn ename="thisSettlementTax" cname="结算税金" width="120" enable="false" readonly="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="15" required="false" displayType="0.000" sort="true" align="right" maxLength="15" required="false"
......
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