Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c184bce3

Von Philip Reetz vor mehr als 15 Jahren hinzugefügt

  • ID c184bce36ecd18049541dccaaa38d212fb6170cf
  • Vorgänger 747bdb80
  • Nachfolger e05d94ad

SuSa angepasst, so dass auch bei EUR korrekte Werte berechnet werden

Unterschiede anzeigen:

SL/RP.pm
688 688
          FROM acc_trans ac
689 689
          LEFT JOIN chart c ON (ac.chart_id = c.id)
690 690
          $dpt_join
691
          WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.ob_transaction $acc_cash_where
691
          WHERE ((select date_trunc('year', ac.transdate::date)) = (select date_trunc('year', ?::date))) AND ac.ob_transaction
692 692
            $dpt_where
693 693
            $project
694 694
          GROUP BY c.accno, c.category, c.description |;
......
747 747

  
748 748
  if ($form->{fromdate} || $form->{todate}) {
749 749
    if ($form->{fromdate}) {
750
      my $fromdate = conv_dateq($form->{fromdate});
750
      $fromdate = conv_dateq($form->{fromdate});
751 751
      $tofrom        .= " AND (ac.transdate >= $fromdate)";
752
      $subwhere      .= " AND (transdate >= $fromdate)";
753
      $sumsubwhere   .= " AND (transdate >= (select date_trunc('year', date $fromdate))) ";
754
      $saldosubwhere .= " AND transdate>=(select date_trunc('year', date $fromdate))  ";
752
      $subwhere      .= " AND (ac.transdate >= $fromdate)";
753
      $sumsubwhere   .= " AND (ac.transdate >= (select date_trunc('year', date $fromdate))) ";
754
      $saldosubwhere .= " AND (ac,transdate>=(select date_trunc('year', date $fromdate)))  ";
755 755
      $invwhere      .= " AND (a.transdate >= $fromdate)";
756 756
      $glsaldowhere  .= " AND ac.transdate>=(select date_trunc('year', date $fromdate)) ";
757 757
      $glwhere        = " AND (ac.transdate >= $fromdate)";
758 758
      $glsumwhere     = " AND (ac.transdate >= (select date_trunc('year', date $fromdate))) ";
759 759
    }
760 760
    if ($form->{todate}) {
761
      my $todate = conv_dateq($form->{todate});
761
      $todate = conv_dateq($form->{todate});
762 762
      $tofrom        .= " AND (ac.transdate <= $todate)";
763 763
      $invwhere      .= " AND (a.transdate <= $todate)";
764
      $saldosubwhere .= " AND (transdate <= $todate)";
765
      $sumsubwhere   .= " AND (transdate <= $todate)";
766
      $subwhere      .= " AND (transdate <= $todate)";
764
      $saldosubwhere .= " AND (ac.transdate <= $todate)";
765
      $sumsubwhere   .= " AND (ac.transdate <= $todate)";
766
      $subwhere      .= " AND (ac.transdate <= $todate)";
767 767
      $glwhere       .= " AND (ac.transdate <= $todate)";
768 768
      $glsumwhere    .= " AND (ac.transdate <= $todate) ";
769 769
      $glsaldowhere  .= " AND (ac.transdate <= $todate) ";
......
772 772

  
773 773
  if ($form->{method} eq "cash") {
774 774
    $where .=
775
      qq| AND ((ac.trans_id IN (SELECT id from ar) AND
776
                ac.trans_id IN
777
                  (
778
                    SELECT trans_id
779
                    FROM acc_trans
780
                    JOIN chart ON (chart_id = id)
781
                    WHERE (link LIKE '%AR_paid%')
782
                      $subwhere
783
                  )
784
               )
785
               OR
786
               (ac.trans_id in (SELECT id from ap) AND
787
                ac.trans_id IN
788
                  (
789
                    SELECT trans_id
790
                    FROM acc_trans
791
                    JOIN chart ON (chart_id = id)
792
                    WHERE (link LIKE '%AP_paid%')
793
                      $subwhere
794
                  )
795
               )
796
               OR
797
               (ac.trans_id in (SELECT id from gl)
798
                $glwhere)
799
              )|;
800
    $saldowhere .=
801
      qq| AND ((ac.trans_id IN (SELECT id from ar) AND
802
                ac.trans_id IN
803
                  (
804
                    SELECT trans_id
805
                    FROM acc_trans
806
                    JOIN chart ON (chart_id = id)
807
                    WHERE (link LIKE '%AR_paid%')
808
                      $saldosubwhere
809
                  )
810
               )
811
               OR
812
               (ac.trans_id in (SELECT id from ap) AND
813
                ac.trans_id IN
814
                  (
815
                    SELECT trans_id
816
                    FROM acc_trans
817
                    JOIN chart ON (chart_id = id)
818
                    WHERE (link LIKE '%AP_paid%')
819
                      $saldosubwhere
820
                  )
821
               )
822
               OR
823
               (ac.trans_id in (SELECT id from gl)
824
                $glsaldowhere)
825
              )|;
826
    $sumwhere .=
827
      qq| AND ((ac.trans_id IN (SELECT id from ar) AND
828
                ac.trans_id IN
829
                  (
830
                    SELECT trans_id
831
                    FROM acc_trans
832
                    JOIN chart ON (chart_id = id)
833
                    WHERE (link LIKE '%AR_paid%')
834
                      $sumsubwhere
835
                  )
836
               )
837
               OR
838
               (ac.trans_id in (SELECT id from ap) AND
839
                ac.trans_id IN
840
                  (
841
                    SELECT trans_id
842
                    FROM acc_trans
843
                    JOIN chart ON (chart_id = id)
844
                    WHERE (link LIKE '%AP_paid%')
845
                      $sumsubwhere
846
                  )
847
               )
848
               OR
849
               (ac.trans_id in (SELECT id from gl)
850
                $glsumwhere)
851
              )|;
852

  
775
      qq| AND(ac.trans_id IN (SELECT id FROM ar WHERE datepaid>= $fromdate AND datepaid<= $todate UNION SELECT id FROM ap WHERE datepaid>= $fromdate AND datepaid<= $todate UNION SELECT id FROM gl WHERE transdate>= $fromdate AND transdate<= $todate)) AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL) |;
776
    $saldowhere .= qq| AND(ac.trans_id IN (SELECT id FROM ar WHERE datepaid>= $fromdate AND datepaid<= $todate UNION SELECT id FROM ap WHERE datepaid>= $fromdate AND datepaid<= $todate UNION SELECT id FROM gl WHERE transdate>= $fromdate AND transdate<= $todate))  AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL) |;
777
      
778
    $sumwhere .= qq| AND(ac.trans_id IN (SELECT id FROM ar WHERE datepaid>= $fromdate AND datepaid<= $todate UNION SELECT id FROM ap WHERE datepaid>= $fromdate AND datepaid<= $todate UNION SELECT id FROM gl WHERE transdate>= $fromdate AND transdate<= $todate)) AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL) |;
853 779
  } else {
854 780
    $where .= $tofrom . " AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL)";
855 781
    $saldowhere .= $glsaldowhere . " AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL)";
......
1108 1034
          $ref->{soll_saldo} = $form->round_amount(($ref->{haben_saldo} *- 1), 2);
1109 1035
          $ref->{haben_saldo} = 0;
1110 1036
        }
1111
      } elsif ($ref->{soll_saldo} != 0) {
1037
      } else {
1112 1038
        $ref->{soll_saldo} = $ref->{soll_saldo} - $ref->{beginning_balance};
1113 1039
        if ($ref->{soll_saldo} < 0) {
1114 1040
          $ref->{haben_saldo} = $form->round_amount(($ref->{soll_saldo} * -1), 2);

Auch abrufbar als: Unified diff