2023-05-02 16:49:52 +02:00
|
|
|
import macros
|
|
|
|
import nimpy
|
|
|
|
|
|
|
|
macro eval(value: static[string]): untyped =
|
|
|
|
result = parseStmt value
|
|
|
|
|
|
|
|
# let e: int = 5
|
|
|
|
# echo eval("1 + e")
|
|
|
|
|
2023-05-10 18:45:07 +02:00
|
|
|
# type Contract = object
|
|
|
|
# employee: int
|
|
|
|
# start_date: string
|
|
|
|
# end_date: string
|
|
|
|
# salary: float
|
2023-05-02 16:49:52 +02:00
|
|
|
|
|
|
|
# type
|
|
|
|
# WageType = tuple[id: int, name: string]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
WageType = object
|
|
|
|
id: int
|
|
|
|
name: string
|
|
|
|
sequence: int
|
|
|
|
definition: string
|
|
|
|
# unit_price_formula: void
|
|
|
|
# expense_formula: void
|
|
|
|
# salary_constitute: bool
|
|
|
|
# uom: int
|
|
|
|
# type_concept: string
|
|
|
|
# concepts_salary: @[]
|
|
|
|
# adjust_days_worked: bool
|
|
|
|
|
2023-05-10 18:45:07 +02:00
|
|
|
# type Payroll = object
|
|
|
|
# employee: int
|
|
|
|
# start_date: string
|
|
|
|
# end_date: string
|
2023-05-02 16:49:52 +02:00
|
|
|
# salary: float
|
|
|
|
# lines: @[PayrollLine]
|
|
|
|
|
|
|
|
|
|
|
|
# proc computePayroll(wages: seq[WageType]): int {.exportpy.} =
|
|
|
|
|
|
|
|
proc computePayroll(wages: seq[WageType]): string {.exportpy.} =
|
|
|
|
# echo wage.name
|
2023-05-10 18:45:07 +02:00
|
|
|
for waget in wages:
|
|
|
|
echo waget.name
|
|
|
|
echo waget.sequence
|
2023-05-02 16:49:52 +02:00
|
|
|
# var mat = Payroll(
|
|
|
|
# employee: 456,
|
|
|
|
# start_date: "2023-01-01",
|
|
|
|
# end_date: "2023-01-31"
|
|
|
|
# )
|
2023-05-10 18:45:07 +02:00
|
|
|
# let mat: string = wage.name
|
|
|
|
# return mat
|