Beispiel #1
0
        /// <summary>
        /// actualiza un registro
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            try
            {
                using (var conexion = new DataModelFE())
                {
                    // se declara el objeto a insertar
                    CondicionVenta dato = new CondicionVenta();
                    //llena el objeto con los valores de la pantalla
                    dato.codigo = e.NewValues["codigo"] != null ? e.NewValues["codigo"].ToString().ToUpper() : null;

                    //busca el objeto
                    dato = conexion.CondicionVenta.Find(dato.codigo);
                    dato.descripcionEN       = e.NewValues["descripcionEN"] != null ? e.NewValues["descripcionEN"].ToString().ToUpper() : null;
                    dato.descripcion         = e.NewValues["descripcion"] != null ? e.NewValues["descripcion"].ToString().ToUpper() : null;
                    dato.estado              = e.NewValues["estado"].ToString();
                    dato.usuarioModificacion = Session["usuario"].ToString();
                    dato.fechaModificacion   = Date.DateTimeNow();

                    //modifica objeto
                    conexion.Entry(dato).State = EntityState.Modified;
                    conexion.SaveChanges();

                    //esto es para el manero del devexpress
                    e.Cancel = true;
                    this.ASPxGridView1.CancelEdit();
                }
            }
            catch (DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                var errorMessages = ex.EntityValidationErrors
                                    .SelectMany(x => x.ValidationErrors)
                                    .Select(x => x.ErrorMessage);

                // Join the list to a single string.
                var fullErrorMessage = string.Join("; ", errorMessages);

                // Throw a new DbEntityValidationException with the improved exception message.
                throw new DbEntityValidationException(fullErrorMessage, ex.EntityValidationErrors);
            }
            catch (Exception ex)
            {
                throw new Exception(Utilidades.validarExepcionSQL(ex), ex.InnerException);
            }
            finally
            {
                //refescar los datos
                this.refreshData();
            }
        }
Beispiel #2
0
        private int ObtenerCondicionVenta(CondicionVenta condicionVenta)
        {
            int condicionVentaId = 0;

            if (condicionVenta.dias == 0)
            {
                condicionVentaId = 1;
            }

            if (condicionVenta.dias > 0)
            {
                condicionVentaId = 2;
            }

            return(condicionVentaId);
        }
Beispiel #3
0
        public CondicionVenta getCondicionVenta(int condicionVentaId)
        {
            using (connection = new SqlConnection(connectionStringCrm))
            {
                CondicionVenta con = new CondicionVenta();

                query = "Select CondicionVentaID, CondicionVentaNombre, Dias From CondicionesVenta Where CondicionVentaID = @CondicionVentaID";

                command = new SqlCommand(query, connection);

                SqlParameter paramCondicionVentaId = new SqlParameter();
                paramCondicionVentaId.ParameterName = "@CondicionVentaID";
                paramCondicionVentaId.SqlDbType     = SqlDbType.Int;
                paramCondicionVentaId.SqlValue      = condicionVentaId;

                command.Parameters.Add(paramCondicionVentaId);

                try
                {
                    connection.Open();

                    SqlDataReader reader = command.ExecuteReader();

                    if (reader.Read())
                    {
                        con.condicionVentaId     = Convert.ToInt32(reader["CondicionVentaID"]);
                        con.condicionVentaNombre = Convert.ToString(reader["CondicionVentaNombre"]);
                        con.dias = Convert.ToInt32(reader["Dias"]);
                    }
                    else
                    {
                        con = null;
                    }

                    return(con);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public Documento(DateTime fechaEmision,
                         Emisor emisor,
                         CondicionVenta condicionVenta,
                         MedioPago medioPago,
                         String numero,
                         TipoDocumento tipoDocumento,
                         String codigoSeguridad,
                         Item[] items,
                         ResumenFactura resumenFactura,
                         SituacionDocumento situacionDocumento,

                         //Parametros opcionales
                         Receptor receptor        = null,
                         Normativa normativa      = null,
                         Referencia[] referencias = null,
                         string plazoCredito      = "",
                         string pais = "506",
                         string sede = "001",
                         string terminalPuntodeVenta = "00001")
        {
            if (normativa == null)
            {
                normativa = new Normativa( );
            }
            this.fechaEmision       = fechaEmision;
            this.emisor             = emisor;
            this.receptor           = receptor;
            this.condicionVenta     = condicionVenta;
            this.plazoCredito       = plazoCredito;
            this.medioPago          = medioPago;
            this.numero             = numero;
            this.tipoDocumento      = tipoDocumento;
            this.codigoSeguridad    = codigoSeguridad;
            this.items              = items;
            this.referencias        = referencias;
            this.resumenFactura     = resumenFactura;
            this.situacionDocumento = situacionDocumento;
            this.pais = pais;
            this.sede = sede;
            this.terminalPuntodeVenta = terminalPuntodeVenta;
        }
Beispiel #5
0
        //public async Task GenerarComprobante(TipoComprobante tipoComprobante, string fechaComprobante, ConceptosIncluir Conceptos, CondicionIVA Condicion,
        //    TipoDocumento TipoDoc, string NroDocumento, CondicionVenta FormaPago)
        public async Task GenerarComprobante(TipoComprobante tipoComprobante, string fechaComprobante, ConceptosIncluir Conceptos, CondicionIVA Condicion,
                                             TipoDocumento TipoDoc, string NroDocumento, CondicionVenta FormaPago)
        {
            try
            {
                var btnGenerarComprantes = await newPage.QuerySelectorAsync("#btn_gen_cmp > span.ui-button-text");

                if (btnGenerarComprantes != null)
                {
                    await btnGenerarComprantes.ClickAsync();
                }
                else
                {
                    var btnGenerarComprantes2 = await newPage.QuerySelectorAsync("#btn_gen_cmp > span.ui-button-text");

                    await btnGenerarComprantes2.ClickAsync();
                }
                await newPage.WaitForNavigationAsync();

                //selector donde se seleccionan los puntos de venta
                await newPage.SelectAsync("select#puntodeventa", "3");

                await newPage.WaitForSelectorAsync("#universocomprobante > option:nth-child(2)");

                //se selecciona el tipo de comprobante
                switch (tipoComprobante)
                {
                case TipoComprobante.FacturaC:
                    await newPage.SelectAsync("select#universocomprobante", "2");

                    break;

                case TipoComprobante.NotaDebito:
                    await newPage.SelectAsync("select#universocomprobante", "3");

                    break;

                case TipoComprobante.NotaCredito:
                    await newPage.SelectAsync("select#universocomprobante", "4");

                    break;
                }


                //se presona el boton siguiente para pasar al siguiente formulario
                var btnSiguiente = await newPage.QuerySelectorAsync("#contenido > form > input[type=button]:nth-child(4)");

                if (btnSiguiente != null)
                {
                    await btnSiguiente.ClickAsync();
                }
                await newPage.WaitForNavigationAsync();

                var inputFecha = await newPage.QuerySelectorAsync("#fc");

                if (inputFecha != null)
                {
                    //Se ingresa la fecha en el input correspondiente el  formato dd/MM/yyyy
                    await inputFecha.EvaluateFunctionAsync <dynamic>("(el, value) => el.value = value", fechaComprobante);
                }
                if (inputFecha == null)
                {
                    Console.WriteLine("NO funca");
                }

                switch (Conceptos)
                {
                case ConceptosIncluir.Productos:
                    await newPage.SelectAsync("select#idconcepto", "1");

                    break;

                case ConceptosIncluir.Servicios:
                    await newPage.SelectAsync("select#idconcepto", "2");

                    break;

                case ConceptosIncluir.ProducosYServicios:
                    await newPage.SelectAsync("select#idconcepto", "3");

                    break;
                }
                //se presona el boton siguiente para pasar al siguiente formulario
                var btnSiguiente2 = await newPage.QuerySelectorAsync("#contenido > form > input[type=button]:nth-child(4)");

                if (btnSiguiente2 != null)
                {
                    await btnSiguiente2.ClickAsync();
                }

                await newPage.WaitForNavigationAsync();

                //switch case donde se selecciona la condicion del iva del receptor de la factura
                switch (Condicion)
                {
                case CondicionIVA.ConsumidoFinal:
                    await newPage.SelectAsync("select#idivareceptor", "5");

                    break;

                case CondicionIVA.IVAInscripto:
                    await newPage.SelectAsync("select#idivareceptor", "1");

                    break;
                }
                //switch case donde se selecciona el tipo de documento
                switch (TipoDoc)
                {
                case TipoDocumento.DNI:
                    await newPage.SelectAsync("select#idtipodocreceptor", "96");

                    break;

                case TipoDocumento.CUIL:
                    await newPage.SelectAsync("select#idtipodocreceptor", "96");

                    break;

                case TipoDocumento.CUIT:
                    await newPage.SelectAsync("select#idtipodocreceptor", "96");

                    break;
                }

                var inputNroDocumento = await newPage.QuerySelectorAsync("#nrodocreceptor");

                if (inputNroDocumento != null)
                {
                    //Se ingresa la
                    await inputNroDocumento.EvaluateFunctionAsync <dynamic>("(el, value) => el.value = value", NroDocumento);
                }



                string Forma  = "#formadepago";
                string Numero = "1";
                switch (FormaPago)
                {
                case CondicionVenta.Contado:
                    Numero = "1";
                    break;

                case CondicionVenta.TarjetaDebito:
                    Numero = "2";
                    break;

                case CondicionVenta.TarjetaCredito:
                    Numero = "3";
                    break;
                }
                var inputFormaPago = await newPage.QuerySelectorAsync(Forma + Numero);

                if (inputFormaPago != null)
                {
                    await inputFormaPago.ClickAsync();
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("algo que no esta bien esta mal");
                }

                //se presona el boton siguiente para pasar al siguiente formulario
                var btnSiguiente3 = await newPage.QuerySelectorAsync("#formulario > input[type=button]:nth-child(4)");

                if (btnSiguiente3 != null)
                {
                    await btnSiguiente3.ClickAsync();
                }

                await newPage.WaitForNavigationAsync();



                Console.ReadKey();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);

                throw;
            }
        }