My CodeIgniter-based POS already tracks sales, but its commission module is still one-size-fits-all. I need the underlying logic re-worked so it: • Calculates commission on a per-item basis rather than on the overall ticket. • Supports both fixed and variable rates at the same time—some items pay a flat percentage, others pull their rate from a lookup table. • Splits the resulting amount among several employees according to their individual contribution on that invoice (quantity sold, price handled, or another numeric field that is already stored with the sale). All of this happens inside a single invoice workflow, so totals, taxes, discounts, and loyalty points remain untouched. Only the commission calculation and its database writes need updating. Deliverables: 1. Updated model and controller methods with clear inline comments. 2. Any new or altered SQL structure (migrations preferred). 3. A short README explaining how to trigger the calculation and where to adjust fixed vs. variable percentages. The rest of the system (receipt printing, inventory deduction, nightly reports) should behave exactly as before—no regressions. If tests already exist, please extend them; if not, a couple of PHPUnit assertions around the new logic will do.