Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 15a630c6

Von Tamino Steinert vor 1 Tag hinzugefügt

  • ID 15a630c643963a0446f609dab6921b3b8729e03e
  • Vorgänger db7d17f2

POS: Quittung parken

Unterschiede anzeigen:

SL/Controller/POS.pm
12 12
use SL::DB::TaxZone;
13 13
use SL::DB::Currency;
14 14

  
15
use SL::DBUtils qw(do_query);
15 16
use SL::Locale::String qw(t8);
16 17

  
17 18
use Rose::Object::MakeMethods::Generic
......
27 28
  my ($self) = @_;
28 29
  $::form->{type} = SALES_ORDER_TYPE();
29 30

  
31
  if ($::form->{id}) {
32
    $self->load_receipt(delete $::form->{id});
33
  }
34

  
30 35
  $self->order(SL::Model::Record->update_after_new($self->order));
31 36

  
32 37
  $self->order_controller->pre_render();
......
143 148
  );
144 149
}
145 150

  
151
sub action_parking_receipt {
152
  my ($self) = @_;
153
  my $order = $self->order;
154

  
155
  SL::DB->client->with_transaction( sub {
156
    $order->save();
157
    my $query = <<SQL;
158
SQL
159
    do_query(
160
      $::form,
161
      SL::DB->client->dbh,
162
      q| UPDATE oe SET record_type = ? WHERE id = ? |,
163
      SALES_RECEIPT_ORDER_TYPE(), $order->id
164
    );
165
    $self->order(undef);
166
    1;
167
  });
168

  
169
  $self->redirect_to(
170
    action => 'add',
171
  );
172
}
173

  
174
sub action_open_receipt_load_dialog {
175
  my ($self) = @_;
176

  
177
  my $orders = SL::DB::Manager::Order->get_all(
178
    where => [
179
      record_type => SALES_RECEIPT_ORDER_TYPE(),
180
    ],
181
    sort_by => 'itime',
182
  );
183

  
184
  $self->render(
185
    'pos/_receipt_load_dialog', { layout => 0 },
186
    popup_dialog                 => 1,
187
    popup_js_close_function      => '$("#receipt_load_dialog").dialog("close")',
188
    ORDERS                       => $orders,
189
  );
190
}
191

  
146 192
sub action_to_delivery_order {
147 193
  my ($self) = @_;
148 194
  my $order = $self->order;
......
182 228
  $self->order_controller->order(@_);
183 229
}
184 230

  
231
sub load_receipt {
232
  my ($self, $order_id) = @_;
233

  
234
  my $order_to_delete = SL::DB::Manager::Order->find_by(
235
    id          => $order_id,
236
    record_type => SALES_RECEIPT_ORDER_TYPE,
237
  );
238

  
239
  return unless $order_to_delete;
240

  
241
  $order_to_delete->record_type(SALES_ORDER_TYPE());
242

  
243
  my $new_order = SL::Model::Record->new_from_workflow(
244
    $order_to_delete,
245
    SALES_ORDER_TYPE(),
246
    no_linked_records => 1
247
  );
248
  $order_to_delete->delete;
249

  
250
  return $self->order($new_order);
251
}
252

  
253

  
185 254
#
186 255
# intits
187 256
#

Auch abrufbar als: Unified diff