private void compute_charges() { // double total = 0; if (tbl_charges_ALM.isEmpty()) { total = 0; } else { List<S2_customers.to_cust_charges> datas = tbl_charges_ALM; for (S2_customers.to_cust_charges to : datas) { total += to.amount; } } tf_total.setText("" + NumType.with_comma(Double.parseDouble("" + total))); }
private void do_pay() { int[] idx = tbl_charges.getSelectedRows(); // JOptionPane.showMessageDialog(null, idx); if (idx.length <= 0) { return; } final List<S2_customers.to_cust_charges> cus = new ArrayList(); final List<String> rem = new ArrayList(); double charges = 0; for (int ix : idx) { charges += Double.parseDouble(NumType.no_comma(tbl_charges.getModel().getValueAt(ix, 2).toString())); String or_number = tbl_charges.getModel().getValueAt(ix, 0).toString(); String ci_number = tbl_charges.getModel().getValueAt(ix, 1).toString(); // rem.add(tbl_charges.getModel().getValueAt(ix, 1).toString()); S2_customers.to_cust_charges to = new S2_customers.to_cust_charges(or_number, ci_number, 0, ""); cus.add(to); // System.out.println(tbl_charges.getModel().getValueAt(ix, 1).toString()); } int row = tbl_charges.getSelectedRow(); if (row < 0) { return; } String num = tbl_charges.getModel().getValueAt(row, 1).toString(); Window p = (Window) this; Dlg_quantity1 nd = Dlg_quantity1.create(p, true); nd.setTitle(""); nd.do_pass(charges); nd.setCallback( new Dlg_quantity1.Callback() { @Override public void ok(CloseDialog closeDialog, Dlg_quantity1.OutputData data) { closeDialog.ok(); pay3(cus); // pay(rem); } }); Center.setCenter(nd); nd.setVisible(true); }
@Override public Object getValueAt(int row, int col) { S2_customers.to_cust_charges tt = (S2_customers.to_cust_charges) getRow(row); switch (col) { case 0: return tt.or; case 1: return tt.ci_number; case 2: return NumType.with_comma(tt.amount); default: return (tt.date_added); } }