255 |
255 |
);
|
256 |
256 |
|
257 |
257 |
my %project_labels = ();
|
258 |
|
my @project_values = ("");
|
259 |
258 |
foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
|
260 |
|
push(@project_values, $item->{id});
|
261 |
259 |
$project_labels{$item->{id}} = $item->{projectnumber};
|
262 |
260 |
}
|
263 |
261 |
|
264 |
|
my (%AP_amount_labels, @AP_amount_values);
|
265 |
|
my (%AP_labels, @AP_values);
|
266 |
|
my (%AP_paid_labels, @AP_paid_values);
|
267 |
262 |
my %charts;
|
268 |
263 |
my $taxchart_init;
|
269 |
264 |
|
270 |
265 |
foreach my $item (@{ $form->{ALL_CHARTS} }) {
|
271 |
|
if (grep({ $_ eq "AP_amount" } @{ $item->{link_split} })) {
|
272 |
|
$taxchart_init = $item->{tax_id} if ($taxchart_init eq "");
|
273 |
|
my $key = "$item->{accno}--$item->{tax_id}";
|
274 |
|
push(@AP_amount_values, $key);
|
275 |
|
$AP_amount_labels{$key} =
|
276 |
|
"$item->{accno}--$item->{description}";
|
277 |
|
|
278 |
|
} elsif (grep({ $_ eq "AP" } @{ $item->{link_split} })) {
|
279 |
|
push(@AP_values, $item->{accno});
|
280 |
|
$AP_labels{$item->{accno}} = "$item->{accno}--$item->{description}";
|
281 |
|
|
282 |
|
} elsif (grep({ $_ eq "AP_paid" } @{ $item->{link_split} })) {
|
283 |
|
push(@AP_paid_values, $item->{accno});
|
284 |
|
$AP_paid_labels{$item->{accno}} =
|
285 |
|
"$item->{accno}--$item->{description}";
|
|
266 |
if ( grep({ $_ eq 'AP_amount' } @{ $item->{link_split} }) ) {
|
|
267 |
if ( $taxchart_init eq '' ) {
|
|
268 |
$taxchart_init = $item->{tax_id};
|
|
269 |
}
|
|
270 |
|
|
271 |
push(@{ $form->{ALL_CHARTS_AP_amount} }, $item);
|
|
272 |
}
|
|
273 |
elsif ( grep({ $_ eq 'AP' } @{ $item->{link_split} }) ) {
|
|
274 |
push(@{ $form->{ALL_CHARTS_AP} }, $item);
|
|
275 |
}
|
|
276 |
elsif ( grep({ $_ eq 'AP_paid' } @{ $item->{link_split} }) ) {
|
|
277 |
push(@{ $form->{ALL_CHARTS_AP_paid} }, $item);
|
286 |
278 |
}
|
287 |
279 |
|
288 |
280 |
$charts{$item->{accno}} = $item;
|
289 |
281 |
}
|
290 |
282 |
|
291 |
|
my %taxchart_labels = ();
|
292 |
|
my @taxchart_values = ();
|
293 |
283 |
my %taxcharts = ();
|
294 |
284 |
foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
|
295 |
|
my $key = "$item->{id}--$item->{rate}";
|
296 |
|
$taxchart_init = $key if ($taxchart_init eq $item->{id});
|
297 |
|
push(@taxchart_values, $key);
|
298 |
|
$taxchart_labels{$key} =
|
299 |
|
"$item->{taxdescription} " . ($item->{rate} * 100) . ' %';
|
|
285 |
my $key = $item->{id} .'--'. $item->{rate};
|
|
286 |
|
|
287 |
if ( $taxchart_init eq $item->{id} ) {
|
|
288 |
$taxchart_init = $key;
|
|
289 |
}
|
|
290 |
|
300 |
291 |
$taxcharts{$item->{id}} = $item;
|
301 |
292 |
}
|
302 |
293 |
|
... | ... | |
310 |
301 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
|
311 |
302 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/follow_up.js"></script>|;
|
312 |
303 |
|
313 |
|
$form->{globalprojectnumber} =
|
314 |
|
NTI($cgi->popup_menu('-name' => "globalproject_id",
|
315 |
|
'-values' => \@project_values,
|
316 |
|
'-labels' => \%project_labels,
|
317 |
|
'-default' => $form->{"globalproject_id"} ));
|
318 |
|
|
319 |
|
$form->header;
|
|
304 |
$form->header();
|
320 |
305 |
|
321 |
306 |
for my $i (1 .. $form->{rowcount}) {
|
322 |
307 |
|
... | ... | |
342 |
327 |
|
343 |
328 |
$selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"});
|
344 |
329 |
|
345 |
|
$form->{'selectAP_amount_'. $i} =
|
346 |
|
NTI($cgi->popup_menu('-name' => "AP_amount_$i",
|
347 |
|
'-id' => "AP_amount_$i",
|
348 |
|
'-style' => 'width:400px',
|
349 |
|
'-onChange' => "setTaxkey(this, $i)",
|
350 |
|
'-values' => \@AP_amount_values,
|
351 |
|
'-labels' => \%AP_amount_labels,
|
352 |
|
'-default' => $selected_accno_full))
|
353 |
|
. $cgi->hidden('-name' => "previous_AP_amount_$i",
|
354 |
|
'-default' => $selected_accno_full);
|
355 |
|
|
356 |
|
$form->{'select_tax_'. $i} =
|
357 |
|
NTI($cgi->popup_menu('-name' => "taxchart_$i",
|
358 |
|
'-id' => "taxchart_$i",
|
359 |
|
'-style' => 'width:200px',
|
360 |
|
'-values' => \@taxchart_values,
|
361 |
|
'-labels' => \%taxchart_labels,
|
362 |
|
'-default' => $selected_taxchart));
|
363 |
|
|
364 |
|
$form->{'select_projectnumber_'. $i} =
|
365 |
|
NTI($cgi->popup_menu('-name' => "project_id_$i",
|
366 |
|
'-values' => \@project_values,
|
367 |
|
'-labels' => \%project_labels,
|
368 |
|
'-default' => ($i==$form->{rowcount})? $form->{globalproject_id} : $form->{"project_id_$i"} ));
|
|
330 |
$form->{'selected_accno_full_'. $i} = $selected_accno_full;
|
|
331 |
|
|
332 |
$form->{'selected_taxchart_'. $i} = $selected_taxchart;
|
369 |
333 |
}
|
370 |
334 |
|
|
335 |
$form->{AP_amount_value_title_sub} = sub {
|
|
336 |
my $item = shift;
|
|
337 |
return [
|
|
338 |
$item->{accno} .'--'. $item->{tax_id},
|
|
339 |
$item->{accno} .'--'. $item->{description},
|
|
340 |
];
|
|
341 |
};
|
|
342 |
|
|
343 |
$form->{taxchart_value_title_sub} = sub {
|
|
344 |
my $item = shift;
|
|
345 |
return [
|
|
346 |
$item->{id} .'--'. $item->{rate},
|
|
347 |
$item->{taxdescription} .' '. ($item->{rate} * 100) .' %',
|
|
348 |
];
|
|
349 |
};
|
|
350 |
|
|
351 |
$form->{AP_paid_value_title_sub} = sub {
|
|
352 |
my $item = shift;
|
|
353 |
return [
|
|
354 |
$item->{accno},
|
|
355 |
$item->{accno} .'--'. $item->{description}
|
|
356 |
];
|
|
357 |
};
|
|
358 |
|
|
359 |
$form->{APselected_value_title_sub} = sub {
|
|
360 |
my $item = shift;
|
|
361 |
return [
|
|
362 |
$item->{accno},
|
|
363 |
$item->{accno} .'--'. $item->{description}
|
|
364 |
];
|
|
365 |
};
|
371 |
366 |
|
372 |
367 |
$form->{invtotal_unformatted} = $form->{invtotal};
|
373 |
368 |
$form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
|
374 |
369 |
|
375 |
|
$form->{APselected} =
|
376 |
|
NTI($cgi->popup_menu('-name' => "APselected", '-id' => "APselected",
|
377 |
|
'-style' => 'width:400px',
|
378 |
|
'-values' => \@AP_values, '-labels' => \%AP_labels,
|
379 |
|
'-default' => $form->{APselected}));
|
380 |
|
|
381 |
370 |
$form->{totalpaid} = 0;
|
382 |
371 |
|
383 |
372 |
if ( $form->{'paid_'. $form->{paidaccounts}} ) {
|
384 |
373 |
$form->{paidaccounts}++;
|
385 |
374 |
}
|
386 |
375 |
for my $i (1 .. $form->{paidaccounts}) {
|
387 |
|
|
388 |
|
$form->{'selectAP_paid_'. $i} =
|
389 |
|
NTI($cgi->popup_menu('-name' => "AP_paid_$i",
|
390 |
|
'-id' => "AP_paid_$i",
|
391 |
|
'-values' => \@AP_paid_values,
|
392 |
|
'-labels' => \%AP_paid_labels,
|
393 |
|
'-default' => $form->{"AP_paid_$i"}));
|
394 |
|
|
395 |
376 |
$form->{totalpaid} += $form->{"paid_$i"};
|
396 |
377 |
|
397 |
378 |
# format amounts
|
... | ... | |
417 |
398 |
|
418 |
399 |
$form->{'paidaccount_changeable_'. $i} = $changeable;
|
419 |
400 |
|
420 |
|
if ( $changeable ) {
|
421 |
|
$form->{'selectpaid_project_id_'. $i} =
|
422 |
|
NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
|
423 |
|
'-values' => \@project_values,
|
424 |
|
'-labels' => \%project_labels,
|
425 |
|
'-default' => $form->{"paid_project_id_$i"}));
|
426 |
|
} else {
|
427 |
|
$form->{'labelpaid_project_id_'. $i} = $project_labels{$form->{'paid_project_id_'. $i}};
|
428 |
|
}
|
|
401 |
$form->{'labelpaid_project_id_'. $i} = $project_labels{$form->{'paid_project_id_'. $i}};
|
429 |
402 |
}
|
430 |
403 |
|
431 |
404 |
$form->{paid_missing} = $form->{invtotal_unformatted} - $form->{totalpaid};
|
cgi->popup_menu durch L.select_tag (in templates/webpages/ap/form_header.html) ersetzt