Example #1
0
        private void Mostrar()
        {
            string fechaInicio = dtpFechaInicio.Value.ToString("yyyy-MM-dd");
            string fechaFin    = dtpFechaFin.Value.ToString("yyyy-MM-dd");

            this.dataListado.DataSource = NMovimientoAlmacen.mostrarMovimientoAlmacen(Convert.ToDateTime(fechaInicio + " 00:00:00"), Convert.ToDateTime(fechaFin + " 23:59:59"));
            this.lblTotal.Text          = "Total de Registros: " + this.dataListado.Rows.Count;
            this.dataListado.ClearSelection();
        }
Example #2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (this.dataListadoDetalle.Rows.Count == 0)
            {
                MensajeError("No hay productos en la lista");
            }
            else
            {
                try
                {
                    if (cbAlmacen.SelectedIndex == -1)
                    {
                        MensajeError("Seleccione el almacén de salida");
                    }
                    else if (cbTipoIngreso.SelectedIndex == -1)
                    {
                        MensajeError("Seleccioe el tipo de salida");
                    }
                    else if (this.txtEntregado.Text.Trim() == string.Empty)
                    {
                        MensajeError("Ingrese el nombre al que entregerá los productos");
                    }
                    else
                    {
                        string rpta = "";
                        if (this.isNuevo)
                        {
                            rpta = NMovimientoAlmacen.Insertar(Convert.ToInt32(this.cbAlmacen.SelectedValue.ToString()), Convert.ToInt32(this.cbTipoIngreso.SelectedValue.ToString()), Convert.ToInt32(this.lblIdUsuario.Text), txtEntregado.Text.Trim().ToUpper(), dtFecha.Value, "REGISTRADO", "SALIDA", dtDetalle);
                        }
                        if (rpta.Equals("OK"))
                        {
                            if (this.isNuevo)
                            {
                                this.MensajeOK("Se insertó correctamente");
                            }
                        }
                        else
                        {
                            this.MensajeError(rpta);
                        }

                        this.isNuevo = false;
                        this.Botones();
                        this.Limpiar();
                        this.limpiarDetalle();
                        this.txtCantidad.ReadOnly = true;
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
            }
        }
        private void Mostrar()
        {
            this.dataListado.DataSource = NMovimientoAlmacen.mostrarDetalleMovimiento(Convert.ToInt32(this.lblIdVenta.Text));
            lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);

            if (this.dataListado.Rows.Count == 0)
            {
                this.dataListado.Visible = false;
            }
            else
            {
                this.dataListado.Visible = true;
                Formato();
            }
        }
Example #4
0
        private void Mostrar()
        {
            if (cbProducto.SelectedIndex == -1)
            {
                MessageBox.Show("Seleccione un producto de la lista");
            }
            else
            {
                string tipo = "";
                if (rbIngreso.Checked == true)
                {
                    tipo = "INGRESO";
                }
                else
                {
                    tipo = "SALIDA";
                }

                this.lblCaja.Text           = "0";
                this.dataListado.DataSource = NMovimientoAlmacen.mostrarMovAlmacenProducto(Convert.ToInt32(cbProducto.SelectedValue), tipo);
                decimal cant = 00.00m;
                for (int i = 0; i < dataListado.Rows.Count; i++)
                {
                    cant = cant + Convert.ToDecimal(dataListado.Rows[i].Cells[1].Value.ToString());
                }
                lblCant.Text  = cant.ToString();
                lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);

                if (this.dataListado.Rows.Count == 0)
                {
                    this.dataListado.Visible = false;
                    lblCant.Text             = "0";
                    btnImprimir.Enabled      = false;
                    //ocultarColumnas();
                }
                else
                {
                    this.dataListado.Visible = true;
                    btnImprimir.Enabled      = true;
                    ocultarColumnas();
                }
            }
        }
Example #5
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (this.dataListadoDetalle.Rows.Count == 0)
            {
                MensajeError("No hay productos en la lista");
            }
            else
            {
                try
                {
                    if (cbAlmacen.SelectedIndex == -1)
                    {
                        MensajeError("Seleccione el almacén de salida");
                    }
                    else if (cbTipoIngreso.SelectedIndex == -1)
                    {
                        MensajeError("Seleccioe el tipo de salida");
                    }
                    else
                    {
                        string rpta = "";
                        if (this.isNuevo)
                        {
                            rpta = NMovimientoAlmacen.Insertar(Convert.ToInt32(this.cbAlmacen.SelectedValue.ToString()), Convert.ToInt32(this.cbTipoIngreso.SelectedValue.ToString()), Convert.ToInt32(this.lblIdUsuario.Text), "", dtFecha.Value, "REGISTRADO", "INGRESO", dtDetalle);
                        }
                        if (rpta.Equals("OK"))
                        {
                            if (this.isNuevo)
                            {
                                for (int i = 0; i < dataListadoDetalle.Rows.Count; i++)
                                {
                                    decimal precioUnitario = Convert.ToDecimal(dataListadoDetalle.Rows[i].Cells["PrecioUnitario"].Value.ToString());
                                    if (precioUnitario > 0)
                                    {
                                        rpta = NProducto.EditarCostoInsumo(Convert.ToInt32(dataListadoDetalle.Rows[i].Cells[0].Value.ToString()), precioUnitario);
                                    }
                                }
                                if (cbCaja.Checked == true)
                                {
                                    rpta = NCaja.Insertar(Convert.ToInt32(this.lblIdUsuario.Text), "1", "EGRESO", Convert.ToDecimal(this.txtTotalPagado.Text), "COMPRA", "EFECTIVO");
                                }
                                this.MensajeOK("Se insertó correctamente");
                                txtTotalPagado.Text = string.Empty;
                            }
                        }
                        else
                        {
                            this.MensajeError(rpta);
                        }

                        this.isNuevo = false;
                        this.Botones();
                        this.Limpiar();
                        this.limpiarDetalle();
                        this.txtCantidad.ReadOnly = true;
                        this.txtMonto.ReadOnly    = true;
                        cbCaja.Enabled            = false;
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
            }
        }