Ver Mensaje Individual
  #3  
Antiguo 24-08-2010
shany shany is offline
Registrado
 
Registrado: ago 2010
Posts: 9
Reputación: 0
shany Va por buen camino
ok aqui va lo que hice

Espero se entienda, muchas gracias por la atencion.

procedure TFMovimientos.SpBtnAreasClick(Sender: TObject);
var
FAgregarAreas :TFAgregarAreas;
begin
try
FAgregarAreas := TFAgregarAreas.Create(Self);
with DMHelpDesk do
begin
FAgregarAreas.EFolioLetra.Text:=pFIBDSViewReportesFOLIO.value + pFIBDSViewReportesIDLETRA.value;
pFIBDSReportesAreas.active:=false;
pFIBDSReportesAreas.Params[0].Value:=pFIBDSRepAreaEdoIDREPORTE.value;//pFIBDSReportesIDREPORTE.Value;
pFIBDSReportesAreas.active:=true;
pFIBDSReportes.Active:=FALSE;
pFIBDSReportes.Params[0].Value:=pFIBDSViewReportesFOLIO.value;//******activo el dataset
pFIBDSReportes.Active:=TRUE;
FAgregarAreas.idreporte:=pFIBDSRepAreaEdoIDREPORTE.value
end;
FAgregarAreas.ShowModal;
finally
FAgregarAreas.Free;
end;
end;


procedure TFAgregarAreas.SpBtnAceptarClick(Sender: TObject);
begin
with DMHelpDesk do
begin
if(pFIBDSReportesAreas.STATE<>dsinsert)then //****este es el dataset que me trae problemas con los combos lookup
begin
pFIBDSReportesareas.append;//y revalido que se ponga en insert otra vez porq tan solo con dar un click
end; //en el combo se quita el estado de append que puse al inicio, sin tener eventos en ellos.

pFIBDSReportesAreasIDAREA.value:=pFIBDSAreasIDAREA.value;
pFIBDSReportesAreasIDSERVICIO.value:=pFIBDSIdServicioAreaIDSERVICIO.value;

try
begin
If not pFIBDSReportesAreas.IsEmpty then
begin
pFIBDSReportesAreas.Post;
if(pFIBDSReportes.STATE<>dsedit)then
begin
pFIBDSReportes.edit; //***aqui intento poner el dataset en edicion y sigue en insert
end;

pFIBDSReportes.Post;
DMMov.pFIBTMov.CommitRetaining;
end;
end;
except
pFIBDSReportesAreas.Cancel;
pFIBDSReportes.cancel;
DMMov.pFIBTMov.RollbackRetaining;
Application.MessageBox('Ha ocurrido un error con el registro'#13'Favor de verificar la información introducida','Error',MB_OK+MB_ICONERROR);
end;




procedure TDMHelpDesk.pFIBDSReportesAreasBeforePost(DataSet: TDataSet);
begin
with DMHelpDesk do
begin
if pFIBDSReportesAreasIDAREA.IsNull then
begin
Application.MessageBox('Debe Seleccionar el area','Error',MB_OK+MB_ICONERROR);
exit;
end
else
if pFIBDSReportesAreasIDSERVICIO.IsNull then
begin
Application.MessageBox('Debe Seleccionar el servicio','Error',MB_OK+MB_ICONERROR);
exit;
end;
//OBT RA
pFIBDSGet_IdRA.active:=true;
pFIBDSReportesAreasIDRA.value:=pFIBDSGet_IdRAIDRA.value;
pFIBDSGet_IdRA.active:=false;
pFIBDSReportesAreasIDREPORTE.value:=pFIBDSReportesIDREPORTE.value;
pFIBDSReportesAreasESTADO.value:='R';
pFIBDSReportesAreasFASIGNADO.Value:=now;
//update
pFIBDSReportes.Edit; /*******esta es la parte donde trato de poner el modo y me pone insert
pFIBDSReportesESTADO.value:='P';
pFIBDSReportesFECHAAREASERV.value:=now;
end;
end;

//este es el unico evento que tengo para el dataset problema de reportes pero no creo que tnga nada de malo
procedure TDMHelpDesk.pFIBDSReportesCalcFields(DataSet: TDataSet);
begin
if pFIBDSReportesESTADO.value = 'R' then
pFIBDSReportesCCEstado.Value:= 'R - Recibido'
else
if pFIBDSReportesESTADO.value = 'P' then
pFIBDSReportesCCEstado.Value:= 'P - Proceso'
else
if pFIBDSReportesESTADO.value = 'T' then
pFIBDSReportesCCEstado.Value:= 'T - Terminado'
else
if pFIBDSReportesESTADO.value = 'C' then
pFIBDSReportesCCEstado.Value:= 'C - Concluido';
end;
Responder Con Cita