UI for per-city taxes (setup and assigning to customers/package locations), RT#5852
[freeside.git] / FS / FS / Schema.pm
index 80aed82..946cf7f 100644 (file)
@@ -372,18 +372,57 @@ sub tables_hashref {
       'index' => [ ['typenum'] ],
     },
 
+    'cust_attachment' => {
+      'columns' => [
+        'attachnum', 'serial', '', '', '', '',
+        'custnum',   'int', '', '', '', '',
+        '_date',     @date_type, '', '',
+        'otaker',    'varchar', '', 32, '', '',
+        'filename',  'varchar', '', 32, '', '',
+        'mime_type', 'varchar', '', 32, '', '',
+        'body',      'blob', 'NULL', '', '', '',
+        'disabled',  @date_type, '', '',
+      ],
+      'primary_key' => 'attachnum',
+      'unique'      => [],
+      'index'       => [ ['custnum'] ],
+    },
+
     'cust_bill' => {
       'columns' => [
-        'invnum',    'serial',  '', '', '', '', 
-        'custnum',   'int',  '', '', '', '', 
-        '_date',     @date_type, '', '', 
-        'charged',   @money_type, '', '', 
-        'printed',   'int',  '', '', '', '', 
-        'closed',    'char', 'NULL', 1, '', '', 
+        #regular fields
+        'invnum',    'serial',     '', '', '', '', 
+        'custnum',      'int',     '', '', '', '', 
+        '_date',        @date_type,        '', '', 
+        'charged',      @money_type,       '', '', 
+        'invoice_terms', 'varchar', 'NULL', $char_d, '', '',
+
+        #customer balance info at invoice generation time
+        'previous_balance',   @money_typen, '', '',  #eventually not nullable
+        'billing_balance',    @money_typen, '', '',  #eventually not nullable
+
+        #deprecated (unused by now, right?)
+        'printed',      'int',     '', '', '', '', 
+
+        #specific use cases
+        'closed',      'char', 'NULL',  1, '', '', #not yet used much
+        'statementnum', 'int', 'NULL', '', '', '', #invoice aggregate statements
+        'agent_invid',  'int', 'NULL', '', '', '', #(varchar?) importing legacy
       ],
       'primary_key' => 'invnum',
+      'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum?  huh
+      'index' => [ ['custnum'], ['_date'], ['statementnum'], ['agent_invid'] ],
+    },
+
+    'cust_statement' => {
+      'columns' => [
+        'statementnum', 'serial', '', '', '', '',
+        'custnum',         'int', '', '', '', '',
+        '_date',           @date_type,    '', '',
+      ],
+      'primary_key' => 'statementnum',
       'unique' => [],
-      'index' => [ ['custnum'], ['_date'] ],
+      'index' => [ ['custnum'], ['_date'], ],
     },
 
     'cust_bill_event' => {
@@ -531,9 +570,10 @@ sub tables_hashref {
         'billpkgnum', 'int', 'NULL', '', '', '',        # should not be nullable
         'pkgnum',  'int', 'NULL', '', '', '',           # deprecated
         'invnum',  'int', 'NULL', '', '', '',           # deprecated
-        'amount',  @money_typen, '', '', 
+        'amount',  'decimal', 'NULL', '10,4', '', '',
         'format',  'char', 'NULL', 1, '', '',
         'classnum', 'int', 'NULL', '', '', '',
+        'phonenum', 'varchar', 'NULL', 15, '', '',
         'detail',  'varchar', '', 255, '', '', 
       ],
       'primary_key' => 'detailnum',
@@ -827,8 +867,9 @@ sub tables_hashref {
                             # a tax rate.
       'columns' => [
         'taxnum',   'serial',   '',    '', '', '', 
-        'state',    'varchar',  'NULL',    $char_d, '', '', 
+        'city',     'varchar',  'NULL',    $char_d, '', '',
         'county',   'varchar',  'NULL',    $char_d, '', '', 
+        'state',    'varchar',  'NULL',    $char_d, '', '', 
         'country',  'char',  '', 2, '', '', 
         'taxclass',   'varchar', 'NULL', $char_d, '', '', 
         'exempt_amount', @money_type, '', '', 
@@ -840,7 +881,7 @@ sub tables_hashref {
       'primary_key' => 'taxnum',
       'unique' => [],
   #    'unique' => [ ['taxnum'], ['state', 'county'] ],
-      'index' => [ [ 'county' ], [ 'state' ], [ 'country' ],
+      'index' => [ [ 'city' ], [ 'county' ], [ 'state' ], [ 'country' ],
                    [ 'taxclass' ],
                  ],
     },
@@ -1412,7 +1453,7 @@ sub tables_hashref {
       'columns' => [
         'svcnum',    'int',    '',   '', '', '', 
         'username',  'varchar',   '',   $username_len, '', '',
-        '_password', 'varchar',   '',  512, '', '',
+        '_password', 'varchar',   'NULL',  512, '', '',
         '_password_encoding', 'varchar', 'NULL', $char_d, '', '',
         'sec_phrase', 'varchar',  'NULL',   $char_d, '', '', 
         'popnum',    'int',    'NULL',   '', '', '', 
@@ -2044,6 +2085,7 @@ sub tables_hashref {
       'columns' => [
         'categorynum',   'serial',  '', '', '', '', 
         'categoryname',  'varchar', '', $char_d, '', '', 
+        'weight',         'int', 'NULL',  '', '', '',
         'disabled',      'char', 'NULL',   1, '', '', 
       ],
       'primary_key' => 'categorynum',