summaryrefslogtreecommitdiff
path: root/httemplate/misc/tax-import.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc/tax-import.cgi')
-rw-r--r--httemplate/misc/tax-import.cgi70
1 files changed, 46 insertions, 24 deletions
diff --git a/httemplate/misc/tax-import.cgi b/httemplate/misc/tax-import.cgi
index 6bdea6a..9044ac9 100644
--- a/httemplate/misc/tax-import.cgi
+++ b/httemplate/misc/tax-import.cgi
@@ -3,41 +3,63 @@
Import a CSV file set containing tax rate records.
<BR><BR>
-<FORM ACTION="process/tax-import.cgi" METHOD="post" ENCTYPE="multipart/form-data">
+<% include( '/elements/progress-init.html',
+ 'TaxRateUpload',
+ [ 'format', 'uploaded_files' ],
+ 'process/tax-import.cgi',
+ { 'message' => 'Tax rates imported' },
+ )
+%>
-<% &ntable("#cccccc", 2) %>
+<SCRIPT>
+
+ function gotLoaded(success, message) {
+
+ 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 )">
+<% &ntable("#cccccc", 2) %>
<TR>
<TH ALIGN="right">Format</TH>
<TD>
<SELECT NAME="format">
- <OPTION VALUE="cch" SELECTED>CCH
+ <OPTION VALUE="cch-update" SELECTED>CCH update
+ <OPTION VALUE="cch">CCH initial import
</SELECT>
</TD>
</TR>
-<TR>
- <TH ALIGN="right">code CSV filename</TH>
- <TD><INPUT TYPE="file" NAME="codefile"></TD>
-</TR>
-
-<TR>
- <TH ALIGN="right">plus4 CSV filename</TH>
- <TD><INPUT TYPE="file" NAME="plus4file"></TD>
-</TR>
-
-<TR>
- <TH ALIGN="right">txmatrix CSV filename</TH>
- <TD><INPUT TYPE="file" NAME="txmatrix"></TD>
-</TR>
-
-<TR>
- <TH ALIGN="right">detail CSV filename</TH>
- <TD><INPUT TYPE="file" NAME="detail"></TD>
-</TR>
-
+<% 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"></TD></TR>
+<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>
</TABLE>