Revision 11461cce
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
bin/mozilla/rp.pl | ||
---|---|---|
47 | 47 |
require "bin/mozilla/common.pl"; |
48 | 48 |
require "bin/mozilla/reportgenerator.pl"; |
49 | 49 |
|
50 |
# note: this file was particularly hard to strictify. |
|
51 |
# alot of the vars are passed carelessly between invocations |
|
52 |
# should there be any missing vars, declare them globally |
|
53 |
use strict; |
|
54 |
|
|
50 | 55 |
1; |
51 | 56 |
|
52 | 57 |
# end of main |
... | ... | |
106 | 111 |
'balance_sheet' => 'report', |
107 | 112 |
}; |
108 | 113 |
|
114 |
# subs use these pretty freely, so declare them here |
|
115 |
our (%column_data, @column_index); |
|
116 |
our ($subtotalnetamount, $subtotaltax, $subtotal); |
|
117 |
|
|
109 | 118 |
sub check_rp_access { |
119 |
my $form = $main::form; |
|
120 |
|
|
110 | 121 |
my $right = $rp_access_map->{$form->{report}}; |
111 | 122 |
$right ||= 'DOES_NOT_EXIST'; |
112 | 123 |
|
113 |
$auth->assert($right); |
|
124 |
$main::auth->assert($right);
|
|
114 | 125 |
} |
115 | 126 |
|
116 | 127 |
sub report { |
117 |
$lxdebug->enter_sub(); |
|
128 |
$main::lxdebug->enter_sub();
|
|
118 | 129 |
|
119 | 130 |
check_rp_access(); |
120 | 131 |
|
121 |
%title = ('balance_sheet' => 'Balance Sheet', |
|
132 |
my $form = $main::form; |
|
133 |
my %myconfig = %main::myconfig; |
|
134 |
my $locale = $main::locale; |
|
135 |
|
|
136 |
my %title = ( |
|
137 |
'balance_sheet' => 'Balance Sheet', |
|
122 | 138 |
'income_statement' => 'Income Statement', |
123 | 139 |
'trial_balance' => 'Trial Balance', |
124 | 140 |
'ar_aging' => 'AR Aging', |
... | ... | |
130 | 146 |
'receipts' => 'Receipts', |
131 | 147 |
'payments' => 'Payments', |
132 | 148 |
'projects' => 'Project Transactions', |
133 |
'bwa' => 'Betriebswirtschaftliche Auswertung',); |
|
149 |
'bwa' => 'Betriebswirtschaftliche Auswertung', |
|
150 |
); |
|
134 | 151 |
|
135 | 152 |
$form->{title} = $locale->text($title{ $form->{report} }); |
136 | 153 |
|
137 |
$accrual = ($eur) ? "" : "checked";
|
|
138 |
$cash = ($eur) ? "checked" : "";
|
|
154 |
my $accrual = ($main::eur) ? "" : "checked";
|
|
155 |
my $cash = ($main::eur) ? "checked" : "";
|
|
139 | 156 |
|
140 |
$year = (localtime)[5] + 1900; |
|
157 |
my $year = (localtime)[5] + 1900;
|
|
141 | 158 |
|
142 | 159 |
# get departments |
143 | 160 |
$form->all_departments(\%myconfig); |
... | ... | |
146 | 163 |
map { $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}\n" } @{ $form->{all_departments} }; |
147 | 164 |
} |
148 | 165 |
|
149 |
$department = qq| |
|
166 |
my $department = qq|
|
|
150 | 167 |
<tr> |
151 | 168 |
<th align=right nowrap>| . $locale->text('Department') . qq|</th> |
152 | 169 |
<td colspan=3><select name=department>$form->{selectdepartment}</select></td> |
... | ... | |
164 | 181 |
} |
165 | 182 |
|
166 | 183 |
my $projectnumber = |
167 |
NTI($cgi->popup_menu('-name' => "project_id", |
|
168 |
'-values' => \@project_values, |
|
169 |
'-labels' => \%project_labels)); |
|
184 |
NTI($main::cgi->popup_menu('-name' => "project_id",
|
|
185 |
'-values' => \@project_values,
|
|
186 |
'-labels' => \%project_labels));
|
|
170 | 187 |
|
171 | 188 |
# use JavaScript Calendar or not |
172 | 189 |
$form->{jsscript} = 1; |
173 |
$jsscript = ""; |
|
190 |
my $jsscript = ""; |
|
191 |
my ( $name_1, $id_1, $value_1, $trigger_1, $name_2, $id_2, $value_2, $trigger_2, ); |
|
174 | 192 |
if ($form->{report} eq "balance_sheet") { |
175 | 193 |
$name_1 = "asofdate"; |
176 | 194 |
$id_1 = "asofdate"; |
... | ... | |
210 | 228 |
$trigger_2 = "trigger2"; |
211 | 229 |
} |
212 | 230 |
|
231 |
my ($button1, $button1_2, $button2, $button2_2); |
|
232 |
my $checked; |
|
233 |
|
|
213 | 234 |
# with JavaScript Calendar |
214 | 235 |
if ($form->{jsscript}) { |
215 | 236 |
if ($name_1 eq "") { |
... | ... | |
239 | 260 |
} |
240 | 261 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|; |
241 | 262 |
$form->header; |
242 |
$onload = qq|focus()|; |
|
263 |
my $onload = qq|focus()|;
|
|
243 | 264 |
$onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; |
244 | 265 |
$onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; |
245 | 266 |
print qq| |
... | ... | |
626 | 647 |
|; |
627 | 648 |
|
628 | 649 |
$checked = "checked"; |
629 |
foreach $ref (@{ $form->{taxaccounts} }) { |
|
650 |
foreach my $ref (@{ $form->{taxaccounts} }) {
|
|
630 | 651 |
|
631 | 652 |
|
632 | 653 |
qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description} |
... | ... | |
760 | 781 |
|
761 | 782 |
} |
762 | 783 |
|
784 |
my ($label, $nextsub, $vc); |
|
763 | 785 |
if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) { |
764 | 786 |
if ($form->{report} eq 'ar_aging') { |
765 | 787 |
$label = $locale->text('Customer'); |
... | ... | |
810 | 832 |
|
811 | 833 |
# above action can be removed if there is more than one input field |
812 | 834 |
|
835 |
my ($selection, $paymentaccounts); |
|
813 | 836 |
if ($form->{report} =~ /(receipts|payments)$/) { |
814 | 837 |
$form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar"; |
815 | 838 |
|
816 | 839 |
RP->paymentaccounts(\%myconfig, \%$form); |
817 | 840 |
|
818 | 841 |
$selection = "<option>\n"; |
819 |
foreach $ref (@{ $form->{PR} }) { |
|
842 |
foreach my $ref (@{ $form->{PR} }) {
|
|
820 | 843 |
$paymentaccounts .= "$ref->{accno} "; |
821 | 844 |
$selection .= "<option>$ref->{accno}--$ref->{description}\n"; |
822 | 845 |
} |
... | ... | |
887 | 910 |
</html> |
888 | 911 |
|; |
889 | 912 |
|
890 |
$lxdebug->leave_sub(); |
|
913 |
$main::lxdebug->leave_sub();
|
|
891 | 914 |
} |
892 | 915 |
|
893 |
sub continue { call_sub($form->{"nextsub"}); } |
|
916 |
sub continue { call_sub($main::form->{"nextsub"}); }
|
|
894 | 917 |
|
895 | 918 |
sub get_project { |
896 |
$lxdebug->enter_sub(); |
|
919 |
$main::lxdebug->enter_sub();
|
|
897 | 920 |
|
898 |
$auth->assert('report'); |
|
921 |
$main::auth->assert('report'); |
|
922 |
|
|
923 |
my $form = $main::form; |
|
924 |
my %myconfig = %main::myconfig; |
|
925 |
my $locale = $main::locale; |
|
899 | 926 |
|
900 | 927 |
my $nextsub = shift; |
901 | 928 |
|
... | ... | |
914 | 941 |
$form->{project_id} = $form->{project_id_1}; |
915 | 942 |
} |
916 | 943 |
|
917 |
$lxdebug->leave_sub(); |
|
944 |
$main::lxdebug->leave_sub();
|
|
918 | 945 |
} |
919 | 946 |
|
920 | 947 |
sub generate_income_statement { |
921 |
$lxdebug->enter_sub(); |
|
948 |
$main::lxdebug->enter_sub(); |
|
949 |
|
|
950 |
$main::auth->assert('report'); |
|
922 | 951 |
|
923 |
$auth->assert('report'); |
|
952 |
my $form = $main::form; |
|
953 |
my %myconfig = %main::myconfig; |
|
954 |
my $locale = $main::locale; |
|
924 | 955 |
|
925 | 956 |
$form->{padding} = " "; |
926 | 957 |
$form->{bold} = "<b>"; |
... | ... | |
971 | 1002 |
$form->{fromdate} = "1.2.$form->{year}"; |
972 | 1003 |
|
973 | 1004 |
#this works from 1901 to 2099, 1900 and 2100 fail. |
974 |
$leap = ($form->{year} % 4 == 0) ? "29" : "28"; |
|
1005 |
my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
|
|
975 | 1006 |
$form->{todate} = "$leap.2.$form->{year}"; |
976 | 1007 |
last SWITCH; |
977 | 1008 |
}; |
... | ... | |
1043 | 1074 |
$form->{todate} = $form->current_date(\%myconfig); |
1044 | 1075 |
} |
1045 | 1076 |
|
1046 |
$longtodate = $locale->date(\%myconfig, $form->{todate}, 1); |
|
1047 |
$shorttodate = $locale->date(\%myconfig, $form->{todate}, 0); |
|
1077 |
my $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
|
|
1078 |
my $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
|
|
1048 | 1079 |
|
1049 |
$longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1); |
|
1050 |
$shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0); |
|
1080 |
my $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
|
|
1081 |
my $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
|
|
1051 | 1082 |
|
1052 | 1083 |
$form->{this_period} = "$shortfromdate\n$shorttodate"; |
1053 | 1084 |
$form->{period} = |
... | ... | |
1058 | 1089 |
} |
1059 | 1090 |
|
1060 | 1091 |
if ($form->{comparefromdate} || $form->{comparetodate}) { |
1061 |
$longcomparefromdate = |
|
1062 |
$locale->date(\%myconfig, $form->{comparefromdate}, 1); |
|
1063 |
$shortcomparefromdate = |
|
1064 |
$locale->date(\%myconfig, $form->{comparefromdate}, 0); |
|
1092 |
my $longcomparefromdate = $locale->date(\%myconfig, $form->{comparefromdate}, 1); |
|
1093 |
my $shortcomparefromdate = $locale->date(\%myconfig, $form->{comparefromdate}, 0); |
|
1065 | 1094 |
|
1066 |
$longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1); |
|
1067 |
$shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0); |
|
1095 |
my $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
|
|
1096 |
my $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
|
|
1068 | 1097 |
|
1069 | 1098 |
$form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate"; |
1070 | 1099 |
$form->{period} .= |
... | ... | |
1074 | 1103 |
} |
1075 | 1104 |
|
1076 | 1105 |
# setup variables for the form |
1077 |
@a = qw(company address businessnumber); |
|
1106 |
my @a = qw(company address businessnumber);
|
|
1078 | 1107 |
map { $form->{$_} = $myconfig{$_} } @a; |
1079 | 1108 |
|
1080 | 1109 |
$form->{templates} = $myconfig{templates}; |
... | ... | |
1083 | 1112 |
|
1084 | 1113 |
$form->parse_template; |
1085 | 1114 |
|
1086 |
$lxdebug->leave_sub(); |
|
1115 |
$main::lxdebug->leave_sub();
|
|
1087 | 1116 |
} |
1088 | 1117 |
|
1089 | 1118 |
sub generate_balance_sheet { |
1090 |
$lxdebug->enter_sub(); |
|
1119 |
$main::lxdebug->enter_sub();
|
|
1091 | 1120 |
|
1092 |
$auth->assert('report'); |
|
1121 |
$main::auth->assert('report'); |
|
1122 |
|
|
1123 |
my $form = $main::form; |
|
1124 |
my %myconfig = %main::myconfig; |
|
1125 |
my $locale = $main::locale; |
|
1093 | 1126 |
|
1094 | 1127 |
$form->{decimalplaces} = $form->{decimalplaces} * 1 || 2; |
1095 | 1128 |
$form->{padding} = " "; |
... | ... | |
1105 | 1138 |
($form->{department}) = split /--/, $form->{department}; |
1106 | 1139 |
|
1107 | 1140 |
# define Current Earnings account |
1108 |
$padding = ($form->{l_heading}) ? $form->{padding} : ""; |
|
1141 |
my $padding = ($form->{l_heading}) ? $form->{padding} : "";
|
|
1109 | 1142 |
push(@{ $form->{equity_account} }, $padding . $locale->text('Current Earnings')); |
1110 | 1143 |
|
1111 | 1144 |
$form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0); |
... | ... | |
1122 | 1155 |
print $form->parse_html_template('rp/balance_sheet', $data); |
1123 | 1156 |
# $form->parse_template(); |
1124 | 1157 |
|
1125 |
$lxdebug->leave_sub(); |
|
1158 |
$main::lxdebug->leave_sub();
|
|
1126 | 1159 |
} |
1127 | 1160 |
|
1128 | 1161 |
sub generate_projects { |
1129 |
$lxdebug->enter_sub(); |
|
1162 |
$main::lxdebug->enter_sub(); |
|
1163 |
|
|
1164 |
$main::auth->assert('report'); |
|
1130 | 1165 |
|
1131 |
$auth->assert('report'); |
|
1166 |
my $form = $main::form; |
|
1167 |
my %myconfig = %main::myconfig; |
|
1168 |
my $locale = $main::locale; |
|
1132 | 1169 |
|
1133 |
&get_project(generate_projects);
|
|
1170 |
&get_project("generate_projects");
|
|
1134 | 1171 |
$form->{projectnumber} = $form->{projectnumber_1}; |
1135 | 1172 |
|
1136 | 1173 |
$form->{nextsub} = "generate_projects"; |
... | ... | |
1139 | 1176 |
|
1140 | 1177 |
list_accounts('generate_projects'); |
1141 | 1178 |
|
1142 |
$lxdebug->leave_sub(); |
|
1179 |
$main::lxdebug->leave_sub();
|
|
1143 | 1180 |
} |
1144 | 1181 |
|
1145 | 1182 |
# Antonio Gallardo |
... | ... | |
1149 | 1186 |
# added headers and subtotals |
1150 | 1187 |
# |
1151 | 1188 |
sub generate_trial_balance { |
1152 |
$lxdebug->enter_sub(); |
|
1189 |
$main::lxdebug->enter_sub();
|
|
1153 | 1190 |
|
1154 |
$auth->assert('report'); |
|
1191 |
$main::auth->assert('report'); |
|
1192 |
|
|
1193 |
my $form = $main::form; |
|
1194 |
my %myconfig = %main::myconfig; |
|
1195 |
my $locale = $main::locale; |
|
1155 | 1196 |
|
1156 | 1197 |
if ($form->{reporttype} eq "custom") { |
1157 | 1198 |
|
... | ... | |
1197 | 1238 |
$form->{fromdate} = "1.2.$form->{year}"; |
1198 | 1239 |
|
1199 | 1240 |
#this works from 1901 to 2099, 1900 and 2100 fail. |
1200 |
$leap = ($form->{year} % 4 == 0) ? "29" : "28"; |
|
1241 |
my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
|
|
1201 | 1242 |
$form->{todate} = "$leap.2.$form->{year}"; |
1202 | 1243 |
last SWITCH; |
1203 | 1244 |
}; |
... | ... | |
1331 | 1372 |
$form->{callback} = $href .= "&sort=$form->{sort}"; |
1332 | 1373 |
|
1333 | 1374 |
# escape callback for href |
1334 |
$callback = $form->escape($href); |
|
1375 |
my $callback = $form->escape($href);
|
|
1335 | 1376 |
|
1336 | 1377 |
my @subtotal_columns = qw(soll_eb haben_eb soll haben soll_kumuliert haben_kumuliert soll_saldo haben_saldo); |
1337 | 1378 |
|
... | ... | |
1339 | 1380 |
|
1340 | 1381 |
my $edit_url = build_std_url('action=edit', 'type', 'vc'); |
1341 | 1382 |
|
1342 |
foreach $accno (@{ $form->{TB} }) { |
|
1383 |
my $idx; |
|
1384 |
foreach my $accno (@{ $form->{TB} }) { |
|
1343 | 1385 |
|
1344 | 1386 |
$accno->{soll} = $accno->{debit}; |
1345 | 1387 |
$accno->{haben} = $accno->{credit}; |
... | ... | |
1357 | 1399 |
}; |
1358 | 1400 |
} |
1359 | 1401 |
|
1360 |
|
|
1361 |
$row->{$ordnumber}->{link} = $edit_url . "&id=" . E($oe->{id}) . "&callback=${callback}"; |
|
1362 | 1402 |
$row->{accno}->{link} = build_std_url('script=ca.pl', 'action=list_transactions', 'accno=' . E($accno->{accno}), 'description=' . E($accno->{description}), 'fromdate=' . E($form->{fromdate}), 'todate=' . E($form->{todate}), 'method=' . E($form->{method})); |
1363 | 1403 |
|
1364 | 1404 |
my $row_set = [ $row ]; |
... | ... | |
1375 | 1415 |
|
1376 | 1416 |
$report->generate_with_headers(); |
1377 | 1417 |
|
1378 |
$lxdebug->leave_sub(); |
|
1418 |
$main::lxdebug->leave_sub();
|
|
1379 | 1419 |
|
1380 | 1420 |
} |
1381 | 1421 |
|
1382 | 1422 |
sub create_subtotal_row { |
1383 |
$lxdebug->enter_sub(); |
|
1423 |
$main::lxdebug->enter_sub();
|
|
1384 | 1424 |
|
1385 | 1425 |
my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_; |
1386 | 1426 |
|
1427 |
my $form = $main::form; |
|
1428 |
my %myconfig = %main::myconfig; |
|
1429 |
my $locale = $main::locale; |
|
1430 |
|
|
1387 | 1431 |
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } }; |
1388 | 1432 |
|
1389 | 1433 |
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns }; |
... | ... | |
1392 | 1436 |
|
1393 | 1437 |
map { $totals->{$_} = 0 } @{ $subtotal_columns }; |
1394 | 1438 |
|
1395 |
$lxdebug->leave_sub(); |
|
1439 |
$main::lxdebug->leave_sub();
|
|
1396 | 1440 |
|
1397 | 1441 |
return $row; |
1398 | 1442 |
} |
1399 | 1443 |
|
1400 | 1444 |
sub create_list_accounts_subtotal_row { |
1401 |
$lxdebug->enter_sub(); |
|
1445 |
$main::lxdebug->enter_sub();
|
|
1402 | 1446 |
|
1403 | 1447 |
my ($subtotals, $columns, $fields, $class) = @_; |
1404 | 1448 |
|
1449 |
my $form = $main::form; |
|
1450 |
my %myconfig = %main::myconfig; |
|
1451 |
my $locale = $main::locale; |
|
1452 |
|
|
1405 | 1453 |
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => 'right' } } @{ $columns } }; |
1406 | 1454 |
|
1407 | 1455 |
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $subtotals->{$_}, 2) } @{ $fields }; |
1408 | 1456 |
|
1409 |
$lxdebug->leave_sub(); |
|
1457 |
$main::lxdebug->leave_sub();
|
|
1410 | 1458 |
|
1411 | 1459 |
return $row; |
1412 | 1460 |
} |
1413 | 1461 |
|
1414 | 1462 |
sub list_accounts { |
1415 |
$lxdebug->enter_sub(); |
|
1463 |
$main::lxdebug->enter_sub();
|
|
1416 | 1464 |
|
1417 | 1465 |
my ($action) = @_; |
1418 | 1466 |
|
1467 |
my $form = $main::form; |
|
1468 |
my %myconfig = %main::myconfig; |
|
1469 |
my $locale = $main::locale; |
|
1470 |
|
|
1419 | 1471 |
my @options; |
1420 | 1472 |
if ($form->{department}) { |
1421 | 1473 |
my ($department) = split /--/, $form->{department}; |
... | ... | |
1528 | 1580 |
|
1529 | 1581 |
$report->generate_with_headers(); |
1530 | 1582 |
|
1531 |
$lxdebug->leave_sub(); |
|
1583 |
$main::lxdebug->leave_sub();
|
|
1532 | 1584 |
} |
1533 | 1585 |
|
1534 | 1586 |
sub generate_ar_aging { |
1535 |
$lxdebug->enter_sub(); |
|
1587 |
$main::lxdebug->enter_sub(); |
|
1588 |
|
|
1589 |
$main::auth->assert('general_ledger'); |
|
1536 | 1590 |
|
1537 |
$auth->assert('general_ledger'); |
|
1591 |
my $form = $main::form; |
|
1592 |
my %myconfig = %main::myconfig; |
|
1593 |
my $locale = $main::locale; |
|
1538 | 1594 |
|
1539 | 1595 |
# split customer |
1540 | 1596 |
($form->{customer}) = split(/--/, $form->{customer}); |
... | ... | |
1547 | 1603 |
RP->aging(\%myconfig, \%$form); |
1548 | 1604 |
aging(); |
1549 | 1605 |
|
1550 |
$lxdebug->leave_sub(); |
|
1606 |
$main::lxdebug->leave_sub();
|
|
1551 | 1607 |
} |
1552 | 1608 |
|
1553 | 1609 |
sub generate_ap_aging { |
1554 |
$lxdebug->enter_sub(); |
|
1610 |
$main::lxdebug->enter_sub();
|
|
1555 | 1611 |
|
1556 |
$auth->assert('general_ledger'); |
|
1612 |
$main::auth->assert('general_ledger'); |
|
1613 |
|
|
1614 |
my $form = $main::form; |
|
1615 |
my %myconfig = %main::myconfig; |
|
1616 |
my $locale = $main::locale; |
|
1557 | 1617 |
|
1558 | 1618 |
# split vendor |
1559 | 1619 |
($form->{vendor}) = split(/--/, $form->{vendor}); |
... | ... | |
1566 | 1626 |
RP->aging(\%myconfig, \%$form); |
1567 | 1627 |
aging(); |
1568 | 1628 |
|
1569 |
$lxdebug->leave_sub(); |
|
1629 |
$main::lxdebug->leave_sub();
|
|
1570 | 1630 |
} |
1571 | 1631 |
|
1572 | 1632 |
sub create_aging_subtotal_row { |
1573 |
$lxdebug->enter_sub(); |
|
1633 |
$main::lxdebug->enter_sub();
|
|
1574 | 1634 |
|
1575 | 1635 |
my ($subtotals, $columns, $periods, $class) = @_; |
1576 | 1636 |
|
1637 |
my $form = $main::form; |
|
1638 |
my %myconfig = %main::myconfig; |
|
1639 |
my $locale = $main::locale; |
|
1640 |
|
|
1577 | 1641 |
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => 'right' } } @{ $columns } }; |
1578 | 1642 |
|
1579 | 1643 |
foreach (@{ $periods }) { |
... | ... | |
1581 | 1645 |
$subtotals->{$_} = 0; |
1582 | 1646 |
} |
1583 | 1647 |
|
1584 |
$lxdebug->leave_sub(); |
|
1648 |
$main::lxdebug->leave_sub();
|
|
1585 | 1649 |
|
1586 | 1650 |
return $row; |
1587 | 1651 |
} |
1588 | 1652 |
|
1589 | 1653 |
sub aging { |
1590 |
$lxdebug->enter_sub(); |
|
1654 |
$main::lxdebug->enter_sub();
|
|
1591 | 1655 |
|
1592 |
$auth->assert('general_ledger'); |
|
1656 |
$main::auth->assert('general_ledger'); |
|
1657 |
|
|
1658 |
my $form = $main::form; |
|
1659 |
my %myconfig = %main::myconfig; |
|
1660 |
my $locale = $main::locale; |
|
1661 |
my $cgi = $main::cgi; |
|
1593 | 1662 |
|
1594 | 1663 |
my $report = SL::ReportGenerator->new(\%myconfig, $form); |
1595 | 1664 |
|
... | ... | |
1642 | 1711 |
push @options, $locale->text('for Period') . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1); |
1643 | 1712 |
} |
1644 | 1713 |
|
1645 |
my $attachment_basename = $form->{ct} eq 'customer' ? $locale->text('ar_aging_list') : $locale->text('ap_aging_list');
|
|
1714 |
$attachment_basename = $form->{ct} eq 'customer' ? $locale->text('ar_aging_list') : $locale->text('ap_aging_list'); |
|
1646 | 1715 |
|
1647 | 1716 |
$report->set_options('top_info_text' => join("\n", @options), |
1648 | 1717 |
'output_format' => 'HTML', |
... | ... | |
1656 | 1725 |
my %subtotals = map { $_ => 0 } @periods; |
1657 | 1726 |
my %totals = map { $_ => 0 } @periods; |
1658 | 1727 |
|
1659 |
foreach $ref (@{ $form->{AG} }) { |
|
1728 |
foreach my $ref (@{ $form->{AG} }) {
|
|
1660 | 1729 |
if ($row_idx && ($previous_ctid != $ref->{ctid})) { |
1661 | 1730 |
$report->add_data(create_aging_subtotal_row(\%subtotals, \@columns, \@periods, 'listsubtotal')); |
1662 | 1731 |
} |
... | ... | |
1698 | 1767 |
$report->add_data(create_aging_subtotal_row(\%totals, \@columns, \@periods, 'listtotal')); |
1699 | 1768 |
|
1700 | 1769 |
if ($form->{arap} eq 'ar') { |
1701 |
$raw_top_info_text = $form->parse_html_template('rp/aging_ar_top'); |
|
1702 |
$raw_bottom_info_text = $form->parse_html_template('rp/aging_ar_bottom', { 'row_idx' => $row_idx, |
|
1770 |
my $raw_top_info_text = $form->parse_html_template('rp/aging_ar_top');
|
|
1771 |
my $raw_bottom_info_text = $form->parse_html_template('rp/aging_ar_bottom', { 'row_idx' => $row_idx,
|
|
1703 | 1772 |
'PRINT_OPTIONS' => print_options(inline => 1), }); |
1704 | 1773 |
$report->set_options('raw_top_info_text' => $raw_top_info_text, |
1705 | 1774 |
'raw_bottom_info_text' => $raw_bottom_info_text); |
... | ... | |
1709 | 1778 |
|
1710 | 1779 |
$report->generate_with_headers(); |
1711 | 1780 |
|
1712 |
$lxdebug->leave_sub(); |
|
1781 |
$main::lxdebug->leave_sub();
|
|
1713 | 1782 |
} |
1714 | 1783 |
|
1715 | 1784 |
sub select_all { |
1716 |
$lxdebug->enter_sub(); |
|
1785 |
$main::lxdebug->enter_sub(); |
|
1786 |
|
|
1787 |
my $form = $main::form; |
|
1788 |
my %myconfig = %main::myconfig; |
|
1789 |
my $locale = $main::locale; |
|
1717 | 1790 |
|
1718 | 1791 |
RP->aging(\%myconfig, \%$form); |
1719 | 1792 |
|
... | ... | |
1721 | 1794 |
|
1722 | 1795 |
&aging; |
1723 | 1796 |
|
1724 |
$lxdebug->leave_sub(); |
|
1797 |
$main::lxdebug->leave_sub();
|
|
1725 | 1798 |
} |
1726 | 1799 |
|
1727 | 1800 |
sub e_mail { |
1728 |
$lxdebug->enter_sub(); |
|
1801 |
$main::lxdebug->enter_sub();
|
|
1729 | 1802 |
|
1730 |
$auth->assert('general_ledger'); |
|
1803 |
$main::auth->assert('general_ledger'); |
|
1804 |
|
|
1805 |
my $form = $main::form; |
|
1806 |
my %myconfig = %main::myconfig; |
|
1807 |
my $locale = $main::locale; |
|
1731 | 1808 |
|
1732 | 1809 |
# get name and email addresses |
1733 |
for $i (1 .. $form->{rowcount}) { |
|
1810 |
my $selected = 0; |
|
1811 |
for my $i (1 .. $form->{rowcount}) { |
|
1734 | 1812 |
if ($form->{"statement_$i"}) { |
1735 | 1813 |
$form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"}; |
1736 | 1814 |
RP->get_customer(\%myconfig, \%$form); |
... | ... | |
1741 | 1819 |
|
1742 | 1820 |
$form->error($locale->text('Nothing selected!')) unless $selected; |
1743 | 1821 |
|
1822 |
my $bcc = ''; |
|
1744 | 1823 |
if ($myconfig{role} eq 'admin') { |
1745 | 1824 |
$bcc = qq| |
1746 | 1825 |
<th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th> |
... | ... | |
1748 | 1827 |
|; |
1749 | 1828 |
} |
1750 | 1829 |
|
1751 |
$title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}"; |
|
1830 |
my $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
|
|
1752 | 1831 |
|
1753 | 1832 |
$form->{media} = "email"; |
1754 | 1833 |
|
... | ... | |
1803 | 1882 |
qw(action email cc bcc subject message type sendmode format header); |
1804 | 1883 |
|
1805 | 1884 |
# save all other variables |
1806 |
foreach $key (keys %$form) { |
|
1885 |
foreach my $key (keys %$form) {
|
|
1807 | 1886 |
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); |
1808 | 1887 |
$form->{$key} =~ s/\"/"/g; |
1809 | 1888 |
print qq|<input type=hidden name=$key value="$form->{$key}">\n|; |
... | ... | |
1828 | 1907 |
</html> |
1829 | 1908 |
|; |
1830 | 1909 |
|
1831 |
$lxdebug->leave_sub(); |
|
1910 |
$main::lxdebug->leave_sub();
|
|
1832 | 1911 |
} |
1833 | 1912 |
|
1834 | 1913 |
sub send_email { |
1835 |
$lxdebug->enter_sub(); |
|
1914 |
$main::lxdebug->enter_sub(); |
|
1915 |
|
|
1916 |
$main::auth->assert('general_ledger'); |
|
1836 | 1917 |
|
1837 |
$auth->assert('general_ledger'); |
|
1918 |
my $form = $main::form; |
|
1919 |
my %myconfig = %main::myconfig; |
|
1920 |
my $locale = $main::locale; |
|
1838 | 1921 |
|
1839 | 1922 |
$form->{subject} = $locale->text('Statement') . qq| - $form->{todate}| |
1840 | 1923 |
unless $form->{subject}; |
... | ... | |
1848 | 1931 |
|
1849 | 1932 |
$form->redirect($locale->text('Statement sent to') . " $form->{$form->{ct}}"); |
1850 | 1933 |
|
1851 |
$lxdebug->leave_sub(); |
|
1934 |
$main::lxdebug->leave_sub();
|
|
1852 | 1935 |
} |
1853 | 1936 |
|
1854 | 1937 |
sub print { |
1855 |
$lxdebug->enter_sub(); |
|
1938 |
$main::lxdebug->enter_sub();
|
|
1856 | 1939 |
|
1857 |
$auth->assert('general_ledger'); |
|
1940 |
$main::auth->assert('general_ledger'); |
|
1941 |
|
|
1942 |
my $form = $main::form; |
|
1943 |
my %myconfig = %main::myconfig; |
|
1944 |
my $locale = $main::locale; |
|
1858 | 1945 |
|
1859 | 1946 |
if ($form->{media} eq 'printer') { |
1860 | 1947 |
$form->error($locale->text('Select postscript or PDF!')) |
1861 | 1948 |
if ($form->{format} !~ /(postscript|pdf)/); |
1862 | 1949 |
} |
1863 | 1950 |
|
1864 |
for $i (1 .. $form->{rowcount}) { |
|
1951 |
my $selected = 0; |
|
1952 |
for my $i (1 .. $form->{rowcount}) { |
|
1865 | 1953 |
if ($form->{"statement_$i"}) { |
1866 | 1954 |
$form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"}; |
1867 | 1955 |
$selected = 1; |
... | ... | |
1884 | 1972 |
$form->redirect($locale->text('Statements sent to printer!')) |
1885 | 1973 |
if ($form->{media} eq 'printer'); |
1886 | 1974 |
|
1887 |
$lxdebug->leave_sub(); |
|
1975 |
$main::lxdebug->leave_sub();
|
|
1888 | 1976 |
} |
1889 | 1977 |
|
1890 | 1978 |
sub print_form { |
1891 |
$lxdebug->enter_sub(); |
|
1979 |
$main::lxdebug->enter_sub(); |
|
1980 |
|
|
1981 |
$main::auth->assert('general_ledger'); |
|
1892 | 1982 |
|
1893 |
$auth->assert('general_ledger'); |
|
1983 |
my $form = $main::form; |
|
1984 |
my %myconfig = %main::myconfig; |
|
1985 |
my $locale = $main::locale; |
|
1894 | 1986 |
|
1895 | 1987 |
$form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1); |
1896 | 1988 |
|
... | ... | |
1914 | 2006 |
# Save $form->{email} because it will be overwritten. |
1915 | 2007 |
$form->{EMAIL_RECIPIENT} = $form->{email}; |
1916 | 2008 |
|
1917 |
$i = 0; |
|
2009 |
my $i = 0; |
|
2010 |
my $ctid; |
|
1918 | 2011 |
while (@{ $form->{AG} }) { |
1919 | 2012 |
|
1920 |
$ref = shift @{ $form->{AG} }; |
|
2013 |
my $ref = shift @{ $form->{AG} };
|
|
1921 | 2014 |
|
1922 | 2015 |
if ($ctid != $ref->{ctid}) { |
1923 | 2016 |
|
... | ... | |
1926 | 2019 |
|
1927 | 2020 |
if ($form->{"statement_$i"}) { |
1928 | 2021 |
|
1929 |
@a = |
|
1930 |
(name, street, zipcode, city, country, contact, email,
|
|
2022 |
my @a =
|
|
2023 |
("name", "street", "zipcode", "city", "country", "contact", "email",
|
|
1931 | 2024 |
"$form->{ct}phone", "$form->{ct}fax"); |
1932 | 2025 |
map { $form->{$_} = $ref->{$_} } @a; |
1933 | 2026 |
|
... | ... | |
1936 | 2029 |
|
1937 | 2030 |
map { $form->{$_} = () } qw(invnumber invdate duedate); |
1938 | 2031 |
$form->{total} = 0; |
1939 |
foreach $item (qw(c0 c30 c60 c90)) { |
|
2032 |
foreach my $item (qw(c0 c30 c60 c90)) {
|
|
1940 | 2033 |
$form->{$item} = (); |
1941 | 2034 |
$form->{"${item}total"} = 0; |
1942 | 2035 |
} |
... | ... | |
1968 | 2061 |
map { |
1969 | 2062 |
$form->{"${_}total"} = |
1970 | 2063 |
$form->format_amount(\%myconfig, $form->{"${_}total"}, 2) |
1971 |
} (c0, c30, c60, c90, "");
|
|
2064 |
} ('c0', 'c30', 'c60', 'c90', "");
|
|
1972 | 2065 |
|
1973 | 2066 |
$form->{attachment_filename} = $locale->quote_special_chars('filenames', $locale->text("Statement") . "_$form->{todate}.$attachment_suffix"); |
1974 | 2067 |
$form->{attachment_filename} =~ s/\s+/_/g; |
1975 | 2068 |
|
1976 |
$form->parse_template(\%myconfig, $userspath); |
|
2069 |
$form->parse_template(\%myconfig, $main::userspath);
|
|
1977 | 2070 |
|
1978 | 2071 |
} |
1979 | 2072 |
} |
... | ... | |
1986 | 2079 |
$form->save_history($form->dbconnect(\%myconfig)); |
1987 | 2080 |
} |
1988 | 2081 |
# /saving the history |
1989 |
$lxdebug->leave_sub(); |
|
2082 |
$main::lxdebug->leave_sub();
|
|
1990 | 2083 |
} |
1991 | 2084 |
|
1992 | 2085 |
sub statement_details { |
1993 |
$lxdebug->enter_sub(); |
|
2086 |
$main::lxdebug->enter_sub();
|
|
1994 | 2087 |
|
1995 |
$auth->assert('general_ledger'); |
|
2088 |
$main::auth->assert('general_ledger'); |
|
2089 |
|
|
2090 |
my $form = $main::form; |
|
2091 |
my %myconfig = %main::myconfig; |
|
2092 |
my $locale = $main::locale; |
|
1996 | 2093 |
|
1997 | 2094 |
my ($ref) = @_; |
1998 | 2095 |
|
... | ... | |
2000 | 2097 |
push @{ $form->{invdate} }, $ref->{transdate}; |
2001 | 2098 |
push @{ $form->{duedate} }, $ref->{duedate}; |
2002 | 2099 |
|
2003 |
foreach $item (qw(c0 c30 c60 c90)) { |
|
2100 |
foreach my $item (qw(c0 c30 c60 c90)) {
|
|
2004 | 2101 |
if ($ref->{exchangerate} * 1) { |
2005 | 2102 |
$ref->{$item} = |
2006 | 2103 |
$form->round_amount($ref->{$item} / $ref->{exchangerate}, 2); |
... | ... | |
2011 | 2108 |
$form->format_amount(\%myconfig, $ref->{$item}, 2); |
2012 | 2109 |
} |
2013 | 2110 |
|
2014 |
$lxdebug->leave_sub(); |
|
2111 |
$main::lxdebug->leave_sub();
|
|
2015 | 2112 |
} |
2016 | 2113 |
|
2017 | 2114 |
sub generate_tax_report { |
2018 |
$lxdebug->enter_sub(); |
|
2115 |
$main::lxdebug->enter_sub(); |
|
2116 |
|
|
2117 |
$main::auth->assert('report'); |
|
2019 | 2118 |
|
2020 |
$auth->assert('report'); |
|
2119 |
my $form = $main::form; |
|
2120 |
my %myconfig = %main::myconfig; |
|
2121 |
my $locale = $main::locale; |
|
2021 | 2122 |
|
2022 | 2123 |
RP->tax_report(\%myconfig, \%$form); |
2023 | 2124 |
|
2024 |
$descvar = "$form->{accno}_description"; |
|
2025 |
$description = $form->escape($form->{$descvar}); |
|
2026 |
$ratevar = "$form->{accno}_rate"; |
|
2125 |
my $descvar = "$form->{accno}_description"; |
|
2126 |
my $description = $form->escape($form->{$descvar}); |
|
2127 |
my $ratevar = "$form->{accno}_rate"; |
|
2128 |
our $taxrate; # most likely error |
|
2027 | 2129 |
|
2028 |
$department = $form->escape($form->{department}); |
|
2130 |
my $department = $form->escape($form->{department});
|
|
2029 | 2131 |
|
2030 | 2132 |
# construct href |
2031 |
$href = |
|
2133 |
my $href =
|
|
2032 | 2134 |
"$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; |
2033 | 2135 |
|
2034 | 2136 |
# construct callback |
2035 | 2137 |
$description = $form->escape($form->{$descvar}, 1); |
2036 | 2138 |
$department = $form->escape($form->{department}, 1); |
2037 |
$callback = |
|
2139 |
my $callback =
|
|
2038 | 2140 |
"$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}"; |
2039 | 2141 |
|
2040 |
$title = $form->escape($form->{title}); |
|
2142 |
my $title = $form->escape($form->{title});
|
|
2041 | 2143 |
$href .= "&title=$title"; |
2042 | 2144 |
$title = $form->escape($form->{title}, 1); |
2043 | 2145 |
$callback .= "&title=$title"; |
2044 | 2146 |
|
2045 | 2147 |
$form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |; |
2046 | 2148 |
|
2047 |
@columns = |
|
2149 |
my @columns =
|
|
2048 | 2150 |
$form->sort_columns(qw(id transdate invnumber name netamount tax amount)); |
2049 | 2151 |
|
2050 |
foreach $item (@columns) { |
|
2152 |
foreach my $item (@columns) {
|
|
2051 | 2153 |
if ($form->{"l_$item"} eq "Y") { |
2052 | 2154 |
push @column_index, $item; |
2053 | 2155 |
|
... | ... | |
2062 | 2164 |
$href .= "&l_subtotal=Y"; |
2063 | 2165 |
} |
2064 | 2166 |
|
2167 |
my $option; |
|
2065 | 2168 |
if ($form->{department}) { |
2066 | 2169 |
($department) = split /--/, $form->{department}; |
2067 | 2170 |
$option = $locale->text('Department') . " : $department"; |
2068 | 2171 |
} |
2069 | 2172 |
|
2173 |
my ($fromdate, $todate); |
|
2070 | 2174 |
# if there are any dates |
2071 | 2175 |
if ($form->{fromdate} || $form->{todate}) { |
2072 | 2176 |
if ($form->{fromdate}) { |
... | ... | |
2082 | 2186 |
$locale->date(\%myconfig, $form->current_date(\%myconfig), 1); |
2083 | 2187 |
} |
2084 | 2188 |
|
2189 |
my ($name, $invoice, $arap); |
|
2085 | 2190 |
if ($form->{db} eq 'ar') { |
2086 | 2191 |
$name = $locale->text('Customer'); |
2087 | 2192 |
$invoice = 'is.pl'; |
... | ... | |
2096 | 2201 |
$option .= "<br>" if $option; |
2097 | 2202 |
$option .= "$form->{period}"; |
2098 | 2203 |
|
2204 |
my %column_header; |
|
2099 | 2205 |
$column_header{id} = qq|<th><a class=listheading href=$href&sort=id>| . $locale->text('ID') . qq|</th>|; |
2100 | 2206 |
$column_header{invnumber} = qq|<th><a class=listheading href=$href&sort=invnumber>| . $locale->text('Invoice') . qq|</th>|; |
2101 | 2207 |
$column_header{transdate} = qq|<th><a class=listheading href=$href&sort=transdate>| . $locale->text('Date') . qq|</th>|; |
... | ... | |
2112 | 2218 |
|
2113 | 2219 |
<table width=100%> |
2114 | 2220 |
<tr> |
2115 |
<th class=listtop colspan=$colspan>$form->{title}</th>
|
|
2221 |
<th class=listtop>$form->{title}</th> |
|
2116 | 2222 |
</tr> |
2117 | 2223 |
<tr height="5"></tr> |
2118 | 2224 |
<tr> |
... | ... | |
2133 | 2239 |
# add sort and escape callback |
2134 | 2240 |
$callback = $form->escape($callback . "&sort=$form->{sort}"); |
2135 | 2241 |
|
2242 |
my $sameitem; |
|
2136 | 2243 |
if (@{ $form->{TR} }) { |
2137 | 2244 |
$sameitem = $form->{TR}->[0]->{ $form->{sort} }; |
2138 | 2245 |
} |
2139 | 2246 |
|
2140 |
foreach $ref (@{ $form->{TR} }) { |
|
2247 |
my ($totalnetamount, $totaltax); |
|
2248 |
my ($i); |
|
2249 |
foreach my $ref (@{ $form->{TR} }) { |
|
2141 | 2250 |
|
2142 |
$module = ($ref->{invoice}) ? $invoice : $arap; |
|
2251 |
my $module = ($ref->{invoice}) ? $invoice : $arap;
|
|
2143 | 2252 |
|
2144 | 2253 |
if ($form->{l_subtotal} eq 'Y') { |
2145 | 2254 |
if ($sameitem ne $ref->{ $form->{sort} }) { |
... | ... | |
2193 | 2302 |
<tr class=listtotal> |
2194 | 2303 |
|; |
2195 | 2304 |
|
2196 |
$total = |
|
2197 |
$form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " "); |
|
2198 |
$totalnetamount = |
|
2199 |
$form->format_amount(\%myconfig, $totalnetamount, 2, " "); |
|
2200 |
$totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " "); |
|
2305 |
my $total = $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " "); |
|
2306 |
$totalnetamount = $form->format_amount(\%myconfig, $totalnetamount, 2, " "); |
|
2307 |
$totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " "); |
|
2201 | 2308 |
|
2202 |
$column_data{netamount} = |
|
2203 |
qq|<th class=listtotal align=right>$totalnetamount</th>|; |
|
2309 |
$column_data{netamount} = qq|<th class=listtotal align=right>$totalnetamount</th>|; |
|
2204 | 2310 |
$column_data{tax} = qq|<th class=listtotal align=right>$totaltax</th>|; |
2205 | 2311 |
$column_data{amount} = qq|<th class=listtotal align=right>$total</th>|; |
2206 | 2312 |
|
... | ... | |
2220 | 2326 |
</html> |
2221 | 2327 |
|; |
2222 | 2328 |
|
2223 |
$lxdebug->leave_sub(); |
|
2329 |
$main::lxdebug->leave_sub();
|
|
2224 | 2330 |
} |
2225 | 2331 |
|
2226 | 2332 |
sub tax_subtotal { |
2227 |
$lxdebug->enter_sub(); |
|
2333 |
$main::lxdebug->enter_sub(); |
|
2334 |
|
|
2335 |
my $form = $main::form; |
|
2336 |
my %myconfig = %main::myconfig; |
|
2337 |
my $locale = $main::locale; |
|
2228 | 2338 |
|
2229 | 2339 |
map { $column_data{$_} = "<td> </td>" } @column_index; |
2230 | 2340 |
|
2231 |
$subtotalnetamount = |
|
2232 |
$form->format_amount(\%myconfig, $subtotalnetamount, 2, " "); |
|
2233 |
$subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " "); |
|
2234 |
$subtotal = |
|
2235 |
$form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax, |
|
2236 |
2, " "); |
|
2341 |
$subtotalnetamount = $form->format_amount(\%myconfig, $subtotalnetamount, 2, " "); |
|
2342 |
$subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " "); |
|
2343 |
$subtotal = $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax, 2, " "); |
|
2237 | 2344 |
|
2238 |
$column_data{netamount} = |
|
2239 |
"<th class=listsubtotal align=right>$subtotalnetamount</th>"; |
|
2240 |
$column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>"; |
|
2241 |
$column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>"; |
|
2345 |
$column_data{netamount} = "<th class=listsubtotal align=right>$subtotalnetamount</th>"; |
|
2346 |
$column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>"; |
|
2347 |
$column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>"; |
|
2242 | 2348 |
|
2243 | 2349 |
$subtotalnetamount = 0; |
2244 | 2350 |
$subtotaltax = 0; |
... | ... | |
2252 | 2358 |
</tr> |
2253 | 2359 |
|; |
2254 | 2360 |
|
2255 |
$lxdebug->leave_sub(); |
|
2361 |
$main::lxdebug->leave_sub();
|
|
2256 | 2362 |
} |
2257 | 2363 |
|
2258 | 2364 |
sub list_payments { |
2259 |
$lxdebug->enter_sub(); |
|
2365 |
$main::lxdebug->enter_sub();
|
|
2260 | 2366 |
|
2261 |
$auth->assert('cash'); |
|
2367 |
$main::auth->assert('cash'); |
|
2368 |
|
|
2369 |
my $form = $main::form; |
|
2370 |
my %myconfig = %main::myconfig; |
|
2371 |
my $locale = $main::locale; |
|
2262 | 2372 |
|
2263 | 2373 |
if ($form->{account}) { |
2264 | 2374 |
($form->{paymentaccounts}) = split /--/, $form->{account}; |
2265 | 2375 |
} |
2376 |
|
|
2377 |
my $option; |
|
2266 | 2378 |
if ($form->{department}) { |
2267 |
($department, $form->{department_id}) = split /--/, $form->{department}; |
|
2379 |
(my $department, $form->{department_id}) = split /--/, $form->{department};
|
|
2268 | 2380 |
$option = $locale->text('Department') . " : $department"; |
2269 | 2381 |
} |
2270 | 2382 |
|
... | ... | |
2377 | 2489 |
|
2378 | 2490 |
$report->generate_with_headers(); |
2379 | 2491 |
|
2380 |
$lxdebug->leave_sub(); |
|
2492 |
$main::lxdebug->leave_sub();
|
|
2381 | 2493 |
} |
2382 | 2494 |
|
2383 | 2495 |
sub print_options { |
2384 |
$lxdebug->enter_sub(); |
|
2496 |
$main::lxdebug->enter_sub();
|
|
2385 | 2497 |
|
2386 | 2498 |
my ($dont_print) = @_; |
2387 | 2499 |
|
2500 |
my $form = $main::form; |
|
2501 |
my %myconfig = %main::myconfig; |
|
2502 |
my $locale = $main::locale; |
|
2503 |
|
|
2388 | 2504 |
$form->{sendmode} = "attachment"; |
2389 | 2505 |
|
2390 | 2506 |
$form->{"format"} = |
... | ... | |
2402 | 2518 |
$form->{OP}{ $form->{media} } = "selected"; |
2403 | 2519 |
$form->{SM}{ $form->{sendmode} } = "selected"; |
2404 | 2520 |
|
2405 |
$type = qq| |
|
2521 |
my ($media); |
|
2522 |
my $type = qq| |
|
2406 | 2523 |
<option value=statement $form->{PD}{statement}>| |
2407 | 2524 |
. $locale->text('Statement'); |
2408 | 2525 |
|
... | ... | |
2414 | 2531 |
} else { |
2415 | 2532 |
$media = qq| |
2416 | 2533 |
<option value=screen $form->{OP}{screen}>| . $locale->text('Screen'); |
2417 |
if ($myconfig{printer} && $latex_templates) { |
|
2534 |
if ($myconfig{printer} && $main::latex_templates) {
|
|
2418 | 2535 |
$media .= qq| |
2419 | 2536 |
<option value=printer $form->{OP}{printer}>| |
2420 | 2537 |
. $locale->text('Printer'); |
2421 | 2538 |
} |
2422 | 2539 |
} |
2423 | 2540 |
|
2424 |
if ($latex_templates) { |
|
2541 |
my $format; |
|
2542 |
if ($main::latex_templates) { |
|
2425 | 2543 |
$format .= qq| |
2426 | 2544 |
<option value=html $form->{DF}{html}>| . $locale->text('HTML') |
2427 | 2545 |
. qq| <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF') |
... | ... | |
2436 | 2554 |
<td><select name=media>$media</select></td> |
2437 | 2555 |
|; |
2438 | 2556 |
|
2439 |
if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') { |
|
2557 |
if ($myconfig{printer} && $main::latex_templates && $form->{media} ne 'email') {
|
|
2440 | 2558 |
$output .= qq| |
2441 | 2559 |
<td>| . $locale->text('Copies') . qq| |
2442 | 2560 |
<input name=copies size=2 value=$form->{copies}></td> |
... | ... | |
2450 | 2568 |
|
2451 | 2569 |
print $output unless $dont_print; |
2452 | 2570 |
|
2453 |
$lxdebug->leave_sub(); |
|
2571 |
$main::lxdebug->leave_sub();
|
|
2454 | 2572 |
|
2455 | 2573 |
return $output; |
2456 | 2574 |
} |
2457 | 2575 |
|
2458 | 2576 |
sub generate_bwa { |
2459 |
$lxdebug->enter_sub(); |
|
2577 |
$main::lxdebug->enter_sub(); |
|
2578 |
|
|
2579 |
$main::auth->assert('report'); |
|
2460 | 2580 |
|
2461 |
$auth->assert('report'); |
|
2581 |
my $form = $main::form; |
|
2582 |
my %myconfig = %main::myconfig; |
|
2583 |
my $locale = $main::locale; |
|
2462 | 2584 |
|
2463 | 2585 |
$form->{padding} = " "; |
2464 | 2586 |
$form->{bold} = "<b>"; |
... | ... | |
2521 | 2643 |
$form->{fromdate} = "1.2.$form->{year}"; |
2522 | 2644 |
|
2523 | 2645 |
#this works from 1901 to 2099, 1900 and 2100 fail. |
2524 |
$leap = ($form->{year} % 4 == 0) ? "29" : "28"; |
|
2646 |
my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
|
|
2525 | 2647 |
$form->{todate} = "$leap.2.$form->{year}"; |
2526 | 2648 |
$form->{comparefromdate} = "1.01.$form->{year}"; |
2527 | 2649 |
$form->{comparetodate} = "$leap.02.$form->{year}"; |
... | ... | |
2599 | 2721 |
}; |
2600 | 2722 |
} |
2601 | 2723 |
} else { |
2602 |
($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate}); |
|
2724 |
my ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
|
|
2603 | 2725 |
$form->{fromdate} = "${dd}.${mm}.${yy}"; |
2604 | 2726 |
($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{todate}); |
2605 | 2727 |
$form->{todate} = "${dd}.${mm}.${yy}"; |
... | ... | |
2624 | 2746 |
|
2625 | 2747 |
my %germandate = ("dateformat" => "dd.mm.yyyy"); |
2626 | 2748 |
|
2627 |
$longtodate = $locale->date(\%germandate, $form->{todate}, 1); |
|
2628 |
$shorttodate = $locale->date(\%germandate, $form->{todate}, 0); |
|
2749 |
my $longtodate = $locale->date(\%germandate, $form->{todate}, 1);
|
|
2750 |
my $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
|
|
2629 | 2751 |
|
2630 |
$longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1); |
|
2631 |
$shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0); |
|
2752 |
my $longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1);
|
|
2753 |
my $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
|
|
2632 | 2754 |
|
2633 | 2755 |
$form->{this_period} = "$shortfromdate\n$shorttodate"; |
2634 | 2756 |
$form->{period} = |
... | ... | |
2639 | 2761 |
} |
2640 | 2762 |
|
2641 | 2763 |
# setup variables for the form |
2642 |
@a = qw(company address businessnumber); |
|
2764 |
my @a = qw(company address businessnumber);
|
|
2643 | 2765 |
map { $form->{$_} = $myconfig{$_} } @a; |
2644 | 2766 |
$form->{templates} = $myconfig{templates}; |
2645 | 2767 |
|
... | ... | |
2647 | 2769 |
|
2648 | 2770 |
$form->parse_template; |
2649 | 2771 |
|
2650 |
$lxdebug->leave_sub(); |
|
2772 |
$main::lxdebug->leave_sub();
|
|
2651 | 2773 |
} |
2652 | 2774 |
|
Auch abrufbar als: Unified diff
rp strict
Vorsicht. Coding Standard in diesem Modul ist extrem schlecht. Mit
Fehlern zu rechnen.