Commit 007c22fd authored by Project Open's avatar Project Open

- WIP: "Sum" column at the very right, right aligned, rounding, ...

parent 25329849
......@@ -75,7 +75,7 @@ function launchTimesheetWeeklyLogging(){
}
});
var summaryType = function(hourArray, dataIndex) {
var sumType = function(hourArray, dataIndex) {
var sum = 0;
for (var i = 0; i < hourArray.length; i++) {
var vString = hourArray[i].get(dataIndex);
......@@ -85,7 +85,7 @@ function launchTimesheetWeeklyLogging(){
return sum;
};
var summaryRenderer = function(value, summaryData, dataIndex) {
var sumRenderer = function(value, summaryData, dataIndex) {
var type = typeof(value);
if ("number" == type) {
return Math.round(value * 100) / 100;
......@@ -152,13 +152,22 @@ function launchTimesheetWeeklyLogging(){
editor: { xtype: 'pocombotree', store: taskTreeStore, queryMode: 'local', displayField: 'project_name', valueField: 'id'}
},
// { text: "Date", xtype: 'datecolumn', dataIndex: 'day', renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: {xtype: 'datefield',allowBlank: true}},
{text: "<div align=center>Mon<br>3/29/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Tue<br>3/30/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Wed<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Thu<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Fri<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Sat<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Sun<br>2/31/2021</div>", width: 65, dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: summaryType, summaryRenderer: summaryRenderer},
{text: "<div align=center>Mon<br>3/29/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Tue<br>3/30/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Wed<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Thu<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Fri<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Sat<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{text: "<div align=center>Sun<br>2/31/2021</div>", width: 75, align: "right", dataIndex: 'hours', editor: { xtype: 'numberfield', minValue: 0}, summaryType: sumType, summaryRenderer: sumRenderer},
{ text: "Sum", width: 75, dataIndex: 'note', align: "center",
renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
var hoursString = record.get('hours');
var hoursFloat = parseFloat(hoursString)
if ("number" == typeof(hoursFloat)) return Math.round(700.0 * hoursFloat) / 100.0;
return "";
},
summaryType: sumType, summaryRenderer: sumRenderer
}
// { text: "Note", flex: 1, dataIndex: 'note', editor: { allowBlank: true }}
]
});
......@@ -576,7 +585,7 @@ Ext.onReady(function() {
});
// Load stores that need parameters
hourStore.getProxy().extraParams = { user_id: @current_user_id@, format: 'json' };
hourStore.getProxy().extraParams = { query: "user_id = @current_user_id@ and day > '2021-03-10'", format: 'json' };
hourStore.load({
callback: function() {
console.log('PO.store.timesheet.HourStore: loaded');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment