Select last ruler based on broad period

1. Added model function
2. Added query calls to add and edit
3. Added ajax call