(in-package #:accountancy-implementation) ;;; if negative it is an expense, if positive it is income (define-protocol-class money-flow () ()) (defgeneric from (money-flow)) (defgeneric to (money-flow)) (defgeneric amount (money-flow)) (defgeneric currency (money-flow)) (defgeneric date-time (money-flow)) (defgeneric description (money-flow)) ;;; The transaction that resulted into this money-flow ;;; it can be the attendance of an employee for example. ;;; or an invoice (when the company purchases stuff for example) (defgeneric transaction (money-flow)) ;;; for the time being pretend all is cash, don't use credit-flow. ;;; just use money-flow for now (define-protocol-class cash-flow (money-flow) ()) (define-protocol-class credit-flow (money-flow) ()) (define-protocol-class business-entity () ()) ;;; The incomes (defgeneric income-register (business-entity)) (defgeneric expense-register (business-entity)) (define-protocol-class company (business-entity) ()) (defgeneric name (company)) (defgeneric departments (company) #.many-to-one) (define-protocol-class employee (business-entity) ()) (defgeneric first-name (employee)) (defgeneric middle-names (employee)) (defgeneric last-name (employee)) (defgeneric nicknames (employee)) (defgeneric company (employee)) ;;; Leaders,Workers,Accountants,IT department,etc ;;; IT department has subdivisions: programmers,testers,etc (define-protocol-class department (#+c one-parent-many-children-mixin) ()) (defgeneric name (department)) (defgeneric parent-department (department)) (defgeneric sub-departments (department) #.many-to-one) ;;; Get the projects (defgeneric projects (department) #.many-to-one) ;;; A department contains projects ;;; For example the Workers department has Worksite1 etc (define-protocol-class project () ()) ;;; The name of the project (defgeneric name (project)) ;;; The department it belongs to (defgeneric department (project)) ;;; It contains the records of the presence, ;;; absence, sick leave, late comings, holidays ;;; job training, and all kinds of leaves used ;;; to calculate the salary. (defgeneric attendance-register (project) #.many-to-one) ;;; The default salary of employee in project (defgeneric default-salary (project employee)) ; perhaps add a period parameter which can be :day , :hour, :month etc (defgeneric (setf default-salary) (new-salary project employee)) (define-protocol-class attendance () ()) ;;; (defgeneric project (attendance)) ;;; (defgeneric employee (attendance)) (defgeneric interval-start (attendance)) (defgeneric interval-end (attendance)) ;;; salary for that day (defgeneric money-flow (attendance)) ;;; (defgeneric attend (project employees interval-start &key interval-end salary))