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
|
<%
#<!-- $Id: part_pkg.cgi,v 1.5 2001-10-15 10:42:28 ivan Exp $ -->
use strict;
use vars qw( $cgi $p $part_pkg );
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use FS::UID qw(cgisuidsetup);
use FS::Record qw(qsearch qsearchs);
use FS::CGI qw(header menubar popurl table);
use FS::part_pkg;
use FS::pkg_svc;
use FS::part_svc;
$cgi = new CGI;
&cgisuidsetup($cgi);
$p = popurl(2);
print $cgi->header( '-expires' => 'now' ), header("Package Definition Listing",menubar(
'Main Menu' => $p,
)), "One or more services are grouped together into a package and given",
" pricing information. Customers purchase packages, not services.<BR><BR>",
&table(), <<END;
<TABLE BORDER>
<TR>
<TH COLSPAN=2>Package</TH>
<TH>Comment</TH>
<TH><FONT SIZE=-1>Freq.</FONT></TH>
<TH><FONT SIZE=-1>Plan</FONT></TH>
<TH><FONT SIZE=-1>Data</FONT></TH>
<TH>Service</TH>
<TH><FONT SIZE=-1>Quan.</FONT></TH>
</TR>
END
foreach $part_pkg ( sort {
$a->getfield('pkgpart') <=> $b->getfield('pkgpart')
} qsearch('part_pkg',{}) ) {
my($hashref)=$part_pkg->hashref;
my(@pkg_svc)=grep $_->getfield('quantity'),
qsearch('pkg_svc',{'pkgpart'=> $hashref->{pkgpart} });
my($rowspan)=scalar(@pkg_svc);
my $plandata;
if ( $hashref->{plan} ) {
$plandata = $hashref->{plandata};
$plandata =~ s/^(\w+)=/$1 /mg;
$plandata =~ s/\n/<BR>/g;
} else {
$hashref->{plan} = "(legacy)";
$plandata = "Setup ". $hashref->{setup}.
"<BR>Recur ". $hashref->{recur};
}
print <<END;
<TR>
<TD ROWSPAN=$rowspan><A HREF="${p}edit/part_pkg.cgi?$hashref->{pkgpart}">
$hashref->{pkgpart}
</A></TD>
<TD ROWSPAN=$rowspan><A HREF="${p}edit/part_pkg.cgi?$hashref->{pkgpart}">$hashref->{pkg}</A></TD>
<TD ROWSPAN=$rowspan>$hashref->{comment}</TD>
<TD ROWSPAN=$rowspan>$hashref->{freq}</TD>
<TD ROWSPAN=$rowspan>$hashref->{plan}</TD>
<TD ROWSPAN=$rowspan>$plandata</TD>
END
my($pkg_svc);
my($n)="";
foreach $pkg_svc ( @pkg_svc ) {
my($svcpart)=$pkg_svc->getfield('svcpart');
my($part_svc) = qsearchs('part_svc',{'svcpart'=> $svcpart });
print $n,qq!<TD><A HREF="${p}edit/part_svc.cgi?$svcpart">!,
$part_svc->getfield('svc'),"</A></TD><TD>",
$pkg_svc->getfield('quantity'),"</TD></TR>\n";
$n="<TR>";
}
print "</TR>";
}
print <<END;
<TR><TD COLSPAN=8><I><A HREF="${p}edit/part_pkg.cgi">Add a new package definition</A></I></TD></TR>
</TABLE>
</BODY>
</HTML>
END
%>
|