(finally) wrap up new tax rate engine (for now)
[freeside.git] / httemplate / misc / tax-import.cgi
1 <% include("/elements/header.html",'Batch Tax Rate Import') %>
2
3 Import a CSV file set containing tax rate records.
4 <BR><BR>
5
6 <% include( '/elements/progress-init.html',
7             'TaxRateUpload',
8             [ 'format', 'uploaded_files' ],
9             'process/tax-import.cgi', 
10             { 'message' => 'Tax rates imported' },
11           )
12 %>
13
14 <SCRIPT>
15
16   function gotLoaded(success, message) {
17
18     var uploaded = document.getElementById('uploaded_files');
19     var a = uploaded.value.split(',');
20     if (uploaded.value.split(',').length == 4){
21       process(); 
22     }else{
23       var p = document.getElementById('uploadError');
24       p.innerHTML='<FONT SIZE="+1" COLOR="#ff0000">Error: '+message+'</FONT><BR><BR>';
25       p.style='display:visible';
26       return false;
27     }
28     
29   }
30
31 </SCRIPT>
32
33 <div style="display:none:" id="uploadError"></div>
34 <FORM NAME="TaxRateUpload" ACTION="<% $fsurl %>misc/file-upload.html" METHOD="post" ENCTYPE="multipart/form-data" onsubmit="return doUpload(this, gotLoaded )">
35
36 <% &ntable("#cccccc", 2) %>
37 <TR>
38   <TH ALIGN="right">Format</TH>
39   <TD>
40     <SELECT NAME="format">
41       <OPTION VALUE="cch-update" SELECTED>CCH update
42       <OPTION VALUE="cch">CCH initial import
43     </SELECT>
44   </TD>
45 </TR>
46
47 <% include('/elements/file-upload.html', 'field'    => [ 'codefile',
48                                                          'plus4file',
49                                                          'txmatrix',
50                                                          'detail',
51                                                        ],
52                                          'label'    => [ 'code CSV filename',
53                                                          'plus4 CSV filename',
54                                                          'txmatrix CSV filename',
55                                                          'detail CSV filename',
56                                                        ],
57                                          'callback' => 'gotLoaded',
58                                          'debug'    => 0,
59    )
60 %>
61
62 <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>
63
64 </TABLE>
65
66 </FORM>
67
68 <% include('/elements/footer.html') %>
69 <%init>
70
71 die "access denied"
72   unless $FS::CurrentUser::CurrentUser->access_right('Import');
73
74 </%init>