Search in sources :

Example 16 with XmlBuilder

use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.

the class LoanRepaymentTag method createInstallmentRow.

XmlBuilder createInstallmentRow(LoanScheduleEntity installment, boolean isPaymentMade, boolean isNewGropLoan) {
    XmlBuilder html = new XmlBuilder();
    html.startTag("tr");
    html.startTag("td", "width", "6%", "class", "drawtablerow");
    html.text(installment.getInstallmentId().toString());
    html.endTag("td");
    html.startTag("td", "width", "15%", "class", "drawtablerow");
    html.text(DateUtils.getDBtoUserFormatString(installment.getActionDate(), locale).toString());
    html.endTag("td");
    html.startTag("td", "width", "15%", "class", "drawtablerow");
    html.text((isPaymentMade && installment.getPaymentDate() != null ? DateUtils.getDBtoUserFormatString(installment.getPaymentDate(), locale) : "-").toString());
    html.endTag("td");
    html.startTag("td", "width", "12%", "align", "right", "class", "drawtablerow");
    if (isNewGropLoan) {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(installment.getPrincipalPaid().toString()) : ConversionUtil.formatNumber(installment.getPrincipalDue().toString()) + "(" + ConversionUtil.formatNumber(installment.getPrincipalPaid().toString()) + ")"));
    } else {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(installment.getPrincipalPaid().toString()) : ConversionUtil.formatNumber(installment.getPrincipalDue().toString())));
    }
    html.endTag("td");
    html.startTag("td", "width", "10%", "align", "right", "class", "drawtablerow");
    if (isNewGropLoan) {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(installment.getEffectiveInterestPaid().toString()) : ConversionUtil.formatNumber(installment.getEffectiveInterestDue().toString()) + (AccountingRules.isOverdueInterestPaidFirst() ? " (" + ConversionUtil.formatNumber((installment.getInterestPaid().add(installment.getExtraInterestPaid())).toString()) + ")" : "")));
    } else {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(installment.getEffectiveInterestPaid().toString()) : ConversionUtil.formatNumber(installment.getEffectiveInterestDue().toString()) + (AccountingRules.isOverdueInterestPaidFirst() ? " (" + ConversionUtil.formatNumber((installment.getInterestPaid().add(installment.getExtraInterestPaid())).toString()) + ")" : "")));
    }
    html.endTag("td");
    html.startTag("td", "width", "10%", "align", "right", "class", "drawtablerow");
    if (isNewGropLoan) {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(installment.getTotalFeeAmountPaidWithMiscFee().toString()) : ConversionUtil.formatNumber(installment.getTotalFeeDueWithMiscFeeDue().toString()) + "(" + ConversionUtil.formatNumber(installment.getTotalFeeAmountPaidWithMiscFee().toString()) + ")"));
    } else {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(installment.getTotalFeeAmountPaidWithMiscFee().toString()) : ConversionUtil.formatNumber(installment.getTotalFeeDueWithMiscFeeDue().toString())));
    }
    html.endTag("td");
    html.startTag("td", "width", "10%", "align", "right", "class", "drawtablerow");
    if (isNewGropLoan) {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(installment.getTotalPenaltyPaid().toString()) : ConversionUtil.formatNumber(installment.getPenaltyDue().toString()) + "(" + ConversionUtil.formatNumber(installment.getTotalPenaltyPaid().toString()) + ")"));
    } else {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(installment.getTotalPenaltyPaid().toString()) : ConversionUtil.formatNumber(installment.getPenaltyDue().toString())));
    }
    html.endTag("td");
    html.startTag("td", "width", "10%", "align", "right", "class", "drawtablerow");
    html.text(ConversionUtil.formatNumber(installment.getDaysLate().toString()));
    html.endTag("td");
    html.startTag("td", "width", "12%", "align", "right", "class", "drawtablerow");
    if (isNewGropLoan) {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(String.valueOf(installment.getPrincipalPaid().add(installment.getEffectiveInterestPaid()).add(installment.getTotalFeeAmountPaidWithMiscFee()).add(installment.getTotalPenaltyPaid()))) : ConversionUtil.formatNumber(String.valueOf(installment.getPrincipalDue().add(installment.getEffectiveInterestDue()).add(installment.getTotalFeeDueWithMiscFeeDue()).add(installment.getPenaltyDue()))) + "(" + ConversionUtil.formatNumber(String.valueOf(installment.getPrincipalPaid().add(installment.getEffectiveInterestPaid()).add(installment.getTotalFeeAmountPaidWithMiscFee()).add(installment.getTotalPenaltyPaid()))) + ")"));
    } else {
        html.text((isPaymentMade ? ConversionUtil.formatNumber(String.valueOf(installment.getPrincipalPaid().add(installment.getEffectiveInterestPaid()).add(installment.getTotalFeeAmountPaidWithMiscFee()).add(installment.getTotalPenaltyPaid()))) : ConversionUtil.formatNumber(String.valueOf(installment.getPrincipalDue().add(installment.getEffectiveInterestDue()).add(installment.getTotalFeeDueWithMiscFeeDue()).add(installment.getPenaltyDue())))));
    }
    html.endTag("td");
    html.endTag("tr");
    return html;
}
Also used : XmlBuilder(org.mifos.framework.struts.tags.XmlBuilder)

Example 17 with XmlBuilder

use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.

the class OfficeListTag method processOffice.

private XmlBuilder processOffice(XmlBuilder levelHtml, OfficeBO office, String levelName) {
    if (levelHtml == null) {
        levelHtml = new XmlBuilder();
        levelHtml.singleTag("br");
        levelHtml.startTag("table", "width", "95%", "border", "0", "cellspacing", "0", "cellpadding", "0");
        levelHtml.startTag("tr");
        levelHtml.startTag("td");
        levelHtml.startTag("span", "class", "fontnormalBold");
        levelHtml.text(levelName);
        levelHtml.endTag("span");
        levelHtml.endTag("td");
        levelHtml.endTag("tr");
        levelHtml.endTag("table");
        levelHtml.startTag("table", "width", "90%", "border", "0", "cellspacing", "0", "cellpadding", "0");
    }
    levelHtml.startTag("tr", "class", "fontnormal");
    bullet(levelHtml);
    levelHtml.startTag("td", "width", "99%");
    levelHtml.append(getLink(office.getOfficeId(), office.getOfficeName()));
    levelHtml.endTag("td");
    levelHtml.endTag("tr");
    return levelHtml;
}
Also used : XmlBuilder(org.mifos.framework.struts.tags.XmlBuilder)

Example 18 with XmlBuilder

use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.

the class OfficeListTagTest method testGetLink.

@Test
public void testGetLink() throws Exception {
    OfficeListTag tag = new OfficeListTag("action", "method", "flow");
    XmlBuilder link = tag.getLink((short) 234, "My Office");
    Assert.assertEquals("<a href=\"action?method=method&amp;" + "office.officeId=234&amp;office.officeName=My+Office&amp;" + "officeId=234&amp;officeName=My+Office&amp;" + "currentFlowKey=flow\">My Office</a>", link.getOutput());
}
Also used : XmlBuilder(org.mifos.framework.struts.tags.XmlBuilder) Test(org.junit.Test)

Example 19 with XmlBuilder

use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.

the class DatabaseInitFilter method printErrorPage.

void printErrorPage(PrintWriter out) {
    XmlBuilder xml = new XmlBuilder();
    xml.startTag("html");
    xml.startTag("head");
    xml.startTag("title");
    xml.text("Mifos Database Error");
    xml.text("\n");
    xml.endTag("title");
    xml.text("\n");
    xml.endTag("head");
    xml.text("\n");
    xml.startTag("body");
    xml.startTag("h2");
    xml.text("Mifos Database Error");
    xml.endTag("h2");
    xml.text("\n");
    xml.startTag("p");
    xml.text("A database error occurred. ");
    xml.text("Correct the error and restart the application. ");
    xml.text("Details:");
    xml.endTag("p");
    xml.text("\n");
    ApplicationInitializer.printDatabaseError(xml);
    xml.endTag("body");
    xml.text("\n");
    xml.endTag("html");
    out.println(xml.getOutput());
}
Also used : XmlBuilder(org.mifos.framework.struts.tags.XmlBuilder)

Example 20 with XmlBuilder

use of org.mifos.framework.struts.tags.XmlBuilder in project head by mifos.

the class TableTag method noResults.

XmlBuilder noResults(String officeName, String officeId, String searchString) {
    XmlBuilder html = new XmlBuilder();
    html.startTag("table", "width", "96%", "border", "0", "cellpadding", "0", "cellspacing", "0");
    html.startTag("tr", "class", "fontnormal");
    html.startTag("td", "colspan", "2", "valign", "top");
    html.singleTag("br");
    html.startTag("span", "class", "headingorange");
    html.text(MessageLookup.getLocalizedMessage("Customer.noResultsFoundFor") + " ");
    html.startTag("span", "class", "heading");
    html.text(searchString);
    html.text(" ");
    html.endTag("span");
    String inString = MessageLookup.getLocalizedMessage("Customer.in");
    if (officeId.equals(ALL_BRANCHES)) {
        renderInClause(html, MessageLookup.getLocalizedMessage("Customer.allBranches"), inString);
    } else {
        renderInClause(html, officeName, inString);
    }
    html.endTag("span");
    html.endTag("td");
    html.endTag("tr");
    if (type.equalsIgnoreCase("single")) {
        html.startTag("tr");
        html.startTag("td", "colspan", "2", "valign", "top", "class", "blueline");
        html.singleTag("br");
        html.singleTag("img", "src", "pages/framework/images/trans.gif", "width", "5", "height", "3");
        html.endTag("td");
        html.endTag("tr");
    }
    html.endTag("table");
    return html;
}
Also used : XmlBuilder(org.mifos.framework.struts.tags.XmlBuilder)

Aggregations

XmlBuilder (org.mifos.framework.struts.tags.XmlBuilder)20 JspException (javax.servlet.jsp.JspException)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 HttpSession (javax.servlet.http.HttpSession)2 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)2 FlowManager (org.mifos.framework.util.helpers.FlowManager)2 UserContext (org.mifos.security.util.UserContext)2 IOException (java.io.IOException)1 Date (java.util.Date)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 JspWriter (javax.servlet.jsp.JspWriter)1 Before (org.junit.Before)1 Test (org.junit.Test)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 LoanScheduleEntity (org.mifos.accounts.loan.business.LoanScheduleEntity)1 OfficeBO (org.mifos.customers.office.business.OfficeBO)1 LoanActivityDto (org.mifos.dto.domain.LoanActivityDto)1 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)1