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; } }
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 DBGrid_DoubleClick(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.CurrentRow == null) { return; } frmViewList frm = new frmViewList(); modAccountBalance mod = (modAccountBalance)DBGrid.CurrentRow.DataBoundItem; switch (mod.SubjectId) { case "1030": //现金银行 BindingCollection <modAccCredenceDetail> listcash = _dal.GetCashAndBankDetail(Util.modperiod.AccName, Util.IsTrialBalance, out Util.emsg); frm.InitViewList(mod.SubjectName + clsTranslate.TranslateString("Detail"), listcash); break; case "1235": //库存商品 dalAccProductInout dalpdt = new dalAccProductInout(); BindingCollection <modAccProductSummary> listpdt = dalpdt.GetAccProductSummary(Util.modperiod.AccName, Util.IsTrialBalance, out Util.emsg); frm.InitViewList(mod.SubjectName + clsTranslate.TranslateString("Detail"), listpdt); break; case "1055": //应收帐款 dalAccReceivableList dalrec = new dalAccReceivableList(); BindingCollection <modCustReceivableSummary> listrec = dalrec.GetCustReceivableSummary(Util.modperiod.AccName, out Util.emsg); frm.InitViewList(mod.SubjectName + clsTranslate.TranslateString("Detail"), listrec); break; case "5145": //应付账款 dalAccPayableList dalpay = new dalAccPayableList(); BindingCollection <modVendorPayableSummary> listpay = dalpay.GetVendorPayableSummary(Util.modperiod.AccName, out Util.emsg); frm.InitViewList(mod.SubjectName + clsTranslate.TranslateString("Detail"), listpay); break; case "1060": //其它应收款 dalAccOtherReceivable dalorec = new dalAccOtherReceivable(); BindingCollection <modOtherReceivableSummary> listorec = dalorec.GetOtherReceivableSummary(Util.modperiod.AccName, out Util.emsg); frm.InitViewList(mod.SubjectName + clsTranslate.TranslateString("Detail"), listorec); break; case "5155": //其他应付款 dalAccOtherPayable dalopay = new dalAccOtherPayable(); BindingCollection <modOtherPayableSummary> listopay = dalopay.GetOtherPayableSummary(Util.modperiod.AccName, out Util.emsg); frm.InitViewList(mod.SubjectName + clsTranslate.TranslateString("Detail"), listopay); break; case "1075": //应收票据 dalAccCheckList dalcheckrec = new dalAccCheckList(); BindingCollection <modAccCheckList> listcheckrec = dalcheckrec.GetIList("0", string.Empty, mod.SubjectId, string.Empty, string.Empty, string.Empty, out Util.emsg); frm.InitViewList(mod.SubjectName + clsTranslate.TranslateString("Detail"), listcheckrec); break; case "5125": //应付票据 dalAccCheckList dalcheckpay = new dalAccCheckList(); BindingCollection <modAccCheckList> listcheckpay = dalcheckpay.GetIList("0", string.Empty, mod.SubjectId, string.Empty, string.Empty, string.Empty, out Util.emsg); frm.InitViewList(mod.SubjectName + clsTranslate.TranslateString("Detail"), listcheckpay); break; default: break; } frm.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }