Examples of Expenditure


Examples of br.com.visualmidia.business.Expenditure

        this.isActive = isActive;
    }
   
  @Override
    protected void execute(PrevalentSystem system) {
      Expenditure expenditure = system.getExpenditure().get(expenditureId);
      expenditure.setActive(isActive);
    }
View Full Code Here

Examples of br.com.visualmidia.business.Expenditure

        this.gdDateNextPaymentDate = new GDDate(nextPaymentDate);
    }

    @Override
    protected void execute(PrevalentSystem system) throws BusinessException {
        Expenditure bill = system.expenditure.get(id);
       
        bill.setNextPaymentDate(gdDateNextPaymentDate);

        if(!bill.isFixedValue()) {
            Map<String, PaidExpenditure> tempMap = new HashMap<String, PaidExpenditure>();
            for (PaidExpenditure bill2 : system.paidExpenditures.values()) {
                if(bill2.getEnpenditure() == bill) {
                    tempMap.put(bill2.getId(), bill2);
                }
            }
           
            Money total = new Money(0);
           
            for (PaidExpenditure bills : tempMap.values()) {
                total.credit(bills.getValue());
            }
           
            bill.setValue(new Money(total.getValue()/tempMap.size()));
        }
       
        if (bill.getFrequency() == 0)
            bill.setActive(false);
    }
View Full Code Here

Examples of br.com.visualmidia.business.Expenditure

        int count = 0;
        Money total = new Money(0);
        String idOperation = getIdOperation(system);

        Account account = system.getAccounts().get(accountId);
        Expenditure expenditure = system.getExpenditure().get(expenditureId);
//        Expenditure myExpenditure = new Expenditure(expediture.getId(), expediture.getDescription(), expediture.getNextPaymentDate(), expediture.getFrequency(), expediture.getNumberOfOcurrencies(), expediture.getValue(), expediture.isFixedValue(), expediture.getCategoryId());
//        myExpenditure.setActive(false);

        Operation operation;
       
        if(typeOfPayment == null){
          typeOfPayment = system.getPaymentMoney();
        }else{
          if (typeOfPayment.getType().equals("Dinheiro")) {
            typeOfPayment = system.getPaymentMoney();
      } else if (typeOfPayment.getType().equals("D�bito autom�tico")) {
        typeOfPayment = system.getPaymentAutomaticDebit();
      } else if (typeOfPayment.getType().equals("Pagamento eletr�nico")) {
        typeOfPayment = system.getPaymentEletronic();
      } else if (typeOfPayment.getType().equals("Transfer�ncia eletr�nica")) {
        typeOfPayment = system.getPaymentEletronicTransfer();
      } else if (typeOfPayment.getType().equals("TED")) {
        typeOfPayment = system.getPaymentTED();
      } else if (typeOfPayment.getType().equals("DOC")) {
        typeOfPayment = system.getPaymentDOC();
      } else if (typeOfPayment.getType().equals("Saque cart�o")) {
        typeOfPayment = system.getPaymentGetMoney();
      }
        }
       
        if(idExtractItem == null){
            operation = new Operation(idOperation, account,expenditure.getCategoryId(),date, expenditure.getDescription(),new Money(value).getFloatValue(),typeOfPayment, true, expenditure.getId());
        } else {
            operation = new Operation(idOperation, account,expenditure.getCategoryId(),date, expenditure.getDescription(),new Money(value).getFloatValue(),typeOfPayment, true, expenditure.getId(), idExtractItem);
            operation.setOperationLinked(true);
            system.getExtractItemMap().remove(idExtractItem);
        }
        system.getOperations().put(idOperation, operation);

        expenditure.skip();
       
        if (expenditure.getLastPaymentDate() != null && (expenditure.getFrequency() == 0 || expenditure.getNextPaymentDate().afterDay(expenditure.getLastPaymentDate())) || (expenditure.getLastPaymentDate() == null && expenditure.getFrequency() == 0)) {
          expenditure.setActive(false);
        } else {
            if (!expenditure.isFixedValue()) {
                for (Operation operationTemp : system.getOperations().values()) {
                    if(operationTemp.isExpenditure()) {
                        if (operationTemp.getBillId().equals(expenditure.getId())) {
                            total.credit(operationTemp.getValue());
                            count++;
                        }
                    }
                }
                expenditure.setValue(new Money(total.getValue() / count));
            }
        }
    }
View Full Code Here

Examples of br.com.visualmidia.business.Expenditure

      this.observation = observation;
    }

    @Override
    protected void execute(PrevalentSystem system) throws BusinessException {
        Expenditure expenditure = new Expenditure(id, description, gdDateNextPaymentDate, frequency, numberOfOcurrencies, value, fixedValue, categoryId, observation);
        expenditure.setFirstPaymentDate(gdDatefirstExpenditurePaymentDate);
        expenditure.setLastPaymentDate();
       
        system.getExpenditure().put(id, expenditure);
    }
View Full Code Here

Examples of br.com.visualmidia.business.Expenditure

        if (system.linkedOperations.containsKey(id)) {
            LinkedOperation linkedOperation = system.linkedOperations.get(id);
            linkedOperation.setChecked(checked);
            if (checked) {
               
                Expenditure bill = linkedOperation.getBill();
                if(bill != null){
               
                    Expenditure expenditure = new Expenditure(bill.getId(), bill.getDescription(), bill.getNextPaymentDate(), bill.getFrequency(),bill.getNumberOfOcurrencies(), bill.getValue(), bill.isFixedValue(), bill.getCategoryId(), bill.getObservation());
                    expenditure.setActive(false);
                   
                    Money money = new Money(linkedOperation.getOperation().getValue());
                    GDDate date = new GDDate(linkedOperation.getOperation().getDateTime());
                   
                    Account account = system.accounts.get(accountId);
                   
                    Operation operation = new Operation(id, account, expenditure.getCategoryId(), date, expenditure. getDescription(), money.getFloatValue());
                    system.operations.put(id, operation);
                   
                    bill.skip();
                   
                    if (bill.getFrequency() == 0 || (bill.getLastPaymentDate() == null ? true : bill.getNextPaymentDate().after(bill.getLastPaymentDate()))) {
View Full Code Here

Examples of br.com.visualmidia.business.Expenditure

                GDDate billDate = new GDDate(bill.getNextPaymentDate());
                int frequency = bill.getFrequency();
   
                while (end.afterDay(billDate.getCalendar())) {
                    if (start.beforeOrEqualsDay(billDate) && end.afterOrEqualsDay(billDate)) {
                        Expenditure myBill = new Expenditure(bill.getId(), bill.getDescription(), billDate, bill.getFrequency(), bill.getNumberOfOcurrencies(), bill.getValue(), bill.isFixedValue(), bill.getCategoryId(), bill.getObservation());
                        returnList.add(myBill);
                        break;
                    }
                    billDate = skip(billDate, frequency);
                   
View Full Code Here

Examples of org.openfriendsbudget.model.Expenditure

        budget.addPerson(p1);
        budget.addPerson(p2);
        budget.addPerson(p3);
        budget.addPerson(p4);

        Expenditure exp1 = new Expenditure();
        exp1.setOwner(p1);
        exp1.addRecipient(p1, 1); // p1 : 0
        exp1.addRecipient(p2, 2); // p2 : -200 / p1 : +200
        exp1.setAmount(300);

        Expenditure exp2 = new Expenditure();
        exp2.setOwner(p3);
        exp2.addRecipient(p2, 1); // p2 : -40 / p3 : + 40
        exp2.addRecipient(p3, 1); // p3 : 0
        exp2.setAmount(20); // 20 YEN * 4 = 80 EUR
        exp2.setCurrency("YEN");

        Expenditure exp3 = new Expenditure();
        exp3.setOwner(p1);
        exp3.addRecipient(p1, 1); // p1 : 0
        exp3.addRecipient(p2, 1); // p2 : -100 / p1 : +100
        exp3.addRecipient(p3, 1); // p3 : -100 / p1 : +100
        exp3.setAmount(300);

        Expenditure exp4 = new Expenditure();
        exp4.setOwner(p2);
        exp4.addRecipient(p2, 1); // p2 : 0
        exp4.addRecipient(p3, 1); // p3 : -100 / p2 : +100
        exp4.addRecipient(p1, 2); // p1 : -200 / p2 : +200
        exp4.setAmount(400);

        Expenditure exp5 = new Expenditure();
        exp5.setOwner(p4);
        exp5.addRecipient(p2, 1); // p2 : -50 / p4 : +50
        exp5.addRecipient(p1, 1); // p1 : -50 / p4 : +50
        exp5.addRecipient(p3, 1); // p3 : -50 / p4 : +50
        exp5.addRecipient(p4, 1); // p4 : 0
        exp5.setAmount(200);

        Expenditure exp6 = new Expenditure();
        exp6.setOwner(p3);
        exp6.addRecipient(p1, 2); // p1 : -80 / p3 : +80
        exp6.addRecipient(p4, 1); // p4 : -40 / p3 : +40
        exp6.setAmount(60);
        exp6.setCurrency("USD");


        // Total:
        // p1 : +70
        // p2 : -90
View Full Code Here

Examples of org.openfriendsbudget.model.Expenditure

        budget.addPerson(p1);
        budget.addPerson(p2);
        budget.addPerson(p3);

        Expenditure exp1 = new Expenditure();
        exp1.setOwner(p1);
        exp1.addRecipient(p1, 1); // p1 : 0
        exp1.addRecipient(p2, 2); // p2 : -200 / p1 : +200
        exp1.setAmount(300);

        Expenditure exp2 = new Expenditure();
        exp2.setOwner(p3);
        exp2.addRecipient(p2, 1); // p2 : -40 / p3 : + 40
        exp2.addRecipient(p3, 1); // p3 : 0
        exp2.setAmount(20); // 20 YEN * 4 = 80 EUR
        exp2.setCurrency("YEN");

        Expenditure exp3 = new Expenditure();
        exp3.setOwner(p1);
        exp3.addRecipient(p1, 1); // p1 : 0
        exp3.addRecipient(p2, 1); // p2 : -100 / p1 : +100
        exp3.addRecipient(p3, 1); // p3 : -100 / p1 : +100
        exp3.setAmount(300);

        // Total:
        // p1 : +400
        // p2 : -340
        // p3 : -60
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.