本文整理汇总了C#中ReportDocument.OpenSubreport方法的典型用法代码示例。如果您正苦于以下问题:C# ReportDocument.OpenSubreport方法的具体用法?C# ReportDocument.OpenSubreport怎么用?C# ReportDocument.OpenSubreport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReportDocument
的用法示例。
在下文中一共展示了ReportDocument.OpenSubreport方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CRAllOrders
public ActionResult CRAllOrders(int? id)
{
var allOrdersvar = from a in db.Orders select a;
allOrdersvar = allOrdersvar.Where(o => o.Active.Equals(true));
List<Order> ActiveOrderlist = allOrdersvar.ToList();
List<Company> company = new List<Company>();
company = db.Companies.ToList();
List<AllOrdersCRViewModel> allOrdersCR = new List<AllOrdersCRViewModel>();
foreach (var item in ActiveOrderlist)
{
var allOrderCR = new AllOrdersCRViewModel();
allOrderCR.OrderId = item.OrderId;
allOrderCR.OrderNumber = item.OrderNumber;
allOrderCR.Active = item.Active;
allOrderCR.Date = item.Date;
allOrderCR.CustomerId = item.CustomerId;
allOrderCR.Annotation = item.Annotation;
allOrderCR.FirstName = item.FirstName;
allOrderCR.LastName = item.LastName;
allOrderCR.Email = item.Email;
allOrderCR.StreetName = item.StreetName;
allOrderCR.StreetNumber = item.StreetNumber;
allOrderCR.Box = item.Box;
allOrderCR.CellPhone = item.CellPhone;
allOrderCR.PostalCodeNumber = item.PostalCodeNumber;
allOrderCR.Town = item.Town;
allOrderCR.TotalPrice = item.TotalPrice;
allOrdersCR.Add(allOrderCR);
}
ReportDocument rd = new ReportDocument();
rd.Load(Path.Combine(Server.MapPath("~/Reports"), "AllQuotationsMain.rpt"));
rd.OpenSubreport("Header.rpt").SetDataSource(company);
rd.OpenSubreport("allQuotationsSub.rpt").SetDataSource(allOrdersCR);
//rd.SetDataSource(company);
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
try
{
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf", "All_Orders.pdf");
}
catch (Exception ex)
{
if (ex.Data == null)
{
throw;
}
else
{
throw;
}
}
}
示例2: CRAllCustomers
public ActionResult CRAllCustomers(int? id)
{
List<Customer> allCustomers = new List<Customer>();
allCustomers = db.Customers.ToList();
List<Company> company = new List<Company>();
company = db.Companies.ToList();
List<AllCustomersCRViewModel> allCustomersCR = new List<AllCustomersCRViewModel>();
foreach (var item in allCustomers)
{
var allCustomerCR = new AllCustomersCRViewModel();
allCustomerCR.FirstName = item.FirstName;
allCustomerCR.LastName = item.LastName;
allCustomerCR.CompanyName = item.CompanyName;
allCustomerCR.Phone = item.Phone;
allCustomerCR.CellPhone = item.CellPhone;
allCustomerCR.VATNumber = item.VATNumber;
allCustomerCR.ContactName = item.ContactName;
allCustomerCR.ContactEmail = item.ContactEmail;
allCustomerCR.ContactCellPhone = item.ContactCellPhone;
allCustomerCR.Type = item.Type;
allCustomerCR.TAXLiability = item.TAXLiability;
allCustomerCR.AccountNumber = item.AccountNumber;
allCustomerCR.Annotation = item.Annotation;
allCustomerCR.Email = item.Email;
allCustomerCR.CustomerId = item.CustomerId;
allCustomerCR.AddressId = item.Address.AddressId;
allCustomerCR.StreetName = item.Address.StreetName;
allCustomerCR.StreetNumber = item.Address.StreetNumber;
allCustomerCR.Town = item.Address.Town;
allCustomersCR.Add(allCustomerCR);
}
ReportDocument rd = new ReportDocument();
rd.Load(Path.Combine(Server.MapPath("~/Reports"), "MainCustomers.rpt"));
rd.OpenSubreport("Header.rpt").SetDataSource(company);
rd.OpenSubreport("allCustomers.rpt").SetDataSource(allCustomersCR);
//rd.SetDataSource(company);
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
try
{
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf", "All_Customers.pdf");
}
catch (Exception ex)
{
if (ex.Data == null)
{
throw;
}
else
{
throw;
}
}
}
示例3: CRCustomer
public ActionResult CRCustomer(int id)
{
var customervar = from a in db.Customers select a;
customervar = customervar.Where(c => c.CustomerId.Equals(id));
//expliciete conversie was nodig, Anders conection error nadien op item.adresses.etc
List<Customer> customerList = customervar.ToList();
List<Company> company = new List<Company>();
company = db.Companies.ToList();
List<CustomerCRViewModel> CustomersCR = new List<CustomerCRViewModel>();
List<CustomerDeliveryAdressesCRViewModel> DeliveriesCR = new List<CustomerDeliveryAdressesCRViewModel>();
foreach (var item in customerList)
{
var CustomerCR = new CustomerCRViewModel();
CustomerCR.FirstName = item.FirstName;
CustomerCR.LastName = item.LastName;
CustomerCR.CompanyName = item.CompanyName;
CustomerCR.Phone = item.Phone;
CustomerCR.CellPhone = item.CellPhone;
CustomerCR.VATNumber = item.VATNumber;
CustomerCR.ContactName = item.ContactName;
CustomerCR.ContactEmail = item.ContactEmail;
CustomerCR.ContactCellPhone = item.ContactCellPhone;
CustomerCR.Type = item.Type;
CustomerCR.TAXLiability = item.TAXLiability;
CustomerCR.AccountNumber = item.AccountNumber;
CustomerCR.Annotation = item.Annotation;
CustomerCR.Email = item.Email;
CustomerCR.CustomerId = item.CustomerId;
CustomerCR.AddressId = item.Address.AddressId;
CustomerCR.StreetName = item.Address.StreetName;
CustomerCR.StreetNumber = item.Address.StreetNumber;
CustomerCR.Town = item.Address.Town;
foreach (var item2 in item.CustomerDeliveryAddress)
{
var DeliveryCR = new CustomerDeliveryAdressesCRViewModel();
DeliveryCR.CustomerId = item.CustomerId;
DeliveryCR.CustomerDeliveryAddressId = item2.CustomerDeliveryAddressId;
DeliveryCR.StreetName = item2.StreetName;
DeliveryCR.StreetNumber = item2.StreetNumber;
DeliveryCR.Town = item2.Town;
DeliveryCR.PostalCodeNumber = item2.PostalCodeNumber;
DeliveriesCR.Add(DeliveryCR);
}
CustomersCR.Add(CustomerCR);
}
ReportDocument rd = new ReportDocument();
rd.Load(Path.Combine(Server.MapPath("~/Reports"), "CustomerMain.rpt"));
rd.OpenSubreport("Header.rpt").SetDataSource(company);
rd.OpenSubreport("CustomerSub.rpt").SetDataSource(CustomersCR);
rd.OpenSubreport("DeliveryAddressesCR.rpt").SetDataSource(DeliveriesCR);
//rd.SetDataSource(company);
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
try
{
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf", "Customer.pdf");
}
catch (Exception ex)
{
if (ex.Data == null)
{
throw;
}
else
{
throw;
}
}
}
示例4: _loadReport
public void _loadReport()
{
DateTime startDate = new DateTime();
DateTime endDate = new DateTime();
try
{
startDate = txtStartDate.Text != "" ? Convert.ToDateTime(txtStartDate.Text) : DateTime.Parse("1 / 1 / 1753");
}
catch (Exception ex)
{
startDate = DateTime.MinValue;
}
try
{
DateTime date = new DateTime();
date = txtEndDate.Text != "" ? Convert.ToDateTime(txtEndDate.Text) : DateTime.Now.AddDays(1);
endDate = date.AddDays(1);
}
catch (Exception ex)
{
endDate = DateTime.Now;
}
decimal sumCredit = 0, sumdebit = 0;
List<ACC_Account> acc_credit = new List<ACC_Account>();
List<ACC_Account> acc_debit = new List<ACC_Account>();
List<ACC_Account> accounts = ACC_AccountManager.ViewAllACC_JournalsByAccountID(startDate, endDate);
foreach (ACC_Account account in accounts)
{
decimal credit = 0, debit = 0;
List<ACC_Journal> accountJournals = ACC_JournalManager.ViewAllACC_JournalsByAccountID(account.AccountID, startDate, endDate);
account.StartDate = txtStartDate.Text;
account.EndDate = txtEndDate.Text;
foreach (ACC_Journal accountJournal in accountJournals)
{
credit = credit + accountJournal.Credit;
debit = debit + accountJournal.Debit;
}
if (credit > debit)
{
account.CreditAccountName = ACC_AccountManager.GetACC_AccountByAccountID(account.AccountID).AccountName;
account.DebitAccountName = "";
account.Credit = credit - debit;
account.Debit = 0;
sumCredit = sumCredit + account.Credit;
account.SumCredit = sumCredit;
acc_credit.Add(account);
}
else if (debit > credit)
{
account.DebitAccountName = ACC_AccountManager.GetACC_AccountByAccountID(account.AccountID).AccountName;
account.CreditAccountName = "";
account.Debit = debit - credit;
account.Credit = 0;
sumdebit = sumdebit + account.Debit;
account.SumDebit = sumdebit;
acc_debit.Add(account);
}
else
{
account.CreditAccountName = "";
account.DebitAccountName = "";
account.Credit = 0;
account.Debit = 0;
}
}
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("~/Accounting/Report/TrialBalanceView.rpt"));
rptDoc.OpenSubreport("TrialBalanceDebitReport.rpt").SetDataSource(acc_debit);
rptDoc.OpenSubreport("TrialBalanceCreditReportView.rpt").SetDataSource(acc_credit);
rptDoc.SetDataSource(acc_credit);
this.crvTrialBalance.EnableDatabaseLogonPrompt = false;
crvTrialBalance.ReportSource = rptDoc;
crvTrialBalance.Zoom(83);
}
示例5: cReport
//ALL THIS FUNCTION NOT IN USE
public ReportDocument cReport(String headerSql, Boolean isPortrait, Boolean headerReq, String reportSql, String reportName)
{
ReportDocument rptDoc = new ReportDocument();
try
{
String hName;
rptDoc.FileName = reportName;
SqlConnection sqlCon = new SqlConnection(strConStr);
sqlCon.Open();
DataSet dSet = new DataSet();
SqlDataAdapter dAdapter = new SqlDataAdapter();
dAdapter.TableMappings.Add("Table", "Header");
SqlCommand sqlCmd = new SqlCommand(headerSql, sqlCon);
sqlCmd.CommandType = CommandType.Text;
dAdapter.SelectCommand = sqlCmd;
dAdapter.Fill(dSet);
dAdapter.Dispose();
dAdapter.TableMappings.Add("Table", "Report");
sqlCmd = new SqlCommand(reportSql, sqlCon);
sqlCmd.CommandType = CommandType.Text;
dAdapter.SelectCommand = sqlCmd;
dAdapter.Fill(dSet);
sqlCmd.Cancel();
sqlCmd.Dispose();
if (isPortrait == true) hName = "crHeader_Portrait.rpt"; else hName = "crHeader_Landscape.rpt";
if (headerReq == true) rptDoc.OpenSubreport(hName).SetDataSource(dSet.Tables["Header"]);
rptDoc.SetDataSource(dSet.Tables["Report"]);
dSet.Clear();
dSet.Dispose();
dAdapter.Dispose();
sqlCon.Close();
sqlCon.Dispose();
return rptDoc;
}
//catch (SqlException sqlExp)
//{
// //MessageBox.Show(sqlExp.Message, "SQL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
// return;
//}
catch
{
//MessageBox.Show(ex.Message, "General Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return rptDoc;
}
}
示例6: getInforme
private static ReportDocument getInforme(decimal ajusteId, string tipoInforme, string ApplicationPath)
{
bool tieneSeccionesAdicionales = true;
bool tieneSeccionesFinales = false;
string tituloInforme = "INFORME BÁSICO";
string tipoMonto = "RESERVA NETA";
decimal montoIndemnizacion = 0;
tipoInforme = GetTipoInforme(tipoInforme);
switch (tipoInforme)
{
case "B":
{
tieneSeccionesAdicionales = false;
break;
}
case "P":
{
tieneSeccionesAdicionales = true;
tituloInforme = "INFORME PRELIMINAR";
break;
}
case "C":
{
tieneSeccionesAdicionales = true;
tituloInforme = "INFORME COMPLEMENTARIO";
break;
}
case "F":
{
tieneSeccionesAdicionales = true;
tieneSeccionesFinales = true;
if (GestorAjuste.dameTipoAjuste(ajusteId) != 2)
{
tituloInforme = "INFORME FINAL";
}
else
{
tituloInforme = "INFORME FINAL RÁPIDO";
}
tipoMonto = "INDEMNIZACIÓN";
montoIndemnizacion = GestorAjuste.dameTotalIndemnizacion(ajusteId);
break;
}
}
// Instancia del reporte
String reportPath = ApplicationPath + "\\docs\\crInformeBasico.rpt";
ReportDocument informeBasico = new ReportDocument();
informeBasico.Load(reportPath);
dsReporteTableAdapters.InformeBasicoImagenesTableAdapter dtImagenes = new dsReporteTableAdapters.InformeBasicoImagenesTableAdapter();
DataTable imagenes = (DataTable)dtImagenes.GetData(Convert.ToInt32(ajusteId));
if (imagenes.Rows.Count > 0)
informeBasico.OpenSubreport("crIBImagen.rpt").SetDataSource(imagenes);
else
informeBasico.ReportDefinition.Sections["Imagenes"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.InformeBasicoDocumentacionSolicitadaTableAdapter dtdocumentacion = new dsReporteTableAdapters.InformeBasicoDocumentacionSolicitadaTableAdapter();
try
{
DataTable documentacion = (DataTable)dtdocumentacion.GetData(Convert.ToInt32(ajusteId));
if (documentacion.Rows.Count > 0)
informeBasico.OpenSubreport("crIBDocumentacion.rpt").SetDataSource(documentacion);
else
informeBasico.ReportDefinition.Sections["documentacion"].SectionFormat.EnableSuppress = true;
}
catch (Exception Ex)
{
Console.Write(Ex.Message);
}
dsReporteTableAdapters.InformeBasicoReclamoTableAdapter dtreclamo = new dsReporteTableAdapters.InformeBasicoReclamoTableAdapter();
DataTable reclamo = (DataTable)dtreclamo.GetData(Convert.ToInt32(ajusteId));
ReportDocument reclamoReport = informeBasico.OpenSubreport("crIBReclamo.rpt");
reclamoReport.SetDataSource(reclamo);
//Aqui agrego el nuevo SubReporte Informacion Complementaria
dsReporteTableAdapters.InformeBasicoReclamoTableAdapter dtinformacionComplementaria = new dsReporteTableAdapters.InformeBasicoReclamoTableAdapter();
DataTable informacionComplementaria = (DataTable)dtinformacionComplementaria.GetData(Convert.ToInt32(ajusteId));
ReportDocument informacionComplementariaReport = informeBasico.OpenSubreport("crIBInformacionComplementaria.rpt");
informacionComplementariaReport.SetDataSource(informacionComplementaria);
dsReporteTableAdapters.InformeBasicoInspeccionTableAdapter dtinspeccion = new dsReporteTableAdapters.InformeBasicoInspeccionTableAdapter();
DataTable inspeccion = (DataTable)dtinspeccion.GetData(Convert.ToInt32(ajusteId));
informeBasico.OpenSubreport("crIBInspeccion.rpt").SetDataSource(inspeccion);
dsReporteTableAdapters.InformeBasicoOcurrenciaDetalleTableAdapter dtdetalleocurrencia = new dsReporteTableAdapters.InformeBasicoOcurrenciaDetalleTableAdapter();
DataTable detalleocurrencia = (DataTable)dtdetalleocurrencia.GetData(Convert.ToInt32(ajusteId));
if (detalleocurrencia.Rows.Count > 0)
informeBasico.OpenSubreport("crIBDetalleOcurrencia.rpt").SetDataSource(detalleocurrencia);
else
informeBasico.ReportDefinition.Sections["detalleOcurrencia"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.InformeBasicoOcurrenciaCabeceraTableAdapter dtocurrencia = new dsReporteTableAdapters.InformeBasicoOcurrenciaCabeceraTableAdapter();
DataTable ocurrencia = (DataTable)dtocurrencia.GetData(Convert.ToInt32(ajusteId));
informeBasico.OpenSubreport("crIBOcurrencia.rpt").SetDataSource(ocurrencia);
//.........这里部分代码省略.........
示例7: getSolicitudDocumentos
private static ReportDocument getSolicitudDocumentos(decimal ajusteId, decimal solicitudDocumentosId, string nombreDestinatario, string cargoDestinatario, DateTime fechaRemision, string numeroCarta, int numeroRecordatorio, string descripcion, string ApplicationPath)
{
// Instancia del reporte
//String reportPath = ApplicationPath + "\\docs\\crSolicitudDocs.rpt";
String reportPath = ApplicationPath + "\\docs\\crSolicitudDocumentos.rpt";
ReportDocument solicitudDocumentos = new ReportDocument();
solicitudDocumentos.Load(reportPath);
dsReporteTableAdapters.SolicitudDocsTableAdapter documentosAdater = new dsReporteTableAdapters.SolicitudDocsTableAdapter();
dsReporte.SolicitudDocsDataTable documentosTable = documentosAdater.GetData(ajusteId, solicitudDocumentosId);
solicitudDocumentos.OpenSubreport("Documentos").SetDataSource(documentosTable.Select(" estado = 'N'"));
dsReporteTableAdapters.SolicitudDocumentoTableAdapter solicitudAdater = new dsReporteTableAdapters.SolicitudDocumentoTableAdapter();
dsReporte.SolicitudDocumentoDataTable solicitudTable = solicitudAdater.GetData(ajusteId, solicitudDocumentosId);
solicitudDocumentos.SetDataSource((DataTable)solicitudTable);
solicitudDocumentos.SetParameterValue("personaNombre", nombreDestinatario);
solicitudDocumentos.SetParameterValue("personaCargo", cargoDestinatario);
solicitudDocumentos.SetParameterValue("fechaRemision", fechaRemision);
solicitudDocumentos.SetParameterValue("numeroCarta", numeroCarta);
solicitudDocumentos.SetParameterValue("numeroRecordatorio", numeroRecordatorio);
solicitudDocumentos.SetParameterValue("descripcion", descripcion);
return solicitudDocumentos;
}
示例8: GetInformePreliminar
public static byte[] GetInformePreliminar(int ajusteId, string ruta)
{
// Instancia del reporte
String reportPath = ruta + "docs\\crInformePreliminar.rpt";
//MODIFICAR CON LA AGREGACION DE LA EXTENCION DEL PDF
String nombre = "PASA-IP-" + ajusteId + "-" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Year + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond + ".pdf";
ReportDocument informeBasico = new ReportDocument();
informeBasico.Load(reportPath);
dsReporteTableAdapters.InformeBasicoImagenesTableAdapter dtImagenes = new dsReporteTableAdapters.InformeBasicoImagenesTableAdapter();
DataTable imagenes = (DataTable)dtImagenes.GetData(ajusteId);
informeBasico.OpenSubreport("crIBImagen.rpt").SetDataSource(imagenes);
dsReporteTableAdapters.InformeBasicoDocumentacionSolicitadaTableAdapter dtdocumentacion = new dsReporteTableAdapters.InformeBasicoDocumentacionSolicitadaTableAdapter();
DataTable documentacion = (DataTable)dtdocumentacion.GetData(ajusteId);
informeBasico.OpenSubreport("crIBDocumentacion.rpt").SetDataSource(documentacion);
dsReporteTableAdapters.InformeBasicoReclamoTableAdapter dtreclamo = new dsReporteTableAdapters.InformeBasicoReclamoTableAdapter();
DataTable reclamo = (DataTable)dtreclamo.GetData(ajusteId);
informeBasico.OpenSubreport("crIBReclamo.rpt").SetDataSource(reclamo);
dsReporteTableAdapters.InformeBasicoInspeccionTableAdapter dtinspeccion = new dsReporteTableAdapters.InformeBasicoInspeccionTableAdapter();
DataTable inspeccion = (DataTable)dtinspeccion.GetData(ajusteId);
informeBasico.OpenSubreport("crIBInspeccion.rpt").SetDataSource(inspeccion);
dsReporteTableAdapters.InformeBasicoOcurrenciaDetalleTableAdapter dtdetalleocurrencia = new dsReporteTableAdapters.InformeBasicoOcurrenciaDetalleTableAdapter();
DataTable detalleocurrencia = (DataTable)dtdetalleocurrencia.GetData(ajusteId);
informeBasico.OpenSubreport("crIBDetalleOcurrencia.rpt").SetDataSource(detalleocurrencia);
dsReporteTableAdapters.InformeBasicoOcurrenciaCabeceraTableAdapter dtocurrencia = new dsReporteTableAdapters.InformeBasicoOcurrenciaCabeceraTableAdapter();
DataTable ocurrencia = (DataTable)dtocurrencia.GetData(ajusteId);
informeBasico.OpenSubreport("crIBOcurrencia.rpt").SetDataSource(ocurrencia);
dsReporteTableAdapters.InformeBasicoClausulasTableAdapter dtclausulas = new dsReporteTableAdapters.InformeBasicoClausulasTableAdapter();
DataTable clausulas = (DataTable)dtclausulas.GetData(ajusteId);
informeBasico.OpenSubreport("crIBClausulas.rpt").SetDataSource(clausulas);
dsReporteTableAdapters.InformeBasicoDeduciblesTableAdapter dtdeducibles = new dsReporteTableAdapters.InformeBasicoDeduciblesTableAdapter();
DataTable deducibles = (DataTable)dtdeducibles.GetData(ajusteId);
informeBasico.OpenSubreport("crIBDeducibles.rpt").SetDataSource(deducibles);
dsReporteTableAdapters.InformeBasicoPolizaDetalleTableAdapter dtdetallepoliza = new dsReporteTableAdapters.InformeBasicoPolizaDetalleTableAdapter();
DataTable detallePoliza = (DataTable)dtdetallepoliza.GetData(ajusteId);
informeBasico.OpenSubreport("crIBDetallePoliza.rpt").SetDataSource(detallePoliza);
dsReporteTableAdapters.InformeBasicoPolizaTableAdapter dtPoliza = new dsReporteTableAdapters.InformeBasicoPolizaTableAdapter();
DataTable poliza = (DataTable)dtPoliza.GetData(ajusteId);
informeBasico.OpenSubreport("crIBPoliza.rpt").SetDataSource(poliza);
dsReporteTableAdapters.InformeBasicoFechaAvisoCoordinacionTableAdapter dtfechacoordinacion = new dsReporteTableAdapters.InformeBasicoFechaAvisoCoordinacionTableAdapter();
DataTable fechaCoordinacion = (DataTable)dtfechacoordinacion.GetData(ajusteId);
informeBasico.OpenSubreport("crIBFechaAviso.rpt").SetDataSource(fechaCoordinacion);
dsReporteTableAdapters.InformeBasicoGeneralesTableAdapter dtgenerales = new dsReporteTableAdapters.InformeBasicoGeneralesTableAdapter();
DataTable datosgenerales = (DataTable)dtgenerales.GetData(ajusteId);
informeBasico.OpenSubreport("crIBGenerales.rpt").SetDataSource(datosgenerales);
dsReporteTableAdapters.InformeBasicoCabeceraTableAdapter cabeceraAdapter = new dsReporteTableAdapters.InformeBasicoCabeceraTableAdapter();
informeBasico.SetDataSource((DataTable)cabeceraAdapter.GetData(ajusteId));
//informeBasico.FileName = "InformeBasico" + ajusteId + ".pdf";
ExportOptions informeOpcion = new ExportOptions();
informeOpcion.ExportFormatType = ExportFormatType.PortableDocFormat;
informeOpcion.ExportDestinationType = ExportDestinationType.DiskFile;
DiskFileDestinationOptions destino = new DiskFileDestinationOptions();
nombre = "InformeBasicoAYP.pdf";
destino.DiskFileName = ruta + "informes\\" + nombre;
informeOpcion.ExportDestinationOptions = destino;
informeBasico.Export(informeOpcion);
//dsReporteTableAdapters.InformeBasicoSelectTableAdapter tainforme = new dsReporteTableAdapters.InformeBasicoSelectTableAdapter();
//tainforme.Insert(ajusteId, nombre, ruta + "informes\\");
MemoryStream oStream;
oStream = (MemoryStream)informeBasico.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
return oStream.ToArray();
}
示例9: getConvenioAjuste
private static ReportDocument getConvenioAjuste(decimal ajusteId, string ApplicationPath)
{
// Instancia del reporte
String reportPath = ApplicationPath + "\\docs\\crConvenioAjuste.rpt";
ReportDocument convenioAjuste = new ReportDocument();
convenioAjuste.Load(reportPath);
dsReporteTableAdapters.InformeBasicoCabeceraTableAdapter cabeceraAdapter = new dsReporteTableAdapters.InformeBasicoCabeceraTableAdapter();
convenioAjuste.OpenSubreport("Cabecera").SetDataSource((DataTable)cabeceraAdapter.GetData(Convert.ToInt32(ajusteId)));
dsReporteTableAdapters.ConvenioAjusteTableAdapter convenioAdapter = new dsReporteTableAdapters.ConvenioAjusteTableAdapter();
convenioAjuste.SetDataSource((DataTable)convenioAdapter.GetData(Convert.ToDecimal(ajusteId)));
convenioAjuste.SetParameterValue("montoIndemnizacion", GestorAjuste.dameTotalIndemnizacion(ajusteId));
return convenioAjuste;
}
示例10: ShowReport
public static void ShowReport(ReportDocument rptObject, string[] pstrSubRepName, DataSet dataSetName, string forMat)
{
int lintCtr = 0;
try
{
if (dataSetName.Tables[0].Rows.Count > 0)
{
rptObject.Database.Tables[0].SetDataSource(dataSetName);
for (lintCtr = 0; lintCtr < pstrSubRepName.GetLength(0); lintCtr++)
{
rptObject.OpenSubreport(pstrSubRepName[lintCtr]).SetDataSource(dataSetName);
}
ShowReportFromStream(rptObject, forMat);
}
}
catch (Exception ex)
{
if (ex.Message.ToString() != "Thread was being aborted.")
{
Console.Write(ex);
}
}
finally
{
rptObject.Dispose();
rptObject = null;
dataSetName.Dispose();
dataSetName = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
示例11: _loadReport
//.........这里部分代码省略.........
}
}
subBasicAccount.HeadName = headName;
subBasicAccount.SubBasicAccountName = ACC_SubBasicAccountManager.GetACC_SubBasicAccountBySubBasicAccountID(subBasicAccount.SubBasicAccountID).SubBasicAccountName;
subBasicAccount.Asset = debit - credit;
sumAssets = sumAssets + subBasicAccount.Asset;
subBasicAccount.SumAsset = sumAssets;
subBasicAccount.AssetAccountName = subBasicAccount.SubBasicAccountName;
assets.Add(subBasicAccount);
}
else if (subBasicAccount.BasicAccountID == 4)
{
List<ACC_Account> accounts = ACC_AccountManager.GetAllAccountBySubBasicAccountID(subBasicAccount.SubBasicAccountID);
foreach (ACC_Account account in accounts)
{
List<ACC_Journal> accountJournals = ACC_JournalManager.ViewAllACC_JournalsByAccountID(account.AccountID, startDate, endDate);
foreach (ACC_Journal accountJournal in accountJournals)
{
credit = credit + accountJournal.Credit;
debit = debit + accountJournal.Debit;
headName = accountJournal.HeadName;
}
}
subBasicAccount.HeadName = headName;
subBasicAccount.SubBasicAccountName = ACC_SubBasicAccountManager.GetACC_SubBasicAccountBySubBasicAccountID(subBasicAccount.SubBasicAccountID).SubBasicAccountName;
subBasicAccount.Liability = credit - debit;
sumLiability = sumLiability + subBasicAccount.Liability;
subBasicAccount.SumLiability = sumLiability;
subBasicAccount.LiabilityAccountName = subBasicAccount.SubBasicAccountName;
liability.Add(subBasicAccount);
}
else if (subBasicAccount.BasicAccountID == 5)
{
List<ACC_Account> accounts = ACC_AccountManager.GetAllAccountBySubBasicAccountID(subBasicAccount.SubBasicAccountID);
foreach (ACC_Account account in accounts)
{
List<ACC_Journal> accountJournals = ACC_JournalManager.ViewAllACC_JournalsByAccountID(account.AccountID, startDate, endDate);
foreach (ACC_Journal accountJournal in accountJournals)
{
credit = credit + accountJournal.Credit;
debit = debit + accountJournal.Debit;
headName = accountJournal.HeadName;
}
}
subBasicAccount.HeadName = headName;
subBasicAccount.SubBasicAccountName = ACC_SubBasicAccountManager.GetACC_SubBasicAccountBySubBasicAccountID(subBasicAccount.SubBasicAccountID).SubBasicAccountName;
subBasicAccount.Capital = credit - debit;
sumCapital = sumCapital + subBasicAccount.Capital;
subBasicAccount.SumCapital = sumCapital;
subBasicAccount.CapitalAccountName = subBasicAccount.SubBasicAccountName;
capital.Add(subBasicAccount);
}
}
ACC_SubBasicAccount subBasic = new ACC_SubBasicAccount();
subBasic.StartDate = txtStartDate.Text;
subBasic.EndDate = txtEndDate.Text;
//if (sumExpense > 0 && sumIncome > sumExpense)
//{
// subBasic.NetIncome = sumIncome - sumExpense;
//}
//else
//{
// subBasic.NetIncome = 0;
//}
balanseSheet.Add(subBasic);
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("~/Accounting/Report/BalanceSheetView.rpt"));
rptDoc.OpenSubreport("AssetBalanceSheet.rpt").SetDataSource(assets);
rptDoc.OpenSubreport("CapitalBalanceSheet.rpt").SetDataSource(capital);
rptDoc.OpenSubreport("LiabilityBalanceSheet.rpt").SetDataSource(liability);
rptDoc.SetDataSource(balanseSheet);
this.crvBalanceSheet.EnableDatabaseLogonPrompt = false;
crvBalanceSheet.ReportSource = rptDoc;
crvBalanceSheet.Zoom(83);
}
示例12: getAmpliatorio
private static ReportDocument getAmpliatorio(decimal inspeccionId, decimal ampliatorioId , string ApplicationPath)
{
decimal vehiculoId = GestorInspeccion.getVehiculoId(inspeccionId);
// Instancia del reporte
String reportPath = ApplicationPath + "\\Reportes\\crAmpliatorio.rpt";
ReportDocument informe = new ReportDocument();
informe.Load(reportPath);
dsReporteTableAdapters.CabeceraTableAdapter dtCabecera = new dsReporteTableAdapters.CabeceraTableAdapter();
try
{
DataTable cabecera = (DataTable)dtCabecera.GetData(vehiculoId);
informe.OpenSubreport("crCabecera.rpt").SetDataSource(cabecera);
}
catch (Exception Ex)
{
Console.Write(Ex.Message);
}
dsReporteTableAdapters.DatosGeneralesTableAdapter dtDatosGenerales = new dsReporteTableAdapters.DatosGeneralesTableAdapter();
try
{
DataTable datosGenerales = (DataTable)dtDatosGenerales.GetData(inspeccionId);
informe.OpenSubreport("crDatosGenerales.rpt").SetDataSource(datosGenerales);
}
catch (Exception Ex)
{
Console.Write(Ex.Message);
}
dsReporteTableAdapters.InformeAmpliatorioTableAdapter dtDatosAmpliatorio = new dsReporteTableAdapters.InformeAmpliatorioTableAdapter();
try
{
DataTable ContenidoAmpliatorio = (DataTable)dtDatosAmpliatorio.GetData(ampliatorioId);
informe.OpenSubreport("crContenido.rpt").SetDataSource(ContenidoAmpliatorio);
}
catch (Exception Ex)
{
Console.Write(Ex.Message);
}
dsReporteTableAdapters.AmpliatorioImagenesTableAdapter dtImagenes = new dsReporteTableAdapters.AmpliatorioImagenesTableAdapter();
DataTable imagenes = (DataTable)dtImagenes.GetData(ampliatorioId);
if (imagenes.Rows.Count > 0)
informe.OpenSubreport("crIBImagen.rpt").SetDataSource(imagenes);
else
informe.ReportDefinition.Sections["Imagenes"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.CabeceraDetalleTableAdapter cabeceraAdapter = new dsReporteTableAdapters.CabeceraDetalleTableAdapter();
informe.SetDataSource((DataTable)cabeceraAdapter.GetData(Convert.ToInt32(inspeccionId)));
return informe;
}
示例13: getInforme
private static ReportDocument getInforme(decimal vehiculoId, string ApplicationPath)
{
decimal? inspeccionId = CarCheck.Gestores.GestorInspeccion.getInspeccionId(vehiculoId);
// Instancia del reporte
String reportPath = ApplicationPath + "\\Reportes\\crInforme.rpt";
ReportDocument informe = new ReportDocument();
informe.Load(reportPath);
dsReporteTableAdapters.CabeceraTableAdapter dtCabecera = new dsReporteTableAdapters.CabeceraTableAdapter();
try
{
DataTable cabecera = (DataTable)dtCabecera.GetData(Convert.ToInt32(vehiculoId));
informe.OpenSubreport("crCabecera.rpt").SetDataSource(cabecera);
}
catch (Exception Ex)
{
Console.Write(Ex.Message);
}
dsReporteTableAdapters.DatosGeneralesTableAdapter dtDatosGenerales = new dsReporteTableAdapters.DatosGeneralesTableAdapter();
try
{
DataTable datosGenerales = (DataTable)dtDatosGenerales.GetData(Convert.ToInt32(inspeccionId));
informe.OpenSubreport("crDatosGenerales.rpt").SetDataSource(datosGenerales);
}
catch (Exception Ex)
{
Console.Write(Ex.Message);
}
dsReporteTableAdapters.VehiculoTableAdapter dtVehiculo = new dsReporteTableAdapters.VehiculoTableAdapter();
DataTable vehiculo = (DataTable)dtVehiculo.GetData(Convert.ToInt32(vehiculoId));
informe.OpenSubreport("crDatosVehiculo.rpt").SetDataSource(vehiculo);
dsReporteTableAdapters.CaracteristicasExterioresTableAdapter dtCaracteristicasExteriores = new dsReporteTableAdapters.CaracteristicasExterioresTableAdapter();
DataTable caracteristicasExteriores = (DataTable)dtCaracteristicasExteriores.GetData(Convert.ToInt32(vehiculoId));
if (caracteristicasExteriores.Rows.Count > 0)
informe.OpenSubreport("crCaracteristicasExteriores.rpt").SetDataSource(caracteristicasExteriores);
else
informe.ReportDefinition.Sections["CaracteristicasExteriores"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.CaracteristicasSalonTableAdapter dtCaracteristicasSalon = new dsReporteTableAdapters.CaracteristicasSalonTableAdapter();
DataTable caracteristicasSalon = (DataTable)dtCaracteristicasSalon.GetData(Convert.ToInt32(vehiculoId));
if (caracteristicasSalon.Rows.Count > 0)
informe.OpenSubreport("crCaracteristicasSalon.rpt").SetDataSource(caracteristicasSalon);
else
informe.ReportDefinition.Sections["CaracteristicasSalon"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.EquipoSonidoTableAdapter dtEquipo = new dsReporteTableAdapters.EquipoSonidoTableAdapter();
DataTable equipo = (DataTable)dtEquipo.GetData(Convert.ToInt32(vehiculoId));
if (equipo.Rows.Count > 0)
informe.OpenSubreport("crEquipoSonido.rpt").SetDataSource(equipo);
else
informe.ReportDefinition.Sections["EquipoSonido"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.CaracteristicasAudioTableAdapter dtAudio = new dsReporteTableAdapters.CaracteristicasAudioTableAdapter();
DataTable accesoriosSonido = (DataTable)dtAudio.GetData(Convert.ToInt32(vehiculoId));
if (accesoriosSonido.Rows.Count > 0)
informe.OpenSubreport("crAccesoriosAudio.rpt").SetDataSource(accesoriosSonido);
else
informe.ReportDefinition.Sections["AccesoriosAudio"].SectionFormat.EnableSuppress = true;
if ((accesoriosSonido.Rows.Count == 0) && (equipo.Rows.Count == 0))
{
informe.ReportDefinition.Sections["tituloAudioVideo"].SectionFormat.EnableSuppress = true;
}
dsReporteTableAdapters.OtrosAccesoriosTableAdapter dtAccesorios = new dsReporteTableAdapters.OtrosAccesoriosTableAdapter();
DataTable accesorios = (DataTable)dtAccesorios.GetData(Convert.ToInt32(vehiculoId));
if (accesorios.Rows.Count > 0)
informe.OpenSubreport("crAccesorios.rpt").SetDataSource(accesorios);
else
informe.ReportDefinition.Sections["Accesorios"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.LlantasTableAdapter dtLlantas = new dsReporteTableAdapters.LlantasTableAdapter();
DataTable llantas = (DataTable)dtLlantas.GetData(Convert.ToInt32(vehiculoId));
if (llantas.Rows.Count > 0)
informe.OpenSubreport("crLlantas.rpt").SetDataSource(llantas);
else
informe.ReportDefinition.Sections["llantas"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.DamagesTableAdapter dtDamage = new dsReporteTableAdapters.DamagesTableAdapter();
DataTable damages = (DataTable)dtDamage.GetData(Convert.ToInt32(vehiculoId));
if (damages.Rows.Count > 0)
informe.OpenSubreport("crDaños.rpt").SetDataSource(damages);
else
informe.ReportDefinition.Sections["Danos"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.AlarmaTableAdapter dtAlarma = new dsReporteTableAdapters.AlarmaTableAdapter();
DataTable alarma = (DataTable)dtAlarma.GetData(Convert.ToInt32(vehiculoId));
if (alarma.Rows.Count > 0)
informe.OpenSubreport("crAlarma.rpt").SetDataSource(alarma);
else
informe.ReportDefinition.Sections["Alarma"].SectionFormat.EnableSuppress = true;
dsReporteTableAdapters.IdenticarTableAdapter dtIdenticar = new dsReporteTableAdapters.IdenticarTableAdapter();
//.........这里部分代码省略.........
示例14: CRAllProducts
public ActionResult CRAllProducts(int? id)
{
List<Product> allProducts = new List<Product>();
allProducts = db.Products.ToList();
List<Company> company = new List<Company>();
company = db.Companies.ToList();
List<AllProductsCRViewModel> allProductsCR = new List<AllProductsCRViewModel>();
foreach (var item in allProducts)
{
var allProductCR = new AllProductsCRViewModel();
allProductCR.ProductId = item.ProductId;
allProductCR.ProductName = item.ProductName;
allProductCR.ProductCode = item.ProductCode;
allProductCR.Brand = item.Brand;
allProductCR.Auvibel = item.Auvibel;
allProductCR.Bebat = item.Bebat;
allProductCR.Recupel = item.Recupel;
allProductCR.Reprobel = item.Reprobel;
allProductCR.PurchasePrice = item.PurchasePrice;
allProductCR.PriceExVAT = item.PriceExVAT;
allProductCR.VATPercId = item.VATPercId;
allProductCR.Remark = item.Remark;
allProductCR.Stock = item.Stock;
allProductCR.Description = item.Description;
allProductCR.EAN = item.EAN;
allProductCR.CategoryId = item.CategoryId;
allProductCR.CategoryName = item.Category.CategoryName;
allProductCR.VATValue = item.VAT.VATValue;
allProductCR.Active = item.Active;
allProductsCR.Add(allProductCR);
}
ReportDocument rd = new ReportDocument();
rd.Load(Path.Combine(Server.MapPath("~/Reports"), "AllProductsMain.rpt"));
rd.OpenSubreport("Header.rpt").SetDataSource(company);
rd.OpenSubreport("allProductsSub.rpt").SetDataSource(allProductsCR);
//rd.SetDataSource(company);
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
try
{
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf", "All_Products.pdf");
}
catch (Exception ex)
{
if (ex.Data == null)
{
throw;
}
else
{
throw;
}
}
}