Beispiel #1
0
 /// <summary>
 /// Function to Update values in VoucherTypeTax Table
 /// </summary>
 /// <param name="vouchertypetaxinfo"></param>
 public void VoucherTypeTaxEdit(VoucherTypeTaxInfo vouchertypetaxinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("VoucherTypeTaxEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@voucherTypeTaxId", SqlDbType.Decimal);
         sprmparam.Value = vouchertypetaxinfo.VoucherTypeTaxId;
         sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = vouchertypetaxinfo.VoucherTypeId;
         sprmparam       = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = vouchertypetaxinfo.TaxId;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = vouchertypetaxinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = vouchertypetaxinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = vouchertypetaxinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to Update values in VoucherTypeTax Table
 /// </summary>
 /// <param name="vouchertypetaxinfo"></param>
 public void VoucherTypeTaxEdit(VoucherTypeTaxInfo vouchertypetaxinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("VoucherTypeTaxEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherTypeTaxId", SqlDbType.Decimal);
         sprmparam.Value = vouchertypetaxinfo.VoucherTypeTaxId;
         sprmparam = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = vouchertypetaxinfo.VoucherTypeId;
         sprmparam = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = vouchertypetaxinfo.TaxId;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = vouchertypetaxinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = vouchertypetaxinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = vouchertypetaxinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Beispiel #3
0
        /// <summary>
        /// Function to get particular values from VoucherTypeTax table based on the parameter
        /// </summary>
        /// <param name="voucherTypeTaxId"></param>
        /// <returns></returns>
        public VoucherTypeTaxInfo VoucherTypeTaxView(decimal voucherTypeTaxId)
        {
            VoucherTypeTaxInfo vouchertypetaxinfo = new VoucherTypeTaxInfo();
            SqlDataReader      sdrreader          = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("VoucherTypeTaxView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@voucherTypeTaxId", SqlDbType.Decimal);
                sprmparam.Value = voucherTypeTaxId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    vouchertypetaxinfo.VoucherTypeTaxId = decimal.Parse(sdrreader[0].ToString());
                    vouchertypetaxinfo.VoucherTypeId    = decimal.Parse(sdrreader[1].ToString());
                    vouchertypetaxinfo.TaxId            = decimal.Parse(sdrreader[2].ToString());
                    vouchertypetaxinfo.ExtraDate        = DateTime.Parse(sdrreader[3].ToString());
                    vouchertypetaxinfo.Extra1           = sdrreader[4].ToString();
                    vouchertypetaxinfo.Extra2           = sdrreader[5].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(vouchertypetaxinfo);
        }
Beispiel #4
0
        /// <summary>
        /// update function
        /// </summary>
        public void EditFunction()
        {
            try
            {
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                VoucherTypeTaxSP spVoucherTypeTax = new VoucherTypeTaxSP();
                VoucherTypeTaxInfo infoVoucherTypeTax = new VoucherTypeTaxInfo();

                if (spVoucherType.VoucherTypeCheckExistence(txtVoucherName.Text.Trim(), decVoucherTypeId) == false)
                {
                    if (spVoucherType.VoucherTypeChechReferences(decVoucherTypeId) == false)
                    {
                        infoVoucherType.VoucherTypeId = decVoucherTypeId;
                        infoVoucherType.VoucherTypeName = txtVoucherName.Text.Trim();
                        infoVoucherType.TypeOfVoucher = cmbTypeOfVoucher.Text;
                        infoVoucherType.MethodOfVoucherNumbering = cmbMethodOfvoucherNumbering.Text;
                        infoVoucherType.Narration = txtNarration.Text.Trim();
                        if (cbxActive.Checked)
                        {
                            IsActive = true;
                        }
                        infoVoucherType.IsActive = IsActive;
                        int inRowCount = dgvApplicableTaxes.RowCount;
                        for (int i = 0; i <= inRowCount - 1; i++)
                        {

                            if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null && dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                            {
                                isTax = bool.Parse(dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString());

                            }
                        }
                        infoVoucherType.IsTaxApplicable = isTax;
                        infoVoucherType.IsDefault = false;
                        infoVoucherType.Extra1 = string.Empty;
                        infoVoucherType.Extra2 = string.Empty;
                        infoVoucherType.MasterId = int.Parse(cmbDotMatrix.SelectedValue.ToString());
                        infoVoucherType.Declarartion = txtDeclaration.Text;
                        infoVoucherType.Heading1 = txtHeading1.Text;
                        infoVoucherType.Heading2 = txtHeading2.Text;
                        infoVoucherType.Heading3 = txtHeading3.Text;
                        infoVoucherType.Heading4 = txtHeading4.Text;
                        if (spVoucherType.CheckForDefaultVoucherType(decVoucherTypeId) == false)
                        {

                            spVoucherType.VoucherTypeEdit(infoVoucherType);
                        }
                        else
                        {

                            spVoucherType.VoucherTypeEditForDefaultVouchers(infoVoucherType);

                        }
                        //------------------------------------- Delete And Add Tax details From VoucherTypeTax Using VoucherTypeId-------------------------------//
                        spVoucherTypeTax.DeleteVoucherTypeTaxUsingVoucherTypeId(decVoucherTypeId);
                        if (isTax)
                        {
                            for (int i = 0; i <= inRowCount - 1; i++)
                            {
                                if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null && dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                                {
                                    infoVoucherTypeTax.VoucherTypeId = decVoucherTypeId;
                                    infoVoucherTypeTax.TaxId = Convert.ToDecimal(dgvApplicableTaxes.Rows[i].Cells["dgvtxtTaxId"].Value.ToString());
                                    infoVoucherTypeTax.Extra1 = string.Empty;
                                    infoVoucherTypeTax.Extra2 = string.Empty;

                                    spVoucherTypeTax.VoucherTypeTaxAdd(infoVoucherTypeTax);
                                }
                            }
                        }

                        //-----------------------------------------------------------Deleted And Added--------------------------------------------------------//
                        Messages.UpdatedMessage();
                        Clear();
                    }
                    else
                    {
                        Messages.InformationMessage("You can't update,voucher already in use");
                    }
                }
                else
                {
                    Messages.InformationMessage("Voucher name already exists");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("VT04:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #5
0
        /// <summary>
        /// save function
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                VoucherTypeSP spVoucherType = new VoucherTypeSP();
                VoucherTypeInfo infoVoucherType = new VoucherTypeInfo();
                if (spVoucherType.VoucherTypeCheckExistence(txtVoucherName.Text.Trim(), 0) == false)
                {
                    infoVoucherType.VoucherTypeName = txtVoucherName.Text.Trim();
                    infoVoucherType.TypeOfVoucher = cmbTypeOfVoucher.Text;
                    infoVoucherType.MethodOfVoucherNumbering = cmbMethodOfvoucherNumbering.Text;
                    int inRowCount = dgvApplicableTaxes.RowCount;
                    for (int i = 0; i <= inRowCount - 1; i++)
                    {
                        if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null)
                        {

                            if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                            {
                                isTax = bool.Parse(dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString());
                            }
                        }
                    }
                    infoVoucherType.IsTaxApplicable = isTax;
                    if (cbxActive.Checked)
                    {
                        IsActive = true;
                    }
                    infoVoucherType.IsActive = IsActive;
                    infoVoucherType.IsDefault = false;
                    infoVoucherType.Narration = txtNarration.Text.Trim();
                    infoVoucherType.Extra1 = string.Empty;
                    infoVoucherType.Extra2 = string.Empty;
                    infoVoucherType.MasterId = Convert.ToInt32(cmbDotMatrix.SelectedValue);
                    infoVoucherType.Declarartion = txtDeclaration.Text;
                    infoVoucherType.Heading1 = txtHeading1.Text;
                    infoVoucherType.Heading2 = txtHeading2.Text;
                    infoVoucherType.Heading3 = txtHeading3.Text;
                    infoVoucherType.Heading4 = txtHeading4.Text;

                    decVoucherTypeId = spVoucherType.VoucherTypeAddWithIdentity(infoVoucherType);
                    if (isTax)
                    {
                        for (int i = 0; i <= inRowCount - 1; i++)
                        {
                            if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value != null)
                            {
                                if (dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value.ToString() != "False")
                                {
                                    VoucherTypeTaxSP spVoucherTypeTax = new VoucherTypeTaxSP();
                                    VoucherTypeTaxInfo infoVoucherTypeTax = new VoucherTypeTaxInfo();
                                    infoVoucherTypeTax.VoucherTypeId = decVoucherTypeId;
                                    infoVoucherTypeTax.TaxId = Convert.ToDecimal(dgvApplicableTaxes.Rows[i].Cells["dgvtxtTaxId"].Value.ToString());
                                    infoVoucherTypeTax.Extra1 = string.Empty;
                                    infoVoucherTypeTax.Extra2 = string.Empty;

                                    spVoucherTypeTax.VoucherTypeTaxAdd(infoVoucherTypeTax);
                                }
                            }

                        }

                    }
                    Messages.SavedMessage();
                    Clear();
                }
                else
                {
                    Messages.InformationMessage("Voucher name already exists");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("VT03:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 /// <summary>
 /// Function to get particular values from VoucherTypeTax table based on the parameter
 /// </summary>
 /// <param name="voucherTypeTaxId"></param>
 /// <returns></returns>
 public VoucherTypeTaxInfo VoucherTypeTaxView(decimal voucherTypeTaxId)
 {
     VoucherTypeTaxInfo vouchertypetaxinfo = new VoucherTypeTaxInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("VoucherTypeTaxView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@voucherTypeTaxId", SqlDbType.Decimal);
         sprmparam.Value = voucherTypeTaxId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             vouchertypetaxinfo.VoucherTypeTaxId = decimal.Parse(sdrreader[0].ToString());
             vouchertypetaxinfo.VoucherTypeId = decimal.Parse(sdrreader[1].ToString());
             vouchertypetaxinfo.TaxId = decimal.Parse(sdrreader[2].ToString());
             vouchertypetaxinfo.ExtraDate = DateTime.Parse(sdrreader[3].ToString());
             vouchertypetaxinfo.Extra1 = sdrreader[4].ToString();
             vouchertypetaxinfo.Extra2 = sdrreader[5].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return vouchertypetaxinfo;
 }