Main Koha release repository https://koha-community.org
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

542 строки
28 KiB

  1. [% USE raw %]
  2. [% USE Asset %]
  3. [% USE Koha %]
  4. [% USE KohaDates %]
  5. [% USE Price %]
  6. [% SET footerjs = 1 %]
  7. [% USE AuthorisedValues %]
  8. [% INCLUDE 'doc-head-open.inc' %]
  9. <title>Koha &rsaquo; Acquisitions &rsaquo; Invoice</title>
  10. [% INCLUDE 'doc-head-close.inc' %]
  11. </head>
  12. <body id="acq_invoice" class="acq">
  13. [% INCLUDE 'header.inc' %]
  14. [% INCLUDE 'acquisitions-search.inc' %]
  15. [% SET readonly = NOT CAN_user_acquisition_edit_invoices %]
  16. <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> &rsaquo; <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid | html %]">[% invoicenumber | html %]</a></div>
  17. <div class="main container-fluid">
  18. <div class="row">
  19. <div class="col-sm-10 col-sm-push-2">
  20. <main>
  21. [% INCLUDE 'blocking_errors.inc' %]
  22. [% IF ( modified ) %]
  23. <div class="dialog message">
  24. <p>Invoice has been modified</p>
  25. </div>
  26. [% END %]
  27. <h1>Invoice: [% invoicenumber | html %]</h1>
  28. <p>Vendor: <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% suppliername | html %]</a></p>
  29. <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
  30. <fieldset class="rows">
  31. <ol>
  32. <li>
  33. [% IF readonly %]
  34. <label for="shipmentdate">Invoice number:</label>
  35. [% invoicenumber | html %]
  36. [% ELSE %]
  37. <label for="shipmentdate" class="required">Invoice number:</label>
  38. <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber | html %]" class="required" required="required"/>
  39. <span class="required">Required</span>
  40. [% END %]
  41. </li>
  42. <li>
  43. <label for="shipmentdate">Shipment date:</label>
  44. [% IF readonly %]
  45. [% shipmentdate | $KohaDates %]
  46. [% ELSE %]
  47. <input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | $KohaDates %]" class="datepicker" />
  48. [% END %]
  49. </li>
  50. <li>
  51. <label for="billingdate">Billing date:</label>
  52. [% IF readonly %]
  53. [% billingdate | $KohaDates %]
  54. [% ELSE %]
  55. <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" class="datepicker" />
  56. [% END %]
  57. </li>
  58. <li>
  59. <label for="shipmentcost">Shipping cost:</label>
  60. [% IF readonly %]
  61. [% shipmentcost | $Price %]
  62. [% ELSE %]
  63. <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost | $Price on_editing => 1 %]" />
  64. [% END %]
  65. </li>
  66. <li>
  67. <label for="shipment_budget_id">Shipping fund: </label>
  68. [% IF readonly %]
  69. [% budget.budget_name | html %]
  70. [% ELSE %]
  71. <select id="shipment_budget_id" name="shipment_budget_id">
  72. <option value="">No fund</option>
  73. [% FOREACH budget IN budgets %]
  74. [% IF ( budget.selected ) %]
  75. <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option>
  76. [% ELSIF ( budget.b_active ) %]
  77. <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
  78. [% ELSE %]
  79. <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option>
  80. [% END %]
  81. [% END %]
  82. </select>
  83. <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
  84. <input type="checkbox" id="showallfunds" />
  85. [% END %]
  86. </li>
  87. [% IF ( invoiceclosedate ) %]
  88. <li><span class="label">Status:</span>
  89. Closed on [% invoiceclosedate | $KohaDates %]</li>
  90. [% IF CAN_user_acquisition_reopen_closed_invoices AND NOT readonly %]
  91. <li>
  92. <label for="reopen">Reopen: </label>
  93. <input type="checkbox" name="reopen" id="reopen" />
  94. </li>
  95. [% END %]
  96. [% ELSE %]
  97. <li>
  98. <span class="label">Status:</span>
  99. Open
  100. </li>
  101. [% UNLESS ( readonly ) %]
  102. <li>
  103. <label for="close">Close: </label>
  104. <input type="checkbox" name="close" id="close" />
  105. </li>
  106. [% END %]
  107. [% END %]
  108. </ol>
  109. [% UNLESS readonly %]
  110. <input type="hidden" name="op" value="mod" />
  111. <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
  112. <fieldset class="action">
  113. <input type="submit" value="Save" />
  114. [% IF CAN_user_acquisition_delete_invoices AND NOT orders_loop.size %]
  115. <a href="invoice.pl?op=delete&invoiceid=[% invoiceid | uri %]" id="delete">Delete</a>
  116. [% END %]
  117. </fieldset>
  118. [% END %]
  119. </fieldset>
  120. </form>
  121. <hr />
  122. <h3>Adjustments</h3>
  123. <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
  124. <fieldset class="rows">
  125. <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
  126. [% IF (adjustments && adjustments.count > 0) %]
  127. <table id="invoice_adj_table">
  128. <tr>
  129. <th>Id</th>
  130. <th>Amount</th>
  131. <th>Reason</th>
  132. <th>Note</th>
  133. <th>Fund</th>
  134. <th>Encumber while invoice open</th>
  135. [% UNLESS readonly %]<th>&nbsp</th>[% END %]
  136. </tr>
  137. [% total_adj = 0 %]
  138. [% FOREACH adjustment IN adjustments %]
  139. [% total_adj = total_adj + adjustment.adjustment %]
  140. <tr>
  141. <td><input type="hidden" name="adjustment_id" value="[% adjustment.adjustment_id | html %]" />[% adjustment.adjustment_id | html %]</td>
  142. <td>
  143. [% IF readonly %]
  144. [% adjustment.adjustment | $Price %]
  145. [% ELSE %]
  146. <input type="text" name="adjustment" id="adjustment_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment | $Price on_editing => 1 %]" />
  147. [% END %]
  148. </td>
  149. <td>
  150. [% IF readonly %]
  151. [% AuthorisedValues.GetByCode('ADJ_REASON', adjustment.reason) | html %]
  152. [% ELSE %]
  153. [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
  154. [% IF reasons.0 %]
  155. <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
  156. <option value="">No reason</option>
  157. [% FOREACH reason IN reasons %]
  158. [% IF ( adjustment.reason == reason.authorised_value ) %]
  159. <option selected="selected" value="[% reason.authorised_value | html %]">
  160. [% ELSE %]
  161. <option value="[% reason.authorised_value | html %]">
  162. [% END %]
  163. [% reason.lib | html %]
  164. </option>
  165. [% END %]
  166. </select>
  167. [% ELSE %]
  168. <p title="Define values in authorised value category ADJ_REASON to enable">None</p>
  169. <input type="hidden" name="reason" id="reason_[% adjustment.adjustment_id | html %]" value="" />
  170. [% END %]
  171. [% END %]
  172. </td>
  173. <td>
  174. [% IF readonly %]
  175. [% adjustment.note | html %]
  176. [% ELSE %]
  177. <input type="text" name="note" id="note_new" value="[% adjustment.note | html %]"/>
  178. [% END %]
  179. </td>
  180. <td>
  181. [% IF readonly %]
  182. [% adjustement.fund.budget_name | html %]
  183. [% ELSE %]
  184. <select id="budget_id_[% adjustment.adjustment_id | html %]" name="budget_id">
  185. <option value="">No fund</option>
  186. [% FOREACH budget IN budgets %]
  187. [% IF ( budget.b_id == adjustment.budget_id ) %]
  188. <option selected="selected" value="[% budget.b_id | html %]">
  189. [% ELSE %]
  190. <option value="[% budget.b_id | html %]">
  191. [% END %]
  192. [% budget.b_txt | html %]
  193. </option>
  194. [% END %]
  195. </select>
  196. [% END %]
  197. </td>
  198. [% IF adjustment.encumber_open %]
  199. <td>
  200. [% IF readonly %]
  201. <input type="checkbox" checked="checked" readonly="readonly" />
  202. [% ELSE %]
  203. <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" checked/>
  204. [% END %]
  205. </td>
  206. [% ELSE %]
  207. <td>
  208. [% IF readonly %]
  209. <input type="checkbox" disabled="disabled" />
  210. [% ELSE %]
  211. <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" />
  212. [% END %]
  213. </td>
  214. [% END %]
  215. [% UNLESS readonly %]
  216. <td>
  217. <a class="btn btn-default btn-xs delete_adjustment" href="/cgi-bin/koha/acqui/invoice.pl?op=del_adj&adjustment_id=[% adjustment.adjustment_id | html %]&invoiceid=[% invoiceid | html %]"><i class="fa fa-trash"></i> Delete</a>
  218. </td>
  219. [% END %]
  220. </tr>
  221. [% END %]
  222. </table>
  223. [% END %]
  224. [% UNLESS readonly %]
  225. <p>
  226. <a href="#" id="show_invoice_adjustment" class="toggle_invoice_adjustment"><i class="fa fa-plus"></i> Add an adjustment</a>
  227. </p>
  228. <fieldset id="add_invoice_adjustment" style="display:none">
  229. <h4>Add an adjustment</h4>
  230. <input type="hidden" name="adjustment_id" value="new" />
  231. <ol>
  232. <li>
  233. <label for="adjustment_new">Amount: </label>
  234. <input type="text" name="adjustment" id="adjustment_new" />
  235. </li>
  236. [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
  237. [% IF reasons.0 %]
  238. <li>
  239. <label for="reason_[% adjustment.adjustment_id | html %]">Reason: </label>
  240. <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
  241. <option value="">No reason</option>
  242. [% FOREACH reason IN reasons %]
  243. <option value="[% reason.authorised_value | html %]">
  244. [% reason.lib | html %]
  245. </option>
  246. [% END %]
  247. </select>
  248. </li>
  249. [% ELSE %]
  250. <li>
  251. <span class="label">Reason: </span>
  252. <span>None</span>
  253. <div class="hint">Define values in authorised value category ADJ_REASON to enable</div>
  254. </li>
  255. [% END %]
  256. <li>
  257. <label for="note_new">Note: </label>
  258. <input type="text" name="note" id="note_new" value=""/>
  259. </li>
  260. <li>
  261. <label for="budget_id_new">Fund: </label>
  262. <select id="budget_id_new" name="budget_id">
  263. <option value="">No fund</option>
  264. [% FOREACH budget IN budgets %]
  265. [% IF ( budget.selected ) %]
  266. <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option>
  267. [% ELSIF ( budget.b_active ) %]
  268. <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
  269. [% ELSE %]
  270. <option value="[% budget.b_id | html %]" class="ab_inactive">[% budget.b_txt | html %] (inactive)</option>
  271. [% END %]
  272. [% END %]
  273. </select>
  274. <label for="showallfunds_adj" style="float:none;width:auto;">&nbsp;Show inactive:</label>
  275. <input type="checkbox" id="showallfunds_adj" />
  276. </li>
  277. <li>
  278. <label for="encumber_new">Encumber while invoice open? </label>
  279. <input type="checkbox" name="encumber_open" id="encumber_new" value="new" />
  280. <input type="hidden" name="delete" value="">
  281. </li>
  282. <li>
  283. <span class="label">&nbsp;</span>
  284. <a href="#" id="cancel_invoice_adjustment" class="toggle_invoice_adjustment" style="display:none"><i class="fa fa-remove"></i> Cancel</a>
  285. </li>
  286. </ol>
  287. </fieldset>
  288. <fieldset class="action">
  289. <input type="hidden" name="op" value="mod_adj" />
  290. <input type="submit" value="Update adjustments" />
  291. </fieldset>
  292. [% END %]
  293. </fieldset>
  294. </form>
  295. <p>
  296. <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">Go to receipt page</a>
  297. [% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid | uri %]">Manage invoice files</a>[% END %]
  298. </p>
  299. <h2>Invoice details</h2>
  300. <fieldset>
  301. [% IF orders_loop.size %]
  302. <label for="show_all_details">
  303. <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
  304. Show all details
  305. </label>
  306. <table id="orderst">
  307. <thead>
  308. <tr>
  309. <th class="anti-the">Summary</th>
  310. <th>Library</th>
  311. <th class="tax_excluded">Actual cost tax exc.</th>
  312. <th class="tax_included">Actual cost tax inc.</th>
  313. <th class="replacementprice">Replacement price</th>
  314. <th>Qty.</th>
  315. <th class="tax_excluded">Total tax exc. ([% currency.symbol | html %])</th>
  316. <th class="tax_included">Total tax inc. ([% currency.symbol | html %])</th>
  317. <th>GST %</th>
  318. <th>GST</th>
  319. <th>Fund</th>
  320. </tr>
  321. </thead>
  322. <tbody>
  323. [% FOREACH order IN orders_loop %]
  324. <tr>
  325. <td>
  326. [% IF order.biblionumber %]
  327. <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title | html %]</a>
  328. [% IF ( order.author ) %]
  329. <br /><em>by</em> [% order.author | html %]
  330. [% END %]
  331. [% ELSE %]
  332. <em>Deleted bibliographic record, can't find title</em>
  333. [% END %]
  334. [% IF ( order.isbn ) %] &ndash; [% order.isbn | html %][% END %]
  335. [% IF ( order.publishercode ) %]
  336. <br/>[% order.publishercode | html %]
  337. [% IF order.publicationyear %], [% order.publicationyear | html %]
  338. [% ELSIF ( order.copyrightdate ) %][% order.copyrightdate | html %][% END %]
  339. [% END %]
  340. </td>
  341. <td><p>[% order.branchcode | html %]</p></td>
  342. <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
  343. <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
  344. <td class="number replacementprice">[% order.replacementprice | $Price %] [% IF ( order.uncertainprice ) %] (Uncertain) [% END %]</td>
  345. <td class="number">[% order.quantity | html %]</td>
  346. <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
  347. <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
  348. <td class="number">[% order.tax_rate * 100 | html %]</td>
  349. <td class="number">[% order.tax_value | $Price %]</td>
  350. <td>[% order.budget_name | html %]</td>
  351. </tr>
  352. [% END %]
  353. </tbody>
  354. <tfoot>
  355. [% FOR tf IN foot_loop %]
  356. <tr>
  357. <th colspan="2">Total (GST [% tf.tax_rate * 100 | html %] %)</th>
  358. <th class="tax_excluded"></th>
  359. <th class="tax_included"></th>
  360. <th class="replacementprice"/>
  361. <th>[% tf.quantity | html %]</th>
  362. <th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>
  363. <th class="tax_included">[% tf.total_tax_included | $Price %]</th>
  364. <th>&nbsp;</th>
  365. <th>[% tf.tax_value | $Price %]</th>
  366. <th>&nbsp;</th>
  367. </tr>
  368. [% END %]
  369. <tr>
  370. <th colspan="2">Total ([% currency.symbol | html %])</th>
  371. <th class="tax_excluded"></th>
  372. <th class="tax_included"></th>
  373. <th class="replacementprice"/>
  374. <th>[% total_quantity | html %]</th>
  375. <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
  376. <th class="tax_included">[% total_tax_included | $Price %]</th>
  377. <th>&nbsp;</th>
  378. <th>[% total_tax_value | $Price %]</th>
  379. <th>&nbsp;</th>
  380. </tr>
  381. <tr>
  382. <th colspan="2">Total + adjustments + shipment cost ([% currency.symbol | html %])</th>
  383. <th class="tax_excluded"></th>
  384. <th class="tax_included"></th>
  385. <th class="replacementprice"/>
  386. <th>[% total_quantity | html %]</th>
  387. <th class="tax_excluded">[% total_tax_excluded_shipment + total_adj | $Price %]</th>
  388. <th class="tax_included">[% total_tax_included_shipment + total_adj | $Price %]</th>
  389. <th>&nbsp;</th>
  390. <th>[% total_tax_value | $Price %]</th>
  391. <th>&nbsp;</th>
  392. </tr>
  393. </tfoot>
  394. </table>
  395. [% ELSE %]
  396. <div class="dialog message"><p>No orders yet</p>
  397. [% IF adjustments && adjustments.count > 0 || shipmentcost && shipmentcost > 0 %]
  398. <p>Adjustments plus shipping: [% total_adj + shipmentcost | $Price %]</p>
  399. [% END %]
  400. </div>
  401. [% END %]
  402. [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
  403. <br />
  404. <h2>Files attached to invoice</h2>
  405. <table id="invoice_files_table">
  406. <thead>
  407. <tr>
  408. <th>Name</th>
  409. <th>Type</th>
  410. <th>Description</th>
  411. <th>Uploaded</th>
  412. </tr>
  413. </thead>
  414. <tbody>
  415. [% FOREACH f IN files %]
  416. <tr>
  417. <td><a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid | uri %]&amp;op=download&amp;view=1&amp;file_id=[% f.file_id | uri %]">[% f.file_name | html %]</a></td>
  418. <td>[% f.file_type | html %]</td>
  419. <td>[% f.file_description | html %]</td>
  420. <td class="title-string">
  421. <span title="[% f.date_uploaded | html %]">[% f.date_uploaded | $KohaDates %]</span>
  422. </td>
  423. </tr>
  424. [% END %]
  425. </tbody>
  426. </table>
  427. [% END %]
  428. </fieldset>
  429. </main>
  430. </div> <!-- /.col-sm-10.col-sm-push-2 -->
  431. <aside>
  432. <div class="col-sm-2 col-sm-pull-10">
  433. [% INCLUDE 'acquisitions-menu.inc' %]
  434. </div>
  435. </aside>
  436. </div> <!-- /.row -->
  437. [% MACRO jsinclude BLOCK %]
  438. [% Asset.js("js/acquisitions-menu.js") | $raw %]
  439. [% INCLUDE 'calendar.inc' %]
  440. [% INCLUDE 'datatables.inc' %]
  441. <script>
  442. function updateColumnsVisibility(visible) {
  443. if ( visible ) {
  444. $("table .tax_excluded, .tax_included").show();
  445. } else {
  446. [% IF ( invoiceincgst ) %]
  447. $("table .tax_excluded").hide();
  448. [% ELSE %]
  449. $("table .tax_included").hide();
  450. [% END %]
  451. }
  452. }
  453. $(document).ready(function() {
  454. $("#delete").click(function(){
  455. return confirmDelete(_("Are you sure you want to delete this invoice?"));
  456. });
  457. $("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, {
  458. bInfo: false,
  459. bPaginate: false,
  460. bFilter: false,
  461. sDom: "t",
  462. "aoColumnDefs": [
  463. { "sType": "anti-the", "aTargets": [ "anti-the" ] }
  464. ]
  465. }));
  466. [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
  467. $("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
  468. "aoColumnDefs": [
  469. { "aTargets": [ "title-string" ], "sType": "title-string" }
  470. ],
  471. bInfo: false,
  472. bPaginate: false,
  473. bFilter: false,
  474. sDom: "t"
  475. }));
  476. [% END %]
  477. $("#show_all_details").click(function(){
  478. updateColumnsVisibility( $(this).is(":checked") );
  479. });
  480. $("#show_all_details").prop('checked', false);
  481. updateColumnsVisibility(false);
  482. $(".toggle_invoice_adjustment").on("click", function(e){
  483. e.preventDefault();
  484. $("#show_invoice_adjustment, #cancel_invoice_adjustment, #add_invoice_adjustment").toggle();
  485. });
  486. $("a.delete_adjustment").click(function(){
  487. return ( confirm( _("Are you sure you want to delete this file ?") ) );
  488. });
  489. //keep a copy of all budgets before removing the inactives
  490. var budgetId = $("#shipment_budget_id");
  491. var disabledBudgetsCopy = budgetId.html();
  492. $('.b_inactive').remove();
  493. $('#showallfunds').click(function() {
  494. if ($(this).is(":checked")) {
  495. budgetId.html(disabledBudgetsCopy); //Puts back all the funds
  496. }
  497. else {
  498. $('.b_inactive').remove();
  499. }
  500. });
  501. // same effort for the adjustments
  502. var adjBudgetId = $("#budget_id_new");
  503. var disabledAdjBudgetsCopy = adjBudgetId.html();
  504. $('.ab_inactive').remove();
  505. $('#showallfunds_adj').click(function() {
  506. if ($(this).is(":checked")) {
  507. adjBudgetId.html(disabledAdjBudgetsCopy); //Puts back all the funds
  508. }
  509. else {
  510. $('.ab_inactive').remove();
  511. }
  512. });
  513. });
  514. </script>
  515. [% END %]
  516. [% INCLUDE 'intranet-bottom.inc' %]