@Override
 public void writeValueEOF() {
   m_sID = null;
   m_jdate.setText(null);
   m_ReasonModel.setSelectedKey(null);
   m_LocationsModel.setSelectedKey(m_App.getInventoryLocation());
   productid = null;
   productref = null;
   productcode = null;
   productname = null;
   m_jreference.setText(null);
   m_jcodebar.setText(null);
   jproduct.setText(null);
   attsetid = null;
   attsetinstid = null;
   attsetinstdesc = null;
   jattributes.setText(null);
   m_junits.setText(null);
   m_jprice.setText(null);
   m_jdate.setEnabled(false);
   m_jbtndate.setEnabled(false);
   m_jreason.setEnabled(false);
   m_jreference.setEnabled(false);
   m_jEnter1.setEnabled(false);
   m_jcodebar.setEnabled(false);
   m_jEnter.setEnabled(false);
   m_jLocation.setEnabled(false);
   jproduct.setEnabled(false);
   jEditProduct.setEnabled(false);
   jattributes.setEnabled(false);
   jEditAttributes.setEnabled(false);
   m_junits.setEnabled(false);
   m_jprice.setEnabled(false);
   m_cat.setComponentEnabled(false);
 }
예제 #2
0
  public void writeValueInsert() {
    m_sID = UUID.randomUUID().toString();
    m_jdate.setText(Formats.TIMESTAMP.formatValue(DateUtils.getTodayMinutes()));
    m_ReasonModel.setSelectedItem(MovementReason.IN_PURCHASE);
    m_LocationsModel.setSelectedKey(m_App.getInventoryLocation());
    productid = null;
    productref = null;
    productcode = null;
    productname = null;
    m_jreference.setText(null);
    m_jcodebar.setText(null);
    jproduct.setText(null);
    attsetid = null;
    attsetinstid = null;
    attsetinstdesc = null;
    jattributes.setText(null);
    m_jcodebar.setText(null);
    m_junits.setText(null);
    m_jprice.setText(null);
    m_jdate.setEnabled(true);
    m_jbtndate.setEnabled(true);
    m_jreason.setEnabled(true);
    m_jreference.setEnabled(true);
    m_jEnter1.setEnabled(true);
    m_jcodebar.setEnabled(true);
    m_jEnter.setEnabled(true);
    m_jLocation.setEnabled(true);
    jproduct.setEnabled(true);
    jEditProduct.setEnabled(true);
    jattributes.setEnabled(true);
    jEditAttributes.setEnabled(true);
    m_junits.setEnabled(true);
    m_jprice.setEnabled(true);
    m_cat.setComponentEnabled(true);

    // MSL
    supplierid = null;
    m_jSupplierId.setText(null);
  }
예제 #3
0
  private void btnPayActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnPayActionPerformed

    paymentdialog.setPrintSelected(true);
    // MSL : get total of selected tickets
    double tt = 0;
    for (Object tl : jList1.getSelectedValues()) {

      FindTicketsInfoCustomer sTicket = (FindTicketsInfoCustomer) tl;
      TicketInfo t = new TicketInfo();
      try {
        t = dlsales.loadTicket(0, sTicket.getTicketId());
        tt = tt + t.getTotal(); // - t.getTotalPaid();
      } catch (BasicException e) {

      }
    }
    // -------------

    // if (paymentdialog.showDialog(customerext.getCurdebt(), null)) {
    if (paymentdialog.showDialog(tt, null)) {

      // Save the ticket
      /*TicketInfo ticket = new TicketInfo();
      ticket.setTicketType(TicketInfo.RECEIPT_PAYMENT);

      List<PaymentInfo> payments = paymentdialog.getSelectedPayments();

      double total = 0.0;
      for (PaymentInfo p : payments) {
          total += p.getTotal();
      }

      payments.add(new PaymentInfoTicket(-total, "debtpaid"));

      ticket.setPayments(payments);

      ticket.setUser(app.getAppUserView().getUser().getUserInfo());
      ticket.setActiveCash(app.getActiveCashIndex());
      ticket.setDate(new Date());
      ticket.setCustomer(customerext);

      try {
          dlsales.saveTicket(ticket, app.getInventoryLocation());
      } catch (BasicException eData) {
          MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.nosaveticket"), eData);
          msg.show(this);
      }
       *
       */

      // Save the ticket
      TicketInfo ticket = new TicketInfo();
      ticket.setTicketType(TicketInfo.RECEIPT_PAYMENT);

      List<PaymentInfo> payments = paymentdialog.getSelectedPayments();

      double total = 0.0;
      for (PaymentInfo p : payments) {
        total += p.getTotal();
      }
      double reste = total;

      for (Object tl : jList1.getSelectedValues()) {
        FindTicketsInfoCustomer sTicket = (FindTicketsInfoCustomer) tl;
        TicketInfo t = new TicketInfo();

        if (reste > 0) {
          try {
            t = dlsales.loadTicket(0, sTicket.getTicketId());

            payments.add(new PaymentInfoTicket(-t.getTotal(), "debtpaid"));
            reste = total - t.getTotal();

            ticket.setPayments(payments);
            ticket.setUser(app.getAppUserView().getUser().getUserInfo());
            ticket.setActiveCash(app.getActiveCashIndex());
            ticket.setDate(new Date());
            ticket.setCustomer(customerext);
            dlsales.saveTicket(ticket, app.getInventoryLocation());
            new StaticSentence(
                    this.app.getSession(),
                    "UPDATE TICKETS Set STATUS=9 WHERE ID = ?",
                    SerializerWriteString.INSTANCE)
                .exec(t.getId());

            // MSL : break the system : set the receipt with original one
            // TODO : split the amount paid to the ticket values
            /*new StaticSentence(this.app.getSession()
                        , "UPDATE RECEIPTS Set ID=? WHERE ID = ?"
                        , new SerializerWriteBasic(new Datas[] {Datas.STRING, Datas.STRING}))
                        .exec(new Object[] {t.getId(), ticket.getId()});
            */
            new StaticSentence(
                    this.app.getSession(),
                    "UPDATE PAYMENTS Set TICKETID=? WHERE RECEIPT = ?",
                    new SerializerWriteBasic(new Datas[] {Datas.STRING, Datas.STRING}))
                .exec(new Object[] {t.getId(), ticket.getId()});

          } catch (BasicException eData) {
            MessageInf msg =
                new MessageInf(
                    MessageInf.SGN_NOTICE, AppLocal.getIntString("message.nosaveticket"), eData);
            msg.show(this);
          }
        }
      }

      // MSL : no tickets selected
      if ((jList1.getSelectedValues() == null) || (reste > 0)) {

        payments.add(new PaymentInfoTicket(-reste, "debtpaid"));

        ticket.setPayments(payments);

        ticket.setUser(app.getAppUserView().getUser().getUserInfo());
        ticket.setActiveCash(app.getActiveCashIndex());
        ticket.setDate(new Date());
        ticket.setCustomer(customerext);

        try {
          dlsales.saveTicket(ticket, app.getInventoryLocation());
        } catch (BasicException eData) {
          MessageInf msg =
              new MessageInf(
                  MessageInf.SGN_NOTICE, AppLocal.getIntString("message.nosaveticket"), eData);
          msg.show(this);
        }
      }

      // reload customer
      CustomerInfoExt c;
      try {
        c = dlsales.loadCustomerExt(customerext.getId());
        if (c == null) {
          MessageInf msg =
              new MessageInf(
                  MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotfindcustomer"));
          msg.show(this);
        } else {
          editCustomer(c);
        }
      } catch (BasicException ex) {
        c = null;
        MessageInf msg =
            new MessageInf(
                MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotfindcustomer"), ex);
        msg.show(this);
      }

      printTicket(
          paymentdialog.isPrintSelected() ? "Printer.CustomerPaid" : "Printer.CustomerPaid2",
          ticket,
          c);
    }

    editorcard.reset();
    editorcard.activate();
  } // GEN-LAST:event_btnPayActionPerformed