123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- using LYFZ.ComponentLibrary;
- using System;
- using System.Collections;
- 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.FinancialManagement
- {
- public partial class FrmStaffAwardPunish : LYFZ.Software.UI.FinancialManagement.FrmStaffAwardPunish
- {
- LYFZ.BLL.BLL_ErpRewardPunishment rpbll = new BLL.BLL_ErpRewardPunishment();
- public FrmStaffAwardPunish()
- {
- this.Shown += FrmStaffAwardPunish_Shown;
- this.btnQuery.Click += btnQuery_Click;
- this.btnEntry.Click += btnEntry_Click;
- this.btnUpdate.Click += btnUpdate_Click;
- this.dgvData.MouseDoubleClick += dgvData_MouseDoubleClick;
- this.btnDelete.Click += btnDelete_Click;
- this.btnClose.Click += btnClose_Click;
- this.chkPenalty.Click += chkPenalty_Click;
- this.chkReward.Click += chkReward_Click;
- this.chkExecuteNot.Click += chkExecuteNot_Click;
- this.chkExecuteOK.Click += chkExecuteOK_Click;
- this.btn_print.Click += btn_print_Click;
- this.Resize += FrmStaffAwardPunish_Resize;
- }
- /// <summary>
- /// 打印员工奖罚单;
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btn_print_Click(object sender, EventArgs e)
- {
- if ( dgvData.CurrentRow != null )
- {
- Hashtable hashtable = new Hashtable();
- hashtable["CurrentRow"] = dgvData.CurrentRow;
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.员工奖罚, hashtable);
- }
- else
- {
- MessageBox.Show("请选择要打印的行");
- }
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmStaffAwardPunish_Shown(object sender, EventArgs e)
- {
- this.dtpDateTimeStart.DateValue = SDateTime.Now.ToString("yyyy-MM-dd");
- this.dtpDateTimeEnd.DateValue = this.dtpDateTimeStart.DateValue;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbtreevPenaltyAndRewardName, IsFirstNodeNull: true, IsShowResign: false);
- this.btnEntry.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StaffAwardPunishCompetence, CustomAttributes.OperatingAuthority.Add);
- this.btnUpdate.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StaffAwardPunishCompetence, CustomAttributes.OperatingAuthority.Update);
- this.btnDelete.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StaffAwardPunishCompetence, CustomAttributes.OperatingAuthority.Delete);
- this.PublicFunctionRows();
- ///控制财务管理员工奖罚薪资执行的版本权
- List<Control> hideControl = new List<Control>();
- //LYFZSS.SystemSpecterPossessed.ISystemSpecterPossessed.GetMySystemSpecter = LYFZSS.SystemSpecterType.SST_D;
- hideControl.Add(this.chkExecuteOK);
- LYFZ.Software.MainBusiness.VersionControl.StaticVersion.BindVersionShowHideControl(VersionControl.VersionFunctionEnum.财务管理薪资执行, hideControl, null, null);
- }
- /// <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 btnEntry_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.FinancialManagement.StaffAwardPunish.FrmStaffAwardPunishEntry frm = new StaffAwardPunish.FrmStaffAwardPunishEntry();
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.PublicFunctionRows(); }
- }
- /// <summary>
- /// 修改
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnUpdate_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选择你要修改的数据!"); return; }
- LYFZ.Software.MainBusiness.FinancialManagement.StaffAwardPunish.FrmStaffAwardPunishUpdate frm = new StaffAwardPunish.FrmStaffAwardPunishUpdate();
- frm.StrOrderID = this.dgvData.CurrentRow.Cells["ID"].Value.ToString();
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.PublicFunctionRows(); }
- }
- /// <summary>
- /// 双击列表修改
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- if (e.Location.Y > this.dgvData.ColumnHeadersHeight)
- {
- if (this.dgvData.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选择你要修改的数据!"); return; }
- this.btnUpdate_Click(this, null);
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选择你要删除的数据!"); return; }
- if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- if (rpbll.Delete(Convert.ToInt32(this.dgvData.CurrentRow.Cells["ID"].Value)))
- {
- // 写入操作日志
- string logsContent = "删除奖罚相关人员:" + this.dgvData.CurrentRow.Cells["相关人员"].Value.ToString() + " 金额为:" + this.dgvData.CurrentRow.Cells["奖罚金额"].Value.ToString();
- LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.删除员工奖罚, logsContent, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
- MessageBoxCustom.Show("删除成功!");
- 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 chkPenalty_Click(object sender, EventArgs e)
- {
- this.chkExecuteNot.Checked = false;
- this.chkExecuteOK.Checked = false;
- this.chkReward.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 惩
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkReward_Click(object sender, EventArgs e)
- {
- this.chkExecuteNot.Checked = false;
- this.chkExecuteOK.Checked = false;
- this.chkPenalty.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 未执行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkExecuteNot_Click(object sender, EventArgs e)
- {
- this.chkReward.Checked = false;
- this.chkExecuteOK.Checked = false;
- this.chkPenalty.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 已执行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkExecuteOK_Click(object sender, EventArgs e)
- {
- this.chkReward.Checked = false;
- this.chkExecuteNot.Checked = false;
- this.chkPenalty.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 窗体大小发生变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmStaffAwardPunish_Resize(object sender, EventArgs e)
- {
- switch (this.panelExecuteOK.Location.Y)
- {
- case 5: this.flowLayoutPanel1.Height = 40; break;
- case 39: this.flowLayoutPanel1.Height = 73; break;
- }
- }
- /// <summary>
- /// 绑定数据
- /// </summary>
- void PublicFunctionRows()
- {
- string StrWhere = " Where 1 = 1";
- if (!string.IsNullOrEmpty(this.cmbtreevPenaltyAndRewardName.Text.Trim()))
- { StrWhere += " And Rp_RelevantPeople='" + this.cmbtreevPenaltyAndRewardName.Tag.ToString().Trim() + "'"; }
- if (this.chkPenalty.Checked)
- { StrWhere += " And Rp_Type='惩罚'"; }
- if (this.chkReward.Checked)
- { StrWhere += " And Rp_Type='奖励'"; }
- if (this.chkExecuteNot.Checked)
- { StrWhere += " And Rp_Status='" + this.chkExecuteNot.Text.Trim() + "'"; }
- if (this.chkExecuteOK.Checked)
- { StrWhere += " And Rp_Status='" + this.chkExecuteOK.Text.Trim() + "'"; }
- if (!string.IsNullOrEmpty(this.dtpDateTimeStart.DateValue) && !string.IsNullOrEmpty(this.dtpDateTimeEnd.DateValue))
- { StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Rp_RPDatetime", this.dtpDateTimeStart.DateValue, this.dtpDateTimeEnd.DateValue); }
- DataTable newTable = new DataTable();
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- newTable = LYFZ.BLL.BLL_ErpOrderView.GetData_FinancialManagementUserRewardPunishment(StrWhere, "");
- });
- #region
- this.dgvData.DataColumns(newTable.Columns, strHideField: "ID");
- this.dgvData.Columns["相关人员"].Width = 120;
- this.dgvData.Columns["执行日期"].Width = 120;
- this.dgvData.Columns["奖罚类型"].Width = 120;
- this.dgvData.Columns["奖罚金额"].Width = 120;
- this.dgvData.Columns["是否执行"].Width = 120;
- this.dgvData.Columns["录单人"].Width = 120;
- this.dgvData.FillLastColumn();
- for (int t = 0; t < newTable.Rows.Count; t++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["ID"].ToString().Trim(); ;
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(newTable.Rows[t]["相关人员"]);
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["奖罚类型"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["奖罚金额"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["是否执行"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = Convert.ToDateTime(newTable.Rows[t]["执行日期"]).ToString("yyyy-MM-dd");
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(newTable.Rows[t]["录单人"]);
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = newTable.Rows[t]["备注"].ToString().Trim();
- dgvr.Cells.Add(cell);
- this.dgvData.Rows.Add(dgvr);
- }
- #endregion
- this.dgvData.ClearSelection();
- }
- }
- }
|