my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
my %accnos;
- map { ($accnos{$_}) = split(m/--/, $form->{$_}) } qw(inventory_accno income_accno expense_accno fxgain_accno fxloss_accno);
+ map { ($accnos{$_}) = split(m/--/, $form->{$_}) } qw(inventory_accno income_accno expense_accno fxgain_accno fxloss_accno ar_paid_accno);
$form->{curr} =~ s/ //g;
my @currencies = grep { $_ ne '' } split m/:/, $form->{curr};
expense_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
fxgain_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
fxloss_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
+ ar_paid_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?),
invnumber = ?,
cnnumber = ?,
sonumber = ?,
servicenumber = ?,
sdonumber = ?,
pdonumber = ?,
- yearend = ?,
curr = ?,
businessnumber = ?,
weightunit = ?|;
my @values = ($accnos{inventory_accno}, $accnos{income_accno}, $accnos{expense_accno},
- $accnos{fxgain_accno}, $accnos{fxloss_accno},
+ $accnos{fxgain_accno}, $accnos{fxloss_accno}, $accnos{ar_paid_accno},
$form->{invnumber}, $form->{cnnumber},
$form->{sonumber}, $form->{ponumber},
$form->{sqnumber}, $form->{rfqnumber},
$form->{customernumber}, $form->{vendornumber},
$form->{articlenumber}, $form->{servicenumber},
$form->{sdonumber}, $form->{pdonumber},
- $form->{yearend}, $currency,
+ $currency,
$form->{businessnumber}, $form->{weightunit});
do_query($form, $dbh, $query, @values);
$form->{defaults}{IC_expense} = $form->{defaults}{expense_accno_id};
$form->{defaults}{FX_gain} = $form->{defaults}{fxgain_accno_id};
$form->{defaults}{FX_loss} = $form->{defaults}{fxloss_accno_id};
+ $form->{defaults}{AR_paid} = $form->{defaults}{ar_paid_accno_id};
$form->{defaults}{weightunit} ||= 'kg';
if $ref->{taxnumber};
$form->{taxrates}{ $ref->{accno} }{rate} = $ref->{rate} if $ref->{rate};
}
+ # Abfrage für Standard Umlaufvermögenskonto
+ $query =
+ qq|SELECT id, accno, description, link | .
+ qq|FROM chart | .
+ qq|WHERE link LIKE ? |.
+ qq|ORDER BY accno|;
+ $sth = prepare_execute_query($form, $dbh, $query, '%AR%');
+ $sth->execute || $form->dberror($query);#
+ while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
+ foreach my $item (split(/:/, $ref->{link})) {
+ if ($item eq "AR_paid") {
+ %{ $form->{IC}{AR_paid}{ $ref->{accno} } } = (
+ id => $ref->{id},
+ description => $ref->{description}
+ );
+ }
+ }
+ }
$sth->finish;
$dbh->disconnect;
CP->paymentaccounts(\%myconfig, \%$form);
+ # Standard Konto für Umlaufvermögen
+ my $accno_arap = IS->get_standard_accno_current_assets(\%myconfig, \%$form);
+
$form->{selectaccount} = "";
$form->{"select$form->{ARAP}"} = "";
- map { $form->{selectaccount} .= "<option>$_->{accno}--$_->{description}\n" }
- @{ $form->{PR}{"$form->{ARAP}_paid"} };
- map {
- $form->{"select$form->{ARAP}"} .=
- "<option>$_->{accno}--$_->{description}\n"
- } @{ $form->{PR}{ $form->{ARAP} } };
+ map { $form->{selectaccount} .= "<option>$_->{accno}--$_->{description}\n";
+ $form->{account} = "$_->{accno}--$_->{description}" if ($_->{accno} eq $accno_arap) } @{ $form->{PR}{"$form->{ARAP}_paid"} };
+
+ # Braucht man das hier überhaupt? Erstmal auskommentieren .. jan 18.12.2010
+ # map {
+ # $form->{"select$form->{ARAP}"} .=
+ # "<option>$_->{accno}--$_->{description}\n"
+ # } @{ $form->{PR}{ $form->{ARAP} } };
+ # ENDE LOESCHMICH in 2012
# currencies
# oldcurrency ist zwar noch hier als fragment enthalten, wird aber bei
foreach my $key (keys %{ $form->{AP_links} }) {
foreach my $ref (@{ $form->{AP_links}{$key} }) {
- $form->{"select$key"} .= "<option>$ref->{accno}--$ref->{description}\n";
+ $form->{"select$key"} .= "<option>$ref->{accno}--$ref->{description}</option>";
}
next unless $form->{acc_trans}{$key};
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
$form->{paid_indices} = [ 1 .. $form->{paidaccounts} ];
+ # Standard Konto für Umlaufvermögen
+ my $accno_arap = IS->get_standard_accno_current_assets(\%myconfig, \%$form);
+
for my $i (1 .. $form->{paidaccounts}) {
$form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
- $form->{"selectAP_paid_$i"} =~ s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/;
+ if (!$form->{"AP_paid_$i"}) {
+ $form->{"selectAP_paid_$i"} =~ s/option>$accno_arap--(.*?)>/option selected>$accno_arap--$1>/;
+ } else {
+ $form->{"selectAP_paid_$i"} =~ s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/;
+ }
+
$totalpaid += $form->{"paid_$i"};
}