コード例 #1
0
ファイル: frmNuevaVenta.cs プロジェクト: Brainer2511/Kosturas
        public void CargarPanelProductos(int aiProducto, string NombreProducto, double PrecioProducto)
        {
            try
            {
                var id        = aiProducto;
                var productos = db.Productos.Where(q => q.ProductoId == id).ToList();
                listaProductos = new List <OrdenDetalleViewModel>();
                var Colores = true;
                foreach (var item in productos)
                {
                    var panelViewProductos = new OrdenDetalleViewModel(string.Empty, string.Empty, 0);



                    panelViewProductos.panelTarea.Size        = new Size(897, 45);
                    panelViewProductos.panelTarea.MouseEnter += new EventHandler(Mouseovertabla);
                    panelViewProductos.panelTarea.MouseLeave += new EventHandler(Mouseleavetabla);
                    panelViewProductos.panelTarea.Name        = item.CodigoId.ToString();

                    if (Colores == true)
                    {
                        panelViewProductos.panelTarea.BackColor = Color.White;
                        Colores = false;
                    }
                    else
                    {
                        panelViewProductos.panelTarea.BackColor = Color.WhiteSmoke;
                        Colores = true;
                    }



                    panelViewProductos.lblTarea.Text = item.Nombre.ToString();

                    panelViewProductos.lblTarea.Location = new Point(0, 0);

                    panelViewProductos.lblTarea.Size = new Size(90, 45);



                    panelViewProductos.txtPrecio.Text = "1";

                    panelViewProductos.txtPrecio.KeyPress += new KeyPressEventHandler(ClickPrecioneTecla);
                    panelViewProductos.txtPrecio.Location  = new Point(115, 0);

                    panelViewProductos.txtPrecio.Size = new System.Drawing.Size(100, 34);


                    panelViewProductos.lblPrecio.Text = item.PrecioVenta.ToString();

                    panelViewProductos.lblPrecio.Location = new Point(230, 0);



                    panelViewProductos.cmbDescuentos.Name                  = item.ProductoId.ToString();
                    panelViewProductos.cmbDescuentos.DataSource            = db.Ofertas.ToList();
                    panelViewProductos.cmbDescuentos.DisplayMember         = "Descripcion";
                    panelViewProductos.cmbDescuentos.ValueMember           = "OfertaId";
                    panelViewProductos.cmbDescuentos.SelectedIndexChanged += new EventHandler(ClickDescuento);

                    panelViewProductos.cmbDescuentos.Location = new Point(325, 0);


                    panelViewProductos.lblSubTotal.Text = item.PrecioVenta.ToString();

                    panelViewProductos.lblSubTotal.Location = new Point(452, 0);



                    panelViewProductos.panelTarea.Controls.Add(panelViewProductos.lblTarea);
                    panelViewProductos.panelTarea.Controls.Add(panelViewProductos.txtPrecio);
                    panelViewProductos.panelTarea.Controls.Add(panelViewProductos.cmbDescuentos);
                    panelViewProductos.panelTarea.Controls.Add(panelViewProductos.lblPrecio);

                    panelViewProductos.panelTarea.Controls.Add(panelViewProductos.lblSubTotal);

                    listaProductos.Add(panelViewProductos);
                    rowCount         += 1;
                    tbpDatos.RowCount = rowCount;
                    this.tbpDatos.Controls.Add(listaProductos.Last().panelTarea, 0, rowCount);

                    var ultimatarea       = listaProductos.Last();
                    var CantidadArticulos = int.Parse(ultimatarea.txtPrecio.Text);

                    var detalleVenta = new DetalleVentas {
                        Precio = double.Parse(ultimatarea.lblPrecio.Text), Cantidad = CantidadArticulos, Descuento = Descuento, Subtotal = double.Parse(ultimatarea.lblSubTotal.Text), CodigoId = aiProducto, VentaId = ventaId
                    };
                    db.DetalleVentas.Add(detalleVenta);
                    db.SaveChanges();
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #2
0
ファイル: OrdenMap.cs プロジェクト: altivaIsacc/altivawebapp
        public TbPrOrdenDetalle ViewModelToDomainSingleOD(OrdenDetalleViewModel viewModel, OrdenViewModel orden)
        {
            var domain = new TbPrOrdenDetalle
            {
                Cantidad         = viewModel.Cantidad,
                Id               = viewModel.Id,
                IdInventario     = viewModel.IdInventario,
                IdOrden          = viewModel.IdOrden,
                NombreInventario = viewModel.NombreInventario,
                PorcIs           = viewModel.PorcIs,
                PorcIva          = viewModel.PorcIva,
                PorcDesc         = viewModel.PorcDesc
            };

            float dolar = (float)orden.TipoCambioDolar;
            float euro  = (float)orden.TipoCambioEuro;

            if (viewModel.IdMonedaOD == 1)
            {
                domain.SubTotalExcentoBase  = viewModel.SubTotalExcento;
                domain.SubTotalExcentoDolar = domain.SubTotalExcentoBase / dolar;
                domain.SubTotalExcentoEuro  = domain.SubTotalExcentoBase / euro;

                domain.SubTotalGrabadoBase  = viewModel.SubTotalGrabado;
                domain.SubTotalGrabadoDolar = domain.SubTotalGrabadoBase / dolar;
                domain.SubTotalGrabadoEuro  = domain.SubTotalGrabadoBase / euro;

                domain.SubTotalNetoBase  = viewModel.SubTotalNeto;
                domain.SubTotalNetoDolar = domain.SubTotalNetoBase / dolar;
                domain.SubTotalNetoEuro  = domain.SubTotalNetoBase / euro;

                domain.TotalIvabase  = viewModel.TotalIva;
                domain.TotalIvadolar = domain.TotalIvabase / dolar;
                domain.TotalIvaeuro  = domain.TotalIvabase / euro;

                domain.TotalIsbase  = viewModel.TotalIva;
                domain.TotalIsdolar = domain.TotalIsbase / dolar;
                domain.TotalIseuro  = domain.TotalIsbase / euro;

                domain.TotalBase  = viewModel.Total;
                domain.TotalDolar = domain.TotalBase / dolar;
                domain.TotalEuro  = domain.TotalBase / euro;



                domain.PrecioBase  = viewModel.Precio;
                domain.PrecioDolar = viewModel.Precio / dolar;
                domain.PrecioEuro  = viewModel.Precio / euro;

                domain.TotalDescuentoBase  = viewModel.TotalDescuento;
                domain.TotalDescuentoDolar = viewModel.TotalDescuento / dolar;
                domain.TotalDescuentoEuro  = viewModel.TotalDescuento / euro;
            }
            else if (viewModel.IdMonedaOD == 2)
            {
                domain.SubTotalExcentoBase  = viewModel.SubTotalExcento * dolar;
                domain.SubTotalExcentoDolar = viewModel.SubTotalExcento;
                domain.SubTotalExcentoEuro  = domain.SubTotalExcentoBase / euro;

                domain.SubTotalGrabadoBase  = viewModel.SubTotalGrabado * dolar;
                domain.SubTotalGrabadoDolar = viewModel.SubTotalGrabado;
                domain.SubTotalGrabadoEuro  = domain.SubTotalGrabadoBase / euro;

                domain.SubTotalNetoBase  = viewModel.SubTotalNeto * dolar;
                domain.SubTotalNetoDolar = viewModel.SubTotalNeto;
                domain.SubTotalNetoEuro  = domain.SubTotalNetoBase / euro;

                domain.TotalIvabase  = viewModel.TotalIva * dolar;
                domain.TotalIvadolar = viewModel.TotalIva;
                domain.TotalIvaeuro  = domain.TotalIvabase / euro;

                domain.TotalIsbase  = viewModel.TotalIs * dolar;
                domain.TotalIsdolar = viewModel.TotalIs;
                domain.TotalIseuro  = domain.TotalIsbase / euro;

                domain.TotalBase  = viewModel.Total * dolar;
                domain.TotalDolar = viewModel.Total;
                domain.TotalEuro  = domain.TotalBase / euro;

                domain.PrecioBase  = viewModel.Precio * dolar;
                domain.PrecioDolar = viewModel.Precio;
                domain.PrecioEuro  = domain.PrecioBase / euro;

                domain.TotalDescuentoBase  = viewModel.TotalDescuento * dolar;
                domain.TotalDescuentoDolar = viewModel.TotalDescuento;
                domain.TotalDescuentoEuro  = domain.TotalDescuentoBase / euro;
            }
            else if (viewModel.IdMonedaOD == 3)
            {
                domain.SubTotalExcentoBase  = viewModel.SubTotalExcento * euro;
                domain.SubTotalExcentoDolar = domain.SubTotalExcentoBase / dolar;
                domain.SubTotalExcentoEuro  = viewModel.SubTotalExcento;

                domain.SubTotalGrabadoBase  = viewModel.SubTotalGrabado * euro;
                domain.SubTotalGrabadoDolar = domain.SubTotalGrabadoBase / dolar;
                domain.SubTotalGrabadoEuro  = viewModel.SubTotalGrabado;

                domain.SubTotalNetoBase  = viewModel.SubTotalNeto * euro;
                domain.SubTotalNetoDolar = domain.SubTotalNetoBase / dolar;
                domain.SubTotalNetoEuro  = viewModel.SubTotalNeto;

                domain.TotalIvabase  = viewModel.TotalIva * euro;
                domain.TotalIvadolar = domain.TotalIvabase / dolar;
                domain.TotalIvaeuro  = viewModel.TotalIva;

                domain.TotalIsbase  = viewModel.TotalIs * euro;
                domain.TotalIsdolar = domain.TotalIsbase / dolar;
                domain.TotalIseuro  = viewModel.TotalIs;

                domain.TotalBase  = viewModel.Total * euro;
                domain.TotalDolar = domain.TotalBase / dolar;
                domain.TotalEuro  = viewModel.Total;

                domain.PrecioBase  = viewModel.Precio * euro;
                domain.PrecioDolar = domain.PrecioBase / dolar;
                domain.PrecioEuro  = viewModel.Precio;

                domain.TotalDescuentoBase  = viewModel.TotalDescuento * euro;
                domain.TotalDescuentoDolar = domain.TotalDescuentoBase / dolar;
                domain.TotalDescuentoEuro  = viewModel.TotalDescuento;
            }

            return(domain);
        }
コード例 #3
0
        void ClickPAgos(object sender, EventArgs e)
        {
            try
            {
                listaPagos = new List <OrdenDetalleViewModel>();
                Panel btn = sender as Panel;
                var   id  = int.Parse(btn.Name);

                var Colores = true;

                rowCount = 0;


                var orden = db.Pagos.Where(q => q.OrdenId == id).ToList();



                foreach (var pago in orden.ToList())
                {
                    var panelViewTarea = new OrdenDetalleViewModel(string.Empty, string.Empty, 0);



                    panelViewTarea.panelTarea.MouseEnter += new EventHandler(MouseoverDos);
                    panelViewTarea.panelTarea.MouseLeave += new EventHandler(MouseleaveDos);
                    panelViewTarea.panelTarea.Size        = new Size(370, 30);
                    panelViewTarea.panelTarea.Name        = pago.PagoId.ToString();

                    if (Colores == true)
                    {
                        panelViewTarea.panelTarea.BackColor = Color.White;
                        Colores = false;
                    }
                    else
                    {
                        panelViewTarea.panelTarea.BackColor = Color.WhiteSmoke;
                        Colores = true;
                    }

                    panelViewTarea.lblId.Text = pago.Fecha.ToString();

                    panelViewTarea.lblId.Location = new Point(0, 0);
                    panelViewTarea.lblId.Size     = new Size(65, 20);
                    panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblId);

                    panelViewTarea.lblTarea.Text = pago.Monto.ToString();

                    panelViewTarea.lblTarea.Location = new Point(80, 0);
                    panelViewTarea.lblTarea.Size     = new Size(65, 20);

                    panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblTarea);

                    panelViewTarea.lblDetalleTarea.Text = pago.MediosPago.FormaPago.ToString();

                    panelViewTarea.lblDetalleTarea.Location = new Point(150, 0);
                    panelViewTarea.lblDetalleTarea.Size     = new Size(65, 20);

                    panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblDetalleTarea);

                    panelViewTarea.lblPrecio.Text = pago.EmpleadoRealizo.ToString();

                    panelViewTarea.lblPrecio.Location = new Point(225, 0);
                    panelViewTarea.lblPrecio.Size     = new Size(65, 20);

                    panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblPrecio);

                    panelViewTarea.lblDescuento.Text = pago.Puntos.ToString();

                    panelViewTarea.lblDescuento.Location = new Point(300, 0);
                    panelViewTarea.lblDescuento.Size     = new Size(45, 20);

                    panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblDescuento);

                    listaPagos.Add(panelViewTarea);
                    rowCount += 1;
                    tblDetalleOrdenesClientes.RowCount = rowCount;
                    this.tlpPagos.Controls.Add(listaPagos.Last().panelTarea, 0, rowCount);
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #4
0
        void ClickCargarOrden(object sender, EventArgs e)
        {
            try
            {
                listaTareas  = new List <OrdenDetalleViewModel>();
                listaPrendas = new List <OrdenPrendaViewModel>();

                BorrarPanelDetalleOrdenes();
                BorrarPanelPagos();
                Panel btn = sender as Panel;
                var   id  = int.Parse(btn.Name);

                var Colores = true;

                rowCount = 0;


                var orden = db.Ordenes.Find(id);

                label8.Text  = orden.EmpleadoRealizo;
                label9.Text  = orden.EmpleadoActualizo;
                label11.Text = orden.EmpleadoCompleto;



                foreach (var prenda in orden.Prendas)

                {
                    var panelViewPrenda = new OrdenPrendaViewModel(string.Empty);



                    panelViewPrenda.panelPrenda.Name = prenda.DetalleOrdenPrendaId.ToString();

                    panelViewPrenda.lblPrenda.Text = prenda.Prenda.TipoRopa.ToString() + "X" + prenda.Cantidad;



                    panelViewPrenda.panelPrenda.Controls.Add(panelViewPrenda.lblPrenda);
                    listaPrendas.Add(panelViewPrenda);
                    rowCount += 1;
                    tblDetalleOrdenesClientes.RowCount = rowCount;
                    this.tblDetalleOrdenesClientes.Controls.Add(listaPrendas.Last().panelPrenda, 0, rowCount);

                    foreach (var tarea in prenda.DetalleTareas)
                    {
                        var panelViewTarea = new OrdenDetalleViewModel(string.Empty, string.Empty, 0);



                        panelViewTarea.panelTarea.MouseEnter += new EventHandler(MouseoverDos);
                        panelViewTarea.panelTarea.MouseLeave += new EventHandler(MouseleaveDos);
                        panelViewTarea.panelTarea.Size        = new Size(1020, 30);
                        panelViewTarea.panelTarea.Name        = tarea.DetalleOrdenesId.ToString();
                        panelViewTarea.DetalleOrdenesId       = tarea.DetalleOrdenesId;
                        if (Colores == true)
                        {
                            panelViewTarea.panelTarea.BackColor = Color.White;
                            Colores = false;
                        }
                        else
                        {
                            panelViewTarea.panelTarea.BackColor = Color.WhiteSmoke;
                            Colores = true;
                        }

                        panelViewTarea.lblId.Text = tarea.Prenda.OrdenId.ToString();

                        panelViewTarea.lblId.Location = new Point(0, 0);
                        panelViewTarea.lblId.Size     = new Size(65, 20);
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblId);

                        panelViewTarea.lblTarea.Text = tarea.Detalle.Tarea.NombreTareas.ToString();

                        panelViewTarea.lblTarea.Location = new Point(90, 0);
                        panelViewTarea.lblTarea.Size     = new Size(135, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblTarea);

                        panelViewTarea.lblDetalleTarea.Text = tarea.Detalle.DetalleTareas.ToString();

                        panelViewTarea.lblDetalleTarea.Location = new Point(230, 0);
                        panelViewTarea.lblDetalleTarea.Size     = new Size(135, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblDetalleTarea);

                        panelViewTarea.lblPrecio.Text = tarea.Detalle.Precio.ToString();

                        panelViewTarea.lblPrecio.Location = new Point(400, 0);
                        panelViewTarea.lblPrecio.Size     = new Size(65, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblPrecio);

                        panelViewTarea.txtTotalPrecio.Text = (tarea.Descuento).ToString();

                        panelViewTarea.txtTotalPrecio.Location = new Point(480, 0);
                        panelViewTarea.txtTotalPrecio.Size     = new Size(65, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.txtTotalPrecio);

                        panelViewTarea.lblSubTotal.Text = (tarea.Subtotal).ToString();

                        panelViewTarea.lblSubTotal.Location = new Point(560, 0);
                        panelViewTarea.lblSubTotal.Size     = new Size(65, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblSubTotal);


                        panelViewTarea.lblDescuento.Text = ("").ToString();

                        panelViewTarea.lblDescuento.Location = new Point(640, 0);
                        panelViewTarea.lblDescuento.Size     = new Size(135, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblDescuento);

                        if (tarea.AfiliadoId > 0)
                        {
                            var nombre = db.Afiliados.Find(tarea.AfiliadoId);
                            panelViewTarea.lblAfiliado.Text = (nombre.Nombre);
                        }
                        else
                        {
                            panelViewTarea.lblAfiliado.Text = "";
                        }



                        panelViewTarea.lblAfiliado.Location = new Point(800, 0);
                        panelViewTarea.lblAfiliado.Size     = new Size(105, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblAfiliado);

                        panelViewTarea.lblEmpleado.Text = (tarea.EmpleadoActualizo).ToString();

                        panelViewTarea.lblEmpleado.Location = new Point(935, 0);
                        panelViewTarea.lblEmpleado.Size     = new Size(90, 20);

                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblEmpleado);

                        listaTareas.Add(panelViewTarea);
                        rowCount += 1;
                        tblDetalleOrdenesClientes.RowCount = rowCount;
                        this.tblDetalleOrdenesClientes.Controls.Add(listaTareas.Last().panelTarea, 0, rowCount);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #5
0
        void ClickCargarOrden(object sender, EventArgs e)
        {
            try
            {
                listaTareas  = new List <OrdenDetalleViewModel>();
                listaPrendas = new List <OrdenPrendaViewModel>();

                BorrarPanelDetalleOrdenes();

                Panel btn     = sender as Panel;
                var   id      = int.Parse(btn.Name);
                var   Colores = true;

                rowCount = 0;


                var orden = db.Ordenes.Find(id);

                label19.Text = orden.EmpleadoRealizo;
                label15.Text = orden.EmpleadoActualizo;
                label14.Text = orden.EmpleadoCompleto;



                foreach (var prenda in orden.Prendas)

                {
                    var panelViewPrenda = new OrdenPrendaViewModel(string.Empty);



                    panelViewPrenda.panelPrenda.Click += new EventHandler(ClickCargarOrden);
                    panelViewPrenda.panelPrenda.Name   = prenda.DetalleOrdenPrendaId.ToString();

                    panelViewPrenda.lblPrenda.Text = prenda.Prenda.TipoRopa.ToString() + "X" + prenda.Cantidad;



                    panelViewPrenda.panelPrenda.Controls.Add(panelViewPrenda.lblPrenda);
                    listaPrendas.Add(panelViewPrenda);
                    rowCount += 1;
                    tblDetalleOrdenesClientes.RowCount = rowCount;
                    this.tblDetalleOrdenesClientes.Controls.Add(listaPrendas.Last().panelPrenda, 0, rowCount);

                    foreach (var tarea in prenda.DetalleTareas)
                    {
                        var panelViewTarea = new OrdenDetalleViewModel(string.Empty, string.Empty, 0);



                        panelViewTarea.panelTarea.Click      += new EventHandler(ClickCargarOrden);
                        panelViewTarea.panelTarea.MouseEnter += new EventHandler(MouseoverDos);
                        panelViewTarea.panelTarea.MouseLeave += new EventHandler(MouseleaveDos);
                        panelViewTarea.panelTarea.Name        = tarea.DetalleOrdenesId.ToString();
                        panelViewTarea.DetalleOrdenesId       = tarea.DetalleOrdenesId;
                        if (Colores == true)
                        {
                            panelViewTarea.panelTarea.BackColor = Color.White;
                            Colores = false;
                        }
                        else
                        {
                            panelViewTarea.panelTarea.BackColor = Color.WhiteSmoke;
                            Colores = true;
                        }



                        panelViewTarea.lblTarea.Text = tarea.Detalle.Tarea.NombreTareas.ToString();
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblTarea);

                        panelViewTarea.lblDetalleTarea.Text = tarea.Detalle.DetalleTareas.ToString();
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.lblDetalleTarea);

                        panelViewTarea.txtPrecio.Text = tarea.Detalle.Precio.ToString();
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.txtPrecio);

                        panelViewTarea.txtTotalPrecio.Text = (prenda.Cantidad * tarea.Detalle.Precio).ToString();
                        panelViewTarea.panelTarea.Controls.Add(panelViewTarea.txtTotalPrecio);

                        if (tarea.Estado == true)
                        {
                            panelViewTarea.btnEstado.BackColor = Color.OliveDrab;
                            panelViewTarea.btnEstado.ForeColor = Color.OliveDrab;
                            panelViewTarea.btnEstado.Text      = tarea.DetalleOrdenesId.ToString();
                            panelViewTarea.btnEstado.Click    += new EventHandler(ClickCambiarEstadoTarea);
                            panelViewTarea.panelTarea.Controls.Add(panelViewTarea.btnEstado);
                        }
                        else
                        {
                            panelViewTarea.btnEstado.Text   = tarea.DetalleOrdenesId.ToString();
                            panelViewTarea.btnEstado.Click += new EventHandler(ClickCambiarEstadoTarea);
                            panelViewTarea.panelTarea.Controls.Add(panelViewTarea.btnEstado);
                        }


                        listaTareas.Add(panelViewTarea);
                        rowCount += 1;
                        tblDetalleOrdenesClientes.RowCount = rowCount;
                        this.tblDetalleOrdenesClientes.Controls.Add(listaTareas.Last().panelTarea, 0, rowCount);
                    }
                }

                dgvPagos.DataSource = db.Pagos.Where(q => q.OrdenId == orden.OrdenId).Select(t => new { t.Fecha, t.Monto, t.MediosPago.FormaPago, t.EmpleadoRealizo, t.Puntos }).ToList();
            }
            catch (Exception)
            {
            }
        }