monicasierrar
05-05-2003, 19:54:09
Tengo un formulario donde se carga inicialmente la información disponible de la base de datos para que el usuario seleccione los tipos de datos a consultar. Cuando presiona el botón ok, se demora al rededor de 2 minutos o más para descargarlo.
¿Cómo puedo resolver esto?
Adjunto el código donde realizo esta operación
Gracias
procedure Tfrm_ppal.ac_CuentaAgregadaExecute(Sender: TObject);
var
qry : TQuery;
begin
// Crea el módulo de datos de ImpoExpo
md_impoexpo := Tmd_impoexpo.Create(Self);
try
Screen.Cursor := crHourGlass;
hc.MousePointer := F1HourGlass;
Proceso := tpReportesCN;
frm_Consulta := Tfrm_Consulta.Create(Self);
frm_Consulta.Caption := 'Generar Cuentas Agregadas';
frm_Consulta.Procesamiento := Procesamiento;
frm_Consulta.Periodo := Op_Periodo;
frm_Consulta.Trimestre := Op_Trim;
frm_Consulta.Tipo := 2;
frm_Consulta.rg_Periodicidad.ItemIndex := Op_TipoPeriodo;
frm_Consulta.ShowModal;
Refresh;
if frm_Consulta.ModalResult = mrOk then
begin
Periodo.NumPer := frm_Consulta.Periodo;
Periodo.Trimestre := frm_Consulta.Trimestre;
if frm_Consulta.rg_Periodicidad.ItemIndex = 0 then
Periodo.Periodicidad := 2
else
Periodo.Periodicidad := 1;
// Abrir Formato en Excel
try
qry := md_ImpoExpo.qry_Formato;
qry.Close;
qry.ParamByName('Id').AsString := '0001';
qry.Open;
AbrirXls(hc,Ruta_Modelo + '\' +
qry.FieldByName('Archivo').AsString + '.XLS');
// Genera la estructura del formato
GenerarFormato;
// Llenar formato
Entidad.Id := '';
Entidad.Nombre := frm_Consulta.ed_Titulo.Text;
LlenarFormato(0);
GenerarAjusteCN;
except
Showmessage('Error: Leyendo la información del formato...');
end;
end;
finally
// Restaura valores, cierra las querys y el módulo de datos
Screen.Cursor := crDefault;
hc.MousePointer := F1Default;
// Borra los catálogos creados
BorrarCatalogos;
frm_Consulta.free;
md_impoexpo.free;
end;
end; {ac_CuentaAgregadaExecute}
¿Cómo puedo resolver esto?
Adjunto el código donde realizo esta operación
Gracias
procedure Tfrm_ppal.ac_CuentaAgregadaExecute(Sender: TObject);
var
qry : TQuery;
begin
// Crea el módulo de datos de ImpoExpo
md_impoexpo := Tmd_impoexpo.Create(Self);
try
Screen.Cursor := crHourGlass;
hc.MousePointer := F1HourGlass;
Proceso := tpReportesCN;
frm_Consulta := Tfrm_Consulta.Create(Self);
frm_Consulta.Caption := 'Generar Cuentas Agregadas';
frm_Consulta.Procesamiento := Procesamiento;
frm_Consulta.Periodo := Op_Periodo;
frm_Consulta.Trimestre := Op_Trim;
frm_Consulta.Tipo := 2;
frm_Consulta.rg_Periodicidad.ItemIndex := Op_TipoPeriodo;
frm_Consulta.ShowModal;
Refresh;
if frm_Consulta.ModalResult = mrOk then
begin
Periodo.NumPer := frm_Consulta.Periodo;
Periodo.Trimestre := frm_Consulta.Trimestre;
if frm_Consulta.rg_Periodicidad.ItemIndex = 0 then
Periodo.Periodicidad := 2
else
Periodo.Periodicidad := 1;
// Abrir Formato en Excel
try
qry := md_ImpoExpo.qry_Formato;
qry.Close;
qry.ParamByName('Id').AsString := '0001';
qry.Open;
AbrirXls(hc,Ruta_Modelo + '\' +
qry.FieldByName('Archivo').AsString + '.XLS');
// Genera la estructura del formato
GenerarFormato;
// Llenar formato
Entidad.Id := '';
Entidad.Nombre := frm_Consulta.ed_Titulo.Text;
LlenarFormato(0);
GenerarAjusteCN;
except
Showmessage('Error: Leyendo la información del formato...');
end;
end;
finally
// Restaura valores, cierra las querys y el módulo de datos
Screen.Cursor := crDefault;
hc.MousePointer := F1Default;
// Borra los catálogos creados
BorrarCatalogos;
frm_Consulta.free;
md_impoexpo.free;
end;
end; {ac_CuentaAgregadaExecute}