Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2acbe8c6

Von Jan Büren vor etwa 10 Jahren hinzugefügt

  • ID 2acbe8c6c3c8a988e712deb438adf0dc40c3daaf
  • Vorgänger 59b35cf6
  • Nachfolger 329534cc

Neuer Bericht: Lieferwertbericht
Erweiterung DeliveryPlan.pm um Modusweiche Lieferplan oder Lieferwertbericht
Implementierungstand Lieferwertbericht:
- Alle offenen Verkaufsaufträge werden berücksichtigt
- Beim CSV-Export wird die Einheit als Extra-Spalte exportiert und die
Einheiten bei allen anderen Spalten ausgeblendet
Ferner neues Recht Lieferwertbericht umgesetzt

Unterschiede anzeigen:

SL/Auth.pm
1069 1069
    ["edit_prices",                    $locale->text("Edit prices and discount (if not used, textfield is ONLY set readonly)")],
1070 1070
    ["show_ar_transactions",           $locale->text("Show AR transactions as part of AR invoice report")],
1071 1071
    ["delivery_plan",                  $locale->text("Show delivery plan")],
1072
    ["delivery_value_report",          $locale->text("Show delivery value report")],
1072 1073
    ["--ap",                           $locale->text("AP")],
1073 1074
    ["request_quotation_edit",         $locale->text("Create and edit RFQs")],
1074 1075
    ["purchase_order_edit",            $locale->text("Create and edit purchase orders")],
SL/Controller/DeliveryPlan.pm
12 12

  
13 13
use Rose::Object::MakeMethods::Generic (
14 14
  scalar => [ qw(db_args flat_filter) ],
15
  'scalar --get_set_init' => [ qw(models all_edit_right vc) ],
15
  'scalar --get_set_init' => [ qw(models all_edit_right mode vc) ],
16 16
);
17 17

  
18 18
__PACKAGE__->run_before(sub { $::auth->assert('delivery_plan'); });
......
22 22
  description       => t8('Description'),
23 23
  partnumber        => t8('Part Number'),
24 24
  qty               => t8('Qty'),
25
  unit              => t8('Unit'),
25 26
  shipped_qty       => t8('shipped'),
26 27
  delivered_qty     => t8('transferred in / out'),
27 28
  not_shipped_qty   => t8('not shipped'),
......
48 49
  my ($self)      = @_;
49 50

  
50 51
  my $vc          = $self->vc;
52
  my $mode        = $self->mode;
51 53
  my $report      = SL::ReportGenerator->new(\%::myconfig, $::form);
54
  my $csv_option  = $::form->{report_generator_output_format};
52 55
  $self->{report} = $report;
53 56

  
54 57
  my @columns     = qw(reqdate customer vendor ordnumber partnumber description qty shipped_qty not_shipped_qty delivered_qty value_of_goods);
55 58

  
56 59
  my @sortable    = qw(reqdate customer vendor ordnumber partnumber description);
60
  my $rp_csv_mod  = ($csv_option eq 'CSV' && $mode eq 'delivery_value_report') ? 1 : '';
57 61

  
58 62
  my %column_defs = (
59 63
    reqdate           => {      sub => sub { $_[0]->reqdate_as_date || $_[0]->order->reqdate_as_date                         } },
......
61 65
                           obj_link => sub { $self->link_to($_[0]->part)                                                     } },
62 66
    partnumber        => {      sub => sub { $_[0]->part->partnumber                                                         },
63 67
                           obj_link => sub { $self->link_to($_[0]->part)                                                     } },
64
    qty               => {      sub => sub { $_[0]->qty_as_number . ' ' . $_[0]->unit                                        } },
65
    shipped_qty       => {      sub => sub { $::form->format_amount(\%::myconfig, $_[0]->shipped_qty, 2) . ' ' . $_[0]->unit } },
66
    not_shipped_qty   => {      sub => sub { $::form->format_amount(\%::myconfig, $_[0]->qty - $_[0]->shipped_qty, 2) . ' ' . $_[0]->unit } },
67
    delivered_qty     => {      sub => sub { $::form->format_amount(\%::myconfig, $_[0]->delivered_qty, 2) . ' ' . $_[0]->unit } },
68
    qty               => {      sub => sub { $_[0]->qty_as_number .
69
                                             ($rp_csv_mod ? '' : ' ' .  $_[0]->unit)                                         } },
70
    unit              => {      sub => sub {  $_[0]->unit                                                                    },
71
                            visible => $rp_csv_mod                                                                           },
72
    shipped_qty       => {      sub => sub { $::form->format_amount(\%::myconfig, $_[0]->shipped_qty, 2) .
73
                                             ($rp_csv_mod ? '' : ' ' .  $_[0]->unit)                                         } },
74
    not_shipped_qty   => {      sub => sub { $::form->format_amount(\%::myconfig, $_[0]->qty - $_[0]->shipped_qty, 2) .
75
                                             ($rp_csv_mod ? '' : ' ' .  $_[0]->unit)                                         } },
76
    delivered_qty     => {      sub => sub { $::form->format_amount(\%::myconfig, $_[0]->delivered_qty, 2) .
77
                                             ($rp_csv_mod ? '' : ' ' .  $_[0]->unit)                                         } },
68 78
    ordnumber         => {      sub => sub { $_[0]->order->ordnumber                                                         },
69 79
                           obj_link => sub { $self->link_to($_[0]->order)                                                    } },
70 80
    vendor            => {      sub => sub { $_[0]->order->vendor->name                                                      },
......
74 84
                            visible => $vc eq 'customer',
75 85
                           obj_link => sub { $self->link_to($_[0]->order->customer)                                          } },
76 86
    value_of_goods    => {      sub => sub { $::form->format_amount(\%::myconfig, $_[0]->value_of_goods, 2) . ' ' . $_[0]->taxincluded },
77
                            visible => $::auth->assert('sales_order_edit', 1) && $::instance_conf->get_delivery_plan_show_value_of_goods, },
87
                            visible => $::auth->assert('sales_order_edit', 1) && $mode eq 'delivery_value_report' &&   $::instance_conf->get_delivery_plan_show_value_of_goods, },
78 88
  );
79 89

  
80 90
  $column_defs{$_}->{text} = $sort_columns{$_} for keys %column_defs;
......
83 93
    std_column_visibility => 1,
84 94
    controller_class      => 'DeliveryPlan',
85 95
    output_format         => 'HTML',
86
    top_info_text         => ($vc eq 'customer') ? $::locale->text('Delivery Plan for currently outstanding sales orders') :
96
    top_info_text         => ($vc eq 'customer') ?  (($mode eq 'delivery_plan') ? $::locale->text('Delivery Plan for currently outstanding sales orders') :
97
                                                   $::locale->text('Delivery Value Report for currently open sales orders')) :
98
                                                   ($mode eq 'delivery_value_report') ? $::locale->text('Delivery Value Report for currently outstanding purchase orders') :
87 99
                                                   $::locale->text('Delivery Plan for currently outstanding purchase orders'),
88
    title                 => $::locale->text('Delivery Plan'),
100
    title                 => ($mode eq 'delivery_plan') ? $::locale->text('Delivery Plan') : $::locale->text('Delivery Value Report'),
89 101
    allow_pdf_export      => 1,
90 102
    allow_csv_export      => 1,
91 103
  );
92 104
  $report->set_columns(%column_defs);
93 105
  $report->set_column_order(@columns);
94
  $report->set_export_options(qw(list filter vc));
106
  $report->set_export_options(qw(list filter vc mode));
95 107
  $report->set_options_from_form;
96 108
  $self->models->disable_plugin('paginated') if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
97 109
  $self->models->finalize; # for filter laundering
98 110
  $self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
99 111
  $report->set_options(
100
    raw_top_info_text     => $self->render('delivery_plan/report_top',    { output => 0 }, vc => $vc),
112
    raw_top_info_text     => $self->render('delivery_plan/report_top',    { output => 0 }),
101 113
    raw_bottom_info_text  => $self->render('delivery_plan/report_bottom', { output => 0 }, models => $self->models),
102 114
  );
103 115
}
......
105 117
sub make_filter_summary {
106 118
  my ($self) = @_;
107 119
  my $vc     = $self->vc;
120
  my $mode   = $self->mode;
108 121

  
109 122
  my $filter = $::form->{filter} || {};
110 123
  my @filter_strings;
......
142 155
sub delivery_plan_query {
143 156
  my ($self) = @_;
144 157
  my $vc     = $self->vc;
158
  my $mode   = $self->mode;
145 159
  my $employee_id = SL::DB::Manager::Employee->current->id;
146 160
  my $oe_owner = $_[0]->all_edit_right ? '' : " oe.employee_id = $employee_id AND";
147 161
  # check delivered state for delivery_orders (transferred out) if enabled
148
  my $filter_delivered = $::instance_conf->get_delivery_plan_calculate_transferred_do  ?
149
      "AND (SELECT delivered from delivery_orders where id = doi.delivery_order_id)" : '';
162
  # OR if we are delivery_value_report mode
163
  my $filter_delivered = ($::instance_conf->get_delivery_plan_calculate_transferred_do ||
164
                          $mode eq 'delivery_value_report' ) ?
165
                          "AND (SELECT delivered from delivery_orders where id = doi.delivery_order_id)" : '';
166
  # Show ALL open orders in delivery_value_report mode
167
  my $comment_show_all_open_orders = ($mode eq 'delivery_value_report' ) ? "-- " : "";
150 168
  [
151 169
  "order.${vc}_id" => { gt => 0 },
152 170
  'order.closed' => 0,
......
239 257
        FROM record_links rl
240 258
        WHERE oi.trans_id = rl.from_id AND rl.from_table = 'oe' AND rl.to_table = 'delivery_orders'
241 259
      ) AND
242
      coalesce(sum, 0) < oi.qty AND
260
      $comment_show_all_open_orders coalesce(sum, 0) < oi.qty AND
243 261
      oe.${vc}_id IS NOT NULL AND
244 262
      $oe_owner
245 263
      (oe.quotation = 'f' OR oe.quotation IS NULL) AND NOT oe.closed
......
250 268
sub init_models {
251 269
  my ($self) = @_;
252 270
  my $vc     = $self->vc;
253

  
271
  my $mode   = $self->mode;
254 272
  SL::Controller::Helper::GetModels->new(
255 273
    controller            => $self,
256 274
    model                 => 'OrderItem',
......
263 281
    },
264 282
    query                 => $self->delivery_plan_query,
265 283
    with_objects          => [ 'order', "order.$vc", 'part' ],
266
    additional_url_params => { vc => $vc },
284
    additional_url_params => { vc => $vc, mode => $mode},
267 285
  );
268 286
}
269 287

  
......
273 291
sub init_vc {
274 292
  return $::form->{vc} if ($::form->{vc} eq 'customer' || $::form->{vc} eq 'vendor') || croak "self (DeliveryPlan) has no vc defined";
275 293
}
294
sub init_mode {
295
  return $::form->{mode} if ($::form->{mode} eq 'delivery_value_report' || $::form->{mode} eq 'delivery_plan') || croak "self (DeliveryPlan) has no mode defined";
296
}
276 297

  
277 298
sub link_to {
278 299
  my ($self, $object, %params) = @_;
menus/erp.ini
193 193
module=controller.pl
194 194
action=DeliveryPlan/list
195 195
vc=customer
196
mode=delivery_plan
197

  
198
[AR--Reports--Delivery Value Report]
199
ACCESS=delivery_value_report
200
module=controller.pl
201
action=DeliveryPlan/list
202
vc=customer
203
mode=delivery_value_report
204

  
196 205

  
197 206
[AR--Reports--Financial Controlling]
198 207
ACCESS=sales_order_edit
......
262 271
module=controller.pl
263 272
action=DeliveryPlan/list
264 273
vc=vendor
274
mode=delivery_plan
275

  
276
[AP--Reports--Delivery Value Report]
277
ACCESS=delivery_value_report
278
module=controller.pl
279
action=DeliveryPlan/list
280
vc=vendor
281
mode=delivery_value_report
265 282

  
266 283
[Warehouse]
267 284

  
sql/Pg-upgrade2-auth/delivery_process_value.pl
1
# @tag: delivery_process_value
2
# @description: Setzt das neue Recht den Lieferstatus mit Warenwert zu sehen
3
# @depends: release_3_0_0
4
package SL::DBUpgrade2::delivery_process_value;
5

  
6
use strict;
7
use utf8;
8

  
9
use parent qw(SL::DBUpgrade2::Base);
10

  
11
use SL::DBUtils;
12

  
13
sub run {
14
  my ($self) = @_;
15

  
16
  my $groups = $main::auth->read_groups();
17

  
18
  foreach my $group (values %{$groups}) {
19
    $group->{rights}->{delivery_value_report} = $group->{rights}->{sales_order_edit};
20
    $main::auth->save_group($group);
21
  }
22

  
23
  return 1;
24
} # end run
25

  
26
1;
templates/webpages/delivery_plan/_filter.html
67 67
[% L.hidden_tag('sort_dir', FORM.sort_dir) %]
68 68
[% L.hidden_tag('page', FORM.page) %]
69 69
[% L.hidden_tag('vc', SELF.vc) %]
70
[% L.hidden_tag('mode', SELF.mode) %]
70 71
  [% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
71 72

  
72 73

  

Auch abrufbar als: Unified diff