Exemple #1
0
        private void BuscarDetallePlatos(string tipo_busqueda, string texto_busqueda)
        {
            try
            {
                DataTable table =
                    NPlatos.BuscarDetallePlatos(tipo_busqueda, texto_busqueda);
                this.dgvInsumosUsados.DataSource = table;
                if (table != null)
                {
                    this.lblins.Text = "Insumos usados " + table.Rows.Count;

                    string[] columnsHeader =
                    {
                        "Id detalle", "Id plato", "Id insumos", "Insumo", "Cantidad", "Cantidad usada", "Id tipo insumo", "Tipo"
                    };
                    bool[] columnsVisible =
                    {
                        false, false, false, true, false, true, false, false
                    };
                    this.dgvInsumosUsados =
                        DatagridString.ChangeHeaderTextAndVisible(this.dgvInsumosUsados, columnsHeader, columnsVisible);
                }
                else
                {
                    this.lblins.Text = "No hay insumos agregados";
                }
            }
            catch (Exception ex)
            {
                Mensajes.MensajeErrorCompleto(this.Name, "BuscarDetallePlatos",
                                              "Hubo un error al buscar un detalle", ex.Message);
            }
        }
        private void BuscarPedido(int id_pedido)
        {
            try
            {
                string    rpta = "";
                DataTable tablaDetalle;
                TablaDatosPrincipales =
                    NPedido.BuscarPedidosYDetalle("ID PEDIDO", Convert.ToString(this.Id_pedido),
                                                  out tablaDetalle, out rpta);
                this.TablaDetalle = tablaDetalle;

                this.dgvPedido.DataSource = TablaDetalle;
                if (this.TablaDetalle != null)
                {
                    this.dgvPedido.Enabled = true;
                    string[] columnsHeaderText =
                    {
                        "Id pedido", "Id tipo", "Tipo", "Nombre", "Precio", "Cantidad", "Total", "Observaciones"
                    };
                    bool[] columnsVisible =
                    {
                        false, false, false, true, true, true, true, true
                    };
                    this.dgvPedido =
                        DatagridString.ChangeHeaderTextAndVisible(this.dgvPedido, columnsHeaderText, columnsVisible);
                }
                else
                {
                    this.dgvPedido.Enabled = false;
                }

                if (this.TablaDatosPrincipales != null)
                {
                    this.ContextMenuDatosPedido.txtCliente.Text = Convert.ToString(TablaDatosPrincipales.Rows[0]["Cliente"]);
                    this.ContextMenuDatosPedido.txtCliente.Tag  = Convert.ToString(TablaDatosPrincipales.Rows[0]["Id_cliente"]);
                    this.lblIdPedido.Text = Convert.ToString(TablaDatosPrincipales.Rows[0]["Id_pedido"]);
                    this.lblEmpleado.Text = "Mesero encargado: " + Convert.ToString(TablaDatosPrincipales.Rows[0]["Nombre_empleado"]);

                    this.lblMesa.Text = Convert.ToString(TablaDatosPrincipales.Rows[0]["Num_mesa"]);
                }
            }
            catch (Exception ex)
            {
                this.dgvPedido.Enabled = false;
                Mensajes.MensajeErrorCompleto(this.Name, "BuscarPedido",
                                              "Hubo un error al buscar un pedido", ex.Message);
            }
        }
        private void BuscarVentas(string tipo_busqueda, string texto_busqueda)
        {
            try
            {
                string fecha1 = this.date1.Value.ToShortDateString();
                string fecha2 = this.date2.Value.ToShortDateString();
                string hora1  = this.ListaHora1.SelectedValue.ToString();
                string hora2  = this.ListaHora2.SelectedValue.ToString();

                DataTable tablaVenta =
                    NVentas.BuscarVenta(tipo_busqueda, texto_busqueda, fecha1, fecha2, hora1, hora2);
                this.dgvVentas.DataSource = tablaVenta;
                if (tablaVenta != null)
                {
                    this.btnResumen.Enabled = true;
                    string[] columns_header =
                    {
                        "Id venta",  "Id pedido",    "Fecha",       "Hora",          "Total parcial", "Propina",        "Subtotal",
                        "Descuento", "Bono o cupón", "Total",       "Observaciones", "Id cliente",    "Nombre cliente",
                        "Id mesa",   "Mesa",         "Id empleado", "Empleado"
                    };
                    bool[] columns_visible =
                    {
                        false, false, true,  true,  true, true,  true, true,
                        false, true,  false, false, true, false, true, false, true
                    };
                    this.dgvVentas =
                        DatagridString.ChangeHeaderTextAndVisible(this.dgvVentas, columns_header, columns_visible);

                    //this.dgvVentas.Columns["Hora_venta"].DefaultCellStyle.Format = "HH:mm";

                    this.resumenVenta.ObtenerVenta(Convert.ToDateTime(fecha1), Convert.ToDateTime(fecha2),
                                                   hora1, hora2);
                }
                else
                {
                    this.btnResumen.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                Mensajes.MensajeErrorCompleto(this.Name, "BuscarVentas", "Hubo un error al buscar una venta", ex.Message);
            }
        }
Exemple #4
0
        private void CrearTabla()
        {
            this.DtInsumos = new DataTable();
            this.DtInsumos.Columns.Add("Id_insumo", typeof(string));
            this.DtInsumos.Columns.Add("Nombre_insumo", typeof(string));
            this.DtInsumos.Columns.Add("Id_tipo_insumo", typeof(string));
            this.DtInsumos.Columns.Add("Tipo_insumo", typeof(string));
            this.DtInsumos.Columns.Add("Cantidad_usada", typeof(string));
            this.dgvInsumos.DataSource = this.DtInsumos;

            string[] columns_header =
            {
                "Id insumo", "Insumo", "Id tipo insumo", "Tipo", "Cantidad"
            };
            bool[] columns_visible =
            {
                false, true, false, true, true
            };

            this.dgvInsumos =
                DatagridString.ChangeHeaderTextAndVisible(this.dgvInsumos, columns_header, columns_visible);
        }
        private void AsignarDatos()
        {
            try
            {
                if (Row_venta != null)
                {
                    this.Id_pedido              = Convert.ToInt32(Row_venta.Cells["Id_pedido"].Value);
                    this.lblId_venta.Text      += " " + Convert.ToString(Row_venta.Cells["Id_venta"].Value);
                    this.lblIdPedido.Text      += " " + Convert.ToString(Row_venta.Cells["Id_pedido"].Value);
                    this.lblFecha.Text         += " " + Convert.ToDateTime(Row_venta.Cells["Fecha_venta"].Value).ToLongDateString();
                    this.lblHora.Text          += " " + Convert.ToDateTime(Row_venta.Cells["Hora_venta"].Value).ToLongTimeString();
                    this.lblMesa.Text          += " " + Convert.ToString(Row_venta.Cells["Num_mesa"].Value);
                    this.lblEmpleado.Text      += " " + Convert.ToString(Row_venta.Cells["Nombre_empleado"].Value);
                    this.lblCliente.Text       += " " + Convert.ToString(Row_venta.Cells["Nombre_cliente"].Value);
                    this.lblTotal_parcial.Text += " " + Convert.ToInt32(Row_venta.Cells["Total_parcial"].Value).ToString("C");
                    this.lblPropina.Text       += " " + Convert.ToInt32(Row_venta.Cells["Propina"].Value).ToString("C");
                    this.lblSubTotal.Text      += " " + Convert.ToInt32(Row_venta.Cells["Subtotal"].Value).ToString("C");
                    this.lblDescuento.Text     += " " + Convert.ToString(Row_venta.Cells["Descuento"].Value);
                    this.lblTotalFinal.Text    += " " + Convert.ToInt32(Row_venta.Cells["Total_final"].Value).ToString("C");
                    this.txtObservaciones.Text  = Convert.ToString(Row_venta.Cells["Observaciones"].Value);

                    DataTable dtDetallePedido;
                    DataTable dtDetalleVenta;
                    DataTable DatosPrincipales = NVentas.BuscarVentaFinal(this.Id_pedido.ToString(), out dtDetallePedido, out dtDetalleVenta);

                    this.dgvPagos =
                        ConfiguracionDatagridview.ConfigurationGrid(this.dgvPagos);

                    this.dgvDetalle_pedido =
                        ConfiguracionDatagridview.ConfigurationGrid(this.dgvDetalle_pedido);

                    this.dgvDetalle_pedido.DataSource = dtDetallePedido;
                    this.dgvPagos.DataSource          = dtDetalleVenta;

                    if (dtDetallePedido != null)
                    {
                        string[] columns_header =
                        {
                            "Id pedido", "Id tipo", "Tipo", "Nombre", "Precio", "Cantidad", "Total", "Observaciones"
                        };
                        bool[] columns_visible =
                        {
                            false, false, false, true, true, true, true, true
                        };
                        this.dgvDetalle_pedido = DatagridString.ChangeHeaderTextAndVisible(this.dgvDetalle_pedido, columns_header, columns_visible);
                    }

                    if (dtDetalleVenta != null)
                    {
                        string[] columns_header =
                        {
                            "Id venta", "Método de pago", "Valor", "Vaucher", "Observaciones"
                        };
                        bool[] columns_visible =
                        {
                            false, true, true, false, true
                        };
                        this.dgvPagos = DatagridString.ChangeHeaderTextAndVisible(this.dgvPagos, columns_header, columns_visible);
                    }
                }
            }
            catch (Exception ex)
            {
                Mensajes.MensajeErrorCompleto(this.Name, "AsignarDatos()",
                                              "Hubo un error al asignar los datos de la venta", ex.Message);
            }
        }