Fix getDetails customer info
This commit is contained in:
parent
407f68655e
commit
14c9336025
1 changed files with 18 additions and 1 deletions
|
|
@ -47,6 +47,7 @@
|
|||
t.ServicePointID AS TaskServicePointID,
|
||||
tc.Name AS CategoryName,
|
||||
tc.Color AS CategoryColor,
|
||||
tt.Name AS TaskTypeName,
|
||||
o.ID AS OID,
|
||||
o.UUID AS OrderUUID,
|
||||
o.UserID AS OrderUserID,
|
||||
|
|
@ -55,6 +56,9 @@
|
|||
o.ServicePointID AS OrderServicePointID,
|
||||
o.Remarks,
|
||||
o.SubmittedOn,
|
||||
o.TipAmount,
|
||||
o.DeliveryFee,
|
||||
b.TaxRate,
|
||||
COALESCE(sp.Name, tsp.Name) AS ServicePointName,
|
||||
COALESCE(sp.TypeID, tsp.TypeID) AS ServicePointTypeID,
|
||||
COALESCE(sp.ID, tsp.ID) AS ServicePointID,
|
||||
|
|
@ -65,10 +69,12 @@
|
|||
u.ImageExtension AS CustomerImageExtension
|
||||
FROM Tasks t
|
||||
LEFT JOIN TaskCategories tc ON tc.ID = t.CategoryID
|
||||
LEFT JOIN tt_TaskTypes tt ON tt.ID = t.TaskTypeID
|
||||
LEFT JOIN Orders o ON o.ID = t.OrderID
|
||||
LEFT JOIN Businesses b ON b.ID = t.BusinessID
|
||||
LEFT JOIN ServicePoints sp ON sp.ID = o.ServicePointID
|
||||
LEFT JOIN ServicePoints tsp ON tsp.ID = t.ServicePointID
|
||||
LEFT JOIN Users u ON u.ID = o.UserID
|
||||
LEFT JOIN Users u ON u.ID = COALESCE(t.UserID, o.UserID)
|
||||
WHERE t.ID = ?
|
||||
", [ { value = TaskID, cfsqltype = "cf_sql_integer" } ], { datasource = "payfrit" })>
|
||||
|
||||
|
|
@ -103,6 +109,7 @@
|
|||
"TaskBusinessID": qTask.BusinessID,
|
||||
"TaskCategoryID": qTask.CategoryID,
|
||||
"TaskTypeID": qTask.TaskTypeID ?: 1,
|
||||
"TaskTypeName": qTask.TaskTypeName ?: "",
|
||||
"TaskTitle": taskTitle,
|
||||
"TaskCreatedOn": dateFormat(qTask.CreatedOn, "yyyy-mm-dd") & "T" & timeFormat(qTask.CreatedOn, "HH:mm:ss"),
|
||||
"TaskStatusID": qTask.ClaimedByUserID GT 0 ? 1 : 0,
|
||||
|
|
@ -111,6 +118,7 @@
|
|||
"OrderID": qTask.OrderID ?: 0,
|
||||
"OrderRemarks": qTask.Remarks ?: "",
|
||||
"OrderSubmittedOn": isDate(qTask.SubmittedOn) ? (dateFormat(qTask.SubmittedOn, "yyyy-mm-dd") & "T" & timeFormat(qTask.SubmittedOn, "HH:mm:ss")) : "",
|
||||
"OrderTotal": 0,
|
||||
"ServicePointID": qTask.ServicePointID ?: 0,
|
||||
"ServicePointName": qTask.ServicePointName ?: "",
|
||||
"ServicePointTypeID": qTask.ServicePointTypeID ?: 0,
|
||||
|
|
@ -164,7 +172,9 @@
|
|||
ORDER BY oli.ID
|
||||
", [ { value = qTask.OrderID, cfsqltype = "cf_sql_integer" } ], { datasource = "payfrit" })>
|
||||
|
||||
<cfset subtotal = 0>
|
||||
<cfloop query="qLineItems">
|
||||
<cfset subtotal = subtotal + (qLineItems.LineItemPrice * qLineItems.Quantity)>
|
||||
<cfset arrayAppend(result.LineItems, {
|
||||
"LineItemID": qLineItems.OrderLineItemID,
|
||||
"ParentLineItemID": qLineItems.ParentOrderLineItemID,
|
||||
|
|
@ -176,6 +186,13 @@
|
|||
"IsModifier": qLineItems.ParentOrderLineItemID GT 0
|
||||
})>
|
||||
</cfloop>
|
||||
|
||||
<!--- Calculate order total: subtotal + tax + tip + delivery (if delivery) + platform fee --->
|
||||
<cfset taxAmount = subtotal * val(qTask.TaxRate)>
|
||||
<cfset tipAmount = val(qTask.TipAmount)>
|
||||
<cfset deliveryFee = (val(qTask.OrderTypeID) EQ 3) ? val(qTask.DeliveryFee) : 0>
|
||||
<cfset platformFee = subtotal * 0.05>
|
||||
<cfset result.OrderTotal = numberFormat(subtotal + taxAmount + tipAmount + deliveryFee + platformFee, "0.00")>
|
||||
</cfif>
|
||||
|
||||
<cfset apiAbort({
|
||||
|
|
|
|||
Reference in a new issue