public static Conserje obtenerConserjeActual() { DataSet ds = new DataSet(); Conserje conserje; SqlDataAdapter dataAdapter = new SqlDataAdapter("select * from conserjes where logueado = 1", fPrincipal2.conn); dataAdapter.Fill(ds); if (ds.Tables[0].Rows.Count > 0) conserje = new Conserje(ds.Tables[0].Rows[0]); else conserje = null; return conserje; }
internal void ImprimirPlanillaCierre(List<FilaPlanilla> filas, Totales totales, decimal efectivoInicial, decimal efectivoEnCaja, Conserje conserje, Label msjError) { try { string stockArt = ""; List<FilaListArt> articulosConsumidos = obtenerArticulosConsumidos(tools.obtenerParametroString("stockCierreCaja")); if (articulosConsumidos != null) { //-------- Listado Articulos stockArt = Settings.Default.listadoArtStock. Replace("##nmHotel", tools.obtenerParametroString("nombreHotel").PadRight(44)); foreach (FilaListArt fila in articulosConsumidos) { stockArt = stockArt + "\r\n" + fila.ToString(); } stockArt += "\r\n\r\n\r\n\r\n"; //-------- Fin Listado Articulos } //-------- Planilla cierre turnos string planillaCierre = Settings.Default.planillaCierre. Replace("##conserjeId", conserje.usuario.ToString().PadRight(7)). Replace("##conserjeNm", (conserje.nombre + " " + conserje.apellido).PadRight(20)). Replace("##fecha", String.Format("{0:ddd}", DateTime.Now).ToUpper() + " " + DateTime.Now.ToString("dd/MM/yyyy")). Replace("##hora", DateTime.Now.ToString("HH:mm")). Replace("##nroArq", obtenerNroPlanilla().ToString()); foreach (FilaPlanilla fila in filas) { planillaCierre = planillaCierre + "\r\n" + fila.ToString(); } planillaCierre += "\r\n" + "".PadRight(124, '=') + "\r\n" + String.Format("{0:N0}", totales.totalTurnos).PadLeft(41) + " " + String.Format("{0:N0}", totales.totalExtras).PadLeft(6) + " " + String.Format("{0:N0}", totales.totalBar).PadLeft(6) + " " + String.Format("{0:N0}", totales.totalDescuento).PadLeft(6) + " " + String.Format("{0:N0}", totales.totalTotal).PadLeft(8) + " " + String.Format("{0:N0}", totales.totalEfectivo).PadLeft(8) + " " + String.Format("{0:N0}", totales.totalTarjeta).PadLeft(8) + " " + String.Format("{0:N0}", totales.totalGastos).PadLeft(8) + "\r\n"; decimal ingEgre = totales.totalEfectivo - totales.totalGastos; planillaCierre += "\r\n" + "".PadLeft(70) + "Saldo Inicial : " + String.Format("{0:N0}", efectivoInicial).PadLeft(8) + "\r\n" + "".PadLeft(70) + "Ingreso-Egreso : " + String.Format("{0:N0}", ingEgre).PadLeft(8) + "\r\n" + "".PadLeft(70) + "Total en Caja : " + String.Format("{0:N0}", (efectivoInicial + ingEgre)).PadLeft(8) + "\r\n" + "".PadLeft(70) + "Deposito buzón : " + String.Format("{0:N0}", (efectivoInicial + ingEgre - efectivoEnCaja)).PadLeft(8) + "\r\n" + "".PadLeft(70) + "Queda en Caja : " + String.Format("{0:N0}", efectivoEnCaja).PadLeft(8); planillaCierre += "\r\n\r\n\r\n\r\n"; //------ Fin planilla cierre turno string ticketRopaConsumida = ""; if (tools.obtenerParametroInt("consumoRopaCierre") == 1) { //-------- Planilla Ropa Consumida ticketRopaConsumida = Settings.Default.listadoRopaConsumida; List<FilaRopaConsumida> ropaConsumida = obtenerRopaConsumida(); foreach (FilaRopaConsumida fila in ropaConsumida) { if (fila.categoria == "TOTAL") ticketRopaConsumida += "\r\n"; ticketRopaConsumida += fila.ToString() + "\r\n"; } //-------- Fin Planilla Ropa Consumida } try { string ticketSalida = stockArt + planillaCierre + ticketRopaConsumida; guardarArchivoTempCierreCaja(ticketSalida, out cantLineas); configurarImpresora(ref formulario, cantLineas, 9); formulario.PrinterSettings.PrinterName = obtenerImpresora("Caja");//Seleccionar impresora Caja formulario.Print(); } catch (Exception e) { msjError.Text = e.Message; } } catch (Exception ex) { msjError.Text = ex.Message; LoggerProxy.Error(ex.Message + " - " + ex.StackTrace); } }
private void textClave_KeyPress(object sender, KeyPressEventArgs e) { int clave = 0; int usuario = 0; if ((char)Keys.Enter == e.KeyChar) { if (textUsuario.Text == "" || int.TryParse(textUsuario.Text, out usuario) == false) textUsuario.Text = "0"; if (textClave.Text == "" || int.TryParse(textClave.Text, out clave) == false) textClave.Text = "0"; conserjeActual = Conserje.Login(usuario, clave); if (conserjeActual == null) { textClave.Text = ""; textUsuario.Text = ""; textUsuario.Focus(); } else { textUsuario.Visible = false; labelClave.Visible = false; textClave.Visible = false; labelConserje.Text = "Conserje:" + conserjeActual.nombre; panelDatosHotel_Paint(panelDatosHotel, new PaintEventArgs(panelDatosHotel.CreateGraphics(), panelDatosHotel.ClientRectangle)); } e.Handled = true; } }
private void fPrincipal_Load(object sender, EventArgs e) { int maxFilas; SqlDataReader reader; conserjeActual = Conserje.obtenerConserjeActual(); if (conserjeActual == null) { textUsuario.Visible = true; labelClave.Visible = true; textClave.Visible = true; textUsuario.Focus(); } else { labelConserje.Text = "Conserje:" + conserjeActual.nombre; } labelNombre.Text = tools.obtenerParametroString("nombreHotel"); labelHora.Text = "Hora: " + DateTime.Now.ToString("HH:mm"); labelFecha.Text = String.Format("{0:ddd}", DateTime.Now).ToUpper() + " " + DateTime.Now.ToString("dd / MM / yyyy"); SqlCommand comm = new SqlCommand("listaTurnos_2", conn); comm.Parameters.AddWithValue("@orden", tools.obtenerParametroString("ordenListado")); comm.CommandType = CommandType.StoredProcedure; SqlParameter cantHab = new SqlParameter("@ret", SqlDbType.Int); cantHab.Direction = ParameterDirection.ReturnValue; comm.Parameters.Add(cantHab); comm.ExecuteNonQuery(); this.maxFilas = maxFilas = ((int)cantHab.Value / 2) - 1; this.cantHab = (int)cantHab.Value; dataGridView1 = TablaTurnos.nuevaTabla(); dataGridView1.Paint += new System.Windows.Forms.PaintEventHandler(dataGridView_Paint); dataGridView1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_RowPostPaint); dataGridView1.RowsAdded += new DataGridViewRowsAddedEventHandler(dataGridView1_RowsAdded); this.tableLayoutPanel1.Controls.Add(dataGridView1, 0, 1); this.tableLayoutPanel1.SetRowSpan(dataGridView1, 2); dataGridView1.RowTemplate.Height = tools.calcularAltoFila(this.dataGridView1, (int)cantHab.Value, maxFilas); float resto = dataGridView1.Height - dataGridView1.ColumnHeadersHeight - (dataGridView1.RowTemplate.Height * (maxFilas + 1)); if (resto > 5) resto = resto - 5; dataGridView1.ColumnHeadersHeight = dataGridView1.ColumnHeadersHeight + (int)(Math.Floor(resto)); float tamFuente = 12f + (3.6f - (0.1f * (int)cantHab.Value)); dataGridView1.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", tamFuente, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); reader = comm.ExecuteReader(); //reader.Close(); //dibujar(maxFilas, (int)cantHab.Value, reader); //dataGridView1.Sort(new RowComparer(System.Windows.Forms.SortOrder.Descending)); dataGridView1.Enabled = true; dataGridView1.DataSource = null; reader.Close(); //dataGridView1.SuspendLayout(); }
private void textClave_KeyPress(object sender, KeyPressEventArgs e) { int clave = 0; int usuario = 0; if ((char)Keys.Enter == e.KeyChar) { if (textUsuario.Text == "" || int.TryParse(textUsuario.Text, out usuario) == false) textUsuario.Text = "0"; if (textClave.Text == "" || int.TryParse(textClave.Text, out clave) == false) textClave.Text = "0"; conserjeActual = Conserje.Login(usuario, clave); if (conserjeActual == null) { textClave.Text = ""; textUsuario.Text = ""; textUsuario.Focus(); } else { textUsuario.Visible = false; labelClave.Visible = false; textClave.Visible = false; labelConserje.Text = "Conserje:" + conserjeActual.nombre; panelDatosHotel_Paint(panelDatosHotel, new PaintEventArgs(panelDatosHotel.CreateGraphics(), panelDatosHotel.ClientRectangle)); try { // Abro el cierre de caja para el conserje SqlCommand comm = new SqlCommand("cierresCajas_abrirCierre", conn); comm.CommandType = CommandType.StoredProcedure; comm.Parameters.AddWithValue("@efIni", 0); comm.Parameters.AddWithValue("@tarjIni", 0); comm.Parameters.AddWithValue("@conserjeId", conserjeActual.usuario); comm.ExecuteNonQuery(); } catch (Exception ex) { LoggerProxy.ErrorSinBD(ex.Message + " - " + ex.StackTrace); } } e.Handled = true; } }
private void fPrincipal2_Load(object sender, EventArgs e) { OcultarMouse(); #region cargarListaTurnos int altoFila; int altoFilaExtra; tools.calcularAlturas(dataGridView1.Height - dataGridView1.ColumnHeadersHeight, maxFilas < tools.minCantFilas?tools.minCantFilas:maxFilas, out altoFila, out altoFilaExtra); dataGridView1.RowTemplate.Height = altoFila; dataGridView2.RowTemplate.Height = altoFila; dataGridView1.ColumnHeadersHeight = dataGridView1.ColumnHeadersHeight + altoFilaExtra; dataGridView2.ColumnHeadersHeight = dataGridView1.ColumnHeadersHeight; tamFuente = 12f + (3.6f - (0.1f * cantHab)); dataGridView1.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", tamFuente, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridView2.DefaultCellStyle.Font = dataGridView1.DefaultCellStyle.Font; tools.actualizarListadoTurnos(dataGridView1, dataGridView2); #endregion #region Recuperar Estado Habitaciones recuperarEstadosHabitaciones(); #endregion #region CargarConserje conserjeActual = Conserje.obtenerConserjeActual(); if (conserjeActual == null) { textUsuario.Visible = true; labelClave.Visible = true; textClave.Visible = true; textUsuario.Focus(); } else labelConserje.Text = "Conserje: " + conserjeActual.nombre + " " + conserjeActual.apellido; #endregion #region ArrancarActualizacionHora thActualizarHora = new Thread(ActualizarLaHora); thActualizarHora.Start(); #endregion #region ActualizadorTarifaHabitacion thControlarTarifa = new Thread(ControlarTarifaHabitacion); thControlarTarifa.Start(); #endregion #region ArrancarParpadeoSeñalizacionINTER thControlarParpadeo = new Thread(timerParpadeo2); thControlarParpadeo.Start(); #endregion if (textUsuario.Visible) textUsuario.Focus(); }