PageRenderTime 24ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/admin/modules/circulation/pop_loan_receipt.php

https://gitlab.com/mucill/majalengka
PHP | 174 lines | 124 code | 17 blank | 33 comment | 14 complexity | d65351a7d3f5232d22818313b5eed954 MD5 | raw file
  1. <?php
  2. /**
  3. * Copyright (C) 2010 Arie Nugraha (dicarve@yahoo.com)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. *
  19. */
  20. /* Loan Circulation Receipt Pop Windows */
  21. // key to authenticate
  22. if (!defined('INDEX_AUTH')) {
  23. define('INDEX_AUTH', '1');
  24. }
  25. // main system configuration
  26. require '../../../sysconfig.inc.php';
  27. // IP based access limitation
  28. require LIB.'ip_based_access.inc.php';
  29. do_checkIP('smc');
  30. do_checkIP('smc-circulation');
  31. // start the session
  32. require SB.'admin/default/session.inc.php';
  33. require SB.'admin/default/session_check.inc.php';
  34. require SB.'admin/admin_template/printed_settings.inc.php';
  35. // page title
  36. $page_title = 'Loan Receipt';
  37. // start the output buffer
  38. ob_start();
  39. /* main content */
  40. ?>
  41. <style type="text/css">
  42. #receiptBody {
  43. margin: <?php echo $sysconf['print']['receipt']['receipt_margin']; ?>;
  44. padding: <?php echo $sysconf['print']['receipt']['receipt_padding']; ?>;
  45. color: <?php echo $sysconf['print']['receipt']['receipt_color']; ?>;
  46. font-family: <?php echo $sysconf['print']['receipt']['receipt_font']; ?>;
  47. width: <?php echo $sysconf['print']['receipt']['receipt_width']; ?>;
  48. border: <?php echo $sysconf['print']['receipt']['receipt_border']; ?>;
  49. }
  50. #receiptBody * {
  51. color: <?php echo $sysconf['print']['receipt']['receipt_color']; ?>;
  52. font-family: <?php echo $sysconf['print']['receipt']['receipt_font']; ?>;
  53. font-size: <?php echo $sysconf['print']['receipt']['receipt_fontSize']; ?>;
  54. font-weight: bold;
  55. }
  56. .receiptHeader {
  57. font-weight: bold;
  58. font-size: <?php echo $sysconf['print']['receipt']['receipt_header_fontSize']; ?>;
  59. border-bottom: <?php echo $sysconf['print']['receipt']['receipt_border']; ?>;
  60. }
  61. .receiptFooter {
  62. font-weight: bold;
  63. font-size: <?php echo $sysconf['print']['receipt']['receipt_header_fontSize']; ?>;
  64. border-top: <?php echo $sysconf['print']['receipt']['receipt_border']; ?>;
  65. }
  66. </style>
  67. <?php ob_start(); ?>
  68. <div id="receiptBody">
  69. <div class="receiptHeader">
  70. <div id="receiptTitle"><?php echo $sysconf['library_name'] ?><br /><?php echo $sysconf['library_subname'] ?></div></td>
  71. <td><div id="receiptMember"><?php echo $_SESSION['receipt_record']['memberName'] ?> (<?php echo $_SESSION['receipt_record']['memberID'] ?>)</div>
  72. <div id="receiptDate"><?php echo $_SESSION['receipt_record']['date'] ?></div>
  73. </div>
  74. <hr />
  75. <div id="receiptInfo">
  76. <!-- LOAN -->
  77. <?php if (isset($_SESSION['receipt_record']['loan']) || isset($_SESSION['receipt_record']['extend'])) { ?>
  78. <div class="receiptHeader">Type of Transaction: <?php echo __('Loan'); ?>/<?php echo __('Extended'); ?> (<?php echo mt_rand(000000000, 999999999); ?>)</div>
  79. <hr size="1" noshade="noshade" />
  80. <?php
  81. if (isset($_SESSION['receipt_record']['loan'])) {
  82. foreach ($_SESSION['receipt_record']['loan'] as $loan) {
  83. echo '<div class="receiptLoans">';
  84. echo '<div class="receiptItemCode">'.$loan['itemCode'].'</div>';
  85. echo '<div class="receiptItemTitle">'.substr($loan['title'], 0, $sysconf['print']['receipt']['receipt_titleLength']);
  86. if (strlen($loan['title']) > $sysconf['print']['receipt']['receipt_titleLength']) {
  87. echo ' ...';
  88. }
  89. echo '.</div>';
  90. echo '<div class="receiptItemLoanDate">'.$loan['loanDate'].'</div>';
  91. echo '<div class="receiptItemDueDate">'.$loan['dueDate'].'</div>';
  92. echo '</div>';
  93. }
  94. }
  95. // loan extend
  96. if (isset($_SESSION['receipt_record']['extend'])) {
  97. foreach ($_SESSION['receipt_record']['extend'] as $ext) {
  98. echo '<div class="receiptLoans">';
  99. echo '<div class="receiptItemCode">'.$ext['itemCode'].'</div>';
  100. #echo '<td>'.substr($ext['title'], 0, 50).'...<br />-- extended --</td>';
  101. echo '<div class="receiptItemTitle">'.substr($ext['title'], 0, $sysconf['print']['receipt']['receipt_titleLength']);
  102. if (strlen($ext['title']) > $sysconf['print']['receipt']['receipt_titleLength']) {
  103. echo ' ...';
  104. }
  105. echo '. <strong>(Loan Extended)</strong></div>';
  106. echo '<div class="receiptItemLoanDate">'.$ext['loanDate'].'</div>';
  107. echo '<div class="receiptItemDueDate">'.$ext['dueDate'].'</div>';
  108. echo '</div>';
  109. }
  110. }
  111. ?>
  112. <?php } ?>
  113. <?php
  114. # to remove extended items from return session list
  115. if (isset($_SESSION['receipt_record']['return']) AND isset($_SESSION['receipt_record']['extend'])) {
  116. foreach ($_SESSION['receipt_record']['extend'] as $key => $value) {
  117. if ($_SESSION['receipt_record']['extend'][$key]['itemCode'] == $_SESSION['receipt_record']['return'][$key]['itemCode']) {
  118. unset($_SESSION['receipt_record']['return'][$key]);
  119. }
  120. }
  121. }
  122. ?>
  123. <!-- RETURN -->
  124. <?php if (isset($_SESSION['receipt_record']['return']) AND (count($_SESSION['receipt_record']['return']) != 0)) { ?>
  125. <div class="receiptHeader">Type of Transaction: <?php echo __('Return'); ?> (<?php echo mt_rand(000000000, 999999999); ?>)</div>
  126. <hr size="1" noshade="noshade" />
  127. <?php
  128. foreach ($_SESSION['receipt_record']['return'] as $ret) {
  129. echo '<div class="receiptReturns">';
  130. echo '<div class="receiptItemCode">'.$ret['itemCode'].'</div>';
  131. echo '<div class="receiptItemTitle">'.substr($ret['title'], 0, $sysconf['print']['receipt']['receipt_titleLength']);
  132. if (strlen($ret['title']) > $sysconf['print']['receipt']['receipt_titleLength']) {
  133. echo ' ...';
  134. }
  135. echo '.</div>';
  136. echo '<div class="receiptItemReturn">'.$ret['returnDate'].'</div>';
  137. if ($ret['overdues']) {
  138. echo '<span class="receiptLoanOverdue">'.$ret['overdues']['days'].' days overdue</span>';
  139. }
  140. echo '</div>';
  141. }
  142. ?>
  143. <?php } ?>
  144. </div>
  145. <hr size="1" noshade="noshade" />
  146. <div class="receiptFooter">
  147. <div class="receiptLibraryStaff">Library Staf<p><?php echo $_SESSION['realname']; ?></p></div>
  148. <div class="receiptLibraryMember">Library member<p><?php echo $_SESSION['receipt_record']['memberName']; ?></p></div>
  149. </div>
  150. </div>
  151. <?php $buffer_receipt = ob_get_contents(); ob_end_clean(); echo $buffer_receipt; ?>
  152. <script type="text/javascript">window.print()</script>
  153. <?php
  154. /* main content end */
  155. $content = ob_get_clean();
  156. // include the page template
  157. require SB.'/admin/'.$sysconf['admin_template']['dir'].'/notemplate_page_tpl.php';