Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -477,16 +477,47 @@ public class ContabilImportService {
|
|||||||
" AND ctb_part.ser_doc = '/'\n" +
|
" AND ctb_part.ser_doc = '/'\n" +
|
||||||
" AND ctb_part.num_doc = 0";
|
" AND ctb_part.num_doc = 0";
|
||||||
} else {
|
} else {
|
||||||
whereCond = Query.format(" ctb_part.data_doc = %s\n AND ctb_part.num_doc = %s", dataDoc, stringNumDoc);
|
whereCond = Query.format(" ctb_part.anno_part = %s\n AND ctb_part.num_doc = %s", UtilityDate.formatDate(dataDoc, "yyyy"), stringNumDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
sql = UtilityDB.addwhereCond(sql, whereCond, false);
|
sql = UtilityDB.addwhereCond(sql, whereCond, false);
|
||||||
|
|
||||||
|
ctbPart = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CtbPart.class);
|
||||||
|
if (ctbPart != null) {
|
||||||
|
ctbPartList.add(ctbPart);
|
||||||
|
} else if (!UtilityString.isNullOrEmpty(numeroPartita)) {
|
||||||
|
String numProt = numeroPartita.substring(0, numeroPartita.indexOf("/")).trim();
|
||||||
|
String serie = numeroPartita.substring(numeroPartita.indexOf("/") + 1).trim();
|
||||||
|
|
||||||
|
sql = Query.format("SELECT ctb_part.*\n" +
|
||||||
|
"FROM ctb_part\n" +
|
||||||
|
" INNER JOIN ctb_parr ON ctb_part.tipo_anag = ctb_parr.tipo_anag AND ctb_part.cod_anag = ctb_parr.cod_anag AND\n" +
|
||||||
|
" ctb_part.anno_part = ctb_parr.anno_part AND ctb_part.ser_doc = ctb_parr.ser_doc AND\n" +
|
||||||
|
" ctb_part.num_doc = ctb_parr.num_doc\n" +
|
||||||
|
" INNER JOIN ctb_movt ON ctb_parr.num_cmov = ctb_movt.num_cmov and IsNUll(ctb_movt.num_prot, 0) <> 0\n" +
|
||||||
|
"\t\t INNER JOIN gtb_anag ON ctb_part.cod_anag = gtb_anag.cod_anag\n" +
|
||||||
|
"where gtb_anag.diacod = %s\n" +
|
||||||
|
"and ctb_movt.num_prot = %s\n" +
|
||||||
|
"and ctb_part.anno_part = %s\n" +
|
||||||
|
"and ctb_part.ser_doc = %s",
|
||||||
|
cacheCodAnag,
|
||||||
|
numProt,
|
||||||
|
UtilityDate.formatDate(dataDoc, "yyyy"),
|
||||||
|
serie
|
||||||
|
);
|
||||||
|
|
||||||
ctbPart = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CtbPart.class);
|
ctbPart = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CtbPart.class);
|
||||||
if (ctbPart != null) {
|
if (ctbPart != null) {
|
||||||
ctbPartList.add(ctbPart);
|
ctbPartList.add(ctbPart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
previousNumDoc = numDoc;
|
||||||
|
} else {
|
||||||
|
ctbPart = null;
|
||||||
|
listAnomalie.add(AnomalieDTO.warning("Formato numero documento (" + stringNumDocCell + ") non valido: " + cacheCodAnag));
|
||||||
|
}
|
||||||
|
|
||||||
if (ctbPart != null) {
|
if (ctbPart != null) {
|
||||||
CtbScad ctbScad = new CtbScad();
|
CtbScad ctbScad = new CtbScad();
|
||||||
@@ -505,21 +536,12 @@ public class ContabilImportService {
|
|||||||
BigDecimal positiveResiduo = residuoIsNegative ? residuo.multiply(new BigDecimal("-1")) : residuo;
|
BigDecimal positiveResiduo = residuoIsNegative ? residuo.multiply(new BigDecimal("-1")) : residuo;
|
||||||
|
|
||||||
if (impPagato != null) {
|
if (impPagato != null) {
|
||||||
if (impPagato.equals(impRata)) {
|
|
||||||
ctbScad.setImpDare(positiveImpRata);
|
|
||||||
ctbScad.setImpAvere(positiveImpRata);
|
|
||||||
} else {
|
|
||||||
if (impRataIsNegative) {
|
|
||||||
ctbScad.setImpDare(positiveImpPagato);
|
ctbScad.setImpDare(positiveImpPagato);
|
||||||
ctbScad.setImpAvere(positiveImpRata);
|
|
||||||
} else {
|
|
||||||
ctbScad.setImpDare(positiveImpRata);
|
|
||||||
ctbScad.setImpAvere(positiveImpPagato);
|
ctbScad.setImpAvere(positiveImpPagato);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(stringResiduo)) {
|
if (!impPagato.equals(impRata) && !UtilityString.isNullOrEmpty(stringResiduo)) {
|
||||||
CtbScad ctbScadResiduo = new CtbScad();
|
CtbScad ctbScadResiduo = new CtbScad();
|
||||||
|
ctbScadResiduo.setOperation(OperationType.INSERT);
|
||||||
ctbScadResiduo.setDataScad(dataScad);
|
ctbScadResiduo.setDataScad(dataScad);
|
||||||
ctbScadResiduo.setDataPag(dataScad);
|
ctbScadResiduo.setDataPag(dataScad);
|
||||||
ctbScadResiduo.setDescrizPag(pagamento);
|
ctbScadResiduo.setDescrizPag(pagamento);
|
||||||
@@ -542,11 +564,6 @@ public class ContabilImportService {
|
|||||||
ctbScadList.add(ctbScad);
|
ctbScadList.add(ctbScad);
|
||||||
ctbPart.setCtbScad(ctbScadList);
|
ctbPart.setCtbScad(ctbScadList);
|
||||||
ctbPart.setOperation(OperationType.NO_OP);
|
ctbPart.setOperation(OperationType.NO_OP);
|
||||||
|
|
||||||
previousNumDoc = numDoc;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
listAnomalie.add(AnomalieDTO.warning("Formato numero documento (" + stringNumDocCell + ") non valido: " + cacheCodAnag));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user