1
|
package eu.dnetlib.client.fundingrequest.stepinfo;
|
2
|
|
3
|
import com.google.gwt.core.client.GWT;
|
4
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
5
|
import com.google.gwt.user.client.ui.HTML;
|
6
|
import com.google.gwt.user.client.ui.IsWidget;
|
7
|
import com.google.gwt.user.client.ui.Widget;
|
8
|
import eu.dnetlib.goldoa.domain.Invoice;
|
9
|
import eu.dnetlib.goldoa.domain.Request;
|
10
|
|
11
|
/**
|
12
|
* Created by stefania on 3/30/15.
|
13
|
*/
|
14
|
public class AccountingInlineInfo implements IsWidget {
|
15
|
|
16
|
private HTML accountingInlineInfo = new HTML();
|
17
|
private String accountingInfoContents = "";
|
18
|
|
19
|
private DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy/MM/dd");
|
20
|
|
21
|
public AccountingInlineInfo(Request request, float apc, float discount, Invoice invoice) {
|
22
|
|
23
|
accountingInfoContents = "<div class=\"displayInlineInfo\">";
|
24
|
|
25
|
accountingInfoContents += "<dl><dt class=\"chronologySubTitle\">ACCOUNTING</dt></dl>";
|
26
|
accountingInfoContents += "<dd>";
|
27
|
|
28
|
accountingInfoContents += "APC: " + Math.round(apc*100) / 100.0 + " EUROS ";
|
29
|
accountingInfoContents += "(" + Math.round(discount*100) / 100.0 + "% discount)";
|
30
|
accountingInfoContents += ", Project participation: " + Math.round(request.getProjectParticipation()*100) / 100.0 + "%";
|
31
|
accountingInfoContents += ", Funded with: " + Math.round(request.getFundingRequested()*100) / 100.0 + " EUROS";
|
32
|
|
33
|
accountingInfoContents += "</dd>";
|
34
|
|
35
|
if(invoice!=null) {
|
36
|
|
37
|
accountingInfoContents += "<dl><dt class=\"chronologySubTitle\">INVOICE</dt></dl>";
|
38
|
accountingInfoContents += "<dd>";
|
39
|
|
40
|
accountingInfoContents += "Invoice number: " + invoice.getNumber();
|
41
|
accountingInfoContents += ", Date issued: " + dtf.format(invoice.getDate());
|
42
|
accountingInfoContents += ", " + "<a href=\"" + GWT.getModuleBaseURL() + "invoice?invoiceId=" + invoice.getId() + "\" target=\"_blank\">Click here to download the invoice</a>";
|
43
|
|
44
|
accountingInfoContents += "</dd>";
|
45
|
}
|
46
|
|
47
|
accountingInfoContents += "</div>";
|
48
|
accountingInlineInfo.setHTML(accountingInfoContents);
|
49
|
}
|
50
|
|
51
|
@Override
|
52
|
public Widget asWidget() {
|
53
|
return accountingInlineInfo;
|
54
|
}
|
55
|
|
56
|
public void addStyleName(String styleName) {
|
57
|
accountingInlineInfo.addStyleName(styleName);
|
58
|
}
|
59
|
}
|