Example #1
0
    private void createMandanten() {

      Mandant mandant = new Mandant("Mandant.tarmed", "Mandant.tarmed", "01.01.1900", "w");
      mandant.setLabel("mt");

      TarmedACL ta = TarmedACL.getInstance();
      mandant.setExtInfoStoredObjectByKey("Anrede", "Frau");
      mandant.setExtInfoStoredObjectByKey("Kanton", "AG");

      mandant.addXid(Xid.DOMAIN_EAN, "2000000000002", true);
      // make sure somains are registered
      TarmedRequirements.getEAN(mandant);

      mandant.addXid(TarmedRequirements.DOMAIN_KSK, "C000002", true);

      mandant.setExtInfoStoredObjectByKey(ta.ESR5OR9, "esr9");
      mandant.setExtInfoStoredObjectByKey(ta.ESRPLUS, "esr16or27");
      mandant.setExtInfoStoredObjectByKey(ta.LOCAL, "praxis");
      mandant.setExtInfoStoredObjectByKey(ta.KANTON, "AG");
      mandant.setExtInfoStoredObjectByKey(ta.SPEC, "Allgemein");
      mandant.setExtInfoStoredObjectByKey(ta.TIERS, "payant");

      mandant.setExtInfoStoredObjectByKey(ta.ESRNUMBER, "01-12648-2");
      mandant.setExtInfoStoredObjectByKey(ta.ESRSUB, "15453");

      mandanten.add(mandant);

      CoreHub.setMandant(mandant);
    }
  private void loadArticlesUsedOnSelectedDay() {
    String date =
        dtDate.getYear()
            + String.format("%02d", dtDate.getMonth() + 1)
            + String.format("%02d", dtDate.getDay());

    Query<Konsultation> qbe = new Query<Konsultation>(Konsultation.class);
    qbe.add(Konsultation.FLD_DATE, Query.EQUALS, date);
    List<Konsultation> cons = qbe.execute();

    StringBuilder sb = new StringBuilder();

    for (Konsultation c : cons) {
      List<Verrechnet> leistungen = c.getLeistungen();
      for (Verrechnet v : leistungen) {
        IVerrechenbar vv = v.getVerrechenbar();
        if (vv instanceof Artikel) {
          Artikel art = (Artikel) vv;
          Mandant mandator = ElexisEventDispatcher.getSelectedMandator();
          IStockEntry stockEntry =
              CoreHub.getStockService()
                  .findPreferredStockEntryForArticle(
                      art.storeToString(), (mandator != null) ? mandator.getId() : null);
          if (stockEntry != null) {
            StockEntry se = (StockEntry) stockEntry;
            currOrder.addBestellungEntry(
                se.getArticle(), se.getStock(), se.getProvider(), v.getZahl());
          } else {
            sb.append(art.getLabel() + " ist kein Lagerartikel.\n");
          }
        }
      }
    }
  }
  @Override
  protected Control createContents(Composite parent) {
    init();
    Composite comp = new Composite(parent, SWT.None);
    comp.setLayout(new GridLayout(2, false));

    Label lblNewLabel = new Label(comp, SWT.NONE);
    lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblNewLabel.setText("Strasse");

    textStrasse = new Text(comp, SWT.BORDER);
    textStrasse.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textStrasse.setTextLimit(80);

    Label lblPostleitzahl = new Label(comp, SWT.NONE);
    lblPostleitzahl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblPostleitzahl.setText("Postleitzahl");

    textPostleitzahl = new Text(comp, SWT.BORDER);
    textPostleitzahl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textPostleitzahl.setTextLimit(6);

    Label lblOrtschaft = new Label(comp, SWT.NONE);
    lblOrtschaft.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblOrtschaft.setText("Ortschaft");

    textOrtschaft = new Text(comp, SWT.BORDER);
    textOrtschaft.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textOrtschaft.setTextLimit(50);

    Label lblLand = new Label(comp, SWT.NONE);
    lblLand.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblLand.setText("Land");

    TableComboViewer countryComboViewer = new TableComboViewer(comp);
    tableCombo = countryComboViewer.getTableCombo();
    tableCombo.setTableWidthPercentage(90);
    tableCombo.setShowFontWithinSelection(false);
    tableCombo.setShowColorWithinSelection(false);
    tableCombo.setShowTableLines(false);
    tableCombo.setShowTableHeader(false);
    tableCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    countryComboViewer.setLabelProvider(new CountryComboLabelProvider());
    countryComboViewer.setContentProvider(new ArrayContentProvider());
    String[] items = new String[] {"CH", "FL", "AT", "DE", "FR", "IT"};
    countryComboViewer.setInput(items);

    super.setTitle(pat.getLabel());
    textStrasse.setText(pat.get(Patient.FLD_STREET));
    textPostleitzahl.setText(pat.get(Patient.FLD_ZIP));
    textOrtschaft.setText(pat.get(Patient.FLD_PLACE));
    String country = pat.get(Patient.FLD_COUNTRY).trim();
    for (int i = 0; i < items.length; i++) {
      if (country.equalsIgnoreCase(items[i])) {
        countryComboViewer.setSelection(new StructuredSelection(items[i]), true);
      }
    }

    setUnlocked(CoreHub.getLocalLockService().isLocked(pat));

    return comp;
  }