private void previewReport() { String result = ""; String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue(); String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue(); QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId()); if( form.lyrAdviceMobility().tabAdvice().grdAdviceLeflet().getSelectedRow().getValue() instanceof AdviceLeafletConfigDisplayVo) { result = previewAdviceLeafletReport(form.lyrAdviceMobility().tabAdvice().grdAdviceLeflet().getSelectedRow().getValue(), urlReportServer, client); } if(result != "") { engine.openUrl(result); } }
private void populateAdviceLeaflets(AdviceLeafletConfigDisplayVoCollection adviceLeaflets) { // Clear advice leaflet grid form.lyrAdviceMobility().tabAdvice().grdAdviceLeflet().getRows().clear(); // Check advice collection parameter if (adviceLeaflets == null) return; for (AdviceLeafletConfigDisplayVo advice : adviceLeaflets) { ims.emergency.forms.dischargeplanning_advicemobilityequipment.GenForm.lyrAdviceMobilityLayer.tabAdviceContainer.grdAdviceLefletRow row = form.lyrAdviceMobility().tabAdvice().grdAdviceLeflet().getRows().newRow(); row.setColAdvice(advice.getTemplate().getName()); row.setColSelect(false); row.setColumnGiven(isAdiceLeafletsPrinted(advice,form.getLocalContext().getRecord(),row)); row.setValue(advice); } }
private boolean isAdiceLeafletsPrinted(AdviceLeafletConfigDisplayVo advice, DischargeServicesAndAdviceForDischargePlanningVo record,ims.emergency.forms.dischargeplanning_advicemobilityequipment.GenForm.lyrAdviceMobilityLayer.tabAdviceContainer.grdAdviceLefletRow row) { if( advice == null ) return false; if( record == null || !record.getAdviceLeafletsPrintedIsNotNull() || record.getAdviceLeafletsPrinted().size() == 0) return false; for( int i = 0 ; i < record.getAdviceLeafletsPrinted().size();i++) { if( advice.getTemplateIsNotNull() && record.getAdviceLeafletsPrinted().get(i).getTemplateIsNotNull()) { if( advice.getTemplate().getID_TemplateBo().equals(record.getAdviceLeafletsPrinted().get(i).getTemplate().getID_TemplateBo())) { row.setCellColumnGivenTooltip("Given Date: " + record.getAdviceLeafletsPrinted().get(i).getDateGiven().toString()+ ", Authoring HCP: "+ record.getAdviceLeafletsPrinted().get(i).getAuthoringHCP().getName().toString()); return true; } } } return false; }
/** * Function used to populate the Advice Leaflets */ private void populateAdviceLeaflets(AdviceLeafletConfigDisplayVoCollection adviceLeaflets) { // Clear advice leaflet grid form.grdAdviceLeflet().getRows().clear(); // Check advice collection parameter if (adviceLeaflets == null) return; for (AdviceLeafletConfigDisplayVo advice : adviceLeaflets) { grdAdviceLefletRow row = form.grdAdviceLeflet().getRows().newRow(); row.setColAdvice(advice.getTemplate().getName()); row.setColSelect(false); row.setValue(advice); } }
private boolean isPrePrintedAdviceLeafletGiven(AdviceLeafletConfigDisplayVo advice, DischargeServicesAndAdviceForDischargePlanningVo record,ims.emergency.forms.dischargeplanning_advicemobilityequipment.GenForm.lyrAdviceMobilityLayer.tabAdviceContainer.grdAdviceLefletRow row) { if( advice == null ) return false; if( record == null || record.getPrePrintedAdviceLeafletsGiven()==null || record.getPrePrintedAdviceLeafletsGiven().size() == 0) return false; for( int i = 0 ; i < record.getPrePrintedAdviceLeafletsGiven().size();i++) { if( advice.getAdviceLeafletNameIsNotNull()&& record.getPrePrintedAdviceLeafletsGiven().get(i).getAdviceLeafletNameIsNotNull()) { if( advice.getAdviceLeafletName().equals(record.getPrePrintedAdviceLeafletsGiven().get(i).getAdviceLeafletName())) { if (row!=null) { row.setCellColumnGivenTooltip("Given Date: " + record.getPrePrintedAdviceLeafletsGiven().get(i).getDateGiven().toString()+ ", Authoring HCP: "+ record.getPrePrintedAdviceLeafletsGiven().get(i).getAuthoringHCP().getName().toString()); } return true; } } } return false; }
private AdviceLeafletConfigDisplayVo getTemplate() { for(int i = 0;i < form.lyrAdviceMobility().tabAdvice().grdAdviceLeflet().getRows().size();i++) { if( form.lyrAdviceMobility().tabAdvice().grdAdviceLeflet().getRows().get(i).getColSelect() == true ) return form.lyrAdviceMobility().tabAdvice().grdAdviceLeflet().getRows().get(i).getValue(); } return null; }
private void printSelectedAdviceLeaflets() { try { // Get selected advice leaflets AdviceLeafletConfigDisplayVoCollection selectedAdviceLeaflets = new AdviceLeafletConfigDisplayVoCollection(); for (int i = 0; i < form.grdAdviceLeflet().getRows().size(); i++) { grdAdviceLefletRow adviceRow = form.grdAdviceLeflet().getRows().get(i); if (adviceRow.getColSelect()) selectedAdviceLeaflets.add(adviceRow.getValue()); } // For each selected advice leaflet for (AdviceLeafletConfigDisplayVo adviceLeaflet : selectedAdviceLeaflets) { // Get Report and Template from database String report[] = domain.getReportAndTemplate(adviceLeaflet.getTemplate()); // Check for valid report and template if (report == null) { engine.showMessage("No report found for selected advice leaflet"); return; } // Create a query builder client instance QueryBuilderClient client = new QueryBuilderClient(ConfigFlag.GEN.QUERY_SERVER_URL.getValue(), engine.getSessionId()); // Attempt to build report and print it to printer String printerName = form.getGlobalContext().Admin.getSelectedPrinter() != null ? form.getGlobalContext().Admin.getSelectedPrinter().getIPrinterName() : null; client.buildReport(report[0], report[1], ConfigFlag.GEN.REPORT_SERVER_URL.getValue(), "PDF", printerName, 1); } } catch (QueryBuilderClientException exception) { exception.printStackTrace(); } }
public int compare(Object ob1, Object ob2) { String name1 = null; String name2 = null; if(ob1 instanceof AdviceLeafletConfigDisplayVo ) { AdviceLeafletConfigDisplayVo advLeaflet1 = (AdviceLeafletConfigDisplayVo)ob1; if (advLeaflet1.getTemplateIsNotNull()) name1=advLeaflet1.getTemplate().getName(); else name1 = advLeaflet1.getAdviceLeafletName(); } if(ob2 instanceof AdviceLeafletConfigDisplayVo) { AdviceLeafletConfigDisplayVo advLeaflet2 = (AdviceLeafletConfigDisplayVo)ob2; if (advLeaflet2.getTemplateIsNotNull()) name2=advLeaflet2.getTemplate().getName(); else name2 = advLeaflet2.getAdviceLeafletName(); } if(name1 != null ) return name1.compareTo(name2)*direction; if(name2 != null) return (-1)*direction; return 0; }
private void populateAdviceLeaflets(AdviceLeafletConfigDisplayVoCollection adviceLeaflets) { // Clear advice leaflet grid form.lyrAdviceMobility().tabAdvice().grdAdviceLeflet().getRows().clear(); // Check advice collection parameter if (adviceLeaflets == null) return; adviceLeaflets.sort(new AdviceLeafletComparator(SortOrder.ASCENDING)); //WDEV-20437 for (AdviceLeafletConfigDisplayVo advice : adviceLeaflets) { ims.emergency.forms.dischargeplanning_advicemobilityequipment.GenForm.lyrAdviceMobilityLayer.tabAdviceContainer.grdAdviceLefletRow row = form.lyrAdviceMobility().tabAdvice().grdAdviceLeflet().getRows().newRow(); row.setColAdvice(advice.getTemplate()!=null ? advice.getTemplate().getName() : advice.getAdviceLeafletName()); //WDEV-20437 row.setCellColAdviceTooltip(advice.getTemplate()!=null ? advice.getTemplate().getName() : advice.getAdviceLeafletName()); //WDEV-20437 row.setColSelect(false); //WDEV-20437 if (advice.getTemplate()!=null) { row.setColumnGiven(isAdiceLeafletsPrinted(advice,form.getLocalContext().getRecord(),row)); row.setColumnGivenReadOnly(true); } else { boolean isPrePrintedGiven = isPrePrintedAdviceLeafletGiven(advice,form.getLocalContext().getRecord(),row); row.setColumnGiven(isPrePrintedGiven); row.setColumnGivenReadOnly(isPrePrintedGiven); } if (advice.getTemplate()==null) //WDEV-20437 { row.setCellColSelectTooltip("This is Pre-Printed Advice Leaflet and cannot be printed. "); row.setColSelectReadOnly(true); } row.setValue(advice); } }