849 |
849 |
}
|
850 |
850 |
|
851 |
851 |
sub form_header {
|
852 |
|
my ($init) = @_;
|
853 |
|
$main::lxdebug->enter_sub();
|
854 |
|
|
855 |
|
$main::auth->assert('general_ledger');
|
|
852 |
$::lxdebug->enter_sub;
|
|
853 |
$::auth->assert('general_ledger');
|
856 |
854 |
|
857 |
|
my $form = $main::form;
|
858 |
|
my %myconfig = %main::myconfig;
|
859 |
|
my $locale = $main::locale;
|
|
855 |
my ($init) = @_;
|
860 |
856 |
|
861 |
|
my @old_project_ids = ();
|
862 |
|
map({ push(@old_project_ids, $form->{"project_id_$_"})
|
863 |
|
if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
|
|
857 |
my @old_project_ids = grep { $_ } map{ $::form->{"project_id_$_"} } 1..$::form->{rowcount};
|
864 |
858 |
|
865 |
|
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
|
|
859 |
$::form->get_lists("projects" => { "key" => "ALL_PROJECTS",
|
866 |
860 |
"all" => 0,
|
867 |
861 |
"old_id" => \@old_project_ids },
|
868 |
862 |
"charts" => { "key" => "ALL_CHARTS",
|
869 |
|
"transdate" => $form->{transdate} },
|
|
863 |
"transdate" => $::form->{transdate} },
|
870 |
864 |
"taxcharts" => "ALL_TAXCHARTS");
|
871 |
865 |
|
872 |
|
GL->get_chart_balances('charts' => $form->{ALL_CHARTS});
|
873 |
|
|
874 |
|
my $title = $form->{title};
|
875 |
|
$form->{title} = $locale->text("$title General Ledger Transaction");
|
876 |
|
my $readonly = ($form->{id}) ? "readonly" : "";
|
877 |
|
|
878 |
|
my $show_details_checked = $form->{show_details} ? "checked" : '';
|
879 |
|
my $ob_transaction_checked = $form->{ob_transaction} ? "checked" : '';
|
880 |
|
my $cb_transaction_checked = $form->{cb_transaction} ? "checked" : '';
|
|
866 |
GL->get_chart_balances('charts' => $::form->{ALL_CHARTS});
|
881 |
867 |
|
|
868 |
my $title = $::form->{title};
|
|
869 |
$::form->{title} = $::locale->text("$title General Ledger Transaction");
|
882 |
870 |
# $locale->text('Add General Ledger Transaction')
|
883 |
871 |
# $locale->text('Edit General Ledger Transaction')
|
884 |
872 |
|
885 |
|
map { $form->{$_} =~ s/\"/"/g }
|
886 |
|
qw(reference description chart taxchart);
|
887 |
|
|
888 |
|
$form->{javascript} = qq|<script type="text/javascript">
|
889 |
|
<!--
|
890 |
|
function setTaxkey(row) {
|
891 |
|
var accno = document.getElementById('accno_' + row);
|
892 |
|
var taxkey = accno.options[accno.selectedIndex].value;
|
893 |
|
var reg = /--([0-9]*)/;
|
894 |
|
var found = reg.exec(taxkey);
|
895 |
|
var index = found[1];
|
896 |
|
index = parseInt(index);
|
897 |
|
var tax = 'taxchart_' + row;
|
898 |
|
for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
|
899 |
|
var reg2 = new RegExp("^"+ index, "");
|
900 |
|
if (reg2.exec(document.getElementById(tax).options[i].value)) {
|
901 |
|
document.getElementById(tax).options[i].selected = true;
|
902 |
|
break;
|
903 |
|
}
|
904 |
|
}
|
905 |
|
};
|
|
873 |
map { $::form->{$_} =~ s/\"/"/g }
|
|
874 |
qw(chart taxchart);
|
906 |
875 |
|
907 |
|
function copy_debit_to_credit() {
|
908 |
|
var txt = document.getElementsByName('debit_1')[0].value;
|
909 |
|
document.getElementsByName('credit_2')[0].value = txt;
|
910 |
|
};
|
911 |
|
//-->
|
912 |
|
</script>
|
913 |
|
<script type="text/javascript" src="js/show_form_details.js"></script>
|
914 |
|
<script type="text/javascript" src="js/jquery.js"></script>
|
915 |
|
|;
|
916 |
|
|
917 |
|
$form->{selectdepartment} =~ s/ selected//;
|
918 |
|
$form->{selectdepartment} =~
|
919 |
|
s/option>\Q$form->{department}\E/option selected>$form->{department}/;
|
920 |
|
|
921 |
|
my $description;
|
922 |
|
if ((my $rows = $form->numtextrows($form->{description}, 50)) > 1) {
|
923 |
|
$description =
|
924 |
|
qq|<textarea name=description rows=$rows cols=50 wrap=soft $readonly >$form->{description}</textarea>|;
|
925 |
|
} else {
|
926 |
|
$description =
|
927 |
|
qq|<input name=description size=50 value="$form->{description}" $readonly>|;
|
928 |
|
}
|
929 |
|
|
930 |
|
my $taxincluded = ($form->{taxincluded}) ? "checked" : "";
|
|
876 |
$::form->{selectdepartment} =~ s/ selected//;
|
|
877 |
$::form->{selectdepartment} =~
|
|
878 |
s/option>\Q$::form->{department}\E/option selected>$::form->{department}/;
|
931 |
879 |
|
932 |
880 |
if ($init) {
|
933 |
|
$taxincluded = "checked";
|
934 |
|
}
|
935 |
|
|
936 |
|
my $department;
|
937 |
|
$department = qq|
|
938 |
|
<tr>
|
939 |
|
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
|
940 |
|
<td colspan=3><select name=department>$form->{selectdepartment}</select></td>
|
941 |
|
<input type=hidden name=selectdepartment value="$form->{selectdepartment}">
|
942 |
|
</tr>
|
943 |
|
| if $form->{selectdepartment};
|
944 |
|
if ($init) {
|
945 |
|
$form->{fokus} = "gl.reference";
|
946 |
|
} else {
|
947 |
|
$form->{fokus} = qq|gl.accno_$form->{rowcount}|;
|
948 |
|
}
|
949 |
|
|
950 |
|
# use JavaScript Calendar or not
|
951 |
|
$form->{jsscript} = 1;
|
952 |
|
my $jsscript = "";
|
953 |
|
my ($button1, $button2);
|
954 |
|
if ($form->{jsscript}) {
|
955 |
|
|
956 |
|
# with JavaScript Calendar
|
957 |
|
$button1 = qq|
|
958 |
|
<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" $readonly onBlur=\"check_right_date_format(this)\">
|
959 |
|
<input type=button name=transdate id="trigger1" value=|
|
960 |
|
. $locale->text('button') . qq|></td>
|
961 |
|
|;
|
962 |
|
|
963 |
|
#write Trigger
|
964 |
|
$jsscript =
|
965 |
|
Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1");
|
966 |
|
} else {
|
967 |
|
|
968 |
|
# without JavaScript Calendar
|
969 |
|
$button1 =
|
970 |
|
qq|<td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" $readonly onBlur=\"check_right_date_format(this)\"></td>|;
|
971 |
|
}
|
972 |
|
|
973 |
|
$form->{previous_id} ||= "--";
|
974 |
|
$form->{previous_gldate} ||= "--";
|
975 |
|
|
976 |
|
$jsscript .= $form->parse_html_template('gl/form_header_chart_balances_js');
|
977 |
|
|
978 |
|
$form->header;
|
979 |
|
|
980 |
|
print qq|
|
981 |
|
<body onLoad="focus()">
|
982 |
|
|
983 |
|
<script type="text/javascript" src="js/follow_up.js"></script>
|
984 |
|
|
985 |
|
<form method=post name="gl" action=gl.pl>
|
986 |
|
|;
|
987 |
|
|
988 |
|
$form->hide_form(qw(id closedto locked storno storno_id previous_id previous_gldate));
|
989 |
|
|
990 |
|
print qq|
|
991 |
|
<input type=hidden name=title value="$title">
|
992 |
|
|
993 |
|
<input type="hidden" name="follow_up_trans_id_1" value="| . H($form->{id}) . qq|">
|
994 |
|
<input type="hidden" name="follow_up_trans_type_1" value="gl_transaction">
|
995 |
|
<input type="hidden" name="follow_up_trans_info_1" value="| . H($form->{id}) . qq|">
|
996 |
|
<input type="hidden" name="follow_up_rowcount" value="1">
|
997 |
|
|
998 |
|
<table width=100%>
|
999 |
|
<tr>
|
1000 |
|
<th class=listtop>$form->{title}</th>
|
1001 |
|
</tr>| .
|
1002 |
|
|
1003 |
|
($form->{saved_message} ? qq|
|
1004 |
|
<tr>
|
1005 |
|
<td>$form->{saved_message}</th>
|
1006 |
|
</tr>| : '') .
|
1007 |
|
|
1008 |
|
qq|
|
1009 |
|
<tr height="5"></tr>
|
1010 |
|
<tr>
|
1011 |
|
<td>
|
1012 |
|
<table width=100%>
|
1013 |
|
<tr>
|
1014 |
|
<td colspan="6" align="left">|
|
1015 |
|
. $locale->text("Previous transnumber text")
|
1016 |
|
. " $form->{previous_id} "
|
1017 |
|
. $locale->text("Previous transdate text")
|
1018 |
|
. " $form->{previous_gldate}"
|
1019 |
|
. qq|</td>
|
1020 |
|
</tr>
|
1021 |
|
<tr>
|
1022 |
|
<th align=right>| . $locale->text('Reference') . qq|</th>
|
1023 |
|
<td><input name=reference size=20 value="$form->{reference}" $readonly></td>
|
1024 |
|
<td align=left>
|
1025 |
|
<table>
|
1026 |
|
<tr>
|
1027 |
|
<th align=right nowrap>| . $locale->text('Date') . qq|</th>
|
1028 |
|
$button1
|
1029 |
|
</tr>
|
1030 |
|
</table>
|
1031 |
|
</td>
|
1032 |
|
</tr>|;
|
1033 |
|
if ($form->{id}) {
|
1034 |
|
print qq|
|
1035 |
|
<tr>
|
1036 |
|
<th align=right>| . $locale->text('Belegnummer') . qq|</th>
|
1037 |
|
<td><input name=id size=20 value="$form->{id}" $readonly></td>
|
1038 |
|
<td align=left>
|
1039 |
|
<table>
|
1040 |
|
<tr>
|
1041 |
|
<th align=right width=50%>| . $locale->text('Buchungsdatum') . qq|</th>
|
1042 |
|
<td align=left><input name=gldate size=11 title="$myconfig{dateformat}" value=$form->{gldate} $readonly onBlur=\"check_right_date_format(this)\"></td>
|
1043 |
|
</tr>
|
1044 |
|
</table>
|
1045 |
|
</td>
|
1046 |
|
</tr>|;
|
1047 |
|
}
|
1048 |
|
print qq|
|
1049 |
|
$department|;
|
1050 |
|
if ($form->{id}) {
|
1051 |
|
print qq|
|
1052 |
|
<tr>
|
1053 |
|
<th align=right width=1%>| . $locale->text('Description') . qq|</th>
|
1054 |
|
<td width=1%>$description</td>
|
1055 |
|
<td>
|
1056 |
|
<table>
|
1057 |
|
<tr>
|
1058 |
|
<th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
|
1059 |
|
<td><input type=checkbox name=taxincluded value=1 $taxincluded></td>
|
1060 |
|
</tr>
|
1061 |
|
</table>
|
1062 |
|
</td>
|
1063 |
|
<td align=left>
|
1064 |
|
<table width=100%>
|
1065 |
|
<tr>
|
1066 |
|
<th align=right width=50%>| . $locale->text('Mitarbeiter') . qq|</th>
|
1067 |
|
<td align=left><input name=employee size=20 value="| . H($form->{employee}) . qq|" readonly></td>
|
1068 |
|
</tr>
|
1069 |
|
</table>
|
1070 |
|
</td>
|
1071 |
|
</tr>|;
|
|
881 |
$::form->{fokus} = "gl.reference";
|
|
882 |
$::form->{taxincluded} = "1";
|
1072 |
883 |
} else {
|
1073 |
|
print qq|
|
1074 |
|
<tr>
|
1075 |
|
<th align=left width=1%>| . $locale->text('Description') . qq|</th>
|
1076 |
|
<td width=1%>$description</td>
|
1077 |
|
<td>
|
1078 |
|
<table>
|
1079 |
|
<tr>
|
1080 |
|
<th align=left>| . $locale->text('MwSt. inkl.') . qq|</th>
|
1081 |
|
<td><input type=checkbox name=taxincluded value=1 $taxincluded></td>
|
1082 |
|
</tr>
|
1083 |
|
</table>
|
1084 |
|
</td>
|
1085 |
|
</tr>|;
|
|
884 |
$::form->{fokus} = qq|gl.accno_$::form->{rowcount}|;
|
1086 |
885 |
}
|
1087 |
886 |
|
1088 |
|
print qq|
|
1089 |
|
<tr>
|
1090 |
|
<tr><td colspan=4><table><tr>
|
1091 |
|
<td>
|
1092 |
|
| . $locale->text('OB Transaction') . qq|<input type="checkbox" name="ob_transaction" value="1" $ob_transaction_checked>
|
1093 |
|
</td>
|
1094 |
|
<td>
|
1095 |
|
| . $locale->text('CB Transaction') . qq|<input type="checkbox" name="cb_transaction" value="1" $cb_transaction_checked>
|
1096 |
|
</td>
|
1097 |
|
</tr></table></td></tr>
|
1098 |
|
<tr>
|
1099 |
|
<td width="1%" align="right" nowrap>| . $locale->text('Show details') . qq|</td>
|
1100 |
|
<td width="1%"><input type="checkbox" onclick="show_form_details();" name="show_details" value="1" $show_details_checked></td>
|
1101 |
|
</tr>|;
|
|
887 |
$::form->{previous_id} ||= "--";
|
|
888 |
$::form->{previous_gldate} ||= "--";
|
1102 |
889 |
|
1103 |
|
print qq|
|
1104 |
|
<tr>
|
1105 |
|
<td colspan=4>
|
1106 |
|
<table width=100%>
|
1107 |
|
<tr class=listheading>
|
1108 |
|
<th class=listheading style="width:15%">|
|
1109 |
|
. $locale->text('Account') . qq|</th>
|
1110 |
|
<th class=listheading style="width:10%">| . $locale->text('Chart balance') . qq|</th>
|
1111 |
|
<th class=listheading style="width:10%">|
|
1112 |
|
. $locale->text('Debit') . qq|</th>
|
1113 |
|
<th class=listheading style="width:10%">|
|
1114 |
|
. $locale->text('Credit') . qq|</th>
|
1115 |
|
<th class=listheading style="width:10%">|
|
1116 |
|
. $locale->text('Tax') . qq|</th>
|
1117 |
|
<th class=listheading style="width:5%">|
|
1118 |
|
. $locale->text('Taxkey') . qq|</th>|;
|
1119 |
|
|
1120 |
|
if ($form->{show_details}) {
|
1121 |
|
print qq|
|
1122 |
|
<th class=listheading style="width:20%">| . $locale->text('Source') . qq|</th>
|
1123 |
|
<th class=listheading style="width:20%">| . $locale->text('Memo') . qq|</th>
|
1124 |
|
<th class=listheading style="width:20%">| . $locale->text('Project Number') . qq|</th>
|
1125 |
|
|;
|
1126 |
|
}
|
1127 |
|
|
1128 |
|
print qq|
|
1129 |
|
</tr>
|
|
890 |
$::form->header;
|
|
891 |
print $::form->parse_html_template('gl/form_header', {
|
|
892 |
hide_title => $title,
|
|
893 |
});
|
1130 |
894 |
|
1131 |
|
$jsscript
|
1132 |
|
|;
|
1133 |
|
$main::lxdebug->leave_sub();
|
|
895 |
$::lxdebug->leave_sub;
|
1134 |
896 |
|
1135 |
897 |
}
|
1136 |
898 |
|
gl::form_header auf template umgeschrieben