Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 750ac970

Von Sven Schöling vor mehr als 12 Jahren hinzugefügt

  • ID 750ac970f34b91bea202a177f9bd07e77476049d
  • Vorgänger d1123673
  • Nachfolger 257c6678

gl::form_footer auf template umgeschrieben.

Unterschiede anzeigen:

bin/mozilla/gl.pl
897 897
}
898 898

  
899 899
sub form_footer {
900
  $main::lxdebug->enter_sub();
901

  
902
  $main::auth->assert('general_ledger');
903

  
904
  my $form     = $main::form;
905
  my %myconfig = %main::myconfig;
906
  my $locale   = $main::locale;
907
  my $cgi      = $::request->{cgi};
908

  
909
  my $follow_ups_block;
910
  if ($form->{id}) {
911
    my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
912

  
913
    if (@{ $follow_ups} ) {
914
      my $num_due       = sum map { $_->{due} * 1 } @{ $follow_ups };
915
      $follow_ups_block = qq|<p>| . $locale->text("There are #1 unfinished follow-ups of which #2 are due.", scalar @{ $follow_ups }, $num_due) . qq|</p>|;
916
    }
917
  }
918

  
919
  my ($dec) = ($form->{totaldebit} =~ /\.(\d+)/);
920
  $dec = length $dec;
921
  my $decimalplaces = ($dec > 2) ? $dec : 2;
922
  my $radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
923

  
924
  map {
925
    $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2, "&nbsp;")
926
  } qw(totaldebit totalcredit);
927

  
928
  print qq|
929
    <tr class=listtotal>
930
    <th colspan="3" align=right class=listtotal> $form->{totaldebit}</th>
931
    <th align=right class=listtotal> $form->{totalcredit}</th>
932
    <td colspan=6></td>
933
    </tr>
934
  </table>
935
  </td>
936
  </tr>
937
</table>
938

  
939
<input name=callback type=hidden value="$form->{callback}">
940

  
941
$follow_ups_block
942

  
943
<br>
944
|;
945

  
946
  my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
947
  my $closedto  = $form->datetonum($form->{closedto},  \%myconfig);
948

  
949
  if ($form->{id}) {
950

  
951
    if (!$form->{storno}) {
952
      print qq|<input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|">|;
953
    }
954

  
955
    # Löschen und Ändern von Buchungen nicht mehr möglich (GoB) nur am selben Tag möglich
956
    if (!$form->{locked} && $radieren) {
957
      print qq|
958
        <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|" accesskey="b">
959
        <input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|">|;
960
    }
961

  
962
    print qq|
963
        <input class=submit type=submit name=action id=update_button value="| . $locale->text('Update') . qq|">
964
        <input type="button" class="submit" onclick="follow_up_window()" value="|
965
      . $locale->text('Follow-Up')
966
      . qq|"> |;
900
  $::lxdebug->enter_sub;
901
  $::auth->assert('general_ledger');
967 902

  
968
  } else {
969
    if ($form->{draft_id}) {
970
      my $remove_draft_checked = $form->{remove_draft} ? 'checked' : '';
971
      print qq|<p>\n|
972
        . qq|  <input name="remove_draft" id="remove_draft" type="checkbox" class="checkbox" ${remove_draft_checked}>|
973
        . qq|  <label for="remove_draft">| . $locale->text('Remove Draft') . qq|</label>\n|
974
        . qq|</p>\n|;
975
    }
903
  my ($follow_ups, $follow_ups_due);
976 904

  
977
    print qq|
978
        <input class=submit type=submit name=action id=update_button value="| . $locale->text('Update') . qq|">
979
        <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|"> |
980
        . NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit'))
981
        . $cgi->hidden('-name' => 'draft_id',          '-default' => [$form->{draft_id}])
982
        . $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}]);
905
  if ($::form->{id}) {
906
    $follow_ups     = FU->follow_ups('trans_id' => $::form->{id});
907
    $follow_ups_due = sum map { $_->{due} * 1 } @{ $follow_ups || [] };
983 908
  }
984 909

  
985
  print "
986
  </form>
910
  my $radieren = $::form->current_date(\%::myconfig) eq $::form->{gldate};
987 911

  
988
</body>
989
</html>
990
";
991
  $main::lxdebug->leave_sub();
912
  print $::form->parse_html_template('gl/form_footer', {
913
    radieren       => $radieren,
914
    follow_ups     => $follow_ups,
915
    follow_ups_due => $follow_ups_due,
916
  });
992 917

  
918
  $::lxdebug->leave_sub;
993 919
}
994 920

  
995 921
sub delete {
templates/webpages/gl/form_footer.html
1
[%- USE HTML %]
2
[%- USE LxERP %]
3
[%- USE T8 %]
4
[%- USE L %]
5
    <tr class=listtotal>
6
    <th colspan="3" align=right class=listtotal> [% LxERP.format_amount(totaldebit, 2) | html %]</th>
7
    <th align=right class=listtotal> [% LxERP.format_amount(totalcredit, 2) | html %]</th>
8
    <td colspan=6></td>
9
    </tr>
10
  </table>
11
  </td>
12
  </tr>
13
</table>
14

  
15
<input name=callback type=hidden value="[% callback %]">
16

  
17
[%- IF id && follow_ups.size %]
18
  <p>[% LxERP.t8('There are #1 unfinished follow-ups of which #2 are due.', follow_ups.size , follow_ups_due) %]</p>
19
[%- END %]
20

  
21
<br>
22

  
23
[%- IF id %]
24

  
25
 [%- IF !storno %]
26
      [% L.submit_tag('action', LxERP.t8('Storno')) %]
27
 [%- END %]
28

  
29
 [% IF !locked && radieren %]
30
      [% L.submit_tag('action', LxERP.t8('Post'), accesskey='b') %]
31
      [% L.submit_tag('action', LxERP.t8('Delete')) %]
32
 [%- END %]
33
      [% L.submit_tag('action', LxERP.t8('Update'), id='update_button') %]
34
      [% L.submit_tag('action', LxERP.t8('Follow-Up'), onclick='follow_up_window()') %]
35

  
36
[%- ELSE %]
37

  
38
 [%- IF draft_id %]
39
      <p>[% L.checkbox_tag('remove_draft', checked=remove_draft, label=LxERP.t8('Remove Draft')) %]</p>
40
 [%- END %]
41

  
42
      [% L.submit_tag('action', LxERP.t8('Update'), id='update_button') %]
43
      [% L.submit_tag('action', LxERP.t8('Post')) %]
44
      [% L.submit_tag('action', LxERP.t8('Save Draft')) %]
45
      [% L.hidden_tag('draft_id', draft_id) %]
46
      [% L.hidden_tag('draft_description', draft_description) %]
47
[%- END %]
48

  
49
  </form>
50

  
51
</body>
52
</html>

Auch abrufbar als: Unified diff