} ////**** ACTUALIZA SUMA DESPUES DE BORRAR UNA FILA #endregion #region OPERACIONES EN GRIDCONSUMO public void Guardar() { if (txtNombre.TextLength != 0 && txtDireccion.TextLength != 0 && txtTelefono.TextLength != 0) { if (status.Text == "ABIERTA") { label20.Text = Convert.ToString(Convert.ToInt32(label1.Text) - 1); } else { label20.Text = Convert.ToString(NumX.GenerarNumero()); NumX.LimpiarFoliosSinUso(); } //AGREGA A LA TABLA PEDIDOS AgregarPedidoMySql(); //AGREGA A LA TABLA DETALLE DE PEDIDOS AgregaDetallePedidoMySql(); //************ IMPRIMIR TICKET **********************// if (DatosCompartidos.Instance().NombreFormularioActivo == "Delivery") { DataTable data = new DataTable("ACocina"); data.Columns.Add("Cantidad"); data.Columns.Add("Item"); data.Columns.Add("Unitario"); data.Columns.Add("Total"); foreach (DataGridViewRow row in GridDelivery.Rows) { data.Rows.Add(Convert.ToString(row.Cells[0].Value), Convert.ToString(row.Cells[1].Value), Convert.ToString(row.Cells[2].Value), Convert.ToString(row.Cells[3].Value)); } string nombre = txtNombre.Text; string telefono = txtTelefono.Text; string direccion = txtDireccion.Text; string referencia = txtReferencia.Text; DialogResult Dcaja; do { ticket.TicketDelivery(data, Convert.ToString((Convert.ToInt32(label20.Text) + 1)), nombre, telefono, direccion, referencia, Convert.ToDouble(Total.Text)); Dcaja = MessageBox.Show("Desea Imprimir nuevamente el Comprobante de Caja?", "CAJA", MessageBoxButtons.YesNo); } while (Dcaja == DialogResult.Yes); DialogResult Dcocina; do { ticket.TicketDeliveryCocina(data, Convert.ToString((Convert.ToInt32(label20.Text) + 1)), nombre, telefono, direccion, referencia); Dcocina = MessageBox.Show("Desea Imprimir nuevamente el Comprobante de Cocina?", "COCINA", MessageBoxButtons.YesNo); } while (Dcocina == DialogResult.Yes); } //***************************************************// //SU NUMERO DE PEDIDO ES MessageBox.Show("Su numero de pedido es el: " + (Convert.ToInt32(label20.Text) + 1)); //LIMPIA EL GRID GridDelivery.Rows.Clear(); //MARCA EL NUMERO DE PEDIDO Y TRAE EL PROXIMO NumX.MarcarUltimoNumero(Convert.ToInt32(label20.Text)); label20.Text = Convert.ToString(NumX.GenerarNumero()); NumX.LimpiarFoliosSinUso(); txtNombre.BackColor = Color.White; txtTelefono.BackColor = Color.White; txtDireccion.BackColor = Color.White; } else { MessageBox.Show("ERROR, FALTAN DATOS DEL SOLICITANTE PARA COMPLETAR EL PEDIDO.\nCOMPLETE LOS DATOS EN ROJO Y CONTINUE."); if (txtNombre.TextLength == 0) { txtNombre.BackColor = Color.Red; txtNombre.Focus(); } if (txtDireccion.TextLength == 0) { txtDireccion.BackColor = Color.Red; txtDireccion.Focus(); } if (txtTelefono.TextLength == 0) { txtTelefono.BackColor = Color.Red; txtTelefono.Focus(); } } } ////**** GUARDA EL GRID EN LA BASE DATOS