Index: trunk/grails-app/services/CreateDataService.groovy
===================================================================
--- trunk/grails-app/services/CreateDataService.groovy	(revision 631)
+++ trunk/grails-app/services/CreateDataService.groovy	(revision 633)
@@ -115,5 +115,4 @@
 
         // Person and Utils
-        createDemoPersons()
         createDemoSites()
         createDemoDepartments()
@@ -121,5 +120,7 @@
         createDemoManufacturers()
         createDemoProductionReference()
+        createDemoPurchasingGroups()  /// @todo: Perhaps a 'createQuickStartData' method?
         createDemoCostCodes()
+        createDemoPersons()
 
         // Assets
@@ -307,4 +308,7 @@
         personInstance.addToAuthorities(Authority.get(2)) // ROLE_Manager.
         personInstance.addToAuthorities(Authority.get(3)) // ROLE_AppUser.
+        personInstance.addToPersonGroups(PersonGroup.get(1))
+        personInstance.addToPurchasingGroups(PurchasingGroup.get(1))
+        personInstance.addToPurchasingGroups(PurchasingGroup.get(2))
 
         //Person #4
@@ -697,4 +701,19 @@
     }
 
+    void createDemoPurchasingGroups() {
+
+        // PurchasingGroup
+        def purchasingGroupInstance
+
+        purchasingGroupInstance = new PurchasingGroup(name:"R&M")
+        saveAndTest(purchasingGroupInstance)
+
+        purchasingGroupInstance = new PurchasingGroup(name:"Raw Materials")
+        saveAndTest(purchasingGroupInstance)
+
+        purchasingGroupInstance = new PurchasingGroup(name:"Safety")
+        saveAndTest(purchasingGroupInstance)
+    }
+
     def createDemoCostCodes() {
 
@@ -703,9 +722,16 @@
 
         // CostCode #1
-        costCodeInstance = new CostCode(name: "RM Reelstand")
+        costCodeInstance = new CostCode(name: "Reelstand.172",
+                                                                    purchasingGroup: PurchasingGroup.get(1))
         saveAndTest(costCodeInstance)
 
         // CostCode #2
-        costCodeInstance = new CostCode(name: "CAPEX Reelstand")
+        costCodeInstance = new CostCode(name: "Reelstand.CAPEX",
+                                                                    purchasingGroup: PurchasingGroup.get(1))
+        saveAndTest(costCodeInstance)
+
+        // CostCode #2
+        costCodeInstance = new CostCode(name: "PrintUnit.123",
+                                                                    purchasingGroup: PurchasingGroup.get(3))
         saveAndTest(costCodeInstance)
     }
Index: trunk/grails-app/services/InventoryPurchaseService.groovy
===================================================================
--- trunk/grails-app/services/InventoryPurchaseService.groovy	(revision 631)
+++ trunk/grails-app/services/InventoryPurchaseService.groovy	(revision 633)
@@ -89,4 +89,37 @@
     }
 
+    /**
+    * Get costCodes by person and the purchasingGroups they have been assigned.
+    * @param person A Person, defaults to currentUser.
+    * @returns A list of CostCodes.
+    */
+    def getCostCodesByPerson(person = authService.currentUser) {
+        if(person.purchasingGroups) {
+            CostCode.withCriteria {
+                    eq('isActive', true)
+                    or {
+                        person.purchasingGroups.each() { purchasingGroup ->
+                            eq('purchasingGroup', purchasingGroup)
+                        }
+                    }
+            }.sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } // withCriteria
+        }
+        else
+            []
+    } // getCostCodesByPerson
+
+    /**
+    * Check if a person is in a purchasing group.
+    * @param person A PurchasingGroup to check for.
+    * @param person A Person, defaults to currentUser.
+    * @returns True if person is in group.
+    */
+    def isPersonInPurchasingGroup(purchasingGroup, person = authService.currentUser) {
+        for(pg in person.purchasingGroups) {
+            if(pg.id == purchasingGroup.id)
+                return true
+        }
+    } // isPersonInPurchasingGroup
+
     def delete(params) {
         InventoryItemPurchase.withTransaction { status ->
