Trendsic Platform Service

<back to all web services

CostCalcRequest

Requires Authentication
The following routes are available for this service:
POST/v1/workforce/calc
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

class CostLine implements IConvertible
{
    String? Label;
    String? Detail;
    double? Amount;
    String? RuleId;

    CostLine({this.Label,this.Detail,this.Amount,this.RuleId});
    CostLine.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Label = json['Label'];
        Detail = json['Detail'];
        Amount = JsonConverters.toDouble(json['Amount']);
        RuleId = json['RuleId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Label': Label,
        'Detail': Detail,
        'Amount': Amount,
        'RuleId': RuleId
    };

    getTypeName() => "CostLine";
    TypeContext? context = _ctx;
}

class CostBreakdown implements IConvertible
{
    double? Rrop;
    double? St;
    double? Ot;
    double? Dt;
    double? TotalHours;
    double? Straight;
    double? DiffPay;
    double? OtPremium;
    double? DtPremium;
    double? CashWages;
    double? FringeCashPay;
    double? FringePlanPay;
    double? BurdenPct;
    double? BurdenAmount;
    bool? PerDiemApplies;
    double? PerDiemCost;
    double? PerDiemTaxable;
    double? PerDiemNonTax;
    double? Loaded;
    double? Revenue;
    double? Margin;
    double? MarginPct;
    double? OtMultiplier;
    double? DtMultiplier;
    double? PerDiemDaily;
    List<CostLine>? Lines = [];
    List<String>? Notes = [];

    CostBreakdown({this.Rrop,this.St,this.Ot,this.Dt,this.TotalHours,this.Straight,this.DiffPay,this.OtPremium,this.DtPremium,this.CashWages,this.FringeCashPay,this.FringePlanPay,this.BurdenPct,this.BurdenAmount,this.PerDiemApplies,this.PerDiemCost,this.PerDiemTaxable,this.PerDiemNonTax,this.Loaded,this.Revenue,this.Margin,this.MarginPct,this.OtMultiplier,this.DtMultiplier,this.PerDiemDaily,this.Lines,this.Notes});
    CostBreakdown.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Rrop = JsonConverters.toDouble(json['Rrop']);
        St = JsonConverters.toDouble(json['St']);
        Ot = JsonConverters.toDouble(json['Ot']);
        Dt = JsonConverters.toDouble(json['Dt']);
        TotalHours = JsonConverters.toDouble(json['TotalHours']);
        Straight = JsonConverters.toDouble(json['Straight']);
        DiffPay = JsonConverters.toDouble(json['DiffPay']);
        OtPremium = JsonConverters.toDouble(json['OtPremium']);
        DtPremium = JsonConverters.toDouble(json['DtPremium']);
        CashWages = JsonConverters.toDouble(json['CashWages']);
        FringeCashPay = JsonConverters.toDouble(json['FringeCashPay']);
        FringePlanPay = JsonConverters.toDouble(json['FringePlanPay']);
        BurdenPct = JsonConverters.toDouble(json['BurdenPct']);
        BurdenAmount = JsonConverters.toDouble(json['BurdenAmount']);
        PerDiemApplies = json['PerDiemApplies'];
        PerDiemCost = JsonConverters.toDouble(json['PerDiemCost']);
        PerDiemTaxable = JsonConverters.toDouble(json['PerDiemTaxable']);
        PerDiemNonTax = JsonConverters.toDouble(json['PerDiemNonTax']);
        Loaded = JsonConverters.toDouble(json['Loaded']);
        Revenue = JsonConverters.toDouble(json['Revenue']);
        Margin = JsonConverters.toDouble(json['Margin']);
        MarginPct = JsonConverters.toDouble(json['MarginPct']);
        OtMultiplier = JsonConverters.toDouble(json['OtMultiplier']);
        DtMultiplier = JsonConverters.toDouble(json['DtMultiplier']);
        PerDiemDaily = JsonConverters.toDouble(json['PerDiemDaily']);
        Lines = JsonConverters.fromJson(json['Lines'],'List<CostLine>',context!);
        Notes = JsonConverters.fromJson(json['Notes'],'List<String>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Rrop': Rrop,
        'St': St,
        'Ot': Ot,
        'Dt': Dt,
        'TotalHours': TotalHours,
        'Straight': Straight,
        'DiffPay': DiffPay,
        'OtPremium': OtPremium,
        'DtPremium': DtPremium,
        'CashWages': CashWages,
        'FringeCashPay': FringeCashPay,
        'FringePlanPay': FringePlanPay,
        'BurdenPct': BurdenPct,
        'BurdenAmount': BurdenAmount,
        'PerDiemApplies': PerDiemApplies,
        'PerDiemCost': PerDiemCost,
        'PerDiemTaxable': PerDiemTaxable,
        'PerDiemNonTax': PerDiemNonTax,
        'Loaded': Loaded,
        'Revenue': Revenue,
        'Margin': Margin,
        'MarginPct': MarginPct,
        'OtMultiplier': OtMultiplier,
        'DtMultiplier': DtMultiplier,
        'PerDiemDaily': PerDiemDaily,
        'Lines': JsonConverters.toJson(Lines,'List<CostLine>',context!),
        'Notes': JsonConverters.toJson(Notes,'List<String>',context!)
    };

    getTypeName() => "CostBreakdown";
    TypeContext? context = _ctx;
}

class CostInput implements IConvertible
{
    double? Base;
    double? BillRate;
    double? FringeCash;
    double? FringePlan;
    bool? IsNight;
    double? HoursPerDay;
    int? OnDays;
    double? OnDaysExact;
    bool? HasTravel;
    bool? PerDiemEligible;
    bool? PrevailingWage;
    String? Jurisdiction;
    String? Unit;
    double? PriorHours;
    String? BurdenClass;
    double? WcRateOverride;

    CostInput({this.Base,this.BillRate,this.FringeCash,this.FringePlan,this.IsNight,this.HoursPerDay,this.OnDays,this.OnDaysExact,this.HasTravel,this.PerDiemEligible,this.PrevailingWage,this.Jurisdiction,this.Unit,this.PriorHours,this.BurdenClass,this.WcRateOverride});
    CostInput.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Base = JsonConverters.toDouble(json['Base']);
        BillRate = JsonConverters.toDouble(json['BillRate']);
        FringeCash = JsonConverters.toDouble(json['FringeCash']);
        FringePlan = JsonConverters.toDouble(json['FringePlan']);
        IsNight = json['IsNight'];
        HoursPerDay = JsonConverters.toDouble(json['HoursPerDay']);
        OnDays = json['OnDays'];
        OnDaysExact = JsonConverters.toDouble(json['OnDaysExact']);
        HasTravel = json['HasTravel'];
        PerDiemEligible = json['PerDiemEligible'];
        PrevailingWage = json['PrevailingWage'];
        Jurisdiction = json['Jurisdiction'];
        Unit = json['Unit'];
        PriorHours = JsonConverters.toDouble(json['PriorHours']);
        BurdenClass = json['BurdenClass'];
        WcRateOverride = JsonConverters.toDouble(json['WcRateOverride']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Base': Base,
        'BillRate': BillRate,
        'FringeCash': FringeCash,
        'FringePlan': FringePlan,
        'IsNight': IsNight,
        'HoursPerDay': HoursPerDay,
        'OnDays': OnDays,
        'OnDaysExact': OnDaysExact,
        'HasTravel': HasTravel,
        'PerDiemEligible': PerDiemEligible,
        'PrevailingWage': PrevailingWage,
        'Jurisdiction': Jurisdiction,
        'Unit': Unit,
        'PriorHours': PriorHours,
        'BurdenClass': BurdenClass,
        'WcRateOverride': WcRateOverride
    };

    getTypeName() => "CostInput";
    TypeContext? context = _ctx;
}

class CostCalcResponse implements IConvertible
{
    CostBreakdown? Result;
    CostInput? ResolvedInput;
    bool? CanSeePay;
    ResponseStatus? ResponseStatus;

    CostCalcResponse({this.Result,this.ResolvedInput,this.CanSeePay,this.ResponseStatus});
    CostCalcResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Result = JsonConverters.fromJson(json['Result'],'CostBreakdown',context!);
        ResolvedInput = JsonConverters.fromJson(json['ResolvedInput'],'CostInput',context!);
        CanSeePay = json['CanSeePay'];
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Result': JsonConverters.toJson(Result,'CostBreakdown',context!),
        'ResolvedInput': JsonConverters.toJson(ResolvedInput,'CostInput',context!),
        'CanSeePay': CanSeePay,
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

    getTypeName() => "CostCalcResponse";
    TypeContext? context = _ctx;
}

class CostCalcRequest implements IConvertible
{
    CostInput? Input;
    int? ContactID;
    int? ProjectID;
    int? ShiftPatternID;
    String? Unit;

    CostCalcRequest({this.Input,this.ContactID,this.ProjectID,this.ShiftPatternID,this.Unit});
    CostCalcRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Input = JsonConverters.fromJson(json['Input'],'CostInput',context!);
        ContactID = json['ContactID'];
        ProjectID = json['ProjectID'];
        ShiftPatternID = json['ShiftPatternID'];
        Unit = json['Unit'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Input': JsonConverters.toJson(Input,'CostInput',context!),
        'ContactID': ContactID,
        'ProjectID': ProjectID,
        'ShiftPatternID': ShiftPatternID,
        'Unit': Unit
    };

    getTypeName() => "CostCalcRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
    'CostLine': TypeInfo(TypeOf.Class, create:() => CostLine()),
    'CostBreakdown': TypeInfo(TypeOf.Class, create:() => CostBreakdown()),
    'List<CostLine>': TypeInfo(TypeOf.Class, create:() => <CostLine>[]),
    'CostInput': TypeInfo(TypeOf.Class, create:() => CostInput()),
    'CostCalcResponse': TypeInfo(TypeOf.Class, create:() => CostCalcResponse()),
    'CostCalcRequest': TypeInfo(TypeOf.Class, create:() => CostCalcRequest()),
});

Dart CostCalcRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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: application/json
Content-Type: application/json
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: application/json
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"}}}