Ejemplo n.º 1
0
  private void openReportBtnActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_openReportBtnActionPerformed
    if (this.trialBalanceTabbedPane.getSelectedIndex() == 0) {
      this.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));

      debitTotalTxt.setText("0.00");
      creditTotalTxt.setText("0.00");
      balanceTotalTxt.setText("0.00");

      reportBodyTable.setModel(
          com.afrisoftech.dbadmin.TableModel.createTableVectors(
              connectDB,
              "Select "
                  + "  select account_no as scheme, sum(debit-credit) as Balance from ac_debtors "
                  + "  where "
                  + " date::date <='"
                  + endDatePicker.getDate()
                  + "' "
                  + "Group By  group by 1 "));
      balanceTotalTxt.setText(
          com.afrisoftech.lib.CurrencyFormatter.getFormattedDouble(
              com.afrisoftech.lib.TableColumnTotal.getTableColumnTotal(reportBodyTable, 1)));
      this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    }
    this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    // TODO add your handling code here:
  } // GEN-LAST:event_openReportBtnActionPerformed
  private void reportBodyTableMouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_reportBodyTableMouseClicked
    this.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
    totalAmounttxt.setVisible(true);
    for (int t = 1; t < creditorsTableView.getModel().getRowCount(); t++) {
      for (int c = 0; c < creditorsTableView.getModel().getColumnCount(); c++) {
        creditorsTableView.getModel().setValueAt(null, t, c);
      }

      totalAmounttxt.setText(null);
    }

    try {
      creditorsTableView.setModel(
          com.afrisoftech.dbadmin.TableModel.createTableVectors(
              connectDB,
              ""
                  + "  SELECT activity_code,   service_type,sum(credit-debit) as Sales "
                  + "   FROM ac_ledger "
                  + "where description ilike  '%"
                  + reportBodyTable.getValueAt(reportBodyTable.getSelectedRow(), 0)
                  + "%' "
                  + " and date::date BETWEEN '"
                  + com.afrisoftech.lib.SQLDateFormat.getSQLDate(beginDatePicker.getDate())
                  + "' "
                  + "AND '"
                  + com.afrisoftech.lib.SQLDateFormat.getSQLDate(endDatePicker.getDate())
                  + "'"
                  + " group by 1,2"));
    } catch (Exception meza) {
      System.out.println("the creditorsTableView populate table error is " + meza);
    }
    totalAmounttxt.setText(
        com.afrisoftech.lib.CurrencyFormatter.getFormattedDouble(
            (com.afrisoftech.lib.TableColumnTotal.getTableColumnTotal(creditorsTableView, 2))));

    this.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

    // TODO add your handling code here:
  } // GEN-LAST:event_reportBodyTableMouseClicked