/// <summary>
        /// Function to Update values in PDCReceivableMaster Table
        /// </summary>
        /// <param name="pdcreceivablemasterinfo"></param>
        public void PDCReceivableMasterEdit(PDCReceivableMasterInfo pdcreceivablemasterinfo)
        {
            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PDCReceivableMasterEdit", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@pdcReceivableMasterId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.PdcReceivableMasterId;
                sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.VoucherNo;
                sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.InvoiceNo;
                sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.SuffixPrefixId;
                sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value = pdcreceivablemasterinfo.Date;
                sprmparam       = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.LedgerId;
                sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.Amount;
                sprmparam       = sccmd.Parameters.Add("@chequeNo", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.ChequeNo;
                sprmparam       = sccmd.Parameters.Add("@chequeDate", SqlDbType.DateTime);
                sprmparam.Value = pdcreceivablemasterinfo.ChequeDate;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.UserId;
                sprmparam       = sccmd.Parameters.Add("@bankId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.BankId;
                sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.VoucherTypeId;
                sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.FinancialYearId;
                sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
                sprmparam.Value = pdcreceivablemasterinfo.ExtraDate;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.Extra2;
                sccmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            finally
            {
                sqlcon.Close();
            }
        }
    /// <summary>
    /// Function to insert values to PDCReceivableMaster Table
    /// </summary>
    /// <param name="pdcreceivablemasterinfo"></param>
    /// <returns></returns>

    public decimal PDCReceivableMasterAdd(PDCReceivableMasterInfo pdcreceivablemasterinfo)
    {
        decimal decIdentity = 0;
        try
        {
          if (sqlcon.State == ConnectionState.Closed)
            {
                sqlcon.Open();
            }
            SqlCommand sccmd = new SqlCommand("PDCReceivableMasterAdd", sqlcon);
            sccmd.CommandType = CommandType.StoredProcedure;
            SqlParameter sprmparam = new SqlParameter();
            sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
            sprmparam.Value = pdcreceivablemasterinfo.VoucherNo;
            sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
            sprmparam.Value = pdcreceivablemasterinfo.InvoiceNo;
            sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
            sprmparam.Value = pdcreceivablemasterinfo.SuffixPrefixId;
            sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
            sprmparam.Value = pdcreceivablemasterinfo.Date;
            sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
            sprmparam.Value = pdcreceivablemasterinfo.LedgerId;
            sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
            sprmparam.Value = pdcreceivablemasterinfo.Amount;
            sprmparam = sccmd.Parameters.Add("@chequeNo", SqlDbType.VarChar);
            sprmparam.Value = pdcreceivablemasterinfo.ChequeNo;
            sprmparam = sccmd.Parameters.Add("@chequeDate", SqlDbType.DateTime);
            sprmparam.Value = pdcreceivablemasterinfo.ChequeDate;
            sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
            sprmparam.Value = pdcreceivablemasterinfo.Narration;
            sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
            sprmparam.Value = pdcreceivablemasterinfo.UserId;
            sprmparam = sccmd.Parameters.Add("@bankId", SqlDbType.Decimal);
            sprmparam.Value = pdcreceivablemasterinfo.BankId;
            sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
            sprmparam.Value = pdcreceivablemasterinfo.VoucherTypeId;
            sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
            sprmparam.Value = pdcreceivablemasterinfo.FinancialYearId;
            sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
            sprmparam.Value = pdcreceivablemasterinfo.Extra1;
            sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
            sprmparam.Value = pdcreceivablemasterinfo.Extra2;
            decIdentity = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
        finally
        {
            sqlcon.Close();
        }
        return decIdentity;
    }
        /// <summary>
        /// Function to get particular values from PDCReceivableMaster Table based on the parameter
        /// </summary>
        /// <param name="pdcReceivableMasterId"></param>
        /// <returns></returns>
        public PDCReceivableMasterInfo PDCReceivableMasterView(decimal pdcReceivableMasterId)
        {
            PDCReceivableMasterInfo pdcreceivablemasterinfo = new PDCReceivableMasterInfo();
            SqlDataReader           sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PDCReceivableMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@pdcReceivableMasterId", SqlDbType.Decimal);
                sprmparam.Value = pdcReceivableMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    pdcreceivablemasterinfo.PdcReceivableMasterId = decimal.Parse(sdrreader[0].ToString());
                    pdcreceivablemasterinfo.VoucherNo             = sdrreader[1].ToString();
                    pdcreceivablemasterinfo.InvoiceNo             = sdrreader[2].ToString();
                    pdcreceivablemasterinfo.SuffixPrefixId        = decimal.Parse(sdrreader[3].ToString());
                    pdcreceivablemasterinfo.Date            = DateTime.Parse(sdrreader[4].ToString());
                    pdcreceivablemasterinfo.LedgerId        = decimal.Parse(sdrreader[5].ToString());
                    pdcreceivablemasterinfo.Amount          = decimal.Parse(sdrreader[6].ToString());
                    pdcreceivablemasterinfo.ChequeNo        = sdrreader[7].ToString();
                    pdcreceivablemasterinfo.ChequeDate      = DateTime.Parse(sdrreader[8].ToString());
                    pdcreceivablemasterinfo.Narration       = sdrreader[9].ToString();
                    pdcreceivablemasterinfo.UserId          = decimal.Parse(sdrreader[10].ToString());
                    pdcreceivablemasterinfo.BankId          = decimal.Parse(sdrreader[11].ToString());
                    pdcreceivablemasterinfo.VoucherTypeId   = decimal.Parse(sdrreader[12].ToString());
                    pdcreceivablemasterinfo.FinancialYearId = decimal.Parse(sdrreader[13].ToString());
                    pdcreceivablemasterinfo.ExtraDate       = DateTime.Parse(sdrreader[14].ToString());
                    pdcreceivablemasterinfo.Extra1          = sdrreader[15].ToString();
                    pdcreceivablemasterinfo.Extra2          = sdrreader[16].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            { sdrreader.Close();
              sqlcon.Close(); }
            return(pdcreceivablemasterinfo);
        }
 /// <summary>
 /// Function to get particular values from PDCReceivableMaster Table based on the parameter
 /// </summary>
 /// <param name="pdcReceivableMasterId"></param>
 /// <returns></returns>
 public PDCReceivableMasterInfo PDCReceivableMasterView(decimal pdcReceivableMasterId )
 {
     PDCReceivableMasterInfo pdcreceivablemasterinfo =new PDCReceivableMasterInfo();
     SqlDataReader sdrreader =null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PDCReceivableMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@pdcReceivableMasterId", SqlDbType.Decimal);
         sprmparam.Value = pdcReceivableMasterId;
          sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             pdcreceivablemasterinfo.PdcReceivableMasterId=decimal.Parse(sdrreader[0].ToString());
             pdcreceivablemasterinfo.VoucherNo= sdrreader[1].ToString();
             pdcreceivablemasterinfo.InvoiceNo= sdrreader[2].ToString();
             pdcreceivablemasterinfo.SuffixPrefixId=decimal.Parse(sdrreader[3].ToString());
             pdcreceivablemasterinfo.Date=DateTime.Parse(sdrreader[4].ToString());
             pdcreceivablemasterinfo.LedgerId=decimal.Parse(sdrreader[5].ToString());
             pdcreceivablemasterinfo.Amount=decimal.Parse(sdrreader[6].ToString());
             pdcreceivablemasterinfo.ChequeNo= sdrreader[7].ToString();
             pdcreceivablemasterinfo.ChequeDate=DateTime.Parse(sdrreader[8].ToString());
             pdcreceivablemasterinfo.Narration= sdrreader[9].ToString();
             pdcreceivablemasterinfo.UserId=decimal.Parse(sdrreader[10].ToString());
             pdcreceivablemasterinfo.BankId=decimal.Parse(sdrreader[11].ToString());
             pdcreceivablemasterinfo.VoucherTypeId=decimal.Parse(sdrreader[12].ToString());
             pdcreceivablemasterinfo.FinancialYearId=decimal.Parse(sdrreader[13].ToString());
             pdcreceivablemasterinfo.ExtraDate=DateTime.Parse(sdrreader[14].ToString());
             pdcreceivablemasterinfo.Extra1= sdrreader[15].ToString();
             pdcreceivablemasterinfo.Extra2= sdrreader[16].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {           sdrreader.Close(); 
         sqlcon.Close();
     }
     return pdcreceivablemasterinfo;
 }
Beispiel #5
0
        /// <summary>
        /// Ledger Posting Function, here saving the curresponding details into the ledger
        /// </summary>
        public void LedgerPostingAdd()
        {
            try
            {
                string strstatus = cmbStatus.Text.ToString();
                LedgerPostingInfo InfoPosting = new LedgerPostingInfo();
                LedgerPostingSP SpLedgerPosting = new LedgerPostingSP();
                AccountLedgerSP SpLedger = new AccountLedgerSP();
                LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
                PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP();
                PDCPayableMasterInfo infoPDCPayable = new PDCPayableMasterInfo();
                PDCPayableMasterSP spPDCPayable = new PDCPayableMasterSP();
                PDCReceivableMasterInfo infoPDCReceivable = new PDCReceivableMasterInfo();
                PDCReceivableMasterSP spPDCReceivable = new PDCReceivableMasterSP();
                strVoucherType = sppdcClearance.TypeOfVoucherReturnUnderVoucherName(cmbvouchertype.Text.ToString());
                if (strVoucherType == "PDC Payable")
                {
                    infoPDCPayable = spPDCPayable.PDCPayableMasterView(Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString()));
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.Date = Convert.ToDateTime(txtVoucherDate.Text.ToString());
                    infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId;
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text.ToString());
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    if (strstatus == "Cleared")
                    {

                        infoLedgerPosting.LedgerId = infoPDCPayable.BankId;
                        infoLedgerPosting.Debit = 0;
                        infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString());
                    }
                    else if (strstatus == "Bounced")
                    {
                        infoLedgerPosting.LedgerId = infoPDCPayable.LedgerId;
                        infoLedgerPosting.Debit = 0;
                        infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString());
                    }
                    SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                    infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId;
                    infoLedgerPosting.VoucherNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.Date = Convert.ToDateTime(txtVoucherDate.Text.ToString());
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text);
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.LedgerId = 6;
                    infoLedgerPosting.Debit = Convert.ToDecimal(txtAmount.Text.ToString());
                    infoLedgerPosting.Credit = 0;
                    SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                }
                else if (strVoucherType == "PDC Receivable")
                {
                    infoPDCReceivable = spPDCReceivable.PDCReceivableMasterView(Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString()));
                    infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId;
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.Date = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.LedgerId = 7;
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.Debit = 0;
                    infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString());
                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text.ToString());
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                    infoLedgerPosting.VoucherTypeId = decPDCclearanceVoucherTypeId;
                    infoLedgerPosting.Date = PublicVariables._dtCurrentDate;
                    if (strstatus == "Cleared")
                    {
                        infoLedgerPosting.LedgerId = infoPDCReceivable.BankId;
                    }
                    else if (strstatus == "Bounced")
                    {
                        infoLedgerPosting.LedgerId = infoPDCReceivable.LedgerId;
                    }
                    infoLedgerPosting.VoucherNo = strVoucherNo;
                    infoLedgerPosting.InvoiceNo = txtvoucherNo.Text.Trim();
                    infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                    infoLedgerPosting.Debit = Convert.ToDecimal(txtAmount.Text.ToString());
                    infoLedgerPosting.Credit = 0;
                    infoLedgerPosting.ChequeDate = Convert.ToDateTime(txtcheckdate.Text);
                    infoLedgerPosting.ChequeNo = txtcheckNo.Text.Trim();
                    infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate;
                    infoLedgerPosting.Extra1 = string.Empty;
                    infoLedgerPosting.Extra2 = string.Empty;
                    SpLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Save function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         DateValidation Objdatevalidation = new DateValidation();
         OtherDateValidationFunction ObjotherdateValidation = new OtherDateValidationFunction();
         Objdatevalidation.DateValidationFunction(txtVoucherDate);
         ObjotherdateValidation.DateValidationFunction(txtCheckDate, false);
         DataTable dtblMaster = new DataTable();
         PDCReceivableMasterSP spPdcReceivable = new PDCReceivableMasterSP();
         PDCReceivableMasterInfo InfopdcRecivable = new PDCReceivableMasterInfo();
         PartyBalanceSP spPartyBalance = new PartyBalanceSP();
         InfopdcRecivable.VoucherNo = strVoucherNo;
         InfopdcRecivable.InvoiceNo = txtVoucherNo.Text.Trim();
         InfopdcRecivable.Date = DateTime.Parse(txtVoucherDate.Text);
         InfopdcRecivable.LedgerId = Convert.ToDecimal(cmbAccountLedger.SelectedValue.ToString());
         InfopdcRecivable.Amount = decimal.Parse(txtAmount.Text);
         InfopdcRecivable.Narration = txtNarration.Text;
         if (txtcheckNo.Text != string.Empty)
             InfopdcRecivable.ChequeNo = txtcheckNo.Text;
         else
             InfopdcRecivable.ChequeNo = string.Empty;
         if (txtCheckDate.Text != string.Empty)
             InfopdcRecivable.ChequeDate = Convert.ToDateTime(txtCheckDate.Text);
         else
             InfopdcRecivable.ChequeDate = DateTime.Now;
         InfopdcRecivable.UserId = PublicVariables._decCurrentUserId;
         InfopdcRecivable.VoucherTypeId = decPDCReceivableVoucherTypeId;
         if (cmbBank.SelectedValue != null && cmbBank.SelectedValue.ToString() != string.Empty)
         {
             InfopdcRecivable.BankId = Convert.ToDecimal(cmbBank.SelectedValue.ToString());
         }
         else
             InfopdcRecivable.BankId = 0;
         InfopdcRecivable.ExtraDate = DateTime.Now;
         InfopdcRecivable.Extra1 = string.Empty;
         InfopdcRecivable.Extra2 = string.Empty;
         if (!isInEditMode)
         {
             decimal decIdentity = spPdcReceivable.PDCReceivableMasterAdd(InfopdcRecivable);
             LedgerPosting();
             PartyBalanceAddOrEdit();
             Messages.SavedMessage();
             if (cbxPrint.Checked)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decIdentity);
                 }
                 else
                 {
                     Print(decIdentity);
                 }
             }
             ClearFunction();
         }
         else
         {
             
             decimal decIdentity = decPDCReceivableEditId;
             InfopdcRecivable.PdcReceivableMasterId = decPDCReceivableEditId;
             spPdcReceivable.PDCReceivableMasterEdit(InfopdcRecivable);
             LedgerPostingSP spLedgerPosting = new LedgerPostingSP();
             spLedgerPosting.LedgerPostingDeleteByVoucherNoVoucherTypeIdAndLedgerId(strVoucherNo, decPDCReceivableVoucherTypeId, 12);
             spPartyBalance.PartyBalanceDeleteByVoucherTypeAndVoucherNo(decPDCReceivableVoucherTypeId, strVoucherNo);
             PartyBalanceAddOrEdit();
             LedgerPostingEdit(decPDCReceivableEditId);
             Messages.UpdatedMessage();
             if (cbxPrint.Checked)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decIdentity);
                 }
                 else
                 {
                     Print(decIdentity);
                 }
             }
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Fill function to updation
 /// </summary>
 public void FillFunction()
 {
     try
     {
         PDCReceivableMasterSP sppdcreceivable = new PDCReceivableMasterSP();
         PDCReceivableMasterInfo infopdcrecivable = new PDCReceivableMasterInfo();
         infopdcrecivable = sppdcreceivable.PDCReceivableMasterView(decPDCReceivableEditId);
         txtVoucherNo.ReadOnly = false;
         strVoucherNo = infopdcrecivable.VoucherNo;
         strInvoiceNo = infopdcrecivable.InvoiceNo;
         txtVoucherNo.Text = strInvoiceNo;
         decSufixprefixPdcReceivableID = infopdcrecivable.SuffixPrefixId;
         decPDCReceivableVoucherTypeId = infopdcrecivable.VoucherTypeId;
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPDCReceivableVoucherTypeId);
         if (isAutomatic)
         {
             txtVoucherNo.ReadOnly = true;
         }
         else
         {
             txtVoucherNo.ReadOnly = false;
             lblVoucherNoManualValidator.Visible = false;
         }
         if (infopdcrecivable.PdcReceivableMasterId != 0)
         {
             txtVoucherNo.Text = infopdcrecivable.InvoiceNo;
             dtpVoucherDate.Value = infopdcrecivable.Date;
             txtVoucherDate.Text = dtpVoucherDate.Value.ToString("dd-MMM-yyyy");
             txtNarration.Text = infopdcrecivable.Narration;
             cmbAccountLedger.SelectedValue = infopdcrecivable.LedgerId;
             txtAmount.Text = infopdcrecivable.Amount.ToString();
             if (infopdcrecivable.BankId != 0)
                 cmbBank.SelectedValue = infopdcrecivable.BankId;
             else
                 cmbBank.SelectedValue = string.Empty;
             txtcheckNo.Text = infopdcrecivable.ChequeNo;
             txtCheckDate.Text = infopdcrecivable.ChequeDate.ToString("dd-MMM-yyyy");
             btnSave.Text = "Update";
             PartyBalanceSP SpPartyBalance = new PartyBalanceSP();
             DataTable dtbl1 = new DataTable();
             dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decPDCReceivableVoucherTypeId, strVoucherNo, infopdcrecivable.Date);
             dtblPartyBalance = dtbl1;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PP24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }