private void ImporteTotal_xrTableCell_SummaryCalculated(object sender, TextFormatEventArgs e) { var numeroClass = new NumLetra(); var letraNumero = numeroClass.Convertir(AGlobalImporteFinal.ToString(), true); ImporteLetras_xrTableCell.Text = letraNumero; }
private void ImporteLetras_xrTableCell_SummaryGetResult_1(object sender, SummaryGetResultEventArgs e) { var numeroClass = new NumLetra(); var letraNumero = numeroClass.Convertir(AGlobalImporteFinal.ToString(), true); e.Result = letraNumero; e.Handled = true; }
public ActionResult A() { Guid IdNominaHistorial = Guid.Parse("a272c363-4fef-4579-bbf7-29834d9c7a9e"); var base64 = ""; base64 = Convert.ToBase64String(System.IO.File.ReadAllBytes(Server.MapPath("~/Images/Avenzo_Logo_Header.png"))); var imgSrc = String.Format("data:image/gif;base64,{0}", base64); NumLetra NL = new NumLetra(); List <NominaPercepciones> Percepciones = db.NominaPercepciones.Where(x => x.IdNominaHistorial == IdNominaHistorial).ToList(); List <NominaDeduccion> Deducciones = db.NominaDeduccion.Where(x => x.IdNominaHistorial == IdNominaHistorial).ToList(); byte[] CFDI = System.IO.File.ReadAllBytes(@"C:\Users\Ivan\Desktop\Avenzo\Dashboard\Facturas\CHP050224NF5\Nominas\AELS8511267R1_11_2017914.xml"); db.InsertCFDI(Guid.Parse("235e282b-3ebf-4d23-a3a9-518f19d52b54"), "Nomina", 11, CFDI, @"~\Facturas\CHP050224NF5\Nominas\AELS8511267R1_11_2017914", null, Guid.Parse("71eea78e-8ce4-43fe-9038-24c2c0634a40"), Guid.Parse("F34D8F7B-6007-42E6-AD3B-108DDE81ABC2"), false, DateTime.Now, User.Identity.Name); db.InsertCFDIPorOperacion(Guid.NewGuid(), IdNominaHistorial, null, Guid.Parse("235e282b-3ebf-4d23-a3a9-518f19d52b54")); PDF.CrearNomina(Server.MapPath("~/"), "AELS8511267R1_11_2017914", "BCN", "CHP050224NF5", "COLEGIO HEROES DE LA PAZ SC", "", "", "235e282b-3ebf-4d23-a3a9-518f19d52b54", "00001000000301838595", "11", "B", "2017-09-12T08:45:37", "Silvia Lopez Aceves", "", "AELS8511267R1", "Maestra", imgSrc, "AELS851126MSLCPL05", "71048536305", "15", "2017-09-01", "2017-08-16", "2017-08-31", NL.Convertir((3412.56).ToString("f2"), true, "MXN"), "NA", "", "601", "309.63", "3412.56", "W1blIja4rrIfuxICgTvC1zH1/fjwuSN9ehcM5IBSmEgaYOF5VN/6c2MFekxla1P2MPDqS+e89EKebWLShKaOKVvcnMpcr+bLrR6L7sWtKsRt9wgB8DvRc6pxTgu4YW4wRkSZ2kSxkrjoCq99JRlO7WhK+9xSEy+NCHjvkt5k530=", "g4zsOUQv7H+ORiZr+FB9kBRgk9YLpNUwIv1FDKmPubu0Z4cDM0X0tgwpmcie5AlgKm86yTd6p5A5AeI66ASCNrU4aWXwz/429+JEeXvxGRMCSFh7Oznmd6sGR4o9U50QTknKq9US254JeFcNFIsHZxgZYR63uoajCrgF/q07zpI=", "||3.3|A|11|2017-09-14T09:09:35|99|00001000000301838595|3778.00|365.44|MXN|3412.56|N|PUE|22210|CHP050224NF5|COLEGIO HEROES DE LA PAZ SC|601|AELS8511267R1|Silvia Lopez Aceves|P01|84111505|1|ACT|Pago de nómina|3778.00|3778.00|365.44|1.2|O|2017-09-01|2017-08-16|2017-08-31|15|3778.00|365.44|0|Z3113823101|AELS851126MSLCPL05|71048536305|2017-08-16|P2W|01|No|01|02|12|Maestra|1|04|0|186.05|BCN|3778.00|0|0|3778.00|0.00|001|001|Sueldo|2670.00|0.00|049|049|Bono Asistencia|298.00|0.00|049|049|Bono Puntualidad|298.00|0.00|029|029|Despensa|512.00|0.00|55.81|309.63|002|002|ISR|309.63|001|001|IMSS|55.81||", Percepciones, Deducciones); return(null); }
public static string convertirNumerosLetras(String numero, bool mayusculas) { return(NumLetra.Convertir(numero, mayusculas)); }
//OT7349 FIN public string EnviarComprobante(string tipoComprobante, string serie, string numero, string codigoUsuario) { FacturacionDA da = new FacturacionDA(); ParametrosDA parametroDA = new ParametrosDA(); DataTable dt = null; string rutaApp = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string rutaModelo = rutaApp + ConfigurationSettings.AppSettings[ConstantesING.RUTA_MODELO]; string rutaArchivo = rutaApp + ConfigurationSettings.AppSettings[ConstantesING.RUTA_ARCHIVOS]; switch (tipoComprobante) { case "01": dt = da.ObtenerFacturaParaEnvio(serie, numero); break; case "03": dt = da.ObtenerBoletaParaEnvio(serie, numero); break; case "07": dt = da.ObtenerNCParaEnvio(serie, numero); break; } string destinoCsv = rutaArchivo + ConfigurationSettings.AppSettings[tipoComprobante + "csv"]; string destinoRespuesta = rutaArchivo + ConfigurationSettings.AppSettings[tipoComprobante + "respuesta"]; string flagAfectoIGV = dt.Rows[0]["FLAG_AFECTOIGV"].ToString(); DataTable dtParametro = parametroDA.ObtenerValoresParametros(ConstantesING.TABLA_MODELO, tipoComprobante + "-" + flagAfectoIGV); string nombreArchivoModelo = dtParametro.Rows[0]["CAMPO1"].ToString(); //FileStream modelo = File.Open(rutaModelo + nombreArchivoModelo, FileMode.Open); StreamReader modelo = new StreamReader(rutaModelo + nombreArchivoModelo); string contenidoModelo = modelo.ReadToEnd(); //Reemplazando valores en el modelo string fechaEmision = dt.Rows[0]["FECHA_EMISION"].ToString(); string numeroDocumento = dt.Rows[0]["NUMERO_DOCUMENTO"].ToString(); string tipoDocumento = dt.Rows[0]["TIPO_DOCUMENTO"].ToString(); string moneda = dt.Rows[0]["MONEDA"].ToString(); string igv = Convert.ToDecimal(dt.Rows[0]["IGV"]).ToString("#0.00"); string subTotal = Convert.ToDecimal(dt.Rows[0]["VALOR_VENTA"]).ToString("#0.00"); string total = Convert.ToDecimal(dt.Rows[0]["TOTAL"]).ToString("#0.00"); string docCliente = dt.Rows[0]["DOC_CLIENTE"].ToString(); string tipoDocCliente = dt.Rows[0]["TIPO_DOC_CLIENTE"].ToString(); string razonSocial = dt.Rows[0]["RAZON_SOCIAL"].ToString(); string ubigeo = dt.Rows[0]["UBIGEO"].ToString(); string codigoPostal = dt.Rows[0]["CODIGO_POSTAL"].ToString(); string direccionCliente = dt.Rows[0]["DIRECCION_CLIENTE"].ToString(); string departamentoCliente = dt.Rows[0]["DEP_CLIENTE"].ToString(); string provinciaCliente = dt.Rows[0]["PRO_CLIENTE"].ToString(); string distritoCliente = dt.Rows[0]["DIS_CLIENTE"].ToString(); string pais = dt.Rows[0]["PAIS_CLIENTE"].ToString(); string correo = dt.Rows[0]["CORREO_CLIENTE"].ToString(); string cantidad = dt.Rows[0]["CANTIDAD"].ToString(); string descripcion = dt.Rows[0]["DESCRIPCION"].ToString(); string porcIgv = dt.Rows[0]["PORC_IGV"].ToString(); string tipoDocRelacionado = dt.Rows[0]["TIPO_DOCREL"].ToString(); //OT 8365 INI string numDocRelacionado = tipoDocRelacionado == "01" ? "F" : "B"; //OT 8365 FIN numDocRelacionado = numDocRelacionado + dt.Rows[0]["NUMERO_DOCREL"].ToString(); string tipoNC = dt.Rows[0]["TIPO_NC"].ToString(); string glosa = dt.Rows[0]["GLOSA"].ToString(); NumLetra nl = new NumLetra(); string montoTexto = nl.Convertir(dt.Rows[0]["TOTAL"].ToString(), moneda == "PEN"? "Nuevos Soles": "Dólares americanos", true, tipoDocumento); string unidad = "UN"; //OT7999 INI string montoDetraccion = string.Empty; string porcentajeDetraccion = string.Empty; string numeroBancoNancion = string.Empty; string detracMontoTotal = string.Empty; string codTabScotiabankMN = string.Empty; string codItemScotiabankMN = string.Empty; string codTabScotiabankCCI = string.Empty; string codItemScotiabankCCI = string.Empty; string cuentaScotiabankMN = string.Empty; string cuentaScotiabankCCI = string.Empty; string codTabScotiabankMNTexto = string.Empty; string codItemScotiabankMNTexto = string.Empty; string codTabScotiabankCCITexto = string.Empty; string codItemScotiabankCCITexto = string.Empty; string textoScotiabankMN = string.Empty; string textoScotiabankCCI = string.Empty; string textoCuentasScotiabank = string.Empty; /*Cargando los valores adicionales para las facturas*/ if (tipoComprobante.Equals(ConstantesING.TIPO_DOCUMENTO_FACTURA)) { double dTotal = Convert.ToDouble(dt.Rows[0]["TOTAL"]); double dDetraccion = Convert.ToDouble(dt.Rows[0]["MONTO_DETRACCION"]); if (dDetraccion != 0) //Se ha calculado la detraccion { montoDetraccion = Convert.ToDecimal(dt.Rows[0]["MONTO_DETRACCION"]).ToString("#0.00"); porcentajeDetraccion = Convert.ToDecimal(dt.Rows[0]["PORCENTAJE_DETRACCION"]).ToString("#0.00"); //Cargando el numero de banco de la nacion. string strCodigoBancoNacion = ConstantesING.CODIGO_NUMERO_BANCO_NACION; string strNumeroBancoNacion = ConstantesING.NUMERO_BANCO_NACION; DataTable dtNumeroBancoNacion = ObtenerDatosParametro(strCodigoBancoNacion, strNumeroBancoNacion); if (dtNumeroBancoNacion.Rows.Count > 0) { if (dtNumeroBancoNacion.Rows[0]["Descripcion"] != DBNull.Value) { numeroBancoNancion = dtNumeroBancoNacion.Rows[0]["Descripcion"].ToString(); } else { //se sigue procesando?? } } else { //se sigue procesando?? } double dDetracMontoTotal = dTotal - dDetraccion; detracMontoTotal = dDetracMontoTotal.ToString("#0.00"); } } if (tipoComprobante.Equals(ConstantesING.TIPO_DOCUMENTO_FACTURA) || tipoComprobante.Equals(ConstantesING.TIPO_DOCUMENTO_BOLETA)) { if (moneda == "PEN") { //soles codTabScotiabankMN = ConstantesING.CODIGO_SCOTIABANK_SOLES_MN; codItemScotiabankMN = ConstantesING.SCOTIABANK_SOLES_MN; codTabScotiabankCCI = ConstantesING.CODIGO_SCOTIABANK_SOLES_CCI; codItemScotiabankCCI = ConstantesING.SCOTIABANK_SOLES_CCI; codTabScotiabankMNTexto = ConstantesING.CODIGO_SCOTIABANK_SOLES_MN_TEXTO; codItemScotiabankMNTexto = ConstantesING.SCOTIABANK_SOLES_MN_TEXTO; codTabScotiabankCCITexto = ConstantesING.CODIGO_SCOTIABANK_SOLES_CCI_TEXTO; codItemScotiabankCCITexto = ConstantesING.SCOTIABANK_SOLES_CCI_TEXTO; } else { //dolares codTabScotiabankMN = ConstantesING.CODIGO_SCOTIABANK_DOLARES_MN; codItemScotiabankMN = ConstantesING.SCOTIABANK_DOLARES_MN; codTabScotiabankCCI = ConstantesING.CODIGO_SCOTIABANK_DOLARES_CCI; codItemScotiabankCCI = ConstantesING.SCOTIABANK_DOLARES_CCI; codTabScotiabankMNTexto = ConstantesING.CODIGO_SCOTIABANK_DOLARES_MN_TEXTO; codItemScotiabankMNTexto = ConstantesING.SCOTIABANK_DOLARES_MN_TEXTO; codTabScotiabankCCITexto = ConstantesING.CODIGO_SCOTIABANK_DOLARES_CCI_TEXTO; codItemScotiabankCCITexto = ConstantesING.SCOTIABANK_DOLARES_CCI_TEXTO; } DataTable dtCuentaScotiabankMN = ObtenerDatosParametro(codTabScotiabankMN, codItemScotiabankMN); if (dtCuentaScotiabankMN.Rows.Count > 0) { if (dtCuentaScotiabankMN.Rows[0]["Descripcion"] != DBNull.Value) { cuentaScotiabankMN = dtCuentaScotiabankMN.Rows[0]["Descripcion"].ToString(); } else { //se sigue procesando?? } } else { //se sigue procesando?? } DataTable dtCuentaScotiabankCCI = ObtenerDatosParametro(codTabScotiabankCCI, codItemScotiabankCCI); if (dtCuentaScotiabankCCI.Rows.Count > 0) { if (dtCuentaScotiabankCCI.Rows[0]["Descripcion"] != DBNull.Value) { cuentaScotiabankCCI = dtCuentaScotiabankCCI.Rows[0]["Descripcion"].ToString(); } else { //se sigue procesando?? } } else { //se sigue procesando?? } DataTable dtScotiabankTextoMN = ObtenerDatosParametro(codTabScotiabankMNTexto, codItemScotiabankMNTexto); if (dtScotiabankTextoMN.Rows.Count > 0) { if (dtScotiabankTextoMN.Rows[0]["Descripcion"] != DBNull.Value) { textoScotiabankMN = dtScotiabankTextoMN.Rows[0]["Descripcion"].ToString(); } else { //se sigue procesando?? } } else { //se sigue procesando?? } DataTable dtScotiabankTextoCCI = ObtenerDatosParametro(codTabScotiabankCCITexto, codItemScotiabankCCITexto); if (dtScotiabankTextoCCI.Rows.Count > 0) { if (dtScotiabankTextoCCI.Rows[0]["Descripcion"] != DBNull.Value) { textoScotiabankCCI = dtScotiabankTextoCCI.Rows[0]["Descripcion"].ToString(); } else { //se sigue procesando?? } } else { //se sigue procesando?? } //cuentaScotiabankMN = "Scotiabank Cuenta Corriente MN " + cuentaScotiabankMN; cuentaScotiabankMN = textoScotiabankMN + " " + cuentaScotiabankMN; //cuentaScotiabankCCI = "CCI: " + cuentaScotiabankCCI; cuentaScotiabankCCI = textoScotiabankCCI + " " + cuentaScotiabankCCI; textoCuentasScotiabank = cuentaScotiabankMN + " " + cuentaScotiabankCCI; } //OT7999 FIN string usuarioSOL = ConfigurationSettings.AppSettings["UsuarioSol"]; string passwordSOL = ConfigurationSettings.AppSettings["ClaveSol"]; string contenidoArchivo = contenidoModelo.Replace("{FECHA_EMISION}", fechaEmision) .Replace("{NUMERO_DOCUMENTO}", numeroDocumento) .Replace("{TIPO_DOCUMENTO}", tipoDocumento) .Replace("{MONEDA}", moneda) .Replace("{IGV}", igv) .Replace("{TOTAL}", total) .Replace("{VALOR_VENTA}", subTotal) //OT 7999 INI .Replace("{DETRAC_MONTO}", montoDetraccion) .Replace("{DETRAC_PORCENTAJE}", porcentajeDetraccion) .Replace("{DETRAC_NUM_BANCO}", numeroBancoNancion) .Replace("{DETRAC_MONTO_TOTAL}", detracMontoTotal) //OT 7999 FIN .Replace("{DOC_CLIENTE}", docCliente) .Replace("{TIPO_DOC_CLIENTE}", tipoDocCliente) .Replace("{RAZON_SOCIAL}", razonSocial) .Replace("{UBIGEO_CLIENTE}", ubigeo) .Replace("{DIRECCION_CLIENTE}", direccionCliente) .Replace("{DEP_CLIENTE}", departamentoCliente) .Replace("{PRO_CLIENTE}", provinciaCliente) .Replace("{DIS_CLIENTE}", distritoCliente) .Replace("{PAIS_CLIENTE}", pais) .Replace("{CORREO_CLIENTE}", correo) .Replace("{MONTO_TEXTO}", montoTexto) //OT 7999 INI .Replace("{SCOTIABANK}", textoCuentasScotiabank) //OT 7999 FIN .Replace("{UNIDAD}", unidad) .Replace("{CANTIDAD}", cantidad) .Replace("{DESCRIPCION_DETALLE}", descripcion) .Replace("{PORC_IGV}", porcIgv) .Replace("{NUM_DOC_REL}", numDocRelacionado) .Replace("{TIP_DOC_REL}", tipoDocRelacionado) .Replace("{TIPO_AFECTACION}", tipoNC) .Replace("{GLOSA}", glosa) .Replace("{USUARIO}", usuarioSOL) .Replace("{CLAVE}", passwordSOL); string rutaArchivoCompleta = destinoCsv + numeroDocumento + ".csv"; StreamWriter sw = new StreamWriter(rutaArchivoCompleta); sw.Write(contenidoArchivo); sw.Close(); string rutaRespuesta = destinoRespuesta; //File.Move(rutaArchivoCompleta, rutaArchivoCompleta.Replace(".txt", ".csv")); string usuarioServicio = ConfigurationSettings.AppSettings["UsuarioServicio"]; string passwordServicio = ConfigurationSettings.AppSettings["ClaveServicio"]; string respuesta = string.Empty; switch (tipoComprobante) { case "01": respuesta = EfactService.EnviarFactura(usuarioServicio, passwordServicio, rutaArchivoCompleta, rutaRespuesta, numeroDocumento, dt.Rows[0]); break; case "03": respuesta = EfactService.EnviarBoleta(usuarioServicio, passwordServicio, rutaArchivoCompleta, rutaRespuesta, numeroDocumento, dt.Rows[0]); break; case "07": respuesta = EfactService.EnviarNotaCredito(usuarioServicio, passwordServicio, rutaArchivoCompleta, rutaRespuesta, numeroDocumento, dt.Rows[0]); break; } if (dt.Rows[0]["FLAG_ENVIADO"].ToString().Equals(ConstantesING.SI)) { facturacionDA.Server = Conexiones.ServidorPremBanco13; facturacionDA.Database = Conexiones.BaseDeDatosPremBanco13; decimal idComprobante = Convert.ToDecimal(dt.Rows[0]["ID_COMPROBANTE"]); facturacionDA.CrearConexion(); facturacionDA.AbrirConexion(); facturacionDA.AbrirTransaccion(); try { facturacionDA.ActualizarEstadoEnvio(idComprobante, codigoUsuario); facturacionDA.CommitTransaccion(); } catch (Exception ex) { facturacionDA.RollbackTransaccion(); } } return(respuesta); }
public FacturaPdfModel GetFacturaPdf(int id) { var data = new FacturaPdfModel(); try { var numString = new NumLetra(); var venta = _ventas.GetById(id); venta.Impreso = true; var result = _ventas.Edit(venta); data.Success = result.Success; if (result.Success) { var sucursal = _sucursales.GetById(venta.SucursalId); var timbrado = _timbrados.GetById(venta.TimbradoId); data.RazonSocial = "Casa K-rlos S.A."; data.Ruc = "1234567-5"; data.NombreSucursal = sucursal.Nombre; data.Direccion = "Ruta 3 Gral Elizardo Aquino Km 325"; data.Telefono = "(0971) - 222 333"; data.Timbrado = timbrado.NroTimbrado; data.InicioTimbrado = timbrado.FechaInicio.ToString("dd/MM/yyyy"); data.FinTimbrado = timbrado.FechaFin.ToString("dd/MM/yyyy"); data.Fecha = venta.DateCreated.ToString("dd/MM/yyyy"); data.Hora = venta.DateCreated.Hour + ":" + venta.DateCreated.Minute; data.TipoFactura = venta.CondicionVenta == Core.Constants.CondicionVenta.Credito ? "Credito" : "Contado"; data.NroFactura = venta.NroFacturaString; var entitie = _clientes.GetById(venta.ClienteId); data.DisplayName = !string.IsNullOrEmpty(entitie.RazonSocial) ? entitie.RazonSocial : $"{entitie.Nombre} {entitie.Apellido}"; data.RUCEntitie = entitie.Ruc; data.TelefonoEntitie = string.IsNullOrEmpty(entitie.Telefono) ? "" : entitie.Telefono; data.DireccionEntitie = ""; foreach (var detalle in venta.DetalleVenta) { var temp = new DetalleFacturaPdfModel() { Cantidad = detalle.Cantidad, Descripcion = detalle.Descripcion, PrecioUnitario = detalle.PrecioVenta, }; var producto = _productos.GetById(detalle.ProductoId); if (producto.PorcentajeIva == Core.Constants.PorcIva.Excento) { temp.PrecioTotalExcenta = detalle.MontoTotal; data.SubTotalExcenta += detalle.MontoTotal; } if (producto.PorcentajeIva == Core.Constants.PorcIva.Cinco) { temp.PrecioTotalCinco = detalle.MontoTotal; data.SubTotalCinco += detalle.MontoTotal; } if (producto.PorcentajeIva == Core.Constants.PorcIva.Diez) { temp.PrecioTotalDiez = detalle.MontoTotal; data.SubTotalDiez += detalle.MontoTotal; } data.MontoTotal += detalle.MontoTotal; data.MontoTotalString = numString.Convertir(data.MontoTotal.ToString(), true); data.Detalles.Add(temp); data.IvaDiez = venta.IvaDiez; data.IvaCinco = venta.IvaCinco; data.IvaTotal = venta.IvaCinco + venta.IvaDiez; } } else { data.Message = "No se pudo imprimir la venta"; } return(data); } catch (Exception ex) { throw; } }