/// <summary>
 /// Fill function for updation
 /// </summary>
 public void FillFunction()
 {
     try
     {
         isValueChange = false;
         ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
         ReceiptMasterSP SpReceiptMaster = new ReceiptMasterSP();
         ReceiptDetailsInfo InfoReceiptDetails = new ReceiptDetailsInfo();
         ReceiptDetailsSP SpReceiptDetails = new ReceiptDetailsSP();
         PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
         LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
         VoucherTypeSP SpVoucherType = new VoucherTypeSP();
         AccountGroupSP spAccountGroup = new AccountGroupSP();
         AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
         InfoReceiptMaster = SpReceiptMaster.ReceiptMasterViewByMasterId(decRecieptmasterId);
         isAutomatic = SpVoucherType.CheckMethodOfVoucherNumbering(InfoReceiptMaster.VoucherTypeId);
         if (isAutomatic)
         {
             txtVoucherNo.ReadOnly = true;
             txtVoucherNo.Text = InfoReceiptMaster.InvoiceNo;
         }
         else
         {
             txtVoucherNo.ReadOnly = false;
             txtVoucherNo.Text = InfoReceiptMaster.VoucherNo;
         }
         dtpDate.Value = InfoReceiptMaster.Date;
         cmbCashOrBank.SelectedValue = InfoReceiptMaster.LedgerId;
         txtNarration.Text = InfoReceiptMaster.Narration;
         txtTotal.Text = InfoReceiptMaster.TotalAmount.ToString();
         decDailySuffixPrefixId = InfoReceiptMaster.SuffixPrefixId;
         decReceiptVoucherTypeId = InfoReceiptMaster.VoucherTypeId;
         strVoucherNo = InfoReceiptMaster.VoucherNo;
         strInvoiceNo = InfoReceiptMaster.InvoiceNo;
         DataTable dtbl = new DataTable();
         dtbl = SpReceiptDetails.ReceiptDetailsViewByMasterId(decRecieptmasterId);
         for (int inI = 0; inI < dtbl.Rows.Count; inI++)
         {
             dgvReceiptVoucher.Rows.Add();
             dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString());
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptMasterId"].Value = dtbl.Rows[inI]["receiptMasterId"].ToString();
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtreceiptDetailsId"].Value = dtbl.Rows[inI]["receiptDetailsId"].ToString();
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = dtbl.Rows[inI]["amount"].ToString();
             dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString());
             decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["receiptDetailsId"].ToString());
             decimal decLedgerPostingId = SpLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decReceiptVoucherTypeId);
             dgvReceiptVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString();
             decimal decLedgerId = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString());
             bool IsBankAccount = spAccountGroup.AccountGroupwithLedgerId(decLedgerId);
             decimal decI = Convert.ToDecimal(SpAccountLedger.AccountGroupIdCheck(dgvReceiptVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].FormattedValue.ToString()));
             if (decI > 0)
             {
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = true;
                 dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = true;
             }
             else
             {
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = false;
                 dgvReceiptVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = false;
             }
             if (dtbl.Rows[inI]["chequeNo"].ToString() != string.Empty)
             {
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["chequeNo"].ToString();
                 dgvReceiptVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = Convert.ToDateTime(dtbl.Rows[inI]["chequeDate"].ToString()).ToString("dd-MMM-yyyy");
             }
             dgvReceiptVoucher.Rows[inI].HeaderCell.Value = string.Empty;
         }
         DataTable dtbl1 = new DataTable();
         dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decReceiptVoucherTypeId, strVoucherNo, InfoReceiptMaster.Date);
         dtblPartyBalance = dtbl1;
         isValueChange = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("RV34:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }