private void BtnRegistrarCheckIn_Click(object sender, EventArgs e) { if (payLater == true) { f.IdReservacion = id; Reservacion reserva = new Reservacion(); reserva.IdReservacion = f.IdReservacion; reserva.Confirmar(reserva); // HABITACION PASA DE DISPONIBLE A OCUPADA Habitacion hab = new Habitacion(); hab.IdHabitacion = Convert.ToInt32(dgvHabitacion.Rows[0].Cells[13].Value); hab.CambiarEstados(hab.IdHabitacion, "Ocupada"); ErrorDatosFaltantes.confirmacionForm("AGREGADO"); } else { if (cmbFormaPago.Text == string.Empty) { ErrorDatosFaltantes.confirmacionForm("ERROR"); } if (cmbFormaPago.Text == "Tarjeta") { if (txtNombre.Text == string.Empty || txtTotalAPagar.Text == string.Empty || txtBoxDigitos.Text == string.Empty || txtBoxCompania.Text == string.Empty || txtCajero.Text == string.Empty) { ErrorDatosFaltantes.confirmacionForm("ERROR"); } else { f.IdReservacion = id; f.IdHuesped = Convert.ToInt32(txtIdCliente.Text); f.Empleado = txtCajero.Text; f.TotalAPagar = Convert.ToSingle(txtTotalAPagar.Text); f.FormaDePago = cmbFormaPago.Text; f.SubTotal = Convert.ToSingle(dgvHabitacion.Rows[0].Cells[12].Value); f.Fecha = dtpFechaActual.Value; f.UltimosDigitos = Convert.ToInt32(txtBoxDigitos.Text); f.CompaniaTarjeta = txtBoxCompania.Text; if (txtDescuento.Text == string.Empty) { //do nothing } else { f.Descuento = Convert.ToSingle(txtDescuento.Text); } if (f.InsertTarjeta(f) == true) { // RESERVACION PASA DE SIN CONFIRMAR A CHECK IN Reservacion reserva = new Reservacion(); reserva.IdReservacion = f.IdReservacion; reserva.Confirmar(reserva); // HABITACION PASA DE DISPONIBLE A OCUPADA Habitacion hab = new Habitacion(); hab.IdHabitacion = Convert.ToInt32(dgvHabitacion.Rows[0].Cells[13].Value); hab.CambiarEstados(hab.IdHabitacion, "Ocupada"); FrmCorrecto.confirmacionForm("CORRECTO"); f.IdFactura = f.SelectIdFactura(); btnImprimir.Enabled = true; } else { FrmCorrecto.confirmacionForm("CORRECTO"); } } } if (cmbFormaPago.Text == "Efectivo") { if (txtNombre.Text == string.Empty || txtEfectivo.Text == string.Empty || txtTotalAPagar.Text == string.Empty || txtCambio.Text == string.Empty || txtCajero.Text == string.Empty) { MessageBox.Show("Faltan Ingresar datos."); } else { /* * @IdReservacion, @IdHuesped, @SubTotal, @TotalAPagar, @Fecha, @FormaDePago, @EfectivoRecibido, @Devuelta */ f.IdReservacion = id; f.IdHuesped = Convert.ToInt32(txtIdCliente.Text); f.Empleado = txtCajero.Text; f.TotalAPagar = Convert.ToSingle(txtTotalAPagar.Text); f.Fecha = dtpFechaActual.Value; f.FormaDePago = cmbFormaPago.Text; f.SubTotal = Convert.ToSingle(dgvHabitacion.Rows[0].Cells[12].Value); if (txtDescuento.Text == string.Empty) { //do nothing } else { f.Descuento = Convert.ToSingle(txtDescuento.Text); } if (txtEfectivo.Text == string.Empty) { //do nothing } else { f.EfectivoRecibido = Convert.ToSingle(txtEfectivo.Text); } if (txtCambio.Text == string.Empty) { //do nothing MessageBox.Show("Faltan Ingresar datos."); } else { f.Devuelta = Convert.ToSingle(txtCambio.Text); } if (f.InsertEfectivo(f) == true && txtCambio.Text != "") { // RESERVACION PASA DE SIN CONFIRMAR A CHECK IN Reservacion reserva = new Reservacion(); reserva.IdReservacion = f.IdReservacion; reserva.Confirmar(reserva); // HABITACION PASA DE DISPONIBLE A OCUPADA Habitacion hab = new Habitacion(); hab.IdHabitacion = Convert.ToInt32(dgvHabitacion.Rows[0].Cells[13].Value); hab.CambiarEstados(hab.IdHabitacion, "Ocupada"); MessageBox.Show("Se ha facturado correctamente."); f.IdFactura = f.SelectIdFactura(); btnImprimir.Enabled = true; } else { // MessageBox.Show("Ha ocurrido un error al facturar."); } } } } }
private void BtnConfirmarSalida_Click(object sender, EventArgs e) { Factura_Reservacion f = new Factura_Reservacion(); if (txtTotalAPagar.Text == "0") { //no debe f.IdReservacion = id; f.IdHuesped = Convert.ToInt32(txtIdCliente.Text); f.Empleado = txtAtendidoPor.Text; f.TotalAPagar = Convert.ToSingle(txtTotalAPagar.Text); f.Fecha = dtpFechaActual.Value; // f.FormaDePago = cmbFormaPago.Text; f.SubTotal = Convert.ToSingle(dgvFill.Rows[0].Cells[12].Value); // RESERVACION PASA DE CHECKED IN A CHECKED OUT Reservacion reserva = new Reservacion(); reserva.IdReservacion = f.IdReservacion; reserva.CheckOut(reserva); // HABITACION PASA DE OCUPADA A DISPONIBLE Y SU ESTADO DE RESERVADA PASA A NEGATIVO Habitacion hab = new Habitacion(); hab.IdHabitacion = Convert.ToInt32(dgvFill.Rows[0].Cells[3].Value); hab.CambiarEstados(hab.IdHabitacion, "Disponible"); hab.IsReserved(hab.IdHabitacion, 0); FrmCorrecto.confirmacionForm("AGREGADO"); } else { //debe if (cmbFormaPago.Text == string.Empty) { ErrorDatosFaltantes.confirmacionForm("ERROR"); } else { if (cmbFormaPago.Text == "Tarjeta") { if (txtNombre.Text == string.Empty || txtTotalAPagar.Text == string.Empty || txtBoxDigitos.Text == string.Empty || txtBoxCompania.Text == string.Empty || txtAtendidoPor.Text == string.Empty) { ErrorDatosFaltantes.confirmacionForm("ERROR"); } else { f.IdReservacion = id; f.IdHuesped = Convert.ToInt32(txtIdCliente.Text); f.Empleado = txtAtendidoPor.Text; f.TotalAPagar = Convert.ToSingle(txtTotalAPagar.Text); f.FormaDePago = cmbFormaPago.Text; f.SubTotal = Convert.ToSingle(dgvFill.Rows[0].Cells[12].Value); f.Fecha = dtpFechaActual.Value; f.UltimosDigitos = Convert.ToInt32(txtBoxDigitos.Text); f.CompaniaTarjeta = txtBoxCompania.Text; if (txtDescuento.Text == string.Empty) { //do nothing } else { f.Descuento = Convert.ToSingle(txtDescuento.Text); } if (f.InsertTarjeta(f) == true) { // RESERVACION PASA DE SIN CONFIRMAR A CHECK IN Reservacion reserva = new Reservacion(); reserva.IdReservacion = f.IdReservacion; reserva.Confirmar(reserva); // HABITACION PASA DE DISPONIBLE A OCUPADA Habitacion hab = new Habitacion(); hab.IdHabitacion = Convert.ToInt32(dgvFill.Rows[0].Cells[3].Value); hab.CambiarEstados(hab.IdHabitacion, "Disponible"); // hab.IsReserved(hab.IdHabitacion, 1); FrmCorrecto.confirmacionForm("CORRECTO"); f.IdFactura = f.SelectIdFactura(); btnImprimir.Enabled = true; } else { FrmSeguroCerrar.confirmacionForm("ERROR"); } } } if (cmbFormaPago.Text == "Efectivo") { if (txtNombre.Text == string.Empty || txtEfectivo.Text == string.Empty || txtTotalAPagar.Text == string.Empty || txtCambio.Text == string.Empty || txtAtendidoPor.Text == string.Empty) { ErrorDatosFaltantes.confirmacionForm("ERROR"); } else { /* * @IdReservacion, @IdHuesped, @SubTotal, @TotalAPagar, @Fecha, @FormaDePago, @EfectivoRecibido, @Devuelta */ f.IdReservacion = id; f.IdHuesped = Convert.ToInt32(txtIdCliente.Text); f.Empleado = txtAtendidoPor.Text; f.TotalAPagar = Convert.ToSingle(txtTotalAPagar.Text); f.Fecha = dtpFechaActual.Value; f.FormaDePago = cmbFormaPago.Text; f.SubTotal = Convert.ToSingle(dgvFill.Rows[0].Cells[12].Value); if (txtDescuento.Text == string.Empty) { //do nothing } else { f.Descuento = Convert.ToSingle(txtDescuento.Text); } if (txtEfectivo.Text == string.Empty) { //do nothing } else { f.EfectivoRecibido = Convert.ToSingle(txtEfectivo.Text); } if (txtCambio.Text == string.Empty) { //do nothing ErrorDatosFaltantes.confirmacionForm("ERROR"); } else { f.Devuelta = Convert.ToSingle(txtCambio.Text); } if (f.InsertEfectivo(f) == true && txtCambio.Text != "") { // RESERVACION PASA DE SIN CONFIRMAR A CHECK IN Reservacion reserva = new Reservacion(); reserva.IdReservacion = f.IdReservacion; reserva.Confirmar(reserva); // HABITACION PASA DE OCUPADA A DISPONIBLE Habitacion hab = new Habitacion(); hab.IdHabitacion = Convert.ToInt32(dgvFill.Rows[0].Cells[3].Value); hab.CambiarEstados(hab.IdHabitacion, "Disponible"); // hab.IsReserved(hab.IdHabitacion, 1); FrmCorrecto.confirmacionForm("CORRECTO"); f.IdFactura = f.SelectIdFactura(); btnImprimir.Enabled = true; } else { // MessageBox.Show("Ha ocurrido un error al facturar."); } } } } } }