//PopUp
 /// <summary>
 /// Function to call frmLedgerPopup form to select and view ledgers
 /// </summary>
 /// <param name="frmLedgerPopup"></param>
 /// <param name="decId"></param>
 public void CallFromLedgerPopup(frmLedgerPopup frmLedgerPopup, decimal decId)
 {
     try
     {
         base.Show();
         this.frmLedgerPopupObj = frmLedgerPopup;
         TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll();
         obj.CashOrBankComboFill(cmbCashBankAC, false);
         cmbCashBankAC.SelectedValue = decId;
         cmbCashBankAC.Focus();
         frmLedgerPopupObj.Close();
         frmLedgerPopupObj = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show("MSR4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Combofill function of Cash or Bank
 /// </summary>
 /// <param name="cmbBankOrcash"></param>
 public void BankOrCashComboFill(ComboBox cmbBankOrcash)
 {
     try
     {
         TransactionsGeneralFillBll Obj = new TransactionsGeneralFillBll();
         Obj.CashOrBankComboFill(cmbBankOrcash, false);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CV:01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 //PopUp
 /// <summary>
 /// Its the function for find and select purticular cash or bank ledger in a popup window
 /// </summary>
 /// <param name="frmLedgerPopup"></param>
 /// <param name="decId"></param>
 /// <param name="strComboTypes"></param>
 public void CallFromLedgerPopup(frmLedgerPopup frmLedgerPopup, decimal decId, string strComboTypes)
 {
     try
     {
         base.Show();
         this.frmLedgerPopupObj = frmLedgerPopup;
         if (strComboTypes == "CashOrBank")
         {
             TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll();
             obj.CashOrBankComboFill(cmbBankAccount, false);
             cmbBankAccount.SelectedValue = decId;
         }
         else
         {
             dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value = decId;
         }
         frmLedgerPopupObj.Close();
         frmLedgerPopupObj = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CV:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to fill cash/Bank combobox while return from AccountLedger when creating new ledger 
        /// </summary>
        /// <param name="decId"></param>
        public void ReturnFromAccountLedgerForm(decimal decId)
        {
            try
            {
                TransactionsGeneralFillBll Obj = new TransactionsGeneralFillBll();
                Obj.CashOrBankComboFill(cmbCashOrBankAcc, false);
                cmbCashOrBankAcc.SelectedValue = decId.ToString();
                this.Enabled = true;
                cmbCashOrBankAcc.Focus();

            }
            catch (Exception ex)
            {
                MessageBox.Show("MSV17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMonthlySalaryVoucher_Load(object sender, EventArgs e)
        {
            try
            {
                lblCashOrBankIndicator.Visible = true;
                lblVoucherDateIndicator.Visible = true;
                lblVoucherNoIndicator.Visible = true;
                TransactionsGeneralFillBll Obj = new TransactionsGeneralFillBll();
                Obj.CashOrBankComboFill(cmbCashOrBankAcc, false);
                dtpMonth.Value = PublicVariables._dtCurrentDate;
                dtpMonth.MinDate = PublicVariables._dtFromDate;
                dtpMonth.MaxDate = PublicVariables._dtToDate;
                dtpVoucherDate.Value = PublicVariables._dtCurrentDate;
                dtpVoucherDate.MinDate = PublicVariables._dtFromDate;
                dtpVoucherDate.MaxDate = PublicVariables._dtToDate;
                dtpVoucherDate.CustomFormat = "dd-MMMM-yyyy";

                if (isEditMode == false)
                {
                    Clear();
                }
                GridFill(isEditMode);

            }
            catch (Exception ex)
            {
                MessageBox.Show("MSV19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmDailySalaryVoucher_Load(object sender, EventArgs e)
        {
            try
            {

                txtVoucherNo.Select();
                dtpDate.Value = PublicVariables._dtCurrentDate;
                dtpDate.MinDate = PublicVariables._dtFromDate;
                dtpDate.MaxDate = PublicVariables._dtToDate;
                dtpDate.CustomFormat = "dd-MMMM-yyyy";

                dtpSalaryDate.Value = PublicVariables._dtCurrentDate;
                dtpSalaryDate.MinDate = PublicVariables._dtFromDate;
                dtpSalaryDate.MaxDate = PublicVariables._dtToDate;

                TransactionsGeneralFillBll Obj = new TransactionsGeneralFillBll();
                Obj.CashOrBankComboFill(cmbCashorBankAccount, false);
                if (isEditmode == false)
                {
                    Clear();
                }

                DailySalaryVoucherDetailsGridfill(isEditmode);
            }
            catch (Exception ex)
            {
                MessageBox.Show("DSV18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to reset form
 /// </summary>
 public void Clear()
 {
     try
     {
         txtVoucherDateFrom.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
         txtVoucherDateTo.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
         dtpVoucherDateFrom.Value = PublicVariables._dtCurrentDate;
         dtpVoucherDateFrom.MinDate = PublicVariables._dtFromDate;
         dtpVoucherDateFrom.MaxDate = PublicVariables._dtToDate;
         dtpVoucherDateTo.Value = PublicVariables._dtCurrentDate;
         dtpVoucherDateTo.MinDate = PublicVariables._dtFromDate;
         dtpVoucherDateTo.MaxDate = PublicVariables._dtToDate;
         dtpSalaryMonth.Value = PublicVariables._dtCurrentDate;
         dtpSalaryMonth.MinDate = PublicVariables._dtFromDate;
         dtpSalaryMonth.MaxDate = PublicVariables._dtToDate;
         txtVoucherNo.Clear();
         cmbVoucherTypeName.SelectedIndex = -1;
         VoucherTypeNameComboFill();
         TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll();
         obj.CashOrBankComboFill(cmbCashBankAC, false);
         cmbCashBankAC.SelectedIndex = -1;
         GridFill();
     }
     catch (Exception ex)
     {
         MessageBox.Show("MSR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to fill BankorCash combobox while return from Ledger creation when creating new ledger 
        /// </summary>
        /// <param name="decId"></param>
        /// <param name="str"></param>
        public void ReturnFromAccountLedgerForm(decimal decId, string str)
        {
            try
            {
                if (str == "CashOrBank")
                {
                    if (decId != 0)
                    {
                        TransactionsGeneralFillBll Obj = new TransactionsGeneralFillBll();
                        Obj.CashOrBankComboFill(cmbBankorCash, false);
                        cmbBankorCash.SelectedValue = decId.ToString();
                    }
                    cmbBankorCash.Focus();
                }
                else
                {
                    if (decId != 0)
                    {
                        int inCurrentRowIndex = dgvPaymentVoucher.CurrentRow.Index;
                        if (inCurrentRowIndex == dgvPaymentVoucher.Rows.Count - 1)
                        {
                            dgvPaymentVoucher.Rows.Add();
                        }
                        dgvPaymentVoucher.CurrentRow.HeaderCell.Value = "X";
                        dgvPaymentVoucher.CurrentRow.HeaderCell.Style.ForeColor = Color.Red;
                        List<DataTable> ListObj = new List<DataTable>();
                        AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
                        ListObj = bllAccountLedger.AccountLedgerViewAll();
                        DataGridViewComboBoxCell dgvccCashOrBank = (DataGridViewComboBoxCell)dgvPaymentVoucher[dgvPaymentVoucher.Columns["dgvcmbAccountLedger"].Index, dgvPaymentVoucher.Rows[inCurrentRowIndex].Index];
                        DataRow dr = ListObj[0].NewRow();
                        dr["ledgerId"] = "0";
                        dr["ledgerName"] = string.Empty;
                        ListObj[0].Rows.InsertAt(dr, 0);
                        dgvccCashOrBank.DataSource = ListObj[0];
                        dgvccCashOrBank.ValueMember = "ledgerId";
                        dgvccCashOrBank.DisplayMember = "ledgerName";
                        dgvPaymentVoucher.Rows[inCurrentRowIndex].Cells["dgvcmbAccountLedger"].Value = decId;
                        dgvPaymentVoucher.Rows[inCurrentRowIndex].Cells["dgvcmbAccountLedger"].Selected = true;

                    }
                }

                this.Enabled = true;
                this.BringToFront();
            }
            catch (Exception ex)
            {
                MessageBox.Show("PV29:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to call frmLedgerPopup form to select and view Ledger
 /// </summary>
 /// <param name="frmLedgerPopup"></param>
 /// <param name="decId"></param>
 /// <param name="str"></param>
 public void CallFromLedgerPopup(frmLedgerPopup frmLedgerPopup, decimal decId, string str)
 {
     try
     {
         this.Enabled = true;
         if (str == "CashOrBank")
         {
             TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll();
             obj.CashOrBankComboFill(cmbBankorCash, false);
             cmbBankorCash.SelectedValue = decId;
             cmbBankorCash.Focus();
         }
         else
         {
             dgvPaymentVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].Value = decId;
             dgvPaymentVoucher.Focus();
         }
         frmLedgerPopupObj.Close();
         frmLedgerPopupObj = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PV6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill cashorbank combobox
 /// </summary>
 public void CashOrBankComboFill()
 {
     try
     {
         TransactionsGeneralFillBll TransactionsGeneralFillObj = new TransactionsGeneralFillBll();
         TransactionsGeneralFillObj.CashOrBankComboFill(cmbCashOrBank, false);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SJ:28" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Cash/Bank combobox while return from frmAccountLedger in case of creating new ledger
 /// </summary>
 /// <param name="decId"></param>
 public void ReturnFromAccountLedgerForm(decimal decId)
 {
     try
     {
         TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll();
         obj.CashOrBankComboFill(cmbCashOrBank, false);
         cmbCashOrBank.SelectedValue = decId.ToString();
         if (decId.ToString() != "0")
         {
             cmbCashOrBank.SelectedValue = decId;
         }
         else if (strLedgerId != string.Empty)
         {
             cmbCashOrBank.SelectedValue = strLedgerId;
         }
         else
         {
             cmbCashOrBank.SelectedIndex = -1;
         }
         this.Enabled = true;
         cmbCashOrBank.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show("AP19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Load
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void frmAdvancePayment_Load(object sender, EventArgs e)
 {
     try
     {
         dtpSalaryMonth.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
         dtpDate.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
         dtpCheckDate.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
         TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll();
         obj.CashOrBankComboFill(cmbCashOrBank, false);
         EmployeeComboFill();
         btnAdvancePaymentDelete.Enabled = false;
         Clear();
         isLoad = true;
         dtpDate.MinDate = PublicVariables._dtFromDate;
         dtpDate.MaxDate = PublicVariables._dtToDate;
     }
     catch (Exception ex)
     {
         MessageBox.Show("AP22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// BankOrCashComboFill function
 /// </summary>
 private void BankOrCashComboFill()
 {
     try
     {
         TransactionsGeneralFillBll TransactionGeneralFillObj = new TransactionsGeneralFillBll();
         TransactionGeneralFillObj.CashOrBankComboFill(cmbCashOrBank, true);
     }
     catch (Exception ex)
     {
         MessageBox.Show("RV1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        //From AccountLedger form
        /// <summary>
        /// Function to fill Account ledger combobox while return from Account ledger creation when creating new ledger 
        /// </summary>
        /// <param name="decId"></param>
        /// <param name="str"></param>
        public void ReturnFromAccountLedgerForm(decimal decId, string str)
        {
            try
            {
                if (str == "CashOrBank")
                {
                    if (decId != 0)
                    {
                        TransactionsGeneralFillBll Obj = new TransactionsGeneralFillBll();
                        Obj.CashOrBankComboFill(cmbCashOrBank, false);
                        cmbCashOrBank.SelectedValue = decId.ToString();
                    }
                    cmbCashOrBank.Focus();
                }
                else
                {
                    if (decId != 0)
                    {

                        List<DataTable> ListObj = new List<DataTable>();
                        AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
                        ListObj = bllAccountLedger.AccountLedgerViewAll();
                        DataGridViewComboBoxCell dgvccCashOrBank = (DataGridViewComboBoxCell)dgvReceiptVoucher[dgvReceiptVoucher.Columns["dgvcmbAccountLedger"].Index, dgvReceiptVoucher.CurrentRow.Index];
                        dgvccCashOrBank.DataSource = ListObj;
                        dgvccCashOrBank.ValueMember = "ledgerId";
                        dgvccCashOrBank.DisplayMember = "ledgerName";
                        dgvReceiptVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].Value = decId;
                    }
                }
                this.Enabled = true;
                this.BringToFront();
            }
            catch (Exception ex)
            {
                MessageBox.Show("RV29:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }