idOperation = string;
}
idOperation = String.valueOf(Integer.parseInt(idOperation) + 1);
Account account = system.getAccounts().get(accountId);
Incoming incoming = system.getIncoming().get(incomingId);
// Incoming myIncoming = new Incoming(incoming.getId(), incoming.getDescription(), incoming.getNextPaymentDate(), incoming.getFrequency(),incoming.getNumberOfOcurrencies(), incoming.getValue(), incoming.isFixedValue(), incoming.getCategoryId(), incoming.getObservation());
// myIncoming.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, incoming.getCategoryId(), gdDate, incoming.getDescription(), new Money(value).getFloatValue(),typeOfPayment, false, incoming.getId());
} else {
operation = new Operation(idOperation,account,incoming.getCategoryId(),gdDate, incoming.getDescription(),new Money(value).getFloatValue(),typeOfPayment, false, incoming.getId(), idExtractItem);
operation.setOperationLinked(true);
system.getExtractItemMap().remove(idExtractItem);
}
system.getOperations().put(idOperation, operation);
incoming.skip();
if (incoming.getLastPaymentDate() != null && (incoming.getFrequency() == 0 || incoming.getNextPaymentDate().after(incoming.getLastPaymentDate()))) {
incoming.setActive(false);
} else if(incoming.getLastPaymentDate() == null && incoming.getFrequency() == 0){
incoming.setActive(false);
}else {
if (!incoming.isFixedValue()) {
for (Operation operationTemp : system.getOperations().values()) {
if(!operationTemp.isExpenditure()) {
if(operationTemp.getBillId() != null)
if (operationTemp.getBillId().equals(incoming.getId())) {
total.credit(operationTemp.getValue());
count++;
}
}
}
incoming.setValue(new Money(total.getValue() / count));
}
}
}