mirror of
https://github.com/grocy/grocy.git
synced 2026-04-04 11:56:16 +02:00
More suggestion edits
- locale in javascript - global translations - commit migrations sql file
This commit is contained in:
parent
685d99956c
commit
17fbcf77cb
|
|
@ -539,7 +539,9 @@ class StockController extends BaseController
|
||||||
GROUP BY product_group
|
GROUP BY product_group
|
||||||
ORDER BY product_group
|
ORDER BY product_group
|
||||||
";
|
";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (isset($request->getQueryParams()['product_group']) AND $request->getQueryParams()['product_group'] != 'all')
|
if (isset($request->getQueryParams()['product_group']) AND $request->getQueryParams()['product_group'] != 'all')
|
||||||
{
|
{
|
||||||
$where = $where . ' AND product_group_id = ' . $request->getQueryParams()['product_group'];
|
$where = $where . ' AND product_group_id = ' . $request->getQueryParams()['product_group'];
|
||||||
|
|
|
||||||
|
|
@ -2386,3 +2386,33 @@ msgstr ""
|
||||||
|
|
||||||
msgid "Total"
|
msgid "Total"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Apply"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Custom Range"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Yesterday"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Last 7 Days"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Last 14 Days"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Last 30 Days"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "This Month"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Last Month"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "This Year"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Last Year"
|
||||||
|
msgstr ""
|
||||||
|
|
|
||||||
24
migrations/0215.sql
Normal file
24
migrations/0215.sql
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
CREATE VIEW product_purchase_history
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
1 AS id, -- Dummy, LessQL needs an id column
|
||||||
|
p.id as product_id,
|
||||||
|
p.name as product_name,
|
||||||
|
g.id as product_group_id,
|
||||||
|
g.name as product_group,
|
||||||
|
s.amount as quantity,
|
||||||
|
s.price as price,
|
||||||
|
s.purchased_date as purchased_date
|
||||||
|
FROM
|
||||||
|
product_groups as g
|
||||||
|
INNER JOIN products as p
|
||||||
|
ON p.product_group_id = g.id
|
||||||
|
INNER JOIN stock_log as s
|
||||||
|
ON s.product_id = p.id
|
||||||
|
WHERE
|
||||||
|
s.transaction_type = 'purchase'
|
||||||
|
AND
|
||||||
|
s.undone = 0
|
||||||
|
AND
|
||||||
|
s.price is not null
|
||||||
|
ORDER BY p.name ASC
|
||||||
|
|
@ -12,8 +12,9 @@ $("#metrics-table tbody tr").each(function () {
|
||||||
var itemTotalRaw = parseFloat(self.find("td:eq(1)").attr('data-chart-value'));
|
var itemTotalRaw = parseFloat(self.find("td:eq(1)").attr('data-chart-value'));
|
||||||
var itemTotal = parseFloat((Math.round(itemTotalRaw * 100) / 100).toFixed(2));
|
var itemTotal = parseFloat((Math.round(itemTotalRaw * 100) / 100).toFixed(2));
|
||||||
data.push(itemTotal);
|
data.push(itemTotal);
|
||||||
totalAmount = (parseFloat(totalAmount) + parseFloat(itemTotal)).toFixed(2);
|
totalAmount = (parseFloat(totalAmount) + parseFloat(itemTotal));
|
||||||
});
|
});
|
||||||
|
totalAmount = totalAmount.toLocaleString(undefined, { style: "currency", currency: Grocy.Currency });
|
||||||
|
|
||||||
var backgroundColorChoices=['#6C747C',
|
var backgroundColorChoices=['#6C747C',
|
||||||
'#BFB8A4',
|
'#BFB8A4',
|
||||||
|
|
@ -67,12 +68,12 @@ var metricsChart = new Chart('metrics-chart', {
|
||||||
{
|
{
|
||||||
text: totalAmount,
|
text: totalAmount,
|
||||||
font: {
|
font: {
|
||||||
size: 30,
|
size: 24,
|
||||||
weight: 'bold',
|
weight: 'bold',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: 'total',
|
text: __t("Total"),
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -100,31 +101,37 @@ metricsTable.columns.adjust().draw();
|
||||||
/* DateRangePicker */
|
/* DateRangePicker */
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
var start_date = moment().startOf("month").format('MM/DD/YYYY');
|
var start_date = moment().startOf("month").format('YYYY-MM-DD');
|
||||||
var end_date = moment().endOf("month").format('MM/DD/YYYY');
|
var end_date = moment().endOf("month").format('YYYY-MM-DD');
|
||||||
|
|
||||||
if (urlParams.get('start_date')) start_date = moment(urlParams.get('start_date')) ;
|
if (urlParams.get('start_date')) start_date = moment(urlParams.get('start_date')) ;
|
||||||
if (urlParams.get('end_date')) end_date = moment(urlParams.get('end_date'));
|
if (urlParams.get('end_date')) end_date = moment(urlParams.get('end_date'));
|
||||||
|
|
||||||
|
var _ranges = {}
|
||||||
|
_ranges[__t("Today")] = [moment(), moment()]
|
||||||
|
_ranges[__t("Yesterday")] = [moment().subtract(1, 'days'), moment().subtract(1, 'days')]
|
||||||
|
_ranges[__t("Last 7 Days")] = [moment().subtract(6, 'days'), moment()],
|
||||||
|
_ranges[__t("Last 14 Days")] = [moment().subtract(13, 'days'), moment()],
|
||||||
|
_ranges[__t("Last 30 Days")] = [moment().subtract(29, 'days'), moment()],
|
||||||
|
_ranges[__t("This Month")] = [moment().startOf('month'), moment().endOf('month')],
|
||||||
|
_ranges[__t("Last Month")] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
|
||||||
|
_ranges[__t("This Year")] = [moment().startOf('year'), moment().endOf('year')],
|
||||||
|
_ranges[__t("Last Year")] = [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')]
|
||||||
|
|
||||||
$('#daterange-filter').daterangepicker({
|
$('#daterange-filter').daterangepicker({
|
||||||
showDropdowns: true,
|
showDropdowns: true,
|
||||||
startDate: start_date,
|
startDate: start_date,
|
||||||
endDate: end_date,
|
endDate: end_date,
|
||||||
|
showWeekNumbers: Grocy.CalendarShowWeekNumbers,
|
||||||
locale: {
|
locale: {
|
||||||
"format": 'MM/DD/YYYY',
|
"format": 'YYYY-MM-DD',
|
||||||
"firstDay": 1
|
"firstDay": Grocy.CalendarFirstDayOfWeek
|
||||||
},
|
},
|
||||||
ranges: {
|
applyLabel: __t("Apply"),
|
||||||
'Today': [moment(), moment()],
|
cancelLabel: __t("Cancel"),
|
||||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
customRangeLabel: __t("Custom Range"),
|
||||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
ranges: _ranges
|
||||||
'Last 14 Days': [moment().subtract(13, 'days'), moment()],
|
}, function(start, end, label) {
|
||||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
|
||||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
||||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
|
|
||||||
'This Year': [moment().startOf('year'), moment().endOf('year')],
|
|
||||||
'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')]
|
|
||||||
}}, function(start, end, label) {
|
|
||||||
UpdateUriParam("start_date", start.format('YYYY-MM-DD'));
|
UpdateUriParam("start_date", start.format('YYYY-MM-DD'));
|
||||||
UpdateUriParam("end_date", end.format('YYYY-MM-DD'))
|
UpdateUriParam("end_date", end.format('YYYY-MM-DD'))
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user