1
This commit is contained in:
@@ -44,7 +44,7 @@ def BeforeDoSaveExecute(e):
|
|||||||
if entity["SaleOrgId_Id"] != 100303:
|
if entity["SaleOrgId_Id"] != 100303:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if entity["DocumentStatus"] != "Z" and entity["DocumentStatus"] != "C":
|
if entity["DocumentStatus"] != "Z" and entity["DocumentStatus"] != "C" and entity["DocumentStatus"] != "D":
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
billId = entity["Id"]
|
billId = entity["Id"]
|
||||||
@@ -62,10 +62,10 @@ def BeforeDoSaveExecute(e):
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
sql = """/*dialect*/
|
sql = """/*dialect*/
|
||||||
SELECT SUM(t0.F_Amount) '累计核销金额',SUM(t0p.FRECADVANCEAMOUNT) '款到发货应收金额',SUM(t0p.CountTotal) '收款计划条数',SUM(ISNULL(t1.FALLAMOUNT,0)) '累计已发货金额'
|
SELECT SUM(t0.F_Amount) '累计核销金额',SUM(ISNULL(t0p.FRECADVANCEAMOUNT,0)) '款到发货应收金额',SUM(ISNULL(t0p.收款计划条数,0)) '收款计划条数',SUM(ISNULL(t1.FALLAMOUNT,0)) '累计已发货金额'
|
||||||
FROM T_SAL_ORDER t0
|
FROM T_SAL_ORDER t0
|
||||||
CROSS APPLY (
|
OUTER APPLY (
|
||||||
SELECT SUM(t0p.FRECADVANCEAMOUNT) 'FRECADVANCEAMOUNT',COUNT(1) 'CountTotal'
|
SELECT SUM(t0p.FRECADVANCEAMOUNT) 'FRECADVANCEAMOUNT',COUNT(1) '收款计划条数'
|
||||||
FROM T_SAL_ORDERPLAN t0p
|
FROM T_SAL_ORDERPLAN t0p
|
||||||
INNER JOIN T_BD_RECCONDITION_L t1_l on t1_l.FID = t0p.F_RECCONDITIONID
|
INNER JOIN T_BD_RECCONDITION_L t1_l on t1_l.FID = t0p.F_RECCONDITIONID
|
||||||
AND t1_l.FLOCALEID = 2052 AND CHARINDEX('款到发货',t1_l.FNAME) = 1
|
AND t1_l.FLOCALEID = 2052 AND CHARINDEX('款到发货',t1_l.FNAME) = 1
|
||||||
@@ -85,11 +85,19 @@ WHERE t0.FID IN ({0})
|
|||||||
item = res[0]
|
item = res[0]
|
||||||
|
|
||||||
if entity["SAL_DELIVERYNOTICEFIN"] != None and entity["SAL_DELIVERYNOTICEFIN"].Count > 0:
|
if entity["SAL_DELIVERYNOTICEFIN"] != None and entity["SAL_DELIVERYNOTICEFIN"].Count > 0:
|
||||||
|
# 本次发货价税合计
|
||||||
currAmount = entity["SAL_DELIVERYNOTICEFIN"][0]["BillAllAmount"]
|
currAmount = entity["SAL_DELIVERYNOTICEFIN"][0]["BillAllAmount"]
|
||||||
# raise Exception(str(currAmount))
|
# 累计核销金额
|
||||||
isYFHFlag = item["累计核销金额"] < item["款到发货应收金额"]
|
sumAmount = item["累计核销金额"]
|
||||||
isYFHFlag1 = isYFHFlag == True and (item["收款计划条数"] == 1)
|
# 款到发货应收金额
|
||||||
isYFHFlag2 = isYFHFlag == True and (True if isYFHFlag1 else ((item["累计核销金额"] - item["累计已发货金额"]) < currAmount))
|
sumArAmount = item["款到发货应收金额"]
|
||||||
entity["F_SFYFH"] = '是' if isYFHFlag2 == True else '否'
|
# 累计已发货金额
|
||||||
|
sumOutAmount = item["累计已发货金额"]
|
||||||
|
|
||||||
|
countPlan = item["收款计划条数"]
|
||||||
|
|
||||||
|
flag01 = sumAmount >= sumArAmount
|
||||||
|
flag02 = ((sumOutAmount + currAmount) <= sumAmount and (sumOutAmount + currAmount) <= sumArAmount)
|
||||||
|
flag03 = countPlan > 0 and (sumOutAmount + currAmount) > sumAmount and sumAmount < sumArAmount
|
||||||
|
entity["F_SFYFH"] = '是' if flag01 == False and flag02 == False and flag03 == True else '否'
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user