Пример #1
0
 /// <summary>
 /// To fill the tax combobox
 /// </summary>
 public void TaxComboFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         TaxSP spTax = new TaxSP();
         dtbl = spTax.TaxViewAll();
         DataRow dr = dtbl.NewRow();
         dr["taxName"] = "All";
         dr["taxId"] = 0;
         dtbl.Rows.InsertAt(dr, 0);
         cmbTax.DataSource = dtbl;
         cmbTax.DisplayMember = "taxName";
         cmbTax.ValueMember = "taxId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("TR:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Tax combobox
 /// </summary>
 public void TaxComboFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         TaxSP spTax = new TaxSP();
         dtbl = spTax.TaxViewAllForProduct();
         cmbTax.DataSource = dtbl;
         cmbTax.DisplayMember = "taxName";
         cmbTax.ValueMember = "taxId";
         if (TaxStatus())
         {
             cmbTax.Enabled = true;
         }
         else
         {
             cmbTax.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MPC2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #3
0
 /// <summary>
 /// Function to fill the Tax grid
 /// </summary>
 public void taxGridFill()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtblTax = new DataTable();
         SalesBillTaxSP spSalesbillTax = new SalesBillTaxSP();
         dtblTax = spTax.TaxViewAllByVoucherTypeId(DecPOSVoucherTypeId);
         dgvPOSTax.DataSource = dtblTax;
         this.dgvPOSTax.Columns["dgvtxtTaxAmt"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight;
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS:20" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #4
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);
            }
        }
Пример #5
0
 /// <summary>
 /// tax Selection grid fill function
 /// </summary>
 public void TaxSelectionGridFill()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtblTax = new DataTable();
         dtblTax = spTax.TaxViewAllForTaxSelection();
         dgvTaxSelection.DataSource = dtblTax;
     }
     catch (Exception ex)
     {
         MessageBox.Show("TC8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #6
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);
     }
 }
Пример #7
0
 /// <summary>
 /// Tax gridfill function
 /// </summary>
 public void taxGridFill()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtblTax = new DataTable();
         dtblTax = spTax.TaxViewAllByVoucherTypeId(DecSalesInvoiceVoucherTypeId);
         dgvSalesInvoiceTax.DataSource = dtblTax;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #8
0
 /// <summary>
 ///  Grid row total amount calculation( Including Tax)
 /// </summary>
 /// <param name="inIndexOfRow"></param>
 public void taxAndGridTotalAmountCalculation(int inIndexOfRow)
 {
     TaxSP SpTax = new TaxSP();
     try
     {
         decimal dTaxAmt = 0;
         decimal dcTotal = 0;
         decimal dcNetValue = 0;
         if (dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvtxtSalesInvoiceQty"].Value != null && dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvtxtSalesInvoiceQty"].Value.ToString() != string.Empty)
         {
             dcNetValue = Convert.ToDecimal(dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvtxtSalesInvoiceNetAmount"].Value.ToString());
             if (dcNetValue != 0 && dgvSalesInvoice.Columns["dgvcmbSalesInvoiceTaxName"].Visible && (dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvcmbSalesInvoiceTaxName"].Value == null ? "" : dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvcmbSalesInvoiceTaxName"].Value.ToString()) != "")
             {
                 TaxInfo InfoTaxMaster = SpTax.TaxView(Convert.ToDecimal(dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvcmbSalesInvoiceTaxName"].Value.ToString()));
                 dTaxAmt = Math.Round(((dcNetValue * InfoTaxMaster.Rate) / (100)), PublicVariables._inNoOfDecimalPlaces);
                 dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvtxtSalesInvoiceTaxAmount"].Value = dTaxAmt.ToString();
             }
             else
             {
                 dTaxAmt = 0;
                 dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvtxtSalesInvoiceTaxAmount"].Value = "0.00";
             }
         }
         else
         {
             dTaxAmt = 0;
             dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvtxtSalesInvoiceTaxAmount"].Value = "0.00";
         }
         dcTotal = dcNetValue + dTaxAmt;
         dgvSalesInvoice.Rows[inIndexOfRow].Cells["dgvtxtSalesInvoiceAmount"].Value = dcTotal.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 44 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #9
0
 /// <summary>
 /// Function to use the tax gridfill
 /// </summary>
 public void DGVSalesReturn2Fill()
 {
     try
     {
         DataTable dtblSalesReturn2GrideFill = new DataTable();
         TaxSP spTax = new TaxSP();
         dtblSalesReturn2GrideFill = spTax.TaxViewAllByVoucherTypeIdWithCess(decSalesReturnVoucherTypeId);
         dgvSalesReturn2.Rows.Clear();
         foreach (DataRow drowDetails in dtblSalesReturn2GrideFill.Rows)
         {
             dgvSalesReturn2.Rows.Add();
             dgvSalesReturn2.Rows[dgvSalesReturn2.Rows.Count - 2].Cells["dgvTextTaxName"].Value = drowDetails["taxName"].ToString();
             dgvSalesReturn2.Rows[dgvSalesReturn2.Rows.Count - 2].Cells["dgvTextTaxId"].Value = drowDetails["taxId"].ToString();
             dgvSalesReturn2.Rows[dgvSalesReturn2.Rows.Count - 2].Cells["dgvTextAmount"].Value = 0.00;
             dgvSalesReturn2.Rows[dgvSalesReturn2.Rows.Count - 2].Cells["dgvRate"].Value = drowDetails["rate"].ToString();
         }
         SerialNo2();
     }
     catch (Exception ex)
     {
         MessageBox.Show("SR65:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #10
0
 /// <summary>
 /// Function to use the Tax gridfill
 /// </summary>
 public void TaxGridFill()
 {
     string strTaxName = string.Empty;
     try
     {
         DataTable dtbl = new DataTable();
         TaxSP spTax = new TaxSP();
         string strTaxApplicableOn = "Product";
         dtbl = spTax.TaxViewAllByVoucherTypeId1(decSalesReturnVoucherTypeId, strTaxApplicableOn);
         dgvCmbTax.DataSource = dtbl;
         foreach (DataRow item in dtbl.Rows)
         {
             strTaxName = item["taxName"].ToString();
             if (strTaxName != "NA")
             {
                 DataRow dr = dtbl.NewRow();
                 dr["taxName"] = "NA";
                 dr["taxId"] = 1;
                 dtbl.Rows.InsertAt(dr, 0);
             }
             break;
         }
         dgvCmbTax.ValueMember = "taxId";
         dgvCmbTax.DisplayMember = "taxName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SR64:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #11
0
 /// <summary>
 /// TaxAmountCalculation
 /// </summary>
 /// <param name="inRowIndex"></param>
 public void TaxAmountCalculation(int inRowIndex)
 {
     decimal dcTotal = 0;
     decimal dcVatAmount = 0;
     decimal dcNetAmount = 0;
     dcNetAmount = Convert.ToDecimal(dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextNetValue"].Value.ToString());
     TaxSP SpTax = new TaxSP();
     try
     {
         if (dcNetAmount != 0 && dgvCmbTax.Visible && dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbTax"].Value != null)
         {
             TaxInfo InfoTaxMaster = SpTax.TaxView(Convert.ToDecimal(dgvSalesReturn.Rows[inRowIndex].Cells["dgvCmbTax"].Value.ToString()));
             dcVatAmount = Math.Round(((dcNetAmount * InfoTaxMaster.Rate) / (100)), PublicVariables._inNoOfDecimalPlaces);
             dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextTaxAmount"].Value = dcVatAmount;
         }
         else
         {
             dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextTaxAmount"].Value = "0";
         }
         dcTotal = dcVatAmount + dcNetAmount;
         dgvSalesReturn.Rows[inRowIndex].Cells["dgvTextAmount1"].Value = dcTotal;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SR49:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #12
0
 /// <summary>
 /// tax grid fill function
 /// </summary>
 public void TaxGridFill()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtblTax = new DataTable();
         dtblTax = spTax.TaxViewAllForVoucherType();
         dgvApplicableTaxes.DataSource = dtblTax;
     }
     catch (Exception ex)
     {
         MessageBox.Show("VT08:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #13
0
 /// <summary>
 /// Function to fill Tax grid
 /// </summary>
 public void TaxGridFill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         TaxSP spTax = new TaxSP();
         PurchaseBillTaxSP spPurchaseBillTax = new PurchaseBillTaxSP();
         if (decPurchaseMasterId == 0)
         {
             dtbl = spTax.TaxViewAllByVoucherTypeIdForPurchaseInvoice(decPurchaseInvoiceVoucherTypeId);
         }
         else
         {
             dtbl = spPurchaseBillTax.PurchaseBillTaxViewAllByPurchaseMasterId(decPurchaseMasterId);
         }
         dgvTax.DataSource = dtbl;
         TaxSerialNo();
     }
     catch (Exception ex)
     {
         MessageBox.Show("PI24:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #14
0
 /// <summary>
 /// Function to fill tax combobox
 /// </summary>
 public void TaxCombofill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         TaxSP spTax = new TaxSP();
         dtbl = spTax.TaxViewAllByVoucherTypeIdApplicaleForProduct(decPurchaseInvoiceVoucherTypeId);
         DataRow drow = dtbl.NewRow();
         drow["taxName"] = "      ";
         drow["taxId"] = 0;
         dtbl.Rows.InsertAt(drow, 0);
         dgvcmbTax.DataSource = dtbl;
         dgvcmbTax.DisplayMember = "taxName";
         dgvcmbTax.ValueMember = "taxId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PI17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #15
0
 /// <summary>
 /// Function to calculate total amount
 /// </summary>
 /// <param name="inRowIndex"></param>
 public void Calculate(int inRowIndex)
 {
     decimal decDiscount = 0;
     decimal decDiscountPercent = 0;
     decimal decGrossValue = 0;
     decimal decNetValue = 0;
     decimal decTaxAmount = 0;
     decimal decTaxPercent = 0;
     decimal decTaxId = 0;
     decimal decAmount = 0;
     decimal decTotalAmount = 0;
     decimal decProductId = 0;
     decimal decDefaultTotalAmount = 0;
     decimal decProductRate = 0;
     decimal decQuantity = 0;
     ProductInfo infoProduct = new ProductInfo();
     ProductSP spProduct = new ProductSP();
     TaxInfo infotax = new TaxInfo();
     TaxSP spTax = new TaxSP();
     ExchangeRateSP spExchangeRate = new ExchangeRateSP();
     try
     {
         if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value != null)
         {
             if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value.ToString() != string.Empty)
             {
                 if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value != null)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString() != string.Empty && dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString() != ".")
                     {
                         decProductRate = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtRate"].Value.ToString());
                     }
                 }
                 if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value != null)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value.ToString() != string.Empty && dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value.ToString() != ".")
                     {
                         decQuantity = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtQuantity"].Value.ToString());
                     }
                 }
                 decGrossValue = decProductRate * decQuantity;
                 dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtGrossValue"].Value = Math.Round(decGrossValue, PublicVariables._inNoOfDecimalPlaces);
                 if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value != null)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value.ToString() != string.Empty)
                     {
                         decDiscountPercent = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value.ToString());
                     }
                     else
                     {
                         dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0;
                     }
                 }
                 else
                 {
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0;
                 }
                 if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value != null)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value.ToString() != string.Empty)
                     {
                         decDiscount = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value.ToString());
                     }
                     else
                     {
                         dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0;
                     }
                 }
                 else
                 {
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0;
                 }
                 /*------------------------------Calculate-----------------------------------*/
                 /*------------------------------Discount Calculation-----------------------------------*/
                 if (decGrossValue >= decDiscount)
                 {
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = Math.Round(decDiscount, PublicVariables._inNoOfDecimalPlaces);
                 }
                 else
                 {
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscountPercent"].Value = 0;
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtDiscount"].Value = 0;
                     decDiscount = 0;
                 }
                 decNetValue = decGrossValue - decDiscount;
                 dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtNetValue"].Value = Math.Round(decNetValue, PublicVariables._inNoOfDecimalPlaces);
                 /*------------------------------Tax Calculation-----------------------------------*/
                 if (dgvcmbTax.Visible)
                 {
                     if (dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value != null)
                     {
                         if (dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value.ToString() != string.Empty &&
                             dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value.ToString() != "0")
                         {
                             decTaxId = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvcmbTax"].Value.ToString());
                             infotax = spTax.TaxView(decTaxId);
                             decTaxPercent = infotax.Rate;
                         }
                         else
                         {
                             decTaxPercent = 0;
                         }
                     }
                     else
                     {
                         decTaxPercent = 0;
                     }
                     decProductId = Convert.ToDecimal(dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtProductId"].Value.ToString());
                     infoProduct = spProduct.ProductView(decProductId);
                     if (infoProduct.TaxapplicableOn == "MRP")
                     {
                         decTaxAmount = infoProduct.Mrp * decTaxPercent / 100;
                     }
                     else
                     {
                         decTaxAmount = decNetValue * decTaxPercent / 100;
                     }
                     dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtTaxAmount"].Value = Math.Round(decTaxAmount, PublicVariables._inNoOfDecimalPlaces);
                 }
                 decAmount = decNetValue + decTaxAmount;
                 dgvProductDetails.Rows[inRowIndex].Cells["dgvtxtAmount"].Value = Math.Round(decAmount, PublicVariables._inNoOfDecimalPlaces);
                 decTotalAmount = decTotalAmount + decAmount;
                 decDefaultTotalAmount = decTotalAmount * 1;
                 //CalculateTotalAmount();
                 //if (dgvTax.Visible)
                 //{
                 //    TotalTaxAmount();
                 //}
                 //CalculateGrandTotal();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PI84:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #16
0
        /// <summary>
        /// Function for Amount Calculations for Gross value, Net amount, Tax amount and Total amount
        /// </summary>
        /// <param name="columnName"></param>
        /// <param name="inIndexOfRow"></param>
        public void AmountCalculation(string columnName, int inIndexOfRow)
        {
            try
            {
                string strTaxRate = string.Empty;
                decimal decTaxAmt = 0;
                decimal decTotalAmnt = 0;
                decimal decdgvtxtgrossValue = 0, decDiscountCalc = 0, decNetAmount = 0;
                decimal decTaxPercent = 0;
                decimal decTaxId = 0;
                DataGridViewRow dgrow = dgvPurchaseReturn.Rows[inIndexOfRow];
                ProductInfo infoProduct = new ProductInfo();
                ProductSP spProduct = new ProductSP();
                TaxInfo infotax = new TaxInfo();
                TaxSP spTax = new TaxSP();

                if (dgrow.Cells["dgvtxtqty"].Value != null && dgrow.Cells["dgvtxtqty"].Value.ToString() != string.Empty)
                {
                    decQty = Convert.ToDecimal(dgrow.Cells["dgvtxtqty"].Value.ToString());
                }

                if (dgrow.Cells["dgvtxtrate"].Value != null && dgrow.Cells["dgvtxtrate"].Value.ToString() != string.Empty)
                {
                    decRate = Convert.ToDecimal(dgrow.Cells["dgvtxtrate"].Value.ToString());
                    decdgvtxtgrossValue = decQty * decRate;
                    dgrow.Cells["dgvtxtgrossValue"].Value = Math.Round(decdgvtxtgrossValue, PublicVariables._inNoOfDecimalPlaces);
                }
                if (dgrow.Cells["dgvtxtgrossValue"].Value != null && dgrow.Cells["dgvtxtgrossValue"].Value.ToString() != string.Empty)
                {
                    dgrow.Cells["dgvtxtgrossValue"].Value = Math.Round(decdgvtxtgrossValue, PublicVariables._inNoOfDecimalPlaces);
                    if (dgrow.Cells["dgvtxtdiscount"].Value != null && dgrow.Cells["dgvtxtdiscount"].Value.ToString() != string.Empty)
                    {
                        decDiscountCalc = Convert.ToDecimal(dgrow.Cells["dgvtxtdiscount"].Value.ToString());
                        if (decdgvtxtgrossValue >= decDiscountCalc)
                        {
                            decNetAmount = Math.Round((decdgvtxtgrossValue - decDiscountCalc), PublicVariables._inNoOfDecimalPlaces);
                            dgrow.Cells["dgvtxtNetAmount"].Value = Math.Round(decNetAmount, PublicVariables._inNoOfDecimalPlaces);
                        }
                        else
                        {
                            dgrow.Cells["dgvtxtdiscount"].Value = 0;
                        }
                    }
                    else
                    {
                        dgrow.Cells["dgvtxtdiscount"].Value = 0;
                        dgrow.Cells["dgvtxtNetAmount"].Value = Math.Round(decNetAmount, PublicVariables._inNoOfDecimalPlaces);
                    }
                }
                if (dgrow.Cells["dgvtxtNetAmount"].Value != null && dgrow.Cells["dgvtxtNetAmount"].Value.ToString() != string.Empty)
                {
                    decNetAmount = Math.Round(decdgvtxtgrossValue - decDiscountCalc, PublicVariables._inNoOfDecimalPlaces);
                    decNetAmount = Convert.ToDecimal(dgrow.Cells["dgvtxtNetAmount"].Value.ToString());
                    dgrow.Cells["dgvtxtNetAmount"].Value = Math.Round(decNetAmount, PublicVariables._inNoOfDecimalPlaces);
                }
                if (dgvcmbTax.Visible)
                {
                    if (dgrow.Cells["dgvtxtproductId"].Value != null && dgrow.Cells["dgvtxtproductId"].Value.ToString() != string.Empty)
                    {
                        if (dgrow.Cells["dgvcmbTax"].Value != null && dgrow.Cells["dgvcmbTax"].Value.ToString() != string.Empty && dgrow.Cells["dgvcmbTax"].Value.ToString() != "NA")
                        {
                            decTaxId = Convert.ToDecimal(dgrow.Cells["dgvcmbTax"].Value.ToString());
                            infotax = spTax.TaxView(decTaxId);
                            decTaxPercent = infotax.Rate;
                            if (decTaxPercent != 0)
                            {
                                if (strTaxComboFill != string.Empty)
                                {
                                    decTaxAmt = ((decNetAmount * decTaxPercent) / 100);
                                }
                                else
                                {
                                    dgrow.Cells["dgvtxttaxAmount"].Value = "0";
                                }
                                decTotalAmnt = Math.Round((decNetAmount + decTaxAmt), PublicVariables._inNoOfDecimalPlaces);
                                dgrow.Cells["dgvtxttaxAmount"].Value = Math.Round(decTaxAmt, PublicVariables._inNoOfDecimalPlaces);
                                decTaxAmt = Convert.ToDecimal(dgrow.Cells["dgvtxttaxAmount"].Value.ToString());
                                dgrow.Cells["dgvtxtAmount"].Value = Math.Round(decTotalAmnt, PublicVariables._inNoOfDecimalPlaces);
                            }
                            else
                            {
                                dgrow.Cells["dgvtxttaxAmount"].Value = "0";
                                dgrow.Cells["dgvtxtAmount"].Value = Math.Round(decNetAmount, PublicVariables._inNoOfDecimalPlaces);
                            }
                        }
                        else
                        {
                            decTaxPercent = 0;
                            dgrow.Cells["dgvtxttaxAmount"].Value = "0";
                            dgrow.Cells["dgvtxtAmount"].Value = Math.Round(decNetAmount, PublicVariables._inNoOfDecimalPlaces);
                        }
                    }
                    Calculate();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("PR:34 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #17
0
 /// <summary>
 /// Tax combofill in the grid under the vouchertype id
 /// </summary>
 public void dgvSalesInvoiceTaxComboFill()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtblTax = new DataTable();
         dtblTax = spTax.TaxViewAllByVoucherTypeIdApplicaleForProduct(DecSalesInvoiceVoucherTypeId);
         DataRow drow = dtblTax.NewRow();
         drow["taxName"] = string.Empty;
         drow["taxId"] = 0;
         dtblTax.Rows.InsertAt(drow, 0);
         dgvcmbSalesInvoiceTaxName.DataSource = dtblTax;
         dgvcmbSalesInvoiceTaxName.ValueMember = "taxId";
         dgvcmbSalesInvoiceTaxName.DisplayMember = "taxName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 31" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #18
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);
     }
 }
Пример #19
0
 /// <summary>
 ///  Grid fill function Againest DeliveryNote
 /// </summary>
 public void gridFillAgainestDeliveryNote()
 {
     DeliveryNoteMasterSP SPDeliveryNoteMaster = new DeliveryNoteMasterSP();
     DeliveryNoteDetailsSP SPDeliveryNoteDetails = new DeliveryNoteDetailsSP();
     ProductInfo infoproduct = new ProductInfo();
     SalesMasterSP spSalesMaster = new SalesMasterSP();
     BrandInfo InfoBrand = new BrandInfo();
     TaxInfo infoTax = new TaxInfo();
     TaxSP SPTax = new TaxSP();
     try
     {
         if (cmbSalesModeOrderNo.SelectedIndex > 0)
         {
             inMaxCount = 0;
             isValueChange = false;
             for (int i = 0; i < dgvSalesInvoice.RowCount - 1; i++)
             {
                 if (dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value != null && dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value.ToString() != string.Empty)
                 {
                     lstArrOfRemove.Add(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value.ToString());
                 }
             }
             dgvSalesInvoice.Rows.Clear();
             isValueChange = true;
             DataTable dtblMaster = SPDeliveryNoteMaster.SalesInvoiceGridfillAgainestDeliveryNote(Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString()));
             cmbPricingLevel.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["pricingLevelId"].ToString());
             cmbCurrency.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["exchangeRateId"].ToString());
             cmbPricingLevel.Enabled = false;
             cmbCurrency.Enabled = false;
             DataTable dtblDetails = SPDeliveryNoteDetails.SalesInvoiceGridfillAgainestDeliveryNoteUsingDeliveryNoteDetails(Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString()), decSalesInvoiceIdToEdit, DecSalesInvoiceVoucherTypeId);
             dtblDeliveryNoteDetails = dtblDetails;
             int inRowIndex = 0;
             foreach (DataRow drowDetails in dtblDetails.Rows)
             {
                 dgvSalesInvoice.Rows.Add();
                 IsSetGridValueChange = false;
                 isValueChange = false;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceDeliveryNoteDetailsId"].Value = drowDetails["deliveryNoteDetailsId"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductCode"].Value = drowDetails["productCode"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceBarcode"].Value = drowDetails["barcode"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvcmbSalesInvoiceBatch"].Value = Convert.ToDecimal(drowDetails["batchId"].ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherNo"].Value = drowDetails["voucherNo"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value = drowDetails["invoiceNo"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value = drowDetails["voucherTypeId"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value = "0";
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInRowIndex"].Value = drowDetails["deliveryNoteDetailsId"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value = drowDetails.ItemArray[2].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceUnitConversionId"].Value = drowDetails["unitConversionId"].ToString();
                 infoproduct = spSalesMaster.ProductViewByProductIdforSalesInvoice(Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value).ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductName"].Value = infoproduct.ProductName;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceMrp"].Value = infoproduct.Mrp;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicePurchaseRate"].Value = infoproduct.PurchaseRate;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceSalesRate"].Value = infoproduct.SalesRate;
                 InfoBrand = new BrandSP().BrandView(infoproduct.BrandId);
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceBrand"].Value = InfoBrand.BrandName;
                 infoTax = SPTax.TaxViewByProductId(Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value).ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvcmbSalesInvoiceTaxName"].Value = infoTax.TaxId;
                 isValueChange = false;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicembUnitName"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicembUnitName"].ReadOnly = true;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceQty"].Value = drowDetails["Qty"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceRate"].Value = drowDetails["rate"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceAmount"].Value = drowDetails["amount"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceConversionRate"].Value = drowDetails["conversionRate"].ToString();
                 isFromAgainest = true;
                 gridColumnMakeEnables();
                 int intIndex = 0;
                 intIndex = Convert.ToInt32(drowDetails["deliveryNoteDetailsId"].ToString());
                 if (inMaxCount < intIndex)
                     inMaxCount = intIndex;
                 inRowIndex++;
                 isValueChange = true;
                 isFromAgainest = false;
                 GrossValueCalculation(dgvSalesInvoice.Rows.Count - 2);
                 discountCalculation(dgvSalesInvoice.Rows.Count - 2);
                 taxAndGridTotalAmountCalculation(dgvSalesInvoice.Rows.Count - 2);
             }
             IsSetGridValueChange = true;
             for (int i = inRowIndex; i < dgvSalesInvoice.Rows.Count; ++i)
                 dgvSalesInvoice["dgvtxtSalesInvoiceInRowIndex", i].Value = GetNextinRowIndex().ToString();
             SerialNoforSalesInvoice();
             strVoucherNoTostockPost = dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherNo"].Value.ToString();
             strInvoiceNoTostockPost = dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value.ToString();
             decVouchertypeIdTostockPost = Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value);
         }
         else
         {
             SiGridTotalAmountCalculation();
             ClearGridAgainest();
         }
         SiGridTotalAmountCalculation();
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 53" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #20
0
 /// <summary>
 /// Total amount calculation
 /// </summary>
 public void TotalBillTaxCalculation()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtbl = new DataTable();
         dtbl = spTax.TotalBillTaxCalculationBtapplicableOn();
         foreach (DataRow drowItem in dtbl.Rows)
         {
             if (drowItem != null)
             {
                 foreach (DataGridViewRow dgvrItem in dgvSalesReturn2.Rows)
                 {
                     if (dgvrItem.Cells["dgvTextTaxId"].Value != null)
                     {
                         if (dgvrItem.Cells["dgvTextTaxId"].Value.ToString() == drowItem["taxId"].ToString())
                         {
                             if (txtTotalAmount.Text != string.Empty)
                             {
                                 dgvrItem.Cells["dgvTextAmount"].Value = Math.Round((Convert.ToDecimal(drowItem["rate"].ToString()) * Convert.ToDecimal(txtTotalAmount.Text)) / 100, PublicVariables._inNoOfDecimalPlaces);
                                 decTotalBillTaxAmount = Math.Round(Convert.ToDecimal(dgvrItem.Cells["dgvTextAmount"].Value.ToString()), PublicVariables._inNoOfDecimalPlaces);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SR19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #21
0
 /// <summary>
 /// On print button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (rbtnInput.Checked)
         {
             isInput = true;
         }
         else
         {
             isInput = false;
         }
         if (rbtnBillwise.Checked)
         {
             isBillwise = true;
         }
         else
         {
             isBillwise = false;
         }
         TaxSP spTax = new TaxSP();
         DataSet dsTaxReport = new DataSet();
         DateTime dtFromDate = DateTime.Parse(txtFromDate.Text);
         DateTime dtToDate = DateTime.Parse(txtToDate.Text);
         decimal dectaxId = Convert.ToDecimal(cmbTax.SelectedValue.ToString());
         decimal decvoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
         if (isBillwise)
         {
             dsTaxReport = spTax.TaxCrystalReportGridFillByBillWise(1, dtFromDate, dtToDate, dectaxId, decvoucherTypeId, isInput);
         }
         else
         {
             dsTaxReport = spTax.TaxCrystalReportGridFillByProductwise(1, dtFromDate, dtToDate, dectaxId, decvoucherTypeId, isInput);
         }
         frmReport frmReport = new frmReport();
         frmReport.MdiParent = formMDI.MDIObj;
         if (dgvTaxReport.Rows.Count > 0)
         {
             frmReport.TaxCrystalReportPrint(dsTaxReport, isBillwise);
         }
         else
         {
             Messages.InformationMessage("No Data Found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("TR:16" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #22
0
 /// <summary>
 /// Function to Fill new tax type combo box
 /// </summary>
 public void NewTaxTypeComboFill()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtblTax = new DataTable();
         dtblTax = spTax.TaxViewAll();
         cmbNewTaxType.DataSource = dtblTax;
         cmbNewTaxType.ValueMember = "taxId";
         cmbNewTaxType.DisplayMember = "taxName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("CPT 4 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #23
0
 /// <summary>
 /// To fill the grid
 /// </summary>
 public void GridFill()
 {
     try
     {
         if (cmbTax.SelectedValue != null && cmbVoucherType.SelectedItem != null)
         {
             DataTable dtbl = new DataTable();
             TaxSP spTax = new TaxSP();
             DateTime dtFromDate = DateTime.Parse(txtFromDate.Text);
             DateTime dtToDate = DateTime.Parse(txtToDate.Text);
             decimal dectaxId = Convert.ToDecimal(cmbTax.SelectedValue.ToString());
             decimal decvoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString());
             string strTypeofVoucher = Convert.ToString(cmbTypeOfVoucher.Text);
             if (isBillwise)
             {
                 dtbl = spTax.TaxReportGridFillByBillWise(dtFromDate, dtToDate, dectaxId, decvoucherTypeId, strTypeofVoucher, isInput);
                 if (dtbl.Rows.Count > 0)
                 {
                     for (int i = 0; i < dtbl.Rows.Count; i++)
                     {
                         dgvTaxReport.Rows.Add();
                         dgvTaxReport.Rows[i].Cells["dgvtxtSlNo"].Value = Convert.ToDecimal(dtbl.Rows[i]["SlNo"]);
                         dgvTaxReport.Rows[i].Cells["dgvtxtDate"].Value = dtbl.Rows[i]["Date"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtVoucherType"].Value = dtbl.Rows[i]["TypeofVoucher"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtVoucherNo"].Value = dtbl.Rows[i]["Voucher No"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtCashParty"].Value = dtbl.Rows[i]["Cash/Party"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtTIN"].Value = dtbl.Rows[i]["TIN"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtCST"].Value = dtbl.Rows[i]["CST"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtBillAmount"].Value = Convert.ToDecimal(dtbl.Rows[i]["Bill Amount"]);
                         dgvTaxReport.Rows[i].Cells["dgvtxtCessAmount"].Value = Convert.ToDecimal(dtbl.Rows[i]["Cess Amount"]);
                         dgvTaxReport.Rows[i].Cells["dgvtxtTaxAmount"].Value = Convert.ToDecimal(dtbl.Rows[i]["Tax Amount"]);
                     }
                 }
             }
             else
             {
                 dtbl = spTax.TaxReportGridFillByProductwise(dtFromDate, dtToDate, dectaxId, decvoucherTypeId, strTypeofVoucher, isInput);
                 if (dtbl.Rows.Count > 0)
                 {
                     for (int i = 0; i < dtbl.Rows.Count; i++)
                     {
                         dgvTaxReport.Rows.Add();
                         dgvTaxReport.Rows[i].Cells["dgvtxtSlNo"].Value = Convert.ToDecimal(dtbl.Rows[i]["SlNo"]);
                         dgvTaxReport.Rows[i].Cells["dgvtxtDate"].Value = dtbl.Rows[i]["Date"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtVoucherType"].Value = dtbl.Rows[i]["Voucher Type"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtBillNo"].Value = dtbl.Rows[i]["Bill No"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtItem"].Value = dtbl.Rows[i]["Item"].ToString();
                         dgvTaxReport.Rows[i].Cells["dgvtxtBillAmount"].Value = Convert.ToDecimal(dtbl.Rows[i]["Bill Amount"]);
                         dgvTaxReport.Rows[i].Cells["dgvtxtTax"].Value = Convert.ToDecimal(dtbl.Rows[i]["Tax %"]);
                         dgvTaxReport.Rows[i].Cells["dgvtxtTaxAmount"].Value = Convert.ToDecimal(dtbl.Rows[i]["Tax Amount"]);
                         dgvTaxReport.Rows[i].Cells["dgvtxtTotalAmount"].Value = Convert.ToDecimal(dtbl.Rows[i]["Total Amount"]);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("TR:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #24
0
 /// <summary>
 /// Function to Fill product group or tax according to search by combo box selection in Product Group/Tax combo box 
 /// </summary>
 public void ProductGroupTaxComboFill()
 {
     try
     {
         if (cmbSearchBy.SelectedIndex == 0)
         {
             ProductGroupSP spProductGroup = new ProductGroupSP();
             DataTable dtblProductGroup = new DataTable();
             dtblProductGroup = spProductGroup.ProductGroupViewAll();
             cmbProductGroupTax.DataSource = dtblProductGroup;
             cmbProductGroupTax.ValueMember = "groupId";
             cmbProductGroupTax.DisplayMember = "groupName";
         }
         else
         {
             TaxSP spTax = new TaxSP();
             DataTable dtblTax = new DataTable();
             dtblTax = spTax.TaxViewAll();
             cmbProductGroupTax.DataSource = dtblTax;
             cmbProductGroupTax.ValueMember = "taxId";
             cmbProductGroupTax.DisplayMember = "taxName";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CPT 5 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #25
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);
     }
 }
Пример #26
0
 /// <summary>
 /// Function to fill DataGridView Tax combobox 
 /// </summary>
 public void DGVTaxCombofill()
 {
     try
     {
         DataTable dtbl = new DataTable();
         TaxSP spTax = new TaxSP();
         dtbl = spTax.TaxViewAllByVoucherTypeIdApplicaleForProduct(decPurchaseReturnVoucherTypeId);
         strTaxComboFill = (dtbl.Rows.Count > 0) ? dtbl.Rows[0]["taxId"].ToString() : string.Empty;
         dgvcmbTax.DataSource = dtbl;
         dgvcmbTax.DisplayMember = "taxName";
         dgvcmbTax.ValueMember = "taxId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #27
0
 /// <summary>
 /// tax search grid fill
 /// </summary>
 public void TaxSearchGridFill()
 {
     string strCmbActiveSearchText = string.Empty;
     try
     {
         DataTable dtblTaxSearch = new DataTable();
         TaxSP spTax = new TaxSP();
         if (cmbActiveSearch.Text == "Yes")
         {
             strCmbActiveSearchText = "True";
         }
         else if (cmbActiveSearch.Text == "No")
         {
             strCmbActiveSearchText = "False";
         }
         else
         {
             strCmbActiveSearchText = "All";
         }
         dtblTaxSearch = spTax.TaxSearch(txtTaxNameSearch.Text.Trim(), cmbApplicableForSearch.Text, cmbCalculationModeSearch.Text, strCmbActiveSearchText);
         dgvTaxSearch.DataSource = dtblTaxSearch;
         int inRowCount = dgvTaxSearch.RowCount;
         for (int i = 0; i <= inRowCount - 1; i++)
         {
             if (dgvTaxSearch.Rows[i].Cells["dgvtxtActive"].Value.ToString() == "1")
             {
                 dgvTaxSearch.Rows[i].Cells["dgvtxtActive"].Value = "Yes";
             }
             if (dgvTaxSearch.Rows[i].Cells["dgvtxtActive"].Value.ToString() == "0")
             {
                 dgvTaxSearch.Rows[i].Cells["dgvtxtActive"].Value = "No";
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("TC9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #28
0
 /// <summary>
 /// Function to fill DataGridView PurcahseReturnTax
 /// </summary>
 public void DGVPurchaseReturnTaxFill()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtblPurchaseReturnTax = new DataTable();
         dtblPurchaseReturnTax = spTax.TaxViewAllByVoucherTypeId(decPurchaseReturnVoucherTypeId);
         dgvPurchaseReturnTax.DataSource = dtblPurchaseReturnTax;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Пример #29
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);
     }
 }
Пример #30
0
 /// <summary>
 /// Function to use the Tax Combo Fill 
 /// </summary>
 public void ComboTaxFill()
 {
     try
     {
         TaxSP spTax = new TaxSP();
         DataTable dtbl = new DataTable();
         dtbl = spTax.TaxViewByProductIdApplicableForProduct(decProductId);
         cmbTax.DataSource = dtbl;
         cmbTax.ValueMember = "taxId";
         cmbTax.DisplayMember = "taxName";
     }
     catch (Exception ex)
     {
         MessageBox.Show("POS:18" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }