-<% include("/elements/header.html",'Batch Tax Rate Import') %>
+<& /elements/header.html,'Batch Tax Rate Import' &>
Import a CSV file set containing tax rate records.
<BR><BR>
-<% include( '/elements/progress-init.html',
- 'TaxRateUpload',
- [ 'format', 'uploaded_files' ],
- 'process/tax-import.cgi',
- { 'message' => 'Tax rates imported' },
- )
-%>
+<& /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;",
+&>
-<SCRIPT>
+<& /elements/table-grid.html &>
- function gotLoaded(success, message) {
+ <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>
- var uploaded = document.getElementById('uploaded_files');
- var a = uploaded.value.split(',');
- if (uploaded.value.split(',').length == 4){
- process();
- }else{
- var p = document.getElementById('uploadError');
- p.innerHTML='<FONT SIZE="+1" COLOR="#ff0000">Error: '+message+'</FONT><BR><BR>';
- p.style='display:visible';
- return false;
- }
-
- }
-
-</SCRIPT>
-
-<div style="display:none:" id="uploadError"></div>
-<FORM NAME="TaxRateUpload" ACTION="<% $fsurl %>misc/file-upload.html" METHOD="post" ENCTYPE="multipart/form-data" onsubmit="return doUpload(this, gotLoaded )">
+ <TR>
+ <TH ALIGN="right">Replace existing data from this vendor</TH>
+ <TD>
+ <INPUT NAME="reload" TYPE="checkbox" VALUE="1" CHECKED>
+ </TD>
+ </TR>
-<% &ntable("#cccccc", 2) %>
-<TR>
- <TH ALIGN="right">Format</TH>
- <TD>
- <SELECT NAME="format">
- <OPTION VALUE="cch-update" SELECTED>CCH update
- <OPTION VALUE="cch">CCH initial import
- </SELECT>
- </TD>
-</TR>
+ <& /elements/file-upload.html,
+ 'field' => $vendor_info{$data_vendor}->{field},
+ 'label' => $vendor_info{$data_vendor}->{label},
+ 'debug' => 0,
+ &>
-<% include('/elements/file-upload.html', 'field' => [ 'codefile',
- 'plus4file',
- 'txmatrix',
- 'detail',
- ],
- 'label' => [ 'code CSV filename',
- 'plus4 CSV filename',
- 'txmatrix CSV filename',
- 'detail CSV filename',
- ],
- 'callback' => 'gotLoaded',
- 'debug' => 0,
- )
-%>
-
-<TR><TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px"><INPUT TYPE="submit" VALUE="Import CSV files" onClick="document.TaxRateUpload.submit.disabled=true;"></TD></TR>
+ <TR>
+ <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
+ <INPUT TYPE = "submit"
+ NAME = "submitButton"
+ ID = "submitButton"
+ VALUE = "Import CSV files"
+ >
+ </TD>
+ </TR>
</TABLE>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Import');
+my $conf = FS::Conf->new;
+my $data_vendor = $conf->config('tax_data_vendor');
+
+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>