1 package SL::Template::Plugin::LxERP;
 
   3 use base qw( Template::Plugin );
 
   6 use List::Util qw(min);
 
  20   my ($self, $var, $places, $skip_zero, $dash) = @_;
 
  22   return $main::form->format_amount(\%main::myconfig, $var * 1, $places, $dash) unless $skip_zero && $var == 0;
 
  26 sub format_amount_units {
 
  27   my ($self, $amount, $amount_unit, $part_unit) = @_;
 
  29   return $main::form->format_amount_units('amount'      => $amount,
 
  30                                           'part_unit'   => $part_unit,
 
  31                                           'amount_unit' => $amount_unit,
 
  32                                           'conv_units'  => 'convertible_not_smaller');
 
  36   my ($self, $var, $places, $skip_zero) = @_;
 
  38   return $self->format_amount($var * 100, $places, $skip_zero);
 
  42   my ($self, $var) = @_;
 
  54   return $main::form->format_string($string, @_);
 
  60   return $main::form->numtextrows(@_);
 
  65   my $word = shift || "";
 
  67   return join '<br>', map { $main::locale->quote_special_chars('HTML', $_) } split(m//, $word);
 
  78   $args->{split_by} ||= 'chars';
 
  79   $args->{class}      = " class=\"$args->{class}\"" if ($args->{class});
 
  81   if ($args->{split_by} eq 'words') {
 
  82     my @words = split m/\s+/, $word;
 
  84     if (1 >= scalar @words) {
 
  85       return $self->_turn90_word($words[0]);
 
  88     return qq|<table><tr>| . join('', map { '<td valign="bottom"' . $args->{class} . '>' . $self->_turn90_word($_) . '</td>' } @words) . qq|</tr></table>|;
 
  91     return $self->_turn90_word($word);
 
  99   return $var < 0 ? $var * -1 : $var;