Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ea1f1390

Von Kivitendo Admin vor fast 10 Jahren hinzugefügt

  • ID ea1f139071a3ba20d0defdf9f5bf01c2127ca18d
  • Vorgänger 4f152ed2
  • Nachfolger cce8be29

Mandantenkonfiguration: Standardkonten als Chartpicker

Statt Dropdown werden die Standardkonten nun per Chartpicker ausgewählt.

Die Kontenlogik welche Konten als Standardkonten vorgeschlagen werden
steckt jetzt im Template in der Konfiguration des Chartpickers, nicht
mehr im ClientConfig Controller.

Unterschiede anzeigen:

SL/Controller/ClientConfig.pm
21 21

  
22 22
use Rose::Object::MakeMethods::Generic (
23 23
  'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates all_price_sources h_unit_name
24
                                  posting_options payment_options accounting_options inventory_options profit_options accounts balance_startdate_method_options) ],
24
                                  posting_options payment_options accounting_options inventory_options profit_options balance_startdate_method_options) ],
25 25
);
26 26

  
27 27
sub action_edit {
......
182 182
    { title => t8("Last opening balance or start of year"),     value => "last_ob_or_start_of_year"    }, ]
183 183
}
184 184

  
185
sub init_accounts {
186
  my %accounts;
187

  
188
  foreach my $chart (@{ SL::DB::Manager::Chart->get_all(where => [ link => { like => '%IC%' } ], sort_by => 'accno ASC') }) {
189
    my %added;
190

  
191
    foreach my $link (split m/:/, $chart->link) {
192
      my $key = lc($link =~ /cogs/ ? 'IC_expense' : $link =~ /sale/ ? 'IC_income' : $link);
193
      next if $added{$key};
194

  
195
      $added{$key}      = 1;
196
      $accounts{$key} ||= [];
197
      push @{ $accounts{$key} }, $chart;
198
    }
199
  }
200

  
201
  $accounts{fx_gain} = SL::DB::Manager::Chart->get_all(where => [ category => 'I', charttype => 'A' ], sort_by => 'accno ASC');
202
  $accounts{fx_loss} = SL::DB::Manager::Chart->get_all(where => [ category => 'E', charttype => 'A' ], sort_by => 'accno ASC');
203
  $accounts{ar_paid} = SL::DB::Manager::Chart->get_all(where => [ link => { like => '%AR_paid%' }   ], sort_by => 'accno ASC');
204

  
205
  return \%accounts;
206
}
207

  
208 185
sub init_all_price_sources {
209 186
  my @classes = SL::PriceSource::ALL->all_price_sources;
210 187

  
templates/webpages/client_config/_default_accounts.html
1 1
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
2
[% SET style="width: 600px" %]
2
[% SET style="width: 500px" %]
3
[%# L.dump( SELF.defaults ) %]
3 4
<div id="default_accounts">
4 5
 <table>
5 6
  <tr>
6 7
   <td align="right">[% LxERP.t8("Inventory Account") %]</td>
7
   <td>[% L.select_tag('defaults.inventory_accno_id', SELF.accounts.ic, default=SELF.defaults.inventory_accno_id, title_sub=\make_chart_title, style=style) %]</td>
8
   <td>
9
   [% L.chart_picker('defaults.inventory_accno_id', SELF.defaults.inventory_accno_id, type='IC', choose=1, style=style) %]
10
   <td>
8 11
  </tr>
9 12

  
10 13
  <tr>
11 14
   <td align="right">[% LxERP.t8("Revenue Account") %]</td>
12
   <td>[% L.select_tag('defaults.income_accno_id', SELF.accounts.ic_income, default=SELF.defaults.income_accno_id, title_sub=\make_chart_title, style=style) %]</td>
15
   <td>[% L.chart_picker('defaults.income_accno_id', SELF.defaults.income_accno_id, type='IC_income,IC_sale', choose=1, style=style) %]</td>
13 16
  </tr>
14 17

  
15 18
  <tr>
16 19
   <td align="right">[% LxERP.t8("Expense Account") %]</td>
17
   <td>[% L.select_tag('defaults.expense_accno_id', SELF.accounts.ic_expense, default=SELF.defaults.expense_accno_id, title_sub=\make_chart_title, style=style) %]</td>
20
   <td>[% L.chart_picker('defaults.expense_accno_id', SELF.defaults.expense_accno_id, type='IC_expense,IC_cogs', choose=1, style=style) %]</td>
18 21
  </tr>
19 22

  
20 23
  <tr>
21 24
   <td align="right">[% LxERP.t8("Foreign Exchange Gain") %]</td>
22
   <td>[% L.select_tag('defaults.fxgain_accno_id', SELF.accounts.fx_gain, default=SELF.defaults.fxgain_accno_id, title_sub=\make_chart_title, style=style) %]</td>
25
   <td>[% L.chart_picker('defaults.fxgain_accno_id', SELF.defaults.fxgain_accno_id, category='I,A', choose=1, style=style) %]<td>
23 26
  </tr>
24 27

  
25 28
  <tr>
26 29
   <td align="right">[% LxERP.t8("Foreign Exchange Loss") %]</td>
27
   <td>[% L.select_tag('defaults.fxloss_accno_id', SELF.accounts.fx_loss, default=SELF.defaults.fxloss_accno_id, title_sub=\make_chart_title, style=style) %]</td>
30
   <td>[% L.chart_picker('defaults.fxloss_accno_id', SELF.defaults.fxloss_accno_id, category='E,A', choose=1, style=style) %]<td>
28 31
  </tr>
29 32

  
30 33
  <tr>
31 34
   <td align="right">[% LxERP.t8("Current assets account") %]</td>
32
   <td>[% L.select_tag('defaults.ar_paid_accno_id', SELF.accounts.ar_paid, default=SELF.defaults.ar_paid_accno_id, title_sub=\make_chart_title, style=style) %]</td>
35
   <td>[% L.chart_picker('defaults.ar_paid_accno_id', SELF.defaults.ar_paid_accno_id, type='AR_paid', choose=1, style=style) %]<td>
33 36
  </tr>
34 37
 </table>
35 38
</div>

Auch abrufbar als: Unified diff