Fórum Campo Blob Pesquisa e Alteraçao #420055
18/07/2012
0
Alguem puder ajuda agradeço.
Alex Oliveira
Curtir tópico
+ 0Posts
27/07/2012
Wilton Júnior
Gostei + 0
30/07/2012
Alex Oliveira
TABELA DISCRIMINA
CREATE TABLE TB_DISCRIMINA (
DIS_ID INTEGER NOT NULL PRIMARY KEY,
DIS_DESCRICAO VARCHAR(80),
DIS_DISCRIMINACAO BLOB SUB_TYPE 1 SEGMENT SIZE 2000);
Nessa tabela sera salvo a descrição da discriminação e a discriminaçao.
Exemplo
DIS_ID := 1;
DIS_DESCRICAO := SERVIÇOS PRESTADOS;
DIS_DISCRIMINACAO := SERVIÇOS PRESTADOS NO [ANO] CONFORME COMBINADO,
DE ACORDO AO CONTRADO DE Nºxxx56-9, CIENTE EM [DATA];
Observe que [ANO] e [DATA] são variáveis para hora da impressão.
então na hora da impressão o sistema deve identificar [ANO] e [DATA] para ser modificado
pelo ano e data atual. entao a impressão seria o seguinte conforme a data de hoje.
Codigo da Discriminacao : 1
Descricao : SERVIÇOS PRESTADOS
Discriminação : SERVIÇOS PRESTADOS NO 2012 CONFORME COMBINADO,
DE ACORDO AO CONTRADO DE Nºxxx56-9, CIENTE EM 30/07/2012
Obs : será impresso varias discriminaçao + ou - umas 200 a cada operação.
Existe algum meio ou na sql ou no rave ou no delphi para o sistema fazer essa alteraçao na hora da impressao?
Gostei + 0
30/07/2012
Wilton Júnior
ano: formatdatetime(yyyy, date);
ou o SQL:
- year(ano);
- month(mês);
- day(dia);
No link abaixo, explica melhor como usar o código sql:
https://www.devmedia.com.br/funcoes-de-data-no-sql-server/1946
espero ter ajudad
Deus o Abençoe!
Gostei + 0
30/07/2012
William
function FormataObservacao(Texto: string): string;
var
ano, data: string;
i : Integer;
begin
// Verifica e substitui o texto [ANO] pelo ano atual
for i := 0 to Length(Texto) do
begin
if (Texto[i] = [) and (Texto[i + 1] = A) then
begin
Delete(Texto, i, 5);
ano := FormatDateTime(yyyy, date);
Insert(ano, Texto, i);
end;
end;
// Verifica e substitui o texto [DATA] pela data atual
for i := 0 to Length(Texto) do
begin
if (Texto[i] = [) and (Texto[i + 1] = D) then
begin
Delete(Texto, i, 6);
data := FormatDateTime(dd/mm/yyyy, date);
Insert(data, Texto, i);
end;
end;
Result := Texto;
end;
Fiz um teste gerando relatório no FortesReport DelphiXE, coloquei essa função no evento BeforePrint do Band que contém o RLMemo. Antes de carregar a observação no relatório ele modifica a string adicionando a Data e o Ano atual e exclui o [ANO] e [DATA].
Gostei + 0
01/08/2012
Alex Oliveira
Gostei + 0
01/08/2012
Alex Oliveira
segue o select que to usando
select REPLACE(DIS_DISCRIMINACAO,'[MES/ANO]',current_date) from tb_discriminacao, rdb$database
alguem poder ajudar eu agradeço
Gostei + 0
01/08/2012
Alex Oliveira
Obrigado a todos q tentaram....
a soluçao
select REPLACE(DIS_DISCRIMINACAO,'[MES/ANO]',trim(
case LPAD(extract(month from CURRENT_DATE),2,'0')
when 12 then 'DEZEMBRO'
when 11 then 'NOVEMBRO'
when 10 then 'OUTUBRO'
when 09 then 'SETEMBRO'
when 08 then 'AGOSTO'
when 07 then 'JULHO'
when 06 then 'JUNHO'
when 05 then 'MAIO'
when 04 then 'ABRIL'
when 03 then 'MARÇO'
when 02 then 'FEVEREIRO'
when 01 then 'JANEIRO'
end)||'/'||LPAD(extract(year from CURRENT_DATE),4,'0')) from tb_discriminacao, rdb$database
alem de modificar o texto a variavel [MES/ANO] ainda coloca a data por extenso.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)