コード例 #1
0
  @Override
  public ValidationResult validate() {
    ValidationResult result = super.validate();

    if (AccounterValidator.isInPreventPostingBeforeDate(this.transactionDate)) {
      result.addError(transactionDateItem, messages.invalidateDate());
    }

    result.add(payForm.validate());

    if (!AccounterValidator.isPositiveAmount(amountText.getAmount())) {
      amountText.textBox.addStyleName("highlightedFormItem");
      result.addError(amountText, messages.valueCannotBe0orlessthan0(messages.amount()));
    }
    ClientAccount bankAccount = depositInCombo.getSelectedValue();
    // check if the currency of accounts is valid or not
    if (bankAccount != null) {
      ClientCurrency bankCurrency = getCurrency(bankAccount.getCurrency());
      ClientCurrency customerCurrency = getCurrency(customer.getCurrency());
      if (bankCurrency != getBaseCurrency() && bankCurrency != customerCurrency) {
        result.addError(depositInCombo, messages.selectProperBankAccount());
      }
    }
    return result;
  }
コード例 #2
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;
 }
コード例 #3
0
  private void createControls() {
    Label lab1 = new Label(messages.mergeItems());
    lab1.setStyleName("label-title");

    form = new DynamicForm("form");
    form1 = new DynamicForm("form1");
    StyledPanel layout = new StyledPanel("layout");
    StyledPanel layout1 = new StyledPanel("layout1");
    StyledPanel horizontalPanel = new StyledPanel("horizontalPanel");
    itemCombo = createItemCombo();
    itemCombo1 = createItemCombo1();

    status = new CheckboxItem(messages.active(), "status");
    status.setValue(false);

    status1 = new CheckboxItem(messages.active(), "status1");
    status1.setValue(false);

    itemType = new TextItem(messages.itemType(), "itemType");
    itemType.setEnabled(false);

    itemType1 = new TextItem(messages.itemType(), "itemType1");
    itemType1.setEnabled(false);

    price = new TextItem(messages.salesPrice(), "price");
    price.setEnabled(false);

    price1 = new TextItem(messages.salesPrice(), "price1");
    price1.setEnabled(false);

    form.add(itemCombo, itemType, status, price);
    form1.add(itemCombo1, itemType1, status1, price1);
    // form.setItems(getTextItems());
    layout.add(form);
    layout1.add(form1);
    horizontalPanel.add(lab1);
    horizontalPanel.add(layout);
    horizontalPanel.add(layout1);
    this.add(horizontalPanel);
  }
コード例 #4
0
  private void creatControls() {

    StyledPanel mainPanel = new StyledPanel("customerCenter");

    StyledPanel leftVpPanel = new StyledPanel("leftPanel");

    viewTypeCombo();
    DynamicForm viewform = new DynamicForm("viewform");
    viewform.setStyleName("filterPanel");
    viewform.add(activeInActiveSelect);
    leftVpPanel.add(viewform);
    custGrid = new CustomersListGrid();
    custGrid.init();
    initCustomersListGrid();
    leftVpPanel.add(custGrid);

    custGrid.setStyleName("cusotmerCentrGrid");

    rightVpPanel = new StyledPanel("rightPanel");
    dummyPanel = new StyledPanel("dummyPanel");

    detailsPanel = new CustomerDetailsPanel(selectedCustomer);
    rightVpPanel.add(detailsPanel);
    custGrid.setCustomerSelectionListener(
        new CustomerSelectionListener() {
          @Override
          public void cusotmerSelected() {
            OncusotmerSelected();
          }
        });
    transactionViewSelectCombo();
    transactionViewTypeSelectCombo();
    transactionDateRangeSelector();
    DynamicForm transactionViewform = new DynamicForm("transactionViewform");

    transactionViewform.add(trasactionViewSelect, trasactionViewTypeSelect, dateRangeSelector);

    transactionGridpanel = new StyledPanel("transactionGridpanel");
    transactionGridpanel.add(transactionViewform);
    custHistoryGrid =
        new CustomerTransactionsHistoryGrid() {
          @Override
          public void initListData() {
            OncusotmerSelected();
          }
        };
    custHistoryGrid.init();
    custHistoryGrid.addEmptyMessage(messages.pleaseSelectAnyPayee(Global.get().Customer()));
    int pageSize = getPageSize();
    custHistoryGrid.addRangeChangeHandler2(
        new Handler() {

          @Override
          public void onRangeChange(RangeChangeEvent event) {
            onPageChange(event.getNewRange().getStart(), event.getNewRange().getLength());
          }
        });
    SimplePager pager =
        new SimplePager(
            TextLocation.CENTER,
            (Resources) GWT.create(Resources.class),
            false,
            pageSize * 2,
            true);
    pager.setDisplay(custHistoryGrid);
    updateRecordsCount(0, 0, 0);

    if (Accounter.isIpadApp()) {

      transactionButton = new Button(messages.transaction());
      transactionButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              ActionFactory.getCustomerTransactionListHistory(selectedCustomer).run();
            }
          });

    } else {
      dummyPanel.add(transactionGridpanel);
      dummyPanel.add(custHistoryGrid);
      dummyPanel.add(pager);
    }
    rightVpPanel.add(dummyPanel);
    Label labelTitle = new Label(messages.customerCentre(Global.get().Customer()));
    labelTitle.setStyleName("label-title");

    mainPanel.add(leftVpPanel);
    mainPanel.add(rightVpPanel);
    deleteButtonPanel = new StyledPanel("deleteButtonPanel");
    add(labelTitle);
    add(deleteButtonPanel);
    add(mainPanel);
  }
コード例 #5
0
  private void createControls() {
    StyledPanel mainPanel = new StyledPanel("mainPanel");
    StyledPanel leftVpPanel = new StyledPanel("leftVpPanel");
    viewTypeCombo();
    DynamicForm viewform = new DynamicForm("viewform");
    viewform.add(activeInActiveSelect);
    leftVpPanel.add(viewform);
    itemsListGrid = new InventoryCentreItemsListGrid();
    itemsListGrid.init();
    initItemsListGrid();
    leftVpPanel.add(itemsListGrid);

    itemsListGrid.setStyleName("cusotmerCentrGrid");

    rightVpPanel = new StyledPanel("rightVpPanel");
    dummyPanel = new StyledPanel("dummyPanel");
    itemDetailsPanel = new ItemDetailsPanel(selectedItem);
    rightVpPanel.add(itemDetailsPanel);
    itemsListGrid.setItemSelectionListener(
        new ItemSelectionListener() {

          @Override
          public void itemSelected(ClientItem selectedItem) {
            InventoryCentreView.this.selectedItem = selectedItem;
            onItemSelected();
          }
        });
    transactionViewSelectCombo();
    transactionViewTypeSelectCombo();
    transactionDateRangeSelector();
    DynamicForm transactionViewform = new DynamicForm("viewform");

    transactionViewform.add(trasactionViewSelect, trasactionViewTypeSelect, dateRangeSelector);

    transactionGridpanel = new StyledPanel("transactionGridpanel");
    transactionGridpanel.add(transactionViewform);
    transactionHistoryGrid =
        new ItemTransactionsHistoryGrid() {
          @Override
          public void initListData() {

            onItemSelected();
          }

          @Override
          protected String[] setHeaderStyle() {
            return new String[] {"date", "type", "no", "memo", "quantity", "amount"};
          }

          @Override
          protected String[] setRowElementsStyle() {
            return new String[] {
              "date-value", "type-value", "no-value", "memo-value", "quantity-value", "amount"
            };
          }
        };
    transactionHistoryGrid.init();
    transactionHistoryGrid.addEmptyMessage(messages.pleaseSelectAnItem());
    int pageSize = getPageSize();
    transactionHistoryGrid.addRangeChangeHandler2(
        new Handler() {

          @Override
          public void onRangeChange(RangeChangeEvent event) {
            onPageChange(event.getNewRange().getStart(), event.getNewRange().getLength());
          }
        });
    SimplePager pager =
        new SimplePager(
            TextLocation.CENTER,
            (Resources) GWT.create(Resources.class),
            false,
            pageSize * 2,
            true);
    pager.setDisplay(transactionHistoryGrid);
    updateRecordsCount(0, 0, 0);

    if (Accounter.isIpadApp()) {

      transactionButton = new Button(messages.transaction());
      transactionButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              ActionFactory.getInventoryTransactionListHistory(selectedItem).run();
            }
          });

    } else {
      dummyPanel.add(transactionGridpanel);
      dummyPanel.add(transactionHistoryGrid);
      dummyPanel.add(pager);
    }

    rightVpPanel.add(dummyPanel);

    Label labelTitle = new Label(messages.inventoryCentre());
    labelTitle.setStyleName("label-title");
    mainPanel.add(leftVpPanel);
    mainPanel.add(rightVpPanel);
    add(labelTitle);
    add(mainPanel);
  }
コード例 #6
0
  @Override
  protected void createControls() {
    Label lab1 = new Label(messages.payeePrePayment(Global.get().Customer()));
    lab1.setStyleName("label-title");
    // lab1.setHeight("35px");
    transactionDateItem = createTransactionDateItem();

    transactionNumber = createTransactionNumberItem();

    listforms = new ArrayList<DynamicForm>();
    locationCombo = createLocationCombo();
    DynamicForm dateNoForm = new DynamicForm("datenumber-panel");
    dateNoForm.add(transactionDateItem, transactionNumber);

    StyledPanel datepanel = new StyledPanel("datepanel");
    datepanel.add(dateNoForm);

    StyledPanel labeldateNoLayout = new StyledPanel("labeldateNoLayout");
    labeldateNoLayout.add(lab1);
    labeldateNoLayout.add(datepanel);
    // customer and address
    customerCombo = createCustomerComboItem(messages.payeeName(Global.get().Customer()));

    billToCombo = createBillToComboItem(messages.address());
    billToCombo.setEnabled(false);

    // Ending and Vendor Balance
    bankBalText = new AmountField(messages.bankBalance(), this, getBaseCurrency(), "bankBalText");
    bankBalText.setEnabled(false);

    customerBalText =
        new AmountField(
            messages.payeeBalance(Global.get().Customer()),
            this,
            getBaseCurrency(),
            "customerBalText");
    customerBalText.setEnabled(false);

    DynamicForm balForm = new DynamicForm("balForm");
    if (locationTrackingEnabled) balForm.add(locationCombo);
    classListCombo = createAccounterClassListCombo();
    if (isTrackClass()) {
      balForm.add(classListCombo);
    }
    jobListCombo = createJobListCombo();
    if (isTrackJob()) {
      jobListCombo.setEnabled(false);
      balForm.add(jobListCombo);
    }
    balForm.add(bankBalText, customerBalText);
    // balForm.getCellFormatter().setWidth(0, 0, "205px");

    // payment
    depositInCombo = createDepositInComboItem(bankBalText);
    // depositInCombo.setPopupWidth("500px");

    amountText = new AmountField(messages.amount(), this, getBaseCurrency(), "amountText");
    amountText.setRequired(true);
    amountText.addBlurHandler(getBlurHandler());

    paymentMethodCombo = createPaymentMethodSelectItem();
    paymentMethodCombo.setComboItem(UIUtils.getpaymentMethodCheckBy_CompanyType(messages.check()));
    // printCheck = new CheckboxItem(messages.toBePrinted());
    // printCheck.setValue(true);
    // printCheck.addChangeHandler(new ValueChangeHandler<Boolean>() {
    //
    // @Override
    // public void onValueChange(ValueChangeEvent<Boolean> event) {
    // isChecked = (Boolean) event.getValue();
    // if (isChecked) {
    // if (printCheck.getValue().toString()
    // .equalsIgnoreCase("true")) {
    // checkNo.setValue(messages.toBePrinted());
    // checkNo.setDisabled(true);
    // } else {
    // if (depositInAccount == null)
    // checkNo.setValue(messages
    // .toBePrinted());
    // else if (isInViewMode()) {
    // checkNo.setValue(((ClientCustomerPrePayment) transaction)
    // .getCheckNumber());
    // }
    // }
    // } else
    // // setCheckNumber();
    // checkNo.setValue("");
    // checkNo.setDisabled(false);
    //
    // }
    // });
    checkNo = createCheckNumberItm();
    // checkNo.setValue(messages.toBePrinted());
    // checkNo.setDisabled(true);
    checkNo.addChangeHandler(
        new ChangeHandler() {

          @Override
          public void onChange(ChangeEvent event) {
            checkNumber = checkNo.getValue().toString();
          }
        });
    checkNo.setEnabled(!isInViewMode());
    currencyWidget = createCurrencyFactorWidget();
    payForm = UIUtils.form(messages.payment());
    memoTextAreaItem = createMemoTextAreaItem();
    // refText = createRefereceText();
    // refText.setWidth(100);
    payForm.add(
        customerCombo,
        billToCombo,
        depositInCombo,
        amountText,
        paymentMethodCombo,
        checkNo,
        memoTextAreaItem);
    // memo and Reference
    ClientAccount selectedValue = depositInCombo.getSelectedValue();
    if (selectedValue != null) {
      bankBalText.setAmount(selectedValue.getTotalBalanceInAccountCurrency());
      bankBalText.setCurrency(getCompany().getCurrency(selectedValue.getCurrency()));
    }

    // payForm.getCellFormatter().setWidth(0, 0, "160px");

    StyledPanel leftPanel = new StyledPanel("leftPanel");
    leftPanel.add(payForm);
    // leftPanel.add(payForm);
    // leftPanel.add(memoForm);

    StyledPanel rightPanel = new StyledPanel("rightPanel");
    rightPanel.add(balForm);
    if (isMultiCurrencyEnabled()) {
      rightPanel.add(currencyWidget);
    }

    StyledPanel mainVLay = new StyledPanel("mainVLay");
    mainVLay.add(voidedPanel);
    mainVLay.add(labeldateNoLayout);
    StyledPanel hLay = getTopLayOut();
    if (hLay != null) {
      hLay.add(leftPanel);
      hLay.add(rightPanel);
      mainVLay.add(hLay);
    } else {
      mainVLay.add(leftPanel);
      mainVLay.add(rightPanel);
    }

    this.add(mainVLay);

    /* Adding dynamic forms in list */
    listforms.add(dateNoForm);
    listforms.add(balForm);
    listforms.add(payForm);
    // settabIndexes();
  }
コード例 #7
0
  public void createControls() {
    // Creating Title for View
    Label label = new Label();
    label.removeStyleName("gwt-Label");
    label.addStyleName("label-title");
    label.setText(messages.Reconciliation());

    bankaccountLabel = new LabelItem(messages.Account(), "bankaccountLabel");
    bankaccountLabel.setValue(data.getAccount().getName());

    closebalanceLable = new AmountLabel(messages.ClosingBalance());
    closebalanceLable.setTitle(messages.ClosingBalance());
    closebalanceLable.setAmount(data.getClosingBalance());

    startdateLable = new LabelItem(messages.startDate(), "startdateLable");
    startdateLable.setValue(DateUtills.getDateAsString(data.getStartDate().getDateAsObject()));

    enddateLable = new LabelItem(messages.endDate(), "enddateLable");
    enddateLable.setValue(DateUtills.getDateAsString(data.getEndDate().getDateAsObject()));

    // // Creating Input Fields to Start Reconciliation of an Account
    // bankAccountsField = new SelectCombo(messages.bankAccount(Global.get()
    // .Account()));
    //
    // bankAccountsField
    // .addSelectionChangeHandler(new
    // IAccounterComboSelectionChangeHandler<String>() {
    //
    // @Override
    // public void selectedComboBoxItem(String selectItem) {
    // // TODO Auto-generated method stub
    //
    // }
    // });
    //
    // startDate = new DateField(constants.startDate());
    // endDate = new DateField(constants.endDate());
    // closingBalance = new TextItem(constants.ClosingBalance());

    DynamicForm form = new DynamicForm("form");
    form.add(bankaccountLabel, closebalanceLable);
    form.setStyleName("recouncilation_value");

    DynamicForm datesForm = new DynamicForm("datesForm");
    datesForm.add(startdateLable, enddateLable);

    StyledPanel hPanel = new StyledPanel("hPanel");
    // hPanel.setWidth("100%");
    hPanel.add(form);
    hPanel.add(datesForm);
    // hPanel.setCellWidth(form, "40%");
    Button changeBtn = new Button(messages.change());
    changeBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            ReconciliationDialog dialog =
                new ReconciliationDialog(
                    Global.get().messages().Reconciliation(),
                    data,
                    new ValueCallBack<ClientReconciliation>() {

                      @Override
                      public void execute(ClientReconciliation value) {
                        updateData(value);
                      }
                    });
            ViewManager.getInstance().showDialog(dialog);
          }
        });

    StyledPanel btnPanel = new StyledPanel("btnPanel");
    // btnPanel.setWidth("100%");
    btnPanel.add(changeBtn);
    btnPanel.setStyleName("recoucilation_change");
    // btnPanel.setCellHorizontalAlignment(changeBtn,
    // HasHorizontalAlignment.ALIGN_RIGHT);

    // Creating Amount Fields
    StyledPanel amountsPanel = new StyledPanel("amountsPanel");

    openingBalance = new AmountLabel(messages.openingBalance());
    openingBalance.setEnabled(false);
    openingBalance.setAmount(data.getOpeningBalance());

    closingBalance = new AmountLabel(messages.ClosingBalance());
    closingBalance.setEnabled(true);
    closingBalance.setAmount(data.getClosingBalance());

    clearedAmount = new AmountLabel(messages.ClearedAmount());
    clearedAmount.setEnabled(true);

    difference = new AmountLabel(messages.Difference());
    difference.setEnabled(false);
    DynamicForm amountsForm = new DynamicForm("amountsForm");
    // amountsForm.setWidth("50%");
    amountsForm.add(openingBalance, closingBalance, clearedAmount, difference);
    amountsPanel.add(amountsForm);
    amountsPanel.setStyleName("bottom_total_view");

    this.grid =
        new ReconciliationTransactionsGrid(
            this,
            new SelectionChangedHandler<ClientReconciliationItem>() {

              @Override
              public void selectionChanged(ClientReconciliationItem obj, boolean isSelected) {
                if (isCreating()) {
                  clearTransaction(obj, isSelected);
                }
              }
            });
    // grid.setWidth("100%");
    // grid.setHeight("200px");

    this.mainPanel = new StyledPanel("mainPanel");
    StyledPanel gridPanel = new StyledPanel("reconcillation_grid_panel");
    mainPanel.add(label);
    mainPanel.add(hPanel);
    if (isCreating()) {
      mainPanel.add(btnPanel);
    }
    gridPanel.add(grid);
    mainPanel.add(gridPanel);
    // mainPanel.setCellHeight(grid, "200px");
    grid.getElement().getParentElement().addClassName("recounciliation_grid");
    mainPanel.add(amountsPanel);
    this.add(mainPanel);
  }