| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PAM_0601.cs
- * 2.功能描述:工资结算一览
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/08/28 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.PAMModule
- {
- /// <summary>
- /// 工资结算一览
- /// </summary>
- public partial class F_PAM_0601 : DockPanelBase
- {
- #region 成员变量
- //单例模式
- private static F_PAM_0601 _instance;
- // 最后选择行
- private int _selecedRow;
- #endregion
- #region 构造函数
- public F_PAM_0601()
- {
- InitializeComponent();
- this.Text = FormTitles.F_PAM_0601;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.tsbtnPay.Text = ButtonText.TSBTN_PAY;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PAM_0601 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PAM_0601();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载
- /// </summary>
- private void F_PAM_0201_Load(object sender, EventArgs e)
- {
- this.dgvPayroll.AutoGenerateColumns = false;
- this.dgvPiecework.AutoGenerateColumns = false;
- this.dgvDamageSubsidy.AutoGenerateColumns = false;
- this.dgvRepairSubsidy.AutoGenerateColumns = false;
- this.dgvQualityASS.AutoGenerateColumns = false;
- DateTime dt = DateTime.Now.Date;
- dtpStartTime.Value = new DateTime(dt.Year, dt.Month, 1);
- tsbtnPay.Size = new System.Drawing.Size(60, 25);
- tsbtnChangePay.Size = new System.Drawing.Size(65, 25);
- }
- /// <summary>
- /// 关闭窗体事件
- /// </summary>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 自适应事件
- /// </summary>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvPayroll.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvPiecework.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvDamageSubsidy.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvRepairSubsidy.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvQualityASS.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 窗体关闭事件
- /// </summary>
- private void F_PAM_0201_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 搜索按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSearch_Click_1(object sender, EventArgs e)
- {
- try
- {
- // 记录当前选中行
- int selectRowIndex = this._selecedRow;
- // 异步处理
- this.btnSearch.Enabled = false;
- string year = dtpStartTime.Value.Year.ToString();
- string month = dtpStartTime.Value.Month.ToString().Length < 2 ? "0" + dtpStartTime.Value.Month.ToString() : dtpStartTime.Value.Month.ToString();
- this.dgvPayroll.DataSource = null;
- this.dgvPiecework.DataSource = null;
- this.dgvDamageSubsidy.DataSource = null;
- this.dgvRepairSubsidy.DataSource = null;
- this.dgvQualityASS.DataSource = null;
- DataSet dsProductionData = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetPayroll(year + month);
- }));
- this.btnSearch.Enabled = true;
- if (dsProductionData != null)
- {
- base.DataSource = dsProductionData;
- if (this.DataSource != null && this.DataSource.Tables.Count > Constant.INT_IS_ZERO)
- {
- this.dgvPayroll.DataSource = this.DataSource.Tables[0];
- if (this.DataSource.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- if (selectRowIndex >= Constant.INT_IS_ZERO)
- {
- if (selectRowIndex >= dsProductionData.Tables[0].Rows.Count)
- {
- this.dgvPayroll.Rows[this.dgvPayroll.Rows.Count - 1].Selected = true;
- this.dgvPayroll.CurrentCell = this.dgvPayroll.Rows[this.dgvPayroll.Rows.Count - 1].Cells["YYYYMM"];
- }
- else
- {
- this.dgvPayroll.Rows[selectRowIndex].Selected = true;
- this.dgvPayroll.CurrentCell = this.dgvPayroll.Rows[selectRowIndex].Cells["YYYYMM"];
- }
- }
- }
- }
- //this.tabControl1.SelectTab(0);
- this.tabControl1.Controls[0].Text = year + "-" + month + "工资单";
- }
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 单元格选定事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvPayroll_SelectionChanged(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// 结算按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnPay_Click(object sender, EventArgs e)
- {
- try
- {
- F_PAM_0602 fpam0602 = new F_PAM_0602();
- fpam0602.ShowDialog();
- if (fpam0602.DialogResult == DialogResult.OK)
- {
- btnSearch_Click_1(sender, e);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 工资调整按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnChange_Click(object sender, EventArgs e)
- {
- try
- {
- F_PAM_0603 fpam0603 = new F_PAM_0603();
- fpam0603.ShowDialog();
- if (fpam0603.DialogResult == DialogResult.OK)
- {
- btnSearch_Click_1(sender, e);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 审核按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnApproval_Click(object sender, EventArgs e)
- {
- try
- {
- F_PAM_0604 fpam0604 = new F_PAM_0604();
- fpam0604.ShowDialog();
- if (fpam0604.DialogResult == DialogResult.OK)
- {
- btnSearch_Click_1(sender, e);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- /// <summary>
- /// 单元格双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvPayroll_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- try
- {
- if (this.dgvPayroll.CurrentCell != null)
- {
- //if (!this.tsbtnClose.ReadOnly)
- //{
- if (e.RowIndex < 0)
- {
- return;
- }
- DataGridViewColumn columnItem = this.dgvPayroll.Columns[e.ColumnIndex];
- this._selecedRow = this.dgvPayroll.CurrentCell.RowIndex;
- //this.dgvDefect.DataSource = null;
- int staffid = Convert.ToInt32(this.dgvPayroll.Rows[_selecedRow].Cells["staffid"].Value.ToString());
- string yyyymm = this.dgvPayroll.Rows[_selecedRow].Cells["YYYYMM"].Value.ToString();
- DataSet ds = (DataSet)DoAsync(new AsyncMethod(() =>
- {
- return PAMModuleProxy.Service.GetPayrollInfo(yyyymm, staffid);
- }));
- if (ds != null)
- {
- //if (columnItem.Name == "Piecework")
- //{
- // this.tabControl1.SelectTab(1);
- //}
- //else if (columnItem.Name == "DamageSubsidy")
- //{
- // this.tabControl1.SelectTab(2);
- //}
- //else if (columnItem.Name == "RepairSubsidy")
- //{
- // this.tabControl1.SelectTab(3);
- //}
- //else if (columnItem.Name == "QualityEXA")
- //{
- // this.tabControl1.SelectTab(4);
- //}
- // this.tabPage2.Select();
- this.tabControl1.SelectTab(1);
- this.dgvPiecework.DataSource = ds.Tables[0];
- this.dgvDamageSubsidy.DataSource = ds.Tables[1];
- this.dgvRepairSubsidy.DataSource = ds.Tables[2];
- this.dgvQualityASS.DataSource = ds.Tables[3];
- }
- //}
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 反结算按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnChangePay_Click(object sender, EventArgs e)
- {
- //try
- //{
- // if (this.dgvPayroll.CurrentCell != null)
- // {
- // DialogResult msgBoxResult = MessageBox.Show(
- // string.Format(Messages.MSG_CMN_Q002, "工资", "反结算"), this.Text,
- // MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- // if (msgBoxResult == DialogResult.Yes)
- // {
- // this._selecedRow = this.dgvPayroll.CurrentCell.RowIndex;
- // int staffid = Convert.ToInt32(this.dgvPayroll.Rows[_selecedRow].Cells["staffid"].Value.ToString());
- // string yyyymm = this.dgvPayroll.Rows[_selecedRow].Cells["YYYYMM"].Value.ToString();
- // int resultvalue = (int)DoAsync(() =>
- // {
- // return PAMModuleProxy.Service.ChangePayPiecework(yyyymm);
- // }
- // );
- // this.dgvPayroll.ReadOnly = true;
- // // 修改成功
- // if (resultvalue > Constant.INT_IS_ZERO)
- // {
- // MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "工资", "反结算"),
- // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- // this.btnSearch_Click_1(sender, e);
- // }
- // else
- // {
- // MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "工资", "反结算"),
- // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // }
- // }
- // }
- //}
- //catch (Exception ex)
- //{
- // // 对异常进行共通处理
- // ExceptionManager.HandleEventException(this.ToString(),
- // System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- //}
- try
- {
- F_PAM_0605 fpam0605 = new F_PAM_0605();
- fpam0605.ShowDialog();
- if (fpam0605.DialogResult == DialogResult.OK)
- {
- btnSearch_Click_1(sender, e);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void tsbtnAdd_Click(object sender, EventArgs e)
- {
- }
- private void tsbtnEdit_Click_1(object sender, EventArgs e)
- {
- }
- }
- }
|