Patch level : 12.0 370

Files correlati     : tc3.exe tcmenu.men tc3100a.uml tc3800a.uml tctbrca.uml
                      tctbrco.uml tctbriv.uml tctbrpg.uml tctbrre.uml tctbrvl.uml

POrgramma di ricezione da Ericsoft versione 1


git-svn-id: svn://10.65.10.50/branches/R_10_00@23714 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
bonazzi 2017-03-30 20:01:27 +00:00
parent f3ede7b4ff
commit ecac771d7f
4 changed files with 76 additions and 23 deletions

View File

@ -851,7 +851,7 @@ void TTS_sender::add_diversi(const TRecordset& mov, const bool moviva)
j++; j++;
} }
else else
log(2, "Conto cliente/formitore non trovato per giroconto ritenute o intra o reverse charge"); log(2, "Conto cliente/fornitore non trovato per giroconto ritenute o intra o reverse charge");
} }
} }
else else

View File

@ -78,7 +78,7 @@ void TRiclassifica_cache::decode(const char* tab, const TString& cod, int & grup
if (ric != NULL) if (ric != NULL)
{ {
gruppo = ric->get_int(); gruppo = ric->get_int(0);
conto = ric->get_int(); conto = ric->get_int();
sottoconto = ric->get_long(); sottoconto = ric->get_long();
} }
@ -111,7 +111,7 @@ TRecnotype TClifo_recset::new_rec(const char* buf)
{ {
bool apici=false; bool apici=false;
for (const char* c = buf; *c ; c++) for (const unsigned char* c = (const unsigned char*) buf; *c ; c++)
{ {
if (*c == '"') if (*c == '"')
{ {
@ -129,10 +129,10 @@ TRecnotype TClifo_recset::new_rec(const char* buf)
--c; --c;
} }
else else
str << *c; str << *((const char *) c);
} }
else else
str << *c; str << *((const char *) c);
} }
} }
@ -170,12 +170,14 @@ const TString& TClifo_recset::add_stato(TLog_report& log) const
if (stati.read(_isequal) != NOERR) if (stati.read(_isequal) != NOERR)
{ {
stati.setkey(1);
stati.last(); stati.last();
const int codice = stati.get_int("CODTAB") + 1; const int codice = stati.get_int("CODTAB") + 1;
stati.zero(); stati.zero();
stati.put("CODTAB", format("%03d", codice)); stati.put("CODTAB", format("%03d", codice));
stati.put("S0", stato);
const int err = stati.write(); const int err = stati.write();
@ -221,7 +223,7 @@ public:
TRecnotype TPNota_recset::new_rec(const char* buf) TRecnotype TPNota_recset::new_rec(const char* buf)
{ {
TToken_string str(256,'|'); //nuovo record tab separator TToken_string str(2560,'|'); //nuovo record tab separator
if(buf && *buf) if(buf && *buf)
{ {
@ -394,7 +396,7 @@ TImportaEricsoft& app() { return (TImportaEricsoft&) main_app(); }
//funzione che ricerca un cliente o un fornitore nel file clifo di campo in base al CODCF //funzione che ricerca un cliente o un fornitore nel file clifo di campo in base al CODCF
bool TImportaEricsoft::find_cli(const long cod) const bool TImportaEricsoft::find_cli(const long cod) const
{ {
TString16 key; key.format("C|%ld", cod); TString16 key; key.format("C|E%ld", cod);
return !cache().get(LF_CLIFO, key).empty(); return !cache().get(LF_CLIFO, key).empty();
} }
@ -536,17 +538,56 @@ void TImportaEricsoft::upload_cli(const TFilename& file, TLog_report& log)
//eseguo tutto SOLO se riesco a riempire la ragione sociale //eseguo tutto SOLO se riesco a riempire la ragione sociale
if (ragsoc.full()) if (ragsoc.full())
{ {
TString16 key; key.format("E%ld", cod);
const bool var = find_cli(cod); //controllo se il clifo esiste già TString40 paiv = s.get(11).as_string();
TString40 cofi = s.get(14).as_string();
clifo.zero(); paiv.strip_spaces();
cofi.strip_spaces();
clifo.setkey(6);
clifo.zero();
clifo.put(CLI_TIPOCF, "C"); clifo.put(CLI_TIPOCF, "C");
clifo.put(CLI_RICALT, key);
clifo.put(CLI_CODCF,cod);
if (var) bool found = clifo.read() == NOERR;
clifo.read();
if (!found && paiv.full())
{
clifo.setkey(5);
clifo.zero();
clifo.put(CLI_TIPOCF, "C");
clifo.put(CLI_PAIV, paiv);
found = clifo.read() == NOERR;
}
if (!found && cofi.full())
{
clifo.setkey(4);
clifo.zero();
clifo.put(CLI_TIPOCF, "C");
clifo.put(CLI_COFI, cofi);
found = clifo.read() == NOERR;
}
clifo.setkey(1);
if (!found)
{
clifo.put(CLI_TIPOCF, "F");
clifo.put(CLI_CODCF, cofi);
clifo.read();
if (clifo.get(CLI_TIPOCF) == "F")
clifo.prev();
const long newcod = clifo.get_long(CLI_CODCF) + 1L;
clifo.zero();
clifo.put(CLI_TIPOCF, "C");
clifo.put(CLI_CODCF, newcod);
}
if (!clifo.get(CLI_RICALT).starts_with("E"))
clifo.put(CLI_RICALT, key); //ragsoc
clifo.put(CLI_RAGSOC, ragsoc); //ragsoc clifo.put(CLI_RAGSOC, ragsoc); //ragsoc
TToken_string & indirizzo = s.indirizzo(); TToken_string & indirizzo = s.indirizzo();
clifo.put(CLI_INDCF, indirizzo.get()); //indirizzo clifo.put(CLI_INDCF, indirizzo.get()); //indirizzo
@ -574,7 +615,7 @@ void TImportaEricsoft::upload_cli(const TFilename& file, TLog_report& log)
clifo.put(CLI_COMCF, codcom); //inserisci il codice del comune, recuperato tramite il cap clifo.put(CLI_COMCF, codcom); //inserisci il codice del comune, recuperato tramite il cap
clifo.put(CLI_LOCCF, s.get(20).as_string()); //inserisci la frazione se è indicata clifo.put(CLI_LOCCF, s.get(20).as_string()); //inserisci la frazione se è indicata
} }
s.add_stato(log); clifo.put(CLI_STATOCF, s.add_stato(log));
clifo.put(CLI_REFERENTE, s.get(8).as_string()); clifo.put(CLI_REFERENTE, s.get(8).as_string());
//inserisci i numeri di telefono (telefono, altro telefono, fax) //inserisci i numeri di telefono (telefono, altro telefono, fax)
for (int i = 9; i < 10; i++) for (int i = 9; i < 10; i++)
@ -600,7 +641,6 @@ void TImportaEricsoft::upload_cli(const TFilename& file, TLog_report& log)
//inserisci l'indrizzo e-mail //inserisci l'indrizzo e-mail
const TString16 paiv = s.get(11).as_string();
clifo.put(CLI_PAIV, paiv); //p.iva clifo.put(CLI_PAIV, paiv); //p.iva
const TString codpag = s.get(12).as_string(); // clifo.put(CLI_, riferimento); const TString codpag = s.get(12).as_string(); // clifo.put(CLI_, riferimento);
const TString ricavo = s.get(13).as_string(); const TString ricavo = s.get(13).as_string();
@ -612,13 +652,12 @@ void TImportaEricsoft::upload_cli(const TFilename& file, TLog_report& log)
clifo.put(CLI_GRUPPORIC, gruppo); clifo.put(CLI_GRUPPORIC, gruppo);
clifo.put(CLI_CONTORIC, conto); clifo.put(CLI_CONTORIC, conto);
clifo.put(CLI_SOTTOCRIC, sottoconto); clifo.put(CLI_SOTTOCRIC, sottoconto);
const TString40 cofi = s.get(14).as_string();
clifo.put(CLI_COFI, cofi); //cod. fisc. clifo.put(CLI_COFI, cofi); //cod. fisc.
TString str; TString str;
str << "Il Cliente codice (" << clifo.get(CLI_CODCF) <<") " << ragsoc << " "; str << "Il Cliente codice (" << clifo.get(CLI_CODCF) <<") " << ragsoc << " ";
if (var) if (found)
{ {
const int err = clifo.rewrite(); const int err = clifo.rewrite();
if (err == NOERR) if (err == NOERR)
@ -812,6 +851,7 @@ void TImportaEricsoft::upload_mov(const TFilename& file, TLog_report& log)
TArray cods_iva; TArray cods_iva;
TISAM_recordset daily_movs("USE " TOSTRING(LF_MOV) " KEY 2\nFROM " MOV_DATAREG "=#DATE"); TISAM_recordset daily_movs("USE " TOSTRING(LF_MOV) " KEY 2\nFROM " MOV_DATAREG "=#DATE");
TProgind pi(s.items(),"Importazione Movimenti in corso...",true,true); TProgind pi(s.items(),"Importazione Movimenti in corso...",true,true);
TLocalisamfile clifo(LF_CLIFO);
for (bool ok=s.move_first();ok;ok=s.move_next()) for (bool ok=s.move_first();ok;ok=s.move_next())
{ {
@ -822,7 +862,7 @@ void TImportaEricsoft::upload_mov(const TFilename& file, TLog_report& log)
const long numreg_eric = s.get(1).as_int(); const long numreg_eric = s.get(1).as_int();
const char sezione = s.get(2).as_int() == 0 ? 'D' : 'A'; const char sezione = s.get(2).as_int() == 0 ? 'D' : 'A';
_ricl->decode(TAB_RICCONTI, s.get(3).as_string(), gruppo, conto, sottoconto); _ricl->decode(TAB_RICCONTI, s.get(3).as_string(), gruppo, conto, sottoconto);
const long codcf = s.get(5).as_int(); long codcf = s.get(5).as_int();
char tipocf= ' '; char tipocf= ' ';
switch (s.get(4).as_int()) switch (s.get(4).as_int())
@ -836,6 +876,19 @@ void TImportaEricsoft::upload_mov(const TFilename& file, TLog_report& log)
default: default:
break; break;
} }
if (codcf != 0L)
{
TString16 key; key.format("E%ld", codcf);
clifo.setkey(6);
clifo.zero();
clifo.put(CLI_TIPOCF, "C");
clifo.put(CLI_RICALT, key);
if (clifo.read() == NOERR)
codcf = clifo.get_long(CLI_CODCF);
else
log.log(3, format(FR("Codice cliente Ericsoft %ld assente"), codcf));
}
const TDate datacomp = s.get(6).as_date(); const TDate datacomp = s.get(6).as_date();
const int tiporeg = s.get(7).as_int(); const int tiporeg = s.get(7).as_int();

View File

@ -11,7 +11,7 @@ BEGIN
PROMPT 1 1 "Codice IVA Ericsoft" PROMPT 1 1 "Codice IVA Ericsoft"
END END
NUMBER F_CODTAB 3 STRING F_CODTAB 3
BEGIN BEGIN
PROMPT 2 2 "Codice " PROMPT 2 2 "Codice "
USE &RIV USE &RIV
@ -22,7 +22,6 @@ BEGIN
OUTPUT F_DESC S0 OUTPUT F_DESC S0
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
FIELD CODTAB FIELD CODTAB
FLAGS "Z"
KEY 1 KEY 1
END END

View File

@ -19,9 +19,10 @@ BEGIN
ITEM "3|Corrispettivi in scorporo" ITEM "3|Corrispettivi in scorporo"
ITEM "4|Corrispettivi in ventilazione" ITEM "4|Corrispettivi in ventilazione"
FIELD CODTAB[1,1] FIELD CODTAB[1,1]
KEY 1
END END
NUMBER F_CODTAB 2 STRING F_CODTAB 2
BEGIN BEGIN
PROMPT 56 2 "Codice " PROMPT 56 2 "Codice "
USE &RRE USE &RRE