Added Stock Ledger to tables and additonal fields for product including type, code and location

This commit is contained in:
johnnyq 2025-08-11 18:19:45 -04:00
parent 1d98eb5160
commit 595e6090c7
4 changed files with 45 additions and 3 deletions

View File

@ -3828,6 +3828,26 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.8'"); mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.8'");
} }
if (CURRENT_DATABASE_VERSION == '2.2.8') {
mysqli_query($mysqli, "ALTER TABLE `products` ADD `product_type` ENUM('service', 'product') NOT NULL DEFAULT 'service' AFTER `product_name`");
mysqli_query($mysqli, "ALTER TABLE `products` ADD `product_code` VARCHAR(200) DEFAULT NULL AFTER `product_description`");
mysqli_query($mysqli, "ALTER TABLE `products` ADD `product_location` VARCHAR(250) DEFAULT NULL AFTER `product_code`");
mysqli_query($mysqli, "CREATE TABLE `product_stock` (
`stock_id` INT(11) NOT NULL AUTO_INCREMENT,
`stock_qty` INT(11) NOT NULL,
`stock_note` TEXT DEFAULT NULL,
`stock_created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP(),
`stock_expense_id` INT(11) DEFAULT NULL,
`stock_item_id` INT(11) DEFAULT NULL,
`stock_product_id` INT(11) NOT NULL,
PRIMARY KEY (`stock_id`)
)");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '2.2.9'");
}
/* 2025-07-21 - JQ For next release Pauyment Provider Switch Over /* 2025-07-21 - JQ For next release Pauyment Provider Switch Over
if (CURRENT_DATABASE_VERSION == '2.2.4') { if (CURRENT_DATABASE_VERSION == '2.2.4') {

24
db.sql
View File

@ -1457,6 +1457,25 @@ CREATE TABLE `payments` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `product_stock`
--
DROP TABLE IF EXISTS `product_stock`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `product_stock` (
`stock_id` int(11) NOT NULL AUTO_INCREMENT,
`stock_qty` int(11) NOT NULL,
`stock_note` text DEFAULT NULL,
`stock_created_at` datetime NOT NULL DEFAULT current_timestamp(),
`stock_expense_id` int(11) DEFAULT NULL,
`stock_item_id` int(11) DEFAULT NULL,
`stock_product_id` int(11) NOT NULL,
PRIMARY KEY (`stock_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Table structure for table `products` -- Table structure for table `products`
-- --
@ -1467,7 +1486,10 @@ DROP TABLE IF EXISTS `products`;
CREATE TABLE `products` ( CREATE TABLE `products` (
`product_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL AUTO_INCREMENT,
`product_name` varchar(200) NOT NULL, `product_name` varchar(200) NOT NULL,
`product_type` enum('service','product') NOT NULL DEFAULT 'service',
`product_description` text DEFAULT NULL, `product_description` text DEFAULT NULL,
`product_code` varchar(200) DEFAULT NULL,
`product_location` varchar(250) DEFAULT NULL,
`product_price` decimal(15,2) NOT NULL, `product_price` decimal(15,2) NOT NULL,
`product_currency_code` varchar(200) NOT NULL, `product_currency_code` varchar(200) NOT NULL,
`product_created_at` datetime NOT NULL DEFAULT current_timestamp(), `product_created_at` datetime NOT NULL DEFAULT current_timestamp(),
@ -2766,4 +2788,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2025-08-05 13:30:24 -- Dump completed on 2025-08-11 18:18:59

View File

@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php * It is used in conjunction with database_updates.php
*/ */
DEFINE("LATEST_DATABASE_VERSION", "2.2.8"); DEFINE("LATEST_DATABASE_VERSION", "2.2.9");

View File

@ -130,7 +130,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="btn-group"> <div class="btn-group">
<a href="?<?php echo $url_query_strings_sort ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>" <a href="?<?php echo $url_query_strings_sort ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if ($archived == 1) { echo "primary"; } else { echo "default"; } ?>"> class="btn btn-<?php if ($archived == 1) { echo "primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive"></i><span class="d-none d-sm-inline ml-2">Archived</span> <i class="fa fa-fw fa-archive mr-2"></i>Archived
</a> </a>
<div class="dropdown ml-2" id="bulkActionButton" hidden> <div class="dropdown ml-2" id="bulkActionButton" hidden>
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">