FrmSliceStatisticsDetail.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. namespace LYFZ.Software.MainBusiness.StatisticalInquiry
  7. {
  8. public class FrmSliceStatisticsDetail : LYFZ.Software.UI.StatisticalInquiry.FrmSliceStatisticsDetail
  9. {
  10. BLL.BLL_ErpOrdersPhotography photographyBll = new BLL.BLL_ErpOrdersPhotography();
  11. public string startTime = "";
  12. public string endTime = "";
  13. public string employeeId = "";
  14. public string employeeKey = "";
  15. public string employeeName = "";
  16. public string employeeKeyName = "";
  17. public string countData = "";
  18. public string tempStrWhere = "";
  19. public FrmSliceStatisticsDetail()
  20. {
  21. this.Load += FrmSliceStatisticsDetail_Load;
  22. }
  23. void FrmSliceStatisticsDetail_Load(object sender, EventArgs e)
  24. {
  25. this.btn_Export.Click += btn_Export_Click;
  26. SearchDataGridView();
  27. }
  28. void btn_Export_Click(object sender, EventArgs e)
  29. {
  30. //throw new NotImplementedException();
  31. this.dgvData.ExportDataTable();
  32. }
  33. void SearchDataGridView()
  34. {
  35. this.dgvData.Rows.Clear();
  36. string strWhere = "";
  37. int totalCount = 0;
  38. strWhere = "( Ordpg_Photographer like '%" + employeeId + "%' or Ordpg_PhotographyAssistant like '%" +
  39. employeeId + "%' or Ordpg_MakeupArtist like '%" + employeeId + "%' or Ordpg_MakeupAssistant like '%" +
  40. employeeId + "%' or Ordpg_BootDivision like '%" + employeeId + "%' or Ordpg_BootDivisionAssistant like '%" +
  41. employeeId + "%' or Ordv_EarlyRepairName like '%" + employeeId + "%' or Ordv_RefinementName like '%" +
  42. employeeId + "%' or Ordv_FilmSelectionName like '%" + employeeId + "%' or Ordv_DesignerName like '%" +
  43. employeeId + "%' )";
  44. if(!string.IsNullOrEmpty(employeeKey))
  45. {
  46. strWhere = "( "+employeeKey+" = '" + employeeId + "' )";
  47. }
  48. if(!string.IsNullOrEmpty(tempStrWhere))
  49. {
  50. if(!string.IsNullOrEmpty(strWhere))
  51. {
  52. strWhere += " and ";
  53. }
  54. strWhere += tempStrWhere;
  55. }
  56. DataTable selectionData = photographyBll.GetOrdersPhotographyDataBySelection(
  57. startTime, endTime, strWhere, true
  58. );
  59. totalCount = selectionData.Rows.Count;
  60. List<string> dicList = new List<string>();
  61. foreach(DataRow dr in selectionData.Rows)
  62. {
  63. if (dicList.IndexOf(dr["Ordpg_ViceNumber"].ToString()) == -1)
  64. {
  65. dicList.Add(dr["Ordpg_ViceNumber"].ToString());
  66. }
  67. }
  68. if (dicList.Count > 0)
  69. {
  70. strWhere = " Ordpg_ViceNumber in ('" + string.Join("','", dicList.ToArray()) + "') ";
  71. selectionData = photographyBll.GetOrdersPhotographyDataBySelection(
  72. startTime, endTime, strWhere, true
  73. );
  74. }
  75. string dRowNumber = "";
  76. decimal totalValue = 0;
  77. decimal totalPickValue = 0;
  78. decimal totalPaymentValue = 0;
  79. foreach(DataRow dr in selectionData.Rows)
  80. {
  81. int rowIndex = this.dgvData.Rows.Add();
  82. System.Windows.Forms.DataGridViewRow dgvRow = this.dgvData.Rows[rowIndex];
  83. if(dRowNumber!=dr["ord_Number"].ToString())
  84. {
  85. dRowNumber = dr["ord_Number"].ToString();
  86. dgvRow.Cells["ord_Number"].Value = dr["ord_Number"].ToString();
  87. dgvRow.Cells["ord_OrderClass"].Value = dr["ord_OrderClass"].ToString();
  88. dgvRow.Cells["Ord_CustomerSource"].Value = dr["Ord_CustomerSource"].ToString();
  89. dgvRow.Cells["Ord_SeriesName"].Value = dr["Ord_SeriesName"].ToString();
  90. dgvRow.Cells["套系金额"].Value = dr["套系金额"].ToString();
  91. dgvRow.Cells["加挑金额"].Value = dr["加挑金额"].ToString();
  92. dgvRow.Cells["收款金额"].Value = dr["收款金额"].ToString();
  93. dgvRow.Cells["Cus_Name"].Value = dr["Cus_Name"].ToString();
  94. dgvRow.Cells["Cus_Telephone"].Value = dr["Cus_Telephone"].ToString();
  95. totalValue += Convert.ToDecimal(dr["套系金额"].ToString());
  96. totalPickValue += Convert.ToDecimal(dr["加挑金额"].ToString());
  97. totalPaymentValue += Convert.ToDecimal(dr["收款金额"].ToString());
  98. }
  99. dgvRow.Cells["Ordpg_Sights"].Value = dr["Ordpg_Sights"].ToString();
  100. dgvRow.Cells["景点类型"].Value = dr["景点类型"].ToString();
  101. dgvRow.Cells["景点等级"].Value = dr["景点等级"].ToString();
  102. dgvRow.Cells["摄影师"].Value = dr["摄影师"].ToString();
  103. dgvRow.Cells["摄影助理"].Value = dr["摄影助理"].ToString();
  104. dgvRow.Cells["化妆师"].Value = dr["化妆师"].ToString();
  105. dgvRow.Cells["化妆助理"].Value = dr["化妆助理"].ToString();
  106. dgvRow.Cells["引导师"].Value = dr["引导师"].ToString();
  107. dgvRow.Cells["引导助理"].Value = dr["引导助理"].ToString();
  108. dgvRow.Cells["初修师"].Value = dr["初修师"].ToString();
  109. dgvRow.Cells["精修师"].Value = dr["精修师"].ToString();
  110. dgvRow.Cells["选片师"].Value = dr["选片师"].ToString();
  111. dgvRow.Cells["设计师"].Value = dr["设计师"].ToString();
  112. dgvRow.Cells["选片时间"].Value = dr["选片时间"].ToString();
  113. }
  114. lab_Text.Text = employeeName + " ";
  115. if (!string.IsNullOrEmpty(employeeKeyName))
  116. {
  117. lab_Text.Text += employeeKeyName + " " + totalCount + "次 ";
  118. }
  119. lab_Text.Text += "套系总金额:" + totalValue + " 加挑总金额:" + totalPickValue + " 收款总金额:" + totalPaymentValue;
  120. }
  121. }
  122. }