Ver Mensaje Individual
  #3  
Antiguo 05-09-2011
juanch_mc juanch_mc is offline
Registrado
 
Registrado: may 2010
Posts: 2
Reputación: 0
juanch_mc Va por buen camino
Código Delphi [-]
tiporegdat= record
              clave:tipo_clave;
              id_cuenta:string[10];
              fecha_oper:string[10];
              fecha_asiento:string[10];
              hora_asiento:string[13];
              tipo_op:string[2];
              descripcion:string[25];
              debe:real;
              haber:real;
              saldo:real;
              enlace:tipo_enlace;
             end;

tiporegdatX= record
              clave:tipo_clave;
              id_cuenta:string[10];
              fecha_oper:string[10];
              fecha_asiento:string[10];
              hora_asiento:string[13];
              tipo_op:string[2];
              descripcion:string[25];
              debe:real;
              haber:real;
              saldo:real;
              enlace:tipo_enlace;
             end;

tiporegcontrol= record
                  cont_operac:integer;
                  primero:tipo_pos;
                  ultimo:tipo_pos;
                  borrados:tipo_pos;
                end;

tiporegcontrolX= record
                  cont_operac:integer;
                  primero:tipo_pos;
                  ultimo:tipo_pos;
                  borrados:tipo_pos;
                end;

archdat= file of tiporegdat;
archcontrol= file of tiporegcontrol;
archdatx= file of tiporegdatx;
archcontrolx= file of tiporegcontrolx;

tipo_ME= record
           D:archdat;
           C:archcontrol;
         end;

tipo_MEAUX=record
              DX:archdatx;
              CX:archcontrolx;
            end;

Este es el procedimiento que tengo hasta ahora:

Código Delphi [-]
Procedure Saldos_afecha(var me:tipo_me; var meX:tipo_meaux; fecha:string);
var
  RD, RAUX, R_AUX_2:tiporegdat;
  RC:tiporegcontrol;
  RDAUX:tiporegdatx;
  pos:tipo_pos;
  saldo:real;
  cuenta:string;

  begin
     if (not estructura_vacia(me))
     then
        begin
          seek(me.C,0);
          read(me.C,RC);
          pos:=RC.primero;
          saldo:=0;
          while (pos<>null) do
          begin
              seek(me.D,pos);
              read(me.D,RD);
              if (RD.fecha_oper<=fecha)
              then
                begin
                  cuenta:=RD.id_cuenta;
                  seek(me.D,rd.enlace);
                  read(me.d,RAUX);
                  saldo:=saldo+(rd.haber-rd.debe);
                  if (rd.id_cuenta=RAUX.id_cuenta)
                  then
                    begin
                      while (RD.id_cuenta=RAUX.id_cuenta) do
                        if (RAUX.fecha_oper<=fecha)
                        then
                          begin
                            saldo:=saldo+(RAUX.haber-RAUX.debe);
                            seek(me.D,RAUX.enlace);
                            read(me.D,RAUX);
                          end;
                      RDAUX.id_cuenta:=RD.id_cuenta;
                      RDAUX.saldo:=saldo;
                      insertarX(meX,RDAUX);
                    end
                  else
                    begin
                      RDAUX.id_cuenta:=RD.id_cuenta;
                      RDAUX.saldo:=saldo;
                      insertarX(meX,RDAUX);
                      seek(me.D,RDAUX.enlace);
                      read(me.D,RD);
                    end;
                end //if (RD.fecha_oper<=fecha)
              else
                begin
                   seek(me.D,rd.enlace);
                   read(me.D,RD);
                end;
          end // del while (pos<>null) do
        end //del estructura vacia
     else
       showmessage('LA ESTRUCTURA ESTA VACIA');
  END;
Recién lo termino de tipear, tengo que probarlo, pero se los dejo a ver si alguien le encuentra algún error (seguro hay miles).

Espero que la info que agregue mas arriba sea de ayuda para entenderlo.

Muchas gracias!!!

Última edición por ecfisa fecha: 06-09-2011 a las 10:46:09. Razón: Etiquetas [DELPHI] [/DELPHI]
Responder Con Cita