123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.StatisticalEmployeeWork
- {
- public partial class WorkStatisticalDayFilmSelectionToProductComplete : LYFZ.Software.UI.StatisticalEmployeeWork.WorkStatisticalDayFilmSelectionToProductComplete
- {
- public WorkStatisticalDayFilmSelectionToProductComplete()
- {
- this.Load += WorkStatisticalDayFilmSelectionToProductComplete_Load;
- this.btnQuery.Click += btnQuery_Click;
- this.btnClose.Click += btnClose_Click;
- this.dgvData.ColumnHeaderMouseClick += dgvData_ColumnHeaderMouseClick;
- }
- /// <summary>
- /// 员工编号
- /// </summary>
- string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void WorkStatisticalDayFilmSelectionToProductComplete_Load(object sender, EventArgs e)
- {
- this.dtDateTimeEnd.DateValue = SDateTime.Now.ToString("yyyy-MM-dd");
- this.dtDateTimeStart.DateValue = Convert.ToDateTime(this.dtDateTimeEnd.DateValue).AddMonths(-3).ToString("yyyy-MM-01");
- // 部门人员绑定
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cbxTreeViewDepartment, IsFirstNodeNull: true, IsFirstNodeName: "全部", IsShowResign: false, IsShowAdmin: true, tb_User: LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable);
- this.cbxTreeViewDepartment.TextFindTag("全部");
- this.PublicFunctionRows();
- bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(VersionControl.VersionFunctionEnum.工作统计);
- if (!b)
- {
- this.Close();
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 列表标题的点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- string StrColumnName = this.dgvData.Columns[e.ColumnIndex].Name.Trim();
- if (StrColumnName == this.StrCurrentClickField || string.IsNullOrEmpty(this.StrCurrentClickField))
- {
- if (this.StrSortOrder == "ASC")
- {
- this.StrSortOrder = "DESC";
- }
- else
- {
- this.StrSortOrder = "ASC";
- }
- }
- else
- {
- this.StrSortOrder = "DESC";
- }
- this.StrSortField = StrColumnName + " " + this.StrSortOrder + "";
- this.StrCurrentClickField = StrColumnName;
- DataRow[] dtRows = this.newTable.Select("1 = 1", StrColumnName + " " + StrSortOrder);
- this.PublicFunctionRows(dtRows);
- }
- /// <summary>
- /// 当前点击的字段
- /// </summary>
- string StrCurrentClickField = "";
- /// <summary>
- /// 排序字段
- /// </summary>
- string StrSortField = "DATEDIFF(day, Ordv_FilmSelectionTime, Ords_ProductCompletedTime) DESC";
- /// <summary>
- /// 排序顺序
- /// </summary>
- string StrSortOrder = "DESC";
- DataTable newTable = new DataTable();
- /// <summary>
- /// 创建行
- /// </summary>
- void PublicFunctionRows()
- {
- if (string.IsNullOrEmpty(this.dtDateTimeStart.DateValue.Trim()) && string.IsNullOrEmpty(this.dtDateTimeEnd.DateValue.Trim()))
- {
- MessageBoxCustom.Show("日期段不能为空"); return;
- }
- if (Convert.ToDateTime(this.dtDateTimeEnd.DateValue) < Convert.ToDateTime(this.dtDateTimeStart.DateValue))
- {
- MessageBoxCustom.Show("开始日期不能大于结束日期"); return;
- }
- this.dgvData.dgvCurrentColumnOriginalSet = "Ord_Number,Ordv_ViceNumber,订单号,订单类型,客户姓名,客户性别,客户电话,套系名称,套系价格,拍摄名称,选片师,选片时间,选片状态,商品完成时间,用时(天)";
- string StrGuidName = LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0007.ToString().Trim();
- this.dgvData.dgvFixedHideColumn = "Ord_Number,Ordv_ViceNumber";
- this.dgvData.dgvGuidName = StrGuidName;
- this.dgvData.dgvUserEmployeeID = this.StrUserID;
- this.dgvData.StrValueNullColumn = "订单号,客户姓名,客户性别,客户电话,订单类型,接单人,套系名称,套系价格,会员卡号";
- this.dgvData.StrSecondStageNull = "加急,加急日期,拍摄名称,拍照状态,设计状态,设计师,设计日期,看版状态,看版师,看版日期,取件状态";
- Dictionary<string, string> dictColumns = LYFZ.DAL.DAL_GridViewDisplayIndex.GetdictColumns(this.dgvData.dgvCurrentColumnOriginalSet);
- this.dgvData.dictShowColumName = dictColumns;
- string StrQueryCondition = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Ords_ProductCompletedTime", this.dtDateTimeStart.DateValue.Trim(), this.dtDateTimeEnd.DateValue.Trim());
- ItemValue itemValue = GetCompanyDataInfo();
- int intTopCount = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- this.newTable = LYFZ.BLL.BLL_ErpOrderView.GetData_WorkStatistical_FilmSelectionToProductComplete(dictColumns, StrQueryCondition, "Order By " + this.StrSortField, itemValue.Text, itemValue.Value.ToString_s());
- });
- if (this.newTable.Rows.Count > 0)
- {
- this.PublicFunctionRows(this.newTable.Select());
- }
- else
- {
- this.dgvData.DataColumns(this.dgvData.dgvCurrentColumnOriginalSet, strHideField: this.dgvData.dgvFixedHideColumn);
- }
- string strText = string.Format("订单数量:{0} ", this.newTable.Rows.Count);
- // 套系价格列求和;
- try
- {
- double sumObject = 0.0f;// Convert.ToDouble(this.newTable.Compute("sum(cast('套系价格' as float))", "true"));
- foreach ( DataRow dr in this.newTable.Rows )
- {
- sumObject += Convert.ToDouble(dr["套系价格"].ToString());
- }
- strText += string.Format(" 套系总价:{0:N2}, 套系平均价:{1:N2}", sumObject, sumObject / this.newTable.Rows.Count);
- }
- catch (Exception e) {
- }
- this.txtStatisticalText.Text = strText;
- }
- /// <summary>
- /// 处理数据
- /// </summary>
- /// <param name="dtRows"></param>
- void PublicFunctionRows(DataRow[] dtRows)
- {
- this.dgvData.DataColumns(this.newTable.Columns, strHideField: this.dgvData.dgvFixedHideColumn);
- this.dgvData.FillLastColumn();
- DataGridViewRow dgvr = null;
- DataGridViewCell cell = null;
- for (int i = 0; i < dtRows.Length; i++)
- {
- dgvr = new DataGridViewRow();
- for (int j = 0; j < this.newTable.Columns.Count; j++)
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = dtRows[i][this.newTable.Columns[j].ColumnName.Trim()].ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- this.dgvData.Rows.Add(dgvr);
- }
- this.dgvData.Columns["客户姓名"].Frozen = true;
- this.dgvData.Columns["套系名称"].Width = 180;
- this.dgvData.Columns["选片时间"].Width = 120;
- this.dgvData.Columns["商品完成时间"].Width = 120;
- this.dgvData.ClearSelection();
- }
- /// <summary>
- /// 获取数据
- /// </summary>
- /// <returns></returns>
- ItemValue GetCompanyDataInfo()
- {
- ItemValue itemValue = new ItemValue("", "");
- if (this.cbxTreeViewDepartment.Tag != null && this.cbxTreeViewDepartment.TreeView.SelectedNode != null)
- {
- string dataValue = this.cbxTreeViewDepartment.Tag.ToString();
- string dataType = this.cbxTreeViewDepartment.StrGetName.Trim();
- itemValue.Text = dataType;
- itemValue.Value = dataValue;
- if (dataType.Length > 0)
- {
- switch (dataType.ToLower())
- {
- case "storename":
-
- break;
- case "department":
- itemValue.Value = dataValue ;
- break;
- case "user":
- itemValue.Value = dataValue ;
- break;
- }
- }
- }
- return itemValue;
- }
- }
- }
|