private void SetReportLogo(ReporteBase reporte) { const string nombreLogo = "Pictures/Logo{0}.jpg"; //{0} = IdEmpresa reporte.picLogoCabecera.ImageUrl = System.Web.HttpContext.Current.Request.MapPath( string.Format(nombreLogo,UnReporte.oEmpresa.EmpresaID.ToString()) ); }
private void ReporteLlenarCamposEspecificos(TipoDocumento tipoDoc, ReporteBase reporteBase) { Type tipoEspecifico = reporteBase.GetType(); if (typeof(Sprayette) == tipoEspecifico) { Sprayette reporteEspecifico = (Sprayette)reporteBase; //reporteEspecifico.txtEmpresa.Visible = false; reporteEspecifico.picLogoCabecera.Visible = true; //Por ahora, sea A o B se muestra el mismo campo. Lo dejo preparado por si cambia. if (UnReporte.LetraCbte != "B") reporteEspecifico.xrTableCellPrecioUnitario.DataBindings.Add("Text", null, "ImportePrecioUnitarioMonedaFacturacion"); else reporteEspecifico.xrTableCellPrecioUnitario.DataBindings.Add("Text", null, "ImportePrecioUnitarioMonedaFacturacion"); if (reporteEspecifico.xrTableCellPrecioUnitario.DataBindings[0] != null) reporteEspecifico.xrTableCellPrecioUnitario.DataBindings[0].FormatString = FORMATO_NRO; reporteEspecifico.xrTableCellCantidad.DataBindings.Add("Text", null, "CANTIDAD"); //Datos de la empresa. reporteEspecifico.txtEmpresa.Text = UnReporte.oEmpresa.RazonSocial; reporteEspecifico.txtEmpresa.Visible = true; //Datos de la empresa, panel izquierdo. reporteEspecifico.rtbDatosEmpresa.Text = string.Format(reporteEspecifico.rtbDatosEmpresa.Text, UnReporte.oEmpresa.Direccion, UnReporte.oEmpresa.Localidad, UnReporte.oEmpresa.Pais, UnReporte.oEmpresa.Telefono); //Datos de la empresa, panel derecho. reporteEspecifico.rtbDatosEmpresa3.Text = string.Format(reporteEspecifico.rtbDatosEmpresa3.Text, UnReporte.oEmpresa.NroDocumento, UnReporte.oEmpresa.CodigoTipoResponsableAnteAFIP, UnReporte.oEmpresa.NroIIBB, UnReporte.oEmpresa.AgRecaudacionIIBB, UnReporte.oEmpresa.ImpuestosInternos, Convert.ToDateTime(UnReporte.oEmpresa.InicioActividades).ToString("dd/MM/yyyy")); SetReportLogo(reporteEspecifico); } }
public void SaveDocumentInDB(ReporteBase reporte, TipoDocumento strType) { try { var oSettings = new Settings(UnReporte.oEmpresa.EmpresaID); string pathName = oSettings.PathImpresion + @"\TEMP_SITEDOWNLOADS\"; string fileName = pathName + UnReporte.CbteID; try { //Si no existe el path, intento crearlo. if (!System.IO.Directory.Exists(pathName)) System.IO.Directory.CreateDirectory(pathName); } catch (Exception ex) { throw new Exception("No se pudo crear el Path: " + pathName, ex); } //El componente genera el archivo pdf. reporte.ExportToPdf(fileName); //Abro el Pdf creado por el componente, lo convierto en bytes, y lo guardo en la DB. using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { byte[] archivoPdf = new byte[fs.Length]; fs.Read(archivoPdf, 0, archivoPdf.Length); var sqlEngine = new DBEngine.SQLEngine(); if (sqlEngine.Open()) { sqlEngine.SavePdfInDB(archivoPdf, UnReporte.CbteID, UnReporte.TipoDeCopia.ToString()); sqlEngine.Close(); } } //Si se creo el archivo, lo elimino. if (System.IO.File.Exists(fileName)) System.IO.File.Delete(fileName); } catch (Exception) { throw; } }
/// <summary> /// Bindeo el detalle del documento, a los campos correspondientes de 'LinesTable'. /// </summary> /// <param name="tipoDoc"></param> /// <param name="LinesTable"></param> /// <param name="reporte"></param> public void ReporteLlenarImpuestos(TipoDocumento tipoDoc, DataTable Impuestos, ReporteBase reporte) { //Fill Details //reporte.DataSource = Impuestos; int i = 0; string descrip = ""; double import = 0.0F; foreach (DataRow dr in Impuestos.Rows) { i=i+1; descrip = dr.Field<string>("Descripcion"); import = dr.Field<double>("Importe"); if (UnReporte.LetraCbte.Equals("A")) { if (i == 1) AgregarRegistroImporte(reporte.xrTableImportes, descrip, String.Format(FORMATO_NRO, import)); if (i == 2) AgregarRegistroImporte(reporte.xrTableImportes, descrip, String.Format(FORMATO_NRO, import)); } if (i == 3) AgregarRegistroImporte(reporte.xrTableImportes, descrip, String.Format(FORMATO_NRO, import)); if (i == 4) AgregarRegistroImporte(reporte.xrTableImportes, descrip, String.Format(FORMATO_NRO, import)); } }
/// <summary> /// Bindeo el detalle del documento, a los campos correspondientes de 'LinesTable'. /// </summary> /// <param name="tipoDoc"></param> /// <param name="LinesTable"></param> /// <param name="reporte"></param> public void ReporteLlenarDetalle(TipoDocumento tipoDoc, DataTable LinesTable, ReporteBase reporte) { //Fill Details reporte.DataSource = LinesTable; reporte.xrTableCellDetalle.DataBindings.Add("Text", null, LinesTable.Columns["Descripcion"].Caption); if (UnReporte.LetraCbte != "B") reporte.xrTableCellTotal.DataBindings.Add("Text", null, LinesTable.Columns["ImporteSubtotalMonedaFacturacion"].Caption); else reporte.xrTableCellTotal.DataBindings.Add("Text", null, LinesTable.Columns["ImporteSubtotalMonedaFacturacionConIVA"].Caption); if (reporte.xrTableCellTotal.DataBindings[0] != null) reporte.xrTableCellTotal.DataBindings[0].FormatString = FORMATO_NRO; }
/// <summary> /// Cargo el valor de cada campo del Reporte (excepto los del detalle). /// </summary> /// <param name="tipoDoc"></param> /// <param name="reporte"></param> public void ReporteLlenarCampos(TipoDocumento tipoDoc, ReporteBase reporte) { reporte.txtTipo.Text = GetTipoDocDesc(tipoDoc); reporte.rtbDatosEmpresa.Rtf = reporte.rtbDatosEmpresa.Rtf.Replace("Data1", UnReporte.EmisorCalle); reporte.rtbDatosEmpresa.Rtf = reporte.rtbDatosEmpresa.Rtf.Replace("Data2", UnReporte.EmisorLocalidad + " - " + UnReporte.EmisorPais); reporte.rtbDatosEmpresa.Rtf = reporte.rtbDatosEmpresa.Rtf.Replace("Data3", UnReporte.EmisorTelefonos); reporte.rtbDatosEmpresa.Rtf = reporte.rtbDatosEmpresa.Rtf.Replace("Data4", UnReporte.EmisorEMail); reporte.txtCae.Text = UnReporte.CAE; reporte.txtCondiciondeVenta.Text = UnReporte.CondicionDeVenta; reporte.txtDomicilio.Text = UnReporte.Domicilio; reporte.txtFechaVto.Text = UnReporte.FechaVto; reporte.txtFechaCbte.Text = UnReporte.FechaCbte; reporte.txtLetraCbte.Text = UnReporte.LetraCbte; reporte.txtNombreEmpresa.Text = UnReporte.NombreEmpresa; reporte.txtNroCbte.Text = UnReporte.NroCbte; reporte.txtNumCodigo.Text = UnReporte.NumCodigo; reporte.txtNumCuit.Text = UnReporte.NumCuit; reporte.txtNumIIBB.Text = UnReporte.NumIIBB; reporte.txtNumCodIIBB.Text = UnReporte.NumCodIIBB; reporte.txtRefInterna.Text = UnReporte.RefInterna; reporte.txtSon.Text = UnReporte.Son; reporte.txtTipoCbte.Text = UnReporte.TipoCbte; reporte.txtTipoIva.Text = UnReporte.TipoIva; reporte.txtMoneda.Text = UnReporte.Moneda; reporte.txtObservaciones3.Text = UnReporte.ObservacionesPie; reporte.txtBarCodeCbte.Text = UnReporte.BarCodeCbte; reporte.txtCondiciondeVenta.Text = UnReporte.CondicionDePago; //UnReporte.CondiciondeVenta; reporte.txtLugarDeEntrega.Text = UnReporte.ObservacionesCabecera; //Observacion Cabecera = Observaciones1 //Actualizo segun TasaIIBB el nombre del campo IIBB del grupo de totales. reporte.lbl10.Text = UnReporte.TasaIIBB; //Campo SubTotal suma gravado + nogravado //reporte.txtSubtotal.Text = UnReporte.ImporteSubTotal.ToMoney(); AgregarRegistroImporte(reporte.xrTableImportes, "Sub Total", UnReporte.ImporteSubTotal.ToMoney(),true); if (UnReporte.LetraCbte != "B") { reporte.txtPercepcionIIBBDocsB.Text = string.Empty; reporte.lblTituloPercepcionIIBBDocsB.Text = string.Empty; if (Convert.ToDecimal(UnReporte.ImpuestoSubGrav) > 0) { /* reporte.txtSUBGRAVTotal.Visible = true; reporte.txtSUBGRAVTotal.Text = UnReporte.ImpuestoSubGrav.ToMoney(); reporte.lblSubGrav.Visible = true; reporte.lblSubGrav.Text = "Importe Gravado"; **/ AgregarRegistroImporte(reporte.xrTableImportes, "Importe Gravado", UnReporte.ImpuestoSubGrav.ToMoney()); } if (Convert.ToDecimal(UnReporte.ImporteSubNoGrav) > 0) { /* reporte.txtSUBNOGRAVTotal.Visible = true; reporte.txtSUBNOGRAVTotal.Text = UnReporte.ImporteSubNoGrav.ToMoney(); reporte.lblSubNoGrav.Visible = true; reporte.lblSubNoGrav.Text = "Importe No Gravado"; */ AgregarRegistroImporte(reporte.xrTableImportes, "Importe No Gravado", UnReporte.ImporteSubNoGrav.ToMoney()); } } else { //Documento 'B' //Oculto los campos que no corresponden a comprobantes B. reporte.xrLine1.Visible = true; //Primera linea que separa el detalle de los totales. reporte.txtImporteIIBBMonedaFacturacion.Visible = false; reporte.txtImporteIIBBMonedaFacturacion.Visible = false; reporte.lbl10.Visible = false; //Si un documento B tiene percepcion IIBB y 'TasaIIBB' tiene una descripcion, se muestra en un campo aparte. if (UnReporte.TasaIIBB != string.Empty && UnReporte.TotalPercepcionIIBB != string.Empty && Convert.ToDecimal(UnReporte.TotalPercepcionIIBB) > 0) { reporte.txtPercepcionIIBBDocsB.Text = UnReporte.TotalPercepcionIIBB.ToMoney(); reporte.lblTituloPercepcionIIBBDocsB.Text = UnReporte.TasaIIBB; } else { reporte.txtPercepcionIIBBDocsB.Text = string.Empty; reporte.lblTituloPercepcionIIBBDocsB.Text = string.Empty; } } //Si no hay titulo para el campo, obviamente, oculto el valor. if (UnReporte.TasaIIBB.Trim() == string.Empty) reporte.txtImporteIIBBMonedaFacturacion.Visible = false; //reporte.txtSUBGRAVTotal.Text = UnReporte.TotalIva.ToMoney(); reporte.txtImporteIIBBMonedaFacturacion.Text = UnReporte.TotalPercepcionIIBB.ToMoney(); reporte.txtTotal.Text = UnReporte.Total.ToMoney(); reporte.txtBarCodeRapipago.Text = UnReporte.Rapipago; reporte.txtBarcodeRapipago2.Text = UnReporte.Rapipago; reporte.txtDAGRUF.Text = UnReporte.DAGRUF; if (UnReporte.OPER != string.Empty | UnReporte.NOPER != string.Empty) reporte.txCPer.Text = UnReporte.OPER + " - " + UnReporte.NOPER; if (UnReporte.FACTORI_FORMATEADO != string.Empty) { reporte.txtRefInterna.Text = UnReporte.FACTORI_FORMATEADO; //"Comprobante asociado DOC Nº: " + UnReporte.FACTORI; reporte.txtRefInterna.Visible = true; } else { reporte.txtRefInterna.Text = string.Empty; reporte.txtRefInterna.Visible = false; } reporte.txtUsuario.Text = UnReporte.USUARIO; //reporte.txtErrorCodigo.Text = UnReporte.ERRORCODIGO; reporte.txtInformacionAdicional.Text = UnReporte.ObservacionesCuerpo; //Lleno los campos que solo estan en un reporte o el otro. ReporteLlenarCamposEspecificos(tipoDoc, reporte); }