Example #1
0
 //metodo mosrar
 private void Mostrar()
 {
     this.dataListado.DataSource = NIngreso.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
     //Metodo BuscarNombre
 }
Example #2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult Opcion;
                Opcion = MessageBox.Show("Realmente Desea Anular los Registros", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (Opcion == DialogResult.OK)
                {
                    string Codigo;
                    string Rpta = "";
                    foreach (DataGridViewRow row in dataListado.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            Codigo = Convert.ToString(row.Cells[1].Value);
                            Rpta   = NIngreso.Anular(Convert.ToInt32(Codigo));

                            if (Rpta.Equals("OK"))
                            {
                                this.MensajeOK("Se Anuló Correctamente el Ingreso");
                            }
                            else
                            {
                                this.MensajeError(Rpta);
                            }
                        }
                    }
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
 //Método BuscarFechas
 private void BuscarFechas()
 {
     this.dataListado.DataSource = NIngreso.BuscarFechas(this.dtFecha1.Value.ToString("dd/MM/yyyy"),
                                                         this.dtFecha2.Value.ToString("dd/MM/yyyy"));
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
 }
 private void BtnInsertaringreso_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         if (TxtIdProveedor.Text.Trim() == string.Empty || TxtImpuesto.Text.Trim() == string.Empty || TxtNumComprobante.Text.Trim() == string.Empty || DtDetalle.Rows.Count == 0)
         {
             this.MensajeError("Falta ingresar unos datos");
             ErrorIcono.SetError(TxtIdProveedor, "Elige un proveedor");
             ErrorIcono.SetError(TxtImpuesto, "Falta agregar impuesto");
             ErrorIcono.SetError(DgvDetalle, "Debe tener al menor un detalle");
         }
         else
         {
             Rpta = NIngreso.Insertar(Convert.ToInt32(TxtIdProveedor.Text.Trim()), Variables.IdUsuario, CboComprobante.Text, TxtSerieComprobante.Text.Trim(), TxtNumComprobante.Text.Trim(), Convert.ToDecimal(TxtImpuesto.Text.Trim()), Convert.ToDecimal(TxtTotal.Text.Trim()), DtDetalle);
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOK("Se insertaron los datos de manera correcta");
                 this.Limpiar();
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Example #5
0
 //Método Mostrar
 private void Mostrar()
 {
     this.dataListado.DataSource = NIngreso.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
     this.dataListado.Columns["total"].DefaultCellStyle.Format = "N2";
 }
Example #6
0
 //Metodo buscar nombre
 private void BuscarFecha()
 {
     this.dataListado.DataSource = NIngreso.BuscarFecha(this.dtFechaInicio.Value, this.dtFechaFin.Value);
     //this.OcultarColumnas();
     Listado.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count);
     //this.dataListado.Columns[0].Visible = true;
 }
 private void BtnAnular_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult Opcion;
         Opcion = MessageBox.Show("Realmente deseas anular el registro", "Sistema de registro", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (Opcion == DialogResult.OK)
         {
             int    Codigo;
             string Rpta = "";
             foreach (DataGridViewRow row in DgvListado.Rows)
             {
                 if (Convert.ToBoolean(row.Cells[0].Value))
                 {
                     Codigo = Convert.ToInt32(row.Cells[1].Value);
                     Rpta   = NIngreso.Anular(Codigo);
                     if (Rpta.Equals("OK"))
                     {
                         this.MensajeOK("Se anuló el registro: " + Convert.ToString(row.Cells[6].Value) + " - " + Convert.ToString(row.Cells[7].Value));
                     }
                     else
                     {
                         this.MensajeError(Rpta);
                     }
                 }
             }
             this.Listar();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Example #8
0
 private void BtnInsertar_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         if (txtIdProveedor.Text == string.Empty || txtImpuesto.Text == string.Empty || txtNumeroComprobante.Text == string.Empty || DtDetalle.Rows.Count == 0)
         {
             this.MensajeError("Falta ingresar algunos datos, serán remarcados.");
             Erroricono.SetError(txtIdProveedor, "Seleccione un proveedor.");
             Erroricono.SetError(txtImpuesto, "Ingrese un impuesto.");
             Erroricono.SetError(txtNumeroComprobante, "Ingrese el número del comprobante.");
             Erroricono.SetError(DgvDetalle, "Debe tener al menos un detalle.");
         }
         else
         {
             Rpta = NIngreso.Insertar(Convert.ToInt32(txtIdProveedor.Text), Varriables.IdUsuario, CboComprobante.Text, txtSerieComprobante.Text.Trim(), txtNumeroComprobante.Text.Trim(), Convert.ToDecimal(txtImpuesto.Text), Convert.ToDecimal(txtTotal.Text), DtDetalle);
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOK("Se insertó de forma correcta el registro");
                 this.Limpiar();
                 this.Listar();
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Example #9
0
 //Método BuscarDetalles
 private void MostrarDetalles()
 {
     this.dataListadoDetalle.DataSource = NIngreso.MostrarDetalle(this.txtIdingreso.Text);
     //this.OcultarColumnas();
     //lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
     //this.datalistadoDetalle.AutoGenerateColumns = false;
 }
Example #10
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (this.txtNombreMod.Text == string.Empty || this.txtPrCompMod.Text == string.Empty ||
                this.txtPrVentMod.Text == string.Empty || this.txtStockMod.Text == string.Empty)
            {
                MensajeError("Falta ingresar algunos datos");
            }
            else
            {
                try
                {
                    int    itbis   = rbSiItbisMod.Checked ? 18 : 0;
                    string message = NIngreso.ModificarDetalle(idModificarDetalle, idModificarArticulo,
                                                               txtNombreMod.Text, Convert.ToDecimal(txtPrCompMod.Text),
                                                               Convert.ToDecimal(txtPrVentMod.Text), Convert.ToInt32(txtStockMod.Text),
                                                               Convert.ToDateTime(dtpFechaProdMod.Value), Convert.ToDateTime(dtpFechaVencMod.Value), itbis);
                    LimpiarModificarArticulo();

                    MensajeOk(message);
                    this.dgvArticuloMod.DataSource = NIngreso.MostrarPorNombre(this.txtBuscarArticula.Text.Trim());
                }
                catch (Exception)
                {
                    MensajeError("Existen datos que no son validos");
                }
            }
        }
Example #11
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            //insertar datos
            try
            {
                string rpta = "";
                if (this.txtIdProveedor.Text == string.Empty ||
                    this.txtNumComprobante.Text == string.Empty ||
                    this.txtIsv.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados.");
                    errorIcono.SetError(this.txtNombreProveedor, "Seleccione un proveedor.");
                    errorIcono.SetError(this.txtNumComprobante, "Ingrese un número de comprobante.");
                    errorIcono.SetError(this.txtIsv, "Ingrese ISV.");
                }
                else
                {
                    if (this.EsNuevo)
                    {
                        //nombre,descripcion,imagen,activa
                        rpta = NIngreso.Insertar(
                            this.dtpFechaIngreso.Value,
                            this.cmbComprobante.Text.Trim(),
                            this.txtNumComprobante.Text.Trim(),
                            Convert.ToDecimal(this.txtIsv.Text.Trim()),
                            totalPagado,
                            "EMITIDO",
                            Convert.ToInt32(this.txtIdProveedor.Text.Trim()),
                            this.idempleado,
                            dtDetalle
                            );
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.EsNuevo)
                        {
                            this.MensajeOK("Se inserto de forma correcta el Ingreso.");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }

                    //preparamos para nuevos datos
                    this.EsNuevo = false;
                    //this.EsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.LimpiarDetalle();
                    this.MostrarDatos();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Example #12
0
 //Método mostrar
 private void Mostrar()
 {
     this.dataListado.DataSource            = NIngreso.Mostrar();
     this.dataListadoArticulos.DataSource   = NArticulo.Mostrar();
     this.dataListadoProveedores.DataSource = NProveedor.Mostrar();
     this.OcultarColumnas();
     lblTotal.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count);
 }
        //Metodo buscar por parametro de Fechas
        private void BuscarFechas()
        {
            this.dataGridView1.DataSource = NIngreso.BuscarFechas(this.dateTimePickerFI.Value.ToString("dd/MM/yyyy"),
                                                                  this.dateTimePickerFA.Value.ToString("dd/MM/yyyy"));

            this.OcultarColumnas();
            lbltotal.Text = "Total de Registros " + Convert.ToString(dataGridView1.Rows.Count);
        }
Example #14
0
 //Método Mostrar
 private void Mostrar()
 {
     this.dataListado.DataSource            = NIngreso.Mostrar();
     this.dgvArticuloMod.DataSource         = NIngreso.MostrarPorNombre("");
     this.dgvArticuloMod.Columns[0].Visible = false;
     this.OcultarColumnas();
     lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
 }
Example #15
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = string.Empty;
                if (this.txtSerie.Text == string.Empty || this.txtCorrelativo.Text == string.Empty ||
                    this.txtIgv.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    this.ErrorIcono.SetError(txtSerie, "Ingrese un valor");
                    this.ErrorIcono.SetError(txtCorrelativo, "Ingrese un valor");
                    this.ErrorIcono.SetError(txtIgv, "Ingrese un valor");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        rpta = NIngreso.Insertar(IdTrabajador,
                                                 Convert.ToInt32(this.txtIdProveedor.Text),
                                                 this.dtFecha.Value,
                                                 this.cbTipoComprobante.Text,
                                                 this.txtSerie.Text,
                                                 this.txtCorrelativo.Text,
                                                 Convert.ToDecimal(this.txtIgv.Text), "Emitidio",
                                                 dtDetalle);

                        ////Vamos a insertar un Ingreso
                        //Rpta = NIngreso.Insertar(Idtrabajador, Convert.ToInt32(txtIdproveedor.Text),
                        //dtFecha.Value, cbTipo_Comprobante.Text,
                        //txtSerie.Text, txtCorrelativo.Text,
                        //Convert.ToDecimal(txtIgv.Text), "EMITIDO", dtDetalle);
                    }


                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se ingresó correctamente el registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }

                    this.IsNuevo = false;
                    this.Botones();
                    this.Limpiar();
                    this.Consultar();
                    this.LimpiarDetalle();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Example #16
0
 private void btnVolverDataListado_Click(object sender, EventArgs e)
 {
     this.dataListado.DataSource = NIngreso.Mostrar();
     this.chkEliminar.Visible    = true;
     this.lblTotal.Text          = Convert.ToString("Total de registros: " + dataListado.Rows.Count);
     this.listadoDetalle         = true;
     this.chkEliminar.Checked    = false;
     this.OcultarColumnas();
 }
Example #17
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta          = "";
                string updatePrecios = "";
                if (this.txtIdProveedor.Text == string.Empty || this.txtSerie.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algun dato");
                    errorIcono.SetError(txtIdProveedor, "Ingrese un valor");
                    errorIcono.SetError(txtSerie, "Ingrese un valor");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        if (dtDetalle.Rows.Count > 0)
                        {
                            rpta = NIngreso.Insertar(Idtrabajador, Convert.ToInt32(this.txtIdProveedor.Text), dtFecha.Value,
                                                     this.txtSerie.Text, "EMITIDO", dtDetalle);

                            if (rpta.Equals("OK"))
                            {
                                updatePrecios = NIngreso.EditarPrecios(dtPrecioReal);
                            }
                        }
                        else
                        {
                            MensajeError("No ha adjuntado articulos en el ingreso ");
                        }
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            updatePrecios = NIngreso.EditarPrecios(dtPrecioReal);
                            this.MensajeOk("Se inserto correctamente en registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }
                    this.IsNuevo = false;
                    this.Botones();
                    this.Limpiar();
                    this.LimpiarDetalle();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Example #18
0
        private void compararPreciosIngresos()
        {
            //Traer el stock, el precio y el total de ganancias por cada artículo
            int     cantidadStock        = 0;
            decimal precioVentaReal      = 0;
            decimal totalGanancias       = 0;
            decimal precioVentaTemporal  = 0;
            decimal precioVentaCalculado = 0;

            this.ganancias = NIngreso.MostrarDetalleGanancias(Convert.ToInt32(this.txtIdArticulo.Text));
            if (this.ganancias.Rows.Count == 0)
            {
                this.ganancias = null;
            }
            else
            {
                cantidadStock   = Convert.ToInt32(this.ganancias.Rows[0]["Cantidad_Stock"]);
                precioVentaReal = Convert.ToDecimal(this.ganancias.Rows[0]["Precio_Venta_Actual"]);
                totalGanancias  = Convert.ToDecimal(this.ganancias.Rows[0]["Total_Ganancia"]);
            }
            //Comparar el precio anterior con el nuevo y mostrar las alertas correspondientes

            if (precioVentaReal > Convert.ToDecimal(this.txtPrecioVentaActual.Text))
            {
                precioVentaCalculado = (Convert.ToDecimal(this.txtPrecioVentaActual.Text) * cantidadStock);

                precioVentaTemporal = totalGanancias - precioVentaCalculado;

                string ttgan   = string.Format("{0:n}", totalGanancias);
                string pventem = string.Format("{0:n}", precioVentaTemporal);
                string pventre = string.Format("{0:n}", precioVentaReal);

                MessageBox.Show("El valor de venta ingresado es inferior al valor de venta actual " + "Existen " + cantidadStock + " unidades del producto que representan un valor de " +
                                ttgan + " con el valor de venta que quiere ingresar tendra una perdida de " + pventem +
                                " el valor de venta actual es de " + pventre
                                , "Disminución de utilidad",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (precioVentaReal < Convert.ToDecimal(this.txtPrecioVentaActual.Text))
            {
                precioVentaCalculado = (Convert.ToDecimal(this.txtPrecioVentaActual.Text) * cantidadStock);

                precioVentaTemporal = precioVentaCalculado - totalGanancias;

                string ttgan   = string.Format("{0:n}", totalGanancias);
                string pventem = string.Format("{0:n}", precioVentaTemporal);
                string pventre = string.Format("{0:n}", precioVentaReal);

                MessageBox.Show("El valor de venta ingresado es superior al valor de venta actual " + "Existen " + cantidadStock + " unidades del producto que representan un valor de " +
                                ttgan + " con el valor de venta que quiere ingresar tendra una ganancia de " + pventem +
                                " el valor de venta actual es de " + pventre
                                , "Aumento de utilidad",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #19
0
        //Buscar por fechas columnas en DATAGRID
        private void BuscarFechas()
        {
            string textobuscar  = dtpFechaInicial.Value.ToString("yyyy-MM-dd");
            string textobuscar2 = dtpFechaFinal.Value.ToString("yyyy-MM-dd");

            //MessageBox.Show(textobuscar + "final: " + textobuscar2);
            //codigo buscar
            this.dgvIngresos.DataSource = NIngreso.BuscarFechas(textobuscar, textobuscar2);
            this.OcultarColumnas();
            this.lblNumElementos.Text = "Elementos: " + Convert.ToString(this.dgvIngresos.Rows.Count);
        }
Example #20
0
 private void Buscar()
 {
     try
     {
         DgvListado.DataSource = NIngreso.Buscar(TxtBuscar.Text);
         this.Formato();
         LblTotal.Text = "Total registros: " + Convert.ToString(DgvListado.Rows.Count);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Example #21
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtIdproveedor.Text == string.Empty || this.txtSerie.Text == string.Empty || this.txtCorrelativo.Text == string.Empty ||
                    this.txtIgv.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    errorIcono.SetError(txtIdproveedor, "Ingrese un Valor");
                    errorIcono.SetError(txtSerie, "Ingrese un Valor");
                    errorIcono.SetError(txtCorrelativo, "Ingrese un Valor");
                    errorIcono.SetError(txtIgv, "Ingrese un Valor");
                }
                else
                {
                    errorIcono.Clear();


                    if (this.IsNuevo == true)
                    {
                        rpta = NIngreso.Insertar(Idtrabajador, Convert.ToInt32(this.txtIdproveedor.Text), dtFecha.Value, cbTipo_Comprobante.Text, txtSerie.Text, txtCorrelativo.Text,
                                                 Convert.ToDecimal(txtIgv.Text), "EMITIDO", dtDetalle);
                    }


                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se Insertó de forma correcta el registro");
                        }
                    }

                    else
                    {
                        this.MensajeError(rpta);
                    }

                    this.IsNuevo = false;
                    this.Botones();
                    this.Limpiar();
                    this.limpiarDetalle();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Example #22
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                //La variable que almacena si se inserto
                //o se modifico la tabla
                string Rpta = "";
                if (this.txtIdproveedor.Text == string.Empty || this.txtSerie.Text == string.Empty || txtCorrelativo.Text == string.Empty || txtIgv.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    errorIcono.SetError(txtProveedor, "Seleccione un Proveedor");
                    errorIcono.SetError(txtSerie, "Ingrese la serie del comprobante");
                    errorIcono.SetError(txtCorrelativo, "Ingrese el número del comprobante");
                    errorIcono.SetError(txtIgv, "Ingrese el porcentaje de IGV");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        //Vamos a insertar un Ingreso
                        Rpta = NIngreso.Insertar(Idtrabajador, Convert.ToInt32(txtIdproveedor.Text),
                                                 dtFecha.Text, cbTipo_Comprobante.Text,
                                                 txtSerie.Text, txtCorrelativo.Text,
                                                 Convert.ToDecimal(txtIgv.Text), "EMITIDO", dtDetalle);
                    }

                    //Si la respuesta fue OK, fue porque se modifico
                    //o inserto el Ingreso
                    //de forma correcta
                    if (Rpta.Equals("OK"))
                    {
                        this.MensajeOk("Se insertó de forma correcta el registro");
                    }
                    else
                    {
                        //Mostramos el mensaje de error
                        this.MensajeError(Rpta);
                    }
                    this.IsNuevo = false;
                    this.Botones();
                    this.Limpiar();
                    this.limpiarDetalle();
                    this.Mostrar();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Example #23
0
 private void Buscar()
 {
     try
     {
         DgvListado.DataSource = NIngreso.ConsultaFechas(Convert.ToDateTime(DtpFechaInicio.Value), Convert.ToDateTime(DtpFechaFin.Value));
         this.Formato();
         this.Limpiar();
         lblTotal.Text = "Total registros: " + Convert.ToString(DgvListado.Rows.Count);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
 private void Listar()
 {
     try
     {
         DgvListado.DataSource = NIngreso.Listar();
         this.Formato();
         this.Limpiar();
         labelTotal.Text = "TOTAL DE REGISTROS:" + Convert.ToString(DgvListado.Rows.Count);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message + e.StackTrace);
     }
 }
Example #25
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtIdProveedor.Text == string.Empty || this.txtSerie.Text == string.Empty ||
                    this.txtCorrelativo.Text == string.Empty || this.txtIGV.Text == string.Empty)
                {
                    MensajeError("Faltan ingresar datos");
                    errorIcono.SetError(txtIdProveedor, "Ingrese un Proveedor");
                    errorIcono.SetError(txtSerie, "Ingrese un valor");
                    errorIcono.SetError(txtCorrelativo, "Ingrese un valor");
                    errorIcono.SetError(txtIGV, "Ingrese un valor");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        rpta = NIngreso.Insertar(Idtrabajador, Convert.ToInt32(this.txtIdProveedor.Text),
                                                 dtFecha.Value, cmbTipo_Comprobante.Text, txtSerie.Text, txtCorrelativo.Text,
                                                 Convert.ToDecimal(txtIGV.Text), "EMITIDO", dtDetalle);
                    }
                }
                if (rpta.Equals("ok"))
                {
                    if (this.IsNuevo)
                    {
                        this.MensajeOk("Se inserto correctamente el registro");
                    }
                }
                else
                {
                    this.MensajeError(rpta);//Aca salta el error
                    //MessageBox.Show("ERROR");
                }

                this.IsNuevo = false;
                this.Botones();
                this.Limpiar();
                this.limpiarDetalle();
                this.Mostrar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
                //MessageBox.Show("ERROR");
            }
        }
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtIdProveedor.Text == string.Empty || this.txtSerie.Text == string.Empty ||
                    this.txtCorrelativo.Text == string.Empty || this.txtIgv.Text == string.Empty)
                {
                    MensajeError("Falta ingresar datos, seran remarcados");
                    errorProviderIcono.SetError(txtIdProveedor, "Ingrese el Codigo de Proveedor");
                    errorProviderIcono.SetError(txtSerie, "Ingrese la Serie");
                    errorProviderIcono.SetError(txtCorrelativo, "Ingrese el Correlativo");
                    errorProviderIcono.SetError(txtIgv, "Ingrese el IGV");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        rpta = NIngreso.Insertar(idtrabajador, Convert.ToInt32(this.txtIdProveedor.Text),
                                                 dateTimePickerF.Value, cbnComprobante.Text, txtSerie.Text,
                                                 txtCorrelativo.Text, Convert.ToDecimal(txtIgv.Text), "EMITIDO",
                                                 dtDetalles);
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se inserto correctamente");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }
                    this.IsNuevo = false;

                    this.Botones();
                    this.limpiar();
                    this.limpiarDetalle();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
        private void Buscar()
        {
            try
            {
                DgvListado.DataSource = NIngreso.Buscar(txtBuscar.text);

                if (txtBuscar.text.Equals(Convert.ToString(DgvListado.DataSource)))
                {
                    MessageBox.Show("no se encuentra", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + e.StackTrace);
            }
        }
Example #28
0
        //Método para obtener la serie del último registro
        public void UltimaSerie()
        {
            int ultimoValor;

            this.ultimaSerie = NIngreso.UltimaSerie();
            if (this.ultimaSerie.Rows.Count == 0)
            {
                ultimoValor = 0;
            }
            else
            {
                ultimoValor = Convert.ToInt32(this.ultimaSerie.Rows[0]["Serie"].ToString().Substring(3));
            }
            ultimoValor++;
            this.txtSerie.Text = Convert.ToString("IN-" + ultimoValor);
        }
Example #29
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";

                if (txtIdProveedor.Text == string.Empty || txtSerie.Text == string.Empty || textCorrelativo.Text == string.Empty || txtIGV.Text == string.Empty)
                {
                    MensajeError("Falta Ingresar");
                    errorIcono.SetError(txtIdProveedor, "Ingrese un Valor");
                    errorIcono.SetError(txtSerie, "Ingrese un Valor");
                    errorIcono.SetError(textCorrelativo, "Ingrese un Valor");
                    errorIcono.SetError(txtIGV, "Ingrese un Valor");
                }
                else
                {
                    if (this.isNuevo)
                    {
                        rpta = NIngreso.Insertar(this.IdTrabajador, Convert.ToInt32(this.txtIdProveedor.Text), this.dtFecha.Value, this.cbComprobantes.Text,
                                                 this.txtSerie.Text, this.textCorrelativo.Text, Convert.ToDecimal(this.txtIGV.Text),
                                                 "EMITIDO", this.dtDetalle);
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.isNuevo)
                        {
                            this.MensajeOk("Se Inserto el Registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }
                    this.isNuevo = false;
                    this.HabilitarBotones();
                    this.Limpiar();
                    this.LimpiarDetalle();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Example #30
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";

                if (this.txtProveedor.Text == string.Empty || this.txtSerie.Text == string.Empty || this.txtCorrelativo.Text == string.Empty || this.txtIGV.Text == string.Empty)
                {
                    MensajeError("Falta Ingresar algunos datos, seran remarcados");
                    errorIcono.SetError(txtIdProveedor, "Selecciones un proveedor");
                    errorIcono.SetError(txtSerie, "Ingrese el numero de serie del comprobante");
                    errorIcono.SetError(txtCorrelativo, "Ingrese el numero del comprobante");
                    errorIcono.SetError(txtIGV, "Ingrese el IGV");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        rpta = NIngreso.Insertar(this.IdTrabajador, Convert.ToInt32(this.txtIdProveedor.Text.Trim().ToUpper()), this.dtfecha.Value, this.cboxTipo_Comprobante.Text, this.txtSerie.Text.Trim(), this.txtCorrelativo.Text.Trim(), Convert.ToDecimal(this.txtIGV.Text), "EMITIDO", dtDetalle);
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            MensajeOk("Se inserto de forma correcta el registro");
                        }
                    }
                    else
                    {
                        MensajeError(rpta);
                    }

                    this.IsNuevo = false;
                    this.Botones();
                    this.limpiar();
                    this.limpiarDetalle();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }