Skip to content

Commit

Permalink
fixed sorting of cases. fixed display of invoice totals. close #2372
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Mar 20, 2024
1 parent 4359691 commit 6709753
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docker/getversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jlversion=`echo "$jlversion" | tr _ .`

# tadaaa!
# echo $jlversion
echo 2.6.0.17
echo 2.6.1.0

Binary file modified j-lawyer-client/lib/j-lawyer-cloud/j-lawyer-cloud.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,8 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
Expand Down Expand Up @@ -995,7 +997,6 @@ public void setAddressDTO(AddressBean dto) {
this.txtStreet.setText(dto.getStreet());
this.txtWebsite.setText(dto.getWebsite());
this.txtZipCode.setText(dto.getZipCode());
//this.lblArchiveFilesForAddress.setText("");
this.pnlCasesForContact.removeAll();

this.txtCustom1.setText(dto.getCustom1());
Expand Down Expand Up @@ -1091,7 +1092,7 @@ public void setAddressDTO(AddressBean dto) {
}
}

this.jTabbedPane1StateChanged(null);
this.jTabbedPane1.setSelectedIndex(0);

List<Invoice> invoices = new ArrayList<>();
try {
Expand Down Expand Up @@ -3090,18 +3091,19 @@ private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-
JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties());
ArchiveFileServiceRemote afRem = locator.lookupArchiveFileServiceRemote();
Collection col = afRem.getArchiveFileAddressesForAddress(this.dto.getId());
Hashtable<String, ArrayList<ArchiveFileAddressesBean>> casesByPartyType = new Hashtable<>();
// Hashtable<String, ArrayList<ArchiveFileAddressesBean>> casesByPartyType = new Hashtable<>();
Hashtable<String, PartyTypeBean> partyTypes = locator.lookupSystemManagementRemote().getPartyTypesTable();
for (Object o : col) {
ArchiveFileAddressesBean afb = (ArchiveFileAddressesBean) o;
if (!casesByPartyType.containsKey(afb.getReferenceType().getName())) {
ArrayList<ArchiveFileAddressesBean> cases = new ArrayList<>();
casesByPartyType.put(afb.getReferenceType().getName(), cases);
}
casesByPartyType.get(afb.getReferenceType().getName()).add(afb);

}
this.fillCasesForContactPanel(casesByPartyType, partyTypes);
// for (Object o : col) {
// ArchiveFileAddressesBean afb = (ArchiveFileAddressesBean) o;
// if (!casesByPartyType.containsKey(afb.getReferenceType().getName())) {
// ArrayList<ArchiveFileAddressesBean> cases = new ArrayList<>();
// casesByPartyType.put(afb.getReferenceType().getName(), cases);
// }
// casesByPartyType.get(afb.getReferenceType().getName()).add(afb);
//
// }
// this.fillCasesForContactPanel(casesByPartyType, partyTypes);
this.fillCasesForContactPanel(col, partyTypes);
} catch (Exception ex) {
log.error("Error getting archive files for address", ex);
JOptionPane.showMessageDialog(this, "Fehler beim Laden der Akten zur Adresse: " + ex.getMessage(), com.jdimension.jlawyer.client.utils.DesktopUtils.POPUP_TITLE_ERROR, JOptionPane.ERROR_MESSAGE);
Expand Down Expand Up @@ -3559,30 +3561,38 @@ private void enableEmailButton() {
}
}

private void fillCasesForContactPanel(Hashtable<String, ArrayList<ArchiveFileAddressesBean>> casesByPartyType, Hashtable<String, PartyTypeBean> partyTypes) {
private void fillCasesForContactPanel(Collection<ArchiveFileAddressesBean> allCases, Hashtable<String, PartyTypeBean> partyTypes) {
this.pnlCasesForContact.removeAll();

List<ArchiveFileAddressesBean> allCasesList=new ArrayList<>(allCases);
Collections.sort(allCasesList, (ArchiveFileAddressesBean o1, ArchiveFileAddressesBean o2) -> {
ArchiveFileBean c1=o1.getArchiveFileKey();
ArchiveFileBean c2=o2.getArchiveFileKey();
if(c1!=null && c2!=null) {
Date d1=c1.getDateCreated();
Date d2=c2.getDateCreated();
if(d1!=null && d2!=null) {
return d2.compareTo(d1);
}
}
return 1;
});

int totalSize = 0;
for (ArrayList<ArchiveFileAddressesBean> list : casesByPartyType.values()) {
totalSize = totalSize + list.size();
}

GridLayout layout = new GridLayout(totalSize, 1);
GridLayout layout = new GridLayout(allCases.size(), 1);
this.pnlCasesForContact.setLayout(layout);
int i = 0;
for (String key : casesByPartyType.keySet()) {
for (ArchiveFileAddressesBean aFile: allCasesList) {

ArrayList<ArchiveFileAddressesBean> partyFiles = casesByPartyType.get(key);
for (ArchiveFileAddressesBean aFile : partyFiles) {

CaseForContactEntryPanel ep = new CaseForContactEntryPanel(this.getClass().getName());
if (i % 2 == 0) {
ep.setBackground(ep.getBackground().brighter());
}
CaseForContactEntry lce = new CaseForContactEntry();
lce.setRoleForeground(new Color(partyTypes.get(key).getColor()));
lce.setRoleForeground(new Color(partyTypes.get(aFile.getReferenceType().getName()).getColor()));
lce.setFileNumber(aFile.getArchiveFileKey().getFileNumber());
lce.setId(aFile.getArchiveFileKey().getId());
lce.setRole(key);
lce.setRole(aFile.getReferenceType().getName());
lce.setName(aFile.getArchiveFileKey().getName());
lce.setReason(StringUtils.nonEmpty(aFile.getArchiveFileKey().getReason()));
lce.setArchived(aFile.getArchiveFileKey().isArchived());
Expand All @@ -3597,7 +3607,7 @@ private void fillCasesForContactPanel(Hashtable<String, ArrayList<ArchiveFileAdd

this.pnlCasesForContact.add(ep);
i++;
}

}

layout.setRows(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,15 +746,19 @@ public void setEntry(CaseForContactEntry entry) {
this.lblTotal.setText("");
DecimalFormat df=new DecimalFormat("0.00");
if(invoices!=null) {
float total=invoices.get(Invoice.STATUS_NEW) + invoices.get(Invoice.STATUS_OPEN) + invoices.get(Invoice.STATUS_PAID) - invoices.get(Invoice.STATUS_CANCELLED);
float total=invoices.get(Invoice.STATUS_NEW) + invoices.get(Invoice.STATUS_OPEN) + invoices.get(Invoice.STATUS_OPEN_REMINDER1) + invoices.get(Invoice.STATUS_OPEN_REMINDER2) + invoices.get(Invoice.STATUS_OPEN_REMINDER3) + invoices.get(Invoice.STATUS_OPEN_NONENFORCEABLE) - invoices.get(Invoice.STATUS_PAID) - invoices.get(Invoice.STATUS_CANCELLED);
StringBuilder sb=new StringBuilder();
sb.append("<html><b>Umsatzrelevante Werte gesamt: ").append(df.format(total)).append("</b><br/>");
sb.append("<table><tr><td>neu:</td><td>").append(df.format(invoices.get(Invoice.STATUS_NEW))).append("</td></tr>");
sb.append("<tr><td>offen:</td><td>").append(df.format(invoices.get(Invoice.STATUS_OPEN))).append("</td></tr>");
sb.append("<tr><td>offen - 1. Mahnstufe:</td><td>").append(df.format(invoices.get(Invoice.STATUS_OPEN_REMINDER1))).append("</td></tr>");
sb.append("<tr><td>offen - 2. Mahnstufe:</td><td>").append(df.format(invoices.get(Invoice.STATUS_OPEN_REMINDER2))).append("</td></tr>");
sb.append("<tr><td>offen - 3. Mahnstufe:</td><td>").append(df.format(invoices.get(Invoice.STATUS_OPEN_REMINDER3))).append("</td></tr>");
sb.append("<tr><td>offen - nicht vollstreckbar:</td><td>").append(df.format(invoices.get(Invoice.STATUS_OPEN_NONENFORCEABLE))).append("</td></tr>");
sb.append("<tr><td>bezahlt:</td><td>").append(df.format(invoices.get(Invoice.STATUS_PAID))).append("</td></tr>");
sb.append("<tr><td>storniert:</td><td>").append(df.format(invoices.get(Invoice.STATUS_CANCELLED))).append("</td></tr></table></html>");
this.lblTotal.setText(df.format(total));
if(invoices.get(Invoice.STATUS_OPEN)>0)
if(total>0)
this.lblTotal.setForeground(DefaultColorTheme.COLOR_LOGO_RED);
else
this.lblTotal.setForeground(DefaultColorTheme.COLOR_LOGO_GREEN);
Expand Down
Binary file modified j-lawyer-server/j-lawyer-server-ejb/lib/j-lawyer-cloud.jar
Binary file not shown.

0 comments on commit 6709753

Please sign in to comment.