Example #1
0
        static void Configuracion()
        {
            var enviar = new Enviar();

            Console.WriteLine(enviar.ruta);
            Console.WriteLine(enviar.token);
        }
Example #2
0
        private void cmdEnviarUna_Click(object sender, EventArgs e)
        {
            int count = dataGridViewReporte.RowCount;

            if (count > 1)
            {
                int rowIndex        = dataGridViewReporte.CurrentCell.RowIndex;
                var tipoComprobante = dataGridViewReporte["tipo_comprobante", rowIndex].Value;
                var serie           = dataGridViewReporte["serie", rowIndex].Value;
                var numero          = dataGridViewReporte["numero", rowIndex].Value;
                Console.WriteLine("Comprobante: {0} - {1} - {2}",
                                  tipoComprobante.ToString(),
                                  serie.ToString(),
                                  numero.ToString()
                                  );
                Cursor.Current = Cursors.WaitCursor;
                var enviarFactura = new Enviar();
                var generaFactura = new GeneraFactura(
                    tipoComprobante.ToString(),
                    serie.ToString(),
                    numero.ToString()
                    );
                var factura = generaFactura.generaEnvio();
                enviarFactura.factura(factura);
                Cursor.Current = Cursors.Default;
                Consultar();
            }
        }
Example #3
0
        public string Verificar()
        {
            var conSqlServer = new Connection().InitSqlServer();

            if (FechaInicio == null)
            {
                return("La fecha debe contener un valor");
            }
            if (FechaFin == null)
            {
                return("La fecha debe contener un valor");
            }
            try
            {
                conSqlServer.Open();
                SqlCommand sqlCmd = new SqlCommand("select tipo_comprobante, serie, numero from v_peru_facturas_reporte " +
                                                   "where cast(fecha as Date) " +
                                                   "between cast(@fechaInicio as Date) and cast(@fechaFin as Date) " +
                                                   "and estado = @estado " +
                                                   "order by fecha, serie, numero asc",
                                                   conSqlServer);

                sqlCmd.Parameters.AddWithValue("@fechaInicio", this.FechaInicio);
                sqlCmd.Parameters.AddWithValue("@fechaFin", this.FechaFin);
                sqlCmd.Parameters.AddWithValue("@estado", ReporteFactura.NO_ENVIADO);

                SqlDataReader sqlRead = sqlCmd.ExecuteReader();

                var enviarFactura = new Enviar();

                while (sqlRead.Read())
                {
                    var generaFacturaVerificacion = new GeneraFactura(sqlRead["tipo_comprobante"].ToString(),
                                                                      sqlRead["serie"].ToString(),
                                                                      sqlRead["numero"].ToString());

                    var factura = generaFacturaVerificacion.generaVerificar();
                    enviarFactura.facturaVerificacion(factura);
                }

                sqlRead.Close();
                conSqlServer.Close();
                return("");
            }
            catch (Exception ex)
            {
                return("Error al verificar las facturas " + ex.ToString());
            }
        }