Ver Mensaje Individual
  #1  
Antiguo 09-03-2011
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Reputación: 20
oscarac Va por buen camino
Consulta demasiado compleja

Buenos dias
estoy haciendo un sistema contable y el sistema me arroja el mensaje que esta en el titulo
estoy usando Turbo delphi y Access 2003
lo que he podido determinar es que el mensaje me apacere algunos casos en el Locate y otros en el post
alguien sabe pq sucede esto?

adjunto el codigo
Código Delphi [-]
procedure TfrmMayorizacion.AcumulaCostos;
var gn_R1, gn_R2, gn_R3, gn_R4, gn_R5, gn_R6, gn_R7, gn_R8 :String;
    gu_R1, gu_R2, gu_R3, gu_R4, gu_R5, gu_R6, gu_R7, gu_R8 :String;
    sn_R1, sn_R2, sn_R3, sn_R4, sn_R5, sn_R6, sn_R7, sn_R8 ouble;
    su_R1, su_R2, su_R3, su_R4, su_R5, su_R6, su_R7, su_R8 ouble;
    x_r1, _Cuenta :String;
    x_SGN: Integer;
begin
  gn_R1 := 'nr1_' + Llenar (IntToStr(iMes),2);
  gn_R2 := 'nr2_' + Llenar (IntToStr(iMes),2);
  gn_R3 := 'nr3_' + Llenar (IntToStr(iMes),2);
  gn_R4 := 'nr4_' + Llenar (IntToStr(iMes),2);
  gn_R5 := 'nr5_' + Llenar (IntToStr(iMes),2);
  gn_R6 := 'nr6_' + Llenar (IntToStr(iMes),2);
  gn_R7 := 'nr7_' + Llenar (IntToStr(iMes),2);
  gn_R8 := 'nr8_' + Llenar (IntToStr(iMes),2);
  gu_R1 := 'ur1_' + Llenar (IntToStr(iMes),2);
  gu_R2 := 'ur2_' + Llenar (IntToStr(iMes),2);
  gu_R3 := 'ur3_' + Llenar (IntToStr(iMes),2);
  gu_R4 := 'ur4_' + Llenar (IntToStr(iMes),2);
  gu_R5 := 'ur5_' + Llenar (IntToStr(iMes),2);
  gu_R6 := 'ur6_' + Llenar (IntToStr(iMes),2);
  gu_R7 := 'ur7_' + Llenar (IntToStr(iMes),2);
  gu_R8 := 'ur8_' + Llenar (IntToStr(iMes),2);
  sn_R1 := 0;
  sn_R2 := 0;
  sn_R3 := 0;
  sn_R4 := 0;
  sn_R5 := 0;
  sn_R6 := 0;
  sn_R7 := 0;
  sn_R8 := 0;
  su_R1 := 0;
  su_R2 := 0;
  su_R3 := 0;
  su_R4 := 0;
  su_R5 := 0;
  su_R6 := 0;
  su_R7 := 0;
  su_R8 := 0;
  x_SGN := 0;
  tblCuentaGasto.Open;
  tblCuentaArea.Open;
  qryMovimientoContable.First;
  while not qryMovimientoContable.eof do
  begin
    _Cuenta := qryMovimientoContableCcta1.AsString;
    x_R1 := Copy(qryMovimientoContableCuenta.AsString,1,2);
    if Pos(x_r1, c_R1+' '+c_R2+' '+c_R3+' '+c_R4+' '+c_R5+' '+c_R6+' '+c_R7+' '+c_R8) > 0 then
    begin
      if Pos(qryMovimientoContableDh.AsString, '1DI+') > 0 then
        x_SGN := 1
      Else
        x_SGN := -1;
      end;
    if x_r1 = c_R1 then
      begin
        sn_R1 := sn_R1 + (x_SGN * qryMovimientoContablen_imp.Value);
        su_R1 := su_R1 + (x_SGN * qryMovimientoContableu_imp.Value);
      end;
    if x_r1 = c_R2 then
      begin
        sn_R2 := sn_R2 + (x_SGN * qryMovimientoContablen_imp.Value);
        su_R2 := su_R2 + (x_SGN * qryMovimientoContableu_imp.Value);
      end;
    if x_r1 = c_R3 then
      begin
        sn_R3 := sn_R3 + (x_SGN * qryMovimientoContablen_imp.Value);
        su_R3 := su_R3 + (x_SGN * qryMovimientoContableu_imp.Value);
      end;
    if x_r1 = c_R4 then
      begin
        sn_R4 := sn_R4 + (x_SGN * qryMovimientoContablen_imp.Value);
        su_R4 := su_R4 + (x_SGN * qryMovimientoContableu_imp.Value);
      end;
    if x_r1 = c_R5 then
      begin
        sn_R5 := sn_R5 + (x_SGN * qryMovimientoContablen_imp.Value);
        su_R5 := su_R5 + (x_SGN * qryMovimientoContableu_imp.Value);
      end;
    if x_r1 = c_R6 then
      begin
        sn_R6 := sn_R6 + (x_SGN * qryMovimientoContablen_imp.Value);
        su_R6 := su_R6 + (x_SGN * qryMovimientoContableu_imp.Value);
      end;
    if x_r1 = c_R7 then
      begin
        sn_R7 := sn_R7 + (x_SGN * qryMovimientoContablen_imp.Value);
        su_R7 := su_R7 + (x_SGN * qryMovimientoContableu_imp.Value);
      end;
    if x_r1 = c_R8 then
      begin
        sn_R8 := sn_R8 + (x_SGN * qryMovimientoContablen_imp.Value);
        su_R8 := su_R8 + (x_SGN * qryMovimientoContableu_imp.Value);
      end;
    qryMovimientoContable.Next;
  end;
  if not tblCuentaGasto.Locate('Empresa;Periodo;Cuenta', VarArrayOf([dmGlobal.g_CodigoEmpresa, Copy(dmGlobal.g_Periodo,1,4), _Cuenta]), []) then
    Begin
      tblCuentaGasto.Append;
      tblCuentaGastoEmpresa.Value := qryMovimientoContableEmpresa.AsString;
      tblCuentaGastoPeriodo.Value := Copy (dmGlobal.g_Periodo,1,4);
      tblCuentaGastoCuenta.Value := _Cuenta;
    End;
    tblCuentaGasto.Edit;
    tblCuentaGasto.FieldByName(gn_R1).Value := tblCuentaGasto.FieldByName(gn_R1).Value + sn_R1;
    tblCuentaGasto.FieldByName(gn_R2).Value := tblCuentaGasto.FieldByName(gn_R2).Value + sn_R2;
    tblCuentaGasto.FieldByName(gn_R3).Value := tblCuentaGasto.FieldByName(gn_R3).Value + sn_R3;
    tblCuentaGasto.FieldByName(gn_R4).Value := tblCuentaGasto.FieldByName(gn_R4).Value + sn_R4;
    tblCuentaGasto.FieldByName(gn_R5).Value := tblCuentaGasto.FieldByName(gn_R5).Value + sn_R5;
    tblCuentaGasto.FieldByName(gn_R6).Value := tblCuentaGasto.FieldByName(gn_R6).Value + sn_R6;
    tblCuentaGasto.FieldByName(gn_R7).Value := tblCuentaGasto.FieldByName(gn_R7).Value + sn_R7;
    tblCuentaGasto.FieldByName(gn_R8).Value := tblCuentaGasto.FieldByName(gn_R8).Value + sn_R8;
    tblCuentaGasto.FieldByName(gu_R1).Value := tblCuentaGasto.FieldByName(gn_R1).Value + sn_R1;
    tblCuentaGasto.FieldByName(gu_R2).Value := tblCuentaGasto.FieldByName(gu_R2).Value + sn_R2;
    tblCuentaGasto.FieldByName(gu_R3).Value := tblCuentaGasto.FieldByName(gu_R3).Value + sn_R3;
    tblCuentaGasto.FieldByName(gu_R4).Value := tblCuentaGasto.FieldByName(gu_R4).Value + sn_R4;
    tblCuentaGasto.FieldByName(gu_R5).Value := tblCuentaGasto.FieldByName(gu_R5).Value + sn_R5;
    tblCuentaGasto.FieldByName(gu_R6).Value := tblCuentaGasto.FieldByName(gu_R6).Value + sn_R6;
    tblCuentaGasto.FieldByName(gu_R7).Value := tblCuentaGasto.FieldByName(gu_R7).Value + sn_R7;
    tblCuentaGasto.FieldByName(gu_R8).Value := tblCuentaGasto.FieldByName(gu_R8).Value + sn_R8;
    tblCuentaGasto.Post;
  tblCuentaGasto.Close;
  tblCuentaArea.Close;
  qryMovimientoContable.Close;
end;
Responder Con Cita