summaryrefslogtreecommitdiff
path: root/httemplate/misc/tax-import.cgi
blob: 7e72c74e3128602d71e01e01770c5184437b67ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<& /elements/header.html,'Batch Tax Rate Import' &>

Import a CSV file set containing tax rate records.
<BR><BR>

<& /elements/form-file_upload.html,
     'name'      => 'TaxRateUpload',
     'action'    => 'process/tax-import.cgi', 
     'fields'    => [ 'format', 'reload' ],
     'num_files' => $vendor_info{$data_vendor}->{num_files},
     'message'   => 'Tax rates imported',
     'onsubmit'  => "document.TaxRateUpload.submitButton.disabled=true;",
&>

<& /elements/table-grid.html &>

  <TR>
    <TH ALIGN="right">Format</TH>
    <TD>
      <SELECT NAME="format">
% my @formats = @{ $vendor_info{$data_vendor}->{formats} };
% while (@formats) {
        <OPTION VALUE="<% shift @formats %>"><% shift @formats %></OPTION>
% }
      </SELECT>
    </TD>
  </TR>

  <TR>
    <TH ALIGN="right">Replace existing data from this vendor</TH>
    <TD>
      <INPUT NAME="reload" TYPE="checkbox" VALUE="1" CHECKED>
    </TD>
  </TR>

  <& /elements/file-upload.html,
                'field' => $vendor_info{$data_vendor}->{field},
                'label' => $vendor_info{$data_vendor}->{label},
                'debug'    => 0,
  &>

  <TR>
    <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
      <INPUT TYPE  = "submit"
             NAME  = "submitButton"
             ID    = "submitButton"
             VALUE = "Import CSV files"
      >
    </TD>
  </TR>

</TABLE>

</FORM>

<% include('/elements/footer.html') %>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Import');

my $conf = FS::Conf->new;
my $data_vendor = $conf->config('enable_taxproducts');

my %vendor_info = (
  CCH => {
    'num_files' => 6,
    'formats' => [ 'cch'        => 'CCH import (CSV)',
                   'cch-fixed'  => 'CCH import (fixed length)' ],
    'field'   => [ 'geocodefile',
                   'codefile',
                   'plus4file',
                   'zipfile',
                   'txmatrixfile',
                   'detailfile',
                 ],
    'label'   => [ 'geocode filename',
                   'code filename',
                   'plus4 filename',
                   'zip filename',
                   'txmatrix filename',
                   'detail filename',
                 ],
  },
  Billsoft => {
    'num_files' => 1,
    'formats' => [ 'billsoft-pcode' => 'Billsoft PCodes',
                   'billsoft-taxclass' => 'Tax classes',
                   'billsoft-taxproduct' => 'Tax products' ],
    'field'   => [ 'file' ],
    'label'   => [ 'Filename' ],
  },
);
    
</%init>