Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e770cd18

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID e770cd180600810fecd3554e104546236a9c9597
  • Vorgänger d5dee66f
  • Nachfolger 2678f499

Anpassung Rose-Funktionen auf Umstellung currencies

Unterschiede anzeigen:

SL/DB/Default.pm
9 9

  
10 10
sub get_default_currency {
11 11
  my $self = shift->get;
12
  my @currencies = grep { $_ } split(/:/, $self->curr || '');
13
  return $currencies[0] || '';
12
  return $self->currency->name || '' if $self->currency_id;
13
  return '';
14 14
}
15 15

  
16 16
sub get {
SL/DB/Helper/FlattenToForm.pm
14 14

  
15 15
  my $vc = $self->can('customer_id') && $self->customer_id ? 'customer' : 'vendor';
16 16

  
17
  _copy($self, $form, '', '', 0, qw(id type taxzone_id ordnumber quonumber invnumber donumber cusordnumber taxincluded shippingpoint shipvia notes intnotes curr cp_id
17
  _copy($self, $form, '', '', 0, qw(id type taxzone_id ordnumber quonumber invnumber donumber cusordnumber taxincluded shippingpoint shipvia notes intnotes cp_id
18 18
                                    employee_id salesman_id closed department_id language_id payment_id delivery_customer_id delivery_vendor_id shipto_id proforma
19 19
                                    globalproject_id delivered transaction_description container_type accepted_by_customer invoice terms storno storno_id dunning_config_id
20 20
                                    orddate quodate reqdate gldate duedate deliverydate datepaid transdate));
21
  $form->{currency} = $form->{curr}; # curr is called currency in almost all forms
21
  $form->{currency} = $form->{curr} = $self->currency_id ? $self->currency->name || '' : '';
22 22

  
23 23
  if (_has($self, 'transdate')) {
24 24
    my $transdate_idx = ref($self) eq 'SL::DB::Order'   ? ($self->quotation ? 'quodate' : 'orddate')
SL/DB/Helper/PriceTaxCalculator.pm
53 53
sub _get_exchangerate {
54 54
  my ($self, $data, %params) = @_;
55 55

  
56
  if (($self->curr || '') ne SL::DB::Default->get_default_currency) {
57
    $data->{exchangerate}   = $::form->check_exchangerate(\%::myconfig, $self->curr, $self->transdate, $data->{is_sales} ? 'buy' : 'sell');
56
  my $currency = $self->currency_id ? $self->currency->name || '' : '';
57
  if ($currency ne SL::DB::Default->get_default_currency) {
58
    $data->{exchangerate}   = $::form->check_exchangerate(\%::myconfig, $currency, $self->transdate, $data->{is_sales} ? 'buy' : 'sell');
58 59
    $data->{exchangerate} ||= $params{exchangerate};
59 60
  }
60 61
  $data->{exchangerate} ||= 1;
SL/DB/Invoice.pm
98 98

  
99 99
  my $terms = $source->can('payment_id') && $source->payment_id ? $source->payment_terms->terms_netto : 0;
100 100

  
101
  my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes curr salesman_id cusordnumber ordnumber quonumber
101
  my %args = ( map({ ( $_ => $source->$_ ) } qw(customer_id taxincluded shippingpoint shipvia notes intnotes salesman_id cusordnumber ordnumber quonumber
102 102
                                                department_id cp_id language_id payment_id delivery_customer_id delivery_vendor_id taxzone_id shipto_id
103
                                                globalproject_id transaction_description)),
103
                                                globalproject_id transaction_description currency_id)),
104 104
               transdate   => DateTime->today_local,
105 105
               gldate      => DateTime->today_local,
106 106
               duedate     => DateTime->today_local->add(days => $terms * 1),
SL/DB/VC.pm
26 26
  $query = <<SQL;
27 27
    SELECT o.amount,
28 28
      (SELECT e.buy FROM exchangerate e
29
       WHERE e.curr = o.curr
29
       WHERE e.currency_id = o.currency_id
30 30
         AND e.transdate = o.transdate)
31 31
    FROM oe o
32 32
    WHERE (o.${type}_id = ?)

Auch abrufbar als: Unified diff