$main::lxdebug->enter_sub();
my ($self, $myconfig, $amount) = @_;
-
- if (!(substr($amount, -3, 1) eq ".")) {
- if ( ($myconfig->{numberformat} eq '1.000,00')
- || ($myconfig->{numberformat} eq '1000,00')) {
- $amount =~ s/\.//g;
- $amount =~ s/,/\./;
- }
-
- $amount =~ s/,//g;
- }
-
+ $main::lxdebug->message(LXDebug::DEBUG2, "Start amount: $amount");
+
+ if ($myconfig->{in_numberformat} == 1){
+ # Extra input number format 1000.00 or 1000,00
+ $main::lxdebug->message(LXDebug::DEBUG2, "in_numberformat: " . $main::locale->text('1000,00 or 1000.00'));
+ $amount =~ s/,/\./g;
+ #$main::lxdebug->message(LXDebug::DEBUG2, "1.Parsed Number: $amount") if ($amount);
+ $amount = scalar reverse $amount;
+ #$main::lxdebug->message(LXDebug::DEBUG2, "2.Parsed Number: $amount") if ($amount);
+ $amount =~ s/\./DOT/;
+ #$main::lxdebug->message(LXDebug::DEBUG2, "3.Parsed Number: $amount") if ($amount);
+ $amount =~ s/\.//g;
+ #$main::lxdebug->message(LXDebug::DEBUG2, "4.Parsed Number: $amount") if ($amount);
+ $amount =~ s/DOT/\./;
+ #$main::lxdebug->message(LXDebug::DEBUG2, "5.Parsed Number:" . $amount) if ($amount);
+ $amount = scalar reverse $amount ;
+ $main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount . "\n");
+
+ return ($amount * 1);
+
+ }
+ $main::lxdebug->message(LXDebug::DEBUG2, "in_numberformat: " . $main::locale->text('equal Outputformat'));
+ $main::lxdebug->message(LXDebug::DEBUG2, " = numberformat: $myconfig->{numberformat}");
+ if ( ($myconfig->{numberformat} eq '1.000,00')
+ || ($myconfig->{numberformat} eq '1000,00')) {
+ $amount =~ s/\.//g;
+ $amount =~ s/,/\./;
+ }
+
+ if ($myconfig->{numberformat} eq "1'000.00") {
+ $amount =~ s/'//g;
+ }
+
+ $amount =~ s/,//g;
+
+ $main::lxdebug->message(LXDebug::DEBUG2, "Parsed amount:" . $amount. "\n") if ($amount);
$main::lxdebug->leave_sub();
-
+
return ($amount * 1);
}
my @conf = qw(acs address admin businessnumber charset company countrycode
currency dateformat dbconnect dbdriver dbhost dbport dboptions
- dbname dbuser dbpasswd email fax name numberformat password
+ dbname dbuser dbpasswd email fax name numberformat in_numberformat password
printer role sid signature stylesheet tel templates vclimit angebote bestellungen rechnungen
anfragen lieferantenbestellungen einkaufsrechnungen steuernummer ustid duns menustyle);
? "<option selected>$item\n"
: "<option>$item\n";
}
-
+
foreach $item (qw(name company address signature)) {
$myconfig{$item} =~ s/\"/"/g;
}
: "<option value=$key>$countrycodes{$key}\n";
}
$countrycodes = "<option>American English\n$countrycodes";
+
+ # use an other input number format than output numberformat
+ # look at Form.pm, sub parse_amount
+ my $ in_numberformat = '';
+ $text1 = qq|value="0">| . $locale->text('equal Outputformat');
+ $text2 = qq|value="1">| . $locale->text('1000,00 or 1000.00');
+ @in_nf = ($text1, $text2);
+ foreach $item ( @in_nf ) {
+ $in_numberformat .=
+ ( substr($item, 7, 1) eq $myconfig{in_numberformat})
+ ? "<option selected $item\n"
+ : "<option $item\n";
+ }
+
+
foreach $key (keys %{ $form->{IC} }) {
foreach $accno (sort keys %{ $form->{IC}{$key} }) {
$myconfig{$key} .=
<td><select name=dateformat>$dateformat</select></td>
</tr>
<tr>
- <th align=right>| . $locale->text('Number Format') . qq|</th>
+ <th align=right>| . $locale->text('Output Number Format') . qq|</th>
<td><select name=numberformat>$numberformat</select></td>
</tr>
+ <tr>
+ <th align=right>| . $locale->text('Input Number Format') . qq|</th>
+ <td><select name=in_numberformat>$in_numberformat</select></td>
+ </tr>
+
<tr>
<th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
<td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>