Ejemplo n.º 1
0
 /// <summary>
 /// Function to use the cess and tax amount calculation
 /// </summary>
 public void CessTaxamountCalculation()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtbl = new DataTable();
         decTotalCessTaxamount = 0;
         decimal decCessamount = 0;
         foreach (DataGridViewRow drowDetails in dgvSalesReturn2.Rows)
         {
             if (drowDetails.Cells["dgvTextTaxId"].Value != null)
             {
                 dtbl = spTax.TaxIdCorrespondingToCessTaxId(Convert.ToDecimal(drowDetails.Cells["dgvTextTaxId"].Value.ToString()));
                 foreach (DataRow item in dtbl.Rows)
                 {
                     if (item["selectedTaxId"].ToString() != String.Empty)
                     {
                         foreach (DataGridViewRow drowDetails1 in dgvSalesReturn2.Rows)
                         {
                             if (drowDetails1.Cells["dgvTextTaxId"].Value != null)
                             {
                                 if (drowDetails1.Cells["dgvTextTaxId"].Value.ToString() == item["selectedTaxId"].ToString())
                                 {
                                     drowDetails.Cells["dgvTextAmount"].Value = Math.Round((Convert.ToDecimal(drowDetails1.Cells["dgvTextAmount"].Value.ToString()) * Convert.ToDecimal(drowDetails.Cells["dgvRate"].Value.ToString())) / 100, PublicVariables._inNoOfDecimalPlaces);
                                     decCessamount = Convert.ToDecimal(drowDetails.Cells["dgvTextAmount"].Value.ToString());
                                     decTotalCessTaxamount = Math.Round(decTotalCessTaxamount + decCessamount, PublicVariables._inNoOfDecimalPlaces);
                                     drowDetails.Cells["dgvTextAmount"].Value = decTotalCessTaxamount;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SR66:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }