PageRenderTime 26ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/tiki-accounting_entry.tpl

https://gitlab.com/ElvisAns/tiki
Smarty Template | 163 lines | 155 code | 7 blank | 1 comment | 0 complexity | 0cf736348c9fc1b8a5ac30c75a5e8565 MD5 | raw file
  1. {* $Id$ *}
  2. {literal}
  3. <script language="javascript">
  4. function setAmount() {
  5. document.getElementById('debitAmount').value=document.getElementById('totalAmount').value;
  6. document.getElementById('creditAmount').value=document.getElementById('totalAmount').value;
  7. }
  8. function splitDebit() {
  9. document.getElementById('Row_SplitCredit').style.display = "none";
  10. var tbl = document.getElementById('tbl_debit');
  11. var lastRow = tbl.rows.length;
  12. var row = tbl.insertRow(lastRow-1);
  13. row.innerHTML=document.getElementById('Row_StartDebit').innerHTML;
  14. }
  15. function splitCredit() {
  16. document.getElementById('Row_SplitDebit').style.display = "none";
  17. var tbl = document.getElementById('tbl_credit');
  18. var lastRow = tbl.rows.length;
  19. var row = tbl.insertRow(lastRow-1);
  20. row.innerHTML=document.getElementById('Row_StartCredit').innerHTML;
  21. }
  22. function setAccount(v) {
  23. account.value=v;
  24. }
  25. var account='';
  26. </script>
  27. {/literal}
  28. {title help="accounting"}
  29. {$book.bookName}: {tr}Book a transaction{/tr}
  30. {/title}
  31. <div id="accountlist" style="float:right; max-height=400px; overflow: scroll;">
  32. <table class="table">
  33. <tr><th colspan="2">{tr}Accounts{/tr}</th></tr>
  34. {if $tiki_p_account_manage=='y'}
  35. <tr><td colspan="2"><a href="tiki-accounting_account.php?bookId={$bookId}&action=new">{tr}Create account{/tr}</a></td></tr>{/if}
  36. {foreach from=$accounts item=a}
  37. <tr class="{cycle values="odd,even"} tips" {popup caption="{tr}Notes{/tr}" text=$a.accountNotes}>
  38. <td class="accompactlist">
  39. {if $tiki_p_acct_manage_accounts =='y'}
  40. <a href="tiki-accounting_account.php?bookId={$bookId}&action=edit&accountId={$a.accountId}">{icon name=edit}</a>
  41. <a href="tiki-accounting_account.php?bookId={$bookId}&action=delete&accountId={$a.accountId}" onclick="confirmPopup('{tr _0="{$a.accountName|escape:'attr'}"}Delete account %0?{/tr}', '{ticket mode=get}')">{icon name=delete}</a>
  42. {/if}
  43. <a href="javascript:setAccount({$a.accountId})">{$a.accountId}</a>
  44. </td>
  45. <td class="accompactlist">
  46. {$a.accountName}
  47. </td>
  48. </tr>
  49. {/foreach}
  50. </table>
  51. </div>
  52. <div id="mask" style="float:left;">
  53. <form method="post" action="{if $req_url}{$req_url}{else}tiki-accounting_entry.php{/if}">
  54. {ticket}
  55. {if $firstid}<input type="hidden" name="firstid" value="{$firstid}">{/if}
  56. {if $statementId}<input type="hidden" name="statementId" value="{$statementId}">{/if}
  57. <input type="hidden" name="bookId" value="{$bookId}">
  58. <fieldset>
  59. <legend>{tr}Post{/tr}</legend>
  60. <div class="mb-3 row">
  61. <label class="col-form-label col-md-4">{tr}Booking Date{/tr} <span class="text-danger">*</span></label>
  62. <div class="col-md-8">
  63. {html_select_date prefix="journal_" time=$journalDate start_year="-10" end_year="+10" field_order=$prefs.display_field_order}
  64. </div>
  65. </div>
  66. <div class="mb-3 row">
  67. <label class="col-form-label col-md-4">{tr}Description{/tr}</label>
  68. <div class="col-md-8">
  69. <textarea class="form-control" name="journalDescription" id="journalDescription" cols="40" rows="3">{$journalDescription}</textarea>
  70. </div>
  71. </div>
  72. <div class="mb-3 row">
  73. <label class="col-form-label col-md-4">{tr}Amount{/tr} <span class="text-danger">*</span></label>
  74. <div class="col-md-8">
  75. <input class="form-control" type="number" name="totalAmount" id="totalAmount" value="{$totalAmount}" onchange="javascript:setAmount()">
  76. </div>
  77. </div>
  78. </fieldset>
  79. <fieldset>
  80. <legend>{tr}Debit{/tr}</legend>
  81. <table id="tbl_debit" class="table">
  82. <tr>
  83. <th>{tr}Text{/tr}</th>
  84. <th>{tr}Account{/tr} <span class="text-danger">*</span></th>
  85. <th>{tr}Amount{/tr} <span class="text-danger">*</span></th>
  86. </tr>
  87. {section name=debit loop=$debitAccount}{assign var='i' value=$smarty.section.debit.iteration-1}
  88. <tr {if $i==0}id="Row_StartDebit" {/if}>
  89. <td>
  90. <input class="form-control" type="text" name="debitText[]" value="{$debitText[$i]}">
  91. </td>
  92. <td>
  93. <select class="form-select" name="debitAccount[]" style="width:180px" onfocus="account=this">
  94. {foreach from=$accounts item=a}
  95. <option value="{$a.accountId}"{if $a.accountId==$debitAccount[$i]} selected="selected"{/if}>{$a.accountId} {$a.accountName}</option>
  96. {/foreach}
  97. </select>
  98. </td>
  99. <td>
  100. <input class="form-control" name="debitAmount[]" {if $i==0}id="debitAmount" {/if}size="10" value="{$debitAmount[$i]}">
  101. </td>
  102. </tr>
  103. {/section}
  104. <tr id="Row_SplitDebit"{if count($creditAccount)>1} style="display:none;"{/if}>
  105. <td colspan="3">
  106. <input class="btn btn-primary btn-sm float-sm-end" type="button" value="{tr}Add entry{/tr}" id="SplitDebit" onclick="javascript:splitDebit()">
  107. </td>
  108. </tr>
  109. </table>
  110. </fieldset>
  111. <fieldset>
  112. <legend>{tr}Credit{/tr}</legend>
  113. <table id="tbl_credit" class="table">
  114. <tr>
  115. <th>{tr}Text{/tr}</th>
  116. <th>{tr}Account{/tr} <span class="text-danger">*</span></th>
  117. <th>{tr}Amount{/tr} <span class="text-danger">*</span></th>
  118. </tr>
  119. {section name=credit loop=$creditAccount}{assign var='i' value=$smarty.section.credit.iteration-1}
  120. <tr {if $i==0}id="Row_StartCredit" {/if}>
  121. <td>
  122. <input class="form-control" type="text" name="creditText[]" value="{$creditText[$i]}">
  123. </td>
  124. <td>
  125. <select class="form-select" name="creditAccount[]" style="width:180px" onfocus="account=this">
  126. {foreach from=$accounts item=a}
  127. <option value="{$a.accountId}"{if $a.accountId==$creditAccount[$i]} selected="selected"{/if}>{$a.accountId} {$a.accountName}</option>
  128. {/foreach}
  129. </select>
  130. </td>
  131. <td>
  132. <input class="form-control" name="creditAmount[]" {if $i==0}id="creditAmount" {/if}size="10" value="{$creditAmount[$i]}">
  133. </td>
  134. </tr>
  135. {/section}
  136. <tr id="Row_SplitCredit"{if count($creditAccount)>1} style="display:none;"{/if}>
  137. <td colspan="3">
  138. <input class="btn btn-primary btn-sm" type="button" value="{tr}Add entry{/tr}" id="SplitCredit" onclick="javascript:splitCredit()">
  139. </td>
  140. </tr>
  141. </table>
  142. </fieldset>
  143. <input
  144. type="submit"
  145. class="btn btn-primary"
  146. name="book"
  147. id="book"
  148. value="{tr}Book{/tr}"
  149. onclick="confirmPopup('{tr _0="{$book.bookName|escape:'attr'}"}Record entry in book %0?{/tr}')"
  150. >
  151. {button href="tiki-accounting.php?bookId=$bookId" _text="{tr}Back to book page{/tr}"}
  152. </form>
  153. </div>
  154. <div id="journal" style="clear: both;">
  155. {include file='tiki-accounting_journal.tpl'}
  156. </div>