Merge branch 'test' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / DB / MetaSetup / Invoice.pm
index eedecb4..e80b110 100644 (file)
@@ -4,18 +4,20 @@ package SL::DB::Invoice;
 
 use strict;
 
-use base qw(SL::DB::Object);
+use parent qw(SL::DB::Object);
 
 __PACKAGE__->meta->table('ar');
 
 __PACKAGE__->meta->columns(
-  amount                    => { type => 'numeric', precision => 5, scale => 15 },
+  amount                    => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
+  billing_address_id        => { type => 'integer' },
   cp_id                     => { type => 'integer' },
   currency_id               => { type => 'integer', not_null => 1 },
   cusordnumber              => { type => 'text' },
   customer_id               => { type => 'integer' },
   datepaid                  => { type => 'date' },
   delivery_customer_id      => { type => 'integer' },
+  delivery_term_id          => { type => 'integer' },
   delivery_vendor_id        => { type => 'integer' },
   deliverydate              => { type => 'date' },
   department_id             => { type => 'integer' },
@@ -33,15 +35,16 @@ __PACKAGE__->meta->columns(
   invoice                   => { type => 'boolean', default => 'false' },
   itime                     => { type => 'timestamp', default => 'now()' },
   language_id               => { type => 'integer' },
-  marge_percent             => { type => 'numeric', precision => 5, scale => 15 },
-  marge_total               => { type => 'numeric', precision => 5, scale => 15 },
+  marge_percent             => { type => 'numeric', precision => 15, scale => 5 },
+  marge_total               => { type => 'numeric', precision => 15, scale => 5 },
   mtime                     => { type => 'timestamp' },
-  netamount                 => { type => 'numeric', precision => 5, scale => 15 },
+  netamount                 => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
   notes                     => { type => 'text' },
   orddate                   => { type => 'date' },
   ordnumber                 => { type => 'text' },
-  paid                      => { type => 'numeric', precision => 5, scale => 15 },
+  paid                      => { type => 'numeric', default => '0', not_null => 1, precision => 15, scale => 5 },
   payment_id                => { type => 'integer' },
+  qrbill_without_amount     => { type => 'boolean', default => 'false' },
   quodate                   => { type => 'date' },
   quonumber                 => { type => 'text' },
   salesman_id               => { type => 'integer' },
@@ -50,9 +53,9 @@ __PACKAGE__->meta->columns(
   shipvia                   => { type => 'text' },
   storno                    => { type => 'boolean', default => 'false' },
   storno_id                 => { type => 'integer' },
+  tax_point                 => { type => 'date' },
   taxincluded               => { type => 'boolean' },
-  taxzone_id                => { type => 'integer' },
-  terms                     => { type => 'integer', default => '0' },
+  taxzone_id                => { type => 'integer', not_null => 1 },
   transaction_description   => { type => 'text' },
   transdate                 => { type => 'date', default => 'now' },
   type                      => { type => 'text' },
@@ -63,6 +66,11 @@ __PACKAGE__->meta->primary_key_columns([ 'id' ]);
 __PACKAGE__->meta->allow_inline_column_values(1);
 
 __PACKAGE__->meta->foreign_keys(
+  billing_address => {
+    class       => 'SL::DB::AdditionalBillingAddress',
+    key_columns => { billing_address_id => 'id' },
+  },
+
   contact => {
     class       => 'SL::DB::Contact',
     key_columns => { cp_id => 'cp_id' },
@@ -78,6 +86,11 @@ __PACKAGE__->meta->foreign_keys(
     key_columns => { customer_id => 'id' },
   },
 
+  delivery_term => {
+    class       => 'SL::DB::DeliveryTerm',
+    key_columns => { delivery_term_id => 'id' },
+  },
+
   department => {
     class       => 'SL::DB::Department',
     key_columns => { department_id => 'id' },
@@ -122,6 +135,11 @@ __PACKAGE__->meta->foreign_keys(
     class       => 'SL::DB::Invoice',
     key_columns => { storno_id => 'id' },
   },
+
+  taxzone => {
+    class       => 'SL::DB::TaxZone',
+    key_columns => { taxzone_id => 'id' },
+  },
 );
 
 1;