diff --git a/src/bs/bs0300.cpp b/src/bs/bs0300.cpp index a2a2c1f9a..71e40a5ea 100644 --- a/src/bs/bs0300.cpp +++ b/src/bs/bs0300.cpp @@ -906,11 +906,28 @@ void TSknet_sync::load_clifo(const char tipocf) cfv.put(CFV_RAGGDOC, !odbc.get("RaggDoc").as_string().blank()); + int riga = 1; + // Cerco l'ultima riga + { + TLocalisamfile app(LF_CFBAN); + TRectype rapp(LF_CFBAN); + rapp.put("TIPOCF", tipocf); + rapp.put("CODCF", codcf); + rapp.put("", "V"); + if (rapp.read(app, _isgteq) == NOERR) + { + while (rapp.get("TIPOCF") == tipocf && rapp.get("CODCF") == codcf && rapp.get("TIPOBAN") == "V") + { + riga++; + rapp.next(app); + } + } + } TLocalisamfile cfb(LF_CFBAN); cfb.put("TIPOCF", tipocf); cfb.put("CODCF", codcf); cfb.put("TIPOBAN", "V"); - cfb.put("NRIGA", 1); + cfb.put("NRIGA", riga); TString cin, abi, cab, contcor, iban; if (tipocf == 'C') { @@ -1052,7 +1069,7 @@ void TSknet_sync::load_clifo(const char tipocf) else if (token.starts_with("ASSFIS=")) { - cfv.put(CFV_ASSFIS, token.mid(7)); + cfv.put(CFV_ASSFIS, cache().get("%SKI", token.mid(7), "S6")); } else { @@ -1396,6 +1413,7 @@ void TSknet_sync::sync_doc() } const TString80 codart = docs.get("CodArticolo").as_string(); + const TString descr = docs.get("DSRiga").as_string(); if (tiporiga == "01" && ini_get_bool(CONFIG_DITTA, "BS", "SKUseCustomRiga", false)) { @@ -1408,7 +1426,10 @@ void TSknet_sync::sync_doc() TRectype& rdoc = doc->new_row(tiporiga); - rdoc.put(RDOC_CODART, codart); + if(codart.blank() && tiporiga == "02" && descr.starts_with("Bancal")) + rdoc.put(RDOC_CODART, "B1"); + else + rdoc.put(RDOC_CODART, codart); if (tipoart == 2) { @@ -1424,8 +1445,6 @@ void TSknet_sync::sync_doc() rdoc.put(RDOC_CODARTMAG, codart); // rdoc.check_row(); - const TString descr = docs.get("DSRiga").as_string(); - rdoc.put(RDOC_DESCR, descr.sleft(50)); if (descr.len() > 50) {