Patch level : 12.0 452
Files correlati : tf Commento : - Ottimizzato le TString - Aggiunto algoritmo per prelevare il numero documento se il cliente registra i documenti in maniera non ordinata. Es. prima registra doc 1 poi 2 poi di nuovo aggiunge una registrazione dell'1 - Sostituite TToken_string di ricerca con std::map - Tolto controllo flag prima dell'esportazione - Aggiornato controllo record in tfutility git-svn-id: svn://10.65.10.50/branches/R_10_00@24099 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a2f70340fd
commit
3347af023b
@ -878,14 +878,17 @@ TString TTrFa_app::getBody(TToken_string* strarr, bool add)
|
||||
/* Sembra che utilizzare identificatori chiari e sensati in questo mondo non è concesso, quindi adesso vi sbatto un bell'ID numerico
|
||||
* Ok per OGNI cliente devo assegnarli un identificativo del numero della fattura
|
||||
*/
|
||||
TString keyMap; keyMap << strarr->get_char(_tipocf) << "|" << strarr->get_int(_codcf);
|
||||
static TString keyMap; keyMap.cut(0) << strarr->get_char(_tipocf) << "|" << strarr->get_int(_codcf);
|
||||
|
||||
clifoDoc app = mCliDoc[keyMap];
|
||||
if(add)
|
||||
{
|
||||
app.countDoc += 1;
|
||||
app.docID.insert(std::pair<TString,long>(strarr->get(_numdoc), app.countDoc));
|
||||
}
|
||||
mCliDoc[keyMap] = app;
|
||||
|
||||
TString body; body.format("%010d%010d", app.contCliFo, app.countDoc);
|
||||
static TString body; body.format("%010d%010d", app.contCliFo, app.docID[strarr->get(_numdoc)]);
|
||||
return body;
|
||||
}
|
||||
|
||||
@ -1078,7 +1081,8 @@ bool TTrFa_app::tff0400(TSheet_field& sheet)
|
||||
{
|
||||
// Siccome non siamo in grado di fare delle join devo in qualche modo evitare di caricare clienti già caricati quindi mi salvo tutto in un bel TToken_string e controllo
|
||||
// Era troppo complicato fare una join codice cliente con i documenti per prendere solo quelli valorizzati.
|
||||
TToken_string clifoSent = "";
|
||||
std::map<TString, bool> clifoSent;
|
||||
|
||||
bool ok = true;
|
||||
TProgress_monitor p(sheet.items(),"Caricamento Clienti/Fornitori");
|
||||
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
||||
@ -1106,15 +1110,15 @@ bool TTrFa_app::tff0400(TSheet_field& sheet)
|
||||
}
|
||||
|
||||
// Controllo il clifo, se non c'è lo aggiungo altrimenti salto sto giro
|
||||
if(clifoSent.get_pos(checkClifo) < 0)
|
||||
clifoSent.add(checkClifo);
|
||||
if(clifoSent.find(checkClifo) == clifoSent.end())
|
||||
clifoSent.insert(std::pair<TString, bool>(checkClifo,true));
|
||||
else
|
||||
continue;
|
||||
|
||||
TVariant vtipocf = strarr->get(_tipocf), vcodcf = strarr->get(_codcf), voccas = strarr->get(_occas);
|
||||
|
||||
#ifdef DBG
|
||||
if(vtipocf.as_string() == "F" && vcodcf.as_string() == "1814")
|
||||
if(vtipocf.as_string() == "C" && (vcodcf.as_string() == "2699" || vcodcf.as_string() == "3610"))
|
||||
bool tolla = true;
|
||||
#endif
|
||||
|
||||
@ -1286,25 +1290,36 @@ bool TTrFa_app::tff0700(TSheet_field& sheet)
|
||||
* Fattura *
|
||||
********************************************************************************************************************/
|
||||
// Mentre per i clienti è una porcata per le fatture non posso fare altrimenti, potrebbe essere che i clienti mettono righe in fondo customizzate spezzando fatture
|
||||
TToken_string fattSent = "";
|
||||
std::map<TString, bool> fattSent;
|
||||
std::map<TString, long> docRighe;
|
||||
bool ok = true;
|
||||
TProgress_monitor p(sheet.items(), "Caricamento Fatture");
|
||||
|
||||
TString oldKey = "";
|
||||
int numRiga;
|
||||
|
||||
|
||||
|
||||
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
||||
{
|
||||
|
||||
#ifdef DBG
|
||||
if(strarr->get_char(_tipocf) == 'F' && strarr->get_long(_codcf) == 2409 && ((strcmp(strarr->get(_numdoc), "28070") == 0) || strcmp(strarr->get(_numdoc), "28072") == 0))
|
||||
bool tolla = true;
|
||||
#endif
|
||||
|
||||
if(!p.add_status())
|
||||
return false;
|
||||
|
||||
IF_IS_ENABLED(strarr);
|
||||
|
||||
// Chiave: Tipo C/F, Cod C/F, Numero doc. anno doc
|
||||
TString checkFatt; checkFatt << strarr->get_char(_tipocf) << "," << strarr->get_long(_codcf) << "," << strarr->get(_numdoc) << "," << TString(strarr->get(_datadoc)).right(4);
|
||||
if(fattSent.get_pos(checkFatt) < 0)
|
||||
static TString checkFatt;
|
||||
checkFatt.cut(0) << strarr->get_long(_codcf) << "," << strarr->get(_numdoc) << "," << TString(strarr->get(_datadoc)).right(4);
|
||||
|
||||
if(fattSent.find(checkFatt) == fattSent.end())
|
||||
{
|
||||
fattSent.add(checkFatt);
|
||||
fattSent.insert(std::pair<TString, bool>(checkFatt,true));
|
||||
|
||||
// <DatiFatturaBody>
|
||||
TTrFa_record tff0700f("TFF0700F");
|
||||
@ -1327,14 +1342,20 @@ bool TTrFa_app::tff0700(TSheet_field& sheet)
|
||||
if(!ok) return false;
|
||||
}
|
||||
// In qualsiasi caso va messa la riga ma prima elaboro il numero della riga!
|
||||
TString newKey = getBody(strarr, false);
|
||||
if(oldKey != newKey)
|
||||
static TString newKey; newKey.cut(0) << getBody(strarr, false);
|
||||
|
||||
if(docRighe.find(newKey) == docRighe.end())
|
||||
{
|
||||
numRiga = 1;
|
||||
oldKey = newKey;
|
||||
numRiga = 1;
|
||||
docRighe.insert(std::pair<TString,long>(newKey, numRiga));
|
||||
}
|
||||
else
|
||||
numRiga++;
|
||||
{
|
||||
// Incremento e aggiorno
|
||||
numRiga = docRighe[newKey] + 1;
|
||||
docRighe[newKey] = numRiga;
|
||||
}
|
||||
|
||||
ok = tff2200(strarr, numRiga);
|
||||
|
||||
// E dopo l'inserimento del tff2200
|
||||
@ -1488,8 +1509,6 @@ void TTrFa_app::main_loop()
|
||||
{
|
||||
if(msk.checkNotEmpty())
|
||||
{
|
||||
// Sistemo tutti i flag prima di inviare
|
||||
msk.theFinalCheckDown();
|
||||
send(&msk);
|
||||
//ini_set_string(CONFIG_DITTA, "tf", "LastSend", ++TDate(msk.get(F_DATAFIN)));
|
||||
}
|
||||
|
@ -237,6 +237,7 @@ struct clifoDoc
|
||||
{
|
||||
long contCliFo;
|
||||
long countDoc;
|
||||
std::map<TString, long> docID;
|
||||
};
|
||||
|
||||
class TTrFa_app : public TSkeleton_application
|
||||
|
@ -97,7 +97,7 @@ bool checkRecord(TISAM_recordset* rec)
|
||||
TCausale caus(rec->get("23.CODCAUS").as_string());
|
||||
if(caus.soloiva() && (caus.reverse_charge() || caus.regime_speciale() == 3))
|
||||
return false;
|
||||
} else if(rclifo.get("PAIV")[0] != '0' && rclifo.get("PAIV")[0] != '1' && rclifo.get("COFI")[0] >= '8')
|
||||
} else if((rclifo.get("STATOPAIV").blank() || rclifo.get("STATOPAIV") == "IT") && rclifo.get("PAIV")[0] != '0' && rclifo.get("PAIV")[0] != '1' && (rclifo.get("COFI")[0] == '8' || rclifo.get("COFI")[0] == '9'))
|
||||
// Salto tutti i fornitori con cod cf che inizia per 8 o 9 e con p.iva non valida
|
||||
{
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user