Fórum Será q uso threads??? #332074
25/10/2006
0
Bom pessoal... ta tenso aqui pro meu lado...
Não tenho noção de como usar THREADS... sei o q são mas não sei implementar no delphi.. fiz algumas pesquisas mas não consegui uma resposta clara para a minha dúvida....
Seguinte... estou tendo um problema para gerar um relatorio...
A unit é:
O método que estou utilizando para chamar o relatorio é procedure TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude.btnImprimirClick(Sender: TObject);
Na parte em q abro as querys está demorando DEMAIS pois são functions dentro do SQL Server...
Todos os opens estão demorando muito!!!!
Pensei em usar THREADS... alguem pode me indicar se devo realmente usar threads ou outra meio para adiantar...
E se devo usar THREADS COMO QUE EU USO! Alguem pode me indicar uma forma???????????????????????????
Obs.: Uso ADO com CURSOR LOCATION clUseClient e CURSORTYPE ctKeyset.
Não tenho noção de como usar THREADS... sei o q são mas não sei implementar no delphi.. fiz algumas pesquisas mas não consegui uma resposta clara para a minha dúvida....
Seguinte... estou tendo um problema para gerar um relatorio...
A unit é:
unit FrmRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Hr_Frm_BaseRelatorio, cxLookAndFeelPainters, ppBands, ppCache,
ppClass, ppDB, ppDBPipe, ppParameter, ppComm, ppRelatv, ppProd, ppReport,
DB, ADODB, cxStyles, cxPropertiesStore, StdCtrls, cxButtons, ExtCtrls,
cxSpinEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit,
cxDBLookupEdit, cxDBLookupComboBox, cxControls, cxContainer, cxEdit,
cxLabel, ppCtrls, ppVar, ppPrnabl, ppStrtch, ppSubRpt, ppModule, raCodMod,
cxCheckBox, cxImageComboBox, cxGroupBox, ppMemo;
type
TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude = class(THrFrmBaseRelatorio)
ppdbpMasterUnidadesGestoras: TppDBPipeline;
adoMasterUnidadesGestoras: TADOQuery;
dtsMasterUnidadesGestoras: TDataSource;
ppdbpCtb_FN_LRF_Anexo16_TP_Dados01: TppDBPipeline;
adoCtb_FN_LRF_Anexo16_TP_Dados01: TADOQuery;
dtsCtb_FN_LRF_Anexo16_TP_Dados01: TDataSource;
ppdbpCtb_FN_LRF_Anexo16_TP_Dados02: TppDBPipeline;
adoCtb_FN_LRF_Anexo16_TP_Dados02: TADOQuery;
dtsCtb_FN_LRF_Anexo16_TP_Dados02: TDataSource;
ppdbpCtb_FN_LRF_Anexo16_TP_Dados03: TppDBPipeline;
adoCtb_FN_LRF_Anexo16_TP_Dados03: TADOQuery;
dtsCtb_FN_LRF_Anexo16_TP_Dados03: TDataSource;
ppdbpCtb_FN_LRF_Anexo16_TP_Dados04: TppDBPipeline;
adoCtb_FN_LRF_Anexo16_TP_Dados04: TADOQuery;
dtsCtb_FN_LRF_Anexo10_TP_Dados04: TDataSource;
ppdbpCtb_FN_LRF_Anexo16_TP_Dados05: TppDBPipeline;
adoCtb_FN_LRF_Anexo16_TP_Dados05: TADOQuery;
dtsCtb_FN_LRF_Anexo10_TP_Dados05: TDataSource;
ppdbpCtb_FN_LRF_Anexo16_TP_Dados06: TppDBPipeline;
adoCtb_FN_LRF_Anexo16_TP_Dados06: TADOQuery;
dtsCtb_FN_LRF_Anexo16_TP_Dados06: TDataSource;
ppdbpCtb_FN_LRF_Anexo16_TP_Dados07: TppDBPipeline;
adoCtb_FN_LRF_Anexo16_TP_Dados07: TADOQuery;
dtsCtb_FN_LRF_Anexo16_TP_Dados07: TDataSource;
ppdbpCtb_FN_LRF_Anexo16_TP_Dados08: TppDBPipeline;
adoCtb_FN_LRF_Anexo16_TP_Dados08: TADOQuery;
dtsCtb_FN_LRF_Anexo16_TP_Dados08: TDataSource;
ppdbpCtb_FN_LRF_Anexo16_TP_Dados09: TppDBPipeline;
adoCtb_FN_LRF_Anexo16_TP_Dados09: TADOQuery;
dtsCtb_FN_LRF_Anexo16_TP_Dados09: TDataSource;
ppParameterList1: TppParameterList;
cxGroupBox2: TcxGroupBox;
cxLabel3: TcxLabel;
cxlcbUnidadeGestora: TcxLookupComboBox;
cxGroupBox1: TcxGroupBox;
cxicb_TP_Periodo: TcxImageComboBox;
cxLabel4: TcxLabel;
cxseAno: TcxSpinEdit;
cxLabel7: TcxLabel;
cxicb_NR_Periodo: TcxImageComboBox;
cxLReferencia: TcxLabel;
cxGroupBox3: TcxGroupBox;
cxLabel1: TcxLabel;
cxLabel2: TcxLabel;
cxsp_NR_Nivel: TcxSpinEdit;
cxspNR_Posicoes_identacao: TcxSpinEdit;
cxcb_SN_Totalizar_Nivel_Inferior: TcxCheckBox;
cxLabel5: TcxLabel;
cxicbSB_PODER: TcxImageComboBox;
ppHeaderBand1: TppHeaderBand;
ppLine2: TppLine;
ppLine9: TppLine;
ppLine8: TppLine;
pplLinha3: TppLabel;
pplLinha4: TppLabel;
pplLinha5: TppLabel;
ppdb_Unidade_Gestora: TppDBText;
pplReferencia: TppLabel;
ppLabel34: TppLabel;
ppLabel35: TppLabel;
ppDBImage2: TppDBImage;
ppDetailBand1: TppDetailBand;
SBCtb_FN_LRF_Anexo10_TP_Dados01: TppSubReport;
ppChildReport1: TppChildReport;
ppTitleBand1: TppTitleBand;
ppLine1: TppLine;
ppLabel1: TppLabel;
ppLabel2: TppLabel;
ppLabel4: TppLabel;
ppLabel5: TppLabel;
ppLine4: TppLine;
ppLine5: TppLine;
ppLabel8: TppLabel;
ppLine6: TppLine;
ppLabel6: TppLabel;
ppLine7: TppLine;
ppLabel9: TppLabel;
ppLabel10: TppLabel;
ppLabel11: TppLabel;
ppLabel12: TppLabel;
ppLine11: TppLine;
ppLine12: TppLine;
ppDetailBand2: TppDetailBand;
ppDBText1: TppDBText;
ppDBText2: TppDBText;
ppDBText3: TppDBText;
ppDBText5: TppDBText;
ppLine13: TppLine;
ppLine18: TppLine;
ppLine19: TppLine;
ppLine21: TppLine;
ppDBText42: TppDBText;
ppSummaryBand1: TppSummaryBand;
ppLabel13: TppLabel;
ppLine14: TppLine;
ppLine15: TppLine;
ppLine16: TppLine;
ppLine3: TppLine;
ppLine41: TppLine;
ppLine42: TppLine;
ppDBCalc3: TppDBCalc;
ppDBCalc4: TppDBCalc;
ppDBCalc6: TppDBCalc;
ppVariable1: TppVariable;
raCodeModule1: TraCodeModule;
SBCtb_FN_LRF_Anexo10_TP_Dados02: TppSubReport;
ppChildReport2: TppChildReport;
ppTitleBand2: TppTitleBand;
ppLine24: TppLine;
ppLabel14: TppLabel;
ppLabel15: TppLabel;
ppLabel16: TppLabel;
ppLabel17: TppLabel;
ppLine25: TppLine;
ppLine26: TppLine;
ppLabel18: TppLabel;
ppLine27: TppLine;
ppLabel19: TppLabel;
ppLine28: TppLine;
ppLabel21: TppLabel;
ppLabel22: TppLabel;
ppLabel23: TppLabel;
ppLabel24: TppLabel;
ppLine30: TppLine;
ppLine31: TppLine;
ppDetailBand3: TppDetailBand;
ppDBText10: TppDBText;
ppDBText11: TppDBText;
ppDBText12: TppDBText;
ppDBText14: TppDBText;
ppLine32: TppLine;
ppLine33: TppLine;
ppLine34: TppLine;
ppLine36: TppLine;
ppDBText6: TppDBText;
ppSummaryBand2: TppSummaryBand;
ppLabel25: TppLabel;
ppLine37: TppLine;
ppLine38: TppLine;
ppLine39: TppLine;
ppLine43: TppLine;
ppLine44: TppLine;
ppLine45: TppLine;
ppDBCalc8: TppDBCalc;
ppDBCalc9: TppDBCalc;
ppDBCalc11: TppDBCalc;
ppVariable2: TppVariable;
raCodeModule3: TraCodeModule;
ppFooterBand1: TppFooterBand;
ppLine47: TppLine;
raCodeModule2: TraCodeModule;
ppDBText35: TppDBText;
ppDBText55: TppDBText;
ppDBText56: TppDBText;
ppDBText113: TppDBText;
ppDBText114: TppDBText;
ppDBText115: TppDBText;
ppDBText116: TppDBText;
ppDBText117: TppDBText;
ppLine109: TppLine;
ppLine110: TppLine;
ppLine111: TppLine;
ppLine112: TppLine;
dtsCtb_Relatorios_Assinaturas: TDataSource;
ppdbpCtb_Relatorios_Assinaturas: TppDBPipeline;
adoCtb_Relatorios_Assinaturas: TADOQuery;
ppSummaryBand10: TppSummaryBand;
ppLabel7: TppLabel;
SBCtb_FN_LRF_Anexo16_TP_Dados03: TppSubReport;
ppChildReport3: TppChildReport;
ppTitleBand3: TppTitleBand;
ppLine10: TppLine;
ppLabel3: TppLabel;
ppLabel20: TppLabel;
ppLabel26: TppLabel;
ppLabel27: TppLabel;
ppLine17: TppLine;
ppLine20: TppLine;
ppLine22: TppLine;
ppLabel29: TppLabel;
ppLine23: TppLine;
ppLabel30: TppLabel;
ppLabel31: TppLabel;
ppLabel32: TppLabel;
ppLabel33: TppLabel;
ppLine29: TppLine;
ppLine35: TppLine;
ppDetailBand4: TppDetailBand;
ppDBText4: TppDBText;
ppDBText7: TppDBText;
ppDBText8: TppDBText;
ppDBText9: TppDBText;
ppLine40: TppLine;
ppLine46: TppLine;
ppLine48: TppLine;
ppLine49: TppLine;
ppDBText13: TppDBText;
ppSummaryBand3: TppSummaryBand;
ppLabel37: TppLabel;
ppLine50: TppLine;
ppLine51: TppLine;
ppLine52: TppLine;
ppLine53: TppLine;
ppLine54: TppLine;
ppLine55: TppLine;
ppDBCalc1: TppDBCalc;
ppDBCalc2: TppDBCalc;
ppDBCalc5: TppDBCalc;
ppVariable3: TppVariable;
raCodeModule4: TraCodeModule;
SBCtb_FN_LRF_Anexo16_TP_Dados04: TppSubReport;
ppChildReport4: TppChildReport;
ppTitleBand4: TppTitleBand;
ppLine56: TppLine;
ppLine57: TppLine;
ppLine58: TppLine;
ppLine59: TppLine;
ppLabel42: TppLabel;
ppLine60: TppLine;
ppLine62: TppLine;
ppDetailBand5: TppDetailBand;
ppDBText15: TppDBText;
ppDBText16: TppDBText;
ppDBText17: TppDBText;
ppDBText18: TppDBText;
ppLine63: TppLine;
ppLine64: TppLine;
ppLine65: TppLine;
ppLine66: TppLine;
ppDBText19: TppDBText;
ppSummaryBand4: TppSummaryBand;
ppLabel47: TppLabel;
ppLine67: TppLine;
ppLine68: TppLine;
ppLine69: TppLine;
ppLine70: TppLine;
ppLine71: TppLine;
ppLine72: TppLine;
ppDBCalc7: TppDBCalc;
ppDBCalc10: TppDBCalc;
ppDBCalc12: TppDBCalc;
ppVariable4: TppVariable;
raCodeModule5: TraCodeModule;
ppLine61: TppLine;
ppMemo1: TppMemo;
ppMemo2: TppMemo;
ppMemo3: TppMemo;
ppMemo4: TppMemo;
ppMemo5: TppMemo;
SBCtb_FN_LRF_Anexo16_TP_Dados05: TppSubReport;
ppChildReport5: TppChildReport;
ppTitleBand5: TppTitleBand;
ppDetailBand6: TppDetailBand;
ppDBText20: TppDBText;
ppLine83: TppLine;
ppDBText24: TppDBText;
ppSummaryBand5: TppSummaryBand;
raCodeModule6: TraCodeModule;
SBCtb_FN_LRF_Anexo16_TP_Dados06: TppSubReport;
ppChildReport6: TppChildReport;
ppTitleBand6: TppTitleBand;
ppLine73: TppLine;
ppLabel36: TppLabel;
ppLabel38: TppLabel;
ppLabel39: TppLabel;
ppLabel40: TppLabel;
ppLine74: TppLine;
ppLine75: TppLine;
ppLine76: TppLine;
ppLabel43: TppLabel;
ppLine77: TppLine;
ppLabel44: TppLabel;
ppLabel45: TppLabel;
ppLabel46: TppLabel;
ppLabel48: TppLabel;
ppLine78: TppLine;
ppLine79: TppLine;
ppLabel49: TppLabel;
ppDetailBand7: TppDetailBand;
ppDBText21: TppDBText;
ppDBText22: TppDBText;
ppDBText23: TppDBText;
ppDBText25: TppDBText;
ppLine80: TppLine;
ppLine81: TppLine;
ppLine82: TppLine;
ppLine84: TppLine;
ppDBText26: TppDBText;
ppSummaryBand6: TppSummaryBand;
ppLabel50: TppLabel;
ppLine85: TppLine;
ppLine86: TppLine;
ppLine87: TppLine;
ppLine88: TppLine;
ppLine89: TppLine;
ppLine90: TppLine;
ppDBCalc13: TppDBCalc;
ppDBCalc14: TppDBCalc;
ppDBCalc15: TppDBCalc;
ppVariable5: TppVariable;
raCodeModule7: TraCodeModule;
SBCtb_FN_LRF_Anexo16_TP_Dados07: TppSubReport;
ppChildReport7: TppChildReport;
ppTitleBand7: TppTitleBand;
ppDetailBand8: TppDetailBand;
ppDBText27: TppDBText;
ppDBText28: TppDBText;
ppDBText29: TppDBText;
ppDBText30: TppDBText;
ppLine98: TppLine;
ppLine99: TppLine;
ppLine100: TppLine;
ppLine101: TppLine;
ppDBText31: TppDBText;
ppSummaryBand7: TppSummaryBand;
ppLabel59: TppLabel;
ppLine102: TppLine;
ppLine103: TppLine;
ppLine104: TppLine;
ppLine105: TppLine;
ppLine106: TppLine;
ppLine107: TppLine;
ppDBCalc16: TppDBCalc;
ppDBCalc17: TppDBCalc;
ppDBCalc18: TppDBCalc;
ppVariable6: TppVariable;
raCodeModule8: TraCodeModule;
procedure btnImprimirClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cxicb_TP_PeriodoPropertiesEditValueChanged(Sender: TObject);
procedure cxlcbUnidadeGestoraPropertiesEditValueChanged(
Sender: TObject);
procedure ppSummaryBand10BeforePrint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude: TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude;
implementation
uses UtAppDefIndiv;
{$R *.dfm}
procedure TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude.btnImprimirClick(Sender: TObject);
begin
inherited;
pplReferencia.Caption := ´Referência: Exercício de ´+ IntToStr(cxseAno.Value);
if adoMasterUnidadesGestoras.FieldByName(´BL_LOGOMARCA´).isNull then
ppdb_Unidade_Gestora.Alignment := taCenter
else
ppdb_Unidade_Gestora.Alignment := taLeftJustify;
adoMaster.Close;
adoMaster.Parameters.ParamByName(´CD_UNIDADE_GESTORA_INICIAL´).Value := adoMasterUnidadesGestoras.FieldByName(´CD_UNIDADE_GESTORA´).Value;
adoMaster.Parameters.ParamByName(´CD_UNIDADE_GESTORA_FINAL´).Value := adoMasterUnidadesGestoras.FieldByName(´CD_UNIDADE_GESTORA´).Value;
adoMaster.Open;
adoCtb_FN_LRF_Anexo16_TP_Dados01.Close;
adoCtb_FN_LRF_Anexo16_TP_Dados01.Parameters.ParamByName(´SN_SOMENTE_UG´).Value := 0;
adoCtb_FN_LRF_Anexo16_TP_Dados01.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados01.Parameters.ParamByName(´TP_PERIODO´).Value := cxicb_TP_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados01.Parameters.ParamByName(´NR_PERIODO´).Value := cxicb_NR_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados01.Parameters.ParamByName(´AN_PERIODO´).Value := cxseAno.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados01.Parameters.ParamByName(´NR_POSICOES_IDENTACAO´).Value:= cxspNR_Posicoes_identacao.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados01.Open;
adoCtb_FN_LRF_Anexo16_TP_Dados02.Close;
adoCtb_FN_LRF_Anexo16_TP_Dados02.Parameters.ParamByName(´SN_SOMENTE_UG´).Value := 0;
adoCtb_FN_LRF_Anexo16_TP_Dados02.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados02.Parameters.ParamByName(´TP_PERIODO´).Value := cxicb_TP_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados02.Parameters.ParamByName(´NR_PERIODO´).Value := cxicb_NR_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados02.Parameters.ParamByName(´AN_PERIODO´).Value := cxseAno.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados02.Parameters.ParamByName(´NR_POSICOES_IDENTACAO´).Value:= cxspNR_Posicoes_identacao.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados02.Open;
adoCtb_FN_LRF_Anexo16_TP_Dados03.Close;
adoCtb_FN_LRF_Anexo16_TP_Dados03.Parameters.ParamByName(´SN_SOMENTE_UG´).Value := 0;
adoCtb_FN_LRF_Anexo16_TP_Dados03.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados03.Parameters.ParamByName(´TP_PERIODO´).Value := cxicb_TP_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados03.Parameters.ParamByName(´NR_PERIODO´).Value := cxicb_NR_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados03.Parameters.ParamByName(´AN_PERIODO´).Value := cxseAno.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados03.Parameters.ParamByName(´NR_POSICOES_IDENTACAO´).Value:= cxspNR_Posicoes_identacao.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados03.Open;
adoCtb_FN_LRF_Anexo16_TP_Dados04.Close;
adoCtb_FN_LRF_Anexo16_TP_Dados04.Parameters.ParamByName(´SN_SOMENTE_UG´).Value := 0;
adoCtb_FN_LRF_Anexo16_TP_Dados04.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados04.Parameters.ParamByName(´TP_PERIODO´).Value := cxicb_TP_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados04.Parameters.ParamByName(´NR_PERIODO´).Value := cxicb_NR_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados04.Parameters.ParamByName(´AN_PERIODO´).Value := cxseAno.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados04.Parameters.ParamByName(´NR_POSICOES_IDENTACAO´).Value:= cxspNR_Posicoes_identacao.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados04.Open;
adoCtb_FN_LRF_Anexo16_TP_Dados05.Close;
adoCtb_FN_LRF_Anexo16_TP_Dados05.Parameters.ParamByName(´SN_SOMENTE_UG´).Value := 0;
adoCtb_FN_LRF_Anexo16_TP_Dados05.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados05.Parameters.ParamByName(´TP_PERIODO´).Value := cxicb_TP_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados05.Parameters.ParamByName(´NR_PERIODO´).Value := cxicb_NR_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados05.Parameters.ParamByName(´AN_PERIODO´).Value := cxseAno.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados05.Parameters.ParamByName(´NR_POSICOES_IDENTACAO´).Value:= cxspNR_Posicoes_identacao.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados05.Open;
adoCtb_FN_LRF_Anexo16_TP_Dados06.Close;
adoCtb_FN_LRF_Anexo16_TP_Dados06.Parameters.ParamByName(´SN_SOMENTE_UG´).Value := 0;
adoCtb_FN_LRF_Anexo16_TP_Dados06.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados06.Parameters.ParamByName(´TP_PERIODO´).Value := cxicb_TP_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados06.Parameters.ParamByName(´NR_PERIODO´).Value := cxicb_NR_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados06.Parameters.ParamByName(´AN_PERIODO´).Value := cxseAno.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados06.Parameters.ParamByName(´NR_POSICOES_IDENTACAO´).Value:= cxspNR_Posicoes_identacao.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados06.Open;
adoCtb_FN_LRF_Anexo16_TP_Dados07.Close;
adoCtb_FN_LRF_Anexo16_TP_Dados07.Parameters.ParamByName(´SN_SOMENTE_UG´).Value := 0;
adoCtb_FN_LRF_Anexo16_TP_Dados07.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados07.Parameters.ParamByName(´TP_PERIODO´).Value := cxicb_TP_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados07.Parameters.ParamByName(´NR_PERIODO´).Value := cxicb_NR_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados07.Parameters.ParamByName(´AN_PERIODO´).Value := cxseAno.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados07.Parameters.ParamByName(´NR_POSICOES_IDENTACAO´).Value:= cxspNR_Posicoes_identacao.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados07.Open;
adoCtb_FN_LRF_Anexo16_TP_Dados08.Close;
adoCtb_FN_LRF_Anexo16_TP_Dados08.Parameters.ParamByName(´SN_SOMENTE_UG´).Value := 0;
adoCtb_FN_LRF_Anexo16_TP_Dados08.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados08.Parameters.ParamByName(´TP_PERIODO´).Value := cxicb_TP_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados08.Parameters.ParamByName(´NR_PERIODO´).Value := cxicb_NR_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados08.Parameters.ParamByName(´AN_PERIODO´).Value := cxseAno.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados08.Parameters.ParamByName(´NR_POSICOES_IDENTACAO´).Value:= cxspNR_Posicoes_identacao.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados08.Open;
adoCtb_FN_LRF_Anexo16_TP_Dados09.Close;
adoCtb_FN_LRF_Anexo16_TP_Dados09.Parameters.ParamByName(´SN_SOMENTE_UG´).Value := 0;
adoCtb_FN_LRF_Anexo16_TP_Dados09.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados09.Parameters.ParamByName(´TP_PERIODO´).Value := cxicb_TP_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados09.Parameters.ParamByName(´NR_PERIODO´).Value := cxicb_NR_Periodo.EditValue;
adoCtb_FN_LRF_Anexo16_TP_Dados09.Parameters.ParamByName(´AN_PERIODO´).Value := cxseAno.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados09.Parameters.ParamByName(´NR_POSICOES_IDENTACAO´).Value:= cxspNR_Posicoes_identacao.Value;
adoCtb_FN_LRF_Anexo16_TP_Dados09.Open;
pplReferencia.Caption:= ´Referência: ´+ cxicb_NR_Periodo.EditText +´ de ´+IntToStr(cxseAno.Value);
if adoMasterUnidadesGestoras.FieldByName(´BL_LOGOMARCA´).isNull then
ppdb_Unidade_Gestora.Alignment := taCenter
else
ppdb_Unidade_Gestora.Alignment := taLeftJustify;
if not adoMaster.Eof then
begin
if sender = btnPrintPreview then
pprMaster.DeviceType := ´Screen´
else
pprMaster.DeviceType := ´Printer´;
pprMaster.Print;
end
else
begin
ShowMessage(´Não existe dados para montar o relatório´);
end;
end;
procedure TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude.FormCreate(Sender: TObject);
begin
inherited;
FormGUID := ´{CA3479F7-9448-4E87-A8E9-0540132AB7AD}´;
varContabilidade.iNr_Tabela := ´12.01.01´;
cxseAno.Value:= varContabilidade.iAnoTrabalho;
cxicb_TP_Periodo.EditValue := ´B´;
adoMasterUnidadesGestoras.Open;
cxlcbUnidadeGestora.EditValue := varContabilidade.iCodUnidadeGestora;
end;
procedure TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude.cxicb_TP_PeriodoPropertiesEditValueChanged(
Sender: TObject);
begin
inherited;
cxLReferencia.Visible := True;
cxicb_NR_Periodo.Visible:= True;
cxicb_NR_Periodo.Properties.Items.Clear;
if cxicb_TP_Periodo.EditValue = ´M´ then
begin
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[00].Description := ´Janeiro´;
cxicb_NR_Periodo.Properties.Items[00].ImageIndex := 0;
cxicb_NR_Periodo.Properties.Items[00].Value := ´1´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[01].Description := ´Fevereiro´;
cxicb_NR_Periodo.Properties.Items[01].ImageIndex := 1;
cxicb_NR_Periodo.Properties.Items[01].Value := ´2´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[02].Description := ´Março´;
cxicb_NR_Periodo.Properties.Items[02].ImageIndex := 2;
cxicb_NR_Periodo.Properties.Items[02].Value := ´3´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[03].Description := ´Abril´;
cxicb_NR_Periodo.Properties.Items[03].ImageIndex := 3;
cxicb_NR_Periodo.Properties.Items[03].Value := ´4´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[04].Description := ´Maio´;
cxicb_NR_Periodo.Properties.Items[04].ImageIndex := 4;
cxicb_NR_Periodo.Properties.Items[04].Value := ´5´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[05].Description := ´Junho´;
cxicb_NR_Periodo.Properties.Items[05].ImageIndex := 5;
cxicb_NR_Periodo.Properties.Items[05].Value := ´6´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[06].Description := ´Julho´;
cxicb_NR_Periodo.Properties.Items[06].ImageIndex := 6;
cxicb_NR_Periodo.Properties.Items[06].Value := ´7´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[07].Description := ´Agosto´;
cxicb_NR_Periodo.Properties.Items[07].ImageIndex := 7;
cxicb_NR_Periodo.Properties.Items[07].Value := ´8´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[08].Description := ´Setembro´;
cxicb_NR_Periodo.Properties.Items[08].ImageIndex := 8;
cxicb_NR_Periodo.Properties.Items[08].Value := ´9´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[09].Description := ´Outubro´;
cxicb_NR_Periodo.Properties.Items[09].ImageIndex := 9;
cxicb_NR_Periodo.Properties.Items[09].Value := ´10´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[10].Description := ´Novembro´;
cxicb_NR_Periodo.Properties.Items[10].ImageIndex := 10;
cxicb_NR_Periodo.Properties.Items[10].Value := ´11´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[11].Description := ´Dezembro´;
cxicb_NR_Periodo.Properties.Items[11].ImageIndex := 11;
cxicb_NR_Periodo.Properties.Items[11].Value := ´12´;
end
else if cxicb_TP_Periodo.EditValue = ´B´ then
begin
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[0].Description := ´1º Bimestre´;
cxicb_NR_Periodo.Properties.Items[0].ImageIndex := 0;
cxicb_NR_Periodo.Properties.Items[0].Value := ´1´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[1].Description := ´2º Bimestre´;
cxicb_NR_Periodo.Properties.Items[1].ImageIndex := 1;
cxicb_NR_Periodo.Properties.Items[1].Value := ´2´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[2].Description := ´3º Bimestre´;
cxicb_NR_Periodo.Properties.Items[2].ImageIndex := 2;
cxicb_NR_Periodo.Properties.Items[2].Value := ´3´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[3].Description := ´4º Bimestre´;
cxicb_NR_Periodo.Properties.Items[3].ImageIndex := 3;
cxicb_NR_Periodo.Properties.Items[3].Value := ´4´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[4].Description := ´5º Bimestre´;
cxicb_NR_Periodo.Properties.Items[4].ImageIndex := 4;
cxicb_NR_Periodo.Properties.Items[4].Value := ´5´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[5].Description := ´6º Bimestre´;
cxicb_NR_Periodo.Properties.Items[5].ImageIndex := 5;
cxicb_NR_Periodo.Properties.Items[5].Value := ´6´;
end
else if cxicb_TP_Periodo.EditValue = ´T´ then
begin
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[0].Description := ´1º Trimestre´;
cxicb_NR_Periodo.Properties.Items[0].ImageIndex := 0;
cxicb_NR_Periodo.Properties.Items[0].Value := ´1´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[1].Description := ´2º Trimestre´;
cxicb_NR_Periodo.Properties.Items[1].ImageIndex := 1;
cxicb_NR_Periodo.Properties.Items[1].Value := ´2´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[2].Description := ´3º Trimestre´;
cxicb_NR_Periodo.Properties.Items[2].ImageIndex := 2;
cxicb_NR_Periodo.Properties.Items[2].Value := ´3´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[3].Description := ´4º Trimestre´;
cxicb_NR_Periodo.Properties.Items[3].ImageIndex := 3;
cxicb_NR_Periodo.Properties.Items[3].Value := ´4´;
end
else if cxicb_TP_Periodo.EditValue = ´Q´ then
begin
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[0].Description := ´1º Quadrimestre´;
cxicb_NR_Periodo.Properties.Items[0].ImageIndex := 0;
cxicb_NR_Periodo.Properties.Items[0].Value := ´1´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[1].Description := ´2º Quadrimestre´;
cxicb_NR_Periodo.Properties.Items[1].ImageIndex := 1;
cxicb_NR_Periodo.Properties.Items[1].Value := ´2´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[2].Description := ´3º Quadrimestre´;
cxicb_NR_Periodo.Properties.Items[2].ImageIndex := 2;
cxicb_NR_Periodo.Properties.Items[2].Value := ´3´;
end
else if cxicb_TP_Periodo.EditValue = ´S´ then
begin
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[0].Description := ´1º Semestre´;
cxicb_NR_Periodo.Properties.Items[0].ImageIndex := 0;
cxicb_NR_Periodo.Properties.Items[0].Value := ´1´;
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[1].Description := ´2º Semestre´;
cxicb_NR_Periodo.Properties.Items[1].ImageIndex := 1;
cxicb_NR_Periodo.Properties.Items[1].Value := ´2´;
end
else if cxicb_TP_Periodo.EditValue = ´A´ then
begin
cxicb_NR_Periodo.Properties.Items.Add;
cxicb_NR_Periodo.Properties.Items[0].Description := ´Exercicio´;
cxicb_NR_Periodo.Properties.Items[0].ImageIndex := 0;
cxicb_NR_Periodo.Properties.Items[0].Value := ´1´;
end;
cxicb_NR_Periodo.ItemIndex := 0;
end;
procedure TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude.cxlcbUnidadeGestoraPropertiesEditValueChanged(
Sender: TObject);
begin
inherited;
adoMasterUnidadesGestoras.Locate(´CD_UNIDADE_GESTORA´,cxlcbUnidadeGestora.EditValue,[]);
end;
procedure TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude.ppSummaryBand10BeforePrint(
Sender: TObject);
begin
inherited;
adoCtb_Relatorios_Assinaturas.Close;
if cxlcbUnidadeGestora.EditValue > 0 then
adoCtb_Relatorios_Assinaturas.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := cxlcbUnidadeGestora.EditValue
else
adoCtb_Relatorios_Assinaturas.Parameters.ParamByName(´CD_UNIDADE_GESTORA´).Value := varContabilidade.iCodUnidadeGestora;
adoCtb_Relatorios_Assinaturas.Parameters.ParamByName(´SG_RELATORIO_ASSINATURA´).Value := varContabilidade.iNr_Tabela;
adoCtb_Relatorios_Assinaturas.Parameters.ParamByName(´DT_RELATORIO_ASSINATURA_INICIAL´).Value := Data(´F´,cxicb_NR_Periodo.EditValue,cxseAno.Value);
adoCtb_Relatorios_Assinaturas.Open;
ppLine109.Visible := False;
ppLine110.Visible := False;
ppLine111.Visible := False;
ppLine112.Visible := False;
if adoCtb_Relatorios_Assinaturas.FieldByName(´NM_RELATORIO_ASSINATURA_01´).AsString <> ´´ then
ppLine109.Visible := True;
if adoCtb_Relatorios_Assinaturas.FieldByName(´NM_RELATORIO_ASSINATURA_02´).AsString <> ´´ then
ppLine110.Visible := True;
if adoCtb_Relatorios_Assinaturas.FieldByName(´NM_RELATORIO_ASSINATURA_04´).AsString <> ´´ then
ppLine111.Visible := True;
if adoCtb_Relatorios_Assinaturas.FieldByName(´NM_RELATORIO_ASSINATURA_03´).AsString <> ´´ then
ppLine112.Visible := True;
end;
initialization
RegisterClass(TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude);
end.
O método que estou utilizando para chamar o relatorio é procedure TFormRelLRFDemonstrativo_ReceitaImpostos_DespesasPropriasSaude.btnImprimirClick(Sender: TObject);
Na parte em q abro as querys está demorando DEMAIS pois são functions dentro do SQL Server...
Todos os opens estão demorando muito!!!!
Pensei em usar THREADS... alguem pode me indicar se devo realmente usar threads ou outra meio para adiantar...
E se devo usar THREADS COMO QUE EU USO! Alguem pode me indicar uma forma???????????????????????????
Obs.: Uso ADO com CURSOR LOCATION clUseClient e CURSORTYPE ctKeyset.
Diegus
Curtir tópico
+ 0
Responder
Posts
25/10/2006
Martins
Não sei se é um caso para Threads, vc não poderia usar mecanismos da sua Base de Dados para preparar todas as informações necessárias, uam view por exemplo para depois montar seu relatório?
Vou dar uma olhada no seus código com mais calma logo mais quando estiver em casa.
boa sorte!!!
Vou dar uma olhada no seus código com mais calma logo mais quando estiver em casa.
boa sorte!!!
Responder
Gostei + 0
02/04/2008
Gustavo_goszard
qual nome do pacote que suporta esses ppCtrls e os demais?
estou precisando deles pois trouxe meus trabalhos co curso para casa e não sei qual o nome do pacote dessas units. Obrigado previamente.
estou precisando deles pois trouxe meus trabalhos co curso para casa e não sei qual o nome do pacote dessas units. Obrigado previamente.
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)