/****************************** * 说明:单据水印 * 创建人:龚宇超 * 创建日期:2017-12-04 * 修改人: * 修改日期: * 修改备注: * 版本:1.0.0.0 ******************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; namespace Lskj.Model { /// /// 单据水印 /// public class WaterMark { /// /// 单据状态文本(草稿、在审、待审、已终审、已过账、已作废、已关闭) /// public string Text; /// /// 单据打印次数 /// public string Print; /// /// 已收款 /// public string Collect; /// /// 初始化水印 /// /// The prefix. /// The row item. public WaterMark(string prefix,DataRow rowItem) { if (rowItem == null) { // 设置为草稿 this.Text = "草 稿"; if (!string.IsNullOrWhiteSpace(ERPInfo.Instance.DraftReplacementValue)) { this.Text = ERPInfo.Instance.DraftReplacementValue; } } else { // 设置显示文本 DataColumnCollection columns = rowItem.Table.Columns; if (columns.Contains(prefix + "waste_flag") && ("1".Equals(rowItem[prefix + "waste_flag"] + "") || "true".Equals((rowItem[prefix + "waste_flag"] + "").ToLower()))) { this.Text = "已作废"; } else if ((columns.Contains(prefix + "cancelflag")) && ("1".Equals(rowItem[prefix + "cancelflag"] + "") ||"true".Equals((rowItem[prefix + "cancelflag"] + "").ToLower()))) { this.Text = "已关闭"; } else if (columns.Contains(prefix + "stepover") && ("1".Equals(rowItem[prefix + "stepover"] + "") || "true".Equals((rowItem[prefix + "stepover"] + "").ToLower()))) { this.Text = "已终审"; if (columns.Contains(prefix + "collectMoneyFlag")) { this.Text = "已过账"; } } else if (columns.Contains(prefix + "ban") && ("1".Equals(rowItem[prefix + "ban"] + "") || "true".Equals((rowItem[prefix + "ban"] + "").ToLower()))) { this.Text = "在 审"; } else if (columns.Contains(prefix + "affirmer") && ("0" != rowItem[prefix + "affirmer"] + "" && !string.IsNullOrEmpty(rowItem[prefix + "affirmer"] + ""))) { this.Text = "待 审"; } else { this.Text = "草 稿"; if (!string.IsNullOrWhiteSpace(ERPInfo.Instance.DraftReplacementValue)) { this.Text = ERPInfo.Instance.DraftReplacementValue; } } // 设置打印文本 if (columns.Contains(prefix + "printCount")) { this.Print = "打印" + (string.IsNullOrEmpty(rowItem[prefix + "printCount"] + "") ? "0次" : rowItem[prefix + "printCount"] + "次"); if (ERPInfo.Instance.Translatable) { string quantity = string.IsNullOrEmpty(rowItem[prefix + "printCount"] + "") ? "0" : rowItem[prefix + "printCount"]+""; this.Print = ERPInfo.Instance.GetTranslatedText("打印") + quantity + ERPInfo.Instance.GetTranslatedText("次"); } } // 设置收款文本 if (columns.Contains(prefix + "collectMoneyFlag") && "1".Equals(rowItem[prefix + "collectMoneyFlag"] + "")) { this.Collect = "已收款"; } } if (ERPInfo.Instance.Translatable) { if(!string.IsNullOrWhiteSpace(this.Text))this.Text = ERPInfo.Instance.GetTranslatedText(this.Text); if (!string.IsNullOrWhiteSpace(this.Collect)) this.Collect = ERPInfo.Instance.GetTranslatedText(this.Collect); } } } }