RT#38363: use cust_payby when saving cards during payments [ng_selfservice]
[freeside.git] / ng_selfservice / quotation.php
1 <STYLE>
2 td.amount {
3     text-align: right;
4 }
5 td.amount:before {
6     content: "$";
7 }
8 tr.total * {
9     background-color: #ddf;
10     font-weight: bold;
11 }
12 table.section {
13     width: 100%;
14     border-collapse: collapse;
15 }
16 table.section td {
17     font-size: small;
18     padding: 1ex 1ex;
19 }
20 table.section th {
21     text-align: left;
22     padding: 1ex;
23 }
24 .row0 td {
25     background-color: #eee;
26 }
27 .row1 td {
28     background-color: #fff;
29 }
30 </STYLE>
31
32 <? $title ='Plan a new service order'; include('elements/header.php'); ?>
33 <? $current_menu = 'services_new.php'; include('elements/menu.php'); ?>
34 <?
35
36 $quotation = $freeside->quotation_info(array(
37   'session_id'  => $_COOKIE['session_id'],
38 ));
39
40 $can_order = 0;
41
42 if ( isset($quotation['sections']) and count($quotation['sections']) > 0 ) {
43   $can_order = 1;
44   # there are other ways this could be formatted, yes.
45   # if you want the HTML-formatted quotation, use quotation_print().
46   print(
47     '<INPUT STYLE="float: right" TYPE="button" onclick="window.location.href=\'quotation_print.php\'" value="Download a quotation" />'.
48     '<H3>Order summary</H3>'.
49     "\n"
50   );
51   foreach ( $quotation['sections'] as $section ) {
52     print(
53       '<TABLE CLASS="section">'.
54       '<TR>'.
55       '<TH COLSPAN=4>'.  htmlspecialchars($section['description']).'</TH>'.
56       '</TR>'.
57       "\n"
58     );
59     $row = 0;
60     foreach ( $section['detail_items'] as $detail ) {
61       print(
62         '<TR CLASS="row' . $row . '">'.
63         '<TD>'
64       );
65       if ( $detail['pkgnum'] ) {
66         print(
67           '<A HREF="quotation_remove_pkg.php?pkgnum=' .
68           $detail['pkgnum'] . '">'.
69           '<IMG SRC="images/cross.png" /></A>'
70         );
71       }
72       print(
73         '</TD>'.
74         '<TD>'. htmlspecialchars($detail['description']). '</TD>'.
75         '<TD CLASS="amount">'. $detail['amount']. '</TD>'.
76         '</TR>'. "\n"
77       );
78       $row = 1 - $row;
79     }
80     print(
81       '<TR CLASS="total">'.
82       '<TD></TD>'.
83       '<TD>Total</TD>'.
84       '<TD CLASS="amount">'. $section['subtotal']. '</TD>'.
85       '</TR>'.
86       '</TABLE>'.
87       "\n"
88     );
89   } # foreach $section
90 }
91
92 $pkgselect = $freeside->mason_comp( array(
93     'session_id' => $_COOKIE['session_id'],
94     'comp'       => '/elements/select-part_pkg.html',
95     'args'       => array( 'onchange'       , 'enable_order_pkg()',
96                            'empty_label'    , 'Select package',
97                            'form_name'      , 'AddPkgForm',
98                          ),
99 ));
100 if ( isset($pkgselect['error']) && $pkgselect['error'] ) {
101   $error = $pkgselect['error'];
102   header('Location:index.php?error='. urlencode($pkgselect));
103   die();
104 }
105
106 ?>
107 <SCRIPT TYPE="text/javascript">
108 function enable_order_pkg () {
109     document.AddPkgForm.submit.disabled =
110         (document.AddPkgForm.pkgpart.value == '');
111 }
112 </SCRIPT>
113
114 <DIV STYLE="border-top: 1px solid; padding: 1ex">
115 <? $error = $_REQUEST['error']; include('elements/error.php'); ?>
116
117 <FORM NAME="AddPkgForm" ACTION="quotation_add_pkg.php" METHOD=POST>
118 <? echo $pkgselect['output']; ?>
119 <INPUT NAME="submit" TYPE="submit" VALUE="Add package" <? if ( ! isset($_REQUEST['pkgpart']) ) { echo 'DISABLED'; } ?>>
120 </FORM>
121
122 <? if ( $can_order ) { ?>
123 <FORM NAME="OrderQuoteForm" ACTION="quotation_order.php" METHOD=POST>
124 <INPUT TYPE="submit" VALUE="Confirm this order" <? if ( !$can_order ) { echo 'DISABLED'; } ?>>
125 <? } ?>
126
127 </DIV>
128
129 <? include('elements/menu_footer.php'); ?>
130 <? include('elements/footer.php'); ?>