public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     crptSalesQuotation rpt = new crptSalesQuotation();
     rpt.Site = this.Site;
     return rpt;
 }
Exemple #2
0
        /// <summary>
        /// Function to print SalesQuotation in curresponding Crystal report
        /// </summary>
        /// <param name="dsSalesQuotation"></param>
        internal void SalesQuotationPrinting(DataSet dsSalesQuotation)
        {
            try
            {

                crptSalesQuotation crptSalesQuotationObj = new crptSalesQuotation();
                decimal decTotalAmount = 0;
                foreach (DataTable dtbl in dsSalesQuotation.Tables)
                {
                    if (dtbl.TableName == "Table")
                    {
                        crptSalesQuotationObj.Database.Tables["dtblCompany"].SetDataSource(dtbl);
                    }
                    else if (dtbl.TableName == "Table1")
                    {
                        
                        foreach (DataRow drow in dtbl.Rows)
                        {
                            DataColumn dtClmn = new DataColumn("amountInWords");
                            dtbl.Columns.Add(dtClmn);
                            if (drow["totalAmount"].ToString() != string.Empty)
                            {
                                decTotalAmount = Convert.ToDecimal(drow["totalAmount"].ToString());
                                drow["amountInWords"] = new NumToText().AmountWords(decTotalAmount, PublicVariables._decCurrencyId);
                            }
                            crptSalesQuotationObj.Database.Tables["dtblSalesQuotationMaster"].SetDataSource(dtbl);
                        }
                    }
                    else
                    {
                        crptSalesQuotationObj.Database.Tables["dtblSalesQuotationDetails"].SetDataSource(dtbl);

                    }
                }
                this.crptViewer.ReportSource = crptSalesQuotationObj;
                SettingsSP spSettings = new SettingsSP();

                if (spSettings.SettingsStatusCheck("DirectPrint") == "No")
                {
                    base.Show();
                    this.BringToFront();
                }
                else
                {
                    crptSalesQuotationObj.PrintToPrinter(1, false, 0, 0);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(" " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }