Пример #1
0
        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;
            }
        }
Пример #2
0
        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;
            }
        }