void confirmButton_actionPerformed(ActionEvent e) {
    // view close dialog...
    if (JOptionPane.showConfirmDialog(
            ClientUtils.getParentFrame(this),
            ClientSettings.getInstance().getResources().getResource("close credit note?"),
            ClientSettings.getInstance().getResources().getResource("credit note closing"),
            JOptionPane.YES_NO_OPTION)
        == JOptionPane.YES_OPTION) {

      Response res = ClientUtils.getData("closeSaleDoc", controller.getPk());
      if (!res.isError()) {
        confirmButton.setEnabled(false);
        headerFormPanel.setMode(Consts.READONLY);
        headerFormPanel.executeReload();
        if (getInvoices() != null) getInvoices().reloadCurrentBlockOfData();
      } else
        JOptionPane.showMessageDialog(
            ClientUtils.getParentFrame(this),
            res.getErrorMessage(),
            ClientSettings.getInstance().getResources().getResource("credit note closing"),
            JOptionPane.ERROR_MESSAGE);
    }
  }
 public void enabledConfirmButton() {
   confirmButton.setEnabled(true);
 }
  public void loadDataCompleted(boolean error, SaleDocPK pk) {
    DetailSaleDocVO vo = (DetailSaleDocVO) headerFormPanel.getVOModel().getValueObject();

    this.setTitle(
        ClientSettings.getInstance().getResources().getResource("credit note")
            + (vo.getDocSequenceDOC01() != null
                ? " - " + vo.getDocYearDOC01() + "/" + vo.getDocSequenceDOC01()
                : "")
            + " - "
            + vo.getName_1REG04()
            + " "
            + (vo.getName_2REG04() == null ? "" : vo.getName_2REG04()));

    saleTotalsPanel1.getControlTaxableIncome().setDecimals(vo.getDecimalsREG03().intValue());
    saleTotalsPanel1.getControlTaxableIncome().setCurrencySymbol(vo.getCurrencySymbolREG03());
    saleTotalsPanel1
        .getControlTaxableIncome()
        .setDecimalSymbol(vo.getDecimalSymbolREG03().charAt(0));
    saleTotalsPanel1
        .getControlTaxableIncome()
        .setGroupingSymbol(vo.getThousandSymbolREG03().charAt(0));

    saleTotalsPanel1.getControlTotal().setDecimals(vo.getDecimalsREG03().intValue());
    saleTotalsPanel1.getControlTotal().setCurrencySymbol(vo.getCurrencySymbolREG03());
    saleTotalsPanel1.getControlTotal().setDecimalSymbol(vo.getDecimalSymbolREG03().charAt(0));
    saleTotalsPanel1.getControlTotal().setGroupingSymbol(vo.getThousandSymbolREG03().charAt(0));

    saleTotalsPanel1.getControlTotalVat().setDecimals(vo.getDecimalsREG03().intValue());
    saleTotalsPanel1.getControlTotalVat().setCurrencySymbol(vo.getCurrencySymbolREG03());
    saleTotalsPanel1.getControlTotalVat().setDecimalSymbol(vo.getDecimalSymbolREG03().charAt(0));
    saleTotalsPanel1.getControlTotalVat().setGroupingSymbol(vo.getThousandSymbolREG03().charAt(0));

    saleTotalsPanel1.getControlAllowance().setDecimals(vo.getDecimalsREG03().intValue());
    saleTotalsPanel1.getControlAllowance().setCurrencySymbol(vo.getCurrencySymbolREG03());
    saleTotalsPanel1.getControlAllowance().setDecimalSymbol(vo.getDecimalSymbolREG03().charAt(0));
    saleTotalsPanel1.getControlAllowance().setGroupingSymbol(vo.getThousandSymbolREG03().charAt(0));

    saleTotalsPanel1.getControlDeposit().setDecimals(vo.getDecimalsREG03().intValue());
    saleTotalsPanel1.getControlDeposit().setCurrencySymbol(vo.getCurrencySymbolREG03());
    saleTotalsPanel1.getControlDeposit().setDecimalSymbol(vo.getDecimalSymbolREG03().charAt(0));
    saleTotalsPanel1.getControlDeposit().setGroupingSymbol(vo.getThousandSymbolREG03().charAt(0));

    rowsPanel.setParentVO(vo);
    rowsPanel.getGrid().getOtherGridParams().put(ApplicationConsts.SALE_DOC_PK, pk);
    rowsPanel.getGrid().reloadData();

    discPanel.setParentVO(vo);
    discPanel.getGrid().getOtherGridParams().put(ApplicationConsts.SALE_DOC_PK, pk);
    discPanel.getGrid().reloadData();

    chargePanel.setParentVO(vo);
    chargePanel.getGrid().getOtherGridParams().put(ApplicationConsts.SALE_DOC_PK, pk);
    chargePanel.getGrid().reloadData();

    actPanel.setParentVO(vo);
    actPanel.getGrid().getOtherGridParams().put(ApplicationConsts.SALE_DOC_PK, pk);
    actPanel.getGrid().reloadData();

    if (vo.getDocStateDOC01().equals(ApplicationConsts.CONFIRMED)
        || vo.getDocStateDOC01().equals(ApplicationConsts.CLOSED)) {
      confirmButton.setEnabled(false);
      setButtonsEnabled(false);
      rowsPanel.setButtonsEnabled(false);
    }
    if (!vo.getDocStateDOC01().equals(ApplicationConsts.HEADER_BLOCKED)) {
      confirmButton.setEnabled(false);
    }
    if (vo.getDocStateDOC01().equals(ApplicationConsts.HEADER_BLOCKED)) {
      confirmButton.setEnabled(true);
    }

    if (vo.getDocStateDOC01().equals(ApplicationConsts.CONFIRMED)
        || vo.getDocStateDOC01().equals(ApplicationConsts.CLOSED)
        || vo.getDocStateDOC01().equals(ApplicationConsts.HEADER_BLOCKED)) {
      printButton.setEnabled(true);
    } else {
      printButton.setEnabled(false);
    }
  }
  private void jbInit() throws Exception {
    printButton.setToolTipText(
        ClientSettings.getInstance().getResources().getResource("print document"));
    printButton.addActionListener(new SaleCreditDocFrame_printButton_actionAdapter(this));

    addPanel.setLayout(borderLayout5);
    confirmButton.addActionListener(new SaleCreditDocFrame_confirmButton_actionAdapter(this));

    headerFormPanel.setFunctionId("DOC01_CREDITNOTES");
    headerFormPanel.setFormController(controller);
    headerFormPanel.setVOClassName("org.jallinone.sales.documents.java.DetailSaleDocVO");

    headerPanel.setLayout(borderLayout3);
    headerButtonsPanel.setLayout(flowLayout1);
    flowLayout1.setAlignment(FlowLayout.LEFT);
    mainPanel.setLayout(borderLayout2);
    this.getContentPane().setLayout(borderLayout1);
    linesPanel.setLayout(borderLayout4);
    insertButton1.setText("insertButton1");
    reloadButton1.setText("reloadButton1");
    deleteButton1.setText("deleteButton1");
    headerFormPanel.setLayout(gridBagLayout1);
    headerFormPanel.setInsertButton(insertButton1);
    headerFormPanel.setEditButton(editButton1);
    headerFormPanel.setReloadButton(reloadButton1);
    headerFormPanel.setDeleteButton(deleteButton1);
    headerFormPanel.setSaveButton(saveButton1);
    this.getContentPane().add(mainPanel, BorderLayout.CENTER);
    mainPanel.add(tabbedPane, BorderLayout.CENTER);
    tabbedPane.add(headerPanel, "header");
    headerPanel.add(headerButtonsPanel, BorderLayout.NORTH);
    headerButtonsPanel.add(insertButton1, null);
    headerButtonsPanel.add(editButton1, null);
    headerButtonsPanel.add(saveButton1, null);
    headerButtonsPanel.add(reloadButton1, null);
    headerButtonsPanel.add(deleteButton1, null);
    headerButtonsPanel.add(confirmButton, null);
    printButton.setEnabled(false);
    headerButtonsPanel.add(printButton, null);
    linesPanel.add(rowsPanel, BorderLayout.CENTER);
    headerPanel.add(headerFormPanel, BorderLayout.CENTER);
    headerFormPanel.add(
        saleIdHeadPanel1,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));
    headerFormPanel.add(
        saleCustomerHeadPanel1,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    headerFormPanel.add(
        warePanel,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));
    headerFormPanel.add(
        saleTotalsPanel1,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    confirmButton.setToolTipText(
        ClientSettings.getInstance().getResources().getResource("credit note closing"));
    confirmButton.setEnabled(false);

    addPanel.add(saleAgentPanel, BorderLayout.NORTH);
    addPanel.add(saleNotesPanel, BorderLayout.CENTER);

    tabbedPane.add(addPanel, "notes");
    tabbedPane.add(linesPanel, "items");
    tabbedPane.add(discPanel, "customer discounts");
    tabbedPane.add(chargePanel, "charges");
    tabbedPane.add(actPanel, "activities");

    headerFormPanel.addLinkedPanel(addPanel);

    tabbedPane.setTitleAt(0, ClientSettings.getInstance().getResources().getResource("header"));
    tabbedPane.setTitleAt(1, ClientSettings.getInstance().getResources().getResource("notes"));
    tabbedPane.setTitleAt(2, ClientSettings.getInstance().getResources().getResource("items"));
    tabbedPane.setTitleAt(
        3, ClientSettings.getInstance().getResources().getResource("customer discounts"));
    tabbedPane.setTitleAt(4, ClientSettings.getInstance().getResources().getResource("charges"));
    tabbedPane.setTitleAt(
        5, ClientSettings.getInstance().getResources().getResource("sale activities"));
  }