-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from globaldyne/v10.0
V10.0
- Loading branch information
Showing
44 changed files
with
2,828 additions
and
1,125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
9.9 | ||
10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
define('__ROOT__', dirname(dirname(__FILE__))); | ||
|
||
require_once(__ROOT__.'/inc/sec.php'); | ||
require_once(__ROOT__.'/inc/opendb.php'); | ||
require_once(__ROOT__.'/inc/settings.php'); | ||
|
||
$row = $_POST['start'] ?: 0; | ||
$limit = $_POST['length'] ?: 10; | ||
$defBtlSize = $_POST['btlSize'] ?: 100; | ||
|
||
$order_by = $_POST['order_by'] ?: 'name'; | ||
$order = $_POST['order_as'] ?: 'ASC'; | ||
$extra = "ORDER BY ".$order_by." ".$order; | ||
|
||
$s = trim($_POST['search']['value']); | ||
$t = 'inventory_compounds'; | ||
|
||
if($s != ''){ | ||
$f = "WHERE 1 AND (name LIKE '%".$s."%')"; | ||
} | ||
|
||
$q = mysqli_query($conn, "SELECT * FROM $t $f $extra LIMIT $row, $limit"); | ||
while($res = mysqli_fetch_array($q)){ | ||
$rs[] = $res; | ||
} | ||
|
||
|
||
|
||
function calculateBottles($totalVolume, $alcoholPercentage, $defBtlSize) { | ||
$alcoholVolume = $defBtlSize * ($alcoholPercentage / 100); // volume of alcohol in each bottle | ||
$numBottles = floor($totalVolume / $alcoholVolume); // total number of bottles | ||
return $numBottles; | ||
} | ||
|
||
|
||
$pt = mysqli_query($conn, "SELECT id,name,concentration,description FROM perfumeTypes"); | ||
while($rt = mysqli_fetch_array($pt)){ | ||
$types[] = $rt; | ||
} | ||
|
||
$rx = []; | ||
|
||
foreach ($rs as $rq) { | ||
$r['id'] = (int)$rq['id']; | ||
$r['name'] = (string)$rq['name'] ?: 'N/A'; | ||
$r['description'] = (string)$rq['description'] ?: 'N/A'; | ||
$r['batch_id'] = (int)$rq['batch_id']; | ||
$r['size'] = (double)$rq['size'] ?: 0; | ||
$r['updated'] = (string)$rq['updated'] ?: '00:00:00'; | ||
$r['created'] = (string)$rq['created'] ?: '00:00:00'; | ||
$r['label_info'] = (string)$rq['label_info'] ?: '-'; | ||
$r['location'] = (string)$rq['location'] ?: '-'; | ||
$r['owner_id'] = (int)$rq['owner_id'] ?: 0; | ||
$r['btlSize'] = (double)$defBtlSize; | ||
|
||
$rt = []; | ||
foreach ($types as $type) { | ||
$bottleSize = $r['size']; // Bottle size calculated here | ||
$rt[] = [ | ||
'name' => $type['name'], | ||
'concentration' => $type['concentration'], | ||
'bottles_total' => calculateBottles($bottleSize, $type['concentration'], $defBtlSize) | ||
]; | ||
} | ||
|
||
$r['breakDown'] = $rt; | ||
$rx[] = $r; | ||
} | ||
|
||
$total = mysqli_fetch_assoc(mysqli_query($conn,"SELECT COUNT(id) AS entries FROM $t")); | ||
$filtered = mysqli_fetch_assoc(mysqli_query($conn,"SELECT COUNT(id) AS entries FROM $t ".$f)); | ||
|
||
$response = array( | ||
"draw" => (int)$_POST['draw'], | ||
"recordsTotal" => (int)$total['entries'], | ||
"recordsFiltered" => (int)$filtered['entries'], | ||
"data" => $rx | ||
); | ||
|
||
if(empty($r)){ | ||
$response['data'] = []; | ||
} | ||
|
||
header('Content-Type: application/json; charset=utf-8'); | ||
echo json_encode($response); | ||
return; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
9.9 | ||
10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE `inventory_compounds` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `description` TEXT NOT NULL , `batch_id` VARCHAR(255) NOT NULL DEFAULT '-' , `size` DOUBLE NOT NULL DEFAULT '0' , `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `owner_id` INT NOT NULL DEFAULT '0' , `location` VARCHAR(255) NOT NULL , `label_info` TEXT NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB CHARSET=utf8 COLLATE utf8_general_ci; | ||
ALTER TABLE `documents` ADD `isBatch` INT NOT NULL DEFAULT '0' AFTER `docData`; | ||
ALTER TABLE `bottles` ADD `weight` DOUBLE NOT NULL DEFAULT '0' AFTER `supplier`; | ||
ALTER TABLE `customers` ADD `owner_id` INT NOT NULL DEFAULT '0' AFTER `web`, ADD `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL AFTER `owner_id`, ADD `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `updated`; | ||
ALTER TABLE `bottles` ADD `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL AFTER `pieces`, ADD `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `updated`; | ||
ALTER TABLE `formula_history` ADD `ing_id` INT NOT NULL DEFAULT '0' AFTER `fid`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.