Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Firebird e Interbase
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 06-03-2007
Avatar de CarlosHernandez
CarlosHernandez CarlosHernandez is offline
Miembro
 
Registrado: oct 2003
Posts: 139
Poder: 23
CarlosHernandez Va por buen camino
codigo

la cuestion es la siguiente, yo con este codigo realizo la union de varios campos, de una tabla de personal, y otra de horas, validaqndo todo, y haciendo una validacion solo para que me tome 1 entrada y ultima salida por dia, todo el mes para imprimirlo en un reporte, y el union lo uso para pasar el registro que no este en la tabla hora ejmeplo, un sabado que no tenga asistencia, lo pone como registro vacio, para vizualizarlo en el reporte, y se vean los 31 dias del mes. ah tambien tengo fotos dentro de la bases de datos


Código Delphi [-]
var
op,b,boton:integer;
nombref:PChar;
begin


               if RadioButton1.Checked=true then op:=1;   //diario


                     case op of


                     1:begin


     b:=0;
with tabla.IBQuerypersonal do begin     //*-966222

SQL.Clear;
Close;                                 //                                    // and status='+QuotedStr('Activo')+'                                     //                           //
sql.Add('select * from personal where (  Ubicacion='+QuotedStr('CIRCUITO DE TRABAJO')+' or 
Ubicacion='+QuotedStr('DEPARTAMENTO1')+'  ) and status='+QuotedStr('Activo')+'  
and ( modcargo='+QuotedStr('Fijo')+'  or modcargo='+QuotedStr('Contratado')+'  or 
modcargo='+QuotedStr('TITULAR')+'  or modcargo='+QuotedStr('CONTRATADO')+') 
order by nombre asc');
Prepare;
open;


 while not eof do      begin// e aqui el problema cuando pongo esto y se hace en un ciclo de 120 registro aproximado







 ////////////////
 DataSource1.DataSet:=tabla.IBQHorasrep2;
dINI := DateTimePicker1.Date;
Dfin := DateTimePicker2.Date;
nDATO := (dINI + strtofloat('20'));
nDIAS := Trunc(dFIN - dINI);

 with Tabla.IBQHorasrep2 do begin
   sql.Clear;
   Close;

   FOR I := 0 TO nDIAS DO
     BEGIN
       nDATO  := (dINI + STRTOFLOAT(INTTOSTR(I)));
       dFECHA := FLOATTODATETIME(nDATO);
       cFECHA := FormatDateTime('mm/dd/yyyy', dFECHA);
      // SHOWMESSAGE(cFECHA);
//       S := FormatDateTime('dddd, mmmm, yyyy, hh:mm AM/PM');

       SQL.Add('select min(h.he),max(h.hs),CAST('+QuotedStr(cFECHA)+' AS DATE) 
      F1,p.nombre,p.apellido,p.cedula,h.fecha');
       SQL.Add('from personal p left join horas h on h.cedula=p.cedula and h.fecha='+QuotedStr(cFECHA)+'');
       SQL.Add('where p.cedula = arcedula and p.status ='+QuotedStr('Activo')+'');
       SQL.Add('group by p.cedula, p.nombre, p.apellido,h.fecha,3'); //
       IF I < nDIAS THEN
       BEGIN
          SQL.Add(' UNION ');
       END
       ELSE
        BEGIN
          SQL.Add(' order by 3,1 ');
       END


     END;


   Prepare;

   ParamByName('parcedula').AsString:=tabla.IBQuerypersonalCEDULA.AsString;

   
     Open;
 end;




////////////////   end;


//*****ver foto

if tabla.IBQuerypersonalFOTO.IsNull then begin
Image1.Picture:=nil;
end else  begin
  if tabla.IBQuerypersonalFORMATOFOTO.AsString ='BMP' then
  image1.Picture.Graphic:=TBitmap.Create

  else if tabla.IBQuerypersonalFORMATOFOTO.AsString ='JPG' then
 Image1.Picture.Graphic:=TJpegImage.Create


  else

  exit;
  m:=tabla.IBQuerypersonal.CreateBlobStream(tabla.IBQuerypersonalFOTO,bmread);
  Image1.Picture.Graphic.LoadFromStream(m);
  m.Free;

    end;
          //********* ver foto





     b:=b+1;
        label4.Caption:= inttostr(b);



   Boton := Application.MessageBox ('¿Está Seguro que Desea Imprimir este registro?',
                              'Print',MB_YESNO+MB_ICONQUESTION);
   If Boton = ID_YES Then   begin
   //impresion

       form20.QRLabel19.Caption:=DBEdit4.Text;  //ubicacion

form20.QRLabel2.Caption:=DBEdit1.Text;//nombre
form20.QRLabel3.Caption:=DBEdit3.Text;  //apellido
form20.QRLabel5.Caption:=DBEdit2.Text; //cargo

form20.QRLabel4.Caption:=tabla.IBQuerypersonalCEDULA.AsString;    //cedula
Form20.QuickRep1.Prepare;


 
      form20.QuickRep1.Print;
      //impresion


 
 
 end
   Else  begin
   end;




     tabla.IBQuerypersonal.next;
      end;
      tabla.IBQuerypersonal.first;


     end; //*-966222






             end;//del case


    end;
    end;/////////////////////

este codigo da perfecto, pero cuando lo ejecuto en un while do para que se haga 120 veces obvio que consume mucha memoria
__________________
begin
[email protected]
end;

Última edición por CarlosHernandez fecha: 06-03-2007 a las 20:56:59.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Me aparece el error "Insufficient memory for this operation." ilichhernandez Varios 5 23-07-2010 18:48:16
Error :Insufficient memory for this operation Alfredo Varios 6 22-12-2004 21:09:30
Juego Memory Xema OOP 1 16-09-2004 13:59:24
insificient memory fabriciof Conexión con bases de datos 1 26-04-2004 20:03:29
como evitar el error: insufficient memory for this operatiion click Varios 2 10-11-2003 07:03:11


La franja horaria es GMT +2. Ahora son las 18:35:44.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi