This commit is contained in:
2022-07-08 18:48:02 +00:00
parent 25d785ba38
commit bb231437d0
3 changed files with 83 additions and 1 deletions

View File

@@ -98,7 +98,7 @@ namespace AyaNova.Api.Controllers
return Ok(ApiOkResponse.Response(o));
}
/// <summary>
/// <summary>
/// Get Customer view of WorkOrder
/// </summary>
/// <param name="id"></param>
@@ -202,6 +202,26 @@ namespace AyaNova.Api.Controllers
}
/// <summary>
/// Get list of billable work orders for accounting integrations
/// </summary>
/// <param name="workOrderStatusId">Only work orders set to this status (use 0 to ignore status)</param>
/// <returns>List of billable workorders with related data</returns>
[HttpGet("accounting-list-billable/{workOrderStatusId}")]
public async Task<IActionResult> GetAccountingListBillable([FromRoute] long workOrderStatusId)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
var o = await biz.GetAccountingListBillable(workOrderStatusId);
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
return Ok(ApiOkResponse.Response(o));
}
#endregion WorkOrderTopLevel routes