コード例 #1
0
  protected void mergeItem() {
    if (fromClientItem != null && toClientItem != null) {
      if (fromClientItem.getID() == toClientItem.getID()) {}
    }
    if (fromClientItem.getType() != toClientItem.getType()) {
      Accounter.showError(messages.bothItemsMustBelongsTheSameType());
    } else {
      Accounter.createHomeService()
          .mergeItem(
              fromClientItem,
              toClientItem,
              new AccounterAsyncCallback<Void>() {

                @Override
                public void onException(AccounterException exception) {
                  Accounter.showError(exception.getMessage());
                }

                @Override
                public void onResultSuccess(Void result) {
                  onClose();
                }
              });
    }
  }
コード例 #2
0
 private void customerSelected1(ClientItem selectItem) {
   status1.setValue(selectItem.isActive());
   if (selectItem.getType() == 1) {
     itemType1.setValue(messages.service());
   } else if (selectItem.getType() == 3) {
     itemType1.setValue(messages.product());
   }
   price1.setValue(String.valueOf(selectItem.getSalesPrice()));
 }
コード例 #3
0
 private void filterItems() {
   ArrayList<ClientItem> items = getCompany().getItems();
   ArrayList<ClientItem> result = new ArrayList<ClientItem>();
   for (ClientItem item : items) {
     if (item.getType() == ClientItem.TYPE_INVENTORY_PART
         || item.getType() == ClientItem.TYPE_INVENTORY_ASSEMBLY) {
       if (isActiveItems == item.isActive()) {
         result.add(item);
       }
     }
   }
   listOfItems = result;
 }
コード例 #4
0
  @Override
  public void onEdit() {
    if (selectedItem.getType() == ClientItem.TYPE_INVENTORY_ASSEMBLY) {
      InventoryActions inventoryAssemblyAction = InventoryActions.newAssembly();
      inventoryAssemblyAction.setisItemEditable(true);
      inventoryAssemblyAction.run((ClientInventoryAssembly) selectedItem, false);

    } else {
      NewItemAction itemAction = new NewItemAction(true);
      itemAction.setType(selectedItem.getType());
      itemAction.setisItemEditable(true);
      itemAction.run(selectedItem, false);
    }
  }
コード例 #5
0
 @Override
 public HashMap<String, Object> saveView() {
   HashMap<String, Object> map = new HashMap<String, Object>();
   map.put("activeInActive", activeInActiveSelect.getSelectedValue());
   map.put("currentView", trasactionViewSelect.getSelectedValue());
   map.put("transactionType", trasactionViewTypeSelect.getSelectedValue());
   map.put("dateRange", dateRangeSelector.getSelectedValue());
   map.put("selectedItem", selectedItem == null ? "" : selectedItem.getName());
   map.put("itemSelection", itemsListGrid.getSelection());
   return map;
 }
コード例 #6
0
  private void onItemSelected() {

    itemDetailsPanel.showItemDetails(selectedItem);
    if (Accounter.isIpadApp()) {
      rightVpPanel.add(transactionButton);
      transactionButton.setText(messages2.transactionListFor(selectedItem.getDisplayName()));
    }
    transactionHistoryGrid.setSelectedItem(selectedItem);
    MainFinanceWindow.getViewManager().updateButtons();
    callRPC(0, 25);
  }
コード例 #7
0
  @Override
  public void restoreView(HashMap<String, Object> map) {

    if (map == null || map.isEmpty()) {
      return;
    }
    String activeInactive = (String) map.get("activeInActive");
    activeInActiveSelect.setComboItem(activeInactive);
    if (activeInactive.equalsIgnoreCase(messages.active())) {
      refreshActiveinactiveList(true);
    } else {
      refreshActiveinactiveList(false);
    }

    String currentView = (String) map.get("currentView");
    trasactionViewSelect.setComboItem(currentView);
    if (currentView != null) {
      getMessagesList();
    }

    String transctionType = (String) map.get("transactionType");
    trasactionViewTypeSelect.setComboItem(transctionType);

    String dateRange1 = (String) map.get("dateRange");
    dateRangeSelector.setComboItem(dateRange1);
    if (dateRange1 != null) {
      dateRangeChanged(dateRange1);
    }
    ClientItem object = (ClientItem) map.get("itemSelection");
    itemsListGrid.setSelection(object);

    String customer = (String) map.get("selectedItem");

    if (customer != null && !(customer.isEmpty())) {
      selectedItem = getCompany().getItemByName(customer);
    }
    if (this.selectedItem != null) {
      itemsListGrid.setSelectedItem(selectedItem);

      selectedItem = Accounter.getCompany().getItem(selectedItem.getID());

      onItemSelected();
    } else {
      callRPC(0, getPageSize());
    }
  }
コード例 #8
0
  protected void callRPC(int start, int length) {
    transactionHistoryGrid.removeAllRecords();
    records = new ArrayList<TransactionHistory>();
    if (selectedItem != null) {
      Accounter.createHomeService()
          .getItemTransactionsList(
              selectedItem.getID(),
              getTransactionType(),
              getTransactionStatusType(),
              startDate,
              endDate,
              start,
              length,
              new AsyncCallback<PaginationList<TransactionHistory>>() {

                @Override
                public void onFailure(Throwable caught) {
                  Accounter.showError(messages.unableToPerformTryAfterSomeTime());
                }

                @Override
                public void onSuccess(PaginationList<TransactionHistory> result) {
                  records = result;
                  selectedItem = getCompany().getItem(selectedItem.getID());
                  transactionHistoryGrid.setSelectedItem(selectedItem);
                  itemDetailsPanel.showItemDetails(selectedItem);
                  transactionHistoryGrid.removeAllRecords();
                  if (records != null) {
                    transactionHistoryGrid.addRecords(records);
                  }
                  updateRecordsCount(result.getStart(), result.size(), result.getTotalCount());
                  if (records.size() == 0) {
                    transactionHistoryGrid.addEmptyMessage(
                        messages.thereAreNo(messages.transactions()));
                  }
                }
              });

    } else {
      transactionHistoryGrid.removeAllRecords();
      transactionHistoryGrid.addEmptyMessage(messages.thereAreNo(messages.transactions()));
    }
  }
コード例 #9
0
 public ValidationResult validate() {
   ValidationResult result = form.validate();
   result.add(form1.validate());
   if (fromClientItem != null && toClientItem != null) {
     if (fromClientItem.getID() == toClientItem.getID()) {
       result.addError(fromClientItem, messages.notMove(messages.items()));
     }
     if (fromClientItem.getType() != toClientItem.getType()) {
       result.addError(fromClientItem, messages.typesMustbeSame(messages.items()));
     }
     if (fromClientItem.getMeasurement() != toClientItem.getMeasurement()) {
       result.addError(fromClientItem, messages2.measurementMustBeSame(messages.items()));
     }
     return result;
   }
   return result;
 }
コード例 #10
0
 @Override
 public boolean canEdit() {
   return selectedItem == null
       ? false
       : Utility.isUserHavePermissions(selectedItem.getObjectType());
 }