Package br.com.visualmidia.business

Examples of br.com.visualmidia.business.Expenditure


        if (expendituresTable.getAccountTableTree().getSelectionCount() > 0) {
          TableItem[] item = expendituresTable.getAccountTableTree().getSelection();
          String idBill = item[0].getText(0);
          GDDate paymentDayBill = new GDDate(item[0].getText(1));
          try {
            Expenditure expenditure = (Expenditure) system.query(new GetExpenditures(idBill));
            if (expenditure.getNextPaymentDate().beforeDay(paymentDayBill)) {
              MessageBox messageBox = new MessageBox(mainScreen.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
              messageBox.setMessage("Existem Parcelas anteriores em aberto.\nDeseja efetuar o pagamento da parcela vencida?");
              messageBox.setText("Alerta Gerente Digital!");
              int result = messageBox.open();
              if (result == SWT.YES) {
View Full Code Here


  public void loadScreen(String id) {
    try {
      editMode = true;
      if (levelBillPlan == 1) {
        Expenditure expenditure = (Expenditure) system.query(new GetExpenditures(id));
        setOpenAccount(expenditure.getId());

        descriptionText.setText(expenditure.getDescription());
        nextPaymentDateText.setValue(expenditure.getNextPaymentDate().getDate());
        billPlanCombo.select(billPlan.get(expenditure.getCategoryId()).getDescription());
        frequencyCombo.select(expenditure.getFrequency());
        numberOfOcurrenciesText.setText("" + expenditure.getNumberOfOcurrencies());
        fixedValue.select((expenditure.isFixedValue()) ? 0 : 1);
        fixedValue.notifyListeners(SWT.Selection, new Event());
        valueText.setText(expenditure.getValue().getValue() + "");
        observation.setText(expenditure.getObservation());
      } else {
        Incoming incoming = (Incoming) system.query(new GetIncoming(id));
        setOpenAccount(incoming.getId());

        descriptionText.setText(incoming.getDescription());
View Full Code Here

                    } else {
                      Incoming incoming = getRelatedIncoming(bankOperationNumber, description, value, date);
                      if(incoming != null) {
                        system.execute(new AddExtractBankItem(bankOperationNumber, description, value, date, incoming, accountId));
                      } else {
                        Expenditure expenditure = getRelatedExpenditure(bankOperationNumber, description, value, date);
                        if(expenditure != null){
                          system.execute(new AddExtractBankItem(bankOperationNumber, description, value, date, expenditure, accountId));
                        } else {
                          system.execute(new AddExtractBankItem(bankOperationNumber, description, value, date, accountId));
                        }
View Full Code Here

          if (expenditure.getNumberOfOcurrencies() > 0) {
            int i = 1;
            while (i <= expenditure.getNumberOfOcurrencies()) {
              if ( date.afterOrEqualsDay(fromDate) && date.beforeOrEqualsDay(toDate) ){
//                Expenditure myBill = new Expenditure(expenditure.getId(), expenditure.getDescription(), new GDDate(date), expenditure.getFrequency(), expenditure.getNumberOfOcurrencies(), expenditure.getValue(), expenditure.isFixedValue(), expenditure.getCategoryId(), expenditure.getObservation());
                Expenditure myBill = new Expenditure(expenditure.getId(), expenditure.getDescription(), new GDDate(date), expenditure.getFrequency(), expenditure.getNumberOfOcurrencies(), expenditure.getValue(), expenditure.isFixedValue(), expenditure.getCategoryId(), expenditure.getObservation(),expenditure.getFirstPaymentDate(),expenditure.getLastPaymentDate());
                list.add(myBill);
              }
              date = skip(date, frequency);
              if (date == null) {
                break;
              }
              i++;
            }
          }else{
            while (date.beforeOrEqualsDay(toDate)){
              if ( date.afterOrEqualsDay(fromDate) && date.beforeOrEqualsDay(toDate) ){
                Expenditure myBill = new Expenditure(expenditure.getId(), expenditure.getDescription(), new GDDate(date), expenditure.getFrequency(), expenditure.getNumberOfOcurrencies(), expenditure.getValue(), expenditure.isFixedValue(), expenditure.getCategoryId(), expenditure.getObservation(),expenditure.getFirstPaymentDate(),expenditure.getLastPaymentDate());
                list.add(myBill);
              }
              date = skip(date, frequency);
              if (date == null) {
                break;
              }
            }
          }
        }
      }
      SortComparator comparator = new SortComparator();
      Collections.sort(list, comparator);

      int bgColorControl = 0;

      for (Expenditure expenditure : list) {
        if (expenditure.isActive()) {
          TableItem item = new TableItem(expenditureTable, SWT.NONE | SWT.MULTI | SWT.WRAP);
          if (bgColorControl == 1) {
            item.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
            bgColorControl = 0;
          } else {
            bgColorControl = 1;
          }
         
          GDDate todayPlusOneWeek = new GDDate();
          todayPlusOneWeek.addDays(7);
          GDDate nextPaymentDate = expenditure.getNextPaymentDate();
          GDDate today = new GDDate();
         
          Expenditure expenditureToCompare = (Expenditure) system.query(new GetExpenditures(expenditure.getId()));
          GDDate paymentDayBill = expenditureToCompare.getNextPaymentDate();
         
          if (paymentDayBill.beforeDay(nextPaymentDate) && paymentDayBill.beforeDay(today)) {
            item.setImage(new Image(null, "img/icoExpiradNotPayed.png"));
          } else if (nextPaymentDate.beforeOrEqualsDay(todayPlusOneWeek) && nextPaymentDate.afterOrEqualsDay(today)) {
            item.setImage(new Image(null, "img/icoWarningExpiration.png"));
View Full Code Here

                      GDDate date = new GDDate(expenditure.getNextPaymentDate());
                        int frequency = expenditure.getFrequency();
           
                        while (date.beforeOrEqualsDay(endDate)) {
                            if (date.afterOrEqualsDay(beginDate)) {
                              Expenditure myBill = new Expenditure(expenditure.getId(), expenditure.getDescription(), new GDDate(date), expenditure.getFrequency(), expenditure.getNumberOfOcurrencies(), expenditure.getValue(), expenditure.isFixedValue(), expenditure.getCategoryId(), expenditure.getObservation());
                              listExpenditure.add(myBill);
                            }
                            date = skip(date, frequency);
           
                            if (date == null) {
View Full Code Here

        Incoming relatedIncoming = extractBankItem.getRelatedIncoming();
        if(relatedIncoming != null) {
          item.setText(4, "Receita: "+ relatedIncoming.getDescription());
        }
       
        Expenditure relatedExpenditure = extractBankItem.getRelatedExpenditure();
        if(relatedExpenditure != null) {
          item.setText(4, "Despesa: "+ relatedExpenditure.getDescription());
        }
       
                item.setText(5, ((extractBankItem.isCredit())?"":"-")+ extractBankItem.getValue());
            }
        } catch (Exception e) {
View Full Code Here

        this.gdDateNextPaymentDate = nextPaymentDate;
    }

    @Override
    protected void execute(PrevalentSystem system) throws BusinessException {
        Expenditure expenditure = system.expenditure.get(id);
        if (gdDateNextPaymentDate == null || (expenditure.getLastPaymentDate() == null ? false : gdDateNextPaymentDate.afterDay(expenditure.getLastPaymentDate())) || expenditure.getFrequency() == 0) {
          expenditure.setActive(false);
        } else {
            expenditure.setNextPaymentDate(gdDateNextPaymentDate);
        }
    }
View Full Code Here

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

        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

        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

TOP

Related Classes of br.com.visualmidia.business.Expenditure

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.