Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Commit

Permalink
Fix some Bugs in journal exporting ...
Browse files Browse the repository at this point in the history
  • Loading branch information
dev committed Feb 24, 2017
1 parent c0b33a5 commit 42c27b0
Show file tree
Hide file tree
Showing 18 changed files with 536 additions and 263 deletions.
Binary file added lib/xdocreport-2.0.1-SNAPSHOT-sources.jar
Binary file not shown.
Binary file added lib/xdocreport-2.0.1-SNAPSHOT.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions src/mpv5/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,8 @@ public void run() {
Log.Debug(Main.class, "Checking: " + libs[i]);
File lib = new File(libs[i]);
failed = !lib.canRead();
if (failed)
Log.Debug(Main.class, "Missing: " + libs[i]);
}
if (failed == true) {
Popup.notice(Messages.MISSING_LIBS.toString());
Expand Down
1 change: 0 additions & 1 deletion src/mpv5/data/MPList.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package mpv5.data;

import com.lowagie.text.ListItem;
import java.awt.Color;
import java.awt.Component;
import java.util.Vector;
Expand Down
2 changes: 1 addition & 1 deletion src/mpv5/db/common/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public class Context implements Serializable, Comparable<Context> {
// + Context.IDENTITY_GROUPS + "." + "reserve2,"
// + Context.IDENTITY_GROUPS + "." + "reserve2,"
// + Context.IDENTITY_GROUPS + "." + "reserve2,"
+ Context.IDENTITY_REVENUE + "." + "dateadded,"
+ Context.IDENTITY_REVENUE + "." + "{date},"
+ Context.IDENTITY_GROUPS + "." + "CNAME,"
+ Context.IDENTITY_ACCOUNTS + "." + "cname,"
+ Context.IDENTITY_REVENUE + "." + "CNAME,"
Expand Down
2 changes: 0 additions & 2 deletions src/mpv5/db/common/QueryCriteria2.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
*/
package mpv5.db.common;

import com.lowagie.text.Anchor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import mpv5.logging.Log;
import mpv5.utils.arrays.ArrayUtilities;

/**
Expand Down
11 changes: 10 additions & 1 deletion src/mpv5/db/objects/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,16 @@ public boolean save(boolean silent) {

@Override
public String toString() {
return getCname() + " (" + (FormatNumber.formatLokalCurrency(getGrossAmount())) + ")";
try {
if (getCname().equals(cnumber))
return ((Contact) getObject(Context.getContact(), contactsids)).__getCname()
+ "-" + getCname()
+ " (" + (FormatNumber.formatLokalCurrency(getGrossAmount())) + ")";
else
return getCname();
} catch (NodataFoundException ex) {
return getCname() + " (" + (FormatNumber.formatLokalCurrency(getGrossAmount())) + ")";
}
}

@Override
Expand Down
37 changes: 37 additions & 0 deletions src/mpv5/db/objects/Template.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package mpv5.db.objects;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JComponent;
Expand Down Expand Up @@ -55,6 +56,7 @@ public class Template extends DatabaseObject {
private boolean isupdateenabled = false;
private String pathtofile = "";
private long lastmodified = 0;

/**
* Represents the default column order
*/
Expand Down Expand Up @@ -176,6 +178,7 @@ public String __getPathtofile() {
public void setPathtofile(String pathtofile) {
this.pathtofile = pathtofile;
}

MPIcon icon;

@Override
Expand Down Expand Up @@ -281,4 +284,38 @@ public void injectData( Map<String, Object> map) {
public HashMap<String, Object> getData() {
return data;
}

private String contextName = "";

public String getContextName() {
return contextName;
}

public void setContextName(String contextName) {
this.contextName = contextName;
}

public HashMap<String, Object> getTablesAsMap() {
HashMap<String, Object> map = new HashMap<String, Object>();

for (Map.Entry<String, TableModel> entry : tables.entrySet()) {
ArrayList<String[]> list = new ArrayList<String[]>();
String key = entry.getKey();
TableModel model = entry.getValue();
Log.Debug(this, "Table: " + key);
for (int j = 0; j < model.getRowCount(); j++) {
String[] strings = new String[model.getColumnCount()];
for (int k = 0; k < strings.length; k++) {
if (model.getValueAt(j, k) != null) {
strings[k] = String.valueOf(model.getValueAt(j, k));
}
}
list.add(strings);
}

map.put(contextName + "." + key, list);
}

return map;
}
}
56 changes: 46 additions & 10 deletions src/mpv5/handler/Scheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Scheduler() {
@Override
@SuppressWarnings("empty-statement")
public void run() {
checkForOverdueEvents();
checkForOverdueEvents(null);
checkForCreateBillEvents(null);
while (YabsApplication.getApplication().isReady() == false);
if (User.getCurrentUser().getProperties().getProperty(homescreen, "disable", false)) {
Expand All @@ -63,9 +63,9 @@ public void checkForCreateBillEvents(vTimeframe DateFrame) {
}
}

public void checkForOverdueEvents() {
public void checkForOverdueEvents(vTimeframe DateFrame) {
HashMap<Color, List<? extends DatabaseObject>> map;
map = getOverdueEvents();
map = getOverdueEvents(DateFrame);
Iterator<Color> it = map.keySet().
iterator();
while (it.hasNext()) {
Expand Down Expand Up @@ -109,7 +109,7 @@ public static HashMap<Color, List<? extends DatabaseObject>> getScheduledBills(v
return map;
}

public static HashMap<Color, List<? extends DatabaseObject>> getOverdueEvents() {
public static HashMap<Color, List<? extends DatabaseObject>> getOverdueEvents(vTimeframe DateFrame) {
List<DatabaseObject> warnings = new ArrayList<>();
List<DatabaseObject> alerts = new ArrayList<>();
List<DatabaseObject> waitings = new ArrayList<>();
Expand Down Expand Up @@ -200,7 +200,13 @@ public static HashMap<Color, List<? extends DatabaseObject>> getOverdueEvents()
Item it = (Item) Item.getObject(
c,
id);
waitings.add(it);
if (DateFrame != null) {
if (DateFrame.contains(it.__getDateadded())) {
waitings.add(it);
}
} else {
waitings.add(it);
}
} catch (NodataFoundException ex) {
Log.Debug(Scheduler.class,
ex.getMessage());
Expand Down Expand Up @@ -307,7 +313,13 @@ public static HashMap<Color, List<? extends DatabaseObject>> getOverdueEvents()
Item it = (Item) Item.getObject(
c,
id);
warnings.add(it);
if (DateFrame != null) {
if (DateFrame.contains(it.__getDateadded())) {
warnings.add(it);
}
} else {
warnings.add(it);
}
} catch (NodataFoundException ex) {
Log.Debug(Scheduler.class,
ex.getMessage());
Expand Down Expand Up @@ -404,7 +416,13 @@ public static HashMap<Color, List<? extends DatabaseObject>> getOverdueEvents()
try {
Item it = (Item) Item.getObject(c,
id);
alerts.add(it);
if (DateFrame != null) {
if (DateFrame.contains(it.__getDateadded())) {
alerts.add(it);
}
} else {
alerts.add(it);
}
} catch (NodataFoundException ex) {
Log.Debug(ex);
}
Expand Down Expand Up @@ -444,7 +462,13 @@ public static HashMap<Color, List<? extends DatabaseObject>> getOverdueEvents()
Revenue it = (Revenue) Revenue.getObject(
c,
id);
waitings.add(it);
if (DateFrame != null) {
if (DateFrame.contains(it.__getDateadded())) {
waitings.add(it);
}
} else {
waitings.add(it);
}
} catch (NodataFoundException ex) {
Log.Debug(Scheduler.class,
ex.getMessage());
Expand Down Expand Up @@ -477,7 +501,13 @@ public static HashMap<Color, List<? extends DatabaseObject>> getOverdueEvents()
Revenue it = (Revenue) Revenue.getObject(
c,
id);
warnings.add(it);
if (DateFrame != null) {
if (DateFrame.contains(it.__getDateadded())) {
warnings.add(it);
}
} else {
warnings.add(it);
}
} catch (NodataFoundException ex) {
Log.Debug(Scheduler.class,
ex.getMessage());
Expand Down Expand Up @@ -508,7 +538,13 @@ public static HashMap<Color, List<? extends DatabaseObject>> getOverdueEvents()
try {
Revenue it = (Revenue) Revenue.getObject(c,
id);
alerts.add(it);
if (DateFrame != null) {
if (DateFrame.contains(it.__getDateadded())) {
alerts.add(it);
}
} else {
alerts.add(it);
}
} catch (NodataFoundException ex) {
Log.Debug(ex);
}
Expand Down
9 changes: 8 additions & 1 deletion src/mpv5/resources/languages/Panels.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1933,7 +1933,6 @@ JournalPanel.jPanel5.TabConstraints.tabTitle=Contact Overview
JournalPanel.taxVolume._Label=Volume Tax
JournalPanel.volumeBrutto._Label=Volume Brut
JournalPanel.volumeNetto._Label=Volume Net
JournalPanel.revenueNetto._Label=Revenue Net
JournalPanel.jButton4.text=Use Template
JournalPanel.count.text=
JournalPanel.jButton1.text=Load
Expand Down Expand Up @@ -2165,4 +2164,12 @@ ContactPanel.button_credit.text=New Credit
ItemPanel2.number._Label=Number
ItemPanel2.name._Label=short description
ItemPanel2.tocredit.text=Create Credit
JournalPanel.Revenue\ Brut._Label=Revenue Brut
JournalPanel.revenueNetto._Label=Revenue Net
JournalPanel.revenueTax._Label=Revenue Tax
JournalPanel.revenueBrut._Label=Revenue Brut
JournalPanel.expNetto._Label=Expense Net
JournalPanel.expTax._Label=Expense Tax
JournalPanel.expBrut._Label=Expense Brut
JournalPanel.profitNetto._Label=Profit Net
JournalPanel.profitTax._Label=Profit Tax
6 changes: 3 additions & 3 deletions src/mpv5/ui/panels/HomeScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public <T extends DatabaseObject> void setData(List<T> list, JTable table) {
*/
@SuppressWarnings("unchecked")
public void filterByTimeframe(vTimeframe g) {
HashMap<Color, List<? extends DatabaseObject>> map = Scheduler.getOverdueEvents();
HashMap<Color, List<? extends DatabaseObject>> map = Scheduler.getOverdueEvents(g);
this.show(map, this.getOverdue());
}

Expand Down Expand Up @@ -748,7 +748,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
filterByTimeframe(timeframeChooser1.getTime());
filterByTimeframe(timeframeChooser1.getTime());
}//GEN-LAST:event_jButton1ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
Expand Down Expand Up @@ -863,7 +863,7 @@ private void but6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:ev
}
}

HashMap<Color, List<? extends DatabaseObject>> map2 = Scheduler.getOverdueEvents();
HashMap<Color, List<? extends DatabaseObject>> map2 = Scheduler.getOverdueEvents(null);
Iterator<Color> it2 = map2.keySet().
iterator();
while (it2.hasNext()) {
Expand Down
Loading

0 comments on commit 42c27b0

Please sign in to comment.