private void Creditos_Load(object sender, EventArgs e) { //Cargar Combo rubros cboRubros.DataSource = TipoDetalleController.listar(); dgvCreditos.Columns["Monto"].DefaultCellStyle.Format = "C2"; dgvCreditos.Columns["Saldo"].DefaultCellStyle.Format = "C2"; check_CheckedChanged(sender, e); }
private void loadGrid() { dgvTipoDetalle.Rows.Clear(); var tmp = TipoDetalleController.listar(); for (int i = 0; i < tmp.Count; i++) { dgvTipoDetalle.Rows.Add(tmp[i].IdTipoDetalle, tmp[i].Descripcion); } }
void loadCombos() { try { List <CapaDatos.Vehiculo> vehiculos = VehiculosController.lista(new Vehiculo()).OrderBy(x => x.Placa).ToList(); List <CapaDatos.TipoDetalle> egr = TipoDetalleController.listar().OrderBy(x => x.Descripcion).ToList(); cboVehiculo.DataSource = vehiculos; cboEgresos.DataSource = egr; } catch (Exception ex) { MessageBox.Show("Error : " + ex.Message, "No se Cargo toda la informacion", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadCombos() { try { //Obteniendo listas Conductor[] conductores = ConductorController.lista().Where(x => x.Personas.Activo).OrderBy(x => x.Personas.Nombres).ToArray(); Vehiculo[] vehiculos = VehiculosController.lista(new Vehiculo()).Where(x => x.Activo).OrderBy(x => x.Placa).ToArray(); CapaDatos.TipoDetalle[] egr = TipoDetalleController.listar().Where(x => x.Activo).OrderBy(x => x.Descripcion).ToArray(); //Llenando combos cboConductor.Items.AddRange(conductores); cboVehiculo.Items.AddRange(vehiculos); cboEgresos.Items.AddRange(egr); } catch (Exception ex) { MessageBox.Show("Error : " + ex.Message, "No se Cargo toda la informacion", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Dispose(); } }
private void Creditos_Bus_Load(object sender, EventArgs e) { //Cargar Rubros try { this.creditosDataset.EnforceConstraints = false; cboRubros.Items.Add(new TipoDetalle { IdTipoDetalle = 0, Descripcion = "NINGUNO" }); cboRubros.Items.AddRange(TipoDetalleController.listar().ToArray()); cboRubros.SelectedIndex = 0; //Cargar primera vez el datagrid cREDITOS_POR_BUSTableAdapter.Fill(this.creditosDataset.CREDITOS_POR_BUS, data.Id_Vehiculo, dtFecha1.Value, dtFecha2.Value); dgDatos.DataSource = cREDITOSPORBUSBindingSource; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnGuardar_Click(object sender, EventArgs e) { //Validar Selecciones bool txts, cbos; txts = TextosValidos(); cbos = CombosValidos(); //fechas = FechasValidas(); if (txts && cbos) { try { //Obtencion de la informacion para registrar una carrera int id_cajero = MainContainer.sesion.Personas.Id_persona; int id_conductor = ((Conductor)cboConductor.SelectedItem).Id_conductor; int id_vehiculo = ((Vehiculo)cboVehiculo.SelectedItem).Id_Vehiculo; DateTime Fecha = dtFecha.Value.Date; TimeSpan salida = dtSalida.Value.TimeOfDay; TimeSpan llegada = dtLlegada.Value.TimeOfDay; bool vuelta = cbVueltaCompleta.Checked; //Agregando Transaccion int t = TransaccionController.agregar(id_cajero, id_vehiculo, Fecha, true); //Comprobamos que se haya insertado la transaccion if (t > 0) { //Obtenemos el id de la ultima transaccion int idTransaccion = TransaccionController.getUltima().IdTransaccion; t = CarreraController.Agregar(idTransaccion, id_vehiculo, id_conductor, salida, llegada, Fecha, vuelta); //Si se inserto correctamente la carrera, procedemos a ingresar los gastos if (t > 0) { t = 0; decimal ingreso = Decimal.Parse(QuitarEspacios(txtIngreso.Text)); //Registrando Ingreso t = DetalleController.agregar(idTransaccion, TipoDetalleController.leer("CICLO").IdTipoDetalle, "CICLO", ingreso, 0, true); //Verificando y registrando los egresos decimal totalEgreso = 0; if (dgvEgresos.Rows.Count > 0) // Si hay egresos { for (int j = 0; j < dgvEgresos.RowCount; j++) { int id_egreso = (int)dgvEgresos.Rows[j].Cells[0].Value; string descripcion = dgvEgresos.Rows[j].Cells[2].Value.ToString(); decimal monto = (decimal)dgvEgresos.Rows[j].Cells[3].Value; totalEgreso += monto; t += DetalleController.agregar(idTransaccion, id_egreso, descripcion, monto, 1, true); } } if (t == 0) //Si no se registraron transacciones { throw new Exception("No se registraron las transacciones de Entrada/Salida!"); } //Se imprime la factura else { var result = MessageBox.Show("Imprimir factura?", "Confirme Impresion", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result.Equals(DialogResult.Yes)) { var ultima = CarreraController.getUltima(); //var cond = ConductorController.leer(ultima.Id_conductor); //Creando instancia de reporte TicketFisicoForm ticket = new TicketFisicoForm( CapaControlador.TransaccionController.getUltima().IdTransaccion, ultima.FechaCarrera.ToShortDateString(), MainContainer.sesion.ToString(), ultima.Vehiculo.Placa, ultima.Vehiculo.Socio.ToString(), cboConductor.SelectedItem.ToString(), ingreso, totalEgreso, (ingreso - totalEgreso) ); ticket.ShowDialog(); } limpiarControles(); actualizarNoFactura(); } } else { throw new Exception("No se Completo el registro de la carrera"); } } else { throw new Exception("No se Ingreso la carrera"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Todos los campos son requeridos!", "Faltan campos por completar", MessageBoxButtons.OK, MessageBoxIcon.Information); } }