public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { crptServiceVoucher rpt = new crptServiceVoucher(); rpt.Site = this.Site; return(rpt); }
/// <summary> /// Function to print ServiceVoucher in curresponding Crystal report /// </summary> /// <param name="dsServiceVoucher"></param> internal void ServiceVoucherPrinting(DataSet dsServiceVoucher) { try { decimal decGrandTotal = 0; crptServiceVoucher crptServiceVoucher = new crptServiceVoucher(); foreach (DataTable dtbl in dsServiceVoucher.Tables) { if (dtbl.TableName == "Table") { crptServiceVoucher.Database.Tables["dtblCompanyDetails"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table1") { crptServiceVoucher.Database.Tables["dtblServiceMaster"].SetDataSource(dtbl); foreach (DataRow drow in dtbl.Rows) { decGrandTotal = Convert.ToDecimal(drow["grandTotal"].ToString()); } //decimal decExchangeRateID = 0; //foreach (DataRow drow in dtbl.Rows) //{ // decExchangeRateID = Convert.ToDecimal(drow["exchangeRateId"].ToString()); //} //CurrencyInfo infoCurrency = new CurrencyInfo(); //ExchangeRateSP spExchangeRate = new ExchangeRateSP(); //infoCurrency = spExchangeRate.GetCurrencyByExchangeRateID(decExchangeRateID); //DataColumn dtClmnCurrency = new DataColumn("currency"); //dtbl.Columns.Add(dtClmnCurrency); //foreach (DataRow drowCurrency in dtbl.Rows) //{ // drowCurrency["currency"] = infoCurrency.CurrencyName; //} crptServiceVoucher.Database.Tables["dtblServiceMaster"].SetDataSource(dtbl); } else if (dtbl.TableName == "Table2") { DataColumn dtClmn = new DataColumn("AmountInWords"); dtbl.Columns.Add(dtClmn); foreach (DataRow drow in dtbl.Rows) { drow["AmountInWords"] = new NumToText().AmountWords(decGrandTotal, PublicVariables._decCurrencyId); } //decimal decExchangeRateID = 0; //foreach (DataRow drow in dtbl.Rows) //{ // decExchangeRateID = Convert.ToDecimal(drow["exchangeRateId"].ToString()); //} //CurrencyInfo infoCurrency = new CurrencyInfo(); //ExchangeRateSP spExchangeRate = new ExchangeRateSP(); //infoCurrency = spExchangeRate.GetCurrencyByExchangeRateID(decExchangeRateID); //DataColumn dtClmnCurrency = new DataColumn("currency"); //dtbl.Columns.Add(dtClmnCurrency); //foreach (DataRow drowCurrency in dtbl.Rows) //{ // drowCurrency["currency"] = infoCurrency.CurrencyName; //} DataColumn dtClmnSlNo = new DataColumn("SlNo"); dtbl.Columns.Add(dtClmnSlNo); int inRowIndex = 0; foreach (DataRow drSlNo in dtbl.Rows) { drSlNo["SlNo"] = ++inRowIndex; } crptServiceVoucher.Database.Tables["dtblServiceVoucherDetails"].SetDataSource(dtbl); } } this.crptViewer.ReportSource = crptServiceVoucher; SettingsSP spSettings = new SettingsSP(); if (spSettings.SettingsStatusCheck("DirectPrint") == "No") { base.Show(); this.BringToFront(); } else { crptServiceVoucher.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { MessageBox.Show("CRV8 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { crptServiceVoucher rpt = new crptServiceVoucher(); rpt.Site = this.Site; return rpt; }