Revision a873249c
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
bin/mozilla/vk.pl | ||
---|---|---|
87 | 87 |
my ($callback, $href, @columns); |
88 | 88 |
|
89 | 89 |
$form->{customer} = $form->unescape($form->{customer}); |
90 |
|
|
90 |
|
|
91 | 91 |
($form->{customername}, $form->{customer_id}) = split(/--/, $form->{customer}); |
92 | 92 |
|
93 | 93 |
# decimalplaces überprüfen oder auf Default 2 setzen |
... | ... | |
137 | 137 |
'marge_total' => { 'text' => $locale->text('Sales margin'), }, |
138 | 138 |
'marge_percent' => { 'text' => $locale->text('Sales margin %'), }, |
139 | 139 |
); |
140 |
|
|
140 |
|
|
141 | 141 |
my %column_alignment = map { $_ => 'right' } qw(lastcost sellprice sellprice_total lastcost_total unit discount marge_total marge_percent qty); |
142 | 142 |
|
143 | 143 |
$form->{"l_type"} = "Y"; |
... | ... | |
188 | 188 |
'attachment_basename' => $locale->text('Sales Report') . strftime('_%Y%m%d', localtime time), |
189 | 189 |
); |
190 | 190 |
$report->set_options_from_form(); |
191 |
$locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; |
|
191 | 192 |
|
192 | 193 |
$report->set_columns(%column_defs); |
193 | 194 |
$report->set_column_order(@columns); |
... | ... | |
222 | 223 |
$ar->{sellprice} = $ar->{sellprice} / $ar->{price_factor}; |
223 | 224 |
$ar->{lastcost} = $ar->{lastcost} / $ar->{price_factor}; |
224 | 225 |
$ar->{sellprice_total} = $ar->{qty} * $ar->{sellprice}; |
225 |
$ar->{lastcost_total} = $ar->{qty} * $ar->{lastcost};
|
|
226 |
$ar->{lastcost_total} = $ar->{qty} * $ar->{lastcost}; |
|
226 | 227 |
# marge_percent wird neu berechnet, da Wert in invoice leer ist (Bug) |
227 | 228 |
$ar->{marge_percent} = $ar->{sellprice_total} ? (($ar->{sellprice_total}-$ar->{lastcost_total}) / $ar->{sellprice_total}) : 0; |
228 | 229 |
# marge_total neu berechnen |
... | ... | |
243 | 244 |
$report->add_data($headerrow_set); |
244 | 245 |
|
245 | 246 |
# add empty row after main header |
246 |
# my $emptyheaderrow->{description}->{data} = "";
|
|
247 |
# my $emptyheaderrow->{description}->{data} = ""; |
|
247 | 248 |
# $emptyheaderrow->{description}->{class} = "listmainsortheader"; |
248 | 249 |
# my $emptyheaderrow_set = [ $emptyheaderrow ]; |
249 |
# $report->add_data($emptyheaderrow_set) if $form->{l_headers} eq "Y";
|
|
250 |
# $report->add_data($emptyheaderrow_set) if $form->{l_headers} eq "Y"; |
|
250 | 251 |
}; |
251 | 252 |
|
252 | 253 |
# subsort überschriften |
253 |
if ( $idx == 0
|
|
254 |
if ( $idx == 0 |
|
254 | 255 |
or $ar->{ $form->{'subsort'} } ne $form->{AR}->[$idx - 1]->{ $form->{'subsort'} } |
255 | 256 |
or $ar->{ $form->{'mainsort'} } ne $form->{AR}->[$idx - 1]->{ $form->{'mainsort'} } |
256 | 257 |
) { |
... | ... | |
271 | 272 |
map { $subtotals1{$_} += $ar->{$_}; |
272 | 273 |
$subtotals2{$_} += $ar->{$_}; |
273 | 274 |
} @subtotal_columns; |
274 |
|
|
275 |
map { $totals{$_} += $ar->{$_} } @total_columns;
|
|
275 |
|
|
276 |
map { $totals{$_} += $ar->{$_} } @total_columns; |
|
276 | 277 |
|
277 | 278 |
$subtotals2{sellprice} = $subtotals2{sellprice_total} / $subtotals2{qty} if $subtotals2{qty} != 0; |
278 | 279 |
$subtotals1{sellprice} = $subtotals1{sellprice_total} / $subtotals1{qty} if $subtotals1{qty} != 0; |
... | ... | |
298 | 299 |
'align' => $column_alignment{$column}, |
299 | 300 |
}; |
300 | 301 |
} |
301 |
|
|
302 |
|
|
302 | 303 |
$row->{description}->{class} = 'listsortdescription'; |
303 | 304 |
|
304 | 305 |
$row->{invnumber}->{link} = build_std_url("script=is.pl", 'action=edit') |
... | ... | |
317 | 318 |
} else { |
318 | 319 |
$name = 'name'; |
319 | 320 |
}; |
320 |
|
|
321 |
|
|
321 | 322 |
if ($form->{l_subtotal} eq 'Y' ) { |
322 | 323 |
push @{ $row_set }, create_subtotal_row_invoice(\%subtotals2, \@columns, \%column_alignment, \@subtotal_columns, 'listsubsortsubtotal', $ar->{$name}) ; |
323 | 324 |
push @{ $row_set }, insert_empty_row(); |
324 | 325 |
}; |
325 | 326 |
} |
326 | 327 |
|
327 |
# if mainsort has changed, add mainsort subtotal and empty row
|
|
328 |
# if mainsort has changed, add mainsort subtotal and empty row |
|
328 | 329 |
if (($form->{l_subtotal} eq 'Y') |
329 | 330 |
&& (($idx == (scalar @{ $form->{AR} } - 1)) # last element always has a subtotal |
330 | 331 |
|| ($ar->{ $form->{'mainsort'} } ne $form->{AR}->[$idx + 1]->{ $form->{'mainsort'} }) |
... | ... | |
340 | 341 |
push @{ $row_set }, insert_empty_row(); |
341 | 342 |
}; |
342 | 343 |
} |
343 |
|
|
344 |
|
|
344 | 345 |
$report->add_data($row_set); |
345 | 346 |
|
346 | 347 |
$idx++; |
... | ... | |
373 | 374 |
my %myconfig = %main::myconfig; |
374 | 375 |
|
375 | 376 |
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } }; |
376 |
|
|
377 |
|
|
377 | 378 |
$row->{description}->{data} = "Summe " . $name; |
378 | 379 |
|
379 | 380 |
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } qw(marge_total marge_percent); |
Auch abrufbar als: Unified diff
Zahlen beim CSV-Export ohne Tausendertrennzeichen formatieren
Fix für Bug 1393.