Index: trunk/grails-app/views/inventoryItemPurchaseDetailed/search.gsp
===================================================================
--- trunk/grails-app/views/inventoryItemPurchaseDetailed/search.gsp	(revision 570)
+++ trunk/grails-app/views/inventoryItemPurchaseDetailed/search.gsp	(revision 595)
@@ -10,5 +10,5 @@
     <body>
         <div class="nav">
-            <h1>Inventory Purchases</h1>
+            <nav:renderSubItems group="navAlt"/>
         </div>
 
@@ -110,46 +110,55 @@
                                 <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}"/>
 
-                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}"'>
+                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
                                         ${fieldValue(bean:purchase, field:'purchaseOrderNumber')}
                                     </td>
-                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}"'>
+                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
                                         <g:formatDate date="${purchase.dateEntered}" format="EEE, dd-MMM-yyyy"/>
                                     </td>
-                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}"'>
+                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
                                         ${fieldValue(bean:purchase, field:'costCode')}
                                     </td>
-                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}"'>
+                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
                                         ${fieldValue(bean:purchase, field:'quantity')}
                                     </td>
-                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}"'>
+                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
                                         ${fieldValue(bean:purchase, field:'orderValueAmount')}
                                         ${fieldValue(bean:purchase, field:'orderValueCurrency')}
                                     </td>
-                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}"'>
+                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
                                         ${fieldValue(bean:purchase, field:'invoiceNumber')}
                                     </td>
-                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}"'>
+                                    <td onclick='window.location = "${request.getContextPath()}/inventoryItemPurchaseDetailed/show/${purchase.id}?returnTo=search"'>
                                         ${fieldValue(bean:purchase, field:'inventoryItemPurchaseType')}
                                     </td>
                                     <td class="notClickable">
-                                        <g:link controller="inventoryItemPurchaseDetailed" action="show" id="${purchase.id}">
+                                        <g:link controller="inventoryItemPurchaseDetailed" action="show" params="[id: purchase.id, returnTo: 'search']">
                                             <img  src="${resource(dir:'images/skin',file:'database_go.png')}" alt="Show" title="Show" />
                                         </g:link>
                                     </td>
+
                                     <g:if test="${purchase.inventoryItemPurchaseType.id == 1}">
                                         <g:if test="${!purchase.receivedComplete}">
                                             <td class="notClickable">
-                                                <g:link controller="inventoryItemPurchaseDetailed" action="receive" id="${purchase.id}">
+                                                <g:link controller="inventoryItemPurchaseDetailed" action="receive" params="[id: purchase.id, returnTo: 'search']">
                                                     <img  src="${resource(dir:'images/skin',file:'basket_put.png')}" alt="Receive" title="Receive" />
                                                 </g:link>
                                             </td>
+                                            <td class="notClickable">
+                                            </td>
                                         </g:if>
                                         <g:else>
                                             <td class="notClickable">
                                             </td>
+                                            <td class="notClickable">
+                                            </td>
                                         </g:else>
+                                    </g:if>
+                                    <g:elseif test="${(purchase.inventoryItemPurchaseType.id == 2)||(purchase.inventoryItemPurchaseType.id == 3)}">
                                         <g:if test="${!purchase.invoicePaymentApproved}">
                                             <td class="notClickable">
-                                                <g:link controller="inventoryItemPurchaseDetailed" action="approveInvoicePayment" id="${purchase.id}">
+                                            </td>
+                                            <td class="notClickable">
+                                                <g:link controller="inventoryItemPurchaseDetailed" action="approveInvoicePayment" params="[id: purchase.id, returnTo: 'search']">
                                                     <img  src="${resource(dir:'images/skin',file:'tick.png')}" alt="Approve" title="Approve Payment" />
                                                 </g:link>
@@ -159,6 +168,8 @@
                                             <td class="notClickable">
                                             </td>
+                                            <td class="notClickable">
+                                            </td>
                                         </g:else>
-                                    </g:if>
+                                    </g:elseif>
                                     <g:else>
                                         <td class="notClickable">
