Exemplo n.º 1
0
  private void processKey(char c) {

    if (c == '\n') {

      AppUser user = null;
      try {
        user = m_dlSystem.findPeopleByCard(inputtext.toString());
      } catch (BasicException e) {
        e.printStackTrace();
      }

      if (user == null) {
        // user not found
        MessageInf msg =
            new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.nocard"));
        msg.show(this);
      } else {
        openAppView(user);
      }

      inputtext = new StringBuffer();
    } else {
      inputtext.append(c);
    }
  }
Exemplo n.º 2
0
  private void listPeople() {

    try {

      jScrollPane1.getViewport().setView(null);

      JFlowPanel jPeople = new JFlowPanel();
      jPeople.applyComponentOrientation(getComponentOrientation());

      java.util.List people = m_dlSystem.listPeopleVisible();

      for (int i = 0; i < people.size(); i++) {

        AppUser user = (AppUser) people.get(i);

        JButton btn = new JButton(new AppUserAction(user));
        btn.applyComponentOrientation(getComponentOrientation());
        btn.setFocusPainted(false);
        btn.setFocusable(false);
        btn.setRequestFocusEnabled(false);
        btn.setHorizontalAlignment(SwingConstants.LEADING);
        btn.setMaximumSize(new Dimension(150, 50));
        btn.setPreferredSize(new Dimension(150, 50));
        btn.setMinimumSize(new Dimension(150, 50));

        jPeople.add(btn);
      }
      jScrollPane1.getViewport().setView(jPeople);

    } catch (BasicException ee) {
      ee.printStackTrace();
    }
  }
  public void checkout(TicketInfo ticket, String place) throws BasicException {
    appView = AppViewImpl.getInstance();
    DataLogicSales dlSales = appView.getBean(DataLogicSales.class);

    try {
      // reset the payment info
      TaxesLogic taxesLogic = new TaxesLogic(dlSales.getTaxList().list());
      taxesLogic.calculateTaxes(ticket);
      if (ticket.getTotal() >= 0.0) {
        ticket.resetPayments(); // Only reset if is sale
      }

      // assign the payments selected and calculate taxes.
      List<PaymentInfo> payments = new ArrayList<PaymentInfo>();
      payments.add(new PaymentInfoCash(ticket.getTotal(), ticket.getTotalPaid()));
      ticket.setPayments(payments);

      // Asigno los valores definitivos del ticket...
      ticket.setUser(appView.getAppUserView().getUser().getUserInfo()); // El usuario que lo cobra
      ticket.setActiveCash(appView.getActiveCashIndex());
      ticket.setDate(new Date()); // Le pongo la fecha de cobro

      // Save the receipt and assign a receipt number
      try {
        dlSales.saveTicket(ticket, appView.getInventoryLocation());
      } catch (BasicException eData) {
        eData.printStackTrace();
      }

    } catch (TaxesException e) {
      e.printStackTrace();
    }
  }
 public void search() {
   try {
     jListProducts.setModel(new MyListData(lpr.loadData()));
     if (jListProducts.getModel().getSize() > 0) {
       jListProducts.setSelectedIndex(0);
     }
   } catch (BasicException e) {
     new MessageInf(MessageInf.SGN_WARNING, "Error", e).show(this);
     e.printStackTrace();
   }
 }
Exemplo n.º 5
0
  public boolean executeSentence(BaseSentence sent, Object params) {

    CardLayout cl = (CardLayout) (getLayout());

    try {
      DataResultSet rs = sent.openExec(params);

      if (rs.updateCount() < 0) {
        cl.show(this, "resultset");

        DataField[] df = rs.getDataField();

        SQLTableModel sqlresult = new SQLTableModel(df);

        while (rs.next()) {
          sqlresult.addRow(rs);
        }
        rs.close();

        sent.closeExec();

        m_jTableResult.setModel(sqlresult);
      } else {
        cl.show(this, "updatecount");
        m_txtResulltText.setText("Update count: " + Integer.toString(rs.updateCount()));
        m_txtResulltText.setCaretPosition(0);
      }
      return true;

    } catch (BasicException e) {
      cl.show(this, "updatecount");
      StringWriter w = new StringWriter();
      e.printStackTrace(new PrintWriter(w));
      m_txtResulltText.setText(w.toString());
      m_txtResulltText.setCaretPosition(0);
      // e.printStackTrace();
      return false;
    }
  }