| POST | /v1/workforce/calc |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CostLine:
label: Optional[str] = None
detail: Optional[str] = None
amount: Decimal = decimal.Decimal(0)
rule_id: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CostBreakdown:
rrop: Decimal = decimal.Decimal(0)
st: Decimal = decimal.Decimal(0)
ot: Decimal = decimal.Decimal(0)
dt: Decimal = decimal.Decimal(0)
total_hours: Decimal = decimal.Decimal(0)
straight: Decimal = decimal.Decimal(0)
diff_pay: Decimal = decimal.Decimal(0)
ot_premium: Decimal = decimal.Decimal(0)
dt_premium: Decimal = decimal.Decimal(0)
cash_wages: Decimal = decimal.Decimal(0)
fringe_cash_pay: Decimal = decimal.Decimal(0)
fringe_plan_pay: Decimal = decimal.Decimal(0)
burden_pct: Decimal = decimal.Decimal(0)
burden_amount: Decimal = decimal.Decimal(0)
per_diem_applies: bool = False
per_diem_cost: Decimal = decimal.Decimal(0)
per_diem_taxable: Decimal = decimal.Decimal(0)
per_diem_non_tax: Decimal = decimal.Decimal(0)
loaded: Decimal = decimal.Decimal(0)
revenue: Decimal = decimal.Decimal(0)
margin: Decimal = decimal.Decimal(0)
margin_pct: Decimal = decimal.Decimal(0)
ot_multiplier: Decimal = decimal.Decimal(0)
dt_multiplier: Decimal = decimal.Decimal(0)
per_diem_daily: Decimal = decimal.Decimal(0)
lines: List[CostLine] = field(default_factory=list)
notes: List[str] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CostInput:
base: Decimal = decimal.Decimal(0)
bill_rate: Decimal = decimal.Decimal(0)
fringe_cash: Decimal = decimal.Decimal(0)
fringe_plan: Decimal = decimal.Decimal(0)
is_night: bool = False
hours_per_day: Decimal = decimal.Decimal(0)
on_days: int = 0
on_days_exact: Optional[Decimal] = None
has_travel: bool = False
per_diem_eligible: bool = False
prevailing_wage: bool = False
jurisdiction: Optional[str] = None
unit: Optional[str] = None
prior_hours: Decimal = decimal.Decimal(0)
burden_class: Optional[str] = None
wc_rate_override: Optional[Decimal] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CostCalcResponse:
result: Optional[CostBreakdown] = None
resolved_input: Optional[CostInput] = None
can_see_pay: bool = False
response_status: Optional[ResponseStatus] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CostCalcRequest:
input: Optional[CostInput] = None
contact_i_d: Optional[int] = None
project_i_d: Optional[int] = None
shift_pattern_i_d: Optional[int] = None
unit: Optional[str] = None
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/workforce/calc HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Input:
{
Base: 0,
BillRate: 0,
FringeCash: 0,
FringePlan: 0,
IsNight: False,
HoursPerDay: 0,
OnDays: 0,
OnDaysExact: 0,
HasTravel: False,
PerDiemEligible: False,
PrevailingWage: False,
Jurisdiction: String,
Unit: String,
PriorHours: 0,
BurdenClass: String,
WcRateOverride: 0
},
ContactID: 0,
ProjectID: 0,
ShiftPatternID: 0,
Unit: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Result:
{
Rrop: 0,
St: 0,
Ot: 0,
Dt: 0,
TotalHours: 0,
Straight: 0,
DiffPay: 0,
OtPremium: 0,
DtPremium: 0,
CashWages: 0,
FringeCashPay: 0,
FringePlanPay: 0,
BurdenPct: 0,
BurdenAmount: 0,
PerDiemApplies: False,
PerDiemCost: 0,
PerDiemTaxable: 0,
PerDiemNonTax: 0,
Loaded: 0,
Revenue: 0,
Margin: 0,
MarginPct: 0,
OtMultiplier: 0,
DtMultiplier: 0,
PerDiemDaily: 0,
Lines:
[
{
Label: String,
Detail: String,
Amount: 0,
RuleId: String
}
],
Notes:
[
String
]
},
ResolvedInput:
{
Base: 0,
BillRate: 0,
FringeCash: 0,
FringePlan: 0,
IsNight: False,
HoursPerDay: 0,
OnDays: 0,
OnDaysExact: 0,
HasTravel: False,
PerDiemEligible: False,
PrevailingWage: False,
Jurisdiction: String,
Unit: String,
PriorHours: 0,
BurdenClass: String,
WcRateOverride: 0
},
CanSeePay: False,
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}