Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3b31aeed

Von Moritz Bunkus vor fast 2 Jahren hinzugefügt

  • ID 3b31aeed8d551ef3d67015cbec4430f3287d7c28
  • Vorgänger 46282860
  • Nachfolger dc9a8544

Lieferantenauftrag→Einkaufslieferschein: optional nur mit ausgewählten Positionen

Unterschiede anzeigen:

SL/Controller/Order.pm
816 816
sub action_save_and_delivery_order {
817 817
  my ($self) = @_;
818 818

  
819
  my %params;
820

  
821
  if ($::form->{convert_to_purchase_delivery_order_selected_items_only}) {
822
    $params{only_items} = join(',', @{ $::form->{purchase_delivery_order_item_selection_indexes} || [] });
823
  }
824

  
819 825
  $self->save_and_redirect_to(
820 826
    controller => 'oe.pl',
821 827
    action     => 'oe_delivery_order_from_order',
828
    %params,
822 829
  );
823 830
}
824 831

  
......
2430 2437
          only_if   => (any { $self->type eq $_ } (sales_order_type(), purchase_order_type())),
2431 2438
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2432 2439
        ],
2440
        action => [
2441
          t8('Save and Delivery Order with item selection'),
2442
          call      => [ 'kivi.Order.convert_to_purchase_delivery_order_select_items',
2443
                         { action             => 'save_and_delivery_order',
2444
                           warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
2445
                           warn_on_reqdate    => $::instance_conf->get_order_warn_no_deliverydate },
2446
                       ],
2447
          checks    => [ @req_trans_cost_art, @req_cusordnumber ],
2448
          only_if   => (any { $self->type eq $_ } (purchase_order_type())),
2449
          disabled  => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
2450
        ],
2433 2451
        action => [
2434 2452
          t8('Save and Supplier Delivery Order'),
2435 2453
          call      => [ 'kivi.Order.save', { action             => 'save_and_supplier_delivery_order',
bin/mozilla/oe.pl
2104 2104
  return if !$::form->{id};
2105 2105

  
2106 2106
  my $order = SL::DB::Order->new(id => $::form->{id})->load;
2107

  
2108
  if (exists $::form->{only_items}) {
2109
    my @wanted_indexes = sort { $a <=> $b } map { $_ - 1 } split(",", $::form->{only_items} // "");
2110
    my @items          = $order->items;
2111
    @items             = @items[@wanted_indexes];
2112
    $order->items(\@items);
2113
  }
2114

  
2107 2115
  $order->flatten_to_form($::form, format_amounts => 1);
2108 2116
  $::form->{taxincluded_changed_by_user} = 1;
2109 2117

  
js/kivi.Order.js
60 60
    data.push({ name: 'action', value: 'Order/' + action });
61 61

  
62 62
    if (back_to_caller) data.push({ name: 'back_to_caller', value: '1' });
63
    if (params.convert_to_purchase_delivery_order_selected_items_only) data.push({ name: 'convert_to_purchase_delivery_order_selected_items_only', value: '1' });
63 64

  
64 65
    $.post("controller.pl", data, kivi.eval_json_result);
65 66
  };
......
954 955
    window.open("controller.pl?action=CustomerVendor/edit&db=" + encodeURIComponent(db) + "&id=" + encodeURIComponent($(id_selector).val()), '_blank');
955 956
  };
956 957

  
958
  ns.convert_to_purchase_delivery_order_select_items = function(params) {
959
    $("#purchase_delivery_order_item_selection_checkall").attr("checked", "checked");
960

  
961
    var $src  = $("#row_table_id");
962
    var $dest = $("#convert_to_purchase_delivery_order_item_selection_items");
963

  
964
    $dest.data("params", params);
965
    $dest.empty();
966

  
967
    $("#row_table_id tbody>tr:first-child").each(function(idx, tr) {
968
      const $row        = $(tr);
969
      const partnumber  = $row.find("div[name=partnumber]").text().replaceAll(" ", "");
970
      const description = $row.find("input[name='order.orderitems[].description']").val();
971
      const qty         = $row.find("input[name='order.orderitems[].qty_as_number']").val();
972
      const unit        = $row.find("select[name='order.orderitems[].unit']").val();
973
      var html          =
974
          "<tr class=\"listrow\">" +
975
          "  <td><input type=\"checkbox\" name=\"purchase_delivery_order_item_selection_indexes[+]\" class=\"purchase_delivery_order_item_selection_checkall\" value=\"" + (idx + 1) + "\" checked=\"checked\"></td>" +
976
          "  <td align=\"right\" class=\"numeric\">" + (idx + 1) + "</td>" +
977
          "  <td>" + partnumber + "</td>" +
978
          "  <td>" + description + "</td>" +
979
          "  <td align=\"right\" class=\"numeric\">" + qty + "</td>" +
980
          "  <td>" + unit + "</td>" +
981
          "</tr>";
982

  
983
      $dest.append(html);
984
    });
985

  
986
    kivi.popup_dialog({
987
      id: "convert_to_purchase_delivery_order_item_selection",
988
      dialog: {
989
        title: kivi.t8("Select items for delivery order"),
990
      }
991
    });
992
  };
993

  
994
  ns.convert_to_purchase_delivery_order = function() {
995
    var $dlg = $("#convert_to_purchase_delivery_order_item_selection");
996
    $dlg.dialog('close');
997

  
998
    var params = $("#convert_to_purchase_delivery_order_item_selection_items").data("params");
999
    params.convert_to_purchase_delivery_order_selected_items_only = 1;
1000

  
1001
    $dlg.remove();
1002
    $('#order_form').append($dlg);
1003

  
1004
    kivi.Order.save(params);
1005
  };
957 1006
});
958 1007

  
959 1008
$(function() {
js/locale/de.js
147 147
"Save and keep open":"Speichern und geöffnet lassen",
148 148
"Section/Function block actions":"Abschnitts-/Funktionsblockaktionen",
149 149
"Select from preset":"Aus Voreinstellung wählen",
150
"Select items for delivery order":"Positionen für Lieferschein auswählen",
150 151
"Select template to paste":"Einzufügende Vorlage auswählen",
151 152
"Send email":"E-Mail verschicken",
152 153
"Sep":"Sep",
locale/de/all
862 862
  'Create bank transfer via SEPA XML' => 'Überweisung via SEPA XML erzeugen',
863 863
  'Create customers and vendors. Edit all vendors. Edit all customers' => 'Kunden und Lieferanten erfassen. Alle Lieferanten bearbeiten. Alle Kunden bearbeiten',
864 864
  'Create customers and vendors. Edit all vendors. Edit only customers where salesman equals employee (login)' => 'Kunden und Lieferanten erfassen. Alle Lieferanten bearbeiten. Nur Kunden bearbeiten bei denen der Verkäufer gleich Bearbeiter (login) ist',
865
  'Create delivery order'       => 'Lieferschein erstellen',
865 866
  'Create first invoice on'     => 'Erste Rechnung erzeugen am',
866 867
  'Create invoice'              => 'Buchung erstellen',
867 868
  'Create invoice?'             => 'Rechnung erstellen?',
......
3225 3226
  'Save and Close'              => 'Speichern und schließen',
3226 3227
  'Save and Credit Note'        => 'Speichern und Gutschrift erfassen',
3227 3228
  'Save and Delivery Order'     => 'Speichern und Lieferschein',
3229
  'Save and Delivery Order with item selection' => 'Speichern und Lieferschein mit Positionsauswahl',
3228 3230
  'Save and E-mail'             => 'Speichern und E-Mail',
3229 3231
  'Save and Final Invoice'      => 'Speichern und Schlussrechnung',
3230 3232
  'Save and Further Invoice for Advance Payment' => 'Speichern und weitere Anzahlungsrechnung',
......
3296 3298
  'Select file to upload'       => 'Datei zum Hochladen auswählen',
3297 3299
  'Select from one of the items below' => 'Wählen Sie einen der untenstehenden Einträge',
3298 3300
  'Select from preset'          => 'Aus Voreinstellung wählen',
3301
  'Select items for delivery order' => 'Positionen für Lieferschein auswählen',
3299 3302
  'Select postscript or PDF!'   => 'Postscript oder PDF auswählen!',
3300 3303
  'Select tax office...'        => 'Finanzamt auswählen...',
3301 3304
  'Select template to paste'    => 'Einzufügende Vorlage auswählen',
templates/design40_webpages/order/form.html
68 68
</div>
69 69

  
70 70
</div><!-- /.tabwidget -->
71

  
72
 [% IF SELF.order.id && (FORM.type == 'purchase_order') %]
73
  [%- PROCESS 'order/tabs/_purchase_delivery_order_item_selection.html' %]
74
 [% END %]
71 75
</form>
templates/design40_webpages/order/tabs/_purchase_delivery_order_item_selection.html
1
[%- USE LxERP -%][%- USE L -%]
2
<div id="convert_to_purchase_delivery_order_item_selection">
3
  <div class="wrapper">
4
    [% L.button_tag("kivi.Order.convert_to_purchase_delivery_order()", LxERP.t8("Create delivery order")) %]
5
  </div>
6

  
7
  <div class="wrapper">
8
    <table class="tbl-list">
9
      <thead>
10
        <tr class="listheading">
11
          <th>[% L.checkbox_tag("purchase_delivery_order_item_selection_checkall", checkall="input.purchase_delivery_order_item_selection_checkall") %]</th>
12
          <th>[% LxERP.t8("Position") %]</th>
13
          <th>[% LxERP.t8("Partnumber") %]</th>
14
          <th>[% LxERP.t8("Description") %]</th>
15
          <th>[% LxERP.t8("Qty") %]</th>
16
          <th>[% LxERP.t8("Unit") %]</th>
17
        </tr>
18
      </thead>
19

  
20
      <tbody id="convert_to_purchase_delivery_order_item_selection_items" class="row_entry listrow">
21
      </tbody>
22
    </table>
23
  </div>
24
</div>
templates/webpages/order/form.html
68 68

  
69 69
  </div>
70 70

  
71
 [% IF SELF.order.id && (FORM.type == 'purchase_order') %]
72
  [%- PROCESS 'order/tabs/_purchase_delivery_order_item_selection.html' %]
73
 [% END %]
71 74
</form>
templates/webpages/order/tabs/_purchase_delivery_order_item_selection.html
1
[%- USE LxERP -%][%- USE L -%]
2
<div id="convert_to_purchase_delivery_order_item_selection">
3
  <div>
4
    [% L.button_tag("kivi.Order.convert_to_purchase_delivery_order()", LxERP.t8("Create delivery order")) %]
5
  </div>
6

  
7
  <div>
8
    <table>
9
      <thead>
10
        <tr class="listheading">
11
          <th>[% L.checkbox_tag("purchase_delivery_order_item_selection_checkall", checkall="input.purchase_delivery_order_item_selection_checkall") %]</th>
12
          <th>[% LxERP.t8("Position") %]</th>
13
          <th>[% LxERP.t8("Partnumber") %]</th>
14
          <th>[% LxERP.t8("Description") %]</th>
15
          <th>[% LxERP.t8("Qty") %]</th>
16
          <th>[% LxERP.t8("Unit") %]</th>
17
        </tr>
18
      </thead>
19

  
20
      <tbody id="convert_to_purchase_delivery_order_item_selection_items">
21
        <tr class="listrow">
22
          <td>[% L.checkbox_tag("purchase_delivery_order_item_selection_indexes[+]", class="purchase_delivery_order_item_selection_checkall", value="42", checked="checked") %]</td>
23
          <td>1</td>
24
          <td align="right">4</td>
25
          <td>Moo Cow Chunky Bacon</td>
26
          <td align="right">17,5</td>
27
          <td>Kuh</td>
28
        </tr>
29
      </tbody>
30
    </table>
31
  </div>
32
</div>

Auch abrufbar als: Unified diff