diff --git a/action.php b/action.php index 33ddd94..561d2a0 100644 --- a/action.php +++ b/action.php @@ -79,6 +79,16 @@ switch ($VARS['action']) { } else if (!is_numeric($VARS['want'])) { returnToSender('field_nan'); } + if (is_empty($VARS['cost'])) { + $VARS['cost'] = null; + } else if (!is_numeric($VARS['cost'])) { + returnToSender('field_nan'); + } + if (is_empty($VARS['price'])) { + $VARS['price'] = null; + } else if (!is_numeric($VARS['price'])) { + returnToSender('field_nan'); + } if (!$database->has('categories', ['catid' => $VARS['cat']])) { returnToSender('invalid_category'); } @@ -103,6 +113,8 @@ switch ($VARS['action']) { 'locid' => $VARS['loc'], 'qty' => $VARS['qty'], 'want' => $VARS['want'], + 'cost' => $VARS['cost'], + 'price' => $VARS['price'], 'userid' => $userid ]; diff --git a/database.mwb b/database.mwb index 1496b94..32dbc7a 100644 Binary files a/database.mwb and b/database.mwb differ diff --git a/database_upgrade/v1.1_1.2.sql b/database_upgrade/v1.1_1.2.sql new file mode 100644 index 0000000..8374119 --- /dev/null +++ b/database_upgrade/v1.1_1.2.sql @@ -0,0 +1,8 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +ALTER TABLE `items` +ADD COLUMN `cost` DECIMAL(10,2) NULL DEFAULT NULL AFTER `userid`, +ADD COLUMN `price` DECIMAL(10,2) NULL DEFAULT NULL AFTER `cost`; diff --git a/lang/en_us.php b/lang/en_us.php index 554e1ea..f158bff 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -106,5 +106,9 @@ define("STRINGS", [ "ods file" => "ODS spreadsheet", "html file" => "HTML web page", "itemid" => "Item ID", - "id" => "ID" + "id" => "ID", + "item cost" => "Item cost", + "sale price" => "Sale price", + "cost" => "Cost", + "price" => "Price" ]); diff --git a/lib/getitemtable.php b/lib/getitemtable.php index 9a45d52..16d175b 100644 --- a/lib/getitemtable.php +++ b/lib/getitemtable.php @@ -70,7 +70,9 @@ if (!is_empty($VARS['search']['value'])) { "catname[~]" => $VARS['search']['value'], "locname[~]" => $VARS['search']['value'], "code1[~]" => $VARS['search']['value'], - "code2[~]" => $VARS['search']['value'] + "code2[~]" => $VARS['search']['value'], + "cost[~]" => $VARS['search']['value'], + "price[~]" => $VARS['search']['value'], ]; $where = $wherenolimit; $where["LIMIT"] = [$VARS['start'], $VARS['length']]; diff --git a/lib/reports.php b/lib/reports.php index caf2984..b5b759d 100644 --- a/lib/reports.php +++ b/lib/reports.php @@ -71,7 +71,9 @@ function getItemReport($filter = []) { "userid", "text1", "text2", - "text3" + "text3", + "cost", + "price" ], $filter ); $header = [ @@ -83,6 +85,8 @@ function getItemReport($filter = []) { lang("code 2", false), lang("quantity", false), lang("want", false), + lang("cost", false), + lang("price", false), lang("assigned to", false), lang("description", false), lang("notes", false), @@ -105,6 +109,8 @@ function getItemReport($filter = []) { $items[$i]["code2"], $items[$i]["qty"], $items[$i]["want"], + $items[$i]["cost"], + $items[$i]["price"], $user, $items[$i]["text1"], $items[$i]["text2"], diff --git a/pages/edititem.php b/pages/edititem.php index 3c48837..01e0547 100644 --- a/pages/edititem.php +++ b/pages/edititem.php @@ -1,5 +1,4 @@ '', 'qty' => 1, 'want' => 0, + 'cost' => 0.0, + 'price' => 0.0, 'userid' => '']; $editing = false; @@ -62,6 +63,8 @@ if (!is_empty($VARS['id'])) { 'loccode', 'qty', 'want', + 'cost', + 'price', 'userid' ], [ 'itemid' => $VARS['id'] @@ -76,23 +79,23 @@ if (!is_empty($VARS['id'])) {
-

+

+ + htmlspecialchars($itemdata['name']), 'nitem' => "" . htmlspecialchars($itemdata['name']) . ""]); ?> + + "" . htmlspecialchars($itemdata['name']) . ""]); ?> - htmlspecialchars($itemdata['name']), 'nitem' => "" . htmlspecialchars($itemdata['name']) . ""]); ?> - - "" . htmlspecialchars($itemdata['name']) . ""]); ?> - - - -

+ + +
@@ -167,19 +170,34 @@ if (!is_empty($VARS['id'])) {
-
+
+
+ + +
+
+
+
+ + +
+
+
-
+
+ +
+
-
+
diff --git a/static/css/index.css b/static/css/index.css index 66859ef..81e0ba0 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -1,3 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + .banner-image { max-height: 100px; margin: 2em auto;