Ejemplo n.º 1
0
 /// <summary>
 /// Function to Update values in TaxDetails Table
 /// </summary>
 /// <param name="taxdetailsinfo"></param>
 public void TaxDetailsEdit(TaxDetailsInfo taxdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("TaxDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@taxdetailsId", SqlDbType.Decimal);
         sprmparam.Value = taxdetailsinfo.TaxdetailsId;
         sprmparam = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = taxdetailsinfo.TaxId;
         sprmparam = sccmd.Parameters.Add("@selectedtaxId", SqlDbType.Decimal);
         sprmparam.Value = taxdetailsinfo.SelectedtaxId;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = taxdetailsinfo.ExtraDate;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = taxdetailsinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = taxdetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Function to Update values in TaxDetails Table
 /// </summary>
 /// <param name="taxdetailsinfo"></param>
 public void TaxDetailsEdit(TaxDetailsInfo taxdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("TaxDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@taxdetailsId", SqlDbType.Decimal);
         sprmparam.Value = taxdetailsinfo.TaxdetailsId;
         sprmparam       = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal);
         sprmparam.Value = taxdetailsinfo.TaxId;
         sprmparam       = sccmd.Parameters.Add("@selectedtaxId", SqlDbType.Decimal);
         sprmparam.Value = taxdetailsinfo.SelectedtaxId;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = taxdetailsinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = taxdetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = taxdetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Function to get particular values from TaxDetails Table based on the parameter
        /// </summary>
        /// <param name="taxdetailsId"></param>
        /// <returns></returns>
        public TaxDetailsInfo TaxDetailsView(decimal taxdetailsId)
        {
            TaxDetailsInfo taxdetailsinfo = new TaxDetailsInfo();
            SqlDataReader  sdrreader      = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("TaxDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@taxdetailsId", SqlDbType.Decimal);
                sprmparam.Value = taxdetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    taxdetailsinfo.TaxdetailsId  = decimal.Parse(sdrreader[0].ToString());
                    taxdetailsinfo.TaxId         = decimal.Parse(sdrreader[1].ToString());
                    taxdetailsinfo.SelectedtaxId = decimal.Parse(sdrreader[2].ToString());
                    taxdetailsinfo.ExtraDate     = DateTime.Parse(sdrreader[3].ToString());
                    taxdetailsinfo.Extra1        = sdrreader[4].ToString();
                    taxdetailsinfo.Extra2        = sdrreader[5].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(taxdetailsinfo);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Function to get particular values from TaxDetails Table based on the parameter
 /// </summary>
 /// <param name="taxdetailsId"></param>
 /// <returns></returns>
 public TaxDetailsInfo TaxDetailsView(decimal taxdetailsId)
 {
     TaxDetailsInfo taxdetailsinfo = new TaxDetailsInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("TaxDetailsView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@taxdetailsId", SqlDbType.Decimal);
         sprmparam.Value = taxdetailsId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             taxdetailsinfo.TaxdetailsId = decimal.Parse(sdrreader[0].ToString());
             taxdetailsinfo.TaxId = decimal.Parse(sdrreader[1].ToString());
             taxdetailsinfo.SelectedtaxId = decimal.Parse(sdrreader[2].ToString());
             taxdetailsinfo.ExtraDate = DateTime.Parse(sdrreader[3].ToString());
             taxdetailsinfo.Extra1 = sdrreader[4].ToString();
             taxdetailsinfo.Extra2 = sdrreader[5].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return taxdetailsinfo;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// delete function
 /// </summary>
 public void Delete()
 {
     try
     {
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage())
             {
                 TaxInfo infoTax = new TaxInfo();
                 TaxSP spTax = new TaxSP();
                 TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
                 TaxDetailsSP spTaxDetails = new TaxDetailsSP();
                 AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                 bool isExist = spTax.TaxReferenceCheck(decTaxId);
                 if (!isExist)
                 {
                     if ((spTax.TaxReferenceDelete(decTaxId,decLedgerId)) == -1)
                     {
                         Messages.ReferenceExistsMessage();
                     }
                     else
                     {
                         spTaxDetails.TaxDetailsDeleteWithTaxId(decTaxId);
                         spAccountLedger.AccountLedgerDelete(decLedgerId);
                         Messages.DeletedMessage();
                         TaxSearchGridFill();
                         TaxSelectionGridFill();
                         Clear();
                         SearchClear();
                     }
                 }
                 else
                 {
                     Messages.ReferenceExistsMessage();
                 }
             }
         }
         else
         {
             TaxInfo infoTax = new TaxInfo();
             TaxSP spTax = new TaxSP();
             TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
             TaxDetailsSP spTaxDetails = new TaxDetailsSP();
             bool isExist = spTax.TaxReferenceCheck(decTaxId);
             if (!isExist)
             {
                 if ((spTax.TaxReferenceDelete(decTaxId,decLedgerId)) == -1)
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     spTaxDetails.TaxDetailsDeleteWithTaxId(decTaxId);
                     Messages.DeletedMessage();
                     TaxSearchGridFill();
                     TaxSelectionGridFill();
                     Clear();
                     SearchClear();
                 }
             }
             else
             {
                 Messages.ReferenceExistsMessage();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("TC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// fill the curresponding details for update
        /// </summary>
        public void TaxSelectionFillForUpdate()
        {
            try
            {
                int inRowCount = dgvTaxSelection.RowCount;
                for (int i = 0; i < inRowCount; i++)
                {
                    dgvTaxSelection.Rows[i].Cells["dgvcbxSelect"].Value = false;
                }
                decTaxId = Convert.ToDecimal(dgvTaxSearch.CurrentRow.Cells["dgvtxtTaxIdSearch"].Value.ToString());
                TaxInfo infoTax = new TaxInfo();
                TaxSP spTax = new TaxSP();
                TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
                TaxDetailsSP spTaxDetails = new TaxDetailsSP();
                infoTax = spTax.TaxView(decTaxId);
                txtTaxName.Text = infoTax.TaxName;
                txtRate.Text = infoTax.Rate.ToString();
                cmbApplicableFor.Text = infoTax.ApplicableOn;
                cmbCalculationMode.Text = infoTax.CalculatingMode;
                txtNarration.Text = infoTax.Narration;
                if (infoTax.IsActive.ToString() == "True")
                {
                    cbxActive.Checked = true;
                }
                else
                {
                    cbxActive.Checked = false;
                }
                strTaxName = infoTax.TaxName;
                decTaxIdForEdit = infoTax.TaxId;
                btnSave.Text = "Update";
                btnDelete.Enabled = true;
                DataTable dtbl = new DataTable();
                dtbl = spTax.TaxIdForTaxSelectionUpdate(decTaxId);
                foreach (DataRow dr in dtbl.Rows)
                {
                    string strTaxId = dr["selectedtaxId"].ToString();
                    for (int i = 0; i < inRowCount; i++)
                    {
                        if (dgvTaxSelection.Rows[i].Cells["dgvtxtTaxId"].Value.ToString() == strTaxId)
                        {
                            dgvTaxSelection.Rows[i].Cells["dgvcbxSelect"].Value = true;
                        }
                    }
                }

                AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                decLedgerId = spAccountLedger.AccountLedgerIdGetByName(txtTaxName.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("TC10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// update function
 /// </summary>
 public void EditFunction()
 {
     try
     {
         TaxInfo infoTax = new TaxInfo();
         TaxSP spTax = new TaxSP();
         TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
         TaxDetailsSP spTaxDetails = new TaxDetailsSP();
         infoTax.TaxName = txtTaxName.Text.Trim();
         infoTax.Rate = Convert.ToDecimal(txtRate.Text.ToString());
         infoTax.ApplicableOn = cmbApplicableFor.SelectedItem.ToString();
         if (cmbCalculationMode.Enabled != true)
         {
             infoTax.CalculatingMode = string.Empty;
         }
         else
         {
             infoTax.CalculatingMode = cmbCalculationMode.SelectedItem.ToString();
         }
         infoTax.Narration = txtNarration.Text.Trim();
         if (cbxActive.Checked)
         {
             infoTax.IsActive = true;
         }
         else
         {
             infoTax.IsActive = false;
         }
         infoTax.Extra1 = string.Empty;
         infoTax.Extra2 = string.Empty;
         if (txtTaxName.Text.ToString() != strTaxName)
         {
             if (spTax.TaxCheckExistence(decTaxIdForEdit, txtTaxName.Text.Trim()) == false)
             {
                 infoTax.TaxId = decTaxId;
                 spTax.TaxEdit(infoTax);
                 //-- Delete And Add Tax details --//
                 spTaxDetails.TaxDetailsDeleteWithTaxId(decTaxId);
                 if (dgvTaxSelection.RowCount > 0)
                 {
                     bool isOk = false;
                     foreach (DataGridViewRow dgvRow in dgvTaxSelection.Rows)
                     {
                         isOk = Convert.ToBoolean(dgvRow.Cells["dgvcbxSelect"].Value);
                         if (isOk)
                         {
                             infoTaxDetails.TaxId = decTaxId;
                             infoTaxDetails.SelectedtaxId = Convert.ToDecimal(dgvRow.Cells["dgvtxtTaxId"].Value.ToString());//dgvRow.Cells[0].Value.ToString();
                             infoTaxDetails.ExtraDate = DateTime.Now;
                             infoTaxDetails.Extra1 = string.Empty;
                             infoTaxDetails.Extra2 = string.Empty;
                             spTaxDetails.TaxDetailsAddWithoutId(infoTaxDetails);
                         }
                     }
                 }
                 LedgerEdit();
                 Messages.UpdatedMessage();
                 Clear();
             }
             else
             {
                 Messages.InformationMessage(" Tax or ledger already exist");
                 txtTaxName.Focus();
             }
         }
         else
         {
             infoTax.TaxId = decTaxId;
             spTax.TaxEdit(infoTax);
             spTaxDetails.TaxDetailsDeleteWithTaxId(decTaxId);
             if (dgvTaxSelection.RowCount > 0)
             {
                 bool isOk = false;
                 foreach (DataGridViewRow dgvRow in dgvTaxSelection.Rows)
                 {
                     isOk = Convert.ToBoolean(dgvRow.Cells["dgvcbxSelect"].Value);
                     if (isOk)
                     {
                         infoTaxDetails.TaxId = decTaxId;
                         infoTaxDetails.SelectedtaxId = Convert.ToDecimal(dgvRow.Cells["dgvtxtTaxId"].Value.ToString());//dgvRow.Cells[0].Value.ToString();
                         infoTaxDetails.ExtraDate = DateTime.Now;
                         infoTaxDetails.Extra1 = string.Empty;
                         infoTaxDetails.Extra2 = string.Empty;
                         spTaxDetails.TaxDetailsAddWithoutId(infoTaxDetails);
                     }
                 }
             }
             LedgerEdit();
             Messages.UpdatedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("TC5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// save function
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         TaxInfo infoTax = new TaxInfo();
         TaxSP spTax = new TaxSP();
         TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
         TaxDetailsSP spTaxDetails = new TaxDetailsSP();
         infoTax.TaxName = txtTaxName.Text.Trim();
         infoTax.Rate = Convert.ToDecimal(txtRate.Text.ToString());
         infoTax.ApplicableOn = cmbApplicableFor.SelectedItem.ToString();
         if (cmbCalculationMode.Enabled != true)
         {
             infoTax.CalculatingMode = string.Empty;
         }
         else
         {
             infoTax.CalculatingMode = cmbCalculationMode.SelectedItem.ToString();
         }
         infoTax.Narration = txtNarration.Text.Trim();
         if (cbxActive.Checked)
         {
             infoTax.IsActive = true;
         }
         else
         {
             infoTax.IsActive = false;
         }
         infoTax.Extra1 = string.Empty;
         infoTax.Extra2 = string.Empty;
         if (spTax.TaxCheckExistence(0, txtTaxName.Text.Trim()) == false)
         {
             decTaxId = spTax.TaxAddWithIdentity(infoTax);
             decIdForOtherForms = decTaxId;
             if (dgvTaxSelection.RowCount > 0)
             {
                 bool isOk = false;
                 foreach (DataGridViewRow dgvRow in dgvTaxSelection.Rows)
                 {
                     isOk = Convert.ToBoolean(dgvRow.Cells["dgvcbxSelect"].Value);
                     if (isOk)
                     {
                         infoTaxDetails.TaxId = decTaxId;
                         infoTaxDetails.SelectedtaxId = Convert.ToDecimal(dgvRow.Cells["dgvtxtTaxId"].Value.ToString());//dgvRow.Cells[0].Value.ToString();
                         infoTaxDetails.ExtraDate = DateTime.Now;
                         infoTaxDetails.Extra1 = string.Empty;
                         infoTaxDetails.Extra2 = string.Empty;
                         spTaxDetails.TaxDetailsAddWithoutId(infoTaxDetails);
                     }
                 }
             }
             CreateLedger();
             Messages.SavedMessage();
             Clear();
             SearchClear();
         }
         else
         {
             Messages.InformationMessage(" Tax or ledger already exist");
             txtTaxName.Focus();
         }
         if (frmProductCreationObj != null)
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("TC4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }