Skip to content

Commit

Permalink
better tab handling for reports. better captions for sub tables in op…
Browse files Browse the repository at this point in the history
…en timesheets. close #2185
  • Loading branch information
j-dimension committed Nov 7, 2023
1 parent e154d09 commit 312d148
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JTabbedPane" name="tabbedCharts">
<Properties>
<Property name="tabLayoutPolicy" type="int" value="1"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
Expand All @@ -118,6 +121,9 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
</Container>
<Container class="javax.swing.JTabbedPane" name="tabbedTables">
<Properties>
<Property name="tabLayoutPolicy" type="int" value="1"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});

jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

tabbedCharts.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
jSplitPane1.setLeftComponent(tabbedCharts);

tabbedTables.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
jSplitPane1.setRightComponent(tabbedTables);

dtFrom.setEditable(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ You should also get your employer (if you work as a programmer) or school,
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import javax.annotation.Resource;
Expand Down Expand Up @@ -876,7 +878,7 @@ public ReportResult invokeReport(String reportId, Object... params) throws Excep
result.getTables().add(getTable(true, "Offene Zeiterfassungsprojekte", query, params));
} else if (Reports.RPT_TSHEETS_OPEN_POSITIONS.equals(reportId)) {
String query = "SELECT cases.id, cases.fileNumber as Aktenzeichen, cases.name as Rubrum, cases.reason as wegen, \n"
+ " ts.name as Projektname, ts.description as Projektbeschreibung, ts.interval_minutes as Taktung,\n"
+ " concat(cases.fileNumber, ' ', cases.name, ': ', ts.name) as Projektname, ts.description as Projektbeschreibung, ts.interval_minutes as Taktung,\n"
+ " DATE_FORMAT(tsp.time_started,'%Y-%m-%d %H:%i') as von, DATE_FORMAT(tsp.time_stopped,'%Y-%m-%d %H:%i') as bis, greatest(1, TIMESTAMPDIFF(MINUTE, tsp.time_started, tsp.time_stopped)) AS Minuten, greatest(1, CEILING(TIMESTAMPDIFF(MINUTE, tsp.time_started, tsp.time_stopped)/ts.interval_minutes))*ts.interval_minutes DIV 1 AS MinutenInTaktung, tsp.name as Aktivitaet, tsp.description as Taetigkeiten, tsp.principal as GebuchtDurch, tsp.tax_rate as Steuersatz, tsp.unit_price as Stundensatz, (greatest(1, CEILING(TIMESTAMPDIFF(MINUTE, tsp.time_started, tsp.time_stopped)/ts.interval_minutes))*ts.interval_minutes DIV 1) / 60 * tsp.unit_price as Positionsbetrag\n"
+ " FROM timesheet_positions tsp\n"
+ "left join timesheets ts on ts.id=tsp.timesheet_id \n"
Expand All @@ -888,7 +890,18 @@ public ReportResult invokeReport(String reportId, Object... params) throws Excep
result.getTables().add(mainTable);

Collection<ReportResultTable> subTables=this.splitTable(mainTable, "Projektname");
result.getTables().addAll(subTables);
ArrayList<ReportResultTable> sortedSubTables=new ArrayList<>();
sortedSubTables.addAll(subTables);
Collections.sort(sortedSubTables, (ReportResultTable o1, ReportResultTable o2) -> {
String s1=o1.getTableName();
String s2=o2.getTableName();
if(s1==null)
s1="";
if(s2==null)
s2="";
return s1.compareTo(s2);
});
result.getTables().addAll(sortedSubTables);

} else if (Reports.RPT_CASES_BYSIZE.equals(reportId)) {
String query = "select cid, Aktenzeichen, Rubrum, wegen, archiviert, round((Megabytes/1024/1024),1) as Megabytes from (\n"
Expand Down

0 comments on commit 312d148

Please sign in to comment.