Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ab3f3ed8

Von Jan Büren vor mehr als 10 Jahren hinzugefügt

  • ID ab3f3ed87a12c70d9538b1a07fc0e4659dc43d28
  • Vorgänger 0dc0e521
  • Nachfolger be418943

rp-patch

Unterschiede anzeigen:

SL/RP.pm
884 884
  my $glwhere       = '';
885 885
  my $glsumwhere    = '';
886 886
  my $tofrom;
887
  my ($fromdate, $todate);
887
  my ($fromdate, $todate, $hotfix_query);
888 888

  
889 889
  if ($form->{fromdate} || $form->{todate}) {
890 890
    if ($form->{fromdate}) {
......
921 921
    $where .= $tofrom . " AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL)";
922 922
    $saldowhere .= $glsaldowhere . " AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL)";
923 923
    $sumwhere .= $glsumwhere . " AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL)";
924

  
925
    # get all entries before fromdate, which are not yet fetched
926
    # TODO dpt_where_without_arapgl and project
927
    $hotfix_query = qq|SELECT c.accno, c.description, c.category, SUM(ac.amount) AS amount
928
                       FROM acc_trans ac JOIN chart c ON (c.id = ac.chart_id) WHERE 1 = 1 AND (ac.transdate <= $fromdate)
929
                        AND (ac.transdate >= (SELECT date_trunc('YEAR', | . $fromdate . qq|::date)))
930
                       AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL)
931
                       AND c.accno NOT IN (SELECT c.accno FROM acc_trans ac JOIN chart c ON (c.id = ac.chart_id) WHERE 1 = 1 AND (ac.transdate >= $fromdate) AND (ac.transdate <= $todate)
932
                       AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL))
933
                       GROUP BY c.accno, c.description, c.category ORDER BY accno|;
924 934
  }
925 935

  
926 936
  $query = qq|
......
978 988
  }
979 989
  $sth->finish;
980 990

  
991
  if (! $form->{method} eq "cash") {
992
    $sth = prepare_execute_query($form, $dbh, $hotfix_query);
993
    while ($ref = $sth->fetchrow_hashref("NAME_lc")) {
994
      $trb{ $ref->{accno} }{description} = $ref->{description};
995
      $trb{ $ref->{accno} }{charttype}   = 'A';
996
      $trb{ $ref->{accno} }{category}    = $ref->{category};
997
      $trb{ $ref->{accno} }{amount} += $ref->{amount};
998
    }
999
    $sth->finish;
1000
  }
1001

  
981 1002
  # prepare query for each account
982 1003
  my ($q_drcr, $drcr, $q_project_drcr, $project_drcr);
983 1004

  

Auch abrufbar als: Unified diff