1 <& /elements/header-popup.html, $title &>
3 <FORM ACTION="process/quotation_pkg_detail.html" NAME="DetailForm" ID="DetailForm" METHOD="POST">
5 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
7 <TABLE ID="DetailTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=1 STYLE="background-color: #cccccc">
10 <TD ALIGN="right">Package</TD>
11 <TD BGCOLOR="#ffffff"><% $part_pkg->pkg %></TD>
15 <TD ALIGN="right">Comment</TD>
16 <TD BGCOLOR="#ffffff"><% $part_pkg->comment |h %></TD>
22 <SELECT NAME="copy_on_order">
23 <OPTION VALUE=""<% $copy_on_order ? '' : ' SELECTED' %>>
24 <% emt('Details will only appear on quotation') %>
26 <OPTION VALUE="Y"<% $copy_on_order ? ' SELECTED' : '' %>>
27 <% emt('Copy details to invoice when placing order') %>
33 <& elements/detail-table.html,
42 <INPUT TYPE="submit" ID="submit" NAME="submit" VALUE="<% $title %>">
50 my $curuser = $FS::CurrentUser::CurrentUser;
53 unless $curuser->access_right('Generate quotation');
55 $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum';
58 my $quotation_pkg = qsearchs({
59 'table' => 'quotation_pkg',
60 'addl_from' => 'LEFT JOIN quotation USING ( quotationnum )'.
61 'LEFT JOIN cust_main USING ( custnum )',
62 'hashref' => { 'quotationpkgnum' => $pkgnum },
63 'extra_sql' => ' AND '. $curuser->agentnums_sql,
66 'table' => 'quotation_pkg',
67 'addl_from' => 'LEFT JOIN quotation USING ( quotationnum )'.
68 'LEFT JOIN prospect_main USING ( prospectnum )',
69 'hashref' => { 'quotationpkgnum' => $pkgnum },
70 'extra_sql' => ' AND '. $curuser->agentnums_sql,
73 my $part_pkg = $quotation_pkg->part_pkg;
75 my @details = $quotation_pkg->details;
77 my $copy_on_order = 0;
80 # currently, they should either all have this flag, or none
81 # but just in case, erring on the side of not copying to invoice
82 # unless every existing detail has copy_on_order
83 # (anyway, user has to submit change, this is just for autofill)
85 my @quotation_pkg_detail = $quotation_pkg->quotation_pkg_detail;
86 my @copy_on_order = grep { $_->copy_on_order } @quotation_pkg_detail;
87 $copy_on_order = 1 if @copy_on_order;
88 my @no_copy_on_order = grep { !$_->copy_on_order } @quotation_pkg_detail;
89 $copy_on_order = 0 if @no_copy_on_order;
92 my $title = ( scalar(@details) ? 'Edit ' : 'Add ' ). 'Quotation Details';