Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats #32

Merged
merged 23 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@
/samples/
/PDFs/
/XMLs/
user.enc
/jar/
/.idea/artifacts
user.enc
pass.enc
efakturaplus.iml

/.idea/
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<hr>

### TO-DO list:
- [x] - Ploting both sales and purchases
- [x] - Payment description
- [ ] - Password check
- [ ] - Form validation
- [x] Multiple types of plots
- [ ] Total income/outcome/tax calculation
- [ ] Improved PDF file display

39 changes: 39 additions & 0 deletions efakturaplus.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<libelement value="jar://$MODULE_DIR$/include/pdf-renderer-1.0.5.1.jar!/" />
<libelement value="jar://$MODULE_DIR$/include/json-tool.jar!/" />
<src_description expected_position="2">
<src_folder value="file://$MODULE_DIR$/src" expected_position="2" />
</src_description>
</component>
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.idea/artifacts" />
<excludeFolder url="file://$MODULE_DIR$/jar" />
</content>
<orderEntry type="jdk" jdkName="22" jdkType="JavaSDK" />
<orderEntry type="module-library" exported="">
<library name="pdf-renderer-1.0.5.1.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/include/pdf-renderer-1.0.5.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" exported="">
<library name="json-tool.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/include/json-tool.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
Empty file modified include/pdf-renderer-1.0.5.1.jar
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: efakturaplus.App

49 changes: 18 additions & 31 deletions src/efakturaplus/gui/InvoiceList.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public class InvoiceList extends JPanel {

private static final long serialVersionUID = 1L;

ArrayList<InvoiceListItem> invoices;
ArrayList<Invoice> invoices;

private JPanel invoiceDisplay;
private GridBagLayout layout;

public InvoiceList() {
public InvoiceList(ArrayList<Invoice> invoices) {
this.setLayout(new BorderLayout());

this.invoices = new ArrayList<>();
this.invoices = invoices;

this.layout = new GridBagLayout();
this.invoiceDisplay = new JPanel(this.layout);
Expand All @@ -55,38 +55,22 @@ public InvoiceList() {

printInvoices();
}

public void printInvoices() {
this.invoiceDisplay.removeAll();

public void addInvoice(Invoice invoice) {
InvoiceListItem toRemove = null;
for(InvoiceListItem item : invoices) {
if(item.invoice.id.equals(invoice.id) && invoice.status.ordinal() < item.invoice.status.ordinal())
toRemove = item;
}

if(toRemove != null)
this.invoices.remove(toRemove);

InvoiceListItem item = new InvoiceListItem(invoice);

this.invoices.add(item);

this.invoices.sort(new Comparator<InvoiceListItem>() {

this.invoices.sort(new Comparator<Invoice>() {
@Override
public int compare(InvoiceListItem item1, InvoiceListItem item2) {
return item2.invoice.deliveryDate.compareTo(item1.invoice.deliveryDate);
public int compare(Invoice item1, Invoice item2) {
return item2.deliveryDate.compareTo(item1.deliveryDate);
}
});

printInvoices();
}

public void printInvoices() {
this.invoiceDisplay.removeAll();


int n = this.invoices.size();
GridBagConstraints constr = new GridBagConstraints();


ArrayList<InvoiceListItem> items = new ArrayList<InvoiceListItem>();

if (n == 0) {
ImageIcon loading_gif = new ImageIcon("./icons/loading.gif");
JLabel loading = new JLabel("Loading ...", loading_gif, JLabel.CENTER);
Expand All @@ -99,21 +83,24 @@ public void printInvoices() {
this.invoiceDisplay.add(loading, constr);
}

InvoiceListItem item = null;

for(int i=0; i<n; ++i) {
item = new InvoiceListItem(this.invoices.get(i));

constr.gridx = 0;
constr.gridy = i*45;
constr.anchor = GridBagConstraints.FIRST_LINE_START;
constr.weightx = 1.0;
constr.weighty = 0.0;
constr.fill = GridBagConstraints.HORIZONTAL;

this.invoiceDisplay.add(this.invoices.get(i), constr);
this.invoiceDisplay.add(item, constr);
}

if(n != 0) {
constr.weighty = 1.0;
this.layout.setConstraints(this.invoices.get(n-1), constr);
this.layout.setConstraints(item, constr);
}
}
}
Expand Down
Loading
Loading