@Override public void renderEntityList() { try { AbsEnt title = getFabric().get("div"); title.setValue("Типы задач"); AbsEnt data = div("float:left;width:100%;", ""); AbsEnt table = getFabric().get("table"); // добавление AbsEnt add = simpleAddForm(objectName, null); data.addEnt(renderError(objectName)); data.addEnt(renderMessage(objectName)); data.addEnt(getAddForm()); data.addEnt(table); for (DinamicModel dm : getAr().getDinamicArrayList()) { AbsEnt tr = getFabric().get("tr"); table.addEnt(tr); AbsEnt td = getFabric().get("td"); tr.addEnt(td); AbsEnt td1 = getFabric().get("td"); td1.addEnt( getChangeForm( dm.get("task_type_id"), dm.get("name"), dm.get("showInLinks"), dm.get("daysToDead"))); tr.addEnt(td1); AbsEnt td2 = getFabric().get("td"); tr.addEnt(td2); Map<String, Object> mp = new HashMap<String, Object>(); mp.put("task_type_id", dm.get("task_type_id")); AbsEnt form = simpleDeleteForm(objectName, mp); td2.addEnt(form); AbsEnt td3 = getFabric().get("td"); HrefOptionInterface ho = getHrefOption(objectName, "showOne", "", "Изменить этапы"); AbsEnt href = href(mp, ho); td3.addEnt(href); tr.addEnt(td3); } AbsEnt Mw = moduleWindow(objectName, title, data, false); Mw.setAttribute(EnumAttrType.style, "margin-top:5px;"); addRenderResult(Mw.render()); } catch (Exception ex) { registerException(ex); } }
/** просмотр одного */ @Override public void renderOneEntity() { try { AbsEnt data = div("", "", "profile", null); AbsEnt title = div("div", ""); title.setValue("Тип задач"); if (!getAr().getDinamicArrayList().isEmpty()) { DinamicModel dm = getAr().getDinamicArrayList().get(0); data.addEnt(renderParameter("Название: ", dm.get("name"))); data.addEnt(div("", "{task_type_step:search}")); addRenderResult(moduleWindow(objectName, title, data, false).render()); } } catch (Exception ex) { registerException(ex); } }
@Override public void renderEntityList() { try { AbsEnt title = getFabric().get("div"); title.setValue("Настройка продлений"); AbsEnt data = div("float:left;width:100%;", ""); AbsEnt table = getFabric().get("table"); // добавление AbsEnt add = simpleAddForm(ObjectName, null); data.addEnt(renderError(ObjectName)); data.addEnt(renderMessage(ObjectName)); data.addEnt(getAddForm()); data.addEnt(table); for (DinamicModel dm : getAr().getDinamicArrayList()) { AbsEnt tr = getFabric().get("tr"); table.addEnt(tr); AbsEnt td = getFabric().get("td"); tr.addEnt(td); AbsEnt td1 = getFabric().get("td"); td1.addEnt(getChangeForm(dm.get("prolongOption_id"), dm.get("user_id"), dm.get("number"))); tr.addEnt(td1); AbsEnt td2 = getFabric().get("td"); tr.addEnt(td2); Map<String, Object> mp = new HashMap<String, Object>(); mp.put("prolongOption_id", dm.get("prolongOption_id")); AbsEnt form = simpleDeleteForm(ObjectName, mp); td2.addEnt(form); } AbsEnt Mw = moduleWindow(ObjectName, title, data, false); Mw.setAttribute(EnumAttrType.style, "margin-top:5px;"); addRenderResult(Mw.render()); } catch (Exception ex) { registerException(ex); } }
/** новый отчет */ public void report() { try { // отсортировать по пользователям и по типам Map<String, Day> days = new LinkedHashMap(); List<String> types = new ArrayList(); Map<String, Integer> sumMap = new LinkedHashMap(); int totalSumm = 0; for (DinamicModel model : getAr().getDinamicArrayList()) { if (model.get("insert_user_id") != null && model.get("manager_phone_id") != null && model.get("date") != null) { String date = model.get("date").toString(); if (!days.containsKey(date)) { days.put(date, new Day()); } Day day = days.get(date); day.add(model.get("insert_user_id"), model.get("manager_phone_id"), model.get("count")); String type = model.get("manager_phone_id").toString(); if (!types.contains(type)) { types.add(type); } } } AbsEnt title = div("float:left;", "Отчет по звонкам"); AbsEnt data = div("float:left;", ""); data.addEnt(renderError(ObjectName)); data.addEnt(renderMessage(ObjectName)); data.addEnt(getFormReport()); AbsEnt table = getFabric().get("table"); table.setAttribute(EnumAttrType.border, "1"); table.setAttribute(EnumAttrType.cellpadding, "5"); table.setAttribute(EnumAttrType.cellspacing, "5"); if (!types.isEmpty()) { // заголовок таблицы AbsEnt th1 = getFabric().get("th"); AbsEnt tr1 = getFabric().get("tr").addEnt(th1); table.addEnt(tr1); th1.setValue("Пользователь"); for (String type : types) { String name = comboLikeString("managerPhones", "findActive", type); tr1.addEnt(getFabric().get("th").setValue(name)); } tr1.addEnt(getFabric().get("th").setValue("Всего")); // по дням for (String date : days.keySet()) { Map<String, Integer> summMapDay = new LinkedHashMap(); Integer summDay = 0; Day day = days.get(date); AbsEnt tdDay = getFabric().get("td"); AbsEnt trDay = getFabric().get("tr").addEnt(tdDay); table.addEnt(trDay); Integer colspan = types.size() + 2; tdDay.setAttribute(EnumAttrType.colspan, colspan.toString()); date = dateFormat(date, getRenderConstant().DT_SMALL); tdDay.setValue("Дата: " + date); tdDay.setAttribute(EnumAttrType.style, "font-weight: bold;"); Map<String, User> users = day.getUsers(); // строки по пользователям for (String userId : users.keySet()) { User user = users.get(userId); String userName = comboLikeString("userProfile", "getAllWithComboName", userId); AbsEnt td1 = getFabric().get("td"); AbsEnt tr = getFabric().get("tr"); table.addEnt(tr.addEnt(td1)); td1.setValue(userName); for (String type : types) { Integer count = user.getCount(type); if (count == null) { count = 0; } AbsEnt td = getFabric().get("td"); tr.addEnt(td); td.setValue(count); // сложить сумму if (!sumMap.containsKey(type)) { sumMap.put(type, 0); } if (!summMapDay.containsKey(type)) { summMapDay.put(type, 0); } sumMap.put(type, sumMap.get(type) + count); summMapDay.put(type, summMapDay.get(type) + count); } int summ = user.getSumm(); totalSumm += summ; summDay += summ; AbsEnt td2 = getFabric().get("td"); td2.setValue(summ); tr.addEnt(td2); } // строка с суммой по дню AbsEnt tr2 = getFabric().get("tr"); table.addEnt(tr2); tr2.setAttribute(EnumAttrType.style, "font-weight: bold;"); AbsEnt td1 = getFabric().get("td"); tr2.addEnt(td1); td1.setValue("Всего за день:"); for (Integer summ : summMapDay.values()) { AbsEnt td = getFabric().get("td"); tr2.addEnt(td); td.setValue(summ); } AbsEnt td2 = getFabric().get("td"); tr2.addEnt(td2); td2.setValue(summDay); } // строка с итоговой суммой AbsEnt tr2 = getFabric().get("tr"); table.addEnt(tr2); tr2.setAttribute(EnumAttrType.style, "font-weight: bold;"); AbsEnt td1 = getFabric().get("td"); tr2.addEnt(td1); td1.setValue("Всего"); for (Integer summ : sumMap.values()) { AbsEnt td = getFabric().get("td"); tr2.addEnt(td); td.setValue(summ); } AbsEnt td2 = getFabric().get("td"); tr2.addEnt(td2); td2.setValue(totalSumm); } data.addEnt(table); AbsEnt Mw = moduleWindow(ObjectName, title, data, false); Mw.setAttribute(EnumAttrType.style, "margin-top:5px;"); addRenderResult(Mw.render()); } catch (Exception e) { registerException(e); } }