Beispiel #1
0
        private void botonCobrar_Click(object sender, System.EventArgs e)
        {
            int cuenta = 0;

            foreach (object o in GestorPlazas.getPlaza(mesaSeleccionada).Lineas)
            {
                if (((Linea)o).Seleccionado)
                {
                    cuenta++;
                    ((Linea)o).Pagado = true;
                    // Descontar de existencias
                    // Imprimir...
                }
            }
            if (cuenta == 0)
            {
                // No habia ninguno seleccionado, ticamos todo lo que no este tickado
                foreach (object o in GestorPlazas.getPlaza(mesaSeleccionada).Lineas)
                {
                    if (!((Linea)o).Seleccionado)
                    {
                        ((Linea)o).Pagado = true;
                        // Descontar de existencias
                        // Imprimir...
                    }
                }
            }
            GestorPlazas.getPlaza(mesaSeleccionada).ActualizarDataLineas();
            GestorPlazas.ActualizarBotones();
            GestorPlazas.Save();
            ActualizarPanelConMesa();
        }
Beispiel #2
0
 private void botonVaciarMesa_Click(object sender, System.EventArgs e)
 {
     GestorPlazas.getPlaza(mesaSeleccionada).Clear();
     GestorPlazas.ActualizarBotones();
     GestorPlazas.Save();
     ActualizarPanelConMesa();
 }
Beispiel #3
0
        private void botonTicket_Click(object sender, System.EventArgs e)
        {
            int cuenta = 0;

            foreach (object o in GestorPlazas.getPlaza(mesaSeleccionada).Lineas)
            {
                if (((Linea)o).Seleccionado)
                {
                    cuenta++;
                    ((Linea)o).Ticado = true;
                    // Imprimir...
                    printingPlaza.AddLinea((Linea)o);
                }
            }
            if (cuenta == 0)
            {
                // No habia ninguno seleccionado, ticamos todo lo que no este tickado
                foreach (object o in GestorPlazas.getPlaza(mesaSeleccionada).Lineas)
                {
                    if (!((Linea)o).Ticado)
                    {
                        ((Linea)o).Ticado = true;
                        // Imprimir...
                        printingPlaza.AddLinea((Linea)o);
                    }
                }
            }
            // Imprimimos
            printTicket.Print();

            GestorPlazas.getPlaza(mesaSeleccionada).ActualizarDataLineas();
            GestorPlazas.ActualizarBotones();
            GestorPlazas.Save();
            ActualizarPanelConMesa();
        }
Beispiel #4
0
        private void dataGrid_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            System.Windows.Forms.DataGrid temp = (System.Windows.Forms.DataGrid)sender;

            int row = temp.HitTest(e.X, e.Y).Row;

            if (row != -1)
            {
                ((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[row]).Seleccionado = !(((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[row]).Seleccionado);
            }
            else
            {
                GestorPlazas.getPlaza(mesaSeleccionada).ResetSeleccion();
            }
        }
Beispiel #5
0
        private void botonArticulo_Click(object sender, System.EventArgs e)
        {
            int index;

            index = System.Array.IndexOf(botonArticulo, sender);

            GestorPlazas.getPlaza(mesaSeleccionada).AddArticulo(codBotonArticulo[index]);

            //dataGrid.LinkColor

            GestorPlazas.ActualizarBotones();
            GestorPlazas.Save();

            ActualizarPanelConMesa();
        }
Beispiel #6
0
 private void botonVaciarPagados_Click(object sender, System.EventArgs e)
 {
     for (int i = 0; i < GestorPlazas.getPlaza(mesaSeleccionada).NumLineas; i++)
     {
         if (((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[i]).Pagado)
         {
             GestorPlazas.getPlaza(mesaSeleccionada).EliminarLinea(i);
             i--;                     // Al eliminar el elemento, el siguiente ocupa la posicion actual
             // y debemos volver a analizarla
         }
     }
     GestorPlazas.getPlaza(mesaSeleccionada).ActualizarDataLineas();
     GestorPlazas.ActualizarBotones();
     GestorPlazas.Save();
     ActualizarPanelConMesa();
 }
Beispiel #7
0
        private void dataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            System.Windows.Forms.DataGrid temp = (System.Windows.Forms.DataGrid)sender;

            for (int row = 0; row < GestorPlazas.getPlaza(mesaSeleccionada).NumLineas; row++)
            {
                if (((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[row]).Seleccionado)
                {
                    temp.Select(row);
                }
                else
                {
                    temp.UnSelect(row);
                }
            }
        }
Beispiel #8
0
 private void ActualizarPanelConMesa()
 {
     if (GestorPlazas.getPlaza(mesaSeleccionada).isTerminada())
     {
         panelVaciarMesa.Visible    = true;
         panelGuardarMesa.Visible   = false;
         panelVaciarPagados.Visible = false;
         botonTraspasar.Visible     = true;
     }
     else if (!GestorPlazas.getPlaza(mesaSeleccionada).isOcupada())
     {
         panelGuardarMesa.Visible   = true;
         panelVaciarMesa.Visible    = false;
         panelVaciarPagados.Visible = false;
         botonTraspasar.Visible     = false;
     }
     else
     {
         panelVaciarPagados.Visible = true;
         panelVaciarMesa.Visible    = false;
         panelGuardarMesa.Visible   = false;
         botonTraspasar.Visible     = true;
     }
 }
Beispiel #9
0
        private void botonesMesa_Click(object sender, System.EventArgs e)
        {
            if (modoDeOperacion == ModoNormal)
            {
                Plaza p = GestorPlazas.getPlaza((System.Windows.Forms.Button)sender);
                if (!p.isJuntada)
                {
                    for (int i = 0; i < GestorPlazas.NewCod - 1; i++)
                    {
                        GestorPlazas.getBotonTPV(i).Text = "";
                    }
                    ((Button)sender).Text = "X";
                    GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).ResetSeleccion();
                    SeleccionarMesa(p.Cod);
                }
            }
            else if (modoDeOperacion == ModoSacarMesa)
            {
                Plaza p = GestorPlazas.getPlaza((System.Windows.Forms.Button)sender);
                GestorPlazas.ActivarPlaza(p.Cod);
                GestorPlazas.Save();
            }
            else if (modoDeOperacion == ModoTraspasar)
            {
                // Vamos a traspasar cosas
                int  cuenta         = 0;
                bool traspasadoTodo = false;
                for (int i = 0; i < GestorPlazas.getPlaza(mesaSeleccionada).NumLineas; i++)
                {
                    Linea l = ((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[i]);
                    if (l.Seleccionado)
                    {
                        cuenta++;
                        GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).AddLinea(l);
                        GestorPlazas.getPlaza(mesaSeleccionada).EliminarLinea(i);
                        i--;
                    }
                }
                if (cuenta == 0)
                {
                    // Traspasamos todo
                    traspasadoTodo = true;
                    for (int i = 0; i < GestorPlazas.getPlaza(mesaSeleccionada).NumLineas; i++)
                    {
                        Linea l = ((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[i]);
                        GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).AddLinea(l);
                        GestorPlazas.getPlaza(mesaSeleccionada).EliminarLinea(i);
                        i--;
                    }
                }
                GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Activar();

                GestorPlazas.ActualizarBotones();
                GestorPlazas.Save();

                // Reponemos el modo de operacion
                modoDeOperacion = ModoNormal;

                panelFamilias.Enabled  = true;
                panelArticulos.Enabled = true;
                panelLineas.Enabled    = true;

                panelGeneral.Visible    = true;
                panelOpsConMesa.Visible = true;
                panelTraspasar.Visible  = false;

                if (traspasadoTodo)
                {
                    // Elegimos la nueva mesa
                    SeleccionarMesa(GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Cod);
                }

                ActualizarPanelConMesa();
            }
            else if (modoDeOperacion == ModoJuntar)
            {
                // Traspasamos todo
                for (int i = 0; i < GestorPlazas.getPlaza(mesaSeleccionada).NumLineas; i++)
                {
                    Linea l = ((Linea)GestorPlazas.getPlaza(mesaSeleccionada).Lineas[i]);
                    GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).AddLinea(l);
                }
                GestorPlazas.getPlaza(mesaSeleccionada).Clear();
                GestorPlazas.getPlaza(mesaSeleccionada).Juntar(GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Cod);

                GestorPlazas.ActualizarBotones();
                GestorPlazas.Save();

                // Reponemos el modo de operacion
                modoDeOperacion = ModoNormal;

                panelFamilias.Enabled  = true;
                panelArticulos.Enabled = true;
                panelLineas.Enabled    = true;

                panelGeneral.Visible    = true;
                panelOpsSinMesa.Visible = true;
                panelJuntar.Visible     = false;

                // Elegimos la nueva mesa
                SeleccionarMesa(GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Cod);

                ActualizarPanelConMesa();
            }
            else if (modoDeOperacion == ModoSeparar)
            {
                GestorPlazas.getPlaza((System.Windows.Forms.Button)sender).Activar();
                GestorPlazas.ActualizarBotones();
                GestorPlazas.Save();

                modoDeOperacion = ModoNormal;

                panelFamilias.Enabled  = true;
                panelArticulos.Enabled = true;
                panelLineas.Enabled    = true;

                panelGeneral.Visible    = true;
                panelOpsSinMesa.Visible = true;
                panelSeparar.Visible    = false;

                ActualizarPanelConMesa();
            }
        }