7 #foreach (qsearch('part_pkg', { 'disabled' => '' })) {
8 # $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
9 # $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
11 foreach (qsearch('part_pkg', {} )) {
12 $all_pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
13 $all_comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
15 $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
16 $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
19 my($custnum, %remove_pkg);
20 if ( $cgi->param('error') ) {
21 $custnum = $cgi->param('custnum');
22 %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg');
24 my($query) = $cgi->keywords;
32 %><%= include('/elements/header.html', "Add/Edit Packages", '') %>
34 <% if ( $cgi->param('error') ) { %>
35 <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
38 <FORM ACTION="<%= $p1 %>process/cust_pkg.cgi" METHOD=POST>
40 <INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $custnum %>">
44 my @cust_pkg = qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } );
49 Current packages - select to remove (services are moved to a new package below)
51 <TR STYLE="background-color: #cccccc;">
52 <TH COLSPAN="2">Pkg #</TH>
53 <TH>Package description</TH>
59 foreach ( sort { $all_pkg{ $a->getfield('pkgpart') }
60 cmp $all_pkg{ $b->getfield('pkgpart') }
65 my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') );
66 my $checked = $remove_pkg{$pkgnum} ? ' CHECKED' : '';
71 <TD><INPUT TYPE="checkbox" NAME="remove_pkg" VALUE="<%= $pkgnum %>"<%= $checked %>></TD>
72 <TD ALIGN="right"><%= $pkgnum %>:</TD>
73 <TD><%= $all_pkg{$pkgpart} %> - <%= $all_comment{$pkgpart} %></TD>
87 my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
88 my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum });
90 my %agent_pkgs = map { ( $_->pkgpart , $all_pkg{$_->pkgpart} ) }
91 qsearch('type_pkgs',{'typenum'=> $agent->typenum });
98 <TR STYLE="background-color: #cccccc;">
100 <TH COLSPAN="2">Package Description</TH>
104 #foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) {
105 foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} }
106 keys(%agent_pkgs) ) {
108 next unless exists $pkg{$pkgpart}; #skip disabled ones
109 #print qq!<TR>! if ( $count == 0 );
110 my $value = $cgi->param("pkg$pkgpart") || 0;
115 <INPUT TYPE="text" NAME="<%= "pkg$pkgpart" %>" VALUE="<%= $value %>" SIZE="2" MAXLENGTH="2">
117 <TD ALIGN="right"><%= $pkgpart %>:</TD>
118 <TD><%= $pkg{$pkgpart} %> - <%= $comment{$pkgpart}%></TD>
123 #if ( $count == 2 ) {
124 # print qq!</TR>\n! ;
132 <% unless ( $pkgparts ) {
134 my $typenum = $agent->typenum;
135 my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } );
136 my $atype = $agent_type->atype;
139 (No <A HREF="<%= $p2 %>browse/part_pkg.cgi">package definitions</A>,
141 <A HREF="<%= $p2 %>edit/agent_type.cgi?<%= $typenum %>"><%= $atype %></a>
142 is not allowed to purchase any packages.)
146 <P><INPUT TYPE="submit" VALUE="Order">
150 <%= include('/elements/footer.html') %>