Пример #1
0
 private void search() {
   Criteria cr = new Criteria();
   addZoneCriteria(cr, siZones, "zone");
   addZoneCriteria(cr, siCustomerType, "custypeid");
   addZoneCriteria(cr, addrComp.getSiStreet(), "streetid");
   cr.addCriteria("uniq", SC.generateID());
   lgCustomers.fetchData(cr);
 }
Пример #2
0
 public void clearFields() {
   LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
   map.put("-1", "---");
   try {
     siCustomerType.setValueMap(map);
     siCustomerType.setValue("-1");
     addrComp.getSiRegion().setValue("-1");
     addrComp.getSiSubregion().setValueMap(map);
     addrComp.getSiSubregion().setValue("-1");
     addrComp.getSiCity().setValueMap(map);
     addrComp.getSiCity().setValue("-1");
     addrComp.getSiStreet().setValueMap(map);
     addrComp.getSiStreet().setValue("-1");
   } catch (Exception e) {
     // TODO: handle exception
   }
 }
Пример #3
0
  private void creteriaChanged() {
    siZones.setValue((Integer) null);
    Criteria cr = new Criteria();
    addZoneCriteria(cr, addrComp.getSiRegion(), "regionid");
    addZoneCriteria(cr, addrComp.getSiSubregion(), "subregionid");
    addZoneCriteria(cr, addrComp.getSiCity(), "cityid");
    addZoneCriteria(cr, addrComp.getSiStreet(), "streetid");
    cr.addCriteria("uniq", SC.generateID());
    siZones.setOptionCriteria(cr);
    siZones.fetchData(
        new DSCallback() {

          @Override
          public void execute(DSResponse response, Object rawData, DSRequest request) {
            if (response.getData() != null && response.getData().length > 0)
              siZones.setValue(response.getData()[0].getAttributeAsDouble(siZones.getValueField()));
          }
        });
  }
Пример #4
0
 public ArrayList<String> createCriteria() {
   ArrayList<String> criterias = new ArrayList<String>();
   criterias.add("system_id=" + DocFlow.system_id);
   addCriteria(criterias, tiUserName, "user_name='%s'", "");
   addCriteria(criterias, addrComp.getSiRegion(), "regionid=%s", "-1");
   addCriteria(criterias, addrComp.getSiSubregion(), "subregionid=%s", "-1");
   addCriteria(criterias, addrComp.getSiCity(), "cityid=%s", "-1");
   addCriteria(criterias, iiZona, "czona=%s", "");
   addCriteria(criterias, siDocStatus, "doc_status_id=%s", "-1");
   addCriteria(criterias, iiCustomer, "cust_id=%s", "");
   addCriteria(criterias, tiContent, "content_xml like '%%s%'", "");
   addCriteria(criterias, tiDocId, "id::character varying like '%s%'", "");
   addCriteria(criterias, tiCancelary, "cancelary_nom like '%%s%'", "");
   String doctypeFilter = "doc_type_id=" + docTypeId;
   if (docTypeId <= 0) doctypeFilter = "group_id=" + Math.abs(docTypeId);
   criterias.add(doctypeFilter);
   if (!DocFlow.hasPermition(PermissionNames.VIEW_ALL_DOCUMENTS))
     criterias.add("user_id=" + DocFlow.user_id);
   return criterias;
 }
Пример #5
0
  protected void saveData() {

    long zoneId = 0;
    try {
      if (tiNewZone.getValue().toString().length() != CHARCOUNT) throw new Exception();
      zoneId = Long.parseLong(tiNewZone.getValue().toString());
    } catch (Exception e) {
      SC.say(
          "Please enter normal new Zone",
          new BooleanCallback() {

            @Override
            public void execute(Boolean value) {
              tiNewZone.focusInItem();
              tiNewZone.selectValue();
            }
          });
      return;
    }
    if (getItemValue((SelectItem) addrComp.getSiSubregion()) == 0) {
      SC.say("Please enter normal new Sub Region");
      return;
    }
    Record[] recs = lgZoneCustomers.getRecords();
    if (recs == null || recs.length == 0) {
      SC.say("Please add some data!!!");
      return;
    }
    int customerIds[] = new int[recs.length];
    for (int i = 0; i < customerIds.length; i++) {
      customerIds[i] = recs[i].getAttributeAsInt("cusid");
    }
    SplashDialog.showSplash();
    DocFlow.docFlowService.changeZoneToCustomers(
        customerIds,
        zoneId,
        new AsyncCallback<Void>() {

          @Override
          public void onFailure(Throwable caught) {
            SplashDialog.hideSplash();
            SC.say(caught.toString());
          }

          @Override
          public void onSuccess(Void result) {
            search();
            lgZoneCustomers.selectAllRecords();
            lgZoneCustomers.removeSelectedData();
            SplashDialog.hideSplash();
          }
        });
  }
Пример #6
0
  private void setResults(HashMap<String, ArrayList<ClSelectionItem>> result) {
    result = result == null ? new HashMap<String, ArrayList<ClSelectionItem>>() : result;
    addrComp = new AddressComponent(false, true, result.get("" + ClSelection.T_REGION));
    setStatuses();
    addrComp.getSiRegion().setTitle("Region");
    addrComp.getSiSubregion().setTitle("Sub Region");
    addrComp.getSiCity().setTitle("City");
    stDocCount.setTitleOrientation(TitleOrientation.LEFT);
    stDocCount.setRequired(true);
    FormItem[] items =
        new FormItem[] {
          diStart,
          diEnd,
          tiUserName,
          addrComp.getSiRegion(),
          addrComp.getSiSubregion(),
          addrComp.getSiCity(),
          iiZona,
          siDocStatus,
          iiCustomer,
          tiContent,
          tiDocId,
          tiCancelary,
          findItem,
          showStatusItem,
          bashConfirm,
          stDocCount
        };
    // if (showStatusItem != null) {
    // FormItem[] itemsTmp = new FormItem[items.length + 1];
    // for (int i = 0; i < items.length; i++) {
    // itemsTmp[i] = items[i];
    // }
    // itemsTmp[items.length] = showStatusItem;
    // items = itemsTmp;
    // }
    setFields(items);
    // showStatusItem.hide();
    // if (!DocFlow.hasPermition("CAN_SEE_STATUSES")) {
    // showStatusItem.hide();
    // }

  }
Пример #7
0
 private void setZoneValue() {
   int regionId = getItemValue(addrComp.getSiRegion());
   int subRegionId = getItemValue(addrComp.getSiSubregion());
   setNewZone(regionId, subRegionId);
 }
Пример #8
0
  private void setResults(HashMap<String, ArrayList<ClSelectionItem>> result) {
    result = result == null ? new HashMap<String, ArrayList<ClSelectionItem>>() : result;
    addrComp = new AddressComponent(true, true, result.get("" + ClSelection.T_REGION));
    setSelectItems(siCustomerType, result.get("" + ClSelection.T_CUST_TYPE));

    addrComp.getSiRegion().setTitle("Region");
    addrComp.getSiSubregion().setTitle("Sub Region");
    addrComp.getSiCity().setTitle("City");
    addrComp.getSiStreet().setTitle("Street");
    biSaveData.setStartRow(false);
    biSaveData.setEndRow(false);
    FormItem[] items =
        new FormItem[] {
          addrComp.getSiRegion(),
          addrComp.getSiSubregion(),
          addrComp.getSiCity(),
          addrComp.getSiStreet(),
          siZones,
          siCustomerType,
          tiNewZone,
          biSaveData
        };
    dmCriteria.setFields(items);

    ChangedHandler addressChange =
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {

            if (event.getItem().equals(addrComp.getSiRegion())
                || event.getItem().equals(addrComp.getSiSubregion())) {
              setZoneValue();
            }

            creteriaChanged();
          }
        };

    addrComp.getSiRegion().addChangedHandler(addressChange);
    addrComp.getSiSubregion().addChangedHandler(addressChange);
    addrComp.getSiCity().addChangedHandler(addressChange);
    addrComp.getSiStreet().addChangedHandler(addressChange);

    Criteria cr = new Criteria();
    addZoneCriteria(cr, addrComp.getSiRegion(), "regionid");
    cr.addCriteria("uniq", SC.generateID());
    siZones.setOptionCriteria(cr);
    setZoneValue();

    biSaveData.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {

          @Override
          public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
            saveData();
          }
        });
  }