示例#1
0
文件: tpvForm.cs 项目: riseven/TPV
        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();
        }
示例#2
0
文件: tpvForm.cs 项目: riseven/TPV
 private void botonVaciarMesa_Click(object sender, System.EventArgs e)
 {
     GestorPlazas.getPlaza(mesaSeleccionada).Clear();
     GestorPlazas.ActualizarBotones();
     GestorPlazas.Save();
     ActualizarPanelConMesa();
 }
示例#3
0
文件: tpvForm.cs 项目: riseven/TPV
        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();
        }
示例#4
0
文件: tpvForm.cs 项目: riseven/TPV
 private void botonGuardarMesa_Click(object sender, System.EventArgs e)
 {
     if (GestorPlazas.GuardarPlaza(mesaSeleccionada))
     {
         dataGrid.SetDataBinding(null, "");
         mesaSeleccionada        = -1;
         panelOpsSinMesa.Visible = true;
         panelOpsConMesa.Visible = false;
         GestorPlazas.Save();
     }
     else
     {
         System.Windows.Forms.MessageBox.Show("No se puede guardar una mesa ocupada");
     }
 }
示例#5
0
文件: tpvForm.cs 项目: riseven/TPV
        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();
        }
示例#6
0
文件: tpvForm.cs 项目: riseven/TPV
 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();
 }
示例#7
0
文件: tpvForm.cs 项目: riseven/TPV
        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();
            }
        }
示例#8
0
 private void botonSalir_Click(object sender, System.EventArgs e)
 {
     GestorPlazas.Save();
     this.Close();
 }