832 |
832 |
}
|
833 |
833 |
|
834 |
834 |
sub form_footer {
|
835 |
|
$main::lxdebug->enter_sub();
|
836 |
|
|
837 |
|
my $form = $main::form;
|
838 |
|
my %myconfig = %main::myconfig;
|
839 |
|
my $locale = $main::locale;
|
840 |
|
my $cgi = $::request->{cgi};
|
841 |
|
|
842 |
|
$main::auth->assert('general_ledger');
|
|
835 |
$::lxdebug->enter_sub;
|
|
836 |
$::auth->assert('general_ledger');
|
843 |
837 |
|
844 |
|
my $follow_ups_block;
|
845 |
|
if ($form->{id}) {
|
846 |
|
my $follow_ups = FU->follow_ups('trans_id' => $form->{id});
|
|
838 |
my $num_due;
|
|
839 |
my $num_follow_ups;
|
|
840 |
if ($::form->{id}) {
|
|
841 |
my $follow_ups = FU->follow_ups('trans_id' => $::form->{id});
|
847 |
842 |
|
848 |
|
if (@{ $follow_ups} ) {
|
849 |
|
my $num_due = sum map { $_->{due} * 1 } @{ $follow_ups };
|
850 |
|
$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>|;
|
|
843 |
if (@{ $follow_ups }) {
|
|
844 |
$num_due = sum map { $_->{due} * 1 } @{ $follow_ups };
|
|
845 |
$num_follow_ups = scalar @{ $follow_ups }
|
851 |
846 |
}
|
852 |
847 |
}
|
853 |
848 |
|
854 |
|
print qq|
|
855 |
|
|
856 |
|
$follow_ups_block
|
857 |
|
|
858 |
|
<script type="text/javascript">
|
859 |
|
<!--
|
860 |
|
function set_duedate() {
|
861 |
|
\$.ajax({
|
862 |
|
url: 'is.pl?action=set_duedate',
|
863 |
|
data: {
|
864 |
|
invdate: \$('#transdate').val(),
|
865 |
|
vendor_id: \$('[name=vendor_id]').val(),
|
866 |
|
},
|
867 |
|
dataType: 'text',
|
868 |
|
success: function(data) {
|
869 |
|
\$('#duedate').val(data);
|
870 |
|
}
|
871 |
|
});
|
872 |
|
}
|
873 |
|
//-->
|
874 |
|
</script>
|
875 |
|
|
876 |
|
<input name=callback type=hidden value="$form->{callback}">
|
877 |
|
<input name="gldate" type="hidden" value="| . Q($form->{gldate}) . qq|">
|
878 |
|
|
|
879 |
|
. $cgi->hidden('-name' => 'draft_id', '-default' => [$form->{draft_id}])
|
880 |
|
. $cgi->hidden('-name' => 'draft_description', '-default' => [$form->{draft_description}])
|
881 |
|
. qq|
|
882 |
|
|
883 |
|
<br>
|
884 |
|
|;
|
885 |
|
|
886 |
|
if (!$form->{id} && $form->{draft_id}) {
|
887 |
|
print(NTI($cgi->checkbox('-name' => 'remove_draft', '-id' => 'remove_draft',
|
888 |
|
'-value' => 1, '-checked' => $form->{remove_draft},
|
889 |
|
'-label' => '')) .
|
890 |
|
qq| <label for="remove_draft">| .
|
891 |
|
$locale->text("Remove draft when posting") .
|
892 |
|
qq|</label><br>|);
|
893 |
|
}
|
|
849 |
my $transdate = $::form->datetonum($::form->{transdate}, \%::myconfig);
|
|
850 |
my $closedto = $::form->datetonum($::form->{closedto}, \%::myconfig);
|
894 |
851 |
|
895 |
|
my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
|
896 |
|
my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
|
|
852 |
my $storno = $::form->{id}
|
|
853 |
&& !IS->has_storno(\%::myconfig, $::form, 'ap')
|
|
854 |
&& !IS->is_storno( \%::myconfig, $::form, 'ap', $::form->{id})
|
|
855 |
&& ($::form->{totalpaid} == 0 || $::form->{totalpaid} eq '');
|
897 |
856 |
|
898 |
|
print qq|<input class="submit" type="submit" name="action" id="update_button" value="| . $locale->text('Update') . qq|">|;
|
|
857 |
$::form->header;
|
|
858 |
print $::form->parse_html_template('ap/form_footer', {
|
|
859 |
num_due => $num_due,
|
|
860 |
num_follow_ups => $num_follow_ups,
|
|
861 |
show_post_draft => ($transdate > $closedto) && !$::form->{id},
|
|
862 |
show_storno => $storno,
|
|
863 |
});
|
899 |
864 |
|
900 |
|
if ($form->{id}) {
|
901 |
|
if ($form->{radier}) {
|
902 |
|
print qq| <input class=submit type=submit name=action value="| . $locale->text('Post') . qq|">
|
903 |
|
<input class=submit type=submit name=action value="| . $locale->text('Delete') . qq|">
|
904 |
|
|;
|
905 |
|
}
|
906 |
|
# ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
|
907 |
|
print qq| <input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|"> |
|
908 |
|
if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap', $form->{id}) && (($form->{totalpaid} == 0) || ($form->{totalpaid} eq "")));
|
909 |
|
|
910 |
|
print qq| <input class=submit type=submit name=action value="| . $locale->text('Post Payment') . qq|">
|
911 |
|
<input class=submit type=submit name=action value="| . $locale->text('Use As Template') . qq|">
|
912 |
|
<input type="button" class="submit" onclick="follow_up_window()" value="| . $locale->text('Follow-Up') . qq|">
|
913 |
|
|;
|
914 |
|
} elsif (($transdate > $closedto) && !$form->{id}) {
|
915 |
|
print qq|
|
916 |
|
<input class=submit type=submit name=action value="| . $locale->text('Post') . qq|"> | .
|
917 |
|
NTI($cgi->submit('-name' => 'action', '-value' => $locale->text('Save draft'), '-class' => 'submit'));
|
918 |
|
}
|
919 |
|
# button for saving history
|
920 |
|
if($form->{id} ne "") {
|
921 |
|
print qq| <input type="button" class="submit" onclick="set_history_window($form->{id});" name="history" id="history" value="| . $locale->text('history') . qq|"> |;
|
922 |
|
}
|
923 |
|
# /button for saving history
|
924 |
|
# mark_as_paid button
|
925 |
|
if($form->{id} ne "") {
|
926 |
|
print qq| <input type="submit" class="submit" name="action" value="| . $locale->text('mark as paid') . qq|"> |;
|
927 |
|
}
|
928 |
|
# /mark_as_paid button
|
929 |
|
print "
|
930 |
|
</form>
|
931 |
|
|
932 |
|
</body>
|
933 |
|
</html>
|
934 |
|
";
|
935 |
|
|
936 |
|
$main::lxdebug->leave_sub();
|
|
865 |
$::lxdebug->leave_sub;
|
937 |
866 |
}
|
938 |
867 |
|
939 |
868 |
sub mark_as_paid {
|
ap::form_footer auf template umgestellt.