5 [% USE ColumnsSettings %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Acquisitions › Late orders</title>
9 [% INCLUDE 'doc-head-close.inc' %]
12 <body id="acq_lateorders" class="acq">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'acquisitions-search.inc' %]
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="lateorders.pl">Late orders</a></div>
18 <div class="main container-fluid">
20 <div class="col-sm-10 col-sm-push-2">
23 <h1>[% IF ( Supplier ) %][% Supplier | html %] : [% END %]Late orders</h1>
24 <div id="acqui_lateorders">
27 [% IF ( error_claim == "no_email" ) %]
28 <div class="dialog alert">This vendor has no email</div>
29 [% ELSIF ( error_claim == "no_order_selected" ) %]
30 <div class="dialog alert">No order selected</div>
32 <div class="dialog alert">[% error_claim | html %]</div>
36 <div class="dialog message">Email has been sent.</div>
38 [% IF ( lateorders ) %]
39 <form action="lateorders.pl" name="claim" method="post">
40 <input type="hidden" name="op" value="send_alert" />
41 <input type="hidden" name="delay" value="[% delay | html %]" />
42 <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
44 <p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
45 [% FOREACH letter IN letters %]
46 <option value="[% letter.code | html %]">[% letter.name | html %]</option>
51 <table id="late_orders">
55 <th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th>
60 <th class="title-string">Order date</th>
61 <th class="title-string">Estimated delivery date</th>
63 <th class="anti-the">Information</th>
70 <th class="title-string">Claimed date</th>
71 <th>Internal note</th>
77 [% FOREACH lateorder IN lateorders %]
80 <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber">
83 [% lateorder.ordernumber | $raw %]
86 <span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span>
89 [% IF ( lateorder.estimateddeliverydate ) %]
90 <span title="[% lateorder.estimateddeliverydate | html %]">[% lateorder.estimateddeliverydate | $KohaDates %]</span>
92 <span title="0000-00-00"></span>
96 [% lateorder.supplier | html %]
97 ([% lateorder.supplierid | html %])
100 <b>[% lateorder.title | html %]</b>
101 [% IF ( lateorder.author ) %]<br/><i>Author:</i> [% lateorder.author | html %][% END %]
102 [% IF ( lateorder.publisher ) %]
103 <br/><i>Published by:</i> [% lateorder.publisher | html %]
104 [% IF ( lateorder.publicationyear ) %]
105 <i> in </i>[% lateorder.publicationyear | html %]
110 [% lateorder.unitpricesupplier | html %]x[% lateorder.quantity | html %] =
111 [% lateorder.subtotal | html %]
114 [% IF ( CAN_user_acquisition_order_manage ) %]
115 <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basketname | html %] ([% lateorder.basketno | html %])</a>
117 [% lateorder.basketname | html %] ([% lateorder.basketno | html %])
121 [% IF ( lateorder.basketgroupid ) %]
122 [% IF ( CAN_user_acquisition_group_manage ) %]
123 <a href="basketgroup.pl?op=add&booksellerid=[% lateorder.supplierid | uri %]&basketgroupid=[% lateorder.basketgroupid | uri %]" title="basketgroup">[% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %])</a>
125 [% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %])</a>
129 <td>[% Branches.GetName( lateorder.branch ) | html %]
131 <td>[% lateorder.budget | html %]
133 <td>[% lateorder.claims_count | html %]</td>
135 [% IF ( lateorder.claimed_date ) %]
136 <span title="[% lateorder.claimed_date | html %]">[% lateorder.claimed_date | $KohaDates %]</span>
138 <span title="0000-00-00"></span>
141 <td><input name="internalnote" id="internalnote" type="text" value="[% lateorder.internalnote | html %]"></td>
142 <td><input name="vendornote" id="vendornote" type="text" value="[% lateorder.vendornote | html %]"></td>
143 <td>[% lateorder.isbn | $raw %]</td>
149 <th colspan="6">Total</th>
150 <th>[% total | html %]</th>
151 <th colspan="9"> </th>
155 <div class="spacer"></div>
157 <p style="display:block;">
158 <input type="button" value="Export as CSV" id="ExportSelected" />
159 [% UNLESS lateorder.budget_lock %]
160 <input type="submit" value="Claim order" />
162 <input type="button" value="Save notes" id="savenotes"/>
165 [% ELSE %]<p>There are no late orders.</p>
167 </div> <!-- /#acqui_lateorders -->
169 </div> <!-- /.col-sm-10.col-sm-push-2 -->
171 <div class="col-sm-2 col-sm-pull-10">
173 <form action="lateorders.pl" method="get">
174 <fieldset class="brief">
175 <h4>Filter results:</h4>
176 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
177 [% IF ( ERROR_LOO.delay_digits ) %]<p class="error">The number of days ([% ERROR_LOO.bad_delay | html %]) must be a number between 0 and 999.</p>[% END %]
180 <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
181 <li><label for="from">Estimated delivery date from: </label>
182 <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="datepickerfrom" />
183 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
185 <li><label for="to">To: </label>
186 <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="datepickerto" />
187 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
190 <li><label for="booksellerid">Vendor:</label>
191 <select id="booksellerid" size="1" tabindex="" name="booksellerid">
192 <option value=""></option>
193 [% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
194 [% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id | html %]" selected="selected">[% SUPPLIER_LOO.name | html %]</option>
195 [% ELSE %]<option value="[% SUPPLIER_LOO.id | html %]">[% SUPPLIER_LOO.name | html %]</option>[% END %]
199 <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
202 [% INCLUDE 'acquisitions-menu.inc' %]
204 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
207 [% MACRO jsinclude BLOCK %]
208 [% Asset.js("js/acquisitions-menu.js") | $raw %]
209 [% INCLUDE 'datatables.inc' %]
210 [% INCLUDE 'columns_settings.inc' %]
211 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
212 [% INCLUDE 'calendar.inc' %]
215 function check_uncheck() {
216 var all_nodes = $(late_orderst.fnGetNodes());
217 if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
218 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
219 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
221 $("input:checkbox[name=ordernumber]").prop('disabled', false);
225 $(document).ready(function() {
227 var columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
228 late_orderst = KohaTable("late_orders", {
230 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
231 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
232 { "sType": "title-string", "aTargets" : [ "title-string" ] }
234 "sPaginationType": "full",
236 "fnDrawCallback": function() {
237 if ( typeof late_orderst != 'undefined' ) {
239 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
242 }, columns_settings );
243 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
244 $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
245 $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
247 // Generates a dynamic link for exporting the selection's data as CSV
248 $("#ExportSelected").click(function() {
249 var all_nodes = $(late_orderst.fnGetNodes());
250 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
252 if (selected.length == 0) {
253 alert(_("Please select at least one item to export."));
257 // Building the url from currently checked boxes
258 var url = '/cgi-bin/koha/acqui/lateorders-export.pl?op=export';
259 for (var i = 0; i < selected.length; i++) {
260 url += '&ordernumber=' + selected[i].value;
262 // And redirecting to the CSV page
267 $("#savenotes").click(function(){
268 $("#savenotes").after("<span id=\"loading\" style=\"margin:4px;\"><img src=\"[% interface | html %]/[% theme | html %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</span>");
269 var all_nodes = $(late_orderst.fnGetNodes());
270 var req = new XMLHttpRequest();
271 var url = '/cgi-bin/koha/acqui/lateorders.pl';
272 var data = new FormData();
273 data.append("op","save");
274 for (var i = 0; i < all_nodes.length; i++) {
275 var order = $(all_nodes[i]).find("input[name='ordernumber']");
276 var internalnote = $(all_nodes[i]).find("input[name='internalnote']")[0].value;
277 var vendornote = $(all_nodes[i]).find("input[name='vendornote']")[0].value;
278 var internalnote_key = order[0].value + "_i";
279 var vendornote_key = order[0].value + "_v";
280 data.append(internalnote_key, internalnote);
281 data.append(vendornote_key, vendornote);
284 req.open("POST",url);
286 req.onreadystatechange = function () {
287 $("#loading").remove();
288 if (req.readyState == '4' ){
289 if ( req.status == 200 ){
290 alert(_("Notes successfully saved"));
293 alert(_("Error while saving the notes. Please try again"));
302 [% INCLUDE 'intranet-bottom.inc' %]