diff --git a/code/controllers/subsystems/cargo.dm b/code/controllers/subsystems/cargo.dm index 7700404fbb8..b33c37e382d 100644 --- a/code/controllers/subsystems/cargo.dm +++ b/code/controllers/subsystems/cargo.dm @@ -114,41 +114,44 @@ var/datum/controller/subsystem/cargo/SScargo reset_cargo() //Load the categories - var/DBQuery/category_query = dbcon.NewQuery("SELECT name, display_name, description, icon, price_modifier FROM ss13_cargo_categories WHERE deleted_at IS NULL ORDER BY order_by ASC") + var/DBQuery/category_query = dbcon.NewQuery("SELECT id, name, display_name, description, icon, price_modifier FROM ss13_cargo_categories WHERE deleted_at IS NULL ORDER BY order_by ASC") category_query.Execute() while(category_query.NextRow()) CHECK_TICK + var/category_id = category_query.item[1] try add_category( - category_query.item[1], category_query.item[2], category_query.item[3], category_query.item[4], - text2num(category_query.item[5])) + category_query.item[5], + text2num(category_query.item[6])) catch(var/exception/ec) - log_debug("SScargo: Error when loading category: [ec]") + log_debug("SScargo: Error when loading category [category_id] from sql: [ec]") //Load the suppliers - var/DBQuery/supplier_query = dbcon.NewQuery("SELECT short_name, name, description, tag_line, shuttle_time, shuttle_price, available, price_modifier FROM ss13_cargo_suppliers WHERE deleted_at is NULL") + var/DBQuery/supplier_query = dbcon.NewQuery("SELECT id, short_name, name, description, tag_line, shuttle_time, shuttle_price, available, price_modifier FROM ss13_cargo_suppliers WHERE deleted_at is NULL") supplier_query.Execute() while(supplier_query.NextRow()) CHECK_TICK + var/supplier_id = supplier_query.item[1] try add_supplier( - supplier_query.item[1], supplier_query.item[2], supplier_query.item[3], supplier_query.item[4], supplier_query.item[5], supplier_query.item[6], supplier_query.item[7], - supplier_query.item[8]) + supplier_query.item[8], + supplier_query.item[9]) catch(var/exception/es) - log_debug("SScargo: Error when loading supplier: [es]") + log_debug("SScargo: Error when loading supplier [supplier_id] from sql: [es]") //Load the items var/DBQuery/item_query = dbcon.NewQuery("SELECT id, name, supplier, description, categories, price, items, access, container_type, groupable, item_mul FROM ss13_cargo_items WHERE deleted_at IS NULL AND approved_at IS NOT NULL AND supplier IS NOT NULL ORDER BY order_by ASC, name ASC, supplier ASC") item_query.Execute() while(item_query.NextRow()) CHECK_TICK + var/item_id = item_query.item[1] try add_item( item_query.item[1], @@ -163,7 +166,7 @@ var/datum/controller/subsystem/cargo/SScargo item_query.item[10], item_query.item[11]) catch(var/exception/ei) - log_debug("SScargo: Error when loading item from sql: [ei]") + log_debug("SScargo: Error when loading item [item_id] from sql: [ei]") //Loads the cargo data from JSON /datum/controller/subsystem/cargo/proc/load_from_json() diff --git a/code/datums/cargo.dm b/code/datums/cargo.dm index 3d70bcbb88c..279b6000663 100644 --- a/code/datums/cargo.dm +++ b/code/datums/cargo.dm @@ -505,17 +505,46 @@ // Generates the invoice at the time of shipping /datum/cargo_shipment/proc/generate_invoice() var/list/invoice_data = list() - invoice_data += "One day
" - invoice_data += "This will contain the invoice
" - invoice_data += "Right now its just a placeholder
" - invoice_data += "Shipment num: [shipment_num]
" - invoice_data += "shipment cost sell: [shipment_cost_sell]
" - invoice_data += "shipment cost purchse: [shipment_cost_purchase]
" - invoice_data += "shuttle fee: [shuttle_fee]
" - invoice_data += "shuttle time: [shuttle_time]
" - invoice_data += "shuttle called by: [shuttle_called_by]
" - invoice_data += "shuttle recalled by: [shuttle_recalled_by]
" - invoice_data += "centcom message:
[nl2br(message)]" + invoice_data += "

Shipping Invoice

" + + invoice_data += "

Shipment Data

" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "
Shipment Number:[shipment_num]
Shipment Income:[shipment_cost_sell]
Shipment Expense:[shipment_cost_purchase]
" + + invoice_data += "

Shuttle Data

" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "" + invoice_data += "
Shuttle Fee::[shuttle_fee]
Shuttle Time:[shuttle_time]
Shuttle Called By:[shuttle_called_by]
Shuttle Recalled By:[shuttle_recalled_by]
" + + invoice_data += "

Central Command Message:

" + invoice_data += "
[nl2br(message)]
" shipment_invoice = invoice_data.Join("") completed = 1 diff --git a/code/modules/modular_computers/file_system/programs/civilian/cargo_control.dm b/code/modules/modular_computers/file_system/programs/civilian/cargo_control.dm index 09cbecbe683..5c0f568960a 100644 --- a/code/modules/modular_computers/file_system/programs/civilian/cargo_control.dm +++ b/code/modules/modular_computers/file_system/programs/civilian/cargo_control.dm @@ -217,10 +217,19 @@ if(href_list["shipment_print"]) var/datum/cargo_shipment/cs = SScargo.get_shipment_by_id(text2num(href_list["shipment_print"])) if(cs && cs.completed && console && console.nano_printer) - if(!console.nano_printer.print_text(cs.get_invoice(),"Shipment Invoice #[cs.shipment_num]")) + var/obj/item/paper/P = console.nano_printer.print_text(cs.get_invoice(),"Shipment Invoice #[cs.shipment_num]") + if(!P) to_chat(usr,"Hardware error: Printer was unable to print the file. It may be out of paper.") return else + //stamp the paper + var/image/stampoverlay = image('icons/obj/bureaucracy.dmi') + stampoverlay.icon_state = "paper_stamp-cent" + if(!P.stamped) + P.stamped = new + P.stamped += /obj/item/stamp + P.add_overlay(stampoverlay) + P.stamps += "
This paper has been stamped by the Shipping Server." console.visible_message("\The [console] prints out paper.") if(href_list["bounty_print"]) if(console && console.nano_printer) diff --git a/code/modules/modular_computers/hardware/nano_printer.dm b/code/modules/modular_computers/hardware/nano_printer.dm index 860b7fe6289..5f49199b311 100644 --- a/code/modules/modular_computers/hardware/nano_printer.dm +++ b/code/modules/modular_computers/hardware/nano_printer.dm @@ -29,7 +29,7 @@ P.color = paper_color stored_paper-- - return 1 + return P /obj/item/computer_hardware/nano_printer/attackby(obj/item/W as obj, mob/user as mob) if(istype(W, /obj/item/paper)) diff --git a/html/changelogs/arrow768-invoice.yml b/html/changelogs/arrow768-invoice.yml new file mode 100644 index 00000000000..a62ef4f435d --- /dev/null +++ b/html/changelogs/arrow768-invoice.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: Arrow768 + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Updates the Cargo Shipping Invoice for Cargo Oders."