[freeside-commits] freeside/httemplate/browse part_referral.cgi,
1.21, NONE part_referral.html, NONE, 1.1
Ivan,,,
ivan at wavetail.420.am
Thu Aug 10 04:55:52 PDT 2006
- Previous message: [freeside-commits] freeside/FS/FS Schema.pm, 1.21,
1.22 part_referral.pm, 1.4, 1.5 Record.pm, 1.118,
1.119 AccessRight.pm, 1.4, 1.5 access_user.pm, 1.6, 1.7
- Next message: [freeside-commits]
freeside/httemplate/edit part_referral.cgi, 1.10,
NONE part_referral.html, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail:/tmp/cvs-serv20579/httemplate/browse
Added Files:
part_referral.html
Removed Files:
part_referral.cgi
Log Message:
agent-virtualize advertising sources
--- NEW FILE: part_referral.html ---
<%= include("/elements/header.html","Advertising source Listing" ) %>
Where a customer heard about your service. Tracked for informational purposes.
<BR><BR>
<A HREF="<%= $p %>edit/part_referral.html"><I>Add a new advertising source</I></A>
<BR><BR>
<%
my $today = timelocal(0, 0, 0, (localtime(time))[3..5] );
my %after;
tie %after, 'Tie::IxHash',
'Today' => 0,
'Yesterday' => 86400, # 60sec * 60min * 24hrs
'Past week' => 518400, # 60sec * 60min * 24hrs * 6days
'Past 30 days' => 2505600, # 60sec * 60min * 24hrs * 29days
'Past 60 days' => 5097600, # 60sec * 60min * 24hrs * 59days
'Past 90 days' => 7689600, # 60sec * 60min * 24hrs * 89days
'Past 6 months' => 15724800, # 60sec * 60min * 24hrs * 182days
'Past year' => 31486000, # 60sec * 60min * 24hrs * 364days
'Total' => $today,
;
my %before = (
'Today' => 86400, # 60sec * 60min * 24hrs
'Yesterday' => 0,
'Past week' => 86400, # 60sec * 60min * 24hrs
'Past 30 days' => 86400, # 60sec * 60min * 24hrs
'Past 60 days' => 86400, # 60sec * 60min * 24hrs
'Past 90 days' => 86400, # 60sec * 60min * 24hrs
'Past 6 months' => 86400, # 60sec * 60min * 24hrs
'Past year' => 86400, # 60sec * 60min * 24hrs
'Total' => 86400, # 60sec * 60min * 24hrs
);
my $curuser = $FS::CurrentUser::CurrentUser;
my $extra_sql = $curuser->agentnums_sql;
$extra_sql .= ' OR agentnum IS NULL '
if $curuser->access_right('Edit global advertising sources');
$extra_sql = " WHERE $extra_sql";
my $statement = "SELECT COUNT(*) FROM h_cust_main
WHERE history_action = 'insert'
AND refnum = ?
AND history_date >= ?
AND history_date < ?
AND ". $curuser->agentnums_sql;
my $sth = dbh->prepare($statement)
or die dbh->errstr;
my $show_agentnums = scalar($curuser->agentnums);
%>
<%= include('/elements/table-grid.html') %>
<% my $bgcolor1 = '#eeeeee';
my $bgcolor2 = '#ffffff';
my $bgcolor = '';
%>
<TR>
<TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=2 ROWSPAN=2>Advertising source</TH>
<% if ( $show_agentnums ) { %>
<TH CLASS="grid" BGCOLOR="#cccccc" ROWSPAN=2>Agent</TH>
<% } %>
<TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<%= scalar(keys %after) %>>Customers</TH>
</TR>
<% for my $period ( keys %after ) { %>
<TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1><%= $period %></FONT></TH>
<% } %>
</TR>
<%
foreach my $part_referral (
qsearch({
'table' => 'part_referral',
'extra_sql' => "$extra_sql ORDER BY refnum",
})
) {
if ( $bgcolor eq $bgcolor1 ) {
$bgcolor = $bgcolor2;
} else {
$bgcolor = $bgcolor1;
}
%>
<TR>
<TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF="<%= $p %>edit/part_referral.html?<%= $part_referral->refnum %>">
<%= $part_referral->refnum %></A></TD>
<TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><A HREF="<%= $p %>edit/part_referral.html?<%= $part_referral->refnum %>">
<%= $part_referral->referral %></A></TD>
<% if ( $show_agentnums ) { %>
<TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $part_referral->agentnum ? $part_referral->agent->agent : '(global)' %></TD>
<% } %>
<% for my $period ( keys %after ) {
$sth->execute( $part_referral->refnum,
$today-$after{$period},
$today+$before{$period},
) or die $sth->errstr;
my $number = $sth->fetchrow_arrayref->[0];
%>
<TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ALIGN="right"><%= $number %></TD>
<% } %>
</TR>
<% } %>
<%
$statement =~ s/AND refnum = \?//;
$sth = dbh->prepare($statement)
or die dbh->errstr;
%>
<TR>
<TD BGCOLOR="#dddddd" COLSPAN=3><B>Total</B></TD>
<% for my $period ( keys %after ) {
$sth->execute( $today-$after{$period},
$today+$before{$period},
) or die $sth->errstr;
my $number = $sth->fetchrow_arrayref->[0];
%>
<TD BGCOLOR="#dddddd" ALIGN="right"><%= $number %></TD>
<% } %>
</TR>
</TABLE>
</BODY>
</HTML>
--- part_referral.cgi DELETED ---
- Previous message: [freeside-commits] freeside/FS/FS Schema.pm, 1.21,
1.22 part_referral.pm, 1.4, 1.5 Record.pm, 1.118,
1.119 AccessRight.pm, 1.4, 1.5 access_user.pm, 1.6, 1.7
- Next message: [freeside-commits]
freeside/httemplate/edit part_referral.cgi, 1.10,
NONE part_referral.html, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list