private void delete_cust() {
    int row = tbl_cust.getSelectedRow();
    if (row < 0) {
      return;
    }
    final String num = tbl_cust.getModel().getValueAt(row, 1).toString();
    Window p = (Window) this;
    Dlg_confirm nd = Dlg_confirm.create(p, true);
    nd.setTitle("");
    //        nd.do_pass("");
    nd.setCallback(
        new Dlg_confirm.Callback() {

          @Override
          public void ok(CloseDialog closeDialog, Dlg_confirm.Data data) {
            closeDialog.ok();
            delete(num);
          }

          @Override
          public void cancel(CloseDialog closeDialog) {
            //                throw new UnsupportedOperationException("Not supported yet.");
          }
        });
    Center.setCenter(nd);

    nd.setVisible(true);
  }
 private void data_charges() {
   //        String date = lb_date_baptism.getText();
   int row = tbl_cust.getSelectedRow();
   if (row < 0) {
     return;
   }
   String num = tbl_cust.getModel().getValueAt(row, 1).toString();
   //        JOptionPane.showMessageDialog(null, num);
   loadData_charges(S2_customers.ret_charges(num));
   compute_charges();
 }
  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);
  }
  private void ok1() {

    int row = tbl_cust.getSelectedRow();
    if (row < 0) {
      return;
    }

    final String num = tbl_cust.getModel().getValueAt(row, 1).toString();
    final String names = tbl_cust.getModel().getValueAt(row, 0).toString();
    final double balance = Double.parseDouble(tbl_cust.getModel().getValueAt(row, 2).toString());
    String[] details = new String[3];
    details = S2_customers.get_details(num);
    final String name = details[0];
    final String add = details[1];
    final String contact = details[2];
    //           final String name=details[0];
    Window p = (Window) this;

    Dlg_credit_card nd = Dlg_credit_card.create(p, true);
    nd.setTitle("");
    nd.do_pass(names, details[1], details[2], credit_amount, balance);
    nd.setCallback(
        new Dlg_credit_card.Callback() {

          @Override
          public void ok(CloseDialog closeDialog, Dlg_credit_card.OutputData data) {
            closeDialog.ok();

            ok2(name, add, contact, credit_amount, data.to, data.pay_mode, num);
            disposed();
          }

          @Override
          public void credit(CloseDialog closeDialog, Dlg_credit_card.OutputData data) {
            ok2(name, add, contact, credit_amount, data.to, data.pay_mode, num);
            //                disposed();
          }

          @Override
          public void prepaid(CloseDialog closeDialog, Dlg_credit_card.OutputData data) {
            ok2(name, add, contact, credit_amount, data.to, data.pay_mode, num);
            //                disposed();
          }
        });
    Center.setCenter(nd);

    nd.setVisible(true);
  }
  private void init_long_press() {
    tbl_cust.addMouseListener(
        new MouseAdapter() {

          Date pressedtime;
          long timeClicked;

          @Override
          public void mousePressed(MouseEvent e) {
            pressedtime = new Date();
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            timeClicked = (new Date()).getTime() - pressedtime.getTime();
            //                JOptionPane.showMessageDialog(null, timeClicked);
            if (timeClicked >= 500) {
              //                     JOptionPane.showMessageDialog(null, timeClicked);
              ok1();
            }
          }
        });
  }
  private void init_tbl_charges() {
    tbl_charges_ALM = new ArrayListModel();
    tbl_charges_M = new TblchargesModel(tbl_charges_ALM);

    tbl_charges.setModel(tbl_charges_M);
    tbl_charges.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    tbl_charges.setRowHeight(25);

    //        tbl_charges.setAutoResizeMode(0);
    int[] tbl_widths_accounts = {0, 0, 200, 150};

    for (int i = 0, n = tbl_widths_accounts.length; i < n; i++) {
      if (i == 2) {
        continue;
      }
      TableWidthUtilities.setColumnWidth(tbl_charges, i, tbl_widths_accounts[i]);
      //          TableWidthUtilities.
      //          TableWidthUtilities.
    }

    tbl_charges.getTableHeader().setFont(new java.awt.Font("Arial", Font.BOLD, 10));
    tbl_charges.setRowHeight(35);
    tbl_charges.setFont(new java.awt.Font("Arial", 1, 10));
  }
  private void init_tbl_baptism() {
    tbl_employee_payroll_ALM = new ArrayListModel();
    tbl_employee_payroll_M = new TblInvoicesModel(tbl_employee_payroll_ALM);

    tbl_cust.setModel(tbl_employee_payroll_M);
    tbl_cust.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    tbl_cust.setRowHeight(25);

    //        tbl_cust.setAutoResizeMode(0);
    int[] tbl_widths_accounts = {450, 0, 100, 100};

    for (int i = 0, n = tbl_widths_accounts.length; i < n; i++) {
      if (i == 0) {
        continue;
      }
      TableWidthUtilities.setColumnWidth(tbl_cust, i, tbl_widths_accounts[i]);
      //          TableWidthUtilities.
      //          TableWidthUtilities.
    }

    tbl_cust.getTableHeader().setFont(new java.awt.Font("Arial", Font.BOLD, 12));
    tbl_cust.setRowHeight(50);
    tbl_cust.setFont(new java.awt.Font("Arial", 1, 12));
  }
  private void edit_customer() {

    int row = tbl_cust.getSelectedRow();
    if (row < 0) {
      return;
    }
    final String num = tbl_cust.getModel().getValueAt(row, 1).toString();

    //         JOptionPane.showMessageDialog(null, to.b_date);
    Window p = (Window) this;
    Dlg_customers nd = Dlg_customers.create(p, true);
    nd.setTitle("");
    if (System.getProperty("version", "resto").equals("resto")) {
      S2_customers.customers to = S2_customers.get_cust_guest(num);
      //            System.out.println(to.member_name + " asdasd");
      nd.do_pass(
          to.member_name,
          to.address,
          to.contact,
          to.occupation,
          to.income,
          to.b_date,
          to.civil_status,
          to.is_male,
          to.balance,
          num,
          to.credit_limit);
    } else {
      S2_customers.customers to = S2_customers.get_cust_details(num);
      nd.do_pass(
          to.member_name,
          to.address,
          to.contact,
          to.occupation,
          to.income,
          to.b_date,
          to.civil_status,
          to.is_male,
          to.balance,
          num,
          to.credit_limit);
    }

    nd.setCallback(
        new Dlg_customers.Callback() {

          @Override
          public void ok(CloseDialog closeDialog, Dlg_customers.OutputData data) {
            closeDialog.ok();
            do_edit_customer(
                data.name,
                data.add,
                data.contact,
                data.occupation,
                data.income,
                data.bday,
                data.civil_status,
                data.gender,
                num,
                data.balance,
                data.credit_limit);
          }

          @Override
          public void balance(CloseDialog closeDialog, Dlg_customers.OutputData data) {
            data_employee();
            int row = tbl_cust.getSelectedRow();
            if (row < 0) {
              return;
            }
            String num = tbl_cust.getModel().getValueAt(row, 1).toString();
            //        JOptionPane.showMessageDialog(null, num);
            loadData_charges(S2_customers.ret_charges(num));
            compute_charges();
          }
        });
    Center.setCenter(nd);

    nd.setVisible(true);
  }