summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/process/usage_elec_manual_input.cgi225
-rwxr-xr-xhttemplate/edit/usage_elec_manual_input.cgi213
-rw-r--r--httemplate/elements/menu.html42
-rw-r--r--httemplate/index.html5
-rwxr-xr-xhttemplate/misc/cust_edi_data-onp.cgi57
-rwxr-xr-xhttemplate/misc/cust_main-import-oldonp.cgi68
-rw-r--r--httemplate/misc/payment.cgi2
-rwxr-xr-xhttemplate/misc/process/cust_edi_data-onp.cgi182
-rwxr-xr-xhttemplate/misc/process/cust_main-import-oldonp.cgi35
-rwxr-xr-xhttemplate/misc/process/qualified_liteup_customers.cgi139
-rwxr-xr-xhttemplate/misc/process/transaction810-import.cgi23
-rwxr-xr-xhttemplate/misc/qualified_liteup_customers.cgi71
-rwxr-xr-xhttemplate/misc/transaction810-import.cgi76
-rwxr-xr-xhttemplate/misc/usage_elec_prefilled_input.cgi245
-rw-r--r--httemplate/pref/pref-process.html1
-rw-r--r--httemplate/pref/pref.html16
-rwxr-xr-xhttemplate/view/cust_bill-pdf.cgi6
-rwxr-xr-xhttemplate/view/cust_bill.cgi9
-rw-r--r--httemplate/view/svc_external.cgi4
19 files changed, 1411 insertions, 8 deletions
diff --git a/httemplate/edit/process/usage_elec_manual_input.cgi b/httemplate/edit/process/usage_elec_manual_input.cgi
new file mode 100755
index 0000000..1a62c39
--- /dev/null
+++ b/httemplate/edit/process/usage_elec_manual_input.cgi
@@ -0,0 +1,225 @@
+%
+%$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
+%my $svcnum =$1;
+%$svcnum = $cgi->param('svcnum');
+svcnum = <% $svcnum %><br>
+%
+%my $old = qsearchs('svc_external',{'svcnum'=>$svcnum}) if $svcnum;
+%
+%
+%### this is the field name for usage_elec with the exception of
+%### prev_date, curr_date, _date
+%my @field_name = qw / prev_read curr_read tdsp
+% meter_multiplier total_usage measured_demand
+% billed_demand svcnum meter_number /;
+%my ($prev_date, $curr_date, $_date);
+%
+%my %usage_hash = (
+% map {
+% ($_, scalar($cgi->param($_)))
+% } ( @field_name )
+% );
+%
+% my $error = '';
+%
+% # Some general rules regarding the data
+% # prev_date, curr_date -
+% # 8 digit in format of yyyymmdd (y-year m-month d-date)
+% # prev_read, curr_read - positive interger. curr_read > prev_read
+% # tdsp - an dollar amount w/wo cent
+% # meter_multiplier - positive integer
+% # total_usage -
+% # should equal (total_usage = (prev_read-curr_read) * meter_multiplier
+% # unless meter multiplier ignore value is set
+% # measured_demand - positive integer
+% # billed_demand - positive integer
+% # meter_number - alpha numeric value
+%
+% # prev_date, curr_date -
+% # 8 digit in format of yyyymmdd (y-year m-month d-date)
+% my ($pd, $cd) = ($cgi->param('prev_date'),$cgi->param('curr_date'));
+% if ( $pd =~ /^(\d{4})(\d{2})(\d{2})$/ ) {
+% my ($y,$m,$d) = ($1,$2,$3);
+% if ($m < 01 || $m > 12 || $d < 01 || $d > 31) {
+% $error = "error: previous date '$pd' must follow the rule"
+% ." of being 8 digit in format of yyyymmdd (y-year m-month d-date)";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+% }
+% else {
+% $error = "error: previous date '$pd' must follow the rule"
+% ." of being 8 digit in format of yyyymmdd (y-year m-month d-date)";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+% if ( ($cd =~ /^(\d{4})(\d{2})(\d{2})$/) ) {
+% my ($y,$m,$d) = ($1,$2,$3);
+% if ($m < 01 || $m > 12 || $d < 01 || $d > 31) {
+% $error = "error: previous date '$cd' must follow the rule"
+% ." of being 8 digit in format of yyyymmdd (y-year m-month d-date)";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+% }
+% else {
+% $error = "error: previous date '$cd' must follow the rule"
+% ." of being 8 digit in format of yyyymmdd (y-year m-month d-date)";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+%
+%
+% my $multiplier_ignore_flag = $cgi->param('ignore_meter_multiplier');
+%
+% # check prev_read and curr_read
+% my ($pr, $cr) = ($usage_hash{'prev_read'},$usage_hash{'curr_read'});
+% if ($pr =~ /^\d+$/ && $cr =~ /^\d+$/) {
+% # prev and curr are integer
+% if ( ($pr > $cr) && (!$multiplier_ignore_flag) ) {
+% # prev > current .. this is not possible unless meter change
+% $error = "error: previous reading '$pr' is greater than current reading"
+% ." '$cr'\n";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+% }
+% else {
+% $error = "error: previous reading '$pr' or current reading '$cr'"
+% ." need to follow the simple rule of being a positive integer.\n";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+%
+% # tdsp - an dollar amount w/wo cent
+% my $tdsp = $usage_hash{'tdsp'};
+% if ( $tdsp !~ /^(\d+|\d+\.\d{2})$/ ) {
+% $error = "error: tdsp '$tdsp' must follow the rule<br>"
+% ." of being a dollar amount w/wo cent value.<br>";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+%
+% # meter_multiplier - positive integer
+% my $mm = $usage_hash{'meter_multiplier'};
+% #if ( ($mm < 0) || ($mm !~ /^\d+$/) ) {
+% if ( ($mm < 0) || ($mm !~ /^\d+\.{0,1}\d*$/) ) {
+% $error = "error: meter multiplier '$mm' must follow the rule<br>"
+% ." of being a positive integer.<br>";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+%
+% # total_usage -
+% # should equal (total_usage = (curr_read-prev_read) * meter_multiplier
+% # unless meter multiplier ignore value is set
+% my $input_tu = $usage_hash{'total_usage'};
+% my $tu = ($cr-$pr)*$mm;
+% if ( ( ($tu != $input_tu) && (! $multiplier_ignore_flag)) ) {
+% # total usage didn't equal formula and there were no ignore set
+% $error = "error: total usage '$input_tu' '$tu' must follow the formula<br>"
+% ." total_usage = (current_reading - previous_reading) * meter_multiplier<br>"
+% ." unless the meter multiplier ignore flag '$multiplier_ignore_flag' is set.<br>";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+%
+% # measured_demand - positive integer
+% my $md = $usage_hash{'measured_demand'};
+% if ( ($md < 0) || ($md !~ /^\d+$/) ) {
+% $error = "error: measured demand '$md' must follow the rule<br>"
+% ." of being a positive integer.<br>";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+%
+% # billed_demand - positive integer
+% my $bd = $usage_hash{'billed_demand'};
+% if ( ($bd < 0) || ($bd !~ /^\d+$/) ) {
+% $error = "error: billed demand '$bd' must follow the rule<br>"
+% ." of being a positive integer.<br>";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+%
+% # meter_number - alpha numeric value
+% my $mn = $usage_hash{'meter_number'};
+% if ( $mn !~ /^[a-z0-9]+$/i ) {
+% $error = "error: meter number '$mn' must follow the rule<br>"
+% ." of being a alpha numeric value.<br>";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+%
+%
+%# convert the field date to it strtime
+%$prev_date = FS::usage_elec::to_usage_elec_time($cgi->param('prev_date'));
+%unless ($prev_date) {
+% $error = "error: unable to convert prev_date ".$cgi->param('prev_date')
+% ." to a usable time for usage_elec\n";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+%}
+%
+%$curr_date = FS::usage_elec::to_usage_elec_time($cgi->param('curr_date'));
+%unless ($curr_date) {
+% $error = "error: unable to convert curr_date ".$cgi->param('curr_date')
+% ." to a usable time for usage_elec\n";
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+%}
+%
+%$_date = time;
+%
+%$usage_hash{prev_date} = $prev_date;
+%$usage_hash{curr_date} = $curr_date;
+%$usage_hash{_date} = $_date;
+%
+%my $new = new FS::usage_elec( \%usage_hash );
+%
+%if ( $svcnum ) {
+% $error = $new->insert_usage;
+%} else {
+% $error = "error: can't insert data into usage_elec table without a "
+% ."service number\n"
+%}
+%
+%if ($error) {
+% # handle can't insert data into usage_elec
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+%} else {
+% # look like the data has been inserted into usage_elec successfully
+% # now let generate the bill
+% $error = FS::usage_elec::billing_call($new);
+% if ($error) {
+% # handle can't execute billing
+% $error = "error: Execution of billing failed.\n"
+% ."$error";
+% # delete the usage_elec that was just entered because billing failed
+% $new->delete;
+% $cgi->param('error', $error);
+% print $cgi->redirect(popurl(2). "usage_elec_manual_input.cgi?"
+% . $cgi->query_string );
+% }
+%
+% print $cgi->redirect(popurl(3). "view/svc_external.cgi?$svcnum");
+%}
+%
+%
+
diff --git a/httemplate/edit/usage_elec_manual_input.cgi b/httemplate/edit/usage_elec_manual_input.cgi
new file mode 100755
index 0000000..7f9d9fa
--- /dev/null
+++ b/httemplate/edit/usage_elec_manual_input.cgi
@@ -0,0 +1,213 @@
+%my $debug=0; # toggle debug
+%my( $svcnum, $pkgnum, $svcpart, $part_svc, $svc_external );
+%my @field_descriptions = ( 'prev date', 'curr date', 'prev reading',
+% 'curr reading', 'tdsp', 'meter mult',
+% 'total usage', 'measured demand', 'billed demand',
+% 'svcnum', 'entry date', 'meter number' );
+%my @field_name = qw / prev_date curr_date prev_read curr_read tdsp
+% meter_multiplier total_usage measured_demand
+% billed_demand svcnum _date meter_number /;
+%my $date_exception = '(prev_date|curr_date|_date)';
+%
+%if ( $cgi->param('error') ) {
+% ### handle error call
+% $svcnum = $cgi->param('svcnum');
+%}
+%else {
+%
+% my($query) = $cgi->keywords;
+% $query =~ /^(\d+)$/ or die "unparsable svcnum";
+% $svcnum=$1;
+%
+%}
+%
+%# this is sample data for print in case no previous record of usage_elec
+%my @sample_data = ( '20070201', '20070228', '10000', '100100', '76.50',
+% '5', '500', '179', '220', "$svcnum", 'NA', '030234972LM');
+%
+%### this is where i start
+%###
+%### let gather all the info from usage_elec for the particular 'svcnum'
+%###
+%my $p1 = popurl(1);
+%
+%print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
+% "</FONT>"
+% if $cgi->param('error');
+%
+%print qq!<FORM ACTION="${p1}process/usage_elec_manual_input.cgi" METHOD=POST>!;
+%
+%# print header
+%print header("Manually Adding Record to usage_elec Table", '');
+%
+%#display
+%#
+%#
+<TABLE BORDER=1>
+%
+% # -ctran 04/10/08
+% # change getting previous 10 record to 13 so we can see at least 1 year
+% # worth of transaction
+% # get the previous 13 usage_elec items
+% my @usage_obj = FS::usage_elec::query_usage($svcnum, 13);
+%
+% # print the heading
+% print "<TR bgcolor=#88b2ce class='maintitle'>"
+% . join("\n", map("<TH>" . $_ . "</TH>", @field_descriptions))
+% . "</TR>\n";
+%
+% if (@usage_obj) {
+% foreach my $usage (@usage_obj) {
+% # fill @usage_ele with data order by @field_name
+% my @usage_ele = ();
+% foreach my $field (@field_name) {
+% if ( $field =~ /$date_exception/ ) {
+% # exception handling of converting time to string
+% push(@usage_ele,time2str("%Y%m%d",$usage->$field));
+% }
+% else {
+%#debug: field= <% $field %> = <% $usage->$field %><BR>
+% push(@usage_ele, $usage->$field);
+% }
+% }
+%
+% print "<TR bgcolor=#e8e8ea class='mainbody'>"
+% . join("\n", map("<TD>" . $_ . "</TD>", @usage_ele))
+% . "</TR>\n";
+% }
+% }
+%
+% ###
+% ### gathering pre-filled information
+% ###
+%
+% my ($h_prev_date, $h_prev_read, $h_tdsp, $h_meter_multiplier,
+% $h_measured_demand, $h_billed_demand, $h_svcnum, $h_meter_number);
+%
+% if (@usage_obj) {
+% # fill in all the history data
+% my $lindex = $#usage_obj;
+% $h_prev_date = time2str("%Y%m%d",$usage_obj[$lindex]->curr_date);
+% $h_prev_read = $usage_obj[$lindex]->curr_read;
+% $h_tdsp = $usage_obj[$lindex]->tdsp;
+% $h_meter_multiplier = $usage_obj[$lindex]->meter_multiplier;
+% $h_measured_demand = $usage_obj[$lindex]->measured_demand;
+% $h_billed_demand = $usage_obj[$lindex]->billed_demand;
+% $h_svcnum = $usage_obj[$lindex]->svcnum;
+% $h_meter_number = $usage_obj[$lindex]->meter_number;
+% }
+%
+% # this hash store info to configure the table with text box for input
+% # size - [int] how big textbox
+% # value - [alpha numeric] default value of the text box
+% # extra - [alpha numeric] other option for text box. I.E. READONLY
+% # mean the text box is a readonly
+% my %field_info = (
+% prev_date => {
+% 'size' => '8',
+% 'value' => $h_prev_date,
+% },
+% curr_date => { 'size' => '8' },
+% prev_read => {
+% 'size' => '8',
+% 'value' => $h_prev_read,
+% },
+% curr_read => { 'size' => '8' },
+% tdsp => {
+% 'size' => '8',
+% 'value' => $h_tdsp,
+% },
+% meter_multiplier => {
+% 'size' => '4',
+% 'value' => $h_meter_multiplier,
+% },
+% total_usage => { 'size' => '6' },
+% measured_demand => {
+% 'size' => '4',
+% 'value' => $h_measured_demand,
+% },
+% billed_demand => {
+% 'size' => '4',
+% 'value' => $h_billed_demand,
+% },
+% svcnum => {
+% 'size' => '6',
+% 'value' => $svcnum,
+% 'extra' => 'READONLY'
+% },
+% _date => {
+% 'size' => '8',
+% 'value' => 'N/A',
+% 'extra' => 'READONLY'
+% },
+% meter_number => {
+% 'size' => '14',
+% 'value' => $h_meter_number,
+% },
+% );
+%
+%
+% # input box for entry
+% print qq !<TR bgcolor=#e8e8ea class='mainbody'>!;
+% my $input_style = 'STYLE="color:#000000; background-color: #FFFFCC;"';
+% foreach my $field (@field_name) {
+% my $txt = '';
+% $txt .= ' SIZE=' . $field_info{$field}->{'size'}
+% if (exists($field_info{$field}->{'size'}));
+% $txt .= ' VALUE="' . $field_info{$field}->{'value'} . '"'
+% if (exists($field_info{$field}->{'value'}));
+% $txt .= ' ' . $field_info{$field}->{'extra'}
+% if (exists($field_info{$field}->{'extra'}));
+% if ($field eq 'meter_multiplier') {
+% print qq !
+% <TD>
+% <TABLE>
+% <TD>
+% <INPUT TYPE="text" $input_style NAME="$field" $txt>
+% </TD>
+% <TD>
+% <INPUT TYPE="checkbox" NAME="ignore_meter_multiplier">Ignore<P>
+% </TD>
+% </TABLE>
+% </TD>
+% !;
+% }
+% else {
+% print qq !
+% <TD>
+% <INPUT TYPE="text" $input_style NAME="$field" $txt>
+% </TD>
+% !;
+% }
+% }
+% print "</TR>\n";
+%
+
+</TABLE><BR>
+%print "<BR>measured demand = ",$h_measured_demand,"\n<BR>" if ($debug);
+%
+<INPUT TYPE="submit" VALUE="Submit">
+<INPUT TYPE="Reset" VALUE="Clear">
+<INPUT TYPE=BUTTON OnClick="$cgi->redirect(popurl(2)."view/svc_external.cgi?$svcnum")"
+ VALUE="Cancel">
+%
+% print qq !
+% <br><br>
+% prev_date, curr_date -
+% 8 digit in format of yyyymmdd (y-year m-month d-date)<br>
+% prev_read, curr_read - positive interger. Also, curr_read > prev_read
+% Unless meter multiplier ignore value is set. In
+% this case, this condition will be ignore.<br>
+% tdsp - an dollar amount w/wo cent<br>
+% meter_multiplier - positive integer<br>
+% total_usage -
+% should equal (total_usage = (prev_read-curr_read) * meter_multiplier)
+% unless meter multiplier ignore value is set<br>
+% measured_demand - positive integer<br>
+% billed_demand - positive integer<br>
+% !;
+%
+ </FORM>
+ </BODY>
+</HTML>
+
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index a5bcdeb..aa067e6 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -107,6 +107,7 @@ tie my %report_invoices_open, 'Tie::IxHash',
'All open invoices' => [ $fsurl.'search/cust_bill.html?OPEN_date', 'All invoices with an unpaid balance' ],
'15 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN15_date', 'Invoices 15 days or older with an unpaid balance' ],
'30 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN30_date', 'Invoices 30 days or older with an unpaid balance' ],
+ '45 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN45_date', 'Invoices 45 days or older with an unpaid balance' ],
'60 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN60_date', 'Invoices 60 days or older with an unpaid balance' ],
'90 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN90_date', 'Invoices 90 days or older with an unpaid balance' ],
'120 day open invoices' => [ $fsurl.'search/cust_bill.html?OPEN120_date', 'Invoices 120 days or older with an unpaid balance' ],
@@ -317,13 +318,42 @@ $report_menu{'SQL Query'} = [ $fsurl.'search/report_sql.html', 'SQL Query' ]
tie my %tools_importing, 'Tie::IxHash',
'Customers' => [ $fsurl.'misc/cust_main-import.cgi', '' ],
- 'Customer comments from CSV file' => [ $fsurl.'misc/cust_main_note-import.html', '' ],
- 'One-time charges from CSV file' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
- 'Payments from CSV file' => [ $fsurl.'misc/cust_pay-import.cgi', '' ],
- 'Phone numbers (DIDs)' => [ $fsurl.'misc/phone_avail-import.html', '' ],
- 'Call Detail Records (CDRs)' => [ $fsurl.'misc/cdr-import.html', '' ],
-# 'Import call rates and regions' => [ $fsurl.'misc/rate-import.html', '' ],
;
+
+$tools_importing{'Old OnPAC customers'} = #dubious name
+ [ $fsurl.'misc/cust_main-import-oldonp.cgi', '' ]
+ if $conf->exists('svc_elec_features');
+
+$tools_importing{'Import Qualified LITEUP Customers'} =
+ [ $fsurl.'misc/qualified_liteup_customers.cgi', '' ]
+ if $conf->exists('svc_elec_features');
+
+$tools_importing{'Customer comments from CSV file'} =
+ [ $fsurl.'misc/cust_main_note-import.html', '' ];
+
+$tools_importing{'Import 810 transaction data'} =
+ [ $fsurl.'misc/transaction810-import.cgi', '' ]
+ if $conf->exists('svc_elec_features');
+
+$tools_importing{'Import OnPAC EDI data'} =
+ [ $fsurl.'misc/cust_edi_data-onp.cgi', '' ]
+ if $conf->exists('svc_elec_features');
+
+$tools_importing{'One-time charges from CSV file'} =
+ [ $fsurl.'misc/cust_main-import_charges.cgi', '' ];
+
+$tools_importing{'Payments from CSV file'} =
+ [ $fsurl.'misc/cust_pay-import.cgi', '' ];
+
+$tools_importing{'Phone numbers (DIDs)'} =
+ [ $fsurl.'misc/phone_avail-import.html', '' ];
+
+$tools_importing{'Call Detail Records (CDRs)'} =
+ [ $fsurl.'misc/cdr-import.html', '' ];
+
+#$tools_importing{'Import call rates and regions'} =
+# [ $fsurl.'misc/rate-import.html', '' ];
+
if ( $conf->exists('enable_taxproducts') ) {
if ( $conf->exists('taxdatadirectdownload') ) {
$tools_importing{'Tax rates from vendor site'} =
diff --git a/httemplate/index.html b/httemplate/index.html
index 5b550db..a33ffb5 100644
--- a/httemplate/index.html
+++ b/httemplate/index.html
@@ -19,7 +19,10 @@
% my %saw = ();
% my @custnums = grep { !$saw{$_}++ } map $_->[0], @{ $sth->fetchall_arrayref };
%
-% @custnums = splice(@custnums, 0, 10);
+% my $curuser = $FS::CurrentUser::CurrentUser;
+% my $number_of_customers =
+% $curuser->option('dashboard_customer_history_length') || 10;
+% @custnums = splice(@custnums, 0, $number_of_customers);
%
% if ( @custnums ) {
diff --git a/httemplate/misc/cust_edi_data-onp.cgi b/httemplate/misc/cust_edi_data-onp.cgi
new file mode 100755
index 0000000..985637b
--- /dev/null
+++ b/httemplate/misc/cust_edi_data-onp.cgi
@@ -0,0 +1,57 @@
+<% include("/elements/header.html",'Import EDI Info') %>
+
+<FORM ACTION="process/cust_edi_data-onp.cgi" METHOD="post" ENCTYPE="multipart/form-data">
+
+Import a CSV file containing customer records.
+<BR><BR>
+
+<!-- Simple file format is CSV, with the following field order: <i>cust_pkg.setup, dayphone, first, last, address1, address2, city, state, zip, comments</i>
+<BR><BR> -->
+
+<!--
+Extended file format is CSV, with the following field order: <i>custnum<%$req%>, last<%$req%>, first<%$req%>, address1<%$req%>, address2, city state<%$req%>, zip<%$req%>, ss, daytime ph#, nightime ph#, service_lastname<%$req%>, service_firstname<%$req%>, service_address1<%$req%>, service_address2, service_city service_state <%$req%>, service_zip<%$req%>, newcustdate<%$req%></i> -->
+<BR><BR>
+
+<%$req%> Required fields
+<BR><BR>
+
+<% &ntable("#cccccc") %>
+
+<% include('/elements/tr-select-agent.html', '', #$agentnum,
+ 'label' => "<B>Agent</B>",
+ 'empty_label' => 'Select agent',
+ )
+%>
+
+<TR>
+ <TH ALIGN="right">Format</TH>
+ <TD>
+ <SELECT NAME="format">
+<!-- <OPTION VALUE="simple">Simple -->
+ <OPTION VALUE="extended" SELECTED>Extended
+ </SELECT>
+ </TD>
+</TR>
+
+<TR>
+ <TH ALIGN="right">CSV filename</TH>
+ <TD><INPUT TYPE="file" NAME="csvfile"></TD>
+</TR>
+% #include('/elements/tr-select-part_referral.html')
+%
+
+
+<!--
+-->
+
+</TABLE>
+<BR><BR>
+
+<INPUT TYPE="submit" VALUE="Import">
+</FORM>
+
+<% include('/elements/footer.html') %>
+
+<%once>
+my $req = qq!<font color="#ff0000">*</font>!;
+</%once>
diff --git a/httemplate/misc/cust_main-import-oldonp.cgi b/httemplate/misc/cust_main-import-oldonp.cgi
new file mode 100755
index 0000000..1409e0a
--- /dev/null
+++ b/httemplate/misc/cust_main-import-oldonp.cgi
@@ -0,0 +1,68 @@
+<% include("/elements/header.html",'Batch Customer Import') %>
+
+<FORM ACTION="process/cust_main-import-oldonp.cgi" METHOD="post" ENCTYPE="multipart/form-data">
+
+Import a CSV file containing customer records.
+<BR><BR>
+
+<!-- Simple file format is CSV, with the following field order: <i>cust_pkg.setup, dayphone, first, last, address1, address2, city, state, zip, comments</i>
+<BR><BR> -->
+
+Extended file format is CSV, with the following field order: <i>custnum<%$req%>, last<%$req%>, first<%$req%>, address1<%$req%>, address2, city state<%$req%>, zip<%$req%>, ss, daytime ph#, nightime ph#, service_lastname<%$req%>, service_firstname<%$req%>, service_address1<%$req%>, service_address2, service_city service_state <%$req%>, service_zip<%$req%>, newcustdate<%$req%></i>
+<BR><BR>
+
+<%$req%> Required fields
+<BR><BR>
+
+<% &ntable("#cccccc") %>
+
+<% include('/elements/tr-select-agent.html', '', #$agentnum,
+ 'label' => "<B>Agent</B>",
+ 'empty_label' => 'Select agent',
+ )
+%>
+
+<TR>
+ <TH ALIGN="right">Format</TH>
+ <TD>
+ <SELECT NAME="format">
+<!-- <OPTION VALUE="simple">Simple -->
+ <OPTION VALUE="extended" SELECTED>Extended
+ </SELECT>
+ </TD>
+</TR>
+
+<TR>
+ <TH ALIGN="right">CSV filename</TH>
+ <TD><INPUT TYPE="file" NAME="csvfile"></TD>
+</TR>
+% #include('/elements/tr-select-part_referral.html')
+%
+
+
+<!--
+<TR>
+ <TH>First package</TH>
+ <TD>
+ <SELECT NAME="pkgpart"><OPTION VALUE="">(none)</OPTION>
+% foreach my $part_pkg ( qsearch('part_pkg',{'disabled'=>'' }) ) {
+
+ <OPTION VALUE="<% $part_pkg->pkgpart %>"><% $part_pkg->pkg. ' - '. $part_pkg->comment %></OPTION>
+% }
+
+ </SELECT>
+ </TD>
+</TR>
+-->
+
+</TABLE>
+<BR><BR>
+
+<INPUT TYPE="submit" VALUE="Import">
+</FORM>
+
+<% include('/elements/footer.html') %>
+
+<%once>
+my $req = qq!<font color="#ff0000">*</font>!;
+</%once>
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index 813b560..f587bc2 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -182,7 +182,7 @@
<INPUT TYPE="hidden" NAME="paystate" VALUE="<% $paystate %>">
% }
-% if ( $conf->exists('show_ss') ) {
+% if ( $conf->exists('show_ss') && !$conf->exists('svc_elec_features') ) {
<TR>
<TD ALIGN="right">
Account&nbsp;holder<BR>
diff --git a/httemplate/misc/process/cust_edi_data-onp.cgi b/httemplate/misc/process/cust_edi_data-onp.cgi
new file mode 100755
index 0000000..4295a8d
--- /dev/null
+++ b/httemplate/misc/process/cust_edi_data-onp.cgi
@@ -0,0 +1,182 @@
+%
+%
+% my $fh = $cgi->upload('csvfile');
+% #warn $cgi;
+% #warn $fh;
+%
+% my $error = defined($fh)
+% ? FS::cust_main::batch_edidata_onp( {
+% filehandle => $fh,
+% agentnum => scalar($cgi->param('agentnum')),
+% refnum => scalar($cgi->param('refnum')),
+% pkgpart => scalar($cgi->param('pkgpart')),
+% #'fields' => [qw( cust_pkg.setup dayphone first last address1 address2
+% # city state zip comments )],
+% 'format' => scalar($cgi->param('format')),
+% } )
+% : 'No file';
+%
+% if ( $error =~ /ERROR/) {
+%
+
+ <!-- mason kludge -->
+%
+% eidiot($error);
+%# $cgi->param('error', $error);
+%# print $cgi->redirect( "${p}cust_main-import.cgi
+% } else {
+%
+%# OK let define the heading
+%
+%# general customer info
+%my @field_descriptions1 = ( '810/867 usage match','F. Name', 'L. Name', 'Cust. Num',
+% 'SVC Num', 'Balance', 'Last Billed','Last Read #', '');
+%
+%# info collected from 810 & 867 to be entered into usage_elec
+%my @field_descriptions2 = ( 'Start Date',
+% 'End Date', 'Prev Read', 'Curr Read', 'TDSP',
+% 'Meter Mulx', '867 Usage', 'Measure Demand', 'Billed Demand',
+% '','','','');
+%
+%# info from 810
+%my @field_descriptions3 = ( 'Invc #', '', 'Trans #/867 ref#', 'ESIID', '', '',
+% 'TDSP','', 'Due Date', '', 'Received Date', '810 usage', '',
+% 'Start Date', 'End Date',
+% '', '', '', '', '??', 'Billed Demand', 'Measured Demand',
+% '','','','','','');
+%
+%# info from 867
+%my @field_descriptions4 = ( 'Prev_Read', 'Curr Read', 'Multiplier',
+% 'Total Usage','');
+%
+%# info from excel formula
+%my @field_descriptions5 = ( 'Total Usage Different 810&867' );
+%
+%my @p_fields = ( 'p_prev_date', 'p_curr_date', 'p_prev_reading',
+% 'p_curr_reading', 'p_tdsp', 'p_meter_mult', 'p_total_usage',
+% 'p_measured_demand', 'p_billed_demand', 'p_svcnum',
+% 'p_first', 'p_last', 'p_balance', 'p_last_billed');
+%# 'p_entry_date', 'p_meter_number');
+%my @p_fields_associates_index = ( 9, 10, 11,
+% 12, 28, 14, 15,
+% 16, 17, 4,
+% 1, 2, 5, 6);
+%
+%#my $description = join(',',@field_descriptions);
+%
+%my @field_name = qw / prev_date curr_date prev_read curr_read tdsp
+% meter_multiplier total_usage measured_demand
+% billed_demand svcnum _date meter_number /;
+%my $date_exception = '(prev_date|curr_date|_date)';
+%my $p1 = popurl(0);
+
+% my @usage_data = split /\n/,$error;
+
+% #my @items = split /\n/,$error;
+% my (@usage_cvs, @table_item);
+% foreach my $cust_usage (@usage_data) {
+% my @usage_ele = split ',',$cust_usage;
+% my $svc_num = $usage_ele[4];
+% my $cust_last_name = $usage_ele[2];
+% my $cust_num = $usage_ele[3];
+%
+% # first thing first, let add the last reading from usage elec into table
+% # get the previous 1 usage_elec items
+% my @usage_obj = FS::usage_elec::query_usage($svc_num, 1);
+% my $usage = pop @usage_obj;
+% $usage_ele[7] = $usage->curr_read if $usage; #only if usage exist
+%
+% my $pass_str = '';
+% my $i=0;
+% foreach my $p_field (@p_fields) {
+% my $ele_index = $p_fields_associates_index[$i];
+% $i++;
+% if ($pass_str) {
+% $pass_str .= "\&${p_field}=" . $usage_ele[$ele_index];
+% }
+% else {
+% $pass_str = "${p_field}=" . $usage_ele[$ele_index];
+% }
+% }
+%
+% $usage_ele[2]="<A HREF=\"../../view/cust_main.cgi?${cust_num}\" target=\"_blank\">${cust_last_name}</A>";
+%
+% $usage_ele[3]="<A HREF=\"../../edit/usage_elec_prefilled_input.cgi?${pass_str}\" target=\"_blank\">$cust_num</A>";
+
+% # insert TD tag
+% my $str = join("\n", map("<TD>" . $_ . "</TD>", @usage_ele));
+%
+% # let figure out if this particular usage data has already been entered
+% # into the usage_elec table
+% # if it has, highlight it so the user can identify it
+% # To check for this, we perform some quick check (prev_date, curr_date,
+% # prev_reading, curr_reading, and total_usage)
+% my @exist_in_usage_elec; #identify usage exist in usage_elec table
+% my @usages_history = qsearch ( {
+% 'table' => 'usage_elec',
+% 'hashref' => { 'op' => '=',
+% 'svcnum' => $svc_num
+% },
+% # sort in DESCending order so it easier to splice
+% # the array in the next step
+% 'extra_sql' => 'ORDER BY _date DESC'
+% } );
+% #my $usage_history_no = scalar(@usages_history);
+% my (%h_prev_date, %h_curr_date, %h_prev_read, %h_curr_read,
+% %h_total_usage);
+% foreach my $usage (@usages_history) {
+% $h_prev_date{$usage->prev_date} = 1;
+% $h_curr_date{$usage->curr_date} = 1;
+% $h_prev_read{$usage->prev_read} = 1;
+% $h_curr_read{$usage->curr_read} = 1;
+% $h_total_usage{$usage->total_usage} = 1;
+% }
+%
+% if ( exists $h_prev_date{str2time($usage_ele[9])} &&
+% exists $h_curr_date{str2time($usage_ele[10])} &&
+% exists $h_prev_read{$usage_ele[11]} &&
+% exists $h_curr_read{$usage_ele[12]} &&
+% exists $h_total_usage{$usage_ele[15]} ) {
+% # when data already entered into usage_elec
+% $str = "<tr bgcolor=\"#9999ff\">$str</tr>";
+%
+% }
+% else {
+% $str = "<tr>$str</tr>";
+% }
+%
+% push(@table_item,$str);
+% push(@usage_cvs,join(',',@usage_ele)); #for exporting csv purposes
+% }
+%
+% my $str_cvs = join "<BR>",@usage_cvs; #for exporting csv purposes
+% #print $str_cvs;
+ <!-- mason kludge -->
+ <% include("/elements/header.html","Import successful") %>
+<table border="2" frame="border" rules="all">
+%
+% # print the heading
+% print "<tr class='maintitle'>"
+% . join("\n", map("<th bgcolor=\"#88b2ce\">" . $_ . "</th>", @field_descriptions1))
+% . join("\n", map("<th bgcolor=\"#ffff99\">" . $_ . "</th>", @field_descriptions2))
+% . join("\n", map("<th bgcolor=\"#ff9999\">" . $_ . "</th>", @field_descriptions3))
+% . join("\n", map("<th bgcolor=\"#66cc00\">" . $_ . "</th>", @field_descriptions4))
+% . join("\n", map("<th bgcolor=\"#ff99cc\">" . $_ . "</th>", @field_descriptions5))
+% . "</tr>\n";
+%
+% # print the table
+% foreach my $e (@table_item) {
+% #print "<TR>$e</TR>";
+% print $e;
+% }
+</table>
+%
+% # dumping CSV data out
+% #foreach my $cvs_item (@usage_cvs) {
+% # print "$cvs_item<BR>";
+% #}
+
+%
+% }
+%
+
diff --git a/httemplate/misc/process/cust_main-import-oldonp.cgi b/httemplate/misc/process/cust_main-import-oldonp.cgi
new file mode 100755
index 0000000..9bc4a45
--- /dev/null
+++ b/httemplate/misc/process/cust_main-import-oldonp.cgi
@@ -0,0 +1,35 @@
+%
+%
+% my $fh = $cgi->upload('csvfile');
+% #warn $cgi;
+% #warn $fh;
+%
+% my $error = defined($fh)
+% ? FS::cust_main::batch_import_onp( {
+% filehandle => $fh,
+% agentnum => scalar($cgi->param('agentnum')),
+% refnum => scalar($cgi->param('refnum')),
+% pkgpart => scalar($cgi->param('pkgpart')),
+% #'fields' => [qw( cust_pkg.setup dayphone first last address1 address2
+% # city state zip comments )],
+% 'format' => scalar($cgi->param('format')),
+% } )
+% : 'No file';
+%
+% if ( $error ) {
+%
+
+ <!-- mason kludge -->
+%
+% eidiot($error);
+%# $cgi->param('error', $error);
+%# print $cgi->redirect( "${p}cust_main-import.cgi
+% } else {
+%
+
+ <!-- mason kludge -->
+ <% include("/elements/header.html",'Import successful') %>
+%
+% }
+%
+
diff --git a/httemplate/misc/process/qualified_liteup_customers.cgi b/httemplate/misc/process/qualified_liteup_customers.cgi
new file mode 100755
index 0000000..640bbc6
--- /dev/null
+++ b/httemplate/misc/process/qualified_liteup_customers.cgi
@@ -0,0 +1,139 @@
+<% include("/elements/header.html",'LITEUP') %>
+%
+% my $fh = $cgi->upload('textfile');
+%
+% my $action = $cgi->param('action');
+% #print '<br><br>'.$action.'<br><br>';
+% # read the text file and test for accuracy
+% # we are expection each line of the file to contain
+% # ESIIDxxxxADDRESSxxxxCITYxxxxSTATEZIPxxxxLITEUPDURATION
+% # whese x is multiple whitespace
+% #
+% my $line;
+% my @newlist;
+% my $i =0;
+% while ( defined($line=<$fh>) ) {
+% $newlist[$i] = [ split /\s{2,}/, $line ];
+% $i++;
+% }
+%
+% if ($action eq 'Get Report') { #liteup audit
+% my ($beg,$end) = FS::UI::Web::parse_beginning_ending($cgi);
+% $beg = str2time("1/1/2008") unless ($beg);
+% $end = str2time(`date`) unless ($end);
+% print '<h3>Audit from ' . time2str("%D",$beg) .' through '.
+% ($end == 4294967295 ? 'NOW' : time2str("%D",$end)) .'</h3>';
+%
+% my @cust_bills = qsearch ( {
+% 'table' => 'cust_bill_pkg_detail',
+% 'hashref' => { 'curr_date' => {
+% 'op' => '>=',
+% 'value' => "$beg",
+% }
+% },
+% 'extra_sql'=> "AND curr_date <= $end
+% AND discount1_rate > 0
+% ORDER BY esiid ASC",
+% });
+% my %liteup_cust;
+% foreach my $cust_bill_pkg (@cust_bills) {
+% if ($cust_bill_pkg->discount1_rate) {
+% $cust_bill_pkg->esiid =~ /^\s*(\d{4})\d+$/;
+% $liteup_cust{$1}{$cust_bill_pkg->esiid}{$cust_bill_pkg->curr_date}{discount} =
+% $cust_bill_pkg->discount1_total;
+% $liteup_cust{$1}{$cust_bill_pkg->esiid}{$cust_bill_pkg->curr_date}{usage} =
+% int($cust_bill_pkg->energy_usage);
+% # let get the custnum
+% my $cust_bill = qsearchs( {
+% 'table' => 'cust_bill',
+% 'hashref' => { 'invnum' => { 'op' => '=',
+% 'value' => $cust_bill_pkg->invnum,
+% }
+% }
+% });
+% $liteup_cust{$1}{$cust_bill_pkg->esiid}{$cust_bill_pkg->curr_date}{custnum} =
+% $cust_bill->custnum;
+% }
+% }
+
+% foreach my $esiid_4 (sort keys %liteup_cust) {
+% print '<br><FONT COLOR="#FF0000"><b>'. $esiid_4 .'</FONT></b><br>';
+% my $total = 0;
+% my $total_usage = 0;
+% foreach my $esiid (sort keys %{$liteup_cust{$esiid_4}}) {
+% print '----'. $esiid .'<br>';
+% foreach my $date (sort keys %{$liteup_cust{$esiid_4}{$esiid}}) {
+% print '&nbsp;'x10
+% . $liteup_cust{$esiid_4}{$esiid}{$date}{custnum}
+% . ':'. time2str("%D",$date)
+% . ':'. $liteup_cust{$esiid_4}{$esiid}{$date}{usage} .'kWh'
+% . ':$'. $liteup_cust{$esiid_4}{$esiid}{$date}{discount}
+% . '<br>';
+% $total += $liteup_cust{$esiid_4}{$esiid}{$date}{discount};
+% $total_usage += $liteup_cust{$esiid_4}{$esiid}{$date}{usage};
+% }
+% }
+% #printf "==<FONT COLOR="#FF0000"><b>%dkWh' . $total_usage .'kWh'.':$'. $total .'</FONT></b><br>';
+% printf "==<FONT COLOR='#FF0000'><b>%dkWh:\$%.2f</FONT></b><br>",$total_usage,$total;
+% }
+%
+% }
+%elsif ($action eq 'Process List') {
+% print 'UNDER CONSTRUCTION<BR>';
+%# my @cust_main = qsearch ( {
+%# 'table' => 'cust_main',
+%# 'extra_sql' => 'ORDER BY custnum ASC'
+%# } );
+%
+%# my %liteup_cust;
+%# $i=1;
+%# foreach my $cust (@cust_main) {
+%# if ($i<2000) {
+%# #print $cust->custnum . "=>" . $cust->first . "," . $cust->last . "<br>";
+%# #print $cust->custnum . "<br>";
+%# my @packages = get_packages($cust);
+%# foreach my $cust_pkg (@packages) {
+%# my $part_pkg = $cust_pkg->part_pkg;
+%## print 'PKG: '. $part_pkg->pkg . "<br>";
+%# my @part_pkg_option = $part_pkg->part_pkg_option;
+%# my @cust_svc = $cust_pkg->cust_svc(3);
+%# foreach my $custsvc (@cust_svc) {
+%# my $liteup_discount;
+%# foreach my $pkg_option (@part_pkg_option) {
+%## print 'optionname:'.$pkg_option->optionname.'-----optionvalue:'
+%## .$pkg_option->optionvalue .'<br>';
+%# if ($pkg_option->optionname eq 'rate1_discount' &&
+%# $pkg_option->optionvalue) {
+%# $liteup_discount = $pkg_option->optionvalue;
+%# }
+%# }
+%
+%# my $svc_x = $custsvc->svc_x;
+%## print "svcnum = " . $custsvc->svcnum . "<br>" if $custsvc;
+%## print $svc_x->id . ':'. $svc_x->title .'<br>';
+
+%# if ($svc_x->title eq 'ESIID' && $svc_x->id && $liteup_discount) {
+%# print $cust->custnum . "=>" . $cust->first . "," . $cust->last . "<br>";
+%# print 'PKG: '. $part_pkg->pkg . "<br>";
+%# print $svc_x->id . ':'. $svc_x->title .'<br>';
+%# print 'disount:' . $liteup_discount . '<br>;
+%# $liteup_cust{$cust->custnum}{first} = $cust->first;
+%# $liteup_cust{$cust->custnum}{last} = $cust->last;
+%# $liteup_cust{$cust->custnum}{esiid} = $cust->esiid;
+%# $liteup_cust{$cust->custnum}{discount} = $liteup_discount;
+%# }
+%# }
+%# }
+%# }
+%# $i++;
+%# }
+%
+%} #end elsif
+%# sub get_packages {
+%# my $cust_main = shift or return undef;
+%
+%
+%# return $cust_main->ncancelled_pkgs();
+
+%# }
+<% include('/elements/footer.html') %>
diff --git a/httemplate/misc/process/transaction810-import.cgi b/httemplate/misc/process/transaction810-import.cgi
new file mode 100755
index 0000000..ab31bc6
--- /dev/null
+++ b/httemplate/misc/process/transaction810-import.cgi
@@ -0,0 +1,23 @@
+%
+%
+% my $fh = $cgi->upload('csvfile');
+% #warn $cgi;
+% #warn $fh;
+%
+% my $error = FS::transaction810::testing( {
+% filehandle => $fh,
+% 'format' => scalar($cgi->param('format')),
+% } );
+%
+% if ( $error ) {
+%
+
+<b><% $error %></b>
+%
+% } else {
+%
+<b>Not Successful!</b>
+%
+% }
+%
+
diff --git a/httemplate/misc/qualified_liteup_customers.cgi b/httemplate/misc/qualified_liteup_customers.cgi
new file mode 100755
index 0000000..d0aa992
--- /dev/null
+++ b/httemplate/misc/qualified_liteup_customers.cgi
@@ -0,0 +1,71 @@
+<% include("/elements/header.html",'LITEUP') %>
+
+<h3> <FONT COLOR="Blue">Process new Liteup List</FONT></h3>
+<FORM ACTION="process/qualified_liteup_customers.cgi" METHOD="post" ENCTYPE="multipart/form-data">
+
+Import a text file from PUCT containg qualified LITEUP customers.
+<BR>
+The text file should contain ESIID, Address, City, StateZip, Qualifydate. All seperated by 2 or more white spaces.
+<BR><BR>
+ie.
+<BR>
+10032789488231455 3608 ORING EDINBURG TX78539 2008030120080731<BR>
+1008939284701838499830 2206 W REEN RD HOUSTON TX77067 2008030120080731
+<BR><BR>
+
+<% &ntable("#cccccc") %>
+
+<% include('/elements/tr-select-agent.html', '', #$agentnum,
+ 'label' => "<B>Agent</B>",
+ 'empty_label' => 'Select agent',
+ )
+%>
+
+<!--
+<TR>
+ <TH ALIGN="right">Format</TH>
+ <TD>
+ <SELECT NAME="format">
+ <OPTION VALUE="simple">Simple
+ <OPTION VALUE="extended" SELECTED>Extended
+ </SELECT>
+ </TD>
+</TR>
+-->
+
+<TR>
+ <TH ALIGN="right">filename</TH>
+ <TD><INPUT TYPE="file" NAME="textfile"></TD>
+</TR>
+% #include('/elements/tr-select-part_referral.html')
+%
+
+</TABLE>
+<BR>
+
+<INPUT STYLE="background-color:lightgreen" TYPE="submit" name="action" VALUE="Process List">
+
+<BR><BR>
+<hr color="#CC2277" size="5">
+
+<h3> <FONT COLOR="Blue">Audit Liteup Program</FONT></h3>
+
+<TABLE>
+<% include( '/elements/tr-input-beginning_ending.html' ) %>
+</TABLE>
+
+<BR>
+<INPUT STYLE="background-color:lightgreen" TYPE="submit" name="action" VALUE="Get Report">
+
+<BR><BR>
+<hr color="#CC2277" size="5">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+
+<%once>
+my $req = qq!<font color="#ff0000">*</font>!;
+</%once>
+
+
diff --git a/httemplate/misc/transaction810-import.cgi b/httemplate/misc/transaction810-import.cgi
new file mode 100755
index 0000000..e957666
--- /dev/null
+++ b/httemplate/misc/transaction810-import.cgi
@@ -0,0 +1,76 @@
+<% include("/elements/header.html",'Batch Customer Import') %>
+
+<FORM ACTION="process/transaction810-import.cgi" METHOD="post" ENCTYPE="multipart/form-data">
+
+Import a CSV file containing 810 data.
+<BR><BR>
+
+<!-- Simple file format is CSV, with the following field order: <i>duns, inv_num, 867_usage, esiid, tdsp, due_date, inv_date, usage_kwatts, srvc_from_date, srvc_to_date, puct_fund, billed_demand, measure_demand, bill_status, billing_type, 997_ack</i>
+<BR><BR> -->
+
+Extended file format is CSV, with the
+<BR><BR>
+
+<%$req%> Required fields
+<BR><BR>
+
+[1] This field has special treatment upon import: If a string is passed instead
+of an integer, the string is searched for and if necessary auto-created in the
+target table.
+<BR><BR>
+
+[2] <i>username</i> and <i>_password</i> are required if <i>pkgpart</i> is specified.
+<BR><BR>
+
+<% &ntable("#cccccc") %>
+
+<% include('/elements/tr-select-agent.html', '', #$agentnum,
+ 'label' => "<B>Agent</B>",
+ 'empty_label' => 'Select agent',
+ )
+%>
+
+<TR>
+ <TH ALIGN="right">Format</TH>
+ <TD>
+ <SELECT NAME="format">
+<!-- <OPTION VALUE="simple">Simple -->
+ <OPTION VALUE="extended" SELECTED>Extended
+ </SELECT>
+ </TD>
+</TR>
+
+<TR>
+ <TH ALIGN="right">CSV filename</TH>
+ <TD><INPUT TYPE="file" NAME="csvfile"></TD>
+</TR>
+% #include('/elements/tr-select-part_referral.html')
+%
+
+
+<!--
+<TR>
+ <TH>First package</TH>
+ <TD>
+ <SELECT NAME="pkgpart"><OPTION VALUE="">(none)</OPTION>
+% foreach my $part_pkg ( qsearch('part_pkg',{'disabled'=>'' }) ) {
+
+ <OPTION VALUE="<% $part_pkg->pkgpart %>"><% $part_pkg->pkg. ' - '. $part_pkg->comment %></OPTION>
+% }
+
+ </SELECT>
+ </TD>
+</TR>
+-->
+
+</TABLE>
+<BR><BR>
+
+<INPUT TYPE="submit" VALUE="Import">
+</FORM>
+
+<% include('/elements/footer.html') %>
+
+<%once>
+my $req = qq!<font color="#ff0000">*</font>!;
+</%once>
diff --git a/httemplate/misc/usage_elec_prefilled_input.cgi b/httemplate/misc/usage_elec_prefilled_input.cgi
new file mode 100755
index 0000000..43b45d0
--- /dev/null
+++ b/httemplate/misc/usage_elec_prefilled_input.cgi
@@ -0,0 +1,245 @@
+%my $debug=0; # toggle debug
+%my ($svcnum, $p_prev_date, $p_curr_date, $p_prev_reading, $p_curr_reading,
+% $p_tdsp, $p_meter_mult, $p_total_usage, $p_measured_demand,
+% $p_billed_demand, $p_svcnum, $p_entry_date, $p_meter_number,
+% $p_first, $p_last, $p_balance, $p_last_billed);
+%my ($pkgnum, $svcpart, $svc_external );
+%my @field_descriptions = ( 'prev date', 'curr date', 'prev reading',
+% 'curr reading', 'tdsp', 'meter mult',
+% 'total usage', 'measured demand', 'billed demand',
+% 'svcnum', 'entry date', 'meter number' );
+%my @field_name = qw / prev_date curr_date prev_read curr_read tdsp
+% meter_multiplier total_usage measured_demand
+% billed_demand svcnum _date meter_number /;
+%my $date_exception = '(prev_date|curr_date|_date)';
+%
+%if ( $cgi->param('error') ) {
+% ### handle error call
+% $svcnum = $cgi->param('svcnum');
+%}
+%else {
+%
+% my($query) = $cgi->keywords;
+%# $query =~ /^(\d+)$/ or die "unparsable svcnum";
+% #$svcnum=$1;
+%
+% $p_prev_date = $cgi->param('p_prev_date');
+% $p_curr_date = $cgi->param('p_curr_date');
+% $p_prev_reading = $cgi->param('p_prev_reading');
+% $p_curr_reading = $cgi->param('p_curr_reading');
+% $p_tdsp = $cgi->param('p_tdsp');
+% $p_meter_mult = $cgi->param('p_meter_mult');
+% $p_total_usage = $cgi->param('p_total_usage');
+% $p_measured_demand = $cgi->param('p_measured_demand');
+% $p_billed_demand = $cgi->param('p_billed_demand');
+% $p_svcnum = $svcnum = $cgi->param('p_svcnum');
+% $p_first = $cgi->param('p_first');
+% $p_last = $cgi->param('p_last');
+% $p_balance = $cgi->param('p_balance');
+% $p_last_billed = $cgi->param('p_last_billed');
+% #$svcnum = $cgi->param('p_meter_number');
+%}
+%
+%# this is sample data for print in case no previous record of usage_elec
+%my @sample_data = ( '20070201', '20070228', '10000', '100100', '76.50',
+% '5', '500', '179', '220', "$svcnum", 'NA', '030234972LM');
+%
+%### this is where i start
+%###
+%### let gather all the info from usage_elec for the particular 'svcnum'
+%###
+%my $p1 = popurl(1);
+%
+%print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
+% "</FONT>"
+% if $cgi->param('error');
+%
+%print qq!<FORM ACTION="${p1}process/usage_elec_manual_input.cgi" METHOD=POST>!;
+%
+%# print header
+%#print header("Manually Adding Record to usage_elec Table", '');
+%print header("NAME: ${p_first} ${p_last}", '');
+%print header("BALANCE: \$${p_balance} LAST BILLED: ${p_last_billed}", '');
+%
+%#display
+%#
+%#
+<TABLE BORDER=1>
+%
+% # -ctran 04/10/08
+% # change getting previous 10 record to 13 so we can see at least 1 year
+% # worth of transaction
+% # get the previous 13 usage_elec items
+% my @usage_obj = FS::usage_elec::query_usage($svcnum, 13);
+%
+% # print the heading
+% print "<TR bgcolor=#88b2ce class='maintitle'>"
+% . join("\n", map("<TH>" . $_ . "</TH>", @field_descriptions))
+% . "</TR>\n";
+%
+% if (@usage_obj) {
+% foreach my $usage (@usage_obj) {
+% # fill @usage_ele with data order by @field_name
+% my @usage_ele = ();
+% foreach my $field (@field_name) {
+% if ( $field =~ /$date_exception/ ) {
+% # exception handling of converting time to string
+% push(@usage_ele,time2str("%Y%m%d",$usage->$field));
+% }
+% else {
+%#debug: field= <% $field %> = <% $usage->$field %><BR>
+% push(@usage_ele, $usage->$field);
+% }
+% }
+%
+% print "<TR bgcolor=#e8e8ea class='mainbody'>"
+% . join("\n", map("<TD>" . $_ . "</TD>", @usage_ele))
+% . "</TR>\n";
+% }
+% }
+%
+% ###
+% ### gathering pre-filled information
+% ###
+%
+% my ($h_prev_date, $h_prev_read, $h_tdsp, $h_meter_multiplier,
+% $h_measured_demand, $h_billed_demand, $h_svcnum, $h_meter_number);
+%
+% if (@usage_obj) {
+% # fill in all the history data
+% my $lindex = $#usage_obj;
+% $h_prev_date = time2str("%Y%m%d",$usage_obj[$lindex]->curr_date);
+% $h_prev_read = $usage_obj[$lindex]->curr_read;
+% $h_tdsp = $usage_obj[$lindex]->tdsp;
+% $h_meter_multiplier = $usage_obj[$lindex]->meter_multiplier;
+% $h_measured_demand = $usage_obj[$lindex]->measured_demand;
+% $h_billed_demand = $usage_obj[$lindex]->billed_demand;
+% $h_svcnum = $usage_obj[$lindex]->svcnum;
+% $h_meter_number = $usage_obj[$lindex]->meter_number;
+% }
+%
+% # let figure out if tdsp is charge or not (only charge for BUSINESS)
+% my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$p_svcnum});
+% my $part_svc = qsearchs('part_svc',{'svcpart' => $cust_svc->svcpart});
+% $p_tdsp = '0.00' if ($part_svc->svc !~ /BUSINESS/i);
+%
+% # this hash store info to configure the table with text box for input
+% # size - [int] how big textbox
+% # value - [alpha numeric] default value of the text box
+% # extra - [alpha numeric] other option for text box. I.E. READONLY
+% # mean the text box is a readonly
+% my %field_info = (
+% prev_date => {
+% 'size' => '8',
+% 'value' => $p_prev_date,
+% },
+% curr_date => { 'size' => '8',
+% 'value' => $p_curr_date,
+% },
+% prev_read => {
+% 'size' => '8',
+% 'value' => $p_prev_reading,
+% },
+% curr_read => { 'size' => '8',
+% 'value' => $p_curr_reading,
+% },
+% tdsp => {
+% 'size' => '8',
+% 'value' => $p_tdsp/100,
+% },
+% meter_multiplier => {
+% 'size' => '4',
+% 'value' => $p_meter_mult,
+% },
+% total_usage => { 'size' => '6',
+% 'value' => $p_total_usage,
+% },
+% measured_demand => {
+% 'size' => '4',
+% 'value' => $p_measured_demand,
+% },
+% billed_demand => {
+% 'size' => '4',
+% 'value' => $p_billed_demand,
+% },
+% svcnum => {
+% 'size' => '6',
+% 'value' => $p_svcnum,
+% 'extra' => 'READONLY'
+% },
+% _date => {
+% 'size' => '8',
+% 'value' => 'N/A',
+% 'extra' => 'READONLY'
+% },
+% meter_number => {
+% 'size' => '14',
+% 'value' => $h_meter_number,
+% },
+% );
+%
+%
+% # input box for entry
+% print qq !<TR bgcolor=#e8e8ea class='mainbody'>!;
+% my $input_style = 'STYLE="color:#000000; background-color: #FFFFCC;"';
+% foreach my $field (@field_name) {
+% my $txt = '';
+% $txt .= ' SIZE=' . $field_info{$field}->{'size'}
+% if (exists($field_info{$field}->{'size'}));
+% $txt .= ' VALUE="' . $field_info{$field}->{'value'} . '"'
+% if (exists($field_info{$field}->{'value'}));
+% $txt .= ' ' . $field_info{$field}->{'extra'}
+% if (exists($field_info{$field}->{'extra'}));
+% if ($field eq 'meter_multiplier') {
+% print qq !
+% <TD>
+% <TABLE>
+% <TD>
+% <INPUT TYPE="text" $input_style NAME="$field" $txt>
+% </TD>
+% <TD>
+% <INPUT TYPE="checkbox" NAME="ignore_meter_multiplier">Ignore<P>
+% </TD>
+% </TABLE>
+% </TD>
+% !;
+% }
+% else {
+% print qq !
+% <TD>
+% <INPUT TYPE="text" $input_style NAME="$field" $txt>
+% </TD>
+% !;
+% }
+% }
+% print "</TR>\n";
+%
+
+</TABLE><BR>
+%print "<BR>measured demand = ",$h_measured_demand,"\n<BR>" if ($debug);
+%
+<INPUT TYPE="submit" VALUE="Submit">
+<INPUT TYPE="Reset" VALUE="Clear">
+<INPUT TYPE=BUTTON OnClick="$cgi->redirect(popurl(2)."view/svc_external.cgi?$svcnum")"
+ VALUE="Cancel">
+%
+% print qq !
+% <br><br>
+% prev_date, curr_date -
+% 8 digit in format of yyyymmdd (y-year m-month d-date)<br>
+% prev_read, curr_read - positive interger. Also, curr_read > prev_read
+% Unless meter multiplier ignore value is set. In
+% this case, this condition will be ignore.<br>
+% tdsp - an dollar amount w/wo cent<br>
+% meter_multiplier - positive integer<br>
+% total_usage -
+% should equal (total_usage = (prev_read-curr_read) * meter_multiplier)
+% unless meter multiplier ignore value is set<br>
+% measured_demand - positive integer<br>
+% billed_demand - positive integer<br>
+% !;
+%
+ </FORM>
+ </BODY>
+</HTML>
+
diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html
index a340b7f..7522b8e 100644
--- a/httemplate/pref/pref-process.html
+++ b/httemplate/pref/pref-process.html
@@ -56,6 +56,7 @@ unless ( $error ) { # if ($access_user) {
show_pkgnum show_confitem_counts export_getsettings
show_db_profile save_db_profile
height width availHeight availWidth colorDepth
+ dashboard_customer_history_length
);
foreach (@paramlist) {
diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html
index ab76c3b..0e24e6a 100644
--- a/httemplate/pref/pref.html
+++ b/httemplate/pref/pref.html
@@ -53,6 +53,22 @@ Interface
</SELECT>
</TD>
</TR>
+
+ <TR>
+ <TH ALIGN="right">Dashboard customer history: </TH>
+ <TD COLSPAN=2>
+ <SELECT NAME="dashboard_customer_history_length">
+% foreach my $view ( qw( 5 10 15 20 25 ) ) {
+% my $selected =
+% $customer_views{$view} eq
+% $curuser->option('dashboard_customer_history_length')
+% ? 'SELECTED'
+% : '';
+ <OPTION VALUE="<%$view%>" <%$selected%>><%$view%></OPTION>
+% }
+ </SELECT>
+ </TD>
+ </TR>
<TR>
<TH ALIGN="right" COLSPAN=1>Disable HTML editor for customer notes: </TH>
diff --git a/httemplate/view/cust_bill-pdf.cgi b/httemplate/view/cust_bill-pdf.cgi
index 51e47e0..c1639fd 100755
--- a/httemplate/view/cust_bill-pdf.cgi
+++ b/httemplate/view/cust_bill-pdf.cgi
@@ -31,6 +31,12 @@ my $cust_bill = qsearchs({
});
die "Invoice #$invnum not found!" unless $cust_bill;
+if ( $notice_name eq 'Record' ) {
+ $opt{base}='rec';
+} elsif ( $notice_name eq 'Record Ignoring DUE DATE' ) {
+ $opt{base}='rec';
+ $opt{ignore_due_date}=1;
+}
my $pdf = $cust_bill->print_pdf(\%opt);
http_header('Content-Type' => 'application/pdf' );
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi
index ce8d96a..4e97bb5 100755
--- a/httemplate/view/cust_bill.cgi
+++ b/httemplate/view/cust_bill.cgi
@@ -78,6 +78,15 @@
<A HREF="<% $p %>view/cust_bill-pdf.cgi?<% $link %>">View typeset invoice PDF</A>
<BR><BR>
+% if ( $conf->exists('svc_elec_features') ) {
+% my $reclink = "invnum=$invnum";
+% $reclink .= ';template='. uri_escape($template) if $template;
+ <A HREF="<% $p %>view/cust_bill-pdf.cgi?<% "$reclink;notice_name=Record" %>">View Record</A><BR>
+ <A HREF="<% $p %>view/cust_bill-pdf.cgi?<% "$reclink;notice_name=Record Ignoring DUE DATE" %>">View Record Ignoring DUE DATE</A>
+<BR><BR>
+
+% }
+
% }
% my $br = 0;
diff --git a/httemplate/view/svc_external.cgi b/httemplate/view/svc_external.cgi
index 77679d8..cee0262 100644
--- a/httemplate/view/svc_external.cgi
+++ b/httemplate/view/svc_external.cgi
@@ -23,6 +23,10 @@
</TABLE></TD></TR></TABLE>
+<BR>
+% if ($conf->exists('svc_elec_features')) {
+<A HREF="<%$p%>edit/usage_elec_manual_input.cgi?<%$svcnum%>">Manually manipulate electric usage</A><BR>
+% }
<BR><% joblisting({'svcnum'=>$svcnum}, 1) %>
<% include('/elements/footer.html') %>