private void LoadData() { try { this.Cursor = Cursors.WaitCursor; BindingCollection <modAccountBalance> list = _dal.GetAccountBalance(cboAccName.ComboBox.SelectedValue.ToString(), Util.IsTrialBalance, out Util.emsg); DBGrid.DataSource = list; if (list == null && !string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { DBGrid.Columns["TotalSum"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["DetailSum"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["Differ"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["TotalSum"].Width = 200; DBGrid.Columns["DetailSum"].Width = 200; DBGrid.Columns["Differ"].Width = 200; //if (DBGrid.RowCount > 0) //{ // for (int i = 0; i < DBGrid.RowCount; i++) // { // DBGrid.Rows[i].Cells["TotalSum"].Value = clsMoney.ConvertToMoney(float.Parse(DBGrid.Rows[i].Cells["TotalSum"].Value.ToString())); // DBGrid.Rows[i].Cells["DetailSum"].Value = clsMoney.ConvertToMoney(float.Parse(DBGrid.Rows[i].Cells["DetailSum"].Value.ToString())); // } //} } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void toolTrial_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; Util.emsg = string.Empty; dalAccReport dal = new dalAccReport(); BindingCollection <modWaitingAuditList> list = dal.GetWaitingAuditList(Util.modperiod.AccName, Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg); if (list != null && list.Count > 0) { frmViewList frmvl = new frmViewList(); frmvl.InitViewList(clsTranslate.TranslateString("Waiting Audit List"), list); frmvl.ShowDialog(); if (MessageBox.Show("您本月还有未完成单据,您是否要试算?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { return; } } BindingCollection <modAccountBalance> list2 = dal.GetAccountBalance(Util.modperiod.AccName, false, out Util.emsg); if (list2 != null && list2.Count > 0) { foreach (modAccountBalance mod in list2) { if (mod.SubjectId != "1030" && Math.Abs(mod.Differ) > Convert.ToDecimal("1")) { MessageBox.Show("财务数据不平衡,请先联系程序员检查原因并修正错误!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); frmViewList frmvl = new frmViewList(); frmvl.InitViewList(clsTranslate.TranslateString("Account Balance"), list2); frmvl.ShowDialog(); return; } } } else if (!string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EditAccCredenceList frm = new EditAccCredenceList(); frm.AddItem("试算平衡", string.Empty); if (frm.ShowDialog() == DialogResult.OK) { Util.IsTrialBalance = true; LoadData(); MessageBox.Show("试算操作成功,您现在查到的财务报表是您试算之后的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); frmMain frmmain = (frmMain)this.ParentForm; ((Label)frmmain.Controls.Find("lblTrialBalance", true).First()).Visible = true; toolNew.Visible = false; toolEdit.Visible = false; toolDel.Visible = false; toolAudit.Visible = false; toolReset.Visible = false; toolTrial.Visible = false; toolBalance.Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void toolBalance_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; Util.emsg = string.Empty; dalAccReport dal = new dalAccReport(); BindingCollection <modWaitingAuditList> list = dal.GetWaitingAuditList(Util.modperiod.AccName, Util.modperiod.StartDate.ToString(), Util.modperiod.EndDate.ToString(), out Util.emsg); if (list != null && list.Count > 0) { MessageBox.Show("您本月还有未完成单据,不能结算!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); frmViewList frmvl = new frmViewList(); frmvl.InitViewList(clsTranslate.TranslateString("Waiting Audit List"), list); frmvl.ShowDialog(); return; } BindingCollection <modAccountBalance> list2 = dal.GetAccountBalance(Util.modperiod.AccName, Util.IsTrialBalance, out Util.emsg); if (list2 != null && list2.Count > 0) { foreach (modAccountBalance mod in list2) { if (Math.Abs(mod.Differ) >= Convert.ToDecimal("0.5")) { MessageBox.Show("财务数据不平衡,请先联系程序员检查原因并修正错误!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); frmViewList frmvl = new frmViewList(); frmvl.InitViewList(clsTranslate.TranslateString("Account Balance"), list2); frmvl.ShowDialog(); return; } } } else if (!string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EditAccCredenceList frm = new EditAccCredenceList(); frm.AddItem("月末结算", string.Empty); if (frm.ShowDialog() == DialogResult.OK) { Util.IsTrialBalance = false; LoadData(); EditAccPeriodList frmapl = new EditAccPeriodList(); frmapl.InitForm(Util.modperiod.EndDate.AddDays(1)); frmapl.AddItem(Util.UserId); if (frmapl.ShowDialog() == DialogResult.OK) { Util.modperiod.LockFlag = 1; dalAccAnalyzeProfit dalprofit = new dalAccAnalyzeProfit(); dalprofit.Generate(Util.modperiod.AccName, Util.IsTrialBalance, out Util.emsg); dalAccAnalyzeSales dalsales = new dalAccAnalyzeSales(); dalsales.Generate(Util.modperiod.AccName, out Util.emsg); dalAccAnalyzePurchase dalpur = new dalAccAnalyzePurchase(); dalpur.Generate(Util.modperiod.AccName, out Util.emsg); dalAccAnalyzeWaste dalwaste = new dalAccAnalyzeWaste(); dalwaste.Generate(Util.modperiod.AccName, out Util.emsg); dalAccAnalyzeProduct dalpdt = new dalAccAnalyzeProduct(); dalpdt.Generate(Util.modperiod.AccName, out Util.emsg); Application.Exit(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }