Revision 0fa80981
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/AP.pm | ||
---|---|---|
73 | 73 |
$form->{exchangerate} = $exchangerate || $form->parse_amount($myconfig, $form->{exchangerate}); |
74 | 74 |
} |
75 | 75 |
|
76 |
for my $i (1 .. $form->{rowcount}) { |
|
77 |
$form->{AP_amounts}{"amount_$i"} = |
|
78 |
(split(/--/, $form->{"AP_amount_$i"}))[0]; |
|
79 |
} |
|
80 |
|
|
81 |
($form->{AP_amounts}{payables}) = split(/--/, $form->{APselected}); |
|
82 |
($form->{AP_payables}) = split(/--/, $form->{APselected}); |
|
76 |
# get the charts selected |
|
77 |
$form->{AP_amounts}{"amount_$_"} = $form->{"AP_amount_chart_id_$_"} for (1 .. $form->{rowcount}); |
|
83 | 78 |
|
84 | 79 |
# calculate the totals while calculating and reformatting the $amount_$i and $tax_$i |
85 | 80 |
($form->{netamount},$form->{total_tax},$form->{invtotal}) = $form->calculate_arap('buy',$form->{taxincluded}, $form->{exchangerate}); |
... | ... | |
167 | 162 |
$query = |
168 | 163 |
qq|INSERT INTO acc_trans | . |
169 | 164 |
qq| (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link)| . |
170 |
qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | . |
|
171 |
qq| ?, ?, ?, ?, ?,| . |
|
172 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|; |
|
173 |
@values = ($form->{id}, $form->{AP_amounts}{"amount_$i"}, |
|
165 |
qq|VALUES (?, ?, ?, ?, ?, ?, ?, (SELECT c.link FROM chart c WHERE c.id = ?))|; |
|
166 |
@values = ($form->{id}, $form->{"AP_amount_chart_id_$i"}, |
|
174 | 167 |
$form->{"amount_$i"}, conv_date($form->{transdate}), |
175 | 168 |
$project_id, $form->{"taxkey_$i"}, conv_i($form->{"tax_id_$i"}), |
176 |
$form->{AP_amounts}{"amount_$i"});
|
|
169 |
$form->{"AP_amount_chart_id_$i"});
|
|
177 | 170 |
do_query($form, $dbh, $query, @values); |
178 | 171 |
|
179 | 172 |
if ($form->{"tax_$i"} != 0) { |
... | ... | |
197 | 190 |
# add payables |
198 | 191 |
$query = |
199 | 192 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey, tax_id, chart_link) | . |
200 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, | .
|
|
201 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?),| .
|
|
193 |
qq|VALUES (?, ?, ?, ?, | .
|
|
194 |
qq| (SELECT taxkey_id FROM chart WHERE id = ?),| .
|
|
202 | 195 |
qq| (SELECT tax_id| . |
203 | 196 |
qq| FROM taxkeys| . |
204 |
qq| WHERE chart_id= (SELECT id | . |
|
205 |
qq| FROM chart| . |
|
206 |
qq| WHERE accno = ?)| . |
|
197 |
qq| WHERE chart_id = ?| . |
|
207 | 198 |
qq| AND startdate <= ?| . |
208 | 199 |
qq| ORDER BY startdate DESC LIMIT 1),| . |
209 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|;
|
|
210 |
@values = ($form->{id}, $form->{AP_amounts}{payables}, $form->{payables},
|
|
211 |
conv_date($form->{transdate}), $form->{AP_amounts}{payables}, $form->{AP_amounts}{payables}, conv_date($form->{transdate}),
|
|
212 |
$form->{AP_amounts}{payables});
|
|
200 |
qq| (SELECT c.link FROM chart c WHERE c.id = ?))|;
|
|
201 |
@values = ($form->{id}, $form->{AP_chart_id}, $form->{payables},
|
|
202 |
conv_date($form->{transdate}), $form->{AP_chart_id}, $form->{AP_chart_id}, conv_date($form->{transdate}),
|
|
203 |
$form->{AP_chart_id});
|
|
213 | 204 |
do_query($form, $dbh, $query, @values); |
214 | 205 |
} |
215 | 206 |
|
... | ... | |
254 | 245 |
if ($form->{payables}) { |
255 | 246 |
$query = |
256 | 247 |
qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link) | . |
257 |
qq|VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, | .
|
|
258 |
qq| (SELECT taxkey_id FROM chart WHERE accno = ?),| .
|
|
248 |
qq|VALUES (?, ?, ?, ?, ?, | .
|
|
249 |
qq| (SELECT taxkey_id FROM chart WHERE id = ?),| .
|
|
259 | 250 |
qq| (SELECT tax_id| . |
260 | 251 |
qq| FROM taxkeys| . |
261 |
qq| WHERE chart_id= (SELECT id | . |
|
262 |
qq| FROM chart| . |
|
263 |
qq| WHERE accno = ?)| . |
|
252 |
qq| WHERE chart_id = ?| . |
|
264 | 253 |
qq| AND startdate <= ?| . |
265 | 254 |
qq| ORDER BY startdate DESC LIMIT 1),| . |
266 |
qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|;
|
|
267 |
@values = ($form->{id}, $form->{AP_payables}, $amount,
|
|
255 |
qq| (SELECT c.link FROM chart c WHERE c.id = ?))|;
|
|
256 |
@values = ($form->{id}, $form->{AP_chart_id}, $amount,
|
|
268 | 257 |
conv_date($form->{"datepaid_$i"}), $project_id, |
269 |
$form->{AP_payables}, $form->{AP_payables}, conv_date($form->{"datepaid_$i"}),
|
|
270 |
$form->{AP_payables});
|
|
258 |
$form->{AP_chart_id}, $form->{AP_chart_id}, conv_date($form->{"datepaid_$i"}),
|
|
259 |
$form->{AP_chart_id});
|
|
271 | 260 |
do_query($form, $dbh, $query, @values); |
272 | 261 |
} |
273 | 262 |
$form->{payables} = $amount; |
... | ... | |
759 | 748 |
$form->{"projectnumber_$k"} = "$form->{acc_trans}{$key}->[$i-1]->{projectnumber}"; |
760 | 749 |
$form->{"oldprojectnumber_$k"} = $form->{"projectnumber_$k"}; |
761 | 750 |
$form->{"project_id_$k"} = "$form->{acc_trans}{$key}->[$i-1]->{project_id}"; |
762 |
} |
|
763 |
|
|
764 |
$form->{"${key}_$k"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}"; |
|
765 |
|
|
766 |
my $q_description = quotemeta($form->{acc_trans}{$key}->[$i-1]->{description}); |
|
767 |
$form->{"select${key}"} =~ |
|
768 |
m/<option value=\" |
|
769 |
($form->{acc_trans}{$key}->[$i-1]->{accno}--[^\"]*) |
|
770 |
\"> |
|
771 |
$form->{acc_trans}{$key}->[$i-1]->{accno} |
|
772 |
-- |
|
773 |
${q_description} |
|
774 |
<\/option>\n/x; |
|
775 |
$form->{"${key}_$k"} = $1; |
|
776 |
|
|
777 |
if ($akey eq "AP") { |
|
778 |
$form->{APselected} = $form->{acc_trans}{$key}->[$i-1]->{accno}; |
|
779 |
|
|
780 |
} elsif ($akey eq 'amount') { |
|
781 |
$form->{"${key}_$k"} = $form->{acc_trans}{$key}->[$i-1]->{accno} . "--" . $form->{acc_trans}{$key}->[$i-1]->{id}; |
|
751 |
$form->{"${key}_chart_id_$k"} = $form->{acc_trans}{$key}->[$i-1]->{chart_id}; |
|
782 | 752 |
$form->{"taxchart_$k"} = $form->{acc_trans}{$key}->[$i-1]->{id} . "--" . $form->{acc_trans}{$key}->[$i-1]->{rate}; |
783 | 753 |
} |
784 | 754 |
} |
SL/DB/Vendor.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use Rose::DB::Object::Helpers qw(as_tree); |
6 | 6 |
|
7 |
use SL::DBUtils (); |
|
7 | 8 |
use SL::DB::MetaSetup::Vendor; |
8 | 9 |
use SL::DB::Manager::Vendor; |
9 | 10 |
use SL::DB::Helper::IBANValidation; |
... | ... | |
63 | 64 |
sub payment_terms { goto &payment } |
64 | 65 |
sub number { goto &vendornumber } |
65 | 66 |
|
67 |
sub last_used_ap_chart { |
|
68 |
my ($self) = @_; |
|
69 |
|
|
70 |
my $query = <<EOSQL; |
|
71 |
SELECT c.id |
|
72 |
FROM chart c |
|
73 |
JOIN acc_trans ac ON (ac.chart_id = c.id) |
|
74 |
JOIN ap a ON (a.id = ac.trans_id) |
|
75 |
WHERE (a.vendor_id = ?) |
|
76 |
AND (c.category = 'E') |
|
77 |
AND (c.link !~ '_(paid|tax)') |
|
78 |
AND (a.id IN (SELECT max(a2.id) FROM ap a2 WHERE a2.vendor_id = ?)) |
|
79 |
ORDER BY ac.acc_trans_id ASC |
|
80 |
LIMIT 1 |
|
81 |
EOSQL |
|
82 |
|
|
83 |
my ($chart_id) = SL::DBUtils::selectfirst_array_query($::form, $self->db->dbh, $query, ($self->id) x 2); |
|
84 |
|
|
85 |
return if !$chart_id; |
|
86 |
return SL::DB::Chart->load_cached($chart_id); |
|
87 |
} |
|
88 |
|
|
66 | 89 |
1; |
SL/IR.pm | ||
---|---|---|
1172 | 1172 |
} |
1173 | 1173 |
$sth->finish(); |
1174 | 1174 |
|
1175 |
if (!$params->{id} && $params->{type} !~ /_(order|quotation)/) { |
|
1176 |
# setup last accounts used |
|
1177 |
$query = |
|
1178 |
qq|SELECT c.id, c.accno, c.description, c.link, c.category |
|
1179 |
FROM chart c |
|
1180 |
JOIN acc_trans ac ON (ac.chart_id = c.id) |
|
1181 |
JOIN ap a ON (a.id = ac.trans_id) |
|
1182 |
WHERE (a.vendor_id = ?) |
|
1183 |
AND (NOT ((c.link LIKE '%_tax%') OR (c.link LIKE '%_paid%'))) |
|
1184 |
AND (a.id IN (SELECT max(a2.id) FROM ap a2 WHERE a2.vendor_id = ?))|; |
|
1185 |
my $refs = selectall_hashref_query($form, $dbh, $query, $vid, $vid); |
|
1186 |
|
|
1187 |
my $i = 0; |
|
1188 |
for $ref (@$refs) { |
|
1189 |
if ($ref->{category} eq 'E') { |
|
1190 |
$i++; |
|
1191 |
my ($tax_id, $rate); |
|
1192 |
if ($params->{initial_transdate}) { |
|
1193 |
my $tax_query = qq|SELECT tk.tax_id, t.rate FROM taxkeys tk |
|
1194 |
LEFT JOIN tax t ON (tk.tax_id = t.id) |
|
1195 |
WHERE (tk.chart_id = ?) AND (startdate <= ?) |
|
1196 |
ORDER BY tk.startdate DESC |
|
1197 |
LIMIT 1|; |
|
1198 |
($tax_id, $rate) = selectrow_query($form, $dbh, $tax_query, $ref->{id}, $params->{initial_transdate}); |
|
1199 |
$params->{"taxchart_$i"} = "${tax_id}--${rate}"; |
|
1200 |
} |
|
1201 |
|
|
1202 |
$params->{"AP_amount_$i"} = "$ref->{accno}--$tax_id"; |
|
1203 |
} |
|
1204 |
|
|
1205 |
if ($ref->{category} eq 'L') { |
|
1206 |
$params->{APselected} = $params->{AP_1} = $ref->{accno}; |
|
1207 |
} |
|
1208 |
} |
|
1209 |
$params->{rowcount} = $i if ($i && !$params->{type}); |
|
1210 |
} |
|
1211 |
|
|
1212 | 1175 |
$main::lxdebug->leave_sub(); |
1213 | 1176 |
} |
1214 | 1177 |
|
bin/mozilla/ap.pl | ||
---|---|---|
38 | 38 |
|
39 | 39 |
use SL::AP; |
40 | 40 |
use SL::FU; |
41 |
use SL::GL; |
|
41 | 42 |
use SL::IR; |
42 | 43 |
use SL::IS; |
43 | 44 |
use SL::ReportGenerator; |
... | ... | |
101 | 102 |
create_links(dont_save => 1); |
102 | 103 |
$form->{transdate} = $form->{initial_transdate}; |
103 | 104 |
|
105 |
if ($form->{vendor_id}) { |
|
106 |
my $last_used_ap_chart = SL::DB::Vendor->load_cached($form->{vendor_id})->last_used_ap_chart; |
|
107 |
$form->{"AP_amount_chart_id_1"} = $last_used_ap_chart->id if $last_used_ap_chart; |
|
108 |
} |
|
109 |
|
|
104 | 110 |
&display_form; |
105 | 111 |
|
106 | 112 |
$main::lxdebug->leave_sub(); |
... | ... | |
171 | 177 |
$form->{$_} = $saved{$_} for keys %saved; |
172 | 178 |
$form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}"; |
173 | 179 |
$form->{rowcount} = 1; |
180 |
$form->{AP_chart_id} = $form->{acc_trans} && $form->{acc_trans}->{AP} ? $form->{acc_trans}->{AP}->[0]->{chart_id} : $form->{AP_links}->{AP}->[0]->{chart_id}; |
|
174 | 181 |
|
175 | 182 |
# build the popup menus |
176 | 183 |
$form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked"; |
... | ... | |
232 | 239 |
|
233 | 240 |
$::form->{invoice_obj} = SL::DB::PurchaseInvoice->new(id => $::form->{id})->load if $::form->{id}; |
234 | 241 |
|
242 |
$form->{initial_focus} = !($form->{amount_1} * 1) ? 'vendor' : 'row_' . $form->{rowcount}; |
|
243 |
|
|
235 | 244 |
$form->{title_} = $form->{title}; |
236 | 245 |
$form->{title} = $form->{title} eq 'Add' ? $locale->text('Add Accounts Payables Transaction') : $locale->text('Edit Accounts Payables Transaction'); |
237 | 246 |
|
... | ... | |
302 | 311 |
} |
303 | 312 |
|
304 | 313 |
my %charts; |
305 |
my $taxchart_init;
|
|
314 |
my $default_ap_amount_chart_id;
|
|
306 | 315 |
|
307 | 316 |
foreach my $item (@{ $form->{ALL_CHARTS} }) { |
308 | 317 |
if ( grep({ $_ eq 'AP_amount' } @{ $item->{link_split} }) ) { |
309 |
if ( $taxchart_init eq '' ) { |
|
310 |
$taxchart_init = $item->{tax_id}; |
|
311 |
} |
|
318 |
$default_ap_amount_chart_id //= $item->{id}; |
|
312 | 319 |
|
313 |
push(@{ $form->{ALL_CHARTS_AP_amount} }, $item); |
|
314 |
} |
|
315 |
elsif ( grep({ $_ eq 'AP' } @{ $item->{link_split} }) ) { |
|
316 |
push(@{ $form->{ALL_CHARTS_AP} }, $item); |
|
317 |
} |
|
318 |
elsif ( grep({ $_ eq 'AP_paid' } @{ $item->{link_split} }) ) { |
|
320 |
} elsif ( grep({ $_ eq 'AP_paid' } @{ $item->{link_split} }) ) { |
|
319 | 321 |
push(@{ $form->{ALL_CHARTS_AP_paid} }, $item); |
320 | 322 |
} |
321 | 323 |
|
... | ... | |
324 | 326 |
|
325 | 327 |
my %taxcharts = (); |
326 | 328 |
foreach my $item (@{ $form->{ALL_TAXCHARTS} }) { |
327 |
my $key = $item->{id} .'--'. $item->{rate}; |
|
328 |
|
|
329 |
if ( $taxchart_init eq $item->{id} ) { |
|
330 |
$taxchart_init = $key; |
|
331 |
} |
|
332 |
|
|
333 | 329 |
$taxcharts{$item->{id}} = $item; |
334 | 330 |
} |
335 | 331 |
|
... | ... | |
337 | 333 |
$follow_up_vc =~ s/--.*?//; |
338 | 334 |
my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)"; |
339 | 335 |
|
340 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|; |
|
341 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|; |
|
342 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/follow_up.js"></script>|; |
|
343 |
$form->{javascript} .= qq|<script type="text/javascript" src="js/kivi.Draft.js"></script>|; |
|
336 |
$::request->layout->add_javascripts("autocomplete_chart.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js"); |
|
337 |
my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; |
|
338 |
my $first_taxchart; |
|
344 | 339 |
|
345 | 340 |
$form->header(); |
346 | 341 |
|
... | ... | |
350 | 345 |
$form->{"amount_$i"} = $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2); |
351 | 346 |
$form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2); |
352 | 347 |
|
353 |
my $selected_accno_full; |
|
354 |
my ($accno_row) = split(/--/, $form->{"AP_amount_$i"}); |
|
355 |
my $item = $charts{$accno_row}; |
|
356 |
$selected_accno_full = "$item->{accno}--$item->{tax_id}"; |
|
348 |
my ($default_taxchart, $taxchart_to_use); |
|
349 |
my $amount_chart_id = $form->{"AP_amount_chart_id_$i"} || $default_ap_amount_chart_id; |
|
350 |
my $chart_has_changed = $::form->{"previous_AP_amount_chart_id_$i"} && ($amount_chart_id != $::form->{"previous_AP_amount_chart_id_$i"}); |
|
357 | 351 |
|
358 |
my $selected_taxchart = $form->{"taxchart_$i"}; |
|
359 |
my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full); |
|
360 |
my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_AP_amount_$i"}); |
|
361 |
|
|
362 |
if ($previous_accno && |
|
363 |
($previous_accno eq $selected_accno) && |
|
364 |
($previous_tax_id ne $selected_tax_id)) { |
|
365 |
my $item = $taxcharts{$selected_tax_id}; |
|
366 |
$selected_taxchart = "$item->{id}--$item->{rate}"; |
|
352 |
foreach my $item ( GL->get_active_taxes_for_chart($amount_chart_id, $transdate) ) { |
|
353 |
my $key = $item->id . "--" . $item->rate; |
|
354 |
$first_taxchart //= $item; |
|
355 |
$default_taxchart = $item if $item->{is_default}; |
|
356 |
$taxchart_to_use = $item if $key eq $form->{"taxchart_$i"}; |
|
367 | 357 |
} |
368 | 358 |
|
369 |
$selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"}); |
|
370 |
|
|
371 |
$form->{'selected_accno_full_'. $i} = $selected_accno_full; |
|
372 |
|
|
373 |
$form->{'selected_taxchart_'. $i} = $selected_taxchart; |
|
359 |
$taxchart_to_use = $default_taxchart // $first_taxchart if $chart_has_changed || !$taxchart_to_use; |
|
360 |
my $selected_taxchart = $taxchart_to_use->id . '--' . $taxchart_to_use->rate; |
|
361 |
$form->{"selected_taxchart_$i"} = $selected_taxchart; |
|
362 |
$form->{"AP_amount_chart_id_$i"} = $amount_chart_id; |
|
374 | 363 |
} |
375 | 364 |
|
376 |
$form->{AP_amount_value_title_sub} = sub { |
|
377 |
my $item = shift; |
|
378 |
return [ |
|
379 |
$item->{accno} .'--'. $item->{tax_id}, |
|
380 |
$item->{accno} .'--'. $item->{description}, |
|
381 |
]; |
|
382 |
}; |
|
383 |
|
|
384 | 365 |
$form->{taxchart_value_title_sub} = sub { |
385 | 366 |
my $item = shift; |
386 | 367 |
return [ |
... | ... | |
397 | 378 |
]; |
398 | 379 |
}; |
399 | 380 |
|
400 |
$form->{APselected_value_title_sub} = sub { |
|
401 |
my $item = shift; |
|
402 |
return [ |
|
403 |
$item->{accno}, |
|
404 |
$item->{accno} .'--'. $item->{description} |
|
405 |
]; |
|
406 |
}; |
|
407 |
|
|
408 | 381 |
$form->{invtotal_unformatted} = $form->{invtotal}; |
409 | 382 |
$form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2); |
410 | 383 |
|
... | ... | |
559 | 532 |
$form->{exchangerate} = $form->{forex} if $form->{forex}; |
560 | 533 |
|
561 | 534 |
$form->{invdate} = $form->{transdate}; |
562 |
my %saved_variables = map +( $_ => $form->{$_} ), qw(AP AP_amount_1 taxchart_1 notes); |
|
563 | 535 |
|
564 | 536 |
my $vendor_changed = &check_name("vendor"); |
565 | 537 |
|
566 |
$form->{AP} = $saved_variables{AP}; |
|
567 |
if ($saved_variables{AP_amount_1} =~ m/.--./) { |
|
568 |
map { $form->{$_} = $saved_variables{$_} } qw(AP_amount_1 taxchart_1); |
|
569 |
} else { |
|
570 |
delete $form->{taxchart_1}; |
|
571 |
} |
|
572 |
|
|
573 | 538 |
$form->{rowcount} = $count + 1; |
574 | 539 |
|
575 | 540 |
$form->{invtotal} = |
... | ... | |
731 | 696 |
&update; |
732 | 697 |
$::dispatcher->end_request; |
733 | 698 |
} |
734 |
my ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected}; |
|
735 |
my ($taxkey, $NULL) = split /--/, $form->{taxchartselected}; |
|
736 |
my ($payablesaccno, $payablestaxkey) = split /--/, $form->{APselected}; |
|
737 |
# $form->{AP_amount_1} = $debitaccno; |
|
738 |
$form->{AP_payables} = $payablesaccno; |
|
739 |
$form->{taxkey} = $taxkey; |
|
740 | 699 |
$form->{storno} = 0; |
741 | 700 |
|
742 | 701 |
$form->{id} = 0 if $form->{postasnew}; |
templates/webpages/ap/form_footer.html | ||
---|---|---|
43 | 43 |
[%- END %] |
44 | 44 |
|
45 | 45 |
</form> |
46 |
|
|
47 |
<script type="text/javascript"> |
|
48 |
<!-- |
|
49 |
$(document).ready(function() { |
|
50 |
[%- SET row=0 %] |
|
51 |
[%- WHILE row < rowcount %] |
|
52 |
[%- SET row=row + 1 %] |
|
53 |
$('#AP_amount_chart_id_[% row %]').on('set_item:ChartPicker', function(e, item) { |
|
54 |
kivi.GL.update_taxes(this); |
|
55 |
}); |
|
56 |
[%- END %] |
|
57 |
}); |
|
58 |
--> |
|
59 |
</script> |
templates/webpages/ap/form_header.html | ||
---|---|---|
1 | 1 |
[%- USE L %] |
2 | 2 |
[%- USE HTML %] |
3 | 3 |
[%- USE T8 %] |
4 |
[%- USE LxERP %] |
|
5 |
|
|
6 |
<script type="text/javascript"> |
|
7 |
<!-- |
|
8 |
function setTaxkey(accno, row) { |
|
9 |
var taxkey = accno.options[accno.selectedIndex].value; |
|
10 |
var reg = /--([0-9]*)/; |
|
11 |
var found = reg.exec(taxkey); |
|
12 |
var index = found[1]; |
|
13 |
index = parseInt(index); |
|
14 |
var tax = 'taxchart_' + row; |
|
15 |
for (var i = 0; i < document.getElementById(tax).options.length; ++i) { |
|
16 |
var reg2 = new RegExp("^"+ index, ""); |
|
17 |
if (reg2.exec(document.getElementById(tax).options[i].value)) { |
|
18 |
document.getElementById(tax).options[i].selected = true; |
|
19 |
break; |
|
20 |
} |
|
21 |
} |
|
22 |
}; |
|
23 |
//--> |
|
24 |
</script> |
|
25 |
|
|
26 |
<script type="text/javascript" src="js/show_history.js"></script> |
|
4 |
[%- USE LxERP %][%- USE P -%] |
|
27 | 5 |
|
28 | 6 |
<form method="post" action="[% script | html %]"> |
29 | 7 |
|
... | ... | |
104 | 82 |
<th align="right" nowrap>[% 'Vendor' | $T8 %]</th> |
105 | 83 |
<td colspan="3"> |
106 | 84 |
[% IF ( selectvendor ) %] |
107 |
<select name="vendor" onchange="document.getElementById('update_button').click();">[% selectvendor %]</select> |
|
85 |
<select name="vendor" onchange="document.getElementById('update_button').click();"[% IF initial_focus == 'vendor' %] class="initial_focus"[% END %]>[% selectvendor %]</select>
|
|
108 | 86 |
[% ELSE %] |
109 |
<input name=vendor value="[% vendor | html %]" size="35"> |
|
87 |
<input name=vendor value="[% vendor | html %]" size="35"[% IF initial_focus == 'vendor' %] class="initial_focus"[% END %]>
|
|
110 | 88 |
[% END %] |
111 | 89 |
<input type="button" value="D" onclick="show_vc_details('vendor')"> |
112 | 90 |
</td> |
... | ... | |
211 | 189 |
[% FOREACH i IN [1..rowcount] %] |
212 | 190 |
<tr> |
213 | 191 |
<td> |
214 |
[% selected_accno_full = "selected_accno_full_"_ i %] |
|
215 |
[% L.select_tag('AP_amount_'_ i, ALL_CHARTS_AP_amount, value_title_sub = \AP_amount_value_title_sub, onchange = 'setTaxkey(this, '_ i _')', default = $selected_accno_full) %] |
|
216 |
|
|
217 |
<input type="hidden" name="previous_AP_amount_[% i %]" value="[% $selected_accno_full %]"> |
|
192 |
[% SET selected_chart_id = "AP_amount_chart_id_"_ i %] |
|
193 |
[% P.chart_picker("AP_amount_chart_id_" _ i, $selected_chart_id, style="width: 400px", type="AP_amount", class=(initial_focus == 'row_' _ i ? "initial_focus" : "")) %] |
|
194 |
[% L.hidden_tag("previous_AP_amount_chart_id_" _ i, $selected_chart_id) %] |
|
218 | 195 |
<input type="hidden" name="tax_[% i %]" value="[% temp = "tax"_ i %][% $temp | html %]"> |
219 | 196 |
</td> |
220 | 197 |
<td> |
... | ... | |
241 | 218 |
</tr> |
242 | 219 |
<tr> |
243 | 220 |
<td> |
244 |
[% L.select_tag('APselected', ALL_CHARTS_AP, value_title_sub = \APselected_value_title_sub, default = APselected) %]
|
|
221 |
[% P.chart_picker('AP_chart_id', AP_chart_id, style="width: 400px", type="AP") %]
|
|
245 | 222 |
</td> |
246 | 223 |
<th align="left">[% invtotal | html %]</th> |
247 | 224 |
<td colspan="4"></td> |
Auch abrufbar als: Unified diff
Kreditorenbuchungen auf Verwendung des Chart-Pickers umgestellt