bien resulta que quiero comparar la fecha que tengo registrada en el sistema conla fecha del servidor, y si es menor entonces modifique una columna de pago tardio, pero no logro ahcer que funcione. lo hago de la isguiente manera.
obtengo la fecha del Servidor asi.
WFechaServidor:TDate;
Código Delphi
[-]
procedure TFmodulo.FechaServidor;
var I:Integer;
begin
with Fmodulo.QryTemp do
begin
close;
sql.Clear;
SQL.Add('SELECT CONVERT(VARCHAR(10), GETDATE(), 103) AS [Fecha]');
try
Open;
if (not Eof) then
begin
wfechaservidor:=StrToDate(FieldByname('Fecha').AsString); DecodeDate(Wfechaservidor,anio,Mes,Dia);
if Anio<>0 then
begin
wanioString:=IntToStr(Anio);
end;
end;
except
on E:EOleException do
begin
MessageDlg(Format('Error: %s Codigo: %d', [E.Message, E.ErrorCode]), mtError, [mbOK], 0);
end;
end;
end;
end;
y entonces despues genero 12 recibos en un modulo de cuentas por cobrar y para poder modificar la situacion de cada recibo lo hago de la siguiente manera.
Código Delphi
[-]function tfrmrecibos.CargaMeses(IdContrato:string):string;
var wStatus:string;
WfechaRegistro:TDate;
begin
with fmodulo.QryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from sap_prerecibos');
sql.Add('where nocontrato=:Pnocontrato and fechaPago is null');
Parameters.ParamByName('Pnocontrato').Value:=Idcontrato;
try
Open;
while (not Eof) do
begin
cbb_1.Items.Add(FieldByname('concepto').AsString);
WfechaRegistro:=(FieldByName('fechafinpago').AsDateTime);
if Trunc(WfechaRegistro) < trunc(Fmodulo.WFechaServidor) then wStatus:='S';
begin
with Fmodulo. QryTemporal do
begin
SQL.Clear;
SQL.Add('update sap_prerecibos set interes=status');
SQL.Add('where nocontrato=contrato and FechaPago is null');
Parameters.ParamByName('Pcontrato').Value:=Idcontrato;
Parameters.ParamByName('Pstatus').Value:=Trim(wStatus);
ExecSQL;
end;
end;
Next;
end;
except
on e:eoleException do
begin
end;
end;
end;
end;
alguna sugerencia? de antemano muchas gracias