um relatorio de aniversariantes diferente dos outros
12/08/2004
0
outro caso, preciso passar o conteurdo de um Memo para o relatorio, não estou conseguindo, se alguem puder ajudar com um exemplo ficaria legal
Obrigado
Dpinho
Posts
12/08/2004
Macario
Poste o seu codigo, e diga qual banco usa, e o tipo do campo!
16/08/2004
Dpinho
Esta é a consulta:
procedure TfmAniversariantes.SpeedButton1Click(Sender: TObject);
var
Ano,Mes,Dia:word;
begin
Application.CreateForm(TfmRelDatAniver,fmRelDatAniver);
with fmRelDatAniver do
begin
DecodeDate(Date,ano,mes,dia);
QConsulta.Close;
QConsulta.Params.ParamValues[´DataInicial´] := strtoint(Edit1.Text);
QConsulta.Open;
//Texto:= Memo1.Text;
fmRelDatAniver.QuickRep1.Preview;
end;
end;
Aqui Retornar para o Relatorio:
procedure TfmRelDatAniver.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
VAR
Ano,Mes,Dia:word;
begin
DecodeDate(QConsulta.FieldByName(´DtNasc´).AsFloat,ano,mes,dia);
IF mes = 1 then QRLabel7.caption := ´GENNAIO´;
if mes = 2 then QRLabel7.Caption := ´FEBBRAIO´;
if mes = 3 then QRLabel7.Caption := ´MARZO´;
if mes = 4 then QRLabel7.Caption := ´APRILE´;
if mes = 5 then QRLabel7.Caption := ´MAGGIO´;
if mes = 6 then QRLabel7.Caption := ´GIUGNO´;
if mes = 7 then QRLabel7.Caption := ´LUGLIO´;
if mes = 8 then QRLabel7.Caption := ´AGOSTO´;
if mes = 9 then QRLabel7.Caption := ´SETTEMBRE´;
if mes = 10 then QRLabel7.Caption := ´OTTOBRE´;
if mes = 11 then QRLabel7.Caption := ´NOVEMBRE´;
if mes = 12 then QRLabel7.Caption := ´DICEMBRE´;
// QRLabel4.caption := FormatDateTime(´dd/mm´,QConsulta.FieldByName(´DtNasc´).AsFloat);
// QRMemo1.Caption := fmAniversariantes.Memo1.Text;
end;
Esta funcionando bem, porem esta saindo com dias fora da ordem exemplo dia primeiro do mês sai no final depende do ano
Meu banco é Paradox em delphi 7
17/08/2004
Macario
2-) Isto não está correto:
[b:32ee0aa648][color=red:32ee0aa648]QConsulta.Params.ParamValues[´DataInicial´] := strtoint(Edit1.Text);[/color:32ee0aa648][/b:32ee0aa648]
se o seu campo na tabela for tipo data e estiver no formato DD/MM/AAAA
use assim:
[b:32ee0aa648][color=green:32ee0aa648]QConsulta.Params.ParamValues[´DataInicial´] := strtoDate(Edit1.Text);[/color:32ee0aa648][/b:32ee0aa648]
Espero ter ajudado.
17/08/2004
Dpinho
utilizo a função strtoint porque tenho que passar o numero do mês e não a data
17/08/2004
Jdteichert
- No SELECT coloque o seu campo data desta forma:
EXTRACT( DAY FROM Tabela.DataNasc ) DiaNasc,
EXTRACT( MONTH FROM Tabela.DataNasc ) MesNasc
- Se precisar filtrar o mês na cláusula WHERE:
EXTRACT( MONTH FROM Tabela.DataNasc ) = :MesAniver
- Para ordenar:
ORDER BY DiaNasc, MesNasc
- Nos parâmetros:
ParamByName(´MesAniver´).AsInteger := iMesAniver
Clique aqui para fazer login e interagir na Comunidade :)