I find that the problem statement is not precise enough. See my questions inline.
2011/1/13 dc tech <[email protected]> > > *BACKGROUND* > We have departments setup in a hierarchical structure (i.e. parent > departments) > An employee can belong to one and only one department. > "can belong"? Should be "belongs", I think. > An employee can be the manager of one or more departments; a manager may > or not belong to that department. > A department can have many employees and many managers. > I assume that higher level departments may also have employees, not just managers. > > *PROBLEM* > Find the approver for an employee's expenses. > An approver is a 'higher level' manager relative to employee in the > organizational hierarchy. > Note that since the manager is employee as well, this includes the problem > of finding the manager of a manager. > > *RULES* > 1. The approver the nearest manager to the employee (traversing up the > department hierarchy) > Typical cases then are: > - for a non-manager employee, the approver is the manager of the employee's > department > - for a manager who manages a single department and belongs to that > department, the approver is the manager of the parent unit > > 2. The approver for a manager cannot the manager himself or a peer manager > (in the same department). > Is this a correct interpretation: "peer manager" is another manager *of* the same department; being *in* the same dptmt does not matter. More precisely, a "peer manager" of X is one from the union of all managers managing any of the departments managed by X. > > 3. An approver cannot report to the employee > This sometimes happens when the manager is an employee in one department > but manager for a department a few levels up in the hierarchy > > 3a. An approver cannot be the peer to someone who reports to the manager > I don't see "who is who" in this sentence. "peer" in the sense it was used before? -W > > > > *SAMPLE DATA* > A (manager Hillary) > A1 (manager John and Jane ) > A11 > A12 (manager Mike; employees John and Mike) > A13 > A2 (manager Kate) > A21 (manager Jessica, employee Janet) > A22 (manager Erica, employee Jane) > > 1. Approver for Janet is Jessica > 2. Approver for Jessica is Kate > 3.Approver for John is Hillary (cannot be Mike, John himself or Jane) > 4. Approver for Jane is Erica via A22 (no reporting relationship). > > *ALGORITHMIC SOLUTION* > Define the department reporting vector starting from the employee > department > e.g. for (1) it would be A21 -> A2 -> A and > for (3) it would be A12 -> A1 -> A > Then for each, define managers and then employees > (1) : A21( jessica/ janet ) -> A2: ( Kate) -> A( Hillary) > (2): A12 (Mike/ John, Mike) -> A1 (John, Jane) -> A (Hillary) > Then starting from the top (i.e. A), move down looking for the employee (in > manager or employee list) > If the employee is found in the manager list, approver is the manager of > the parent department > If the employee is found in the employee list, the approver is the manager > of this unit (not the parent) > (I may have missed a few rules in the algorithmic solution) > > > *RULE BASED SOLUTION?* > Is this a good problem for rule bases solution? > I started to model this and will post my solution if I can come up with > something useful but would absolutely welcome your inputs. > > > > > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
