forked from Business/BinStack
Add item cost and sale price fields
This commit is contained in:
parent
5785f27c8c
commit
ca09f9d346
12
action.php
12
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
|
||||
];
|
||||
|
||||
|
BIN
database.mwb
BIN
database.mwb
Binary file not shown.
8
database_upgrade/v1.1_1.2.sql
Normal file
8
database_upgrade/v1.1_1.2.sql
Normal file
@ -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`;
|
@ -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"
|
||||
]);
|
||||
|
@ -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']];
|
||||
|
@ -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"],
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/* 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/. */
|
||||
@ -29,6 +28,8 @@ $itemdata = [
|
||||
'text3' => '',
|
||||
'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'])) {
|
||||
|
||||
<form role="form" action="action.php" method="POST">
|
||||
<div class="card border-green">
|
||||
<h3 class="card-header text-green">
|
||||
<?php
|
||||
if ($cloning) {
|
||||
?>
|
||||
<i class="fas fa-edit"></i> <?php lang2("cloning item", ['oitem' => htmlspecialchars($itemdata['name']), 'nitem' => "<span id=\"name_title\">" . htmlspecialchars($itemdata['name']) . "</span>"]); ?>
|
||||
<?php
|
||||
} else if ($editing) {
|
||||
?>
|
||||
<i class="fas fa-edit"></i> <?php lang2("editing item", ['item' => "<span id=\"name_title\">" . htmlspecialchars($itemdata['name']) . "</span>"]); ?>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<i class="fas fa-edit"></i> <?php lang("adding item"); ?>
|
||||
<?php
|
||||
}
|
||||
<h3 class="card-header text-green">
|
||||
<?php
|
||||
if ($cloning) {
|
||||
?>
|
||||
</h3>
|
||||
<i class="fas fa-edit"></i> <?php lang2("cloning item", ['oitem' => htmlspecialchars($itemdata['name']), 'nitem' => "<span id=\"name_title\">" . htmlspecialchars($itemdata['name']) . "</span>"]); ?>
|
||||
<?php
|
||||
} else if ($editing) {
|
||||
?>
|
||||
<i class="fas fa-edit"></i> <?php lang2("editing item", ['item' => "<span id=\"name_title\">" . htmlspecialchars($itemdata['name']) . "</span>"]); ?>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<i class="fas fa-edit"></i> <?php lang("adding item"); ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label for="name"><i class="fas fa-cube"></i> <?php lang("name"); ?></label>
|
||||
@ -167,19 +170,34 @@ if (!is_empty($VARS['id'])) {
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-4">
|
||||
<div class="col-12 col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="cost"><i class="far fa-money-bill-alt"></i> <?php lang('item cost'); ?></label>
|
||||
<input type="number" class="form-control" id="cost" name="cost" placeholder="0.00" step="0.01" value="<?php echo $itemdata['cost']; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="price"><i class="fas fa-shopping-cart"></i> <?php lang('sale price'); ?></label>
|
||||
<input type="number" class="form-control" id="price" name="price" placeholder="0.00" step="0.01" value="<?php echo $itemdata['price']; ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="info1"><i class="fas fa-info"></i> <?php lang("description"); ?></label>
|
||||
<textarea class="form-control" id="info1" name="text1"><?php echo htmlspecialchars($itemdata['text1']); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-4">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="info2"><i class="fas fa-sticky-note"></i> <?php lang("notes"); ?></label>
|
||||
<textarea class="form-control" id="info2" name="text2"><?php echo htmlspecialchars($itemdata['text2']); ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-4">
|
||||
<div class="col-12 col-sm-12 col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="info3"><i class="fas fa-comments"></i> <?php lang("comments"); ?></label>
|
||||
<textarea class="form-control" id="info3" name="text3"><?php echo htmlspecialchars($itemdata['text3']); ?></textarea>
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user