From a9c5778232079a09000c519a414563a1e04e112d Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 28 Jul 2016 09:05:20 +0200 Subject: Split Calculatable in trait and interface --- include/home.php | 8 +-- include/offers-overview.php | 10 ++-- include/offers-view.php | 4 +- include/pay.php | 135 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+), 11 deletions(-) create mode 100644 include/pay.php (limited to 'include') diff --git a/include/home.php b/include/home.php index 3903ab2..43cfeb1 100644 --- a/include/home.php +++ b/include/home.php @@ -167,8 +167,8 @@ require('./header.php'); 'id' => $offer->id, 'contactClientName' => $offer->getContact()->getClient()->name, 'percentage' => $percentage, - 'price_excl' => Constants::invoice_valuta . $offer->calculate(CALCULATABLE_SUBTOTAL), - 'price_incl' => Constants::invoice_valuta . $offer->calculate(CALCULATABLE_TOTAL) + 'price_excl' => Constants::invoice_valuta . $offer->calculate(Calculatable::SUBTOTAL), + 'price_incl' => Constants::invoice_valuta . $offer->calculate(Calculatable::TOTAL) ); } krsort($list, SORT_STRING); @@ -285,8 +285,8 @@ require('./header.php'); 'assignments_header' => '' ); foreach ($offer->getAssignments() as $assignment) { - $temp['assignments'] .= "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_TOTAL)} incl. VAT)

{$assignment->getHTMLDescription()}

"; - $temp['assignments_header'] .= "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_TOTAL)} incl. VAT)
"; + $temp['assignments'] .= "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)

{$assignment->getHTMLDescription()}

"; + $temp['assignments_header'] .= "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)
"; } $list[] = array_merge($temp, array('type' => 'start', 'time' => $offer->start_date, 'description' => 'Offer started')); $sort_list[] = $offer->start_date . $offer->id . 0; diff --git a/include/offers-overview.php b/include/offers-overview.php index 6c5135a..1118793 100644 --- a/include/offers-overview.php +++ b/include/offers-overview.php @@ -46,10 +46,10 @@ require_once('./login.php'); {$offer->getContact()->name} "; foreach ($offer->getAssignments() as $assignment) { - echo "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_TOTAL)} incl. VAT)

{$assignment->getHTMLDescription()}

"; + echo "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)

{$assignment->getHTMLDescription()}

"; } foreach ($offer->getDiscounts() as $discount) { - echo "{$discount->title}
(".Constants::invoice_valuta."{$discount->calculate(CALCULATABLE_SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$discount->calculate(CALCULATABLE_TOTAL)} incl. VAT)

{$discount->description}

"; + echo "{$discount->title}
(".Constants::invoice_valuta."{$discount->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$discount->calculate(Calculatable::TOTAL)} incl. VAT)

{$discount->description}

"; } echo " @@ -82,15 +82,15 @@ require_once('./login.php'); - + - + - +
Subtotal:".Constants::invoice_valuta."{$offer->calculate(CALCULATABLE_SUBTOTAL)}".Constants::invoice_valuta."{$offer->calculate(Calculatable::SUBTOTAL)}
VAT:".Constants::invoice_valuta."{$offer->calculate(CALCULATABLE_VAT)}".Constants::invoice_valuta."{$offer->calculate(Calculatable::VAT)}
Total:".Constants::invoice_valuta."{$offer->calculate(CALCULATABLE_TOTAL)}".Constants::invoice_valuta."{$offer->calculate(Calculatable::TOTAL)}
diff --git a/include/offers-view.php b/include/offers-view.php index 2df495a..802f42f 100644 --- a/include/offers-view.php +++ b/include/offers-view.php @@ -40,8 +40,8 @@ $_offer = new Offer($_pdo, $_id); 'assignments_header' => '' ); foreach ($_offer->getAssignments() as $assignment) { - $temp['assignments'] .= "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_TOTAL)} incl. VAT)

{$assignment->getHTMLDescription()}

"; - $temp['assignments_header'] .= "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(CALCULATABLE_TOTAL)} incl. VAT)
"; + $temp['assignments'] .= "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)

{$assignment->getHTMLDescription()}

"; + $temp['assignments_header'] .= "{$assignment->title}
(".Constants::invoice_valuta."{$assignment->calculate(Calculatable::SUBTOTAL)} excl. VAT, ".Constants::invoice_valuta."{$assignment->calculate(Calculatable::TOTAL)} incl. VAT)
"; } $list[] = array_merge($temp, array('type' => 'start', 'time' => $_offer->start_date, 'description' => 'Offer started')); $sort_list[] = $_offer->start_date . $_offer->id . 0; diff --git a/include/pay.php b/include/pay.php new file mode 100644 index 0000000..596251c --- /dev/null +++ b/include/pay.php @@ -0,0 +1,135 @@ +. + */ + +require_once('./index.php'); +require('./header.php'); +?> + +
+
+
+
+
+

Pay

+
+
+ key) { + ?> +
The invoice could not be found.
+ (string) $_offer->calculate(Calculatable::TOTAL), + 'paymentMethodNonce' => $nonce, + 'options' => [ + 'submitForSettlement' => true + ] + ]); + + if (!$trans->success) { + echo '
'; + echo '

Your transaction could not be completed:

'; + foreach ($trans->errors->deepAll() as $error) { + echo "{$error->attribute}: {$error->code} {$error->message}
"; + } + echo 'Please try again, or contact us.'; + echo '
'; + } else { + try { + $payment = $_offer->createPayment(); + $payment->braintree_id = $trans->transaction->id; + echo '
Thank you for your payment.
'; + } catch (Exception $e) { + echo '
Your payment has been received, but could not be stored in our database. Please contact us.
'; + } + } + } else { + $subtotal = Constants::invoice_valuta . $_offer->calculate(Calculatable::SUBTOTAL); + $total = Constants::invoice_valuta . $_offer->calculate(Calculatable::TOTAL); + ?> +
+
Welcome to the checkout environment. Please review the invoice carefully.
+ + + + + + + + getItems() as $item) { + $i++; + echo ''; + echo ""; + echo ""; + echo ""; + echo ""; + echo ''; + } + ?> + + + + + + + + +
DescriptionPrice excl.VATPrice incl.
+ {$item->title} +
{$item->getHTMLDescription()}
+
".Constants::invoice_valuta."{$item->calculate(Calculatable::SUBTOTAL)}{$item->VAT_percentage}%".Constants::invoice_valuta."{$item->calculate(Calculatable::TOTAL)}
Subtotal
Total
+
+
+
+ +
+ +
+
+
+
+
+ + + + + -- cgit v1.2.3