view-invoice.phtml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. /**
  3. * @version 7.8
  4. */
  5. /** @var \Ppb\Db\Table\Rowset\AbstractAccounting $rowset */
  6. /** @var \Ppb\Db\Table\Row\AbstractAccounting $row */
  7. $row = $rowset->getRow(0);
  8. /** @var \Ppb\Db\Table\Row\User $buyer */
  9. $buyer = $row->findParentRow('\Ppb\Db\Table\Users');
  10. ?>
  11. <div id="print-area">
  12. <?php if (!empty($this->settings['invoice_header'])) { ?>
  13. <?php echo $this->renderHtml($this->settings['invoice_header']); ?>
  14. <?php } ?>
  15. <div class="row">
  16. <div class="col-xs-6">
  17. <img src="<?php echo $this->thumbnail()->generateImagePath($this->settings['site_logo_path']); ?>"
  18. alt="<?php echo $this->settings['sitename']; ?>">
  19. </div>
  20. <div class="col-xs-6">
  21. <table class="table table-condensed well">
  22. <tbody>
  23. <?php if ($row instanceof \Ppb\Db\Table\Row\Accounting) { ?>
  24. <tr>
  25. <td class="text-right"><strong><?php echo $this->_('Invoice #'); ?></strong></td>
  26. <td><?php echo $row['id']; ?></td>
  27. </tr>
  28. <?php if (!empty($row['listing_id'])) {
  29. /** @var \Ppb\Db\Table\Row\Listing $listing */
  30. $listing = $row->findParentRow('\Ppb\Db\Table\Listings');
  31. ?>
  32. <tr>
  33. <td class="text-right"><strong><?php echo $this->_('Listing ID'); ?></strong></td>
  34. <td>
  35. <a href="<?php echo $this->url($listing->link()); ?>"><?php echo $row['listing_id']; ?></a>
  36. </td>
  37. </tr>
  38. <?php } ?>
  39. <tr>
  40. <td class="text-right"><strong><?php echo $this->_('Date'); ?></strong></td>
  41. <td><?php echo $this->date($row['created_at'], true); ?></td>
  42. </tr>
  43. <?php
  44. }
  45. else if ($row instanceof \Ppb\Db\Table\Row\Transaction) {
  46. ?>
  47. <tr>
  48. <td class="text-right"><strong><?php echo $this->_('Transaction #'); ?></strong></td>
  49. <td><?php echo $row['id']; ?></td>
  50. </tr>
  51. <tr>
  52. <td class="text-right"><strong><?php echo $this->_('Payment Method'); ?></strong></td>
  53. <td>
  54. <?php
  55. $paymentGateway = $row->findParentRow('\Ppb\Db\Table\PaymentGateways');
  56. echo (method_exists($paymentGateway, 'getData')) ? $paymentGateway->getData('name') : $this->_('n/a');
  57. ?>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td class="text-right"><strong><?php echo $this->_('Transaction ID'); ?></strong></td>
  62. <td><?php echo $row['gateway_transaction_code']; ?></td>
  63. </tr>
  64. <tr>
  65. <td class="text-right"><strong><?php echo $this->_('Payment Date'); ?></strong></td>
  66. <td><?php echo $this->date($row['updated_at'], true); ?></td>
  67. </tr>
  68. <?php } ?>
  69. </tbody>
  70. </table>
  71. </div>
  72. </div>
  73. <div class="row">
  74. <div class="col-sm-6">
  75. <?php echo nl2br($this->settings['invoice_address']); ?>
  76. </div>
  77. <div class="col-sm-6">
  78. <?php echo $this->_('Billing Address:'); ?>
  79. <?php echo $this->userDetails()->setUser($buyer)->displayFullAddress(); ?>
  80. </div>
  81. </div>
  82. <div class="row">
  83. <div class="col-sm-12">
  84. <table class="table table-small well">
  85. <caption>
  86. <h2><?php echo $row->caption(); ?></h2>
  87. </caption>
  88. <thead>
  89. <tr>
  90. <th><?php echo $this->_('Name'); ?></th>
  91. <?php if ($row['tax_rate'] > 0) { ?>
  92. <th class="size-mini"><?php echo $this->_('Price'); ?></th>
  93. <th class="size-mini"><?php echo $this->_('Tax'); ?></th>
  94. <th class="size-mini"><?php echo $this->_('Rate'); ?></th>
  95. <th class="size-mini"><?php echo $this->_('Subtotal'); ?></th>
  96. <?php
  97. }
  98. else {
  99. ?>
  100. <th class="size-mini"></th>
  101. <th class="size-mini"><?php echo $this->_('Price'); ?></th>
  102. <?php } ?>
  103. </tr>
  104. </thead>
  105. <tbody>
  106. <?php foreach ($rowset as $row) { ?>
  107. <tr>
  108. <td><?php echo $this->_($row->displayName()); ?></td>
  109. <?php if ($row['tax_rate'] > 0) { ?>
  110. <td><?php echo $this->amount($row->amountNoTax(), $row['currency']); ?></td>
  111. <td><?php echo $this->amount($row->taxAmount(), $row['currency']); ?></td>
  112. <td><?php echo $row['tax_rate'] . '%'; ?></td>
  113. <?php
  114. }
  115. else {
  116. ?>
  117. <td></td>
  118. <?php } ?>
  119. <td><?php echo $this->amount($row->totalAmount(), $row['currency']); ?></td>
  120. </tr>
  121. <?php } ?>
  122. <?php if ($row['tax_rate'] > 0) { ?>
  123. <tr>
  124. <td colspan="3"></td>
  125. <td>
  126. <small><?php echo $this->_('Subtotal'); ?></small>
  127. </td>
  128. <td><?php echo $this->amount($rowset->amountNoTax(), $rowset->currency()); ?></td>
  129. </tr>
  130. <tr>
  131. <td colspan="3"></td>
  132. <td>
  133. <small><?php echo $this->_('Tax'); ?></small>
  134. </td>
  135. <td><?php echo $this->amount($rowset->taxAmount(), $rowset->currency()); ?></td>
  136. </tr>
  137. <?php } ?>
  138. <tr>
  139. <td colspan="<?php echo ($row['tax_rate'] > 0) ? '3' : '1'; ?>"></td>
  140. <td>
  141. <small><strong><?php echo $this->_('Total'); ?></strong></small>
  142. </td>
  143. <td><strong><?php echo $this->amount($rowset->totalAmount(), $rowset->currency()); ?></strong></td>
  144. </tr>
  145. </tbody>
  146. </table>
  147. </div>
  148. </div>
  149. </div>
  150. <?php if (!empty($this->settings['invoice_footer'])) { ?>
  151. <?php echo $this->renderHtml($this->settings['invoice_footer']); ?>
  152. <?php } ?>
  153. <div class="spacing-top">
  154. <?php echo $this->formElement('\Ppb\Form\Element\PrintButton', 'printButton', $this->_('Print'))
  155. ->setAttributes(array(
  156. 'class' => 'print-button btn btn-lg btn-primary',
  157. 'rel' => 'print-area',
  158. ))
  159. ->render();
  160. ?>
  161. </div>