123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.CameraControlBook.SmallForm
- {
- public partial class A_EmployeeScheduleSmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.A_EmployeeScheduleSmallForm
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- public A_EmployeeScheduleSmallForm()
- {
- this.Load += A_EmployeeScheduleSmallForm_Load;
- this.Shown += A_EmployeeScheduleSmallForm_Shown;
- this.btnLastWeek.Click += btnLastWeek_Click;
- this.btnNextWeek.Click += btnNextWeek_Click;
- this.btnQuery.Click += btnQuery_Click;
- this.btnClose.Click += btnClose_Click;
- this.dtpYearMonth.ClickChengedValue += dtpYearMonth_ClickChengedValue;
- this.dtpYearMonth.KeyDown += dtpYearMonth_KeyDown;
- this.chkWeekMode.Click += chkWeekMode_Click;
- this.cmbtreevDepartment.ComboBoxTree_NodeMouseClick += cmbtreevDepartment_ComboBoxTree_NodeMouseClick;
- this.dgvData.CellMouseDown += dgvData_CellMouseDown;
- this.dgvData.DataGridViewConMenu_ItemClicked += dgvData_DataGridViewConMenu_ItemClicked;
- this.dgvData.CellMouseDoubleClick += dgvData_CellMouseDoubleClick;
- }
- /// <summary>
- /// 分店数据
- /// </summary>
- DataTable dtStore = new DataTable();
- /// <summary>
- /// 部门数据
- /// </summary>
- DataTable dtDepartment = new DataTable();
- /// <summary>
- /// 周的开始
- /// </summary>
- DateTime WeekStartDate;
- /// <summary>
- /// 周的结束
- /// </summary>
- DateTime WeekEndDate;
- /// <summary>
- /// 有几个影楼的权限
- /// </summary>
- int StoreNameCount = 0;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void A_EmployeeScheduleSmallForm_Load(object sender, EventArgs e)
- {
- dtStore = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: "", ShowColumnName: "Company_DividedShop,Company_Name").Tables[0];
- dtStore.PrimaryKey = new DataColumn[] { dtStore.Columns["Company_DividedShop"] };
- dtDepartment = orbll.GetView_Custom("tb_ErpDepartment", StrWhere: "", ShowColumnName: "ID,Dt_Name").Tables[0];
- dtDepartment.PrimaryKey = new DataColumn[] { dtDepartment.Columns["ID"] };
- }
- /// <summary>
- /// 人员绑定
- /// </summary>
- void PublicPerson()
- {
- this.cmbtreevDepartment.Nodes.Clear();
- DataTable dtStoreName = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindGroupStoreName("pb002", StrGroupKeyCode: "st064");
- DataTable dtDepartment = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.Tbl_Department;
- DataTable dtUser = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetVersionDataTable.GetUserTable(IsShowResign: false, IsShowAdmin: false);
- this.StoreNameCount = dtStoreName.Rows.Count;
- for (int k = 0; k < dtStoreName.Rows.Count; k++)
- {
- TreeNode rootStore = null;
- if (dtStoreName.Rows.Count == 1 && k == 0)
- {
- TreeNode rootNull = new TreeNode();
- rootNull.Text = " ";
- rootNull.Tag = "";
- rootNull.Name = "";
- this.cmbtreevDepartment.Nodes.Add(rootNull);
- }
- else
- {
- rootStore = new TreeNode();
- rootStore.Text = dtStoreName.Rows[k]["Company_Name"].ToString().Trim();
- rootStore.Tag = dtStoreName.Rows[k]["Company_DividedShop"].ToString().Trim();
- rootStore.Name = "StoreName";
- }
- for (int i = 0; i < dtDepartment.Rows.Count; i++)
- {
- DataRow[] dtRow = dtUser.Select("User_Department='" + dtDepartment.Rows[i]["ID"].ToString().Trim() + "' And User_DividedShop = '" + dtStoreName.Rows[k]["Company_DividedShop"].ToString().Trim() + "'");
- if (dtRow.Length <= 0)
- { continue; }
- TreeNode nodes = new TreeNode();
- nodes.Text = dtDepartment.Rows[i]["Dt_Name"].ToString();
- nodes.Tag = dtDepartment.Rows[i]["ID"].ToString().Trim();
- nodes.Name = "Department";
- TreeNode node;
- for (int j = 0; j < dtRow.Length; j++)
- {
- node = new TreeNode();
- node.Text = dtRow[j]["User_Name"].ToString();
- node.Tag = dtRow[j]["User_EmployeeID"].ToString();
- node.Name = "User";
- nodes.Nodes.Add(node);
- }
- if (rootStore == null)
- { this.cmbtreevDepartment.TreeView.Nodes.Add(nodes); }
- else
- { rootStore.Nodes.Add(nodes); }
- }
- if (rootStore != null)
- { this.cmbtreevDepartment.TreeView.Nodes.Add(rootStore); }
- }
- this.cmbtreevDepartment.Nodes[0].Expand();
- this.cmbtreevDepartment.TextFindTag(this.cmbtreevDepartment.Nodes[0].Text.Trim());
- //this.cmbtreevDepartment.SelectedNode = this.cmbtreevDepartment.GetNodeItem_TextToTag(this.cmbtreevDepartment.Nodes[0].Text.Trim());
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void A_EmployeeScheduleSmallForm_Shown(object sender, EventArgs e)
- {
- this.dtpYearMonth.StrDateValue = SDateTime.Now.ToString("yyyy-MM");
- this.PublicPerson();
- this.chkWeekMode_Click(null, null);
- bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(
- LYFZ.Software.MainBusiness.VersionControl.VersionFunctionEnum.员工考勤员工档期);
- if (!b)
- {
- this.Close();
- }
- }
- /// <summary>
- /// 上星期
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnLastWeek_Click(object sender, EventArgs e)
- {
- this.WeekStartDate = this.WeekStartDate.AddDays(-7);
- this.WeekEndDate = this.WeekEndDate.AddDays(-7);
- this.lblWhichWeek.Text = "第" + new GregorianCalendar().GetWeekOfYear(this.WeekStartDate, CalendarWeekRule.FirstDay, DayOfWeek.Monday) + "周";
- this.PublicFunctionRows1();
- }
- /// <summary>
- /// 下星期
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnNextWeek_Click(object sender, EventArgs e)
- {
- this.WeekStartDate = this.WeekStartDate.AddDays(7);
- this.WeekEndDate = this.WeekEndDate.AddDays(7);
- this.lblWhichWeek.Text = "第" + new GregorianCalendar().GetWeekOfYear(this.WeekStartDate, CalendarWeekRule.FirstDay, DayOfWeek.Monday) + "周";
- this.PublicFunctionRows1();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click(object sender, EventArgs e)
- {
- if (this.chkWeekMode.Checked == true)
- { PublicFunctionRows1(); }
- else
- { PublicFunctionRows(); }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 选择Value值更改事件
- /// </summary>
- /// <param name="SelectValue"></param>
- void dtpYearMonth_ClickChengedValue(string SelectValue)
- {
- PublicFunctionRows();
- }
- /// <summary>
- /// 回车事件
- /// </summary>
- void dtpYearMonth_KeyDown()
- {
- PublicFunctionRows();
- }
- /// <summary>
- /// 周月选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkWeekMode_Click(object sender, EventArgs e)
- {
- if (this.chkWeekMode.Checked == true)
- {
- this.panelLastNextWeek.Visible = true;
- this.dtpYearMonth.Visible = false;
- this.lblWhichWeek.Visible = true;
- this.WeekStartDate = DateTime.Now.AddDays((-1) * Convert.ToInt32(DateTime.Now.DayOfWeek));
- this.WeekEndDate = WeekStartDate.AddDays(6);
- this.lblWhichWeek.Text = "第" + new GregorianCalendar().GetWeekOfYear(WeekStartDate, CalendarWeekRule.FirstDay, DayOfWeek.Monday) + "周";
- this.PublicFunctionRows1();
- }
- else
- {
- this.panelLastNextWeek.Visible = false;
- this.dtpYearMonth.Visible = true;
- this.lblWhichWeek.Visible = false;
- this.PublicFunctionRows();
- }
- }
- /// <summary>
- /// 部门下拉框
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevDepartment_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- //this.btnQuery_Click(this, null);
- }
- /// <summary>
- /// 右键弹出菜单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right)
- {
- ToolStripMenuItem item = null;
- if (e.ColumnIndex != this.dgvData.Columns["影楼名称"].Index && e.ColumnIndex != this.dgvData.Columns["部门"].Index && e.ColumnIndex != this.dgvData.Columns["姓名"].Index)
- {
- if (this.dgvData.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Trim() != "休息!")
- {
- this.dgvData.conMenu.Items.Clear();
- item = new ToolStripMenuItem();
- item.Height = item.Height * 2;
- item.Text = "安排拍照\r\n";
- item.Tag = "0";
- this.dgvData.conMenu.Items.Add(item);
- item = new ToolStripMenuItem();
- item.Height = item.Height * 2;
- item.Text = "安排选片\r\n";
- item.Tag = "1";
- this.dgvData.conMenu.Items.Add(item);
- item = new ToolStripMenuItem();
- item.Height = item.Height * 2;
- item.Text = "安排看设计\r\n";
- item.Tag = "2";
- this.dgvData.conMenu.Items.Add(item);
- item = new ToolStripMenuItem();
- item.Height = item.Height * 2;
- item.Text = "安排取件\r\n";
- item.Tag = "3";
- this.dgvData.conMenu.Items.Add(item);
- item = new ToolStripMenuItem();
- item.Height = item.Height * 2;
- item.Text = "安排服务\r\n";
- item.Tag = "4";
- this.dgvData.conMenu.Items.Add(item);
- item = new ToolStripMenuItem();
- item.Height = item.Height * 2;
- item.Text = "安排选礼服\r\n";
- item.Tag = "5";
- this.dgvData.conMenu.Items.Add(item);
- }
- }
- }
- }
- /// <summary>
- /// 右键菜单选择项事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_DataGridViewConMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- ToolStripItem item = e.ClickedItem;
- if (LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.LoadForm(item.Tag.ToString().Trim()))
- { this.btnQuery_Click(this, null); }
- }
- /// <summary>
- /// 单元格双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
- {
- if (e.ColumnIndex >= 4)
- {
- if (string.IsNullOrEmpty(this.dgvData.CurrentCell.Value.ToString().Trim()))
- { MessageBoxCustom.Show("该员工当前尚未安排!"); return; }
- if (this.dgvData.CurrentCell.Value.ToString().Trim() == "休息!")
- { MessageBoxCustom.Show("该员工当天休息!"); return; }
- Hashtable htData = (Hashtable)this.dgvData.CurrentCell.Tag;
- LYFZ.Software.MainBusiness.TimeAndAttendance.A_EmployeeScheduleSmallFlighting frm = new TimeAndAttendance.A_EmployeeScheduleSmallFlighting();
- frm.StrJobsID = htData["StrJobsID"].ToString().Trim();
- frm.StrJobsText = htData["StrJobsText"].ToString().Trim();
- frm.StrDateTime = htData["StrDateDay"].ToString().Trim();
- frm.StrShowText = dgvData.CurrentRow.Cells[1].Value.ToString() + "" + dgvData.CurrentRow.Cells[2].Value.ToString() + " " + dgvData.CurrentRow.Cells[3].Value.ToString();
- frm.Show();
- }
- }
- }
- /// <summary>
- /// 获取查询条件
- /// </summary>
- /// <param name="StrWherePerson">查询条件</param>
- /// <returns></returns>
- Hashtable GetSelectQueryWhere(ref string StrWherePerson)
- {
- Hashtable htData = new Hashtable();
- if (this.cmbtreevDepartment.StrGetName.Trim() == "User")
- {
- StrWherePerson += " And 员工编号 = '" + this.cmbtreevDepartment.Tag.ToString().Trim() + "'";
- DataRow dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(this.cmbtreevDepartment.Tag.ToString().Trim());
- if (dtRow != null)
- { htData[dtRow["User_EmployeeID"].ToString().Trim() + "|" + dtRow["User_Name"].ToString().Trim() + "|" + dtStore.Rows.Find(dtRow["User_DividedShop"].ToString().Trim())["Company_Name"].ToString().Trim()] = this.cmbtreevDepartment.SelectedNode.Parent.Text.Trim(); }
- }
- else if (this.cmbtreevDepartment.StrGetName.Trim() == "Department")
- {
- string StrPerson = "";
- for (int i = 0; i < this.cmbtreevDepartment.SelectedNode.Nodes.Count; i++)
- {
- StrPerson += "'" + this.cmbtreevDepartment.SelectedNode.Nodes[i].Tag.ToString().Trim() + "',";
- DataRow dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(this.cmbtreevDepartment.SelectedNode.Nodes[i].Tag.ToString().Trim());
- if (dtRow != null)
- { htData[dtRow["User_EmployeeID"].ToString().Trim() + "|" + dtRow["User_Name"].ToString().Trim() + "|" + dtStore.Rows.Find(dtRow["User_DividedShop"].ToString().Trim())["Company_Name"].ToString().Trim()] = this.cmbtreevDepartment.SelectedNode.Text.Trim(); }
- }
- if (!string.IsNullOrEmpty(StrPerson))
- { StrWherePerson += " And 员工编号 in (" + StrPerson.TrimEnd(',') + ")"; }
- }
- else if (this.cmbtreevDepartment.StrGetName.Trim() == "StoreName")
- {
- string StrPerson = "";
- for (int i = 0; i < this.cmbtreevDepartment.SelectedNode.Nodes.Count; i++)
- {
- if (this.cmbtreevDepartment.SelectedNode.Nodes[i].Name.Trim() == "Department")
- {
- for (int j = 0; j < this.cmbtreevDepartment.SelectedNode.Nodes[i].Nodes.Count; j++)
- {
- if (this.cmbtreevDepartment.SelectedNode.Nodes[i].Nodes[j].Name.Trim() == "User")
- {
- StrPerson += "'" + this.cmbtreevDepartment.SelectedNode.Nodes[i].Nodes[j].Tag.ToString().Trim() + "',";
- DataRow dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(this.cmbtreevDepartment.SelectedNode.Nodes[i].Nodes[j].Tag.ToString().Trim());
- if (dtRow != null)
- { htData[dtRow["User_EmployeeID"].ToString().Trim() + "|" + dtRow["User_Name"].ToString().Trim() + "|" + dtStore.Rows.Find(dtRow["User_DividedShop"].ToString().Trim())["Company_Name"].ToString().Trim()] = this.cmbtreevDepartment.SelectedNode.Nodes[i].Text.Trim(); }
- }
- }
- }
- }
- if (!string.IsNullOrEmpty(StrPerson))
- { StrWherePerson += " And 员工编号 in (" + StrPerson.TrimEnd(',') + ")"; }
- }
- else
- {
- DataRow[] dtRows = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Select("User_Status <> '离职'");
- string StrPerson = "";
- for (int i = 0; i < dtRows.Length; i++)
- {
- StrPerson += "'" + dtRows[i]["User_EmployeeID"].ToString().Trim() + "',";
- DataRow dtRow = dtDepartment.Rows.Find(dtRows[i]["User_Department"].ToString().Trim());
- if (dtRow != null)
- {
- htData[dtRows[i]["User_EmployeeID"].ToString().Trim() + "|" + dtRows[i]["User_Name"].ToString().Trim() + "|" + dtStore.Rows.Find(dtRows[i]["User_DividedShop"].ToString().Trim())["Company_Name"].ToString().Trim()] = dtRow["Dt_Name"].ToString().Trim();
- }
- }
- if (!string.IsNullOrEmpty(StrPerson))
- { StrWherePerson += " And 员工编号 in (" + StrPerson.TrimEnd(',') + ")"; }
- }
- return htData;
- }
- /// <summary>
- /// 获取工作数据
- /// </summary>
- /// <param name="StrWherePerson"></param>
- /// <param name="StrWhere2"></param>
- /// <returns></returns>
- DataSet GetDataSetData(string StrWherePerson, string StrWhere2)
- {
- string GetColumn = "员工姓名,员工编号,工作时间,ID";
- DataSet dtSet = new DataSet();
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- string ExecuteSql = orbll.GetView_CustomReturnExecuteSql("BView_MyWorkClothing_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkMakeupArtist_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkMakeupAssistant_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkPhotographyName_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkPhotographyAssistant_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkBootDivision_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkEarlyRepairName_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkFilmSelection_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkRefinement_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkDesigner_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkLookDesign_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkPickup_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkService_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("BView_MyWorkSendPhoto_No", StrWhere: StrWherePerson, ShowColumnName: GetColumn);
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("loninbansets", StrWhere: StrWhere2, ShowColumnName: "User_ID,Time,fixed");
- dtSet = orbll.GetView_Custom(ExecuteSql);
- });
- return dtSet;
- }
- /// <summary>
- /// 周查询
- /// </summary>
- void PublicFunctionRows1()
- {
- this.dgvData.Rows.Clear();
- DateTime CurrentDateValue = Convert.ToDateTime(LYFZ.Command.Command_Validate.DateTimeToString(WeekStartDate, "yyyy-MM-dd"));
- string StrWherePerson = "(工作时间查询 between '" + LYFZ.Command.Command_Validate.DateTimeToString(CurrentDateValue, "yyyy-MM-dd HH:mm:ss") + "' and '" + LYFZ.Command.Command_Validate.DateTimeToString(WeekEndDate, "yyyy-MM-dd HH:mm:ss") + "')";
- string StrWhere2 = "(Time between '" + LYFZ.Command.Command_Validate.DateTimeToString(CurrentDateValue, "yyyy-MM-dd HH:mm:ss") + "' and '" + LYFZ.Command.Command_Validate.DateTimeToString(WeekEndDate, "yyyy-MM-dd HH:mm:ss") + "')";
- Hashtable htData = this.GetSelectQueryWhere(ref StrWherePerson);
- DataSet dtSet = this.GetDataSetData(StrWherePerson, StrWhere2);
- DataTable newTable = new DataTable();
- newTable.Columns.Add("员工编号", typeof(string));
- newTable.Columns.Add("影楼名称", typeof(string));
- newTable.Columns.Add("部门", typeof(string));
- newTable.Columns.Add("姓名", typeof(string));
- for (int i = 1; i < 8; i++)
- { newTable.Columns.Add(i + "日", typeof(object)); }
- foreach (DictionaryEntry items in htData)
- {
- string[] StrArray = items.Key.ToString().Trim().Split('|');
- DataRow newRow = newTable.NewRow();
- newRow["员工编号"] = StrArray[0].Trim();
- newRow["影楼名称"] = StrArray[2].Trim();
- newRow["部门"] = items.Value.ToString().Trim();
- newRow["姓名"] = StrArray[1].Trim();
- #region 获取日期数据
- for (int i = 0; i < 7; i++)
- {
- string StrDateDay = LYFZ.Command.Command_Validate.DateTimeToString(WeekStartDate.AddDays(i));
- DataRow[] dtRows = dtSet.Tables[14].Select("User_ID = '" + StrArray[0].Trim() + "' and Time = '" + StrDateDay + "'");
- string StrShowText = "";
- string StrToolTipText = "";
- string StrJobsID = "";
- string StrJobsText = "";
- if (dtRows.Length > 0)
- {
- if (dtRows[0]["fixed"].ToString().Trim() == "休息")
- { StrShowText = "休息!"; }
- }
- if (string.IsNullOrEmpty(StrShowText))
- {
- string StrdtRowWhere = "员工编号 = '" + StrArray[0].Trim() + "' and 工作时间 = '" + StrDateDay + "'";
- DataRow[] dtRow0 = dtSet.Tables[0].Select(StrdtRowWhere);
- DataRow[] dtRow1 = dtSet.Tables[1].Select(StrdtRowWhere);
- DataRow[] dtRow2 = dtSet.Tables[2].Select(StrdtRowWhere);
- DataRow[] dtRow3 = dtSet.Tables[3].Select(StrdtRowWhere);
- DataRow[] dtRow4 = dtSet.Tables[4].Select(StrdtRowWhere);
- DataRow[] dtRow5 = dtSet.Tables[5].Select(StrdtRowWhere);
- DataRow[] dtRow6 = dtSet.Tables[6].Select(StrdtRowWhere);
- DataRow[] dtRow7 = dtSet.Tables[7].Select(StrdtRowWhere);
- DataRow[] dtRow8 = dtSet.Tables[8].Select(StrdtRowWhere);
- DataRow[] dtRow9 = dtSet.Tables[9].Select(StrdtRowWhere);
- DataRow[] dtRow10 = dtSet.Tables[10].Select(StrdtRowWhere);
- DataRow[] dtRow11 = dtSet.Tables[11].Select(StrdtRowWhere);
- DataRow[] dtRow12 = dtSet.Tables[12].Select(StrdtRowWhere);
- DataRow[] dtRow13 = dtSet.Tables[13].Select(StrdtRowWhere);
- int GroupCount = 0;
- if (dtRow0.Length > 0)
- {
- GroupCount += dtRow0.Length;
- StrToolTipText += "选衣:" + dtRow0.Length + "组\r\n";
- for (int y = 0; y < dtRow0.Length; y++)
- {
- StrJobsID += dtRow0[y][3].ToString().Trim() + ",";
- StrJobsText += "选衣,";
- }
- }
- if (dtRow1.Length > 0)
- {
- GroupCount += dtRow1.Length;
- StrToolTipText += "化妆师:" + dtRow1.Length + "组\r\n";
- for (int y = 0; y < dtRow1.Length; y++)
- {
- StrJobsID += dtRow1[y][3].ToString().Trim() + ",";
- StrJobsText += "化妆师,";
- }
- }
- if (dtRow2.Length > 0)
- {
- GroupCount += dtRow2.Length;
- StrToolTipText += "化妆助理:" + dtRow2.Length + "组\r\n";
- for (int y = 0; y < dtRow2.Length; y++)
- {
- StrJobsID += dtRow2[y][3].ToString().Trim() + ",";
- StrJobsText += "化妆助理,";
- }
- }
- if (dtRow3.Length > 0)
- {
- GroupCount += dtRow3.Length;
- StrToolTipText += "摄影师:" + dtRow3.Length + "组\r\n";
- for (int y = 0; y < dtRow3.Length; y++)
- {
- StrJobsID += dtRow3[y][3].ToString().Trim() + ",";
- StrJobsText += "摄影师,";
- }
- }
- if (dtRow4.Length > 0)
- {
- GroupCount += dtRow4.Length;
- StrToolTipText += "摄影助理:" + dtRow4.Length + "组\r\n";
- for (int y = 0; y < dtRow4.Length; y++)
- {
- StrJobsID += dtRow4[y][3].ToString().Trim() + ",";
- StrJobsText += "摄影助理,";
- }
- }
- if (dtRow5.Length > 0)
- {
- GroupCount += dtRow5.Length;
- StrToolTipText += "引导:" + dtRow5.Length + "组\r\n";
- for (int y = 0; y < dtRow5.Length; y++)
- {
- StrJobsID += dtRow5[y][3].ToString().Trim() + ",";
- StrJobsText += "引导,";
- }
- }
- if (dtRow6.Length > 0)
- {
- GroupCount += dtRow6.Length;
- StrToolTipText += "初修:" + dtRow6.Length + "组\r\n";
- for (int y = 0; y < dtRow6.Length; y++)
- {
- StrJobsID += dtRow6[y][3].ToString().Trim() + ",";
- StrJobsText += "初修,";
- }
- }
- if (dtRow7.Length > 0)
- {
- GroupCount += dtRow7.Length;
- StrToolTipText += "选片:" + dtRow7.Length + "组\r\n";
- for (int y = 0; y < dtRow7.Length; y++)
- {
- StrJobsID += dtRow7[y][3].ToString().Trim() + ",";
- StrJobsText += "选片,";
- }
- }
- if (dtRow8.Length > 0)
- {
- GroupCount += dtRow8.Length;
- StrToolTipText += "精修:" + dtRow8.Length + "组\r\n";
- for (int y = 0; y < dtRow8.Length; y++)
- {
- StrJobsID += dtRow8[y][3].ToString().Trim() + ",";
- StrJobsText += "精修,";
- }
- }
- if (dtRow9.Length > 0)
- {
- GroupCount += dtRow9.Length;
- StrToolTipText += "设计:" + dtRow9.Length + "组\r\n";
- for (int y = 0; y < dtRow9.Length; y++)
- {
- StrJobsID += dtRow9[y][3].ToString().Trim() + ",";
- StrJobsText += "设计,";
- }
- }
- if (dtRow10.Length > 0)
- {
- GroupCount += dtRow10.Length;
- StrToolTipText += "看设计:" + dtRow10.Length + "组\r\n";
- for (int y = 0; y < dtRow10.Length; y++)
- {
- StrJobsID += dtRow10[y][3].ToString().Trim() + ",";
- StrJobsText += "看设计,";
- }
- }
- if (dtRow11.Length > 0)
- {
- GroupCount += dtRow11.Length;
- StrToolTipText += "取件:" + dtRow11.Length + "组\r\n";
- for (int y = 0; y < dtRow11.Length; y++)
- {
- StrJobsID += dtRow11[y][3].ToString().Trim() + ",";
- StrJobsText += "取件,";
- }
- }
- if (dtRow12.Length > 0)
- {
- GroupCount += dtRow12.Length;
- StrToolTipText += "服务:" + dtRow12.Length + "组\r\n";
- for (int y = 0; y < dtRow12.Length; y++)
- {
- StrJobsID += dtRow12[y][3].ToString().Trim() + ",";
- StrJobsText += "服务,";
- }
- }
- if (dtRow13.Length > 0)
- {
- GroupCount += dtRow13.Length;
- StrToolTipText += "发片:" + dtRow13.Length + "组\r\n";
- for (int y = 0; y < dtRow13.Length; y++)
- {
- StrJobsID += dtRow13[y][3].ToString().Trim() + ",";
- StrJobsText += "发片,";
- }
- }
- if (GroupCount > 0)
- { StrShowText = GroupCount + "组"; }
- }
- Hashtable htdataDay = new Hashtable();
- htdataDay["StrShowText"] = StrShowText.TrimEnd(',');
- htdataDay["StrToolTipText"] = StrToolTipText.TrimEnd(',');
- htdataDay["StrDateDay"] = StrDateDay.TrimEnd(',');
- htdataDay["StrJobsID"] = StrJobsID.TrimEnd(',');
- htdataDay["StrJobsText"] = StrJobsText.TrimEnd(',');
- newRow[(i + 1) + "日"] = htdataDay;
- }
- #endregion
- newTable.Rows.Add(newRow);
- }
- string strColumn = "员工编号,影楼名称,部门,姓名";
- for (int i = 0; i < 7; i++)
- { strColumn += "," + this.WeekStartDate.AddDays(i).ToString("dddd") + "\r\n" + this.WeekStartDate.AddDays(i).ToString("MM月dd日") + ""; }
- string strHideField = "员工编号";
- if (this.StoreNameCount <= 1)
- { strHideField += ",影楼名称"; }
- this.dgvData.DataColumns(strColumn, strHideField: strHideField);
- this.dgvData.dgvColumnHeadersHeight = 45;
- this.dgvData.Columns["姓名"].Frozen = true;
- int IntdgvDataColumnsCount = this.dgvData.Columns.GetColumnCount(DataGridViewElementStates.Visible);
- int intThisWidth = this.dgvData.Width - 50;
- if (this.StoreNameCount <= 1)
- {
- IntdgvDataColumnsCount--;
- intThisWidth -= 150;
- }
- int intdgvDataWidth = intThisWidth / IntdgvDataColumnsCount;
- for (int i = 0; i < this.dgvData.Columns.Count; i++)
- {
- if (this.dgvData.Columns[i].Name.Trim() == "影楼名称")
- { this.dgvData.Columns[i].Width = 150; }
- else
- { this.dgvData.Columns[i].Width = intdgvDataWidth; }
- }
- DataGridViewRow dgvr = null;
- DataGridViewCell cell = null;
- for (int i = 0; i < newTable.Rows.Count; i++)
- {
- dgvr = new DataGridViewRow();
- for (int j = 0; j < newTable.Columns.Count; j++)
- {
- if (j > 3)
- {
- Hashtable htDataRow = (Hashtable)newTable.Rows[i][j];
- cell = new DataGridViewTextBoxCell();
- cell.Value = htDataRow["StrShowText"].ToString().Trim();
- cell.ToolTipText = htDataRow["StrToolTipText"].ToString().Trim();
- cell.Tag = htDataRow;
- dgvr.Cells.Add(cell);
- }
- else
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[i][j].ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- }
- this.dgvData.Rows.Add(dgvr);
- }
- }
- /// <summary>
- /// 月查询
- /// </summary>
- void PublicFunctionRows()
- {
- this.dgvData.Rows.Clear();
- int intDayCount = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth(this.dtpYearMonth.StrYear, this.dtpYearMonth.StrMonth);
- string StrYearMonnth = this.dtpYearMonth.StrDateValue.Trim();
- DateTime CurrentDateValue = Convert.ToDateTime(StrYearMonnth + "-01");
- string StrWherePerson = "(工作时间查询 between '" + CurrentDateValue.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + CurrentDateValue.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "')";
- string StrWhere2 = "(Time between '" + CurrentDateValue.ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + CurrentDateValue.AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "')";
- Hashtable htData = this.GetSelectQueryWhere(ref StrWherePerson);
- DataSet dtSet = this.GetDataSetData(StrWherePerson, StrWhere2);
- DataTable newTable = new DataTable();
- newTable.Columns.Add("员工编号", typeof(string));
- newTable.Columns.Add("影楼名称", typeof(string));
- newTable.Columns.Add("部门", typeof(string));
- newTable.Columns.Add("姓名", typeof(string));
- for (int i = 1; i <= intDayCount; i++)
- { newTable.Columns.Add(i + "日", typeof(object)); }
- foreach (DictionaryEntry items in htData)
- {
- string[] StrArray = items.Key.ToString().Trim().Split('|');
- DataRow newRow = newTable.NewRow();
- newRow["员工编号"] = StrArray[0].Trim();
- newRow["影楼名称"] = StrArray[2].Trim();
- newRow["部门"] = items.Value.ToString().Trim();
- newRow["姓名"] = StrArray[1].Trim();
- #region 获取日期数据
- for (int i = 0; i < intDayCount; i++)
- {
- string StrDateDay = StrYearMonnth + "-" + (i + 1).ToString("d2");
- DataRow[] dtRows = dtSet.Tables[14].Select("User_ID = '" + StrArray[0].Trim() + "' and Time = '" + StrDateDay + "'");
- string StrShowText = "";
- string StrToolTipText = "";
- string StrJobsID = "";
- string StrJobsText = "";
- if (dtRows.Length > 0)
- {
- if (dtRows[0]["fixed"].ToString().Trim() == "休息")
- { StrShowText = "休息!"; }
- }
- if (string.IsNullOrEmpty(StrShowText))
- {
- string StrdtRowWhere = "员工编号 = '" + StrArray[0].Trim() + "' and 工作时间 = '" + StrDateDay + "'";
- DataRow[] dtRow0 = dtSet.Tables[0].Select(StrdtRowWhere);
- DataRow[] dtRow1 = dtSet.Tables[1].Select(StrdtRowWhere);
- DataRow[] dtRow2 = dtSet.Tables[2].Select(StrdtRowWhere);
- DataRow[] dtRow3 = dtSet.Tables[3].Select(StrdtRowWhere);
- DataRow[] dtRow4 = dtSet.Tables[4].Select(StrdtRowWhere);
- DataRow[] dtRow5 = dtSet.Tables[5].Select(StrdtRowWhere);
- DataRow[] dtRow6 = dtSet.Tables[6].Select(StrdtRowWhere);
- DataRow[] dtRow7 = dtSet.Tables[7].Select(StrdtRowWhere);
- DataRow[] dtRow8 = dtSet.Tables[8].Select(StrdtRowWhere);
- DataRow[] dtRow9 = dtSet.Tables[9].Select(StrdtRowWhere);
- DataRow[] dtRow10 = dtSet.Tables[10].Select(StrdtRowWhere);
- DataRow[] dtRow11 = dtSet.Tables[11].Select(StrdtRowWhere);
- DataRow[] dtRow12 = dtSet.Tables[12].Select(StrdtRowWhere);
- DataRow[] dtRow13 = dtSet.Tables[13].Select(StrdtRowWhere);
- int GroupCount = 0;
- if (dtRow0.Length > 0)
- {
- GroupCount += dtRow0.Length;
- StrToolTipText += "选衣:" + dtRow0.Length + "组\r\n";
- for (int y = 0; y < dtRow0.Length; y++)
- {
- StrJobsID += dtRow0[y][3].ToString().Trim() + ",";
- StrJobsText += "选衣,";
- }
- }
- if (dtRow1.Length > 0)
- {
- GroupCount += dtRow1.Length;
- StrToolTipText += "化妆师:" + dtRow1.Length + "组\r\n";
- for (int y = 0; y < dtRow1.Length; y++)
- {
- StrJobsID += dtRow1[y][3].ToString().Trim() + ",";
- StrJobsText += "化妆师,";
- }
- }
- if (dtRow2.Length > 0)
- {
- GroupCount += dtRow2.Length;
- StrToolTipText += "化妆助理:" + dtRow2.Length + "组\r\n";
- for (int y = 0; y < dtRow2.Length; y++)
- {
- StrJobsID += dtRow2[y][3].ToString().Trim() + ",";
- StrJobsText += "化妆助理,";
- }
- }
- if (dtRow3.Length > 0)
- {
- GroupCount += dtRow3.Length;
- StrToolTipText += "摄影师:" + dtRow3.Length + "组\r\n";
- for (int y = 0; y < dtRow3.Length; y++)
- {
- StrJobsID += dtRow3[y][3].ToString().Trim() + ",";
- StrJobsText += "摄影师,";
- }
- }
- if (dtRow4.Length > 0)
- {
- GroupCount += dtRow4.Length;
- StrToolTipText += "摄影助理:" + dtRow4.Length + "组\r\n";
- for (int y = 0; y < dtRow4.Length; y++)
- {
- StrJobsID += dtRow4[y][3].ToString().Trim() + ",";
- StrJobsText += "摄影助理,";
- }
- }
- if (dtRow5.Length > 0)
- {
- GroupCount += dtRow5.Length;
- StrToolTipText += "引导:" + dtRow5.Length + "组\r\n";
- for (int y = 0; y < dtRow5.Length; y++)
- {
- StrJobsID += dtRow5[y][3].ToString().Trim() + ",";
- StrJobsText += "引导,";
- }
- }
- if (dtRow6.Length > 0)
- {
- GroupCount += dtRow6.Length;
- StrToolTipText += "初修:" + dtRow6.Length + "组\r\n";
- for (int y = 0; y < dtRow6.Length; y++)
- {
- StrJobsID += dtRow6[y][3].ToString().Trim() + ",";
- StrJobsText += "初修,";
- }
- }
- if (dtRow7.Length > 0)
- {
- GroupCount += dtRow7.Length;
- StrToolTipText += "选片:" + dtRow7.Length + "组\r\n";
- for (int y = 0; y < dtRow7.Length; y++)
- {
- StrJobsID += dtRow7[y][3].ToString().Trim() + ",";
- StrJobsText += "选片,";
- }
- }
- if (dtRow8.Length > 0)
- {
- GroupCount += dtRow8.Length;
- StrToolTipText += "精修:" + dtRow8.Length + "组\r\n";
- for (int y = 0; y < dtRow8.Length; y++)
- {
- StrJobsID += dtRow8[y][3].ToString().Trim() + ",";
- StrJobsText += "精修,";
- }
- }
- if (dtRow9.Length > 0)
- {
- GroupCount += dtRow9.Length;
- StrToolTipText += "设计:" + dtRow9.Length + "组\r\n";
- for (int y = 0; y < dtRow9.Length; y++)
- {
- StrJobsID += dtRow9[y][3].ToString().Trim() + ",";
- StrJobsText += "设计,";
- }
- }
- if (dtRow10.Length > 0)
- {
- GroupCount += dtRow10.Length;
- StrToolTipText += "看设计:" + dtRow10.Length + "组\r\n";
- for (int y = 0; y < dtRow10.Length; y++)
- {
- StrJobsID += dtRow10[y][3].ToString().Trim() + ",";
- StrJobsText += "看设计,";
- }
- }
- if (dtRow11.Length > 0)
- {
- GroupCount += dtRow11.Length;
- StrToolTipText += "取件:" + dtRow11.Length + "组\r\n";
- for (int y = 0; y < dtRow11.Length; y++)
- {
- StrJobsID += dtRow11[y][3].ToString().Trim() + ",";
- StrJobsText += "取件,";
- }
- }
- if (dtRow12.Length > 0)
- {
- GroupCount += dtRow12.Length;
- StrToolTipText += "服务:" + dtRow12.Length + "组\r\n";
- for (int y = 0; y < dtRow12.Length; y++)
- {
- StrJobsID += dtRow12[y][3].ToString().Trim() + ",";
- StrJobsText += "服务,";
- }
- }
- if (dtRow13.Length > 0)
- {
- GroupCount += dtRow13.Length;
- StrToolTipText += "发片:" + dtRow13.Length + "组\r\n";
- for (int y = 0; y < dtRow13.Length; y++)
- {
- StrJobsID += dtRow13[y][3].ToString().Trim() + ",";
- StrJobsText += "发片,";
- }
- }
- if (GroupCount > 0)
- { StrShowText = GroupCount + "组"; }
- }
- Hashtable htdataDay = new Hashtable();
- htdataDay["StrShowText"] = StrShowText.TrimEnd(',');
- htdataDay["StrToolTipText"] = StrToolTipText.TrimEnd(',');
- htdataDay["StrDateDay"] = StrDateDay.TrimEnd(',');
- htdataDay["StrJobsID"] = StrJobsID.TrimEnd(',');
- htdataDay["StrJobsText"] = StrJobsText.TrimEnd(',');
- newRow[(i + 1) + "日"] = htdataDay;
- }
- #endregion
- newTable.Rows.Add(newRow);
- }
- this.dgvData.Columns.Clear();
- string strColumn = "员工编号,影楼名称,部门,姓名";
- for (int i = 1; i <= intDayCount; i++)
- { strColumn += "," + i.ToString() + "日\r\n" + Convert.ToDateTime(CurrentDateValue).AddDays(i - 1).ToString("dddd"); } string strHideField = "员工编号";
- if (this.StoreNameCount <= 1)
- { strHideField += ",影楼名称"; }
- this.dgvData.DataColumns(strColumn, strHideField: strHideField);
- this.dgvData.dgvColumnHeadersHeight = 45;
- this.dgvData.Columns["姓名"].Frozen = true;
- for (int i = 0; i < this.dgvData.Columns.Count; i++)
- {
- switch (this.dgvData.Columns[i].Name.Trim())
- {
- case "影楼名称":
- this.dgvData.Columns[i].Width = 150;
- break;
- case "姓名":
- case "部门":
- this.dgvData.Columns[i].Width = 80;
- break;
- default:
- this.dgvData.Columns[i].Width = 60;
- break;
- }
- }
- DataGridViewRow dgvr = null;
- DataGridViewCell cell = null;
- for (int i = 0; i < newTable.Rows.Count; i++)
- {
- dgvr = new DataGridViewRow();
- for (int j = 0; j < newTable.Columns.Count; j++)
- {
- if (j > 3)
- {
- Hashtable htDataRow = (Hashtable)newTable.Rows[i][j];
- cell = new DataGridViewTextBoxCell();
- cell.Value = htDataRow["StrShowText"].ToString().Trim();
- cell.ToolTipText = htDataRow["StrToolTipText"].ToString().Trim();
- cell.Tag = htDataRow;
- dgvr.Cells.Add(cell);
- }
- else
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[i][j].ToString().Trim();
- dgvr.Cells.Add(cell);
- }
- }
- this.dgvData.Rows.Add(dgvr);
- }
- }
- }
- }
|