public ReportClass GetTicketReport(TicketInfo item) { if (item == null) { return(null); } List <ConceptoTicketPrint> conceptos = new List <ConceptoTicketPrint>(); List <TicketPrint> pList = new List <TicketPrint>(); foreach (ConceptoTicketInfo cfi in item.ConceptoTickets) { conceptos.Add(cfi.GetPrintObject()); } //Si no existen conceptos, no tiene sentido un informe detallado. Además, falla en Crystal Reports if (conceptos.Count <= 0) { return(null); } pList.Add(TicketPrint.New(item)); ProductList productos = ProductList.GetList(false); ReportClass doc = null; try { doc = GetReportFromName("Ticket", "TicketRpt"); } catch { doc = new TicketRpt(); } doc.SetDataSource(pList); doc.Subreports["ConceptosRpt"].SetDataSource(conceptos); Library.Common.CompanyInfo empresa = Library.Common.CompanyInfo.Get(Schema.Oid, false); doc.SetParameterValue("nombreEmpresa", empresa.Name); doc.SetParameterValue("dirEmpresa", empresa.Direccion); doc.SetParameterValue("dir2Empresa", empresa.CodPostal + ". " + empresa.Municipio + ". " + empresa.Provincia); doc.SetParameterValue("CIFEmpresa", empresa.VatNumber); doc.SetParameterValue("TlfEmpresa", empresa.Telefonos); doc.SetParameterValue("FaxEmpresa", empresa.Fax); return(doc); }
public ReportClass GetDetailReport(OutputInvoiceInfo item, SerieInfo serie, ClienteInfo cliente, TransporterInfo transporter, FormatConfFacturaAlbaranReport conf) { if (item == null) { return(null); } List <OutputInvoiceLinePrint> conceptos = new List <OutputInvoiceLinePrint>(); List <OutputInvoicePrint> pList = new List <OutputInvoicePrint>(); foreach (OutputInvoiceLineInfo cfi in item.ConceptoFacturas) { conceptos.Add(cfi.GetPrintObject()); } //Si no existen conceptos, no tiene sentido un informe detallado. Además, falla en Crystal Reports if (conceptos.Count <= 0) { return(null); } pList.Add(OutputInvoicePrint.New(item, cliente, transporter, serie)); ProductList productos = ProductList.GetList(false); foreach (OutputInvoiceLinePrint cfp in conceptos) { if (cfp.OidProducto == 0) { continue; } ProductInfo prod = productos.GetItem(cfp.OidProducto); if (prod != null) { continue; } if (prod.AyudaKilo > 0) { cfp.Concepto += " *"; } } List <ImpuestoResumen> impuestos = new List <ImpuestoResumen>(); foreach (DictionaryEntry impuesto in item.GetImpuestos()) { impuestos.Add((ImpuestoResumen)impuesto.Value); } ReportClass doc = null; try { doc = GetReportFromName("Invoice", "OutputInvoiceRpt"); } catch { doc = new OutputInvoiceRpt(); } doc.SetDataSource(pList); doc.Subreports["ConceptosRpt"].SetDataSource(conceptos); if (doc.Subreports["ImpuestoResumenRpt"] != null) { doc.Subreports["ImpuestoResumenRpt"].SetDataSource(impuestos); } Library.Common.CompanyInfo empresa = Library.Common.CompanyInfo.Get(Schema.Oid, false); doc.SetParameterValue("nombreEmpresa", empresa.Name); doc.SetParameterValue("dirEmpresa", empresa.Direccion); doc.SetParameterValue("dir2Empresa", empresa.CodPostal + ". " + empresa.Municipio + ". " + empresa.Provincia); doc.SetParameterValue("CIFEmpresa", empresa.VatNumber); doc.SetParameterValue("TlfEmpresa", empresa.Telefonos); doc.SetParameterValue("FaxEmpresa", empresa.Fax); doc.SetParameterValue("WebEmpresa", empresa.Url); doc.SetParameterValue("nota", conf.nota); doc.SetParameterValue("ACuenta", (item.CobroFacturas != null) ? item.CobroFacturas.GetTotal() : 0); doc.SetParameterValue("CPEmpresa", empresa.CodPostal); doc.SetParameterValue("municipioEmpresa", empresa.Municipio); return(doc); }