Example #1
0
        private void Dgv_ProductosDev_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                try
                {
                    //seleciona la fila del click derecho
                    var hti = dgv_Doc.HitTest(e.X, e.Y);
                    Dgv_ProductosDev.ClearSelection();

                    Dgv_ProductosDev.Rows[hti.RowIndex].Selected = true;

                    //creo menu conextual con dos items
                    ContextMenu cm = new ContextMenu();
                    MenuItem    mi = new MenuItem();
                    mi.Text   = "Eliminar Devolución";
                    mi.Click += EliminarLinea; //metodo al dar click
                    cm.MenuItems.Add(mi);

                    cm.Show(Dgv_ProductosDev, new Point(e.X, e.Y));
                }
                catch (Exception)
                {
                    MessageBox.Show(" No ha seleccionado ninguna Fila, intente Nuevamente ", "Información", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Example #2
0
        private void Dgv_ProductosDev_DoubleClick(object sender, EventArgs e)
        {
            string NumSerie;
            Int32  NumFactura   = 0;
            String CodigoBarras = "";

            NumSerie     = this.Dgv_ProductosDev.CurrentRow.Cells[0].Value.ToString();
            NumFactura   = int.Parse(this.Dgv_ProductosDev.CurrentRow.Cells[1].Value.ToString());
            CodigoBarras = this.Dgv_ProductosDev.CurrentRow.Cells[13].Value.ToString();

            var result = MessageBox.Show("Desea Elimar esta Linea del Proceso " + "\r\n" +
                                         " Desea Verificar Devoluciones?", "Información", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                ObjListaProductosDev.RemoveAll(x => x.Serie == NumSerie && x.Numero == NumFactura && x.CodBarra == CodigoBarras);
                Dgv_ProductosDev.DataSource = null;
                Dgv_ProductosDev.DataSource = ObjListaProductosDev;
                Dgv_ProductosDev.Refresh();
            }
        }
Example #3
0
        private void BtnProcesar_Click(object sender, EventArgs e)
        {
            bool         Exitoso             = false;
            string       SerieFacDocumento   = "";
            string       SerieFacActual      = "";
            Int32        NumDocDocument      = 0;
            Int32        NumDocActual        = 0;
            int          NumLinea            = 1;
            NotasCredito ObjNotaCreditoProc2 = new NotasCredito();

            this.Cursor = Cursors.WaitCursor;

            foreach (DataGridViewRow Row in Dgv_ProductosDev.Rows)
            {
                String strFila = Row.Index.ToString();
                //ListaNotasCredito ObjListaNCR = new ListaNotasCredito();
                NotasCredito ObjNotaCredito = new NotasCredito();

                SerieFacDocumento = Row.Cells[0].Value.ToString();
                NumDocDocument    = int.Parse(Row.Cells[1].Value.ToString());

                if (SerieFacDocumento == SerieFacActual && NumDocDocument == NumDocActual)
                {
                    NumLinea = NumLinea + 1;
                }
                else
                {
                    NumLinea = 1;
                }

                if (SerieFacActual != "" && NumDocActual != 0 && NumDocDocument != NumDocActual)
                {
                    //Procesa Nota de Credito
                    NotasCredito ObjNotaCreditoProc = new NotasCredito();
                    //Exitoso = ObjProcDB.EjecutarNotasCredito(ObjDaConnexion);

                    this.Cursor        = Cursors.WaitCursor;
                    ObjNotaCreditoProc = ObjProcDB.InsertarNotasCredito(ObjDaConnexion, ObjListaNotasCredito, TipoSerie, oUserSistemasLog);

                    ObjListaNotasCredito.Clear();

                    //ValidarProceso(Exitoso, SerieFacDocumento, NumDocDocument, NumLinea);

                    //ObjNotaCredit = BusarUlimaNotaCredito();
                    if (ObjNotaCreditoProc.Numero != 0)
                    {
                        ObjBuildXml.ContruyeXML(ObjNotaCreditoProc.Serie, ObjNotaCreditoProc.Numero);

                        Process.Start(RutaExeFirmado + "llamarEXE.exe");

                        var stopwatch = Stopwatch.StartNew();
                        Thread.Sleep(8000); //tiempo de pausa
                        stopwatch.Stop();

                        FrmPrintNCR MyFormPrintNCR = new FrmPrintNCR(ObjDaConnexion, ObjNotaCreditoProc);   //(ObjListaNCR);
                        MyFormPrintNCR.Show();
                        this.Show();


                        MessageBox.Show("La Devolución de la Factura " + SerieFacDocumento + " - " +
                                        NumDocDocument + " se Proceso correctamente",
                                        "Información", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        MessageBox.Show("La Devoluci+on de la Factura " + SerieFacDocumento + " - " +
                                        NumDocDocument + " No se Proceso correctamente",
                                        "Información", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                ObjNotaCredito.Serie  = TipoSerie;
                ObjNotaCredito.Numero = 0;

                ObjNotaCredito.Fecha_Fact = DateTime.Parse(Row.Cells[2].Value.ToString());
                ObjNotaCredito.Serie_Fact = Row.Cells[0].Value.ToString();
                ObjNotaCredito.Num_Fact   = Int32.Parse(Row.Cells[1].Value.ToString());

                ObjNotaCredito.Referencia        = Row.Cells[3].Value.ToString();
                ObjNotaCredito.Descripcion       = Row.Cells[4].Value.ToString();
                ObjNotaCredito.Unidades          = Int32.Parse(Row.Cells[5].Value.ToString());
                ObjNotaCredito.UnidadesDevueltas = Int32.Parse(Row.Cells[6].Value.ToString());
                ObjNotaCredito.RazonDevolucion   = Row.Cells[7].Value.ToString();
                ObjNotaCredito.Precio            = decimal.Parse(Row.Cells[8].Value.ToString());
                ObjNotaCredito.Almacen           = Row.Cells[9].Value.ToString();
                ObjNotaCredito.Talla             = Row.Cells[10].Value.ToString();
                ObjNotaCredito.Color             = Row.Cells[11].Value.ToString();
                ObjNotaCredito.CodBarra          = Row.Cells[13].Value.ToString();
                ObjNotaCredito.CodColor          = Row.Cells[14].Value.ToString();
                ObjNotaCredito.NumLinea          = NumLinea;
                ObjNotaCredito.Total             = ObjNotaCredito.UnidadesDevueltas * ObjNotaCredito.Precio;
                ObjNotaCredito.Linea_Fact        = Int32.Parse(Row.Cells[15].Value.ToString());


                SerieFacActual = SerieFacDocumento;
                NumDocActual   = NumDocDocument;


                //ObjListaNCR = ObjProcDB.ValidarDevolucion(ObjNotaCredito.Serie, ObjNotaCredito.Numero, ObjNotaCredito.CodBarra, ObjNotaCredito.UnidadesDevueltas)

                ObjListaNotasCredito.Add(ObjNotaCredito);
            }
            ObjListaProductosDev.Clear();
            Dgv_ProductosDev.DataSource = null;
            Dgv_ProductosDev.Refresh();

            MessageBox.Show("Proceso Completado Correctamente ", "Información", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            //Exitoso = ObjProcDB.EjecutarNotasCredito(ObjDaConnexion);
            this.Cursor         = Cursors.WaitCursor;
            ObjNotaCreditoProc2 = ObjProcDB.InsertarNotasCredito(ObjDaConnexion, ObjListaNotasCredito, TipoSerie, oUserSistemasLog);
            ObjListaNotasCredito.Clear();

            //ObjNotaCredit = BusarUlimaNotaCredito();

            ObjBuildXml.ContruyeXML(ObjNotaCreditoProc2.Serie, ObjNotaCreditoProc2.Numero);
            try
            {
                Process.Start(RutaExeFirmado + "llamarEXE.exe");

                MessageBox.Show("Firmado de la Devolución de la Factura " +
                                SerieFacActual + " - " + NumDocDocument +
                                " Procesada Correctamente ", "Información", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                var stopwatch = Stopwatch.StartNew();
                Thread.Sleep(8000);     //tiempo de pausa
                stopwatch.Stop();

                FrmPrintNCR MyFormPrintNCR = new FrmPrintNCR(ObjDaConnexion, ObjNotaCreditoProc2);       //(ObjListaNCR);
                MyFormPrintNCR.Show();
                this.Show();

                this.Cursor = Cursors.Default;
            }

            catch (Exception)
            {
                MessageBox.Show("Error al Procesar el Firmado de " + NumLinea + " de la Devolucion de la Factura " +
                                SerieFacActual + " " + NumDocDocument
                                , "Información", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
 void CargarGridProductosDev(ListaProductoDev ObjListaProductosDev)
 {
     Dgv_ProductosDev.DataSource = null;
     Dgv_ProductosDev.DataSource = ObjListaProductosDev;
     Dgv_ProductosDev.Refresh();
 }