Example #1
0
        /// <summary>
        /// Function to get sum of quantity for vochers based on parameter
        /// </summary>
        /// <param name="dSalesId"></param>
        /// <returns></returns>
        public string VoucherreportsumQty(decimal dSalesId, string strVoucherType)
        {
            string qty = string.Empty;

            try
            {
                qty = spVoucherType.VoucherreportsumQty(dSalesId, strVoucherType);
            }
            catch (Exception ex)
            {
                MessageBox.Show("VT30:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(qty);
        }
Example #2
0
        /// <summary>
        /// Function to fill the grid
        /// </summary>
        public void GridFill()
        {
            try
            {
                dgvVatreturn.Rows.Clear();
                DataTable dt = new DataTable();
                string    strVoucherTypeName = string.Empty;
                decimal   decVoucherTypeId;
                if (rbtnFormat1.Checked)
                {
                    strformat = "type1";
                }
                else
                {
                    strformat = "type2";
                }
                if (cmbVouchertype.Enabled)
                {
                    decVoucherTypeId = Convert.ToDecimal(cmbVouchertype.SelectedValue.ToString());
                }
                else
                {
                    decVoucherTypeId = 0;
                }
                strVoucherTypeName = Convert.ToString(cmbTypeofVoucher.Text);
                VoucherTypeSP spVoucher = new VoucherTypeSP();
                dt       = spVoucher.VatGridFill(Convert.ToDateTime(dtpFrmDate.Text), Convert.ToDateTime(dtpToDate.Text), strVoucherTypeName, decVoucherTypeId, strformat, cmbTax.Text);
                dtblFill = dt;
                DataTable dtblTaxName = new DataTable();
                dtblTaxName = spVoucher.VatViewTaxNames();
                if (rbtnFormat1.Checked)
                {
                    dgvVatreturn.Columns["dgvtxtTaxName"].Visible       = false;
                    dgvVatreturn.Columns["dgvtxtTaxableAmount"].Visible = false;
                    dgvVatreturn.Columns["dgvtxttax"].Visible           = false;
                    dgvVatreturn.Columns["dgvtxtQty"].Visible           = true;
                    dgvVatreturn.Columns["dgvtxtSalesAmount"].Visible   = true;
                    dgvVatreturn.Columns["dgvtxtTaxAmount"].Visible     = true;
                    dgvVatreturn.Columns["dgvtxtNetAmount"].Visible     = true;
                    dgvVatreturn.Columns["dgvtxtbillDiscount"].Visible  = true;
                    foreach (DataRow drowDetails in dt.Rows)
                    {
                        dgvVatreturn.Rows.Add();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtInvoiceNo"].Value     = drowDetails["Invoice No"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtDate"].Value          = drowDetails["Date"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtPartyName"].Value     = drowDetails["Party Name"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtMailingName"].Value   = drowDetails["Mailing Name"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtsalesmasterid"].Value = drowDetails["SalesMasterId"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtvoucherName"].Value   = drowDetails["voucherName"].ToString();

                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtVoucherType"].Value = drowDetails["voucherType"].ToString();

                        decimal dSaleId        = Convert.ToDecimal(dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtsalesmasterid"].Value.ToString());
                        string  strVoucherType = Convert.ToString(dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtVoucherType"].Value);
                        string  qt             = spVoucher.VoucherreportsumQty(dSaleId, strVoucherType);

                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTinNo"].Value        = drowDetails["Tin No"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtQty"].Value          = qt;
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtSalesAmount"].Value  = drowDetails["Sales Amound"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTaxAmount"].Value    = Math.Round(Convert.ToDecimal(drowDetails["Tax Amount"].ToString()), PublicVariables._inNoOfDecimalPlaces).ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtCess"].Value         = drowDetails["Cess"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtNetAmount"].Value    = Math.Round(Convert.ToDecimal(drowDetails["Net Amount"].ToString()), PublicVariables._inNoOfDecimalPlaces).ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtbillDiscount"].Value = Math.Round(Convert.ToDecimal(drowDetails["billDiscount"].ToString()), PublicVariables._inNoOfDecimalPlaces).ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtGrandTotal"].Value   = Math.Round(Convert.ToDecimal(drowDetails["grandtotal"].ToString()), PublicVariables._inNoOfDecimalPlaces).ToString();;
                    }
                    if (dgvVatreturn.Rows.Count > 0)
                    {
                        SerialNo();
                    }
                }
                else
                {
                    dgvVatreturn.Rows.Clear();
                    dgvVatreturn.Columns["dgvtxtTaxName"].Visible       = true;
                    dgvVatreturn.Columns["dgvtxtTaxableAmount"].Visible = true;
                    dgvVatreturn.Columns["dgvtxttax"].Visible           = true;
                    dgvVatreturn.Columns["dgvtxtQty"].Visible           = false;
                    dgvVatreturn.Columns["dgvtxtSalesAmount"].Visible   = false;
                    dgvVatreturn.Columns["dgvtxtTaxAmount"].Visible     = false;
                    dgvVatreturn.Columns["dgvtxtNetAmount"].Visible     = false;
                    dgvVatreturn.Columns["dgvtxtbillDiscount"].Visible  = false;
                    foreach (DataRow drowDetails in dt.Rows)
                    {
                        dgvVatreturn.Rows.Add();

                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtInvoiceNo"].Value     = drowDetails["Invoice No"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtDate"].Value          = drowDetails["Date"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtPartyName"].Value     = drowDetails["Party Name"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtMailingName"].Value   = drowDetails["Mailing Name"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtsalesmasterid"].Value = drowDetails["SalesMasterId"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTinNo"].Value         = drowDetails["Tin No"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtGrandTotal"].Value    = drowDetails["grandtotal"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTaxName"].Value       = drowDetails["taxName"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTaxableAmount"].Value = drowDetails["rate"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxttax"].Value           = drowDetails["taxamount"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtvoucherName"].Value   = drowDetails["voucherName"].ToString();
                        dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtVoucherType"].Value   = drowDetails["voucherType"].ToString();
                    }
                    if (dgvVatreturn.Rows.Count > 0)
                    {
                        SerialNo();
                        dgvVatreturn.Rows.Add();
                        CalculateTotal();
                    }
                    dtblFill.Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("VRR:06" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }