예제 #1
0
        /// <summary>
        /// Function to insert values to PDCClearanceMaster Table
        /// </summary>
        /// <param name="pdcclearancemasterinfo"></param>
        /// <returns></returns>
        public decimal PDCClearanceMasterAdd(PDCClearanceMasterInfo pdcclearancemasterinfo)
        {
            decimal decIdentity = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PDCClearanceMasterAdd", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value = pdcclearancemasterinfo.VoucherNo;
                sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value = pdcclearancemasterinfo.InvoiceNo;
                sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value = pdcclearancemasterinfo.SuffixPrefixId;
                sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value = pdcclearancemasterinfo.Date;
                sprmparam       = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value = pdcclearancemasterinfo.LedgerId;
                sprmparam       = sccmd.Parameters.Add("@type", SqlDbType.VarChar);
                sprmparam.Value = pdcclearancemasterinfo.Type;
                sprmparam       = sccmd.Parameters.Add("@againstId", SqlDbType.Decimal);
                sprmparam.Value = pdcclearancemasterinfo.AgainstId;
                sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value = pdcclearancemasterinfo.VoucherTypeId;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = pdcclearancemasterinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@status", SqlDbType.VarChar);
                sprmparam.Value = pdcclearancemasterinfo.Status;
                sprmparam       = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
                sprmparam.Value = pdcclearancemasterinfo.UserId;
                sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value = pdcclearancemasterinfo.FinancialYearId;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = pdcclearancemasterinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = pdcclearancemasterinfo.Extra2;
                decIdentity     = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decIdentity);
        }
예제 #2
0
 /// <summary>
 /// Function to insert values to PDCClearanceMaster Table
 /// </summary>
 /// <param name="pdcclearancemasterinfo"></param>
 /// <returns></returns>
 public decimal PDCClearanceMasterAdd(PDCClearanceMasterInfo pdcclearancemasterinfo)
 {
     decimal decIdentity = 0;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PDCClearanceMasterAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = pdcclearancemasterinfo.VoucherNo;
         sprmparam = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = pdcclearancemasterinfo.InvoiceNo;
         sprmparam = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = pdcclearancemasterinfo.SuffixPrefixId;
         sprmparam = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = pdcclearancemasterinfo.Date;
         sprmparam = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = pdcclearancemasterinfo.LedgerId;
         sprmparam = sccmd.Parameters.Add("@type", SqlDbType.VarChar);
         sprmparam.Value = pdcclearancemasterinfo.Type;
         sprmparam = sccmd.Parameters.Add("@againstId", SqlDbType.Decimal);
         sprmparam.Value = pdcclearancemasterinfo.AgainstId;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = pdcclearancemasterinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = pdcclearancemasterinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@status", SqlDbType.VarChar);
         sprmparam.Value = pdcclearancemasterinfo.Status;
         sprmparam = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = pdcclearancemasterinfo.UserId;
         sprmparam = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = pdcclearancemasterinfo.FinancialYearId;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = pdcclearancemasterinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = pdcclearancemasterinfo.Extra2;
         decIdentity = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
     return decIdentity;
 }
예제 #3
0
        /// <summary>
        /// Function to get particular values from PDCClearanceMaster Table based on the parameter
        /// </summary>
        /// <param name="PDCClearanceMasterId"></param>
        /// <returns></returns>
        public PDCClearanceMasterInfo PDCClearanceMasterView(decimal PDCClearanceMasterId)
        {
            PDCClearanceMasterInfo pdcclearancemasterinfo = new PDCClearanceMasterInfo();
            SqlDataReader          sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PDCClearanceMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@PDCClearanceMasterId", SqlDbType.Decimal);
                sprmparam.Value = PDCClearanceMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    pdcclearancemasterinfo.PDCClearanceMasterId = decimal.Parse(sdrreader[0].ToString());
                    pdcclearancemasterinfo.VoucherNo            = sdrreader[1].ToString();
                    pdcclearancemasterinfo.InvoiceNo            = sdrreader[2].ToString();
                    pdcclearancemasterinfo.SuffixPrefixId       = decimal.Parse(sdrreader[3].ToString());
                    pdcclearancemasterinfo.Date            = DateTime.Parse(sdrreader[4].ToString());
                    pdcclearancemasterinfo.LedgerId        = decimal.Parse(sdrreader[5].ToString());
                    pdcclearancemasterinfo.Type            = sdrreader[6].ToString();
                    pdcclearancemasterinfo.AgainstId       = decimal.Parse(sdrreader[7].ToString());
                    pdcclearancemasterinfo.VoucherTypeId   = decimal.Parse(sdrreader[8].ToString());
                    pdcclearancemasterinfo.Narration       = sdrreader[9].ToString();
                    pdcclearancemasterinfo.Status          = sdrreader[10].ToString();
                    pdcclearancemasterinfo.UserId          = decimal.Parse(sdrreader[11].ToString());
                    pdcclearancemasterinfo.FinancialYearId = decimal.Parse(sdrreader[12].ToString());
                    pdcclearancemasterinfo.ExtraDate       = DateTime.Parse(sdrreader[13].ToString());
                    pdcclearancemasterinfo.Extra1          = sdrreader[14].ToString();
                    pdcclearancemasterinfo.Extra2          = sdrreader[15].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(pdcclearancemasterinfo);
        }
예제 #4
0
 /// <summary>
 /// Function to get particular values from PDCClearanceMaster Table based on the parameter
 /// </summary>
 /// <param name="PDCClearanceMasterId"></param>
 /// <returns></returns>
 public PDCClearanceMasterInfo PDCClearanceMasterView(decimal PDCClearanceMasterId)
 {
     PDCClearanceMasterInfo pdcclearancemasterinfo = new PDCClearanceMasterInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PDCClearanceMasterView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@PDCClearanceMasterId", SqlDbType.Decimal);
         sprmparam.Value = PDCClearanceMasterId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             pdcclearancemasterinfo.PDCClearanceMasterId = decimal.Parse(sdrreader[0].ToString());
             pdcclearancemasterinfo.VoucherNo = sdrreader[1].ToString();
             pdcclearancemasterinfo.InvoiceNo = sdrreader[2].ToString();
             pdcclearancemasterinfo.SuffixPrefixId = decimal.Parse(sdrreader[3].ToString());
             pdcclearancemasterinfo.Date = DateTime.Parse(sdrreader[4].ToString());
             pdcclearancemasterinfo.LedgerId = decimal.Parse(sdrreader[5].ToString());
             pdcclearancemasterinfo.Type = sdrreader[6].ToString();
             pdcclearancemasterinfo.AgainstId = decimal.Parse(sdrreader[7].ToString());
             pdcclearancemasterinfo.VoucherTypeId = decimal.Parse(sdrreader[8].ToString());
             pdcclearancemasterinfo.Narration = sdrreader[9].ToString();
             pdcclearancemasterinfo.Status = sdrreader[10].ToString();
             pdcclearancemasterinfo.UserId = decimal.Parse(sdrreader[11].ToString());
             pdcclearancemasterinfo.FinancialYearId = decimal.Parse(sdrreader[12].ToString());
             pdcclearancemasterinfo.ExtraDate = DateTime.Parse(sdrreader[13].ToString());
             pdcclearancemasterinfo.Extra1 = sdrreader[14].ToString();
             pdcclearancemasterinfo.Extra2 = sdrreader[15].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return pdcclearancemasterinfo;
 }
예제 #5
0
 /// <summary>
 /// Its the fill function to update or delete
 /// </summary>
 public void FillFunction()
 {
     try
     {
         PDCClearanceMasterInfo infoPDCClearance = new PDCClearanceMasterInfo();
         PDCClearanceMasterSP Sppdcclerance = new PDCClearanceMasterSP();
         infoPDCClearance = Sppdcclerance.PDCClearanceMasterView(decPDCClearanceEditId);
         VoucherTypeComboFill();
         strVoucherNo = infoPDCClearance.VoucherNo;
         strInvoiceNo = infoPDCClearance.InvoiceNo;
         txtvoucherNo.Text = strInvoiceNo;
         decSufixprefixPdcpayableID = infoPDCClearance.SuffixPrefixId;
         decPDCclearanceVoucherTypeId = infoPDCClearance.VoucherTypeId;
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPDCclearanceVoucherTypeId);
         if (isAutomatic)
         {
             txtvoucherNo.ReadOnly = true;
         }
         else
         {
             txtvoucherNo.ReadOnly = false;
         }
         if (infoPDCClearance.PDCClearanceMasterId != 0)
         {
             PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP();
             txtvoucherNo.Text = infoPDCClearance.VoucherNo;
             dtpVoucherDate.Value = infoPDCClearance.Date;
             txtVoucherDate.Text = dtpVoucherDate.Value.ToString("dd-MMM-yyyy");
             txtNarration.Text = infoPDCClearance.Narration;
             cmbvouchertype.Text = infoPDCClearance.Type;
             InvoiceNumberCombofill(cmbvouchertype.Text.ToString(), decMasterIdEdit);
             cmbStatus.Text = infoPDCClearance.Status;
             cmbInvoiceNo.SelectedValue = decMasterIdEdit;
             btnSave.Text = "Update";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #6
0
 /// <summary>
 /// Save Function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         DateValidation Objdatevalidation = new DateValidation();
         OtherDateValidationFunction ObjotherdateValidation = new OtherDateValidationFunction();
         Objdatevalidation.DateValidationFunction(txtVoucherDate);
         AccountLedgerSP SpAccountLedger = new AccountLedgerSP();
         SettingsSP spSettings = new SettingsSP();
         txtVoucherDate.Text = txtVoucherDate.Text.Trim();
         cmbvouchertype.Text = cmbvouchertype.Text.Trim();
         txtAmount.Text = txtAmount.Text.Trim();
         txtBank.Text = txtBank.Text.Trim();
         txtcheckdate.Text = txtcheckdate.Text.Trim();
         txtcheckNo.Text = txtcheckNo.Text.Trim();
         txtNarration.Text = txtNarration.Text.Trim();
         DataTable dtblMaster = new DataTable();
         PDCClearanceMasterSP sppdcClearance = new PDCClearanceMasterSP();
         PDCClearanceMasterInfo infoPdcclearance = new PDCClearanceMasterInfo();
         infoPdcclearance.SuffixPrefixId = decSufixprefixPdcpayableID;
         infoPdcclearance.FinancialYearId = Convert.ToDecimal(PublicVariables._decCurrentFinancialYearId.ToString());
         infoPdcclearance.VoucherNo = strVoucherNo;
         infoPdcclearance.InvoiceNo = txtvoucherNo.Text;
         if (txtVoucherDate.Text != string.Empty)
             infoPdcclearance.Date = Convert.ToDateTime(txtVoucherDate.Text);
         else
             infoPdcclearance.Date = DateTime.Now;
         infoPdcclearance.LedgerId = decimal.Parse(strledgerId.ToString());
         infoPdcclearance.AgainstId = decmasterId;
         infoPdcclearance.UserId = PublicVariables._decCurrentUserId;
         infoPdcclearance.VoucherTypeId = decPDCclearanceVoucherTypeId;
         infoPdcclearance.Status = cmbStatus.Text.ToString();
         infoPdcclearance.Type = cmbvouchertype.Text.ToString();
         infoPdcclearance.ExtraDate = DateTime.Now;
         infoPdcclearance.Narration = txtNarration.Text;
         infoPdcclearance.Extra1 = string.Empty;
         infoPdcclearance.Extra2 = string.Empty;
         if (!isInEditMode)
         {
             decimal decIdentity = sppdcClearance.PDCClearanceMasterAdd(infoPdcclearance);
             LedgerPostingAdd();
             if (cmbStatus.Text.ToString() == "Bounced")
             {
                 if (SpAccountLedger.AccountGroupIdCheck(txtAccountLedger.Text.ToString()))
                 {
                     PartyBalanceAddOrEdit();
                 }
             }
             Messages.SavedMessage();
             if (cbxPrint.Checked)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decIdentity);
                 }
                 else
                 {
                     Print(decIdentity);
                 }
             }
             ClearFunction();
         }
         else
         {
             decimal decIdentity = decPDCClearanceEditId;
             infoPdcclearance.PDCClearanceMasterId = decPDCClearanceEditId;
             sppdcClearance.PDCClearanceMasterEdit(infoPdcclearance);
             SpAccountLedger.LedgerPostingDeleteByVoucherTypeAndVoucherNo(strVoucherNo, decPDCclearanceVoucherTypeId);
             LedgerPostingAdd();
             SpAccountLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(strVoucherNo, decPDCclearanceVoucherTypeId);
             if (cmbStatus.Text.ToString() == "Bounced")
             {
                 if (SpAccountLedger.AccountGroupIdCheck(txtAccountLedger.Text.ToString()))
                 {
                     PartyBalanceAddOrEdit();
                 }
             }
             Messages.UpdatedMessage();
             if (cbxPrint.Checked)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decIdentity);
                 }
                 else
                 {
                     Print(decIdentity);
                 }
             }
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }