ReportPrintSet.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using SysBaseLibs;
  5. using System.Web.UI.HtmlControls;
  6. namespace SysDataLibs
  7. {
  8. public class ReportPrintSet
  9. {
  10. public ReportPrintSet(string pcTableName)
  11. {
  12. if (pcTableName.Trim().Length > 0)
  13. {
  14. DBConnSql loDBConn = new DBConnSql();
  15. if (loDBConn.Open()&&loDBConn.IsOpened)
  16. {
  17. string lcSql = " select CodeValue,DisplayValue from SysStatus where TableName='" + pcTableName + "' and ColName='Report' ";
  18. rsQuery loQuery = loDBConn.OpenQuery(lcSql);
  19. if (loQuery != null && loQuery.IsOpened && loQuery.RecCount > 0)
  20. {
  21. if (loQuery.GoToRecordByFieldsAndValues("CodeValue", "显示字段"))
  22. {
  23. _Columns = new List<string>();
  24. _ColumnsDis = new List<string>();
  25. _ColumnsWidth = new List<string>();
  26. string lcColumns = loQuery.GetString("DisplayValue");
  27. Array loArr = UtilStr.StrToArray(lcColumns);
  28. if (loArr != null && loArr.Length >0)
  29. {
  30. foreach (string lcStr in loArr)
  31. {
  32. if (lcStr.Trim().Length > 0)
  33. {
  34. Array loCol = UtilStr.StrToArrayEx(lcStr, ":");
  35. if (loCol != null && loCol.Length == 3)
  36. {
  37. _Columns.Add(loCol.GetValue(0).ToString());
  38. _ColumnsDis.Add(loCol.GetValue(1).ToString());
  39. _ColumnsWidth.Add(loCol.GetValue(2).ToString());
  40. }
  41. }
  42. }
  43. }
  44. }
  45. if (loQuery.GoToRecordByFieldsAndValues("CodeValue", "第一页记录数"))
  46. {
  47. _FirstPageNum = loQuery.GetInt("DisplayValue");
  48. }
  49. if (loQuery.GoToRecordByFieldsAndValues("CodeValue", "其他页记录数"))
  50. {
  51. _OtherPageNum = loQuery.GetInt("DisplayValue");
  52. }
  53. if (loQuery.GoToRecordByFieldsAndValues("CodeValue", "每页都打印表头"))
  54. {
  55. _PrintHeader = loQuery.GetBool("DisplayValue");
  56. }
  57. }
  58. }
  59. loDBConn.Close();
  60. }
  61. }
  62. private List<string> _Columns = null;
  63. public List<string> Columns
  64. {
  65. get { return _Columns; }
  66. }
  67. private List<string> _ColumnsDis = null;
  68. public List<string> ColumnsDis
  69. {
  70. get { return _ColumnsDis; }
  71. }
  72. private List<string> _ColumnsWidth = null;
  73. public List<string> ColumnsWidth
  74. {
  75. get { return _ColumnsWidth; }
  76. }
  77. private int _FirstPageNum = 0;
  78. public int FirstPageNum
  79. {
  80. get { return _FirstPageNum; }
  81. }
  82. private int _OtherPageNum=0;
  83. public int OtherPageNum
  84. {
  85. get { return _OtherPageNum; }
  86. }
  87. private bool _PrintHeader = false;
  88. public bool PrintHeader
  89. {
  90. get { return _PrintHeader; }
  91. }
  92. //public void PrintReport(rsQuery loQuery
  93. }
  94. }