mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-26 22:42:26 +01:00
Cargo Order Logging (#9797)
This commit is contained in:
+32
-13
@@ -111,11 +111,15 @@
|
||||
var/status = "basket" //Status of the order: basket - Adding items, submitted - Submitted to cargo, approved - Order sent to suppliers, rejected - Order has been denied, shipped - Has been shipped to the station, delivered - Order has been delivered
|
||||
var/container_type = "" //Type of the container for the order - cate, box
|
||||
var/list/required_access = list() //Access required to unlock the crate
|
||||
var/can_add_items = 1 //If new items can be added to the order
|
||||
var/can_add_items = 1 //If new items can be added to the order
|
||||
var/ordered_by = null //Person that ordered the items
|
||||
var/ordered_by_id = null //Character ID of the person that ordered the items
|
||||
var/authorized_by = null //Person that authorized the order
|
||||
var/authorized_by_id = null //Character ID of the person that authorized the items
|
||||
var/received_by = null //Person the order has been delivered to by cargo
|
||||
var/received_by_id = null //Character ID of the person that received the items
|
||||
var/paid_by = null //Person that has paid for the order
|
||||
var/paid_by_id = null //Character ID of the Person that paid for the items
|
||||
var/time_submitted = null //Time the order has been sent to cargo
|
||||
var/time_approved = null //Time the order has been approved by cargo
|
||||
var/time_shipped = null //Time the order has been shipped to the station
|
||||
@@ -181,7 +185,7 @@
|
||||
container_type = coi.ci.container_type
|
||||
else if (container_type != coi.ci.container_type)
|
||||
return "Unable to add item - Different container required" //You can only add items with the same container type to the order
|
||||
|
||||
|
||||
//Check if more items can be added to the order
|
||||
if(!can_add_items)
|
||||
return "Unable to add item - Order can not contain more items"
|
||||
@@ -227,7 +231,7 @@
|
||||
return "Unable to remove item - Internal Error 608"
|
||||
|
||||
// Returns the value of the order
|
||||
/datum/cargo_order/proc/get_value(var/type=0)
|
||||
/datum/cargo_order/proc/get_value(var/type=0)
|
||||
//Type specifies if the price cargo has to pay or the price the customer has to be should be returned
|
||||
// 0 - Price the customer has to pay
|
||||
// 1 - Price cargo has to pay
|
||||
@@ -389,11 +393,17 @@
|
||||
for(var/object in get_object_list())
|
||||
order_data += "<li>[object]</li>"
|
||||
order_data += "</ul>"
|
||||
|
||||
|
||||
return order_data.Join("")
|
||||
|
||||
//Marks a order as submitted
|
||||
/datum/cargo_order/proc/set_submitted(var/oid)
|
||||
/datum/cargo_order/proc/set_submitted(var/user_name, var/user_id, var/order_reason)
|
||||
if(user_id <= 0)
|
||||
user_id = null
|
||||
|
||||
ordered_by = user_name
|
||||
ordered_by_id = user_id
|
||||
reason = order_reason
|
||||
status = "submitted"
|
||||
time_submitted = worldtime2text()
|
||||
order_id = SScargo.get_next_order_id()
|
||||
@@ -401,11 +411,14 @@
|
||||
return 1
|
||||
|
||||
//Marks a order as approved - Returns a status message
|
||||
/datum/cargo_order/proc/set_approved(var/approved_by)
|
||||
/datum/cargo_order/proc/set_approved(var/user_name, var/user_id)
|
||||
if(user_id <= 0)
|
||||
user_id = null
|
||||
if(status == "submitted")
|
||||
status = "approved"
|
||||
time_approved = worldtime2text()
|
||||
authorized_by = approved_by
|
||||
authorized_by = user_name
|
||||
authorized_by_id = user_id
|
||||
return "The order has been approved"
|
||||
else
|
||||
return "The order could not be approved - Invalid Status"
|
||||
@@ -425,21 +438,27 @@
|
||||
time_shipped = worldtime2text()
|
||||
|
||||
//Marks a order as delivered - Returns a status message
|
||||
/datum/cargo_order/proc/set_delivered(var/customer_name, var/paid=0)
|
||||
/datum/cargo_order/proc/set_delivered(var/user_name, var/user_id, var/paid=0)
|
||||
if(user_id <= 0)
|
||||
user_id = null
|
||||
if(status == "shipped")
|
||||
status = "delivered"
|
||||
time_delivered = worldtime2text()
|
||||
received_by = customer_name
|
||||
received_by = user_name
|
||||
received_by_id = user_id
|
||||
if(paid)
|
||||
set_paid(customer_name)
|
||||
set_paid(user_name, user_id)
|
||||
return "The order has been delivered"
|
||||
else
|
||||
return "The order could not be delivered - Invalid Status"
|
||||
|
||||
//Mark a order as paid
|
||||
/datum/cargo_order/proc/set_paid(var/customer_name)
|
||||
/datum/cargo_order/proc/set_paid(var/user_name, var/user_id)
|
||||
if(user_id <= 0)
|
||||
user_id = null
|
||||
time_paid = worldtime2text()
|
||||
paid_by = customer_name
|
||||
paid_by = user_name
|
||||
paid_by_id = user_id
|
||||
return "The order has been paid for"
|
||||
|
||||
/*
|
||||
@@ -559,4 +578,4 @@
|
||||
generate_invoice()
|
||||
else
|
||||
return "Invoice Unavailable. Shipment not completed."
|
||||
return shipment_invoice
|
||||
return shipment_invoice
|
||||
|
||||
Reference in New Issue
Block a user