Package com.zesped.model

Examples of com.zesped.model.CustomerAccount


  @DefaultHandler
  public Resolution form() {
    try {     
        connect();
        CustomerAccount oAcc = new CustomerAccount(getSession().getDms(), getSessionAttribute("customer_account_docid"));
        cused = oAcc.getCreditsUsed().intValue();
        cleft = oAcc.getCreditsLeft().intValue();
        ordrs = oAcc.orders(getSession()).list(getSession());
        if (ordrs.size()>0) {
        cbought = ordrs.get(0).getCreditsBought().intValue();
        } else {
        cbought = 0;
        }
        ArrayList<TaxPayer> oTxps = oAcc.taxpayers(getSession()).list(getSession());
        for (TaxPayer p : oTxps) {
        cbasic   += p.basicInvoices(getSession()).size();
          cpremium += p.premiumInvoices(getSession()).size();
          ctickets += p.allTickets(getSession()).size();
        }       
View Full Code Here


    } catch (Exception e) {
      Log.out.error("EditConfig.getClients() Cache.getObject("+getSessionAttribute("customer_account_docid")+"clients) "+e.getClass().getName()+" "+e.getMessage(), e);
    }
    if (null==clients) {
      AtrilSession oSes = DAO.getAdminSession("CaptureInvoice");
      CustomerAccount oAcc = new CustomerAccount(oSes.getDms().getDocument(getSessionAttribute("customer_account_docid")));
      clients = oAcc.clients(oSes).list(oSes);
      for (Client oCli : clients)
        if (oCli.getTaxId().length()>0)
          oCli.setBusinessName(oCli.getBusinessName()+" ("+oCli.getTaxId()+")");
      oSes.disconnect();
      oSes.close();
View Full Code Here

    } catch (Exception e) {
      Log.out.error("CaptureInvoice.getClients() Cache.getObject("+getSessionAttribute("customer_account_docid")+"clients) "+e.getClass().getName()+" "+e.getMessage(), e);
    }
    if (null==clients) {
      AtrilSession oSes = DAO.getAdminSession("CaptureInvoice");
      CustomerAccount oAcc = new CustomerAccount(oSes.getDms().getDocument(getSessionAttribute("customer_account_docid")));
      clients = oAcc.clients(oSes).list(oSes);
      for (Client oCli : clients)
        if (oCli.getTaxId().length()>0)
          oCli.setBusinessName(oCli.getBusinessName()+" ("+oCli.getTaxId()+")");
      oSes.disconnect();
      oSes.close();
View Full Code Here

 
  @DefaultHandler
  public Resolution form() {
    try {
        connect();
        TaxPayers txprs = new CustomerAccount(getSession().getDms(), getSessionAttribute("customer_account_docid")).taxpayers(getSession());
        for (TaxPayer t : txprs.list(getSession())) {
        totalInvoices.add(new Integer((int) t.getTotalInvoicesCount()));
        totalTickets.add(new Integer((int) t.getTotalTicketsCount()));
        allowed.add(new Integer(t.allowedUsers(getSession()).size()));
        employees.add(new Integer(t.employees(getSession()).count()));
View Full Code Here

    return null;
  }

  public Collection<TaxPayer> getTaxPayers() throws ElementNotFoundException, NotEnoughRightsException, DmsException, InstantiationException, IllegalAccessException {
    AtrilSession oSes = DAO.getAdminSession("EditUser");
    CustomerAccount oAcc = new CustomerAccount(oSes.getDms().getDocument(getSessionAttribute("customer_account_docid")));
    Collection<TaxPayer> taxpayers = oAcc.taxpayers(oSes).list(oSes);
    oSes.disconnect();
    oSes.close();
    return taxpayers;
  }
View Full Code Here

    } else {
      try {
            connect();
            setUser(new User(getSession(), getParam("id")));
            setActive(getUser().isActive());
            setRole(getUser().getRole(new CustomerAccount(getSession().getDms(), getSessionAttribute("customer_account_docid"))));
            if (getUser().getAllowedTaxPayers().size()>0)
              setPermissions("allow");
            else if (getUser().getDeniedTaxPayers().size()>0)
              setPermissions("deny");
            else
View Full Code Here

      ACCID = CustomerAccount.forBusinessName(TEST_BUSINESSNAME);
    } catch (ElementNotFoundException notfound) {   
      ACCID = CustomerAccount.create(oSes, new User(oSes, USRID), TEST_BUSINESSNAME).id();   
    }
   
    CustomerAccount oAcc = new CustomerAccount(oSes.getDms(), ACCID);
    if (oAcc.taxpayers(oSes).list(oSes).size()==0)
      TaxPayer.create(oSes, oAcc, TEST_BUSINESSNAME+" tax payer", "John Smith", "johnj@junittesting.com", null);

    oSes.disconnect();
    oSes.close();
    }
View Full Code Here

      oUsr.setLastName("Test Last Name "+generateRandomId(6, null,Character.UPPERCASE_LETTER));
      oUsr.setPassword("12345678");
      oUsr.create(oSes);
      oSes.commit();
      String sBizName = "Test Company "+generateRandomId(6, null,Character.UPPERCASE_LETTER);
      CustomerAccount oCac = CustomerAccount.create(oSes, oUsr, sBizName);
    oSes.commit();
    TaxPayer.create(oSes, oCac, sBizName, "", oUsr.getFirstName()+" "+oUsr.getLastName(), oUsr.getEmail(), true, null);
    oSes.commit();
      closeTestSession(oSes);
  }
View Full Code Here

 
  @Test public void createInvoice()
    throws IllegalArgumentException,AuthorizationManagerAdminException,DuplicatedElementException,ElementNotFoundException,NotEnoughRightsException, DmsException, InstantiationException, IllegalAccessException {
      AtrilSession oSes = openTestSession();
      User oUsr = new User(oSes, USRID);
      CustomerAccount oAcc = new CustomerAccount(oSes.getDms(), ACCID);
      Iterator<TaxPayer> oItr = oAcc.taxpayers(oSes).list(oSes).iterator();
    TaxPayer oTpr = oItr.next();
    oTpr.invoices(oSes).create(oSes, oUsr.getNickName(), CaptureServiceFlavor.BASIC, oTpr.id(), null, null);
      closeTestSession(oSes);
  }
View Full Code Here

 
  @Test public void uploadInvoice()
    throws DmsException, NotYetConnectedException, ClassCastException, IllegalStateException, NullPointerException, RuntimeException, IOException, InstantiationException, IllegalAccessException {
      AtrilSession oSes = openTestSession();
      User oUsr = new User(oSes, USRID);
      CustomerAccount oAcc = new CustomerAccount(oSes.getDms(), ACCID);
      Iterator<TaxPayer> oItr = oAcc.taxpayers(oSes).list(oSes).iterator();
    TaxPayer oTpr = oItr.next();
    Invoice oInv = oTpr.invoices(oSes).create(oSes, oUsr.getNickName(), CaptureServiceFlavor.BASIC, oTpr.id(), null, null);
    oInv.createPage(oSes, getClass().getResourceAsStream("BilleteIberia.jpg"), 1, "BilleteIberia");
    closeTestSession(oSes);
  }
View Full Code Here

TOP

Related Classes of com.zesped.model.CustomerAccount

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.