销售订单按发货日期变色_列表条件格式化

场景

客户要求一眼看清哪些订单要发货了。希望未来七天要发货的每天不同色标识,以免遗漏和方便备货。
一段Python代码搞定,未来七天要发货的黄色背景,字体每天不同色。

其他业务需求可以参考修改源代码。

# 第一步:按照需要添加程序集引用
import clr
clr.AddReference('mscorlib')
from System import *

def OnFormatRowConditions(args):
if (args.DataRow.DynamicObject["FDeliveryDate"] >= DateTime.Now.Date and args.DataRow.DynamicObject["FDeliveryDate"] < DateTime.Now.Date.AddDays(1)):
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#FF0000"
fc.BackColor = "#fefedf"
args.FormatConditions.Add(fc);
elif (args.DataRow.DynamicObject["FDeliveryDate"] >= DateTime.Now.Date.AddDays(1)and args.DataRow.DynamicObject["FDeliveryDate"] < DateTime.Now.Date.AddDays(2)):
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#c55a11"
fc.BackColor = "#fefedf"
args.FormatConditions.Add(fc);
elif (args.DataRow.DynamicObject["FDeliveryDate"] >= DateTime.Now.Date.AddDays(2)and args.DataRow.DynamicObject["FDeliveryDate"] < DateTime.Now.Date.AddDays(3)):
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#7030a0"
fc.BackColor = "#fefedf"
args.FormatConditions.Add(fc);
elif (args.DataRow.DynamicObject["FDeliveryDate"] >= DateTime.Now.Date.AddDays(3)and args.DataRow.DynamicObject["FDeliveryDate"] < DateTime.Now.Date.AddDays(4)):
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#0303fd"
fc.BackColor = "#fefedf"
args.FormatConditions.Add(fc);
elif (args.DataRow.DynamicObject["FDeliveryDate"] >= DateTime.Now.Date.AddDays(4)and args.DataRow.DynamicObject["FDeliveryDate"] < DateTime.Now.Date.AddDays(5)):
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#00b0f0"
fc.BackColor = "#fefedf"
args.FormatConditions.Add(fc);
elif (args.DataRow.DynamicObject["FDeliveryDate"] >= DateTime.Now.Date.AddDays(5)and args.DataRow.DynamicObject["FDeliveryDate"] < DateTime.Now.Date.AddDays(6)):
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#ec43e4"
fc.BackColor = "#fefedf"
args.FormatConditions.Add(fc);
elif (args.DataRow.DynamicObject["FDeliveryDate"] >= DateTime.Now.Date.AddDays(6)and args.DataRow.DynamicObject["FDeliveryDate"] < DateTime.Now.Date.AddDays(7)):
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#002060"
fc.BackColor = "#fefedf"
args.FormatConditions.Add(fc);
elif (args.DataRow.DynamicObject["FDeliveryDate"] >= DateTime.Now.Date.AddDays(7)and args.DataRow.DynamicObject["FDeliveryDate"] < DateTime.Now.Date.AddDays(8)):
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#d65db1"
fc.BackColor = "#fefedf"
args.FormatConditions.Add(fc);
elif args.DataRow.DynamicObject["FDeliveryDate"] > DateTime.Now.Date.AddDays(8):
fc = FormatCondition()
fc.ApplayRow = True
fc.ForeColor = "#008f7a"
fc.BackColor = "#fefedf"
args.FormatConditions.Add(fc);

列表上添加以上Python格式化代码:

 

 

暂无评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

本站提供金蝶、钉钉等开发实施相关技术文章的发布和转载。如有侵权,联系立删(info@zjgkd.cn) 。
Powered by WordPress · 苏ICP备13058196号-11