Tema: Vistas
Ver Mensaje Individual
  #3  
Antiguo 07-04-2004
Edu Rod Edu Rod is offline
Miembro
 
Registrado: jun 2003
Ubicación: Mexico
Posts: 13
Reputación: 0
Edu Rod Va por buen camino
Ok aqui el codigo

Primero se graba la factura y en el after post va lo siguiente.

procedure TfrmContado.qryContadoAfterPost(DataSet: TDataSet);
begin
inherited;
DM.DB.ApplyUpdates([qryContado]);
z := qryContadoIDCLIENTE.AsInteger;
y := qryContadoIDAUTO.AsInteger;
end;

Despues al momento de imprimir hago lo siguiente

procedure TfrmContado.btnImprimirClick(Sender: TObject);
begin
inherited;
if (Application.MessageBox('Desea Imprimir el Contrato?', 'Confirmar', MB_YESNO) = IDYES) then
begin
frmreportes := Tfrmreportes.Create(self);
qryContado.Close; // este query se conecta a la tabla ventas//
qryContado.Open;

***este es otro query (aunque llamado igualque esta en la forma de reportes) el cual se conecta a la vista******

frmReportes.qryContado.ParamByName('idcliente').AsInteger := z;
frmReportes.qryContado.ParamByName('idauto').AsInteger := y;
frmReportes.qryContado.Open;
frmreportes.repContado1.Print;
frmreportes.repContado2.Print;
frmreportes.repContado3.Print;
end;
end;

el query de la vista en la sentencia sql tiene:
select * from VW_Contado where idcliente =:z and idauto =:y

el query de la tabla en la sentencia sql tiene:
select * from ventas


Gracias por la ayuda
__________________
Gracias a Todos Por su ayuda..
"Hoy por mi mañana por ti"
Responder Con Cita