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.FinancialManagement.SetSmallForm { public partial class OutlayReportSetSmallForm : LYFZ.Software.UI.FinancialManagement.SetSmallForm.OutlayReportSetSmallForm { LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses oiebll = new BLL.BLL_ErpOtherIncomeAndExpenses(); private delegate void UpdateControl(); public OutlayReportSetSmallForm() { this.Shown += OutlayReportSetSmallForm_Shown; this.btnAuditFinance.Click += btnAuditFinance_Click; this.btnAuditManager.Click += btnAuditManager_Click; this.btnAuditCEO.Click += btnAuditCEO_Click; this.dtYearMonth.ClickChengedValue += dtYearMonth_ClickChengedValue; this.radAll.Click += radAll_Click; this.radLessThan.Click += radLessThan_Click; this.radGreaterThan.Click += radGreaterThan_Click; } public enum OutlayReportLoadType { 店面支出, 财务支出 } /// /// 加载类型 /// public OutlayReportLoadType EnumOutlayReportLoadType; /// /// 窗体加载事件 /// /// /// void OutlayReportSetSmallForm_Shown(object sender, EventArgs e) { try { string StrColumnsName = "ID,项目名称,金额,日期,收银,取款人,备注,财务审核,经理审核,老总审核"; this.dgvData.DataColumns(StrColumnsName, "ID"); this.dtYearMonth.StrDateValue = LYFZ.Command.Command_Validate.DateTimeToString(SDateTime.Now, "yyyy-MM"); this.PublicFunctionRows(); } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } /// /// 财务审核 /// /// /// void btnAuditFinance_Click(object sender, EventArgs e) { if (this.dgvData.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选中你要审核的数据!"); return; } if (MessageBoxCustom.Show("此单审核是否通过?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { LYFZ.Model.Model_ErpOtherIncomeAndExpenses model = oiebll.GetModel(Convert.ToInt32(this.dgvData.CurrentRow.Cells["ID"].Value)); model.Oiae_FinancialAuditState = "已审核"; model.Oiae_FinancialAuditPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; if (oiebll.Update(model)) { MessageBoxCustom.Show("审核成功!"); this.PublicFunctionRows(); } } } /// /// 经理审核 /// /// /// void btnAuditManager_Click(object sender, EventArgs e) { if (this.dgvData.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选中你要审核的数据!"); return; } if (MessageBoxCustom.Show("此单审核是否通过?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { LYFZ.Model.Model_ErpOtherIncomeAndExpenses model = oiebll.GetModel(Convert.ToInt32(this.dgvData.CurrentRow.Cells["ID"].Value)); model.Oiae_ManagerAuditState = "已审核"; model.Oiae_ManagerAuditPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; if (oiebll.Update(model)) { MessageBoxCustom.Show("审核成功!"); this.PublicFunctionRows(); } } } /// /// 老总审核 /// /// /// void btnAuditCEO_Click(object sender, EventArgs e) { if (this.dgvData.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选中你要审核的数据!"); return; } if (MessageBoxCustom.Show("此单审核是否通过?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { LYFZ.Model.Model_ErpOtherIncomeAndExpenses model = oiebll.GetModel(Convert.ToInt32(this.dgvData.CurrentRow.Cells["ID"].Value)); model.Oiae_CEOAuditState = "已审核"; model.Oiae_CEOAuditPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; if (oiebll.Update(model)) { MessageBoxCustom.Show("审核成功!"); this.PublicFunctionRows(); } } } /// /// 日月选择事件 /// /// void dtYearMonth_ClickChengedValue(string SelectValue) { this.PublicFunctionRows(); } /// /// 全部 /// /// /// void radAll_Click(object sender, EventArgs e) { this.PublicFunctionRows(); } /// /// <1000 /// /// /// void radLessThan_Click(object sender, EventArgs e) { this.PublicFunctionRows(); } /// /// >=1000 /// /// /// void radGreaterThan_Click(object sender, EventArgs e) { this.PublicFunctionRows(); } /// /// 绑定数据 /// public void PublicFunctionRows() { string StrWhere = " Where 1 = 1"; string StrDateTimeStart = this.dtYearMonth.StrDateValue + "-01"; string StrDateTimeEnd = Convert.ToDateTime(StrDateTimeStart).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd"); StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Oiae_IEDatetime", StrDateTimeStart, StrDateTimeEnd); switch (this.EnumOutlayReportLoadType) { case OutlayReportLoadType.店面支出: StrWhere += " and Oiae_Type = '支出'"; if (this.radLessThan.Checked) { StrWhere += " and Oiae_Money < 10000 "; } else if (this.radGreaterThan.Checked) { StrWhere += " and Oiae_Money >= 10000 "; } break; case OutlayReportLoadType.财务支出: StrWhere += " and Oiae_Type = '财务支出'"; if (this.radLessThan.Checked) { StrWhere += " and Oiae_Money < 10000 "; } else if (this.radGreaterThan.Checked) { StrWhere += " and Oiae_Money >= 10000 "; } break; } DataTable newTable = new DataTable(); LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { newTable = LYFZ.BLL.BLL_ErpOrderView.GetData_FinancialManagementIncomeExpenditureStatistics(StrWhere, ""); }); #region decimal DecAoumnt = 0; this.dgvData.DataColumns("ID,费用项目,费用金额,支出日期,取款人,录单人,支出说明,财务审核,经理审核,老总审核", strHideField: "ID"); for (int t = 0; t < newTable.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); dgvr.DefaultCellStyle.ForeColor = Color.Red; DataGridViewCell cell = null; cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["ID"].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(); DecAoumnt += Convert.ToDecimal(newTable.Rows[t]["费用金额"]); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = LYFZ.BLL.OtherCommonModel.DateTimeToString(newTable.Rows[t]["支出日期"]); 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 = 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]["Oiae_FinancialAuditState"].ToString().Trim() + "/" + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(newTable.Rows[t]["Oiae_FinancialAuditPeople"]); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["Oiae_ManagerAuditState"].ToString().Trim() + "/" + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(newTable.Rows[t]["Oiae_ManagerAuditPeople"]); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["Oiae_CEOAuditState"].ToString().Trim() + "/" + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(newTable.Rows[t]["Oiae_CEOAuditPeople"]); dgvr.Cells.Add(cell); if (newTable.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "未审核" && newTable.Rows[t]["Oiae_ManagerAuditState"].ToString().Trim() == "未审核" && newTable.Rows[t]["Oiae_CEOAuditState"].ToString().Trim() == "未审核") { dgvr.DefaultCellStyle.ForeColor = Color.Red; } else if (newTable.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "已审核" && newTable.Rows[t]["Oiae_ManagerAuditState"].ToString().Trim() == "已审核" && newTable.Rows[t]["Oiae_CEOAuditState"].ToString().Trim() == "已审核") { dgvr.DefaultCellStyle.ForeColor = Color.Blue; } else { dgvr.DefaultCellStyle.ForeColor = Color.Orange; } this.dgvData.Rows.Add(dgvr); } this.dgvData.ClearSelection(); this.lblTotalOutlay.Text = "总支出:" + DecAoumnt.ToString("n2"); #endregion } } }