Exemplo n.º 1
0
  @Override
  public void exportToCsv() {
    if (selectedCustomer != null) {
      Accounter.createExportCSVService()
          .getCustomerTransactionsListExportCsv(
              selectedCustomer,
              getTransactionType(),
              getTransactionStatusType(),
              getStartDate(),
              getEndDate(),
              new AsyncCallback<String>() {

                @Override
                public void onSuccess(String id) {
                  UIUtils.downloadFileFromTemp(
                      trasactionViewSelect.getSelectedValue()
                          + " of "
                          + selectedCustomer.getName()
                          + ".csv",
                      id);
                }

                @Override
                public void onFailure(Throwable caught) {
                  caught.printStackTrace();
                }
              });
    } else {
      Accounter.showError(messages.pleaseSelect(Global.get().Customer()));
    }
  }
Exemplo n.º 2
0
  @Override
  public void addButtons(ButtonGroup group) {

    ImageButton addCustomerButton = null;
    if (Accounter.isIpadApp()) {
      addCustomerButton = new ImageButton(Accounter.getFinanceImages().ipadAdd(), "add");
    } else {
      addCustomerButton =
          new ImageButton(
              messages.addNew(Global.get().Customer()),
              Accounter.getFinanceImages().portletPageSettings(),
              "add");
    }

    addCustomerButton.addStyleName("settingsButton");
    addCustomerButton.getElement().setId("addCustomerButton");
    addCustomerButton.addClickHandler(
        new ClickHandler() {

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

    addCustomerButton.getElement().setAttribute("data-icon", "add");
    addButton(group, addCustomerButton);
  }
Exemplo n.º 3
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();
                }
              });
    }
  }
  /*
   * @see
   * com.vimukti.accounter.web.client.ui.grids.ListGrid#getColumnValue(java
   * .lang.Object, int)
   */
  @Override
  protected Object getColumnValue(ClientTAXCode taxCode, int index) {
    switch (index) {
      case 0:
        return taxCode.isActive();
      case 1:
        return taxCode.getName() != null ? taxCode.getName() : "";
      case 2:
        return taxCode.getDescription() != null ? taxCode.getDescription() : "";
      case 3:
        if (taxCode.isTaxable())
          // return FinanceApplication.getFinanceImages().tickMark()
          // .getURL();
          return Accounter.getFinanceImages().tickMark();
        else
          // return FinanceApplication.getFinanceImages().balnkImage()
          // .getURL();
          return Accounter.getFinanceImages().balnkImage();
      case 4:
        return Accounter.getFinanceMenuImages().delete();
        // return "/images/delete.png";

    }
    return "";
  }
Exemplo n.º 5
0
 @Override
 public boolean canEdit() {
   if (selectedCustomer != null && Accounter.getUser().isCanDoUserManagement()) {
     return true;
   }
   return false;
 }
Exemplo n.º 6
0
  private void initCustomersListGrid() {
    Accounter.createHomeService()
        .getPayeeList(
            ClientPayee.TYPE_CUSTOMER,
            isActiveAccounts,
            0,
            -1,
            true,
            new AsyncCallback<PaginationList<PayeeList>>() {

              @Override
              public void onSuccess(PaginationList<PayeeList> result) {
                custGrid.removeAllRecords();
                if (result.size() == 0) {
                  custGrid.addEmptyMessage(messages.youDontHaveAny(Global.get().Customers()));
                } else {
                  custGrid.setRecords(result);
                }
              }

              @Override
              public void onFailure(Throwable caught) {
                // TODO Auto-generated method stub
              }
            });
  }
 public NewItemAction getAddNewAction() {
   if (!Accounter.getUser().canDoInvoiceTransactions()) return null;
   else {
     NewItemAction action = new NewItemAction(true);
     action.setType(ClientItem.TYPE_INVENTORY_PART);
     return action;
   }
 }
 @Override
 protected boolean validate() {
   if ((!(managingYes.getValue() || managingNo.getValue()))
   /* && (!(trackingTimeYes.getValue() || trackingNo.getValue()) */ ) {
     Accounter.showError(messages.pleaseEnter(messages.details()));
     return false;
   } else if (!(managingYes.getValue() || managingNo.getValue())) {
     Accounter.showMessage(messages.managingBills());
     return false;
     /*
      * } else if (!(trackingTimeYes.getValue() ||
      * trackingNo.getValue())) {
      * Accounter.showMessage(messages.doyouwantTrackBills()); return
      * false;
      */
   } else {
     return true;
   }
 }
  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);
  }
Exemplo n.º 10
0
  private void OncusotmerSelected() {

    this.selectedCustomer = custGrid.getSelectedCustomer();
    if (Accounter.isIpadApp()) {
      rightVpPanel.add(transactionButton);
      transactionButton.setText(messages2.transactionListFor(selectedCustomer.getDisplayName()));
    }
    detailsPanel.showCustomerDetails(selectedCustomer);
    custHistoryGrid.setSelectedCustomer(selectedCustomer);
    MainFinanceWindow.getViewManager().updateButtons();
    showButtonBar();
    callRPC(0, getPageSize());
  }
Exemplo n.º 11
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());
    }
  }
Exemplo n.º 12
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()));
    }
  }
Exemplo n.º 13
0
  @Override
  protected void callRPC(int start, int length) {
    custHistoryGrid.removeAllRecords();
    records = new ArrayList<TransactionHistory>();
    if (selectedCustomer != null) {
      Accounter.createReportService()
          .getCustomerTransactionsList(
              selectedCustomer.getID(),
              getTransactionType(),
              getTransactionStatusType(),
              getStartDate(),
              getEndDate(),
              start,
              length,
              new AsyncCallback<PaginationList<TransactionHistory>>() {

                @Override
                public void onFailure(Throwable caught) {
                  caught.printStackTrace();
                }

                @Override
                public void onSuccess(PaginationList<TransactionHistory> result) {
                  records = result;
                  custHistoryGrid.removeAllRecords();
                  if (records != null) {
                    custHistoryGrid.addRecords(records);
                  }
                  updateRecordsCount(result.getStart(), result.size(), result.getTotalCount());
                  if (records.size() == 0) {
                    custHistoryGrid.addEmptyMessage(messages.thereAreNo(messages.transactions()));
                  }
                }
              });

    } else {
      custHistoryGrid.removeAllRecords();
      custHistoryGrid.addEmptyMessage(messages.thereAreNo(messages.transactions()));
    }
  }
Exemplo n.º 14
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);
  }
Exemplo n.º 15
0
  public void dateRangeChanged(String dateRange) {
    ClientFinanceDate date = new ClientFinanceDate();
    startDate = Accounter.getStartDate();
    endDate = getCompany().getCurrentFiscalYearEndDate();
    // getLastandOpenedFiscalYearEndDate();
    if (dateRange.equals(messages.thisWeek())) {
      startDate = getWeekStartDate();
      endDate.setDay(startDate.getDay() + 6);
      endDate.setMonth(startDate.getMonth());
      endDate.setYear(startDate.getYear());
    }
    if (dateRange.equals(messages.thisMonth())) {
      startDate = new ClientFinanceDate(date.getYear(), date.getMonth(), 1);
      Calendar endCal = Calendar.getInstance();
      endCal.setTime(new ClientFinanceDate().getDateAsObject());
      endCal.set(Calendar.DAY_OF_MONTH, endCal.getActualMaximum(Calendar.DAY_OF_MONTH));
      endDate = new ClientFinanceDate(endCal.getTime());
    }
    if (dateRange.equals(messages.lastWeek())) {
      endDate = getWeekStartDate();
      endDate.setDay(endDate.getDay() - 1);
      startDate = new ClientFinanceDate(endDate.getDate());
      startDate.setDay(startDate.getDay() - 6);
    }
    if (dateRange.equals(messages.lastMonth())) {
      int day;
      if (date.getMonth() == 0) {
        day = getMonthLastDate(11, date.getYear() - 1);
        startDate = new ClientFinanceDate(date.getYear() - 1, 11, 1);
        endDate = new ClientFinanceDate(date.getYear() - 1, 11, day);
      } else {
        day = getMonthLastDate(date.getMonth() - 1, date.getYear());
        startDate = new ClientFinanceDate(date.getYear(), date.getMonth() - 1, 1);
        endDate = new ClientFinanceDate(date.getYear(), date.getMonth() - 1, day);
      }
    }
    if (dateRange.equals(messages.thisFinancialYear())) {
      startDate = getCompany().getCurrentFiscalYearStartDate();
      endDate = getCompany().getCurrentFiscalYearEndDate();
    }
    if (dateRange.equals(messages.lastFinancialYear())) {

      startDate = Accounter.getCompany().getCurrentFiscalYearStartDate();
      startDate.setYear(startDate.getYear() - 1);
      Calendar endCal = Calendar.getInstance();
      endCal.setTime(Accounter.getCompany().getCurrentFiscalYearEndDate().getDateAsObject());
      endCal.set(Calendar.DAY_OF_MONTH, endCal.getActualMaximum(Calendar.DAY_OF_MONTH));
      endDate = new ClientFinanceDate(endCal.getTime());
      endDate.setYear(endDate.getYear() - 1);
    }
    if (dateRange.equals(messages.thisFinancialQuarter())) {
      startDate = new ClientFinanceDate();
      endDate = getCompany().getCurrentFiscalYearEndDate();
      // getLastandOpenedFiscalYearEndDate();
      getCurrentQuarter();
    }
    if (dateRange.equals(messages.lastFinancialQuarter())) {
      startDate = new ClientFinanceDate();
      endDate = getCompany().getCurrentFiscalYearEndDate();
      // getLastandOpenedFiscalYearEndDate();
      getCurrentQuarter();
      startDate.setYear(startDate.getYear() - 1);
      endDate.setYear(endDate.getYear() - 1);
    }
    if (dateRange.equals(messages.financialYearToDate())) {
      startDate = getCompany().getCurrentFiscalYearStartDate();
      endDate = new ClientFinanceDate();
    }
  }
Exemplo n.º 16
0
 @Override
 public void onClose() {
   Accounter.showError("");
   super.onClose();
 }
Exemplo n.º 17
0
  private void getMessagesList() {
    transactiontypebyStatusMap = new HashMap<Integer, String>();
    String selectedValue = trasactionViewSelect.getSelectedValue();
    if (selectedValue.equalsIgnoreCase(messages.allTransactions())) {
      transactiontypebyStatusMap.put(
          TransactionHistory.ALL_TRANSACTIONS, messages.allTransactions());
    } else if (selectedValue.equalsIgnoreCase(messages.invoices())) {
      transactiontypebyStatusMap.put(TransactionHistory.ALL_INVOICES, messages.getallInvoices());
      transactiontypebyStatusMap.put(
          TransactionHistory.OPENED_INVOICES, messages.getOpendInvoices());
      transactiontypebyStatusMap.put(
          TransactionHistory.OVER_DUE_INVOICES, messages.overDueInvoices());
      if (Accounter.hasPermission(Features.DRAFTS)) {
        transactiontypebyStatusMap.put(
            TransactionHistory.DRAFT_INVOICES, messages.draftTransaction(messages.invoices()));
      }
    } else if (selectedValue.equalsIgnoreCase(messages.cashSales())) {
      transactiontypebyStatusMap.put(
          TransactionHistory.ALL_CASHSALES, messages.all() + " " + messages.cashSales());
      if (Accounter.hasPermission(Features.DRAFTS)) {
        transactiontypebyStatusMap.put(
            TransactionHistory.DRAFT_CASHSALES, messages.draftTransaction(messages.cashSales()));
      }

    } else if (selectedValue.equalsIgnoreCase(messages.quotes())) {

      transactiontypebyStatusMap.put(TransactionHistory.ALL_QUOTES, messages.allQuotes());
      if (Accounter.hasPermission(Features.DRAFTS)) {
        transactiontypebyStatusMap.put(
            TransactionHistory.DRAFT_QUOTES, messages.draftTransaction(messages.quotes()));
      }
    } else if (selectedValue.equalsIgnoreCase(messages.credits())) {
      transactiontypebyStatusMap.put(TransactionHistory.ALL_CREDITS, messages.allCredits());
      if (Accounter.hasPermission(Features.DRAFTS)) {
        transactiontypebyStatusMap.put(
            TransactionHistory.DRAFT_CREDITS, messages.draftTransaction(messages.credits()));
      }

    } else if (selectedValue.equalsIgnoreCase(messages.Charges())) {

      transactiontypebyStatusMap.put(TransactionHistory.ALL_CHARGES, messages.allCahrges());
      if (Accounter.hasPermission(Features.DRAFTS)) {
        transactiontypebyStatusMap.put(
            TransactionHistory.DRAFT_CHARGES, messages.draftTransaction(messages.Charges()));
      }

    } else if (selectedValue.equalsIgnoreCase(messages.receivedPayments())) {
      transactiontypebyStatusMap.put(
          TransactionHistory.ALL_RECEIVEDPAYMENTS,
          messages.all() + " " + messages.receivedPayments());
      transactiontypebyStatusMap.put(
          TransactionHistory.RECEV_PAY_BY_CASH, messages.receivedPaymentsbyCash());
      transactiontypebyStatusMap.put(
          TransactionHistory.RECEV_PAY_BY_CHEQUE, messages.receivedPaymentsbyCheque());
      transactiontypebyStatusMap.put(
          TransactionHistory.RECEV_PAY_BY_CREDITCARD, messages.receivedPaymentsbyCreditCard());
      transactiontypebyStatusMap.put(
          TransactionHistory.RECEV_PAY_BY_DIRECT_DEBIT, messages.receivedPaymentsbyDirectDebit());
      transactiontypebyStatusMap.put(
          TransactionHistory.RECEV_PAY_BY_MASTERCARD, messages.receivedPaymentsbyMastercard());
      transactiontypebyStatusMap.put(
          TransactionHistory.RECEV_PAY_BY_ONLINE, messages.receivedPaymentsbyOnlineBanking());
      transactiontypebyStatusMap.put(
          TransactionHistory.RECEV_PAY_BY_STANDING_ORDER,
          messages.receivedPaymentsbyStandingOrder());
      transactiontypebyStatusMap.put(
          TransactionHistory.RECEV_PAY_BY_MAESTRO, messages.receivedPaymentsbySwitchMaestro());

    } else if (selectedValue.equalsIgnoreCase(messages.CustomerCreditNotes())) {
      transactiontypebyStatusMap.put(TransactionHistory.ALL_CREDITMEMOS, messages.allCreditMemos());
      if (Accounter.hasPermission(Features.DRAFTS)) {
        transactiontypebyStatusMap.put(
            TransactionHistory.DRAFT_CREDITMEMOS, messages.draftTransaction(messages.creditNote()));
      }
      // transactiontypebyStatusMap.put(
      // TransactionHistory.OPEND_CREDITMEMOS,
      // messages.openCreditMemos());

    } else if (selectedValue.equalsIgnoreCase(messages.customerRefunds(Global.get().Customer()))) {
      transactiontypebyStatusMap.put(
          TransactionHistory.REFUNDS_BY_CREDITCARD, messages.refundsByCreditCard());
      transactiontypebyStatusMap.put(TransactionHistory.REFUNDS_BYCASH, messages.refundsByCash());
      transactiontypebyStatusMap.put(
          TransactionHistory.REFUNDS_BYCHEQUE, messages.refundsByCheck());

      transactiontypebyStatusMap.put(
          TransactionHistory.ALL_CUSTOMER_REFUNDS, messages.allCustomerRefunds());
      if (Accounter.hasPermission(Features.DRAFTS)) {
        transactiontypebyStatusMap.put(
            TransactionHistory.DRAFT_CUSTOMER_REFUNDS,
            messages.draftTransaction(messages.customerRefunds(Global.get().Customer())));
      }
    } else if (trasactionViewSelect.getSelectedValue().equalsIgnoreCase(messages.cheques())) {
      transactiontypebyStatusMap.put(TransactionHistory.ALL_CHEQUES, messages.allcheques());
      if (Accounter.hasPermission(Features.DRAFTS)) {
        transactiontypebyStatusMap.put(
            TransactionHistory.DRAFT_CHEQUES, messages.draftTransaction(messages.cheques()));
      }
    } else if (trasactionViewSelect.getSelectedValue().equalsIgnoreCase(messages.salesOrders())) {
      transactiontypebyStatusMap.put(TransactionHistory.ALL_SALES_ORDERS, messages.all());
      transactiontypebyStatusMap.put(
          TransactionHistory.COMPLETED_SALES_ORDERS, messages.completed());
      transactiontypebyStatusMap.put(TransactionHistory.OPEN_SALES_ORDERS, messages.open());
    }
    List<String> typeList = new ArrayList<String>(transactiontypebyStatusMap.values());
    Collections.sort(
        typeList,
        new Comparator<String>() {

          @Override
          public int compare(String entry1, String entry2) {
            return entry1.compareTo(entry2);
          }
        });
    trasactionViewTypeSelect.initCombo(typeList);
    trasactionViewTypeSelect.setComboItem(typeList.get(0));
  }
  @Override
  protected void initTransactionViewData() {
    if (transaction == null) {
      setData(new ClientCustomerPrePayment());
      initDepositInAccounts();
    } else {

      if (currencyWidget != null) {
        this.currency = getCompany().getCurrency(transaction.getCurrency());
        this.currencyFactor = transaction.getCurrencyFactor();
        currencyWidget.setSelectedCurrency(this.currency);
        // currencyWidget.currencyChanged(this.currency);
        currencyWidget.setCurrencyFactor(transaction.getCurrencyFactor());
        currencyWidget.setEnabled(!isInViewMode());
      }
      ClientCompany comapny = getCompany();

      ClientCustomer customer = comapny.getCustomer(transaction.getCustomer());
      customerSelected(comapny.getCustomer(transaction.getCustomer()));
      this.billingAddress = transaction.getAddress();
      if (billingAddress != null) billToaddressSelected(billingAddress);
      amountText.setEnabled(!isInViewMode());
      amountText.setAmount(transaction.getTotal());
      if (customer != null) {
        customerBalText.setAmount(customer.getBalance());
      }
      // bankBalText.setAmount(getAmountInTransactionCurrency(transaction.g));
      paymentMethodSelected(transaction.getPaymentMethod());
      this.depositInAccount = comapny.getAccount(transaction.getDepositIn());
      if (depositInAccount != null) {
        depositInCombo.setComboItem(depositInAccount);
        bankBalText.setAmount(depositInAccount.getTotalBalanceInAccountCurrency());
        bankBalText.setCurrency(getCompany().getCurrency(depositInAccount.getCurrency()));
      }
      if (isTrackClass()) {
        classListCombo.setComboItem(
            getCompany().getAccounterClass(transaction.getAccounterClass()));
      }
      paymentMethodCombo.setComboItem(transaction.getPaymentMethod());
      checkNo.setValue(transaction.getCheckNumber());
      // if (transaction.getPaymentMethod().equals(constants.check())) {
      // printCheck.setDisabled(isInViewMode());
      // checkNo.setDisabled(isInViewMode());
      // } else {
      // printCheck.setDisabled(true);
      // checkNo.setDisabled(true);
      // }

      // if (transaction.getCheckNumber() != null) {
      // if (transaction.getCheckNumber().equals(
      // messages.toBePrinted())) {
      // checkNo.setValue(messages.toBePrinted());
      // printCheck.setValue(true);
      // } else {
      // checkNo.setValue(transaction.getCheckNumber());
      // printCheck.setValue(false);
      // }
      // }
    }
    if (locationTrackingEnabled)
      locationSelected(getCompany().getLocation(transaction.getLocation()));
    if (isTrackJob()) {
      if (customer != null) {
        jobListCombo.setCustomer(customer);
      }
      jobSelected(Accounter.getCompany().getjob(transaction.getJob()));
    }
    initMemoAndReference();
    initCustomers();
    if (isMultiCurrencyEnabled()) {
      updateAmountsFromGUI();
    }
  }
 public ImageResource getSmallImage() {
   return Accounter.getFinanceMenuImages().newJournalEntry();
 }
Exemplo n.º 20
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);
  }