Package com.zesped.model

Examples of com.zesped.model.Ticket$NoteNumComparator


    super.validateBillNoteVsEmployee(errors);
  }

  public Resolution upload() throws Exception {
    String sFwd;
    Ticket tckt = null;
    BillNote bill = null;
    setCapturedCount(0);
    final int nItems = (getItems()==null ? 0 : getItems().size());
    if (nItems>0) {
      Log.out.debug("UploadBillNote "+String.valueOf(nItems)+" items found");
      try {
        connect(getSessionAttribute("nickname"), getSessionAttribute("password"));

        TaxPayer txpy = new TaxPayer(getSession().getDms(), getRecipientTaxPayer());

        bill = txpy.billnotes(getSession()).forConcept(getSession(), getConcept(), getEmployee());
        setCapturedPage1("");

        for (FileBean attachment : getItems()) {
          if (attachment != null) {
            if (attachment.getSize() > 0) {
              if (tckt==null) {
                tckt = bill.createTicket(getSession(), getAccount());
                setId(tckt.id());
                FlashScope oFscope = FlashScope.getCurrent(getContext().getRequest(), true);
                oFscope.put("ticket_docid", tckt.id());
              }
              TicketNote note = tckt.createNote(getSession(), attachment.getInputStream(), incCapturedCount(), attachment.getFileName());
              if (getCapturedPage1().length()==0) setCapturedPage1(note.id());
              attachment.delete();
            } else {
              ValidationError error = new SimpleError(attachment.getFileName()+ " is not a valid file." );
              getContext().getValidationErrors().add("items" , error);
            }
          }
          } // next
        disconnect();
        if (getCapturedCount()>0)
          ThumbnailCreator.createThumbnailFor(getId(), getCapturedPage1());       
        sFwd = "EditBillNote.action?id="+tckt.id();
      } catch (IllegalStateException e) {
        Log.out.error("BillNoteUpload.upload() "+e.getClass().getName()+" "+e.getMessage(), e);
        getContext().getMessages().add(new SimpleMessage("ERROR "+e.getMessage(), items));
        sFwd = "error.jsp?e=couldnotloadticket";
      } finally { close(); }
View Full Code Here


  public TicketThumbnail getThumbnail() {
    Log.out.debug("EditBillNote.getThumbnail("+getId()+")");
    if (thumbnail==null) {
      try {
        connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
        Ticket oTck = new Ticket(getSession().getDms(), getId());
          thumbnail = oTck.thumbnail(getSession());
        } catch (Exception xcpt) {
            Log.out.error(xcpt.getMessage(), xcpt);
        } finally {
          close();
        }     
View Full Code Here

    } else {
      setParam("id", getId());
      Date dtToday = new Date();
      try {
          connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
          Ticket oTck = new Ticket(getSession().getDms(), getId());
          setId(oTck.id());
          setOpen(oTck.isOpen());
          setNumber(oTck.getTicketNumber());
          setRecipientTaxPayer(oTck.getTaxPayer());
          setProcessed(oTck.isProcessed());
          setAccount(oTck.account(getSession()));
          setBaseAmount(oTck.getBaseAmount());
          setBillerTaxPayer(oTck.getBillerTaxPayer());
          setCurrency(oTck.getCurrency());
          setPaymentMean(oTck.getPaymentMean());
          setTotalAmount(oTck.getTotalAmount());
          setVat(oTck.getVat());
          setVatPct(oTck.getVatPct());
          setDescription(oTck.getConcept());
          setComments(oTck.getComments());
          if (oTck.getTicketDate()==null) {
            setBillMonth(dtToday.getMonth()+1);
            setBillYear(dtToday.getYear()+1900);
          } else {
            setBillDay(oTck.getTicketDate().getDate());
            setBillMonth(oTck.getTicketDate().getMonth()+1);
            setBillYear(oTck.getTicketDate().getYear()+1900);
          }
          BillNote oBln = oTck.billNote(getSession());
          setBillNoteId(oBln.id());
          setConcept(oBln.getConcept());
          setEmployee(oBln.getEmployeeUuid());
          ArrayList<TicketNote> oPgs = oTck.pages(getSession());
          setCapturedCount(oPgs.size());
          if (oPgs.size()>0) setCapturedPage1(oPgs.get(0).id());
          for (TicketNote n : oPgs)
            pages.add(n.id());
          disconnect();
View Full Code Here

  }
 
  public Resolution save() {
      try {
      connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
      Ticket tckt = new Ticket(getSession().getDms(), getId());
        tckt.put("accounting_uuid", getAccount().getUuid());
        tckt.put("accounting_code", getAccount().getCode());
        tckt.put("accounting_desc", getAccount().getDescription());
        tckt.isOpen(getOpen());
        tckt.isProcessed(getProcessed());
        tckt.setBaseAmount(getBaseAmount());
      tckt.setBillerTaxPayer(getBillerTaxPayer());
      tckt.setConcept(getDescription());
      tckt.setComments(getComments());
      tckt.setCurrency(getCurrency());
      tckt.setPaymentMean(getPaymentMean());
      tckt.setTaxPayer(getRecipientTaxPayer());
      tckt.setTicketNumber(getNumber());
      tckt.setTotalAmount(getTotalAmount());
      tckt.setVat(getVat());
      tckt.setVatPct(getVatPct());
      if (getBillDay()>0 && getBillMonth()>0 && getBillYear()>0) {
            tckt.setTicketDate(new Date(getBillYear()-1900, getBillMonth()-1, getBillDay()))
      } else {
        tckt.remove("year");
        tckt.remove("month");
        tckt.remove("ticket_date");
      }
      if (getBillNoteId()!=null) {
        if (!getBillNoteId().equals(tckt.billNote(getSession()).id())) {
          tckt.changeBillNote(getSession(), getBillNoteId());
        }
      }
      tckt.save(getSession(), getSessionAttribute("user_uuid"), getProcessed(), false);
      disconnect();
      return new RedirectResolution(ListNewBillNotes.class);
      } catch (StorageException e) {
      setParam("id", getId());
        Log.out.error("EditBillNote.save() "+e.getClass().getName()+" "+e.getMessage());
View Full Code Here

    }

  public Resolution reopen() {
      try {
      connect(getSessionAttribute("nickname"), getSessionAttribute("password"));
      Ticket tckt = new Ticket(getSession().getDms(), getId());
      tckt.reopen(getSession(), getSessionAttribute("user_uuid"));
      disconnect();
      } catch (StorageException e) {
      setParam("id", getId());
        Log.out.error("EditBillNote.reopen() "+e.getClass().getName()+" "+e.getMessage());
      getContext().getMessages().add(new SimpleMessage("ERROR "+e.getMessage()));
View Full Code Here

        oDzb.start();
        Log.out.debug("Done attaching sides");
      } else {
        TaxPayer txpy = new TaxPayer(getSession().getDms(), sTaxPayerId);
        BillNote bill = txpy.billnotes(getSession()).forConcept(getSession(), sConcept, sEmployee);
        Ticket tckt = bill.createTicket(getSession(), new AccountingAccount(getSession(), sAccount));
        disconnect();
        DepositToZespedBridge oDzb = new DepositToZespedBridge(CaptureService.BILLNOTES, lDepositId, Long.parseLong(tckt.getId()));
        oDzb.start();
        Log.out.debug("Done attaching sides");
        FlashScope oFscope = FlashScope.getCurrent(getContext().getRequest(), true);
        oFscope.put("ticket_docid", tckt.id());
      }     
      new CreditBurner(getSessionAttribute("user_uuid"),
               getSessionAttribute("customer_account_docid"),
               sService, sFlavor).start();
    } catch (Exception e) {
View Full Code Here

      final int nTickets = getTicketIds().size();
      Log.out.debug(String.valueOf(nTickets)+" tickets found");
      Log.out.debug(String.valueOf(getBillers().size())+" billers found");
      for (int t=0; t<nTickets; t++) {
        Log.out.debug("Updating Ticket "+getTicketIds().get(t));
        Ticket oTck = new Ticket(oDms, getTicketIds().get(t));
        if (getTicketNumbers().size()>t)
          if (getTicketNumbers().get(t)==null)
            oTck.remove("ticket_number");
          else
            oTck.put("ticket_number", getTicketNumbers().get(t));       
        else
          oTck.remove("ticket_number");         
        if (getAccounts().get(t).length()==0) {
          oTck.remove("accounting_uuid");
          oTck.remove("accounting_code");
          oTck.remove("accounting_desc");
        } else {
          AccountingAccount oAcc = new AccountingAccount(oDms,getAccounts().get(t));
          oTck.put("accounting_uuid", oAcc.getUuid());
          oTck.put("accounting_code", oAcc.getCode());
          oTck.put("accounting_desc", oAcc.getDescription());
        }
        if (getBillers().size()>t) {
          Log.out.debug("Ticket biller is "+getBillers().get(t));
          if (getBillers().get(t)!=null)
            if (getBillers().get(t).id()!=null)
              oTck.setBillerTaxPayer(getBillers().get(t).id());         
            else
              oTck.setBillerTaxPayer("");                   
          else
            oTck.setBillerTaxPayer("");                   
        } else {
          oTck.setBillerTaxPayer("");                   
        }
        Log.out.debug("Ticket base amount "+getBaseAmounts().get(t));
        if (getBaseAmounts().get(t)!=null)
          oTck.setBaseAmount(getBaseAmounts().get(t));
        if (getTotalAmounts().get(t)!=null)
          oTck.setTotalAmount(getTotalAmounts().get(t));
        if (getVats().get(t)!=null)
          oTck.setVat(getVats().get(t));
        if (getVatPcts().get(t)!=null)
          oTck.setVatPct(getVatPcts().get(t));       
        if (bSettle) {
          oTck.isOpen(false);
          oTck.isProcessed(true);
        }
        oTck.save(getSession());
      }
      Log.out.debug("Updating Bill Note");
      BillNote oBln = new BillNote(oDms, getId());
      oBln.setProcessDate(new Date());
      if (bSettle) {
View Full Code Here

      CustomerAccount oAcc = new CustomerAccount(oSes.getDms(), sAccId);
      Iterator<TaxPayer> oItr = oAcc.taxpayers(oSes).list(oSes).iterator();
    TaxPayer oTpr = oItr.next();
    String sEmployeeUuid = "";
    BillNote oBln = oTpr.billnotes(oSes).create(oSes, oUsr.getNickName(), CaptureServiceFlavor.BASIC, oTpr.id(), "Test Concept", sEmployeeUuid);
    Ticket oTck = oBln.createTicket(oSes);
    oTck.createNote(oSes, getClass().getResourceAsStream("OutbackSteakhouse.jpg"), 1, "OutbackSteakhouse.jpg");
    closeTestSession(oSes);
  }
View Full Code Here

TOP

Related Classes of com.zesped.model.Ticket$NoteNumComparator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.