예제 #1
0
        public FormDevolucion(ref ProductoDev ObjProductoDev, DAConnectionSQL ObjDAConnecion, UserSistemas oUserSistemas)
        {
            ObjDaConnexion   = ObjDAConnecion;
            oUserSistemasLog = oUserSistemas;
            InitializeComponent();

            this.Text = this.Text + " USER .: " + oUserSistemasLog.NOMVENDEDOR + " :.";

            ObjProducto = ObjProductoDev;
            CargaInfo(ref ObjProductoDev);
        }
예제 #2
0
 private void CargaInfo(ref ProductoDev ObjProductoDev)
 {
     Unidadesventas             = ObjProductoDev.UnidadesVenta;
     txt_serie.Text             = ObjProductoDev.Serie;
     txt_numero.Text            = ObjProductoDev.Numero.ToString();
     txt_codiart.Text           = ObjProductoDev.Referencia;
     txt_des.Text               = ObjProductoDev.Descripcion;
     txt_talla.Text             = ObjProductoDev.Talla;
     txt_color.Text             = ObjProductoDev.Color;
     txt_dades.Text             = ObjProductoDev.UnidadesVenta.ToString();
     txt_precio.Text            = ObjProductoDev.Precio.ToString();
     txt_alma.Text              = ObjProductoDev.Almacen;
     CBMotivodDev.DataSource    = objProcesosDB.GetMotivosDev(ObjDaConnexion);
     CBMotivodDev.DisplayMember = "DESCRIPCION";
     CBMotivodDev.ValueMember   = "IDMOTIVO";
 }
예제 #3
0
 private void FormDevolucion_Leave(object sender, EventArgs e)
 {
     ObjProducto = null;
 }
예제 #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     ObjProducto = null;
     //ObjProducto.
     this.Close();
 }
예제 #5
0
        public bool ValidarDevolucion(ProductoDev OProductosDevNCR, int TotalDevoluciones)
        {
            bool Procesar         = false;
            int  TotalProducXProc = (from DevxProcesar in ObjListaProductosDev select DevxProcesar.UnidadesDevueltas).Sum();

            if (TotalDevoluciones > OProductosDevNCR.UnidadesVenta)  //ObjListaNCR[0].Unidades)
            {
                var result = MessageBox.Show("El Artículo " + OProductosDevNCR.CodBarra + " de la Factura " + OProductosDevNCR.Serie + " " + OProductosDevNCR.Numero +
                                             " Posee Devoluciones Previas " + "\r\n" +
                                             " Desea Verificar Devoluciones?", "Información", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    ListaNotasCredito ObjListaNCR = new ListaNotasCredito();
                    ObjListaNCR = ObjProcDB.ValidarDevolucion(ObjDaConnexion, OProductosDevNCR.Serie, OProductosDevNCR.Numero,
                                                              OProductosDevNCR.CodBarra, OProductosDevNCR.UnidadesDevueltas, OProductosDevNCR.Linea_Fact);
                    ConsultaDevolucion v1 = new ConsultaDevolucion(ObjListaNCR);
                    this.Hide();
                    v1.ShowDialog();
                    this.Show();
                }
                else
                {
                    MessageBox.Show("No se pueden Devolver más unidades de las vendidas en esta Factura " + "\r\n"
                                    , "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else if (TotalDevoluciones + TotalProducXProc > OProductosDevNCR.UnidadesVenta)
            {
                MessageBox.Show("No se puede devolver mas de lo permitido, Solo Puede Procesar lo Pendiente " + "\r\n"
                                , "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }


            else
            {
                NotasCredito ObjNCR = new NotasCredito();

                ObjNCR.Almacen     = OProductosDevNCR.Almacen;
                ObjNCR.CodArticulo = OProductosDevNCR.CodArticulo;
                ObjNCR.CodBarra    = OProductosDevNCR.CodBarra;
                ObjNCR.CodColor    = OProductosDevNCR.CodColor;
                ObjNCR.Color       = OProductosDevNCR.Color;
                ObjNCR.Descripcion = OProductosDevNCR.Descripcion;
                ObjNCR.Fecha_Fact  = OProductosDevNCR.Fecha_Factura;
                ObjNCR.Num_Fact    = OProductosDevNCR.Numero;
                ObjNCR.Precio      = OProductosDevNCR.Precio;
                //ObjNCR. = OProductosDevNCR. ;

                ObjListaNotasCredito.Add(ObjNCR);
                Procesar = true;
            }

            //var result2 = MessageBox.Show("Se va a procesar la Devolución? " + "\r\n"
            //, "Información", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            //if (result2 == DialogResult.Yes)
            //{

            //}

            return(Procesar);
        }
예제 #6
0
        private void dgv_Doc_DoubleClick(object sender, EventArgs e)
        {
            string            RutaImagen;
            ListaNotasCredito ObjListaNCR    = new ListaNotasCredito();
            ProductoDev       ObjProductoDev = new ProductoDev();

            ObjProductoDev.Serie         = this.dgv_Doc.CurrentRow.Cells[0].Value.ToString();
            ObjProductoDev.Numero        = int.Parse(this.dgv_Doc.CurrentRow.Cells[1].Value.ToString());
            ObjProductoDev.Fecha_Factura = DateTime.Parse(this.txt_fecha.Text);
            ObjProductoDev.Referencia    = this.dgv_Doc.CurrentRow.Cells[2].Value.ToString();
            ObjProductoDev.Descripcion   = this.dgv_Doc.CurrentRow.Cells[3].Value.ToString();
            ObjProductoDev.Talla         = this.dgv_Doc.CurrentRow.Cells[4].Value.ToString();
            ObjProductoDev.Color         = this.dgv_Doc.CurrentRow.Cells[5].Value.ToString();
            ObjProductoDev.UnidadesVenta = int.Parse(this.dgv_Doc.CurrentRow.Cells[6].Value.ToString());
            ObjProductoDev.Precio        = decimal.Parse(this.dgv_Doc.CurrentRow.Cells[10].Value.ToString());
            ObjProductoDev.Almacen       = this.dgv_Doc.CurrentRow.Cells[12].Value.ToString();
            ObjProductoDev.Retornable    = this.dgv_Doc.CurrentRow.Cells[11].Value.ToString();
            ObjProductoDev.CodBarra      = this.dgv_Doc.CurrentRow.Cells[13].Value.ToString();
            ObjProductoDev.CodColor      = this.dgv_Doc.CurrentRow.Cells[14].Value.ToString();
            ObjProductoDev.CodArticulo   = int.Parse(this.dgv_Doc.CurrentRow.Cells[15].Value.ToString());
            ObjProductoDev.NumLinea      = int.Parse(this.dgv_Doc.CurrentRow.Cells[16].Value.ToString());
            ObjProductoDev.Linea_Fact    = int.Parse(this.dgv_Doc.CurrentRow.Cells[16].Value.ToString());



            ObjProductoDev.Procesado = false;

            byte[] FotoItem = ObjProcDB.BuscarFotoArticulo(ObjDaConnexion, ObjProductoDev.CodArticulo);

            PBArticulos.Image = byteArrayToImage(FotoItem);

            if (FotoItem != null)
            {
                PBArticulos.Image = byteArrayToImage(FotoItem);
            }
            else
            {
                RutaImagen        = Settings.Default.PathImagCUST + "NOIMAGEN" + ".jpg";
                PBArticulos.Image = Image.FromFile(RutaImagen);
            }



            if (ObjProductoDev.Retornable == "T")
            {
                FormDevolucion v1 = new FormDevolucion(ref ObjProductoDev, ObjDaConnexion, oUserSistemasLog);
                v1.ShowDialog();
                this.Show();

                if (ObjProductoDev.RazonDevolucion != null && ObjProductoDev.UnidadesDevueltas != 0)
                {
                    if (ObjProductoDev.Procesado)
                    {
                        ObjListaNCR = ObjProcDB.ValidarDevolucion(ObjDaConnexion, ObjProductoDev.Serie, ObjProductoDev.Numero, ObjProductoDev.CodBarra, ObjProductoDev.UnidadesDevueltas, ObjProductoDev.Linea_Fact);
                        // TotalProducDev = (from NotasCredito in ObjListaNCR where NotasCredito.UnidadesDevueltas != 0 select sum(NotasCredito));

                        if (ObjListaNCR.Count > 0)
                        {
                            bool procesar = false;
                            //Debe ser una sola validacion
                            //foreach (var item in ObjListaNCR)
                            //{
                            TotalProducDev = (from NotasCredito in ObjListaNCR select NotasCredito.UnidadesDevueltas).Sum();
                            //procesar = ValidarDevolucion( ObjListaNCR[0], TotalProducDev + ObjProductoDev.UnidadesDevueltas);
                            procesar = ValidarDevolucion(ObjProductoDev, TotalProducDev + ObjProductoDev.UnidadesDevueltas);
                            if (procesar)
                            {
                                ObjListaProductosDev.Add(ObjProductoDev);
                                CargarGridProductosDev(ObjListaProductosDev);
                            }
                            //}
                        }
                        else
                        {
                            bool procesar = false;
                            TotalProducDev = (from ProductoDev in ObjListaProductosDev
                                              where ProductoDev.CodBarra.ToString() == ObjProductoDev.CodBarra.ToString() &
                                              ProductoDev.NumLinea == ObjProductoDev.NumLinea
                                              select ProductoDev.UnidadesDevueltas).Sum();

                            if (ObjProductoDev.UnidadesDevueltas + TotalProducDev > ObjProductoDev.UnidadesVenta)
                            {
                                MessageBox.Show("El Artículo " + ObjProductoDev.CodBarra + " de la Factura " + ObjProductoDev.Serie + " " + ObjProductoDev.Numero +
                                                " Ya esta incluida para Procesar como Devolución", "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }

                            foreach (var someobject in ObjListaProductosDev)
                            {
                                if (someobject.CodBarra.ToString() == dgv_Doc.CurrentRow.Cells[13].Value.ToString())
                                {
                                    procesar = true;
                                    someobject.UnidadesDevueltas = ObjProductoDev.UnidadesDevueltas + TotalProducDev;
                                }
                                //ObjListaProductosDev.Add(ObjProductoDev);
                                //CargarGridProductosDev(ObjListaProductosDev);
                            }

                            if (procesar)
                            {
                                ObjListaProductosDev.Add(ObjProductoDev);
                                Dgv_ProductosDev.DataSource = null;
                                Dgv_ProductosDev.DataSource = ObjListaProductosDev;
                            }
                            else
                            {
                                ObjListaProductosDev.Add(ObjProductoDev);
                                CargarGridProductosDev(ObjListaProductosDev);
                            }
                        }
                    }
                }
            }

            else
            {
                MessageBox.Show("Producto no acepta Devolución", "Notificación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }