if (Integer.parseInt(id) <= Integer.parseInt(key))
id = key;
}
id = String.valueOf(Integer.parseInt(id) + 1);
Operation operation = null;
if(paymentType == null)
paymentType = system.getPaymentMoney();
if(paymentType.getType().equals("Dep�sito em Conta")){
boolean paymentTypeBankAccountExists = false;
for (int i = 0; i< system.getPaymentTypeBankAccount().size(); i++) {
if(system.getPaymentTypeBankAccount().get(i).getAccountId().equals(this.accountId)){
// parcel.setPaymenType(system.getPaymentTypeBankAccount().get(i));
operation = new Operation(id, system.getAccounts().get(accountId), categoryId, gdDate, description, value, system.getPaymentTypeBankAccount().get(i), _receivedValue);
paymentTypeBankAccountExists = true;
break;
}
}
if(!paymentTypeBankAccountExists){
PaymentBankAccountPayed paymentTypeBankAccount = new PaymentBankAccountPayed(this.accountId);
system.getPaymentTypeBankAccount().add(paymentTypeBankAccount);
for (int j=0; j<system.getPaymentTypeBankAccount().size(); j++){
if(system.getPaymentTypeBankAccount().get(j).getAccountId().equals( this.accountId)){
// parcel.setPaymenType(system.getPaymentTypeBankAccount().get(j));
operation = new Operation(id, system.getAccounts().get(accountId), categoryId, gdDate, description, value, system.getPaymentTypeBankAccount().get(j), _receivedValue, discount);
break;
}
}
}
} else{
if(idRegistration.equals("")){
if (paymentType.getType().equals("Dinheiro")) {
paymentType = system.getPaymentMoney();
} else if (paymentType.getType ().equals("D�bito autom�tico")) {
paymentType = system.getPaymentAutomaticDebit();
} else if (paymentType.getType().equals("Pagamento eletr�nico")) {
paymentType = system.getPaymentEletronic();
} else if (paymentType.getType().equals("Transfer�ncia eletr�nica")) {
paymentType = system.getPaymentEletronicTransfer();
} else if (paymentType.getType().equals("TED")) {
paymentType = system.getPaymentTED();
} else if ( paymentType.getType().equals("DOC")) {
paymentType = system.getPaymentDOC();
} else if (paymentType.getType().equals("Saque cart�o")) {
paymentType = system.getPaymentGetMoney();
}
}else{
Registration registration = system.getRegistrations ().get(idRegistration);
if(registration == null || registration.getParcel(parcelId) == null){
paymentType = system.getPaymentMoney();
}else{
Parcel parcel = registration.getParcel(parcelId);
paymentType = parcel.getPayment();
}
}
if (this.discount != 0) {
operation = new Operation(id, system.getAccounts().get(accountId), categoryId, gdDate, description, value, paymentType, _receivedValue, discount);
} else {
operation = new Operation(id, system.getAccounts().get(accountId), categoryId, gdDate, description, value, paymentType, _receivedValue);
}
}
// Operation operation = new Operation(id, system.accounts.get(accountId), categoryId, gdDate.getCalendar(), description, value, paymentType);
if(idExtractItem != null) {
operation.setIdExtractItem(idExtractItem);
operation.setOperationLinked(true);
system.getExtractItemMap().remove(idExtractItem);
}
system.getOperations().put(id, operation);