private void DBGrid2_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { frmViewList frm; modAccAssetDebtReport mod = (modAccAssetDebtReport)DBGrid2.CurrentRow.DataBoundItem; switch (mod.SubjectId) { case "5145": //应付帐款 dalAccPayableList dalpay = new dalAccPayableList(); BindingCollection <modVendorPayableSummary> listpay = dalpay.GetVendorPayableSummary(cboAccName.ComboBox.SelectedValue.ToString(), out Util.emsg); if (listpay != null && listpay.Count > 0) { frm = new frmViewList(); frm.InitViewList(mod.SubjectName, listpay); frm.ShowDialog(); } break; case "5125": //应付票据 dalAccCheckList dalcheck = new dalAccCheckList(); BindingCollection <modAccCheckList> listcheck = dalcheck.GetIList("0", string.Empty, mod.SubjectId, string.Empty, string.Empty, string.Empty, out Util.emsg); frm = new frmViewList(); frm.InitViewList(mod.SubjectName, listcheck); frm.ShowDialog(); break; case "5155": //其它应付款 dalAccOtherPayable dalopay = new dalAccOtherPayable(); BindingCollection <modOtherPayableSummary> listopay = dalopay.GetOtherPayableSummary(cboAccName.ComboBox.SelectedValue.ToString(), out Util.emsg); if (listopay != null && listopay.Count > 0) { frm = new frmViewList(); frm.InitViewList(mod.SubjectName, listopay); frm.ShowDialog(); } break; default: dalAccReport dalrpt = new dalAccReport(); BindingCollection <modAccCredenceDetail> listrpt = new BindingCollection <modAccCredenceDetail>(); dalrpt.GetCredenceDetail(true, cboAccName.ComboBox.SelectedValue.ToString(), mod.SubjectId, Util.IsTrialBalance, ref listrpt, out Util.emsg); if (listrpt != null && listrpt.Count > 0) { frm = new frmViewList(); frm.InitViewList(mod.SubjectName, listrpt); frm.ShowDialog(); } else { if (!string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; } }
private void ACC_WAITING_AUDIT_LIST_Click(object sender, EventArgs e) { 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) { frmViewList frm = new frmViewList(); frm.InitViewList(clsTranslate.TranslateString("Waiting Audit List"), list); frm.ShowDialog(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void DBGrid_DoubleClick(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.CurrentRow == null) { return; } dalAccReport dal = new dalAccReport(); modAccExpenseReport mod = (modAccExpenseReport)DBGrid.CurrentRow.DataBoundItem; if (mod.SubjectId.IndexOf("9135") == 0) { BindingCollection <modAccCredenceDetail> list = new BindingCollection <modAccCredenceDetail>(); dal.GetCredenceDetail(true, cboAccName.ComboBox.SelectedValue.ToString(), mod.SubjectId, Util.IsTrialBalance, ref list, out Util.emsg); if (list != null && list.Count > 0) { frmViewList frm = new frmViewList(); frm.InitViewList(mod.SubjectName, list); frm.ShowDialog(); } else { if (!string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(clsTranslate.TranslateString("No data found!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void ACC_WAITING_AUDIT_LIST_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { dalAccReport dal = new dalAccReport(); BindingCollection <modWaitingAuditList> list = dal.GetWaitingAuditList(Util.modperiod.AccName, Util.modperiod.StartDate.ToString("MM-dd-yyyy"), Util.modperiod.EndDate.ToString("MM-dd-yyyy"), out Util.emsg); if (list != null && list.Count > 0) { frmViewList frm = new frmViewList(); frm.InitViewList("未处理单据清单", list); frm.ShowDialog(); } else { if (!string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("没有找到未处理的数据", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void DBGrid1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { frmViewList frm; modAccAssetDebtReport mod = (modAccAssetDebtReport)DBGrid1.CurrentRow.DataBoundItem; switch (mod.SubjectId) { case "1055": //应收帐款 dalAccReceivableList dalrec = new dalAccReceivableList(); BindingCollection <modCustReceivableSummary> listrec = dalrec.GetCustReceivableSummary(cboAccName.ComboBox.SelectedValue.ToString(), out Util.emsg); if (listrec != null && listrec.Count > 0) { frm = new frmViewList(); frm.InitViewList(mod.SubjectName, listrec); frm.ShowDialog(); } break; case "1060": //其它应收款 dalAccOtherReceivable dalorec = new dalAccOtherReceivable(); BindingCollection <modOtherReceivableSummary> listorec = dalorec.GetOtherReceivableSummary(cboAccName.ComboBox.SelectedValue.ToString(), out Util.emsg); if (listorec != null && listorec.Count > 0) { frm = new frmViewList(); frm.InitViewList(mod.SubjectName, listorec); frm.ShowDialog(); } break; case "1075": //应收票据 dalAccCheckList dalcheck = new dalAccCheckList(); BindingCollection <modAccCheckList> listcheck = dalcheck.GetIList("0", string.Empty, mod.SubjectId, string.Empty, string.Empty, string.Empty, out Util.emsg); frm = new frmViewList(); frm.InitViewList(mod.SubjectName, listcheck); frm.ShowDialog(); break; case "1235": //库存商品 dalAccProductInout dalio = new dalAccProductInout(); BindingCollection <modAccProductSummary> listio = dalio.GetAccProductSummary(cboAccName.ComboBox.SelectedValue.ToString(), Util.IsTrialBalance, out Util.emsg); if (listio != null && listio.Count > 0) { frm = new frmViewList(); frm.InitViewList(mod.SubjectName, listio); frm.ShowDialog(); } break; default: dalAccReport dalrpt = new dalAccReport(); BindingCollection <modAccCredenceDetail> listrpt = new BindingCollection <modAccCredenceDetail>(); dalrpt.GetCredenceDetail(true, cboAccName.ComboBox.SelectedValue.ToString(), mod.SubjectId, Util.IsTrialBalance, ref listrpt, out Util.emsg); if (listrpt != null && listrpt.Count > 0) { frm = new frmViewList(); frm.InitViewList(mod.SubjectName, listrpt); frm.ShowDialog(); } else { if (!string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } break; } }
private void tvSubject_AfterSelect(object sender, TreeViewEventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (tvSubject.SelectedNode == null) { return; } //decimal startsum = 0; //decimal borrowsum = 0; //decimal lendsum = 0; //decimal endsum = 0; dalAccReport dal = new dalAccReport(); switch (cboSubjectType.SelectedIndex) { case 0: BindingCollection <modAccCredenceDetail> list0 = dal.GetCashAndBankDetail(cboAccName.SelectedValue.ToString(), tvSubject.SelectedNode.Name, Util.IsTrialBalance, out Util.emsg); DBGrid.DataSource = list0; if (list0 == null && !string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (list0.Count > 0) { DBGrid.Columns["LastBalance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["ThisBalance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["LendMoney"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["BorrowMoney"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; Status1.Text = clsTranslate.TranslateString("Start Money") + " : " + string.Format("{0:C2}", list0[list0.Count - 1].LastBalance); Status2.Text = clsTranslate.TranslateString("Borrow Money") + " : " + string.Format("{0:C2}", list0[list0.Count - 1].BorrowMoney); Status3.Text = clsTranslate.TranslateString("Lend Money") + " : " + string.Format("{0:C2}", list0[list0.Count - 1].LendMoney); Status4.Text = clsTranslate.TranslateString("End Money") + " : " + string.Format("{0:C2}", list0[list0.Count - 1].ThisBalance); } break; case 1: BindingCollection <modAccCredenceDetail> list1 = new BindingCollection <modAccCredenceDetail>(); dal.GetCredenceDetail(true, cboAccName.SelectedValue.ToString(), tvSubject.SelectedNode.Name, Util.IsTrialBalance, ref list1, out Util.emsg); DBGrid.DataSource = list1; if (list1 == null && !string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (list1.Count > 0) { DBGrid.Columns["LastBalance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["ThisBalance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["LendMoney"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["BorrowMoney"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; Status1.Text = clsTranslate.TranslateString("Start Money") + " : " + string.Format("{0:C2}", list1[list1.Count - 1].LastBalance); Status2.Text = clsTranslate.TranslateString("Borrow Money") + " : " + string.Format("{0:C2}", list1[list1.Count - 1].BorrowMoney); Status3.Text = clsTranslate.TranslateString("Lend Money") + " : " + string.Format("{0:C2}", list1[list1.Count - 1].LendMoney); Status4.Text = clsTranslate.TranslateString("End Money") + " : " + string.Format("{0:C2}", list1[list1.Count - 1].ThisBalance); } break; } } 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; } }
private void LoadData() { if (prepared == false) { return; } if (DBGrid.CurrentRow == null) { return; } switch (cboBookType.SelectedIndex) { case 0: //应收 modCustomerSimpleList modCust = (modCustomerSimpleList)DBGrid.CurrentRow.DataBoundItem; dalAccReceivableList dalRec = new dalAccReceivableList(); BindingCollection <modReceivableBook> listRec = dalRec.GetReceivableBook(modCust.CustId, dtpFrom.Value, dtpTo.Value, out Util.emsg); DBGrid2.DataSource = listRec; break; case 1: //应付 modVendorList modVendor = (modVendorList)DBGrid.CurrentRow.DataBoundItem; dalAccPayableList dalPay = new dalAccPayableList(); BindingCollection <modPayableBook> listPay = dalPay.GetPayableBook(modVendor.VendorName, dtpFrom.Value, dtpTo.Value, out Util.emsg); DBGrid2.DataSource = listPay; break; case 2: //其它应收 modOtherReceivableObject modObjRec = (modOtherReceivableObject)DBGrid.CurrentRow.DataBoundItem; dalAccOtherReceivable dalORec = new dalAccOtherReceivable(); BindingCollection <modOtherReceivableBook> listORec = dalORec.GetOtherReceivableBook(modObjRec.ObjectName, dtpFrom.Value, dtpTo.Value, out Util.emsg); DBGrid2.DataSource = listORec; break; case 3: //其它应付 modOtherPayableObject modObjPay = (modOtherPayableObject)DBGrid.CurrentRow.DataBoundItem; dalAccOtherPayable dalOPay = new dalAccOtherPayable(); BindingCollection <modOtherPayableBook> listOPay = dalOPay.GetOtherPayableBook(modObjPay.ObjectName, dtpFrom.Value, dtpTo.Value, out Util.emsg); DBGrid2.DataSource = listOPay; break; case 4: //现金银行 modAccBankAccount modCash = (modAccBankAccount)DBGrid.CurrentRow.DataBoundItem; dalAccReport dalCash = new dalAccReport(); BindingCollection <modAccCredenceBook> listCash = dalCash.GetCashAndBankBook(modCash.AccountNo, dtpFrom.Value, dtpTo.Value, out Util.emsg); DBGrid2.DataSource = listCash; break; } for (int i = 0; i < DBGrid2.RowCount; i++) { if (DBGrid2.Rows[i].Cells["AccSeq"].Value.ToString() == "本月合计") { DBGrid2.Rows[i].DefaultCellStyle.ForeColor = Color.Red; } } if (DBGrid2.RowCount > 0) { DBGrid2.Columns[0].Visible = false; DBGrid2.Columns["StartMny"].Width = 120; DBGrid2.Columns["AddingMny"].Width = 120; DBGrid2.Columns["PaidMny"].Width = 120; DBGrid2.Columns["EndMny"].Width = 120; DBGrid2.Columns["StartMny"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid2.Columns["AddingMny"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid2.Columns["PaidMny"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid2.Columns["EndMny"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } }