public static Response <VentaResponse> VentaUpdatePostergacionEle(FechaAbiertaRequest filtro) { try { var valor = new VentaResponse(); var listaVentasRealizadas = new List <VentaRealizadaEntity>(); // Verifica 'CodiProgramacion' var objProgramacion = new ProgramacionEntity() { NroViaje = filtro.NroViaje, FechaProgramacion = filtro.FechaProgramacion, CodiProgramacion = filtro.CodiProgramacion, CodiEmpresa = filtro.CodiEmpresa, CodiSucursal = filtro.CodiSucursal, CodiRuta = filtro.CodiRutaBus, CodiBus = filtro.CodiBus, HoraProgramacion = filtro.HoraProgramacion, CodiServicio = byte.Parse(filtro.CodiServicio.ToString()), CodiUsuario = filtro.CodiUsuario.ToString(), NomUsuario = filtro.NomUsuario, CodiPuntoVenta = filtro.CodiPuntoVenta, Terminal = filtro.Terminal, CodiOrigen = filtro.CodiOrigen, CodiDestino = filtro.CodiDestino, NomOrigen = filtro.NomSucursal }; var verificaCodiProgramacion = VentaLogic.VerificaCodiProgramacion(objProgramacion); if (verificaCodiProgramacion == 0) { return(new Response <VentaResponse>(false, valor, Message.MsgErrorVerificaCodiProgramacion, false)); } else { filtro.CodiProgramacion = verificaCodiProgramacion; } // Seteo 'valor.CodiProgramacion' valor.CodiProgramacion = filtro.CodiProgramacion; var venta = VentaRepository.BuscarVentaById(filtro.IdVenta); if (venta.CodiProgramacion != 0) { return(new Response <VentaResponse>(false, valor, Message.MsgExcSeEncontrabaEnFechaAbierta, false)); } FechaAbiertaRepository.VentaUpdatePostergacionEle(filtro); FechaAbiertaRepository.VentaUpdateImpManifiesto(filtro.IdVenta); FechaAbiertaRepository.VentaDerivadaUpdateViaje(filtro.IdVenta, filtro.FechaViaje, filtro.HoraViaje, filtro.CodiServicio); var objAuditoria = new AuditoriaEntity { CodiUsuario = filtro.CodiUsuario, // NomUsuario = filtro.NomUsuario, // Tabla = "VENTA", TipoMovimiento = "CONFIRMA FECHA ABIERTA", Boleto = filtro.Serie.PadLeft(3, '0') + "-" + filtro.Numero.PadLeft(7, '0'), NumeAsiento = filtro.NumeAsiento.PadLeft(2, '0'), NomOficina = filtro.NomSucursal, // NomPuntoVenta = filtro.CodiPuntoVenta.PadLeft(3, '0'), // Pasajero = filtro.Nombre, FechaViaje = filtro.FechaViaje, HoraViaje = filtro.HoraViaje, NomDestino = filtro.NombDestino, Precio = decimal.Parse(filtro.Precio), Obs1 = "CONFIRMACION FECHA ABIERTA", Obs2 = string.Empty, Obs3 = string.Empty, Obs4 = string.Empty, Obs5 = string.Empty }; VentaRepository.GrabarAuditoria(objAuditoria); // Añado 'ventaRealizada' var ventaRealizada = new VentaRealizadaEntity { NumeAsiento = filtro.NumeAsiento }; listaVentasRealizadas.Add(ventaRealizada); // Seteo 'valor.ListaVentasRealizadas' valor.ListaVentasRealizadas = listaVentasRealizadas; return(new Response <VentaResponse>(true, valor, Message.MsgCorrectoVentaUpdatePostergacionEle, true)); } catch (Exception ex) { Log.Instance(typeof(FechaAbiertaLogic)).Error(System.Reflection.MethodBase.GetCurrentMethod().Name, ex); return(new Response <VentaResponse>(false, null, Message.MsgExcVentaUpdatePostergacionEle, false)); } }
public static string WriteTextCopy(VentaRealizadaEntity venta, string TipoImpresion) { StringBuilder texto = new StringBuilder(); // Impresora Térmica if (venta.TipoImpresora == 1) { texto.AppendLine(SplitStringPreserving(venta.EmpRazSocial, 30, "||||^")); texto.AppendLine(SplitStringPreserving("R.U.C. " + venta.EmpRuc, 30, "|||^")); texto.AppendLine(SplitStringPreserving(venta.EmpDireccion, 45, "^")); texto.AppendLine(SplitStringPreserving("Agencia: " + venta.EmpDirAgencia, 45, "^")); texto.AppendLine("||^" + PadBoth((venta.BoletoTipo == "F" ? "FACTURA" : "BOLETA DE VENTA") + " ELECTRÓNICA", 30)); texto.AppendLine("|^" + PadBoth(string.Format(venta.BoletoTipo + venta.BoletoSerie + "-" + venta.BoletoNum), 18)); texto.AppendLine(""); texto.AppendLine("^FECHA DE EMISIÓN : " + venta.EmisionFecha + " - " + venta.EmisionHora); if (venta.BoletoTipo == "F") { texto.AppendLine("^NRO. RUC : " + venta.PasRuc); texto.AppendLine(SplitStringPreserving("CLIENTE : " + venta.PasRazSocial, 45, "^", false)); texto.AppendLine(SplitStringPreserving("DIRECCION : " + venta.PasDireccion, 45, "^", false)); } texto.AppendLine("^COD. CAJERO : " + venta.CajeroCod); texto.AppendLine(new string('-', 42)); texto.AppendLine(""); texto.AppendLine("^TIPO VENTA: " + NameOfTipoVenta(venta.TipoPago, venta.FlagVenta)); texto.AppendLine(new string('-', 42)); texto.AppendLine(" # DESCRIPCIÓN TOTAL"); texto.AppendLine(new string('-', 42)); texto.AppendLine(" 1 SERVICIO DE TRANSPORTE EN LA " + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan)); texto.AppendLine(SplitStringPreserving("RUTA: " + venta.NomOriPas + " - " + venta.NomDesPas, 40, " ", false)); texto.AppendLine(" SERVICIO: " + venta.NomServicio); texto.AppendLine(" NRO ASIENTO: " + venta.NumeAsiento); texto.AppendLine(SplitStringPreserving("PASAJERO: " + venta.PasNombreCom, 40, " ", false)); texto.AppendLine(" DNI: " + venta.DocNumero); texto.AppendLine(" FECHA VIAJE: " + venta.FechaViaje); texto.AppendLine(" HORA EMBARQUE: " + venta.EmbarqueHora); texto.AppendLine(SplitStringPreserving("LUGAR EMBARQUE: " + venta.EmbarqueDir, 40, " ", false)); texto.AppendLine(SplitStringPreserving("DIR. EMBARQUE: " + venta.EmbarqueDirAgencia, 40, " ", false)); texto.AppendLine(""); if (TipoImpresion == TipoReimprimir) { texto.AppendLine("^FEC. REIMP.: " + DataUtility.ObtenerFechaDelSistema() + " - " + DataUtility.Obtener12HorasDelSistema() + " - " + venta.UsuarioCodigo); texto.AppendLine(""); } texto.AppendLine(new string('-', 42)); texto.AppendLine(""); texto.AppendLine(PadBoth("**** CONTROL INTERNO *****", 45)); texto.AppendLine(""); texto.AppendLine(""); texto.AppendLine(""); texto.AppendLine(""); texto.AppendLine(""); texto.AppendLine(""); texto.AppendLine(""); texto.AppendLine(new string('-', 42)); texto.AppendLine("^" + PadBoth("USUARIO CONFORME", 45)); } // Impresora Matricial else if (venta.TipoImpresora == 3) { texto.AppendLine("@@@"); texto.AppendLine("DRAFT 10CPI"); texto.AppendLine("FACT_ELE"); texto.AppendLine("@@@"); texto.AppendLine(PadBoth(venta.EmpRazSocial + " - " + "R.U.C. " + venta.EmpRuc, 80)); texto.AppendLine(PadBoth((venta.BoletoTipo == "F" ? "FACTURA" : "BOLETA DE VENTA") + " ELECTRONICA: " + venta.BoletoTipo + venta.BoletoSerie + "-" + venta.BoletoNum, 80)); texto.AppendLine(PadBoth(venta.EmbarqueDir + " - " + venta.EmpDirAgencia, 80)); texto.AppendLine("FECHA Y HORA DE EMISION".PadRight(25) + (": " + venta.EmisionFecha + " - " + venta.EmisionHora + " - " + "CAJ.: " + venta.CajeroNom).PadRight(65)); if (venta.BoletoTipo == "F") { texto.AppendLine("NRO. RUC".PadRight(25) + (": " + venta.PasRuc).PadRight(65)); texto.AppendLine("CLIENTE".PadRight(25) + (": " + venta.PasRazSocial).PadRight(65)); texto.AppendLine("DIRECCION".PadRight(25) + (": " + venta.PasDireccion).PadRight(65)); } texto.AppendLine("DOC. CLIENTE".PadRight(25) + (": " + venta.DocNumero).PadRight(65)); texto.AppendLine("PASAJERO".PadRight(25) + (": " + venta.PasNombreCom).PadRight(65)); texto.AppendLine("CONDICION DE VENTA".PadRight(25) + (": " + NameOfTipoVenta(venta.TipoPago, venta.FlagVenta)).PadRight(65)); texto.AppendLine(new string('-', 80)); texto.AppendLine(" DESCRIPCION DEL SERVICIO".PadRight(30) + "TOTAL".PadLeft(50)); texto.AppendLine(new string('-', 80)); texto.AppendLine(("|||SER. DE TRAN. DE LA RUTA " + venta.NomOriPas + " - " + venta.NomDesPas + " / " + "SERVICIO:").PadRight(70) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(10)); texto.AppendLine(venta.NomServicio + " / " + "NRO. ASIENTO: " + venta.NumeAsiento + " / " + "PASAJERO: " + venta.PasNombreCom); texto.AppendLine(" / " + "DNI: " + venta.DocNumero + " / " + "FECHA VIAJE: " + venta.FechaViaje + " / " + "HORA VIAJE: " + venta.EmbarqueHora); texto.AppendLine(new string('-', 80)); texto.AppendLine("SON: " + venta.PrecioDes); texto.AppendLine(new string('-', 80)); texto.AppendLine(("CODIGO: " + venta.CodigoX_FE).PadRight(39) + PadBoth("OP.INAFECTA", 25) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(10)); texto.AppendLine("Autorizado mediante: ".PadRight(40) + PadBoth("OP. GRAVADA", 25) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(10)); texto.AppendLine("N° " + venta.ResAut_FE + "/Sunat ".PadRight(40) + PadBoth("OP. EXONERADA", 25) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(10)); texto.AppendLine("I.G.V. 18%".PadLeft(65) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(10)); texto.AppendLine("IMPORTE TOTAL".PadLeft(65) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(10)); texto.AppendLine(new string('-', 80)); texto.AppendLine("Representación impresa de la Factura Electrónica"); texto.AppendLine(" Consulte el documento en: " + venta.LinkPag_FE); texto.AppendLine(SplitStringPreserving("Al recibir el presente documento, acepto todos los términos y/o condiciones del contratado del servicio de transporte publicados en los letreros o en los banners y detallados en la página.", 80, "", false)); texto.AppendLine(""); if (!string.IsNullOrEmpty(venta.PolizaNum)) { texto.AppendLine("CUBIERTO " + venta.PolizaNum + " " + venta.PolizaFechaReg + " - " + venta.PolizaFechaVen); texto.AppendLine(""); } texto.AppendLine(new string('-', 25)); texto.AppendLine(" USUARIO CONFORME"); texto.AppendLine("."); if (TipoImpresion == TipoReimprimir) { texto.AppendLine(""); texto.AppendLine("FECHA DE REIMPRESION: " + DataUtility.ObtenerFechaDelSistema() + " - " + DataUtility.Obtener12HorasDelSistema() + " - " + venta.UsuarioCodigo); } } // Impresora Matricial (Formato reducido) else if (venta.TipoImpresora == 4) { texto.AppendLine("@@@"); texto.AppendLine("DRAFT 17CPI"); texto.AppendLine("FACT_ELE"); texto.AppendLine("@@@"); texto.AppendLine(PadBoth(venta.EmpRazSocial + " - " + "R.U.C. " + venta.EmpRuc, 65)); texto.AppendLine(PadBoth((venta.BoletoTipo == "F" ? "FACTURA" : "BOLETA DE VENTA") + " ELECTRONICA: " + venta.BoletoTipo + venta.BoletoSerie + "-" + venta.BoletoNum, 65)); texto.AppendLine(PadBoth(venta.EmbarqueDir + " - " + venta.EmpDirAgencia, 65)); texto.AppendLine("EMITIDO".PadRight(25) + (": " + venta.EmisionFecha + " - " + venta.EmisionHora + " - " + "CAJ.: " + venta.CajeroNom).PadRight(40)); if (venta.BoletoTipo == "F") { texto.AppendLine("NRO. RUC".PadRight(25) + (": " + venta.PasRuc + " - " + venta.PasRazSocial).PadRight(40)); texto.AppendLine("DIRECCION".PadRight(25) + (": " + venta.PasDireccion).PadRight(40)); } texto.AppendLine("CLIENTE".PadRight(25) + (": " + venta.DocNumero + " - " + venta.PasNombreCom).PadRight(40)); texto.AppendLine("COD. VENTA".PadRight(25) + (": " + NameOfTipoVenta(venta.TipoPago, venta.FlagVenta)).PadRight(40)); texto.AppendLine(new string('-', 70)); texto.AppendLine(" DESCRIPCION DEL SERVICIO".PadRight(25)); texto.AppendLine(new string('-', 70)); texto.AppendLine(("SERVICIO DE TRANSPORTE DE LA RUTA " + venta.NomOriPas + " - " + venta.NomDesPas + " / " + "SERVICIO:").PadRight(56)); texto.AppendLine(venta.NomServicio + " / " + "NRO. ASIENTO: " + venta.NumeAsiento + " / " + "PASAJERO: " + venta.PasNombreCom); texto.AppendLine(" / " + "DNI: " + venta.DocNumero + " / " + "FECHA VIAJE: " + venta.FechaViaje + " / " + "HORA VIAJE: " + venta.EmbarqueHora); texto.AppendLine(new string('-', 70)); texto.AppendLine("SON: " + venta.PrecioDes); texto.AppendLine(new string('-', 70)); texto.AppendLine(("CODIGO: " + venta.CodigoX_FE).PadRight(32) + PadBoth("OP.INAFECTA", 20) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(8)); texto.AppendLine("Autorizado mediante: ".PadRight(32) + PadBoth("OP. GRAVADA", 20) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(8)); texto.AppendLine("N° " + venta.ResAut_FE + "/Sunat ".PadRight(32) + PadBoth("I.G.V. 18%", 20) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(8)); texto.AppendLine("IMPORTE TOTAL".PadLeft(52) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(8)); texto.AppendLine(new string('-', 70)); texto.AppendLine(SplitStringPreserving(" Consulte el documento en: " + venta.LinkPag_FE, 65, "", false)); texto.AppendLine("Representación impresa de la Factura Electrónica"); texto.AppendLine(""); if (!string.IsNullOrEmpty(venta.PolizaNum)) { texto.AppendLine("CUBIERTO " + venta.PolizaNum + " " + venta.PolizaFechaReg + " - " + venta.PolizaFechaVen); texto.AppendLine(""); } texto.AppendLine("."); if (TipoImpresion == TipoReimprimir) { texto.AppendLine(""); texto.AppendLine("FECHA DE REIMPRESION: " + DataUtility.ObtenerFechaDelSistema() + " - " + DataUtility.Obtener12HorasDelSistema() + " - " + venta.UsuarioCodigo); } } texto.AppendLine(" "); byte[] encodedText = Encoding.Default.GetBytes(texto.ToString()); var boletoBase64 = Convert.ToBase64String(encodedText); return(boletoBase64); }
public static Response <VentaResponse> SaveReintegro(ReintegroVentaRequest filtro) { var valor = new VentaResponse(); try { var ListarPanelControl = CreditoRepository.ListarPanelControl(); var listaVentasRealizadas = new List <VentaRealizadaEntity>(); var buscarCorrelativo = new CorrelativoEntity(); SetInvoiceRequestBody bodyDocumentoSUNAT = null; // Modifica Empresa por Panel 223 var objModificaEmpresa = ListarPanelControl.Find(x => x.CodiPanel == "223"); if (objModificaEmpresa != null && objModificaEmpresa.Valor == "1") { var NuevoCodiEmpresa = ReintegroRepository.ConsultaEmpresaPVentaYServicio(Convert.ToInt32(filtro.Punto_Venta), Convert.ToInt32(filtro.servicio)); filtro.Codi_Empresa__ = (NuevoCodiEmpresa == 0) ? filtro.Codi_Empresa : Convert.ToString(NuevoCodiEmpresa); } var auxBoletoOriginal = string.Format("{0}{1}", filtro.TipoOri, filtro.boleto_original); var entidad = new VentaEntity() { CodiEmpresa = byte.Parse(filtro.Codi_Empresa__), //verificar UserWebSUNAT = UserWebSUNAT, TipoDocumento = filtro.tipo_doc, RucCliente = filtro.NIT_CLIENTE, NomEmpresaRuc = filtro.NomEmpresaRuc, DirEmpresaRuc = filtro.DirEmpresaRuc, Tipo = filtro.Tipo, SerieBoleto = short.Parse(filtro.Serie), NumeBoleto = int.Parse(filtro.nume_boleto.PadLeft(8, '0')), PrecioVenta = Convert.ToDecimal(filtro.PRECIO_VENTA), NomDestino = filtro.NombDestino, NomServicio = filtro.NomServicio, NumeAsiento = byte.Parse(filtro.NUMERO_ASIENTO), Dni = filtro.Dni, FechaViaje = filtro.Fecha_viaje, HoraViaje = filtro.HORA_V, FlagVenta = filtro.FLAG_VENTA, CodiUsuario = short.Parse(filtro.Clav_Usuario), CodiOficina = short.Parse(filtro.CODI_SUCURSAL), CodiPuntoVenta = short.Parse(filtro.Pventa__), CodiTerminal = filtro.CODI_TERMINAL__, CodiBus = filtro.CodiBus, CodiEmbarque = short.Parse(filtro.Sube_en), Nombre = filtro.NOMB, TipoPago = filtro.Tipo_Pago, NomEmpresa = filtro.NomEmpresa, RucEmpresa = filtro.RucEmpresa, DireccionEmpresa = filtro.DireccionEmpresa, ElectronicoEmpresa = filtro.ElectronicoEmpresa, TipoTerminalElectronico = filtro.Tipo, //Solo para validar SUNAT TipoImpresora = filtro.TipoImpresora }; // Seteo 'CodiDocumento' if (!string.IsNullOrEmpty(entidad.RucCliente)) { entidad.AuxCodigoBF_Interno = CodiCorrelativoVentaFactura; // Correlativo '20' switch (entidad.TipoTerminalElectronico) { case "M": { if (entidad.FlagVenta != "1") { var objPanelCorrelativoCredito02 = ListarPanelControl.Find(x => x.CodiPanel == "145"); if (objPanelCorrelativoCredito02 != null && objPanelCorrelativoCredito02.Valor == "1") { entidad.AuxCodigoBF_Interno = CodiCorrelativoCredito; // Busca 'Correlativo' buscarCorrelativo = VentaRepository.BuscarCorrelativo(entidad.CodiEmpresa, entidad.AuxCodigoBF_Interno, entidad.CodiOficina, entidad.CodiPuntoVenta, entidad.CodiTerminal, entidad.TipoTerminalElectronico); if (buscarCorrelativo.SerieBoleto != 0) { entidad.SerieBoleto = buscarCorrelativo.SerieBoleto; entidad.NumeBoleto = buscarCorrelativo.NumeBoleto; } else { return(new Response <VentaResponse>(false, valor, "Número de correlativo no esta configurado para el tipo " + entidad.AuxCodigoBF_Interno, false)); } } } }; break; } ; entidad.CodiDocumento = "01"; // Factura } else { entidad.AuxCodigoBF_Interno = CodiCorrelativoVentaBoleta; entidad.CodiDocumento = "03"; // Boleta } // Busca 'Correlativo' if (entidad.AuxCodigoBF_Interno != CodiCorrelativoCredito) { buscarCorrelativo = VentaRepository.BuscarCorrelativo(entidad.CodiEmpresa, entidad.AuxCodigoBF_Interno, entidad.CodiOficina, entidad.CodiPuntoVenta, entidad.CodiTerminal, entidad.TipoTerminalElectronico); entidad.SerieBoleto = buscarCorrelativo.SerieBoleto; entidad.NumeBoleto = buscarCorrelativo.NumeBoleto; } if (buscarCorrelativo.SerieBoleto == 0) { switch (entidad.TipoTerminalElectronico) { case "M": { switch (entidad.CodiDocumento) { case "01": // Factura { if (buscarCorrelativo.SerieBoleto == 0) { // Seteo 'CodiBF Interno' entidad.AuxCodigoBF_Interno = CodiCorrelativoVentaBoleta; // Seteo 'CodiDocumento' entidad.CodiDocumento = "03"; // Boleta // Busca 'Correlativo' buscarCorrelativo = VentaRepository.BuscarCorrelativo(entidad.CodiEmpresa, entidad.AuxCodigoBF_Interno, entidad.CodiOficina, entidad.CodiPuntoVenta, entidad.CodiTerminal, entidad.TipoTerminalElectronico); if (buscarCorrelativo.SerieBoleto == 0) { return(new Response <VentaResponse>(false, valor, Message.MsgErrorSerieBoleto, false)); } else { entidad.SerieBoleto = buscarCorrelativo.SerieBoleto; entidad.NumeBoleto = buscarCorrelativo.NumeBoleto; } } }; break; case "03": // Boleta { if (buscarCorrelativo.SerieBoleto == 0) { return(new Response <VentaResponse>(false, valor, Message.MsgErrorSerieBoleto, false)); } }; break; } ; }; break; case "E": return(new Response <VentaResponse>(false, valor, Message.MsgErrorSerieBoleto, false)); } ; } // Seteo 'Tipo' switch (entidad.TipoTerminalElectronico) { case "M": entidad.Tipo = "M"; break; case "E": { if (!string.IsNullOrEmpty(entidad.RucCliente)) { entidad.Tipo = "F"; } else { entidad.Tipo = "B"; } }; break; } ; // Siempre '+ 1' al 'NumeBoleto' entidad.NumeBoleto = entidad.NumeBoleto + 1; //Para enviar a grabar filtro.Tipo = entidad.Tipo; // Busca 'AgenciaEmpresa' (E -> GenerarAdicionales, M -> También se va a necesitar.) var buscarAgenciaEmpresa = new AgenciaEntity(); buscarAgenciaEmpresa = VentaRepository.BuscarAgenciaEmpresa(entidad.CodiEmpresa, entidad.CodiPuntoVenta); entidad.EmpDirAgencia = buscarAgenciaEmpresa.Direccion; entidad.EmpTelefono1 = buscarAgenciaEmpresa.Telefono1; entidad.EmpTelefono2 = buscarAgenciaEmpresa.Telefono2; //Valida 'ConsultaPoliza' var consultaNroPoliza = new PolizaEntity() { NroPoliza = string.Empty, FechaReg = "01/01/1900", FechaVen = "01/01/1900" }; var objPanelPoliza = ListarPanelControl.Find(x => x.CodiPanel == "224"); if (objPanelPoliza != null && objPanelPoliza.Valor == "1") { consultaNroPoliza = VentaRepository.ConsultaNroPoliza(entidad.CodiEmpresa, entidad.CodiBus, entidad.FechaViaje); if (string.IsNullOrEmpty(consultaNroPoliza.NroPoliza)) { return(new Response <VentaResponse>(false, valor, Message.MsgErrorConsultaNroPoliza, false)); } } entidad.PolizaNum = consultaNroPoliza.NroPoliza; entidad.PolizaFechaReg = consultaNroPoliza.FechaReg; entidad.PolizaFechaVen = consultaNroPoliza.FechaVen; // Valida 'DocumentoSUNAT' ResponseW resValidarDocumentoSUNAT = null; if (!filtro.Tipo.Equals("M")) { resValidarDocumentoSUNAT = VentaLogic.ValidarDocumentoSUNAT(entidad, ref bodyDocumentoSUNAT); } if (resValidarDocumentoSUNAT != null || filtro.Tipo.Equals("M")) { if ((resValidarDocumentoSUNAT != null && resValidarDocumentoSUNAT.Estado) || filtro.Tipo.Equals("M")) { //Setea CodiDocumento, Serie y Número. filtro.Codi_Documento__ = entidad.AuxCodigoBF_Interno; filtro.Serie = entidad.SerieBoleto.ToString(); filtro.nume_boleto = entidad.NumeBoleto.ToString(); filtro.NUME_CORRELATIVO__ = entidad.NumeBoleto.ToString(); var igv = ReintegroRepository.ConsultarIgv(entidad.AuxCodigoBF_Interno); filtro.porcentaje = igv; filtro.tota_ruta1 = filtro.PRECIO_VENTA / (1 + (igv / 100)); filtro.tota_ruta2 = filtro.PRECIO_VENTA - filtro.tota_ruta1; //GRABA REINTEGRO var res = ReintegroRepository.SaveReintegro(filtro); var ventaRealizada = (res > 0) ? true : false; if (ventaRealizada) { entidad.IdVenta = res; var objAuditoria = new AuditoriaEntity { CodiUsuario = Convert.ToInt16(filtro.Clav_Usuario), NomUsuario = filtro.NomUsuario, Tabla = "VENTA", TipoMovimiento = "BOL-REINTEGRO", Boleto = filtro.BoletoAuditoria, NumeAsiento = filtro.NumAsientoAuditoria.PadLeft(2, '0'), NomOficina = filtro.NomSucursal, NomPuntoVenta = filtro.Punto_Venta.PadLeft(3, '0'), Pasajero = filtro.NOMB, FechaViaje = filtro.Fecha_viaje, HoraViaje = filtro.HORA_V, NomDestino = filtro.NombDestino, Precio = (decimal)filtro.PRECIO_VENTA, Obs1 = "REINTEGRO DE PASAJES", Obs2 = filtro.CODI_PROGRAMACION, Obs3 = "BOL-" + filtro.Serie.PadLeft(3, '0') + "-" + filtro.nume_boleto.PadLeft(7, '0'), Obs4 = filtro.NomMotivo, Obs5 = string.Empty }; //Graba Auditoria VentaRepository.GrabarAuditoria(objAuditoria); // Valida 'TipoPago' switch (entidad.TipoPago) { case "02": // Múltiple pago case "03": // Tarjeta de crédito { // Genera 'CorrelativoAuxiliar' var generarCorrelativoAuxiliar = VentaRepository.GenerarCorrelativoAuxiliar("CAJA", entidad.CodiOficina.ToString(), entidad.CodiPuntoVenta.ToString(), string.Empty); if (string.IsNullOrEmpty(generarCorrelativoAuxiliar)) { return(new Response <VentaResponse>(false, valor, Message.MsgErrorGenerarCorrelativoAuxiliar, false)); } var auxBoletoCompleto = VentaLogic.BoletoFormatoCompleto(entidad.TipoTerminalElectronico, entidad.AuxCodigoBF_Interno, entidad.SerieBoleto, entidad.NumeBoleto, "3", "7"); var auxCodiDestino = (filtro.CodMotivo.Equals("00003") || filtro.CodMotivo.Equals("00004")) ? filtro.CODI_SUBRUTA : ""; // Graba 'Caja' var objCajaEntity = new CajaEntity { NumeCaja = generarCorrelativoAuxiliar.PadLeft(7, '0'), CodiEmpresa = entidad.CodiEmpresa, CodiSucursal = entidad.CodiOficina, FechaCaja = DataUtility.ObtenerFechaDelSistema(), TipoVale = "S", Boleto = auxBoletoCompleto.Substring(1), NomUsuario = filtro.NomUsuario, CodiBus = string.Empty, CodiChofer = string.Empty, CodiGasto = string.Empty, ConcCaja = auxBoletoCompleto.Substring(1), Monto = entidad.PrecioVenta, CodiUsuario = entidad.CodiUsuario, IndiAnulado = "F", TipoDescuento = string.Empty, TipoDoc = "XX", TipoGasto = "P", Liqui = 0M, Diferencia = 0M, Recibe = string.Empty, CodiDestino = auxCodiDestino, FechaViaje = entidad.FechaViaje, HoraViaje = entidad.HoraViaje, CodiPuntoVenta = entidad.CodiPuntoVenta, Voucher = "PA", Asiento = string.Empty, Ruc = "N", IdVenta = entidad.IdVenta, Origen = "MT", Modulo = "PM", Tipo = entidad.Tipo, IdCaja = 0 }; var grabarCaja = VentaRepository.GrabarCaja(objCajaEntity); if (grabarCaja > 0) { // Seteo 'NumeCaja' var auxNumeCaja = entidad.CodiOficina.ToString("D3") + entidad.CodiPuntoVenta.ToString("D3") + generarCorrelativoAuxiliar.PadLeft(7, '0'); // Graba 'PagoTarjetaCredito' var objTarjetaCreditoEntity = new TarjetaCreditoEntity { IdVenta = entidad.IdVenta, Boleto = auxBoletoCompleto.Substring(1), CodiTarjetaCredito = filtro.CodiTarjetaCredito, NumeTarjetaCredito = filtro.NumeTarjetaCredito, Vale = auxNumeCaja, IdCaja = grabarCaja, Tipo = entidad.Tipo }; var grabarPagoTarjetaCredito = VentaRepository.GrabarPagoTarjetaCredito(objTarjetaCreditoEntity); if (!grabarPagoTarjetaCredito) { return(new Response <VentaResponse>(false, valor, Message.MsgErrorGrabarPagoTarjetaCredito, false)); } } else { return(new Response <VentaResponse>(false, valor, Message.MsgErrorGrabarCaja, false)); } }; break; } ; if (filtro.stReintegro.Equals("X")) { var objAuditoria2 = new AuditoriaEntity { CodiUsuario = Convert.ToInt16(filtro.Clav_Usuario), NomUsuario = filtro.NomUsuario, Tabla = "VENTA", TipoMovimiento = "BOL-REI-CRE", Boleto = filtro.BoletoAuditoria, NumeAsiento = filtro.NumAsientoAuditoria.PadLeft(2, '0'), NomOficina = filtro.NomSucursal, NomPuntoVenta = filtro.Punto_Venta.PadLeft(3, '0'),// Pasajero = filtro.NOMB, FechaViaje = filtro.Fecha_viaje, HoraViaje = filtro.HORA_V, NomDestino = filtro.NombDestino, Precio = (decimal)filtro.PRECIO_VENTA, Obs1 = "REINTEGRO CON CREDITO", Obs2 = filtro.CODI_PROGRAMACION, Obs3 = "BOL-" + filtro.nume_boleto, Obs4 = filtro.NomMotivo, Obs5 = string.Empty }; //Graba Auditoria Adicional VentaRepository.GrabarAuditoria(objAuditoria2); } if (!filtro.Tipo.Equals("M") && entidad.ElectronicoEmpresa == "1") { //Registra 'DocumentoSUNAT' var resRegistrarDocumentoSUNAT = VentaLogic.RegistrarDocumentoSUNAT(bodyDocumentoSUNAT); if (resRegistrarDocumentoSUNAT.Estado) { entidad.SignatureValue = resRegistrarDocumentoSUNAT.SignatureValue ?? string.Empty; } else { return(new Response <VentaResponse>(false, valor, resRegistrarDocumentoSUNAT.MensajeError, false)); } } } //Se crea esta entidad para la parte de impresión var auxVentaRealizada = new VentaRealizadaEntity { // Para la vista 'BoletosVendidos' BoletoCompleto = VentaLogic.BoletoFormatoCompleto(entidad.TipoTerminalElectronico, entidad.AuxCodigoBF_Interno, entidad.SerieBoleto, entidad.NumeBoleto, "3", "8"),//ok NumeAsiento = entidad.NumeAsiento.ToString("D2"), // Para el método 'ConvertirVentaToBase64' IdVenta = res,//entidad.IdVenta, BoletoTipo = entidad.Tipo, BoletoSerie = entidad.SerieBoleto.ToString("D3"), BoletoNum = entidad.NumeBoleto.ToString("D8"), CodDocumento = entidad.CodiDocumento, EmisionFecha = DataUtility.ObtenerFechaDelSistema(), EmisionHora = DataUtility.Obtener12HorasDelSistema(), CajeroCod = entidad.CodiUsuario, CajeroNom = filtro.NomUsuario, PasNombreCom = entidad.SplitNombre[0] + " " + entidad.SplitNombre[1] + " " + entidad.SplitNombre[2], PasRuc = entidad.RucCliente, PasRazSocial = entidad.NomEmpresaRuc, PasDireccion = entidad.DirEmpresaRuc, NomOriPas = filtro.NomOrigen, NomDesPas = entidad.NomDestino, DocTipo = VentaLogic.TipoDocumentoHomologado(entidad.TipoDocumento), DocNumero = entidad.Dni, PrecioCan = entidad.PrecioVenta, PrecioDes = DataUtility.MontoSolesALetras(DataUtility.ConvertDecimalToStringWithTwoDecimals(entidad.PrecioVenta)), NomServicio = entidad.NomServicio, FechaViaje = entidad.FechaViaje, EmbarqueDir = filtro.DirEmbarque, EmbarqueHora = filtro.Hora_Emb, CodigoX_FE = entidad.SignatureValue ?? string.Empty, TipoTerminalElectronico = entidad.TipoTerminalElectronico, TipoImpresora = entidad.TipoImpresora, EmpDirAgencia = entidad.EmpDirAgencia, EmpTelefono1 = entidad.EmpTelefono1, EmpTelefono2 = entidad.EmpTelefono2, PolizaNum = entidad.PolizaNum, PolizaFechaReg = entidad.PolizaFechaReg, PolizaFechaVen = entidad.PolizaFechaVen, //NEW EmpRuc = filtro.RucEmpresa, EmpRazSocial = filtro.NomEmpresa, EmpDireccion = filtro.DireccionEmpresa, EmpElectronico = filtro.ElectronicoEmpresa, // Parámetros extras EmpCodigo = entidad.CodiEmpresa, PVentaCodigo = entidad.CodiPuntoVenta, BusCodigo = entidad.CodiBus, EmbarqueCod = entidad.CodiEmbarque, //NEW TipoPago = entidad.TipoPago, FlagVenta = entidad.FlagVenta, CodiEsca = auxBoletoOriginal }; listaVentasRealizadas.Add(auxVentaRealizada); valor.ListaVentasRealizadas = listaVentasRealizadas; valor.CodiProgramacion = Convert.ToInt32(filtro.CODI_PROGRAMACION); return((ventaRealizada) ? new Response <VentaResponse>(true, valor, string.Empty, true) : new Response <VentaResponse>(true, null, Message.MsgNoVentaReintegro, true)); } else { return(new Response <VentaResponse>(true, valor, resValidarDocumentoSUNAT.MensajeError, false)); } } else { return(new Response <VentaResponse>(false, valor, Message.MsgErrorWebServiceFacturacionElectronica, false)); } } catch (Exception ex) { Log.Instance(typeof(BaseLogic)).Error(System.Reflection.MethodBase.GetCurrentMethod().Name, ex); return(new Response <VentaResponse>(false, null, Message.MsgExcVentaReintegro, false)); } }
public static string WriteText(VentaRealizadaEntity venta, string TipoImpresion) { StringBuilder texto = new StringBuilder(); // Impresora Térmica if (venta.TipoImpresora == 1) { texto.AppendLine(SplitStringPreserving(venta.EmpRazSocial, 30, "|||^")); texto.AppendLine(SplitStringPreserving("R.U.C. " + venta.EmpRuc, 30, "|||^")); texto.AppendLine(SplitStringPreserving(venta.EmpDireccion, 45, "^")); texto.AppendLine(SplitStringPreserving("Agencia: " + venta.EmpDirAgencia, 45, "^")); texto.AppendLine("|||^" + PadBoth((venta.BoletoTipo == "F" ? "FACTURA" : "BOLETA DE VENTA") + " ELECTRÓNICA", 30)); texto.AppendLine("|^" + PadBoth(string.Format(venta.BoletoTipo + venta.BoletoSerie + "-" + venta.BoletoNum), 18)); texto.AppendLine(""); texto.AppendLine("^FECHA DE EMISIÓN : " + venta.EmisionFecha + " - " + venta.EmisionHora); texto.AppendLine("^NRO. DOCUMENTO : " + venta.DocNumero); texto.AppendLine(SplitStringPreserving("PASAJERO : " + venta.PasNombreCom, 45, "^", false)); if (venta.BoletoTipo == "F") { texto.AppendLine("^NRO. RUC : " + venta.PasRuc); texto.AppendLine(SplitStringPreserving("CLIENTE : " + venta.PasRazSocial, 45, "^", false)); texto.AppendLine(SplitStringPreserving("DIRECCION : " + venta.PasDireccion, 45, "^", false)); } texto.AppendLine("^COD. CAJERO : " + venta.CajeroCod); texto.AppendLine(new string('-', 42)); texto.AppendLine("^DETALLE DEL SERVICIO"); texto.AppendLine(new string('-', 42)); texto.AppendLine("||||^SERVICIO DE TRANSPORTE"); texto.AppendLine("^ORIGEN : " + venta.NomOriPas); texto.AppendLine("^DESTINO : " + venta.NomDesPas); texto.AppendLine("||||^SERVICIO : " + venta.NomServicio); texto.AppendLine("|||^FECHA VIAJE : " + venta.FechaViaje); texto.AppendLine("|||^HORA DE SALIDA : " + venta.EmbarqueHora); texto.AppendLine("|||^ASIENTO : " + venta.NumeAsiento); texto.AppendLine(SplitStringPreserving("DIR.EMBARQUE: " + venta.EmbarqueDirAgencia, 30, "||||^", false)); texto.AppendLine(new string('-', 42)); texto.AppendLine("|||^TOTAL" + ("S/ " + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan)).PadLeft(20)); texto.AppendLine("^SON: " + venta.PrecioDes); texto.AppendLine(new string('-', 42)); texto.AppendLine("^CÓDIGO: " + venta.CodigoX_FE); texto.AppendLine(SplitStringPreserving("Autorizado mediante", 43, "^", true)); texto.AppendLine(SplitStringPreserving("N° " + venta.ResAut_FE + "/SUNAT", 43, "^", true)); texto.AppendLine(SplitStringPreserving("Representación impresa del comprobante de venta, puede ser consultado en", 43, "^", true)); texto.AppendLine(SplitStringPreserving(venta.LinkPag_FE, 45, "^", true)); texto.AppendLine(SplitStringPreserving("Términos y condiciones, visite", 43, "^", true)); texto.AppendLine(SplitStringPreserving("https://floreshnos.pe/terminos/", 45, "^", true)); texto.AppendLine(SplitStringPreserving("Debe presentarse 30 minutos antes de la hora de salida.", 45, "^", true)); texto.AppendLine(SplitStringPreserving("Al abordar el bus debe presentar la representación impresa o digital del comprobante.", 45, "^", true)); texto.AppendLine(SplitStringPreserving("No se aceptan cambios ni devoluciones, conservar su comprobante ante cualquier eventualidad.", 45, "^", true)); texto.AppendLine(""); if (!string.IsNullOrEmpty(venta.PolizaNum)) { texto.AppendLine(SplitStringPreserving("CUBIERTO " + venta.PolizaNum + " " + venta.PolizaFechaReg + " - " + venta.PolizaFechaVen, 45, "^")); texto.AppendLine(""); } texto.AppendLine(SplitStringPreserving("TIPO DE VENTA: " + NameOfTipoVenta(venta.TipoPago, venta.FlagVenta), 43, "^", true)); if (venta.FlagVenta == "O") { texto.AppendLine(SplitStringPreserving("R " + venta.CodiEsca, 43, "^", true)); } texto.AppendLine(""); texto.AppendLine(string.Format("@@@{0}|{1}|{2}{3}|{4}|0|{5}|{6}|{7}|{8}", venta.EmpRuc, venta.DocTipo, venta.BoletoTipo, venta.BoletoSerie, venta.BoletoNum, venta.PrecioCan, venta.EmisionFecha, venta.DocTipo, venta.DocNumero)); if (TipoImpresion == TipoReimprimir) { texto.AppendLine(""); texto.AppendLine("^FEC. REIMP.: " + DataUtility.ObtenerFechaDelSistema() + " - " + DataUtility.Obtener12HorasDelSistema() + " - " + venta.UsuarioCodigo); } } // Impresora Matricial else if (venta.TipoImpresora == 3) { texto.AppendLine("@@@"); texto.AppendLine("DRAFT 10CPI"); texto.AppendLine("FACT_ELE"); texto.AppendLine("@@@"); texto.AppendLine(PadBoth(venta.EmpRazSocial + " - " + "R.U.C. " + venta.EmpRuc, 80)); texto.AppendLine(PadBoth((venta.BoletoTipo == "F" ? "FACTURA" : "BOLETA DE VENTA") + " ELECTRONICA: " + venta.BoletoTipo + venta.BoletoSerie + "-" + venta.BoletoNum, 80)); texto.AppendLine(PadBoth(venta.EmbarqueDir + " - " + venta.EmpDirAgencia, 80)); texto.AppendLine("FECHA Y HORA DE EMISION".PadRight(25) + (": " + venta.EmisionFecha + " - " + venta.EmisionHora + " - " + "CAJ.: " + venta.CajeroNom).PadRight(65)); if (venta.BoletoTipo == "F") { texto.AppendLine("NRO. RUC".PadRight(25) + (": " + venta.PasRuc).PadRight(65)); texto.AppendLine("CLIENTE".PadRight(25) + (": " + venta.PasRazSocial).PadRight(65)); texto.AppendLine("DIRECCION".PadRight(25) + (": " + venta.PasDireccion).PadRight(65)); } texto.AppendLine("DOC. CLIENTE".PadRight(25) + (": " + venta.DocNumero).PadRight(65)); texto.AppendLine("PASAJERO".PadRight(25) + (": " + venta.PasNombreCom).PadRight(65)); texto.AppendLine("CONDICION DE VENTA".PadRight(25) + (": " + NameOfTipoVenta(venta.TipoPago, venta.FlagVenta)).PadRight(65)); texto.AppendLine(new string('-', 80)); texto.AppendLine(" DESCRIPCION DEL SERVICIO".PadRight(30) + "TOTAL".PadLeft(50)); texto.AppendLine(new string('-', 80)); texto.AppendLine(("|||SER. DE TRAN. DE LA RUTA " + venta.NomOriPas + " - " + venta.NomDesPas + " / " + "SERVICIO:").PadRight(70) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(10)); texto.AppendLine(venta.NomServicio + " / " + "NRO. ASIENTO: " + venta.NumeAsiento + " / " + "PASAJERO: " + venta.PasNombreCom); texto.AppendLine(" / " + "DNI: " + venta.DocNumero + " / " + "FECHA VIAJE: " + venta.FechaViaje + " / " + "HORA VIAJE: " + venta.EmbarqueHora); texto.AppendLine(new string('-', 80)); texto.AppendLine("SON: " + venta.PrecioDes); texto.AppendLine(new string('-', 80)); texto.AppendLine(("CODIGO: " + venta.CodigoX_FE).PadRight(39) + PadBoth("OP.INAFECTA", 25) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(10)); texto.AppendLine("Autorizado mediante: ".PadRight(40) + PadBoth("OP. GRAVADA", 25) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(10)); texto.AppendLine("N° " + venta.ResAut_FE + "/Sunat ".PadRight(40) + PadBoth("OP. EXONERADA", 25) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(10)); texto.AppendLine("I.G.V. 18%".PadLeft(65) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(10)); texto.AppendLine("IMPORTE TOTAL".PadLeft(65) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(10)); texto.AppendLine(new string('-', 80)); texto.AppendLine("Representación impresa de la Factura Electrónica"); texto.AppendLine(" Consulte el documento en: " + venta.LinkPag_FE); texto.AppendLine(SplitStringPreserving("Al recibir el presente documento, acepto todos los términos y/o condiciones del contratado del servicio de transporte publicados en los letreros o en los banners y detallados en la página.", 80, "", false)); texto.AppendLine(""); if (!string.IsNullOrEmpty(venta.PolizaNum)) { texto.AppendLine("CUBIERTO " + venta.PolizaNum + " " + venta.PolizaFechaReg + " - " + venta.PolizaFechaVen); texto.AppendLine(""); } texto.AppendLine(new string('-', 25)); texto.AppendLine(" USUARIO CONFORME"); texto.AppendLine("."); if (TipoImpresion == TipoReimprimir) { texto.AppendLine(""); texto.AppendLine("FECHA DE REIMPRESION: " + DataUtility.ObtenerFechaDelSistema() + " - " + DataUtility.Obtener12HorasDelSistema() + " - " + venta.UsuarioCodigo); } } // Impresora Matricial (Formato reducido) else if (venta.TipoImpresora == 4) { texto.AppendLine("@@@"); texto.AppendLine("DRAFT 17CPI"); texto.AppendLine("FACT_ELE"); texto.AppendLine("@@@"); texto.AppendLine(PadBoth(venta.EmpRazSocial + " - " + "R.U.C. " + venta.EmpRuc, 65)); texto.AppendLine(PadBoth((venta.BoletoTipo == "F" ? "FACTURA" : "BOLETA DE VENTA") + " ELECTRONICA: " + venta.BoletoTipo + venta.BoletoSerie + "-" + venta.BoletoNum, 65)); texto.AppendLine(PadBoth(venta.EmbarqueDir + " - " + venta.EmpDirAgencia, 65)); texto.AppendLine("EMITIDO".PadRight(25) + (": " + venta.EmisionFecha + " - " + venta.EmisionHora + " - " + "CAJ.: " + venta.CajeroNom).PadRight(40)); if (venta.BoletoTipo == "F") { texto.AppendLine("NRO. RUC".PadRight(25) + (": " + venta.PasRuc + " - " + venta.PasRazSocial).PadRight(40)); texto.AppendLine("DIRECCION".PadRight(25) + (": " + venta.PasDireccion).PadRight(40)); } texto.AppendLine("CLIENTE".PadRight(25) + (": " + venta.DocNumero + " - " + venta.PasNombreCom).PadRight(40)); texto.AppendLine("COD. VENTA".PadRight(25) + (": " + NameOfTipoVenta(venta.TipoPago, venta.FlagVenta)).PadRight(40)); texto.AppendLine(new string('-', 70)); texto.AppendLine(" DESCRIPCION DEL SERVICIO".PadRight(25)); texto.AppendLine(new string('-', 70)); texto.AppendLine(("SERVICIO DE TRANSPORTE DE LA RUTA " + venta.NomOriPas + " - " + venta.NomDesPas + " / " + "SERVICIO:").PadRight(56)); texto.AppendLine(venta.NomServicio + " / " + "NRO. ASIENTO: " + venta.NumeAsiento + " / " + "PASAJERO: " + venta.PasNombreCom); texto.AppendLine(" / " + "DNI: " + venta.DocNumero + " / " + "FECHA VIAJE: " + venta.FechaViaje + " / " + "HORA VIAJE: " + venta.EmbarqueHora); texto.AppendLine(new string('-', 70)); texto.AppendLine("SON: " + venta.PrecioDes); texto.AppendLine(new string('-', 70)); texto.AppendLine(("CODIGO: " + venta.CodigoX_FE).PadRight(32) + PadBoth("OP.INAFECTA", 20) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(8)); texto.AppendLine("Autorizado mediante: ".PadRight(32) + PadBoth("OP. GRAVADA", 20) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(8)); texto.AppendLine("N° " + venta.ResAut_FE + "/Sunat ".PadRight(32) + PadBoth("I.G.V. 18%", 20) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(0M).PadLeft(8)); texto.AppendLine("IMPORTE TOTAL".PadLeft(52) + "S/".PadLeft(5) + DataUtility.ConvertDecimalToStringWithTwoDecimals(venta.PrecioCan).PadLeft(8)); texto.AppendLine(new string('-', 70)); texto.AppendLine(SplitStringPreserving(" Consulte el documento en: " + venta.LinkPag_FE, 65, "", false)); texto.AppendLine("Representación impresa de la Factura Electrónica"); texto.AppendLine(""); if (!string.IsNullOrEmpty(venta.PolizaNum)) { texto.AppendLine("CUBIERTO " + venta.PolizaNum + " " + venta.PolizaFechaReg + " - " + venta.PolizaFechaVen); texto.AppendLine(""); } texto.AppendLine("."); if (TipoImpresion == TipoReimprimir) { texto.AppendLine(""); texto.AppendLine("FECHA DE REIMPRESION: " + DataUtility.ObtenerFechaDelSistema() + " - " + DataUtility.Obtener12HorasDelSistema() + " - " + venta.UsuarioCodigo); } } texto.AppendLine(" "); byte[] encodedText = Encoding.Default.GetBytes(texto.ToString()); var boletoBase64 = Convert.ToBase64String(encodedText); return(boletoBase64); }