Source for file paypal-cancel.php

Documentation is available at paypal-cancel.php

  1. <?php
  2. ################################################################
  3. # This file is part of SlidingDoors #
  4. # Copyright 2001-2004. Eric D. Nielsen, All rights reserverd #
  5. # SlidingDoors is availible for license under the GPL, see #
  6. # the COPYING file in the root directory of the install for #
  7. # the full terms of the GPL. #
  8. # #
  9. # File: done.php #
  10. # Author: Eric D. Nielsen #
  11. # Description: This page allows people to make PayPal
  12. # payments for their registration
  13. # Internal Links: index.php #
  14. # 2002 MITBDT Open DanceSport Competition page #
  15. # by-school.php #
  16. # External Links: 2002 MITBDT Open DanceSport Competition page #
  17. # SlidingDoors information page #
  18. # Comp-in-a-box information page #
  19. # OpenImpetus information page #
  20. # Change Log: 11/05/04 -- created -- edn #
  21. ################################################################
  22. // {{{ Top Matter
  23.  
  24. include "include_others.inc";
  25. $display = new HTMLDisplay($db);
  26. if (isset($_POST["custom"]))
  27. {
  28. $incomeID=$_POST["custom"];
  29. }
  30. else
  31. {
  32. $incomeID = $_GET["custom"];
  33. }
  34.  
  35. if (!isset($SD_payment_email) || $SD_payment_email=="")
  36. {
  37. die ("This competition is not accepting PayPal Payments.");
  38. }
  39. // }}}
  40. // {{{ Table Generation
  41.  
  42. $query = "SELECT firstname, lastname, paid_amount FROM income NATURAL JOIN income_line_items NATURAL JOIN people_paid NATURAL JOIN people WHERE incomeid=$incomeID ORDER BY lastname, firstname;";
  43.  
  44. $result =$db->query($query);
  45. $confirmTable = "<table><tr><th>Name</th><th>Amount</th></tr>\n";
  46. $numrows = $result->numrows();
  47. $total = 0;
  48. if ($numrows!=0)
  49. {
  50. for ($i=0;$i < $numrows;$i++)
  51. {
  52. list($first,$last, $amount) = $result->getRowAt($i);
  53. $total+=$amount;
  54. $amount=number_format($amount,2);
  55. $confirmTable.="<tr><td>$last, $first</td><td align=\"right\">\$$amount</td></tr>\n";
  56. }
  57. }
  58. else
  59. {
  60. $confirmTable.="<tr><td colspan=\"2\"><i>Error -- payment cancelled reported, but no people included on invoice.";
  61. }
  62. if ($SD_absorb_PayPalFee==FALSE)
  63. {
  64. $payPalFee = 0.35+0.029*$totalPay;
  65. $payPalFee=ceil($payPalFee*100)/100;
  66. $baseTotalPay_s=number_format($totalPay,2);
  67. $totalPay+=$payPalFee;
  68. $totalPay_s=number_format($totalPay,2);
  69. $confirmTable.=<<<END_HTML
  70. <tr><th align="right">Sub Total</th><th align="right">\$$baseTotalPay_s</th></tr>
  71. <tr><th align="right">PayPal Fee</th><th align="right">\$$payPalFee</th></tr>
  72. <tr><th align="right">Total</th><th></th><th align="right">\$$totalPay_s</th></tr>
  73. END_HTML;}
  74. else
  75. {
  76. $total_s=number_format($total,2);
  77. $confirmTable.=<<<END_HTML
  78. <tr><th align="right">Total</th><th align="right">\$$total_s</th></tr>
  79. END_HTML;
  80. }
  81. $query = "DELETE FROM people_paid where itemid in (SELECT itemid FROM income_line_items where incomeid=$incomeID);";
  82. $db->query($query);
  83. $query = "DELETE FROM income_line_items WHERE incomeid=$incomeID;";
  84. $db->query($query);
  85. $query = "DELETE FROM income_email_details WHERE incomeid=$incomeID;";
  86. $db->query($query);
  87. $query = "DELETE FROM income WHERE incomeid=$incomeID;";
  88.  
  89. $confirmTable.="</table>\n";
  90. // }}}
  91. // {{{ Page Display
  92.  
  93. $page = $display->beginPage();
  94. $page.=$display->instructionBox("PayPal Cancelled",
  95. "
  96. <p>
  97. PayPal reports that you have <b>canceled</b> your on-line payment. We have
  98. deleted the pending records. You will need to either pay by check or
  99. restart the PayPal process, by retrieving your registration from the <a href=\"/\">Registation Home Page</a>.
  100. </p>
  101. <p>
  102. For your records, this <b>cancelled transaction</b> would have covered:
  103. </p>
  104. $confirmTable
  105. <p>
  106. Your registration <b>is not complete</b> until payment is received.
  107. We look forward to seeing you at the competition.
  108. You can either browse the <a href=\"../../stats/$unixname/\">event registrations</a>
  109. or check for other <a href=\"../../../\">open events</a> or simply close the browser.
  110. </p>
  111. ");
  112. $page .= $display->sectionBreak();
  113. $page .= $display->compinaboxBox();
  114. $page .= $display->endPage();
  115. echo $page;
  116. // }}}
  117. ?>

Documentation generated on Tue, 25 Apr 2006 13:06:54 -0400 by phpDocumentor 1.3.0RC3