Revision history [back]

click to hide/show revision 1
initial version

answered 2009-03-16 19:38:18 +0800

james gravatar image james

view.zul

<grid id="viewGrid" mold="paging" pageSize="20" pagingPosition="both">
    <columns>
        <column label="Product" width="90" />
        <column label="Procedure" width="90" />
        <column label="DT" width="50px" />
        <column label="Cal Date" width="90px" />
        <column label="CT" width="50px" />
        <column label="Amount" width="70px" />
        <column label="Unit" width="70px" />
        <column label="Qty" width="30px" />
        <column label="Patient" width="90" />
        <column label="Note" width="90" />
    </columns>
</grid>
<zscript>
    String [][] products = mainV.viewOrdersCombine(mainV.getDelDate());
    ListModel productModel = new SimpleListModel(products);
    viewGrid.setModel(productModel); 
    viewGrid.setRowRenderer(new rowRendererTT());
</zscript>

code in func.java

public String[][] viewOrdersCombine(String date) throws ClassNotFoundException, SQLException{
    String[][] Orders = viewOrdersQuery(date);
    String[][] Rxorders = viewRxordersQuery(date);

    String[][] fullOrders = new String[Orders.length + Rxorders.length][13];
    Integer oNum=0;
    for (oNum=0; oNum<Orders.length; oNum++){
        fullOrders[ oNum][0] = "x";
        fullOrders[ oNum][1] = "x";
        fullOrders[ oNum][2] = Orders[ oNum][2];
        fullOrders[ oNum][3] = Orders[ oNum][3];
        fullOrders[ oNum][4] = Orders[ oNum][5];
        try {
            fullOrders[ oNum][5] = showDFormat(dashYFormat(Orders[ oNum][6]));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        fullOrders[ oNum][6] = Orders[ oNum][7];
        fullOrders[ oNum][7] = Orders[ oNum][8];
        fullOrders[ oNum][8] = Orders[ oNum][9];
        fullOrders[ oNum][9] = Orders[ oNum][10];
        fullOrders[ oNum][10] = Orders[ oNum][12];
        fullOrders[ oNum][11] = Orders[ oNum][14];
    }
    for (Integer rNum=1; rNum<Rxorders.length; rNum++){
        fullOrders[rNum+oNum][0] = Rxorders[ rNum][14];
        fullOrders[rNum+oNum][1] = Rxorders[ rNum][13];
        fullOrders[rNum+oNum][2] = Rxorders[ rNum][1];
        fullOrders[rNum+oNum][3] = Rxorders[ rNum][2];
        fullOrders[rNum+oNum][4] = Rxorders[ rNum][3];
        try {
            fullOrders[rNum+oNum][5] = showDFormat(dashYFormat(Rxorders[ rNum][5]));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        fullOrders[rNum+oNum][6] = Rxorders[ rNum][6];
        fullOrders[rNum+oNum][7] = Rxorders[ rNum][7];
        fullOrders[rNum+oNum][8] = Rxorders[ rNum][8];
        fullOrders[rNum+oNum][9] = Rxorders[ rNum][9];
        fullOrders[rNum+oNum][10] = Rxorders[ rNum][10];
        fullOrders[rNum+oNum][11] = Rxorders[ rNum][12];
    }

    return fullOrders;
}

// i had to put a space with "rNum" and "oNum" otherwise this forum doesn't display it at all.

the viewOrdersQuery() and viewRxordersQuery() functions just return a string[][] of the data queried from a database.

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More