From c110da0da864245e47cae019b8a347367cc6430c Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Sat, 25 Apr 2015 15:02:15 -0700 Subject: selfservice quotations, #33852 --- ng_selfservice/images/cross.png | Bin 0 -> 655 bytes ng_selfservice/quotation.php | 130 ++++++++++++++++++++++++++++++++ ng_selfservice/quotation_add_pkg.php | 31 ++++++++ ng_selfservice/quotation_order.php | 15 ++++ ng_selfservice/quotation_print.php | 17 +++++ ng_selfservice/quotation_remove_pkg.php | 31 ++++++++ 6 files changed, 224 insertions(+) create mode 100644 ng_selfservice/images/cross.png create mode 100644 ng_selfservice/quotation.php create mode 100644 ng_selfservice/quotation_add_pkg.php create mode 100644 ng_selfservice/quotation_order.php create mode 100644 ng_selfservice/quotation_print.php create mode 100644 ng_selfservice/quotation_remove_pkg.php (limited to 'ng_selfservice') diff --git a/ng_selfservice/images/cross.png b/ng_selfservice/images/cross.png new file mode 100644 index 000000000..1514d51a3 Binary files /dev/null and b/ng_selfservice/images/cross.png differ diff --git a/ng_selfservice/quotation.php b/ng_selfservice/quotation.php new file mode 100644 index 000000000..cf455431b --- /dev/null +++ b/ng_selfservice/quotation.php @@ -0,0 +1,130 @@ + + + + +quotation_info(array( + 'session_id' => $_COOKIE['session_id'], +)); + +$can_order = 0; + +if ( isset($quotation['sections']) and count($quotation['sections']) > 0 ) { + $can_order = 1; + # there are other ways this could be formatted, yes. + # if you want the HTML-formatted quotation, use quotation_print(). + print( + ''. + '

Order summary

'. + "\n" + ); + foreach ( $quotation['sections'] as $section ) { + print( + ''. + ''. + ''. + ''. + "\n" + ); + $row = 0; + foreach ( $section['detail_items'] as $detail ) { + print( + ''. + ''. + ''. + ''. + ''. "\n" + ); + $row = 1 - $row; + } + print( + ''. + ''. + ''. + ''. + ''. + '
'. htmlspecialchars($section['description']).'
' + ); + if ( $detail['pkgnum'] ) { + print( + ''. + '' + ); + } + print( + ''. htmlspecialchars($detail['description']). ''. $detail['amount']. '
Total'. $section['subtotal']. '
'. + "\n" + ); + } # foreach $section +} + +$pkgselect = $freeside->mason_comp( array( + 'session_id' => $_COOKIE['session_id'], + 'comp' => '/elements/select-part_pkg.html', + 'args' => array( 'onchange' , 'enable_order_pkg()', + 'empty_label' , 'Select package', + 'form_name' , 'AddPkgForm', + ), +)); +if ( isset($pkgselect['error']) && $pkgselect['error'] ) { + $error = $pkgselect['error']; + header('Location:index.php?error='. urlencode($pkgselect)); + die(); +} + +?> + + +
+ + +
+ +> +
+ + +
+> + + +
+ + + diff --git a/ng_selfservice/quotation_add_pkg.php b/ng_selfservice/quotation_add_pkg.php new file mode 100644 index 000000000..1e7e71fa9 --- /dev/null +++ b/ng_selfservice/quotation_add_pkg.php @@ -0,0 +1,31 @@ + $_COOKIE['session_id'], + 'pkgpart' => $_REQUEST['pkgpart'], + ); + + $results = $freeside->quotation_add_pkg($args); + + } + + if ( isset($results['error']) && $results['error'] ) { + $dest .= '?error=' . $results['error'] . ';pkgpart=' . $_REQUEST['pkgpart']; + } +} + +header("Location:$dest"); + +?> + diff --git a/ng_selfservice/quotation_order.php b/ng_selfservice/quotation_order.php new file mode 100644 index 000000000..d35eacbb2 --- /dev/null +++ b/ng_selfservice/quotation_order.php @@ -0,0 +1,15 @@ + $_COOKIE['session_id'] ); + +$results = $freeside->quotation_order($args); + +if ( isset($results['error']) && $results['error'] ) { + $dest = 'quotation.php?error=' . $results['error']; +} + +header("Location:$dest"); + +?> diff --git a/ng_selfservice/quotation_print.php b/ng_selfservice/quotation_print.php new file mode 100644 index 000000000..9676405d1 --- /dev/null +++ b/ng_selfservice/quotation_print.php @@ -0,0 +1,17 @@ + $_COOKIE['session_id'], + 'format' => 'pdf' +); + +$results = $freeside->quotation_print($args); +if ( isset($results['document']) ) { + header('Content-Type: application/pdf'); + header('Content-Disposition: filename=quotation.pdf'); + print($results['document']->scalar); +} else { + header("Location: quotation.php?error=" . $results['error']); +} + +?> diff --git a/ng_selfservice/quotation_remove_pkg.php b/ng_selfservice/quotation_remove_pkg.php new file mode 100644 index 000000000..07548c7f9 --- /dev/null +++ b/ng_selfservice/quotation_remove_pkg.php @@ -0,0 +1,31 @@ + $_COOKIE['session_id'], + 'pkgnum' => $_REQUEST['pkgnum'], + ); + + $results = $freeside->quotation_remove_pkg($args); + + } + + if ( isset($results['error']) && $results['error'] ) { + $dest .= '?error=' . $results['error']; + } + +} + +header("Location:$dest"); + +?> -- cgit v1.2.1