Auftrags-Controller: Zahlungs- und Lieferbedingungen
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 16 Sep 2015 07:55:25 +0000 (09:55 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 11 Mar 2016 11:45:30 +0000 (12:45 +0100)
SL/Controller/Order.pm
templates/webpages/order/tabs/basic_data.html

index 0e89bfe..8ecfaf6 100644 (file)
@@ -137,10 +137,15 @@ sub action_customer_vendor_changed {
     $self->js->hide('#shipto_row');
   }
 
+  $self->order->payment_id($self->order->$cv_method->payment_id);
+  $self->order->delivery_term_id($self->order->$cv_method->delivery_term_id);
+
   $self->js
     ->replaceWith('#order_cp_id',     $self->build_contact_select)
     ->replaceWith('#order_shipto_id', $self->build_shipto_select)
     ->val('#order_taxzone_id', $self->order->taxzone_id)
+    ->val('#order_payment_id',       $self->order->payment_id)
+    ->val('#order_delivery_term_id', $self->order->delivery_term_id)
     ->focus('#order_' . $self->cv . '_id')
     ->render($self);
 }
@@ -400,16 +405,18 @@ sub _save {
 sub _pre_render {
   my ($self) = @_;
 
-  $self->{all_taxzones}  = SL::DB::Manager::TaxZone->get_all_sorted();
-  $self->{all_employees} = SL::DB::Manager::Employee->get_all(where => [ or => [ id => $self->order->employee_id,
-                                                                                 deleted => 0 ] ],
-                                                              sort_by => 'name');
-  $self->{all_salesmen}  = SL::DB::Manager::Employee->get_all(where => [ or => [ id => $self->order->salesman_id,
-                                                                                 deleted => 0 ] ],
-                                                              sort_by => 'name');
-  $self->{all_projects}  = SL::DB::Manager::Project->get_all(where => [ or => [ id => $self->order->globalproject_id,
-                                                                                active => 1 ] ],
-                                                             sort_by => 'projectnumber');
+  $self->{all_taxzones}        = SL::DB::Manager::TaxZone->get_all_sorted();
+  $self->{all_employees}       = SL::DB::Manager::Employee->get_all(where => [ or => [ id => $self->order->employee_id,
+                                                                                       deleted => 0 ] ],
+                                                                    sort_by => 'name');
+  $self->{all_salesmen}        = SL::DB::Manager::Employee->get_all(where => [ or => [ id => $self->order->salesman_id,
+                                                                                       deleted => 0 ] ],
+                                                                    sort_by => 'name');
+  $self->{all_projects}        = SL::DB::Manager::Project->get_all(where => [ or => [ id => $self->order->globalproject_id,
+                                                                                      active => 1 ] ],
+                                                                   sort_by => 'projectnumber');
+  $self->{all_payment_terms}   = SL::DB::Manager::PaymentTerm->get_all_sorted();
+  $self->{all_delivery_terms}  = SL::DB::Manager::DeliveryTerm->get_all_sorted();
 
   $self->{current_employee_id} = SL::DB::Manager::Employee->current->id;
 }
index 02d6cb7..d109954 100644 (file)
     </tr>
 
     <tr>
-      <td align="right">
-        <table>
-          [%- IF NOT taxincluded %]
+      <td colspan="100%" width="100%">
+        <table width="100%">
           <tr>
-            <th align="right">[%- 'Subtotal' | $T8 %]</th>
-            <td align="right">
-              [%- L.div_tag(SELF.order.netamount_as_number, id='netamount_id') %]
+            <td>
+              <table>
+                <tr>
+                  <th align="right">[% 'Payment Terms' | $T8 %]</th>
+                  <td>[% L.select_tag('order.payment_id',
+                                      SELF.all_payment_terms,
+                                      default = SELF.order.payment_id,
+                                      with_empty = 1,
+                                      title_key = 'description',
+                                      style = 'width: 250px') %]</td>
+                </tr>
+                <tr>
+                  <th align="right">[% 'Delivery Terms' | $T8 %]</th>
+                  <td>[% L.select_tag('order.delivery_term_id',
+                                      SELF.all_delivery_terms,
+                                      default = SELF.order.delivery_term_id,
+                                      with_empty = 1,
+                                      title_key = 'description',
+                                      style = 'width: 250px') %]</td>
+                </tr>
+              </table>
             </td>
-          </tr>
-          [%- END %]
-          [%- FOREACH tax = SELF.taxes %]
-            [%- PROCESS order/tabs/_tax_row.html TAX=tax %]
-          [%- END %]
-          <tr id="amount_row_id">
-            <th align="right">[%- 'Total' | $T8 %]</th>
+
             <td align="right">
               <table>
                 [%- IF NOT taxincluded %]