summaryrefslogtreecommitdiff
path: root/httemplate/misc/cust_main-import_charges.cgi
blob: 215cc4c9d095ace256636244dcf0f57084982982 (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
96
97
98
99
100
101
102
<% include("/elements/header.html",'Batch Charge Import') %>

Import a CSV file containing customer charges.
<BR><BR>

<& /elements/form-file_upload.html,
     'name'      => 'OneTimeChargeImportForm',
     'action'    => 'process/cust_main-import_charges.cgi',
     'num_files' => 1,
     'fields'    => [ 'agentnum', 'custbatch', 'format' ],
     'message'   => 'One time charge batch import successful',
     'url'       => $p."misc/cust_main-import_charges.cgi",
     'onsubmit'  => "document.OneTimeChargeImportForm.submitButton.disabled=true;",
&>

<% &ntable("#cccccc", 2) %>

<% include('/elements/tr-select-agent.html',
              #'curr_value' => '', #$agentnum,
              'label'       => "<B>Agent</B>",
              'empty_label' => 'Select agent',
           )
%>

<INPUT TYPE="hidden" NAME="custbatch" VALUE="<% $custbatch %>"%>

<TR>
  <TH ALIGN="right">Format</TH>
  <TD>
    <SELECT NAME="format">
%       foreach my $format ( keys %formats ) {
         <OPTION VALUE="<% $format %>"><% $formats{$format} %></OPTION>
%       }
    </SELECT>
  </TD>
</TR>

  <% include( '/elements/file-upload.html',
                'field' => 'file',
                'label' => 'Filename',
            )
  %>

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

</TABLE>

</FORM>

<BR>

Simple file format is CSV, with the following field order: <i>custnum, agent_custid, amount, description</i>
<BR><BR>

<!-- Extended file format is not yet defined</i>
<BR><BR> -->

Field information:

<ul>

  <li><i>custnum</i>: This is the freeside customer number.  It may be left blank.  If specified, agent_custid must be blank.

  <li><i>agent_custid</i>: This is the reseller's idea of the customer number or identifier.  It may be left blank.  If specified, custnum must be blank.

  <li><i>amount</i>: A numeric value with at most two digits after the decimal point.  If <i>amount</i> is negative, a credit will be applied instead.

  <li><i>description</i>: Text describing the transaction.

</ul>

<BR>

<b>Ooma</b> format has the following field order: <i>Description, Description2, Record Type, Customer Number, Billing Phone Number or Zip Code, Bus/Res Indicator, Invoice Date, Invoice Number, Group, Item, Revenue<%$req%>, LineCount, Exempt, ExemptList, State, City, Zipcode, OfferingPK, Offering name<%$req%>, Quantity, AccountNo<%$req%>, Status, Cust Created, PartnerID</i>
<BR><BR>


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

<%once>
  my $req = qq!<font color="#ff0000">*</font>!;
</%once>

<%init>

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

  tie my %formats, 'Tie::IxHash', FS::cust_main::Import_Charges->import_formats;

  my $custbatch = time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);

</%init>