Beispiel #1
0
        private void BtnFilterOption_Click(object sender, EventArgs e)
        {
            FilterRptAllLedger frm = new FilterRptAllLedger();

            frm.StartPosition = FormStartPosition.CenterScreen;
            frm.ShowDialog();
            BindReport(frm);
        }
Beispiel #2
0
        private void AfterLoading(object sender, EventArgs e)
        {
            this.Activated -= AfterLoading;
            FilterRptAllLedger frm = new FilterRptAllLedger();

            frm.ShowDialog();
            BindReport(frm);
        }
Beispiel #3
0
        private void BindReport(FilterRptAllLedger frm)
        {
            DataSet ds = new DataSet();

            if (frm.ButtonAction == "OK")
            {
                DataTable NullDt = new DataTable();
                Grid.DataSource = NullDt;
                DateTime FromDate = new DateTime();
                DateTime ToDate   = new DateTime();
                if (ClsGlobal.DateType == "D")
                {
                    FromDate = Convert.ToDateTime(frm.TxtFromDate.Text);
                    ToDate   = Convert.ToDateTime(frm.TxtToDate.Text);
                }
                else
                {
                    FromDate = Convert.ToDateTime(frm.TxtFromDate.Tag.ToString());
                    ToDate   = Convert.ToDateTime(frm.TxtToDate.Tag.ToString());
                }

                if (frm.ChkDetails.Checked == true) //--------------- DETAILS LEDGER WISE ----------------
                {
                    bool isNarrationShow = (frm.ChkNarration.Checked == true) ? true : false;
                    ds = _objRptAllLedger.AllLedgerDetailsLedgerWise(FromDate, ToDate, ClsGlobal.BranchId, ClsGlobal.CompanyUnitId, isNarrationShow, frm._LedgerId);
                    Grid.DataSource = ds.Tables[0];
                    //Grid.Columns["Voucher No"].Width = 80;
                    Grid.Columns["Date"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["Particular/Ledger"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["Dr Amount"].AutoSizeMode         = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["Cr Amount"].AutoSizeMode         = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["Balance"].AutoSizeMode           = DataGridViewAutoSizeColumnMode.Fill;

                    Grid.Columns["Dr Amount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    Grid.Columns["Cr Amount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    Grid.Columns["Balance"].DefaultCellStyle.Alignment   = DataGridViewContentAlignment.MiddleRight;

                    int i = 0;
                    foreach (DataGridViewRow row in Grid.Rows)
                    {
                        if (row.Cells["IsBold"].Value.ToString() == "Y" || row.Cells["Particular/Ledger"].Value.ToString() == "Periodic Total :" || row.Cells["Particular/Ledger"].Value.ToString() == "A/C Total :" || row.Cells["Particular/Ledger"].Value.ToString() == "Grand Opening Total :" || row.Cells["Particular/Ledger"].Value.ToString() == "Grand Periodic Total :" || row.Cells["Particular/Ledger"].Value.ToString() == "Grand Total :" || row.Cells["Date"].Value.ToString() == "Narr :")
                        {
                            if (row.Cells["IsBold"].Value.ToString() == "Y")
                            {
                                Grid.Rows[row.Index].DefaultCellStyle.Font = new Font("Arial", 8f, FontStyle.Bold);
                            }
                            if (row.Cells["Particular/Ledger"].Value.ToString() == "Periodic Total :" || row.Cells["Particular/Ledger"].Value.ToString() == "A/C Total :" || row.Cells["Particular/Ledger"].Value.ToString() == "Grand Opening Total :" || row.Cells["Particular/Ledger"].Value.ToString() == "Grand Periodic Total :" || row.Cells["Particular/Ledger"].Value.ToString() == "Grand Total :")
                            {
                                Grid.Rows[row.Index].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                            }

                            if (row.Cells["Date"].Value.ToString() == "Narr :")
                            {
                                Grid.Rows[i].Cells[0].Style.Alignment      = DataGridViewContentAlignment.MiddleRight;
                                Grid.Rows[row.Index].DefaultCellStyle.Font = new Font("Arial", 8f, FontStyle.Italic);
                            }
                        }
                        i++;
                    }
                }
                else //--------------- SUMMARY LEDGER WISE ----------------
                {
                    ds = _objRptAllLedger.AllLedgerSummaryLedgerWise(FromDate, ToDate, ClsGlobal.BranchId, ClsGlobal.CompanyUnitId, frm._LedgerId);
                    Grid.DataSource = ds.Tables[0];
                    //Grid.Columns["Voucher No"].Width = 80;
                    Grid.Columns["Code"].AutoSizeMode        = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["Description"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["O Dr"].AutoSizeMode        = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["O Cr"].AutoSizeMode        = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["P Dr"].AutoSizeMode        = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["P Cr"].AutoSizeMode        = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["Balance"].AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["C Dr"].AutoSizeMode        = DataGridViewAutoSizeColumnMode.Fill;
                    Grid.Columns["C Cr"].AutoSizeMode        = DataGridViewAutoSizeColumnMode.Fill;

                    Grid.Columns["O Dr"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;
                    Grid.Columns["O Cr"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;
                    Grid.Columns["P Dr"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;
                    Grid.Columns["P Cr"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;
                    Grid.Columns["Balance"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    Grid.Columns["C Dr"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;
                    Grid.Columns["C Cr"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;
                    foreach (DataGridViewRow row in Grid.Rows)
                    {
                        if (row.Cells["IsBold"].Value.ToString() == "Y" || row.Cells["Description"].Value.ToString() == "Total :")
                        {
                            Grid.Rows[row.Index].DefaultCellStyle.Font = new Font("Arial", 8f, FontStyle.Bold);
                            if (row.Cells["Description"].Value.ToString() == "Total :")
                            {
                                Grid.Rows[row.Index].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                            }
                        }
                    }
                }
                Grid.Columns["IsBold"].Visible = false;
                Grid.Columns.Cast <DataGridViewColumn>().ToList().ForEach(f => f.SortMode = DataGridViewColumnSortMode.NotSortable);
            }
            frm.Dispose();
        }