Пример #1
0
  public List<TicketLineInfo> getAffectedLines() {
    List<TicketLineInfo> lines = new ArrayList<TicketLineInfo>();

    int i = ticketlines.getSelectedIndex();
    if (i >= 0) {
      TicketLineInfo line = ticket.getLine(i);

      /* Si el producto seleccionado es axuliar o descuento, no podemos transferirlo */
      if (line.isProductCom() || line.isDiscount()) return lines;

      ticket.removeLine(i);
      ticketlines.removeTicketLine(i);
      lines.add(line);

      /* Comprobamos si la linea corresponde a un producto con productos auxiliares
       * como puede ser un menu o si tiene algun descuento por linea asociado
       */
      if (!line.isProductCom() && !line.isDiscount()) {
        while (i < ticket.getLinesCount()
            && ((line = (TicketLineInfo) ticket.getLine(i)).isProductCom() || line.isDiscount())) {
          lines.add(new TicketLineInfo(line));
          ticket.removeLine(i);
          ticketlines.removeTicketLine(i);
        }
      }
      printTotals();
    }
    return lines;
  }
Пример #2
0
  public void setTicket(TicketInfo ticket, Object ticketext) {

    this.ticket = ticket;
    this.ticketext = ticketext;

    // The ticket name
    m_jTicketId.setText(ticket.getName(ticketext));

    ticketlines.clearTicketLines();
    for (int i = 0; i < ticket.getLinesCount(); i++) {
      ticketlines.addTicketLine(ticket.getLine(i));
    }

    if (ticket.getLinesCount() > 0) {
      ticketlines.setSelectedIndex(0);
    }

    printTotals();
  }
Пример #3
0
  private void m_jRefundActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_m_jRefundActionPerformed

    java.util.List aRefundLines = new ArrayList();

    for (int i = 0; i < m_ticket.getLinesCount(); i++) {
      TicketLineInfo newline = new TicketLineInfo(m_ticket.getLine(i));
      aRefundLines.add(newline);
    }

    m_ticketCopy = null;
    m_TicketsBagTicketBag.showRefund();
    m_panelticketedit.showRefundLines(aRefundLines);

    TicketInfo refundticket = new TicketInfo();
    refundticket.setTicketType(TicketInfo.RECEIPT_REFUND);
    refundticket.setCustomer(m_ticket.getCustomer());
    m_panelticketedit.setActiveTicket(refundticket, null);
  } // GEN-LAST:event_m_jRefundActionPerformed
Пример #4
0
  /**
   * This is the action called from the Struts framework.
   *
   * @param mapping The ActionMapping used to select this instance.
   * @param form The optional ActionForm bean for this request.
   * @param request The HTTP Request we are processing.
   * @param response The HTTP Response we are processing.
   * @throws java.lang.Exception
   * @return
   */
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    FloorForm inputForm = (FloorForm) form;
    RestaurantManager manager = new RestaurantManager();

    Place place = manager.findPlaceByName(inputForm.getFloorId());

    TicketInfo ticketInfo = manager.findTicket(place.id);

    if (ticketInfo.getUser() == null) {
      ticketInfo.setUser((UserInfo) request.getSession().getAttribute("user"));
    }
    TicketDAO tkdao = new TicketDAO();
    tkdao.updateTicket(place.id, ticketInfo);

    PrintPDA printer = new PrintPDA();
    printer.PrintPDATicket(place.getName(), ticketInfo, place.getName());

    // Obtenemos un Iterador y recorremos la lista.
    List<TicketLineInfo> lst = ticketInfo.getLines();
    ListIterator iter = lst.listIterator();
    int i = 0;
    while (iter.hasNext()) {
      ticketInfo.getLine(i).getProperties().setProperty("sendstatus", "Yes");
      i = i + 1;
      if (i >= lst.size()) break;
    }
    tkdao = new TicketDAO();
    tkdao.updateTicket(place.id, ticketInfo);

    return mapping.findForward(PRINTING);
  }
Пример #5
0
  public void addAffectedLines(List<TicketLineInfo> lines) {

    int i = ticketlines.getSelectedIndex();
    int e = 0;
    for (e = 0; e < lines.size(); e++, i++) {
      TicketLineInfo line = lines.get(e);
      if (i >= 0
          && ticket.getLine(i).getProduct().getId() != null
          && line.getProduct().getId() != null
          && ticket.getLine(i).getProduct().getId().equals(line.getProduct().getId())
          && ticket.getLine(i).getTaxInfo().getId().equals(line.getTaxInfo().getId())
          && ticket.getLine(i).getPrice() == line.getPrice()) {
        // inc the line
        ticket.getLine(i).setMultiply(ticket.getLine(i).getMultiply() + line.getMultiply());
        ticketlines.setTicketLine(i, ticket.getLine(i));
      } else {
        ticket.addLine(line);
        ticketlines.addTicketLine(line);
      }
    }
    printTotals();
  }