String htmlTblheader= showStock?
String.format("<thead>\n" +
" <tr>\n"
+" <th class=\"tg-0pky\">%s</th>\n"
+" <th class=\"tg-0pky\">%s</th>\n"
+" <th class=\"tg-0pky\">%s</th>\n"//stock
+" <th class=\"tg-0pky\">%s</th>\n"
+" </tr>\n"
+"</thead>"
,M_CODE
,M_NAME
,M_STOCK
,Q_TY
)
:String.format("<thead>\n" +
" <tr>\n" +
" <th class=\"tg-0pky\">%s</th>\n" +
" <th class=\"tg-0pky\">%s</th>\n" +
" <th class=\"tg-0pky\">%s</th>\n" +
" </tr>\n" +
"</thead>"
,M_CODE
,M_NAME
,Q_TY
);
String htmlColGroup=
"<colgroup>\n" +
"<col style=\"width: 96px\">\n" +
"<col style=\"width: 361px\">\n" +
(showStock?"<col style=\"width: 96px\">\n":"") +
"<col style=\"width: 114px\">\n" +
"</colgroup>";
String htmlTable="<table "
+" class=\"tg\" style=\"undefined;table-layout: fixed; width: 571px\""
+">"
+htmlColGroup
+htmlTblheader
+"<tbody>"
+result.stream()
.map(e->
showStock?
String.format(
"<td class=\"tg-0lax\">%s</td>"
+"<td class=\"tg-0lax\">%s</td>"
+"<td class=\"tg-0lax\">%s</td>"
+"<td class=\"tg-dmmf\">%s</td></tr>"
," "+e.getMaterialNumber()
," "+e.getMaterialDescription()
," "+e.getStockId()
,(e.getQtyPacks()<0?0:e.getQtyPacks())+" ") :String.format(
"<td class=\"tg-0lax\">%s</td>"
+"<td class=\"tg-0lax\">%s</td>"
+"<td class=\"tg-dmmf\">%s</td></tr>"
," "+e.getMaterialNumber()
," "+e.getMaterialDescription()
,(e.getQtyPacks()<0?0:e.getQtyPacks())+" ")
)
.collect(Collectors.joining(" \n"))
+"</tbody>"
+"</table>";