Exemplo n.º 1
0
        private void btnView_Click(object sender, EventArgs e)
        {
            clearData();
            if (dtFromDate.Value > dtToDate.Value)
            {
                MessageBox.Show("From Date is Greater than to Date. Check First.");
                return;
            }
            string   totalString = "";
            DateTime ToDate      = dtToDate.Value;
            DateTime FromDate    = dtFromDate.Value;

            if (Utilities.verifyFinancialYear(cmbFYID.SelectedItem.ToString(), FromDate) &&
                Utilities.verifyFinancialYear(cmbFYID.SelectedItem.ToString(), ToDate))
            {
                totalString = ReceiptAndPaymentDB.getTotalreceiptAndTotalValue(FromDate, ToDate);
            }
            else
            {
                MessageBox.Show("Error:\n From Date or To Date is wrong.");
                return;
            }
            txtTotalPayment.Text            = totalString.Substring(0, totalString.IndexOf(':'));
            txtTotalReceipt.Text            = totalString.Substring(totalString.IndexOf(':') + 1);
            txtDifference.Text              = (Convert.ToDecimal(txtTotalReceipt.Text) - Convert.ToDecimal(txtTotalPayment.Text)).ToString();
            pnlShowTotal.Visible            = true;
            grdDocumentWiseList.Visible     = false;
            grdRadioSelectWiseList.Visible  = false;
            btnDocWiseExportToExcel.Visible = false;
            btnLevel2ExportToexcel.Visible  = false;
            btnClose1StGrid.Visible         = false;
            btnClose2ndGrid.Visible         = false;
        }
Exemplo n.º 2
0
        private void grdRadioSelectWiseList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            string columnName = grdRadioSelectWiseList.Columns[e.ColumnIndex].Name;

            try
            {
                if (columnName.Equals("Details") && e.RowIndex != grdRadioSelectWiseList.Rows.Count - 1)
                {
                    grdRadioSelectWiseList.Rows[rowIndex].DefaultCellStyle.BackColor = c;
                    c = grdRadioSelectWiseList.Rows[e.RowIndex].DefaultCellStyle.BackColor;
                    grdRadioSelectWiseList.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.CornflowerBlue;
                    rowIndex = e.RowIndex;
                    btnClose2ndGrid.Visible     = true;
                    grdDocumentWiseList.Visible = true;
                    int    opt;
                    ledger ldg   = new ledger();
                    string HText = grdRadioSelectWiseList.Columns["SelectedType"].HeaderText;
                    if (HText.Equals("Account Code"))
                    {
                        opt = 1;
                        //string str = grdRadioSelectWiseList.Rows[e.RowIndex].Cells["SelectedType"].Value.ToString();
                        ldg.AccountCode = grdRadioSelectWiseList.Rows[e.RowIndex].Cells["SelectedType"].Value.ToString();
                        ldg.AccountName = grdRadioSelectWiseList.Rows[e.RowIndex].Cells["SelectedName"].Value.ToString();
                    }
                    else if (HText.Equals("Party Code"))
                    {
                        opt = 2;
                        //string str = grdRadioSelectWiseList.Rows[e.RowIndex].Cells["SelectedType"].Value.ToString();
                        ldg.SLCode = grdRadioSelectWiseList.Rows[e.RowIndex].Cells["SelectedType"].Value.ToString();
                        ldg.SLName = grdRadioSelectWiseList.Rows[e.RowIndex].Cells["SelectedName"].Value.ToString();
                    }
                    else
                    {
                        opt = 3;
                        string str = grdRadioSelectWiseList.Rows[e.RowIndex].Cells["SelectedType"].Value.ToString();
                        str             = Utilities.convertDateStringToAnsi(str);
                        ldg.VoucherDate = Convert.ToDateTime(str);
                        ////DateTime tDate = Convert.ToDateTime("30-01-2018",);
                        ////DateTime tDate = DateTime.ParseExact("2018-01-30 00:00:00", "yyyy-MM-dd HH:mm", null);
                        //ldg.VoucherDate = DateTime.Parse(str);
                    }
                    List <ledger> ledgList = ReceiptAndPaymentDB.getDocumentWiseDetail(ldg, opt, dtFromDate.Value, dtToDate.Value);
                    btnDocWiseExportToExcel.Visible = true;
                    showDocumentWiseDetailGrid(ledgList);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("grdRadioSelectWiseList_CellContentClick() : Error - " + ex.ToString());
            }
        }
Exemplo n.º 3
0
 private void ShowRadioSelectWiseGridView(int opt)
 {
     try
     {
         if (opt == 3)
         {
             grdRadioSelectWiseList.Columns["SelectedType"].Width = 120;
             grdRadioSelectWiseList.Columns["Receipt"].Width      = 150;
             grdRadioSelectWiseList.Columns["Payment"].Width      = 150;
             grdRadioSelectWiseList.Columns["Details"].Width      = 90;
         }
         else
         {
             grdRadioSelectWiseList.Columns["SelectedType"].Width = 70;
             grdRadioSelectWiseList.Columns["Receipt"].Width      = 100;
             grdRadioSelectWiseList.Columns["Payment"].Width      = 100;
             grdRadioSelectWiseList.Columns["Details"].Width      = 70;
         }
         if (opt == 1)
         {
             grdRadioSelectWiseList.Columns["SelectedType"].HeaderText = "Account Code";
             grdRadioSelectWiseList.Columns["SelectedName"].HeaderText = "Account Name";
             grdRadioSelectWiseList.Columns["SelectedName"].Visible    = true;
             List <ledger> LedgerList = ReceiptAndPaymentDB.getFilteredPaymentAndReceiptDetails(opt, dtFromDate.Value, dtToDate.Value);
             addDetailsToGrid(LedgerList, opt);
         }
         else if (opt == 2)
         {
             grdRadioSelectWiseList.Columns["SelectedType"].HeaderText = "Party Code";
             grdRadioSelectWiseList.Columns["SelectedName"].HeaderText = "Party Name";
             grdRadioSelectWiseList.Columns["SelectedName"].Visible    = true;
             List <ledger> LedgerList = ReceiptAndPaymentDB.getFilteredPaymentAndReceiptDetails(opt, dtFromDate.Value, dtToDate.Value);
             addDetailsToGrid(LedgerList, opt);
         }
         else if (opt == 3)
         {
             grdRadioSelectWiseList.Columns["SelectedType"].HeaderText = "Date";
             grdRadioSelectWiseList.Columns["SelectedName"].Visible    = false;
             List <ledger> LedgerList = ReceiptAndPaymentDB.getFilteredPaymentAndReceiptDetails(opt, dtFromDate.Value, dtToDate.Value);
             addDetailsToGrid(LedgerList, opt);
         }
     }
     catch (Exception ex)
     {
     }
 }