Rev 37536 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<script type="text/javascript">$(function () {// The partner filter reuses the shared /partners typeahead; only a picked suggestion sets// the id, so a half-typed name never silently filters the page to nothing.getPartnerAheadOptions($('#partner-filter-input'), function (selectedPartner) {$('#partner-filter-id').val(selectedPartner.partnerId);});$('#partner-filter-input').on('input', function () {if (!$(this).val()) {$('#partner-filter-id').val('');}});function loadSaleReturns() {var fromDate = $('#invoice-return-from-date').val();var toDate = $('#invoice-return-to-date').val();if (!fromDate || !toDate) {alert("Please pick both From and To dates");return;}if (fromDate > toDate) {alert("From date must be on or before To date");return;}var url = context + "/return/invoice?fromDate=" + encodeURIComponent(fromDate)+ "&toDate=" + encodeURIComponent(toDate);var fofoId = $('#partner-filter-id').val();if (fofoId) {url += "&fofoId=" + encodeURIComponent(fofoId);}doAjaxRequestHandler(url, "GET", function (response) {$('#main-content').html(response);});}$('#sale-return-filter-apply').on('click', loadSaleReturns);$('#partner-filter-clear').on('click', function () {$('#partner-filter-input').val('');$('#partner-filter-id').val('');loadSaleReturns();});});</script><section class="wrapper"><div class="row"><div class="col-lg-12"><h3 class="page-header"><i class="icon_document_alt"></i>SALE RETURNS</h3><ol class="breadcrumb"><li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li><li><i class="icon_document_alt"></i>SALE RETURNS</li></ol></div></div><div><div class="row"><div class="col-lg-3"><input type="text" class="form-control" id="debit-note-number-input" placeholder="Enter Debit Note Number" value="" /></div><div class="col-lg-1"><button class="btn btn-primary" id="search-debit-note-btn" type="button">Search</button></div><div class="col-lg-3"><input type="text" class="form-control" id="invoice-number-input" placeholder="Enter Invoice Number" value="" /></div><div class="col-lg-1"><button class="btn btn-primary" id="return-invoice-button" type="button">Search</button></div></div><div class="row" style="margin-top: 8px;"><div class="col-lg-2"><label style="font-size:12px;">From</label><input type="date" class="form-control" id="invoice-return-from-date" value="$!fromDate" /></div><div class="col-lg-2"><label style="font-size:12px;">To</label><input type="date" class="form-control" id="invoice-return-to-date" value="$!toDate" /></div><div class="col-lg-3"><label style="font-size:12px;">Partner</label><input type="text" class="form-control" id="partner-filter-input" autocomplete="off"placeholder="Type 3+ letters of partner name" value="$!partnerFilterName" /><input type="hidden" id="partner-filter-id" value="$!fofoId" /></div><div class="col-lg-2" style="margin-top: 21px;"><button class="btn btn-default" id="sale-return-filter-apply" type="button">Apply</button><button class="btn btn-link" id="partner-filter-clear" type="button">Clear partner</button></div></div></div><div id="invoice-return-results" style="margin-top: 4%"></div><div style="margin-top: 4%"><h4>Action Pending #if($pendingRows)($pendingRows.size())#end</h4>#if($pendingRows && $pendingRows.size() > 0)<table class="table table-striped table-condensed table-bordered"><thead><tr><th>DN Id</th><th>Debit Note #</th><th>Invoice</th><th>Partner</th><th>Warehouse</th><th>Pending Since</th><th>Days</th><th>Status</th><th>Action</th></tr></thead><tbody>#foreach($row in $pendingRows)<tr><td>#if($row.getDebitNoteId())$row.getDebitNoteId()#else-#end</td><td>#if($row.getDebitNoteId())<a href="javascript:void(0)" class="debit-note-details" data-debitnote-id="$row.getDebitNoteId()">$!row.getDebitNoteNumber()</a>#else$!row.getDebitNoteNumber()#end</td><td>#if($row.getInvoiceNumber())<a href="${rc.contextPath}/purchase-invoice/$row.getInvoiceNumber()" target="_blank">$row.getInvoiceNumber()</a>#end</td><td>$!row.getPartnerName()</td><td>$!row.getWarehouseName()</td><td>$!row.getFormattedPendingSince() <small class="text-muted">$!row.getDateLabel()</small></td><td>$row.getPendingDays()</td><td><span class="label label-$row.getStatusStyle()">$row.getStatusLabel()</span>#if($row.isIrnFailed())<br/><small class="text-danger">$!row.getIrnFailureReason()</small>#end</td><td>#if($row.isIrnFailed())## NIC refused this return for the buyer's GSTIN: only Finance acts on it from here.#if($canRefund)#if($row.isB2cAvailable())<a href="javascript:void(0)" class="btn btn-xs btn-danger b2c-refund" data-pro-id="$row.getPurchaseReturnOrderId()">Refund as B2C</a>#elseif($row.getPendingAction() == "REFUND")<a href="javascript:void(0)" class="btn btn-xs btn-danger refund-debit-note" data-debitnote-id="$row.getDebitNoteId()">Retry Refund</a>#else<a href="javascript:void(0)" class="btn btn-xs btn-danger approve-invoice-return" data-pro-id="$row.getPurchaseReturnOrderId()">Retry Approve & Refund</a>#end#if($row.getPendingAction() == "APPROVE")<a href="javascript:void(0)" class="btn btn-xs btn-warning reject-invoice-return" data-pro-id="$row.getPurchaseReturnOrderId()">Reject</a>#end#else<span class="text-muted">IRN failed - awaiting Finance</span>#end#elseif($row.getPendingAction() == "REFUND" && $canRefund)<a href="javascript:void(0)" class="btn btn-xs btn-danger refund-debit-note" data-debitnote-id="$row.getDebitNoteId()">Refund</a>#end#if($row.getPendingAction() == "ACKNOWLEDGE")<a href="javascript:void(0)" class="btn btn-xs btn-warning acknowledge-rejected-return" data-debitnote-id="$row.getDebitNoteId()">Acknowledge Receipt</a>#end#if($row.getPendingAction() == "APPROVE" && $canApproveInvoiceReturn && !$row.isIrnFailed())<a href="javascript:void(0)" class="btn btn-xs btn-danger approve-invoice-return" data-pro-id="$row.getPurchaseReturnOrderId()">Approve & Refund</a><a href="javascript:void(0)" class="btn btn-xs btn-warning reject-invoice-return" data-pro-id="$row.getPurchaseReturnOrderId()">Reject</a>#end</td></tr>#end</tbody></table>#else<div class="alert alert-success">Nothing pending#if($fofoId) for this partner#end.</div>#end</div><div style="margin-top: 4%"><h4>Settled Returns <small>$!fromDate to $!toDate</small></h4>#if($recentOrders && $recentOrders.size() > 0)<table class="table table-striped table-condensed table-bordered"><thead><tr><th>DN Id</th><th>Debit Note #</th><th>Invoice</th><th>Partner</th><th>Warehouse</th><th>Received By</th><th>Received On</th><th>Status</th></tr></thead><tbody>#foreach($pro in $recentOrders)#set($dn = $debitNoteMap.get($pro.getId()))<tr><td>#if($dn)$dn.getId()#else-#end</td><td>#if($dn)<a href="javascript:void(0)" class="debit-note-details" data-debitnote-id="$dn.getId()">$dn.getDebitNoteNumber()</a>#else$pro.getDocumentReference()#end</td><td>#if($invoiceMap.get($pro.getId()))<a href="${rc.contextPath}/purchase-invoice/$invoiceMap.get($pro.getId())" target="_blank">$invoiceMap.get($pro.getId())</a>#end</td><td>$!partnerNameMap.get($pro.getFofoId())</td><td>$!warehouseNameMap.get($pro.getWarehouseId())</td><td>$!pro.getReceivedBy()</td><td>$!pro.getFormattedReceiveTimestamp()</td><td>#if($pro.getRejectTimestamp())<span class="label label-default">Cancelled</span>#else<span class="label label-success">Refunded</span>#end</td></tr>#end</tbody></table>#else<div class="alert alert-info">No settled returns in this date range#if($fofoId) for this partner#end.</div>#end</div></section>