Patch level : 12.0 550
Files correlati : bs Commento : - Tolti commenti log inutili Articoli: - Aggiunta contropartita fiscale Clienti: - Aggiunto numero civico, veniva calcolato ma non inserito - Impostati true di default ragg effetti e addebito bolle rit banc - Aggiunto codice assoggettamento fiscale - Sistemato campo cod fisc Documenti: - Aggiunto agente - Aggiunto codice pagamento - Aggiunto controllo più severo sulla validità del record git-svn-id: svn://10.65.10.50/branches/R_10_00@24439 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
80b73c800b
commit
dffa0c0d41
@ -98,7 +98,7 @@ protected:
|
||||
virtual TObject* key2obj(const char* key)
|
||||
{
|
||||
const char tipo = *key;
|
||||
const long codice = atol(key+1);
|
||||
const long codice = atol(key + 1);
|
||||
return new TAnagrafica(LF_CLIFO, tipo, codice);
|
||||
}
|
||||
|
||||
@ -117,7 +117,9 @@ public:
|
||||
return anag(tipo, codice);
|
||||
}
|
||||
const TAnagrafica& anag(const TISAM_recordset& rec)
|
||||
{ return anag(rec.cursor()->curr()); }
|
||||
{
|
||||
return anag(rec.cursor()->curr());
|
||||
}
|
||||
};
|
||||
|
||||
static TSknet_cache _anagr;
|
||||
@ -137,10 +139,14 @@ public:
|
||||
void autosave() const;
|
||||
|
||||
bool get_bool(const char* fld)
|
||||
{ TMask_field* f = find_by_fieldname(fld); return f ? f->get().full() : false; }
|
||||
{
|
||||
TMask_field* f = find_by_fieldname(fld); return f ? f->get().full() : false;
|
||||
}
|
||||
|
||||
TDate get_date(const char* fld)
|
||||
{ TMask_field* f = find_by_fieldname(fld); return TDate(f ? f->get() : EMPTY_STRING); }
|
||||
{
|
||||
TMask_field* f = find_by_fieldname(fld); return TDate(f ? f->get() : EMPTY_STRING);
|
||||
}
|
||||
|
||||
TSknet_mask() : TAutomask("bs0300a") { autoload(); }
|
||||
~TSknet_mask() { autosave(); }
|
||||
@ -166,7 +172,7 @@ bool TSknet_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
dpn.put("CODTAB", codice[i]);
|
||||
dpn.put("S0", descr[i]);
|
||||
dpn.write();
|
||||
TRectype& row = rcaus.row(15+i, true);
|
||||
TRectype& row = rcaus.row(15 + i, true);
|
||||
row.put(RCA_CODDESC, codice[i]);
|
||||
row.put(RCA_DESC, descr[i]);
|
||||
}
|
||||
@ -236,12 +242,12 @@ protected:
|
||||
void sync_table(const int logicnum, const char* out_table,
|
||||
const TString_array& fields);
|
||||
|
||||
void sync_iva ();
|
||||
void sync_ums ();
|
||||
void sync_val ();
|
||||
void sync_anamag ();
|
||||
void sync_doc ();
|
||||
void sync_clifo (int cfmask);
|
||||
void sync_iva();
|
||||
void sync_ums();
|
||||
void sync_val();
|
||||
void sync_anamag();
|
||||
void sync_doc();
|
||||
void sync_clifo(int cfmask);
|
||||
void clean();
|
||||
|
||||
public:
|
||||
@ -295,12 +301,12 @@ void TSknet_sync::load_their_origine(TISAM_recordset& out_set, const char* in_ta
|
||||
const TVariant& var = odbc.get(bfld);
|
||||
if (!var.is_null())
|
||||
{
|
||||
if(tfld > 0)
|
||||
file.put(cfld, var.as_string().mid(ffld, tfld-ffld));
|
||||
if (tfld > 0)
|
||||
file.put(cfld, var.as_string().mid(ffld, tfld - ffld));
|
||||
else
|
||||
file.put(cfld, var.as_string());
|
||||
}
|
||||
if (pos == key_fields.items()-1)
|
||||
if (pos == key_fields.items() - 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -319,7 +325,7 @@ void TSknet_sync::load_their_origine(TISAM_recordset& out_set, const char* in_ta
|
||||
|
||||
if (dtultagg >= dataagg)
|
||||
{
|
||||
FOR_EACH_ARRAY_ROW(pairs, r,row)
|
||||
FOR_EACH_ARRAY_ROW(pairs, r, row)
|
||||
{
|
||||
bfld = row->get(0);
|
||||
cfld = row->get();
|
||||
@ -357,9 +363,7 @@ void TSknet_sync::load_their_origine(TISAM_recordset& out_set, const char* in_ta
|
||||
str << " Data di ultimo aggiornamento obsoleta";
|
||||
if (dirty)
|
||||
{
|
||||
if (file.rewrite() == 0)
|
||||
_log->log(1, str);
|
||||
else
|
||||
if (file.rewrite() != 0)
|
||||
{
|
||||
TString80 err; err << TR("ERRORE ") << err << TR(" aggiornando il ");
|
||||
str.insert(err);
|
||||
@ -368,14 +372,14 @@ void TSknet_sync::load_their_origine(TISAM_recordset& out_set, const char* in_ta
|
||||
}
|
||||
else
|
||||
{
|
||||
_log->log(0, str);
|
||||
file.reread(_unlock);
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
if (err == _iskeynotfound)
|
||||
{
|
||||
file.zero();
|
||||
FOR_EACH_ARRAY_ROW(pairs, r,row)
|
||||
FOR_EACH_ARRAY_ROW(pairs, r, row)
|
||||
{
|
||||
bfld = row->get(0);
|
||||
cfld = row->get();
|
||||
@ -437,7 +441,7 @@ void TSknet_sync::sync_table(const char* table, const char* out_table,
|
||||
}
|
||||
|
||||
void TSknet_sync::sync_table(const int logicnum, const char* out_table,
|
||||
const TString_array& fields )
|
||||
const TString_array& fields)
|
||||
{
|
||||
const TString& q = build_query(logicnum);
|
||||
TISAM_recordset set(q);
|
||||
@ -473,6 +477,9 @@ void TSknet_sync::sync_anamag()
|
||||
fields.add("CodIva|" ANAMAG_CODIVA);
|
||||
fields.add("CodLinea|" ANAMAG_GRMERC "|1|3");
|
||||
fields.add("CodCategMerceologica|" ANAMAG_GRMERC);
|
||||
fields.add("ArtGruppo|" ANAMAG_GRUPPOV);
|
||||
fields.add("ArtConto|" ANAMAG_CONTOV);
|
||||
fields.add("ArtSottoconto|" ANAMAG_SOTTOCV);
|
||||
fields.add("Bloccato|" ANAMAG_SOSPESO);
|
||||
|
||||
TString query = build_query(LF_ANAMAG);
|
||||
@ -677,12 +684,12 @@ static bool ClifoEvaluator(const TISAM_recordset& rec, const char* fldname, cons
|
||||
var = tipocf == 'F';
|
||||
return true;
|
||||
}
|
||||
if (_strnicmp(fldname,"Cli_",4) == 0)
|
||||
if (_strnicmp(fldname, "Cli_", 4) == 0)
|
||||
{
|
||||
const char tipocf = rec.get(CLI_TIPOCF).as_string()[0];
|
||||
return tipocf != 'C';
|
||||
}
|
||||
if (_strnicmp(fldname,"For_",4) == 0)
|
||||
if (_strnicmp(fldname, "For_", 4) == 0)
|
||||
{
|
||||
const char tipocf = rec.get(CLI_TIPOCF).as_string()[0];
|
||||
return tipocf != 'F';
|
||||
@ -718,7 +725,7 @@ bool TSknet_sync::split_phone(const TRecordset& odbc, const char* number, TIsamf
|
||||
if (split > 1)
|
||||
{
|
||||
clifo.put(pre, pn.left(split));
|
||||
clifo.put(num, pn.mid(split+1));
|
||||
clifo.put(num, pn.mid(split + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -786,7 +793,7 @@ void TSknet_sync::load_clifo(const char tipocf)
|
||||
|
||||
clifo.put(CLI_RAGSOC, odbc.get("RagSoc").as_string());
|
||||
clifo.put(CLI_PAIV, odbc.get("PartitaIva").as_string());
|
||||
clifo.put(CLI_COFI, odbc.get("CodiceFiscale").as_string());
|
||||
clifo.put(CLI_COFI, odbc.get("CodFiscale").as_string());
|
||||
clifo.put(CLI_MAIL, odbc.get("EMail").as_string());
|
||||
|
||||
const int tipo = odbc.get("Tipo").as_int(); // 1=Fisica; 2=Giuridica; 3=Altro
|
||||
@ -814,6 +821,7 @@ void TSknet_sync::load_clifo(const char tipocf)
|
||||
}
|
||||
|
||||
clifo.put(CLI_INDCF, ind.left(50));
|
||||
clifo.put(CLI_CAPCF, civ);
|
||||
clifo.put(CLI_CAPCF, odbc.get("Cap").as_string());
|
||||
|
||||
// Stato
|
||||
@ -830,7 +838,7 @@ void TSknet_sync::load_clifo(const char tipocf)
|
||||
partCom.zero();
|
||||
partCom.put("COD", "STA");
|
||||
TCursor cur(&relCom, "", 1, &partCom, &partCom);
|
||||
for(cur = 0; cur.pos() < cur.items(); ++cur)
|
||||
for (cur = 0; cur.pos() < cur.items(); ++cur)
|
||||
if (cur.curr().get("S10") == statoISO)
|
||||
{
|
||||
stato = cur.curr().get("CODTAB");
|
||||
@ -943,16 +951,25 @@ void TSknet_sync::load_clifo(const char tipocf)
|
||||
}
|
||||
}
|
||||
|
||||
if (err == NOERR)
|
||||
{
|
||||
// Abi e Cab sempre, posso anche avere solo il primo dei due
|
||||
cfb.put("ABI", abi);
|
||||
cfb.put("CAB", cab);
|
||||
// Il conto corrente ovviamente solo se è giusto
|
||||
if (err == NOERR)
|
||||
{
|
||||
cfb.put("NUMCC", contcor);
|
||||
cfb.put("IBAN", iban);
|
||||
}
|
||||
|
||||
// Always true
|
||||
cfv.put(CFV_RAGGEFF, true);
|
||||
cfv.put(CFV_ADDBOLLI, true);
|
||||
|
||||
// Non ho capito se alla fine mi passa qua i dati o nel campo NOTE
|
||||
cfv.put(CFV_ASSFIS, tipocf == 'C' ? odbc.get("Cli_CodIva").as_string() : odbc.get("For_CodIva").as_string());
|
||||
|
||||
// Parso il campo Note
|
||||
TToken_string note (odbc.get("Note").as_string());
|
||||
TToken_string note(odbc.get("Note").as_string());
|
||||
if (!note.blank() && note[note.len() - 1] == '|')
|
||||
note.cut(note.len() - 1);
|
||||
for (int i = 0; i < note.items(); i++)
|
||||
@ -976,15 +993,17 @@ void TSknet_sync::load_clifo(const char tipocf)
|
||||
nonscd.cut(nonscd.len() - 1);
|
||||
cfv.put(CFV_NONACCEFF, nonacc);
|
||||
cfv.put(CFV_NONSCADEFF, nonscd);
|
||||
} else
|
||||
}
|
||||
else
|
||||
if (token.starts_with("RE="))
|
||||
{
|
||||
cfv.put(CFV_RAGGEFF, token == "RE=X");
|
||||
} else
|
||||
// Disabled, always true by analysis
|
||||
}
|
||||
else
|
||||
if (token.starts_with("NOTE="))
|
||||
{
|
||||
TString note = token.mid(5);
|
||||
if(!note.blank())
|
||||
if (!note.blank())
|
||||
cfv.put(CFV_CODNOTE, clifo_add_note(cfv, note));
|
||||
}
|
||||
else
|
||||
@ -1000,22 +1019,31 @@ void TSknet_sync::load_clifo(const char tipocf)
|
||||
clifo.put(CLI_BYMAIL, bymail);
|
||||
clifo.put(CLI_DOCMAIL, email);
|
||||
}
|
||||
else
|
||||
if (token.starts_with("REF="))
|
||||
{
|
||||
clifo.put(CLI_REFERENTE, token.mid(4));
|
||||
}
|
||||
else
|
||||
if (token.starts_with("EDOC="))
|
||||
{
|
||||
clifo.put(CLI_BYMAIL, true);
|
||||
clifo.put(CLI_DOCMAIL, token.mid(5));
|
||||
}
|
||||
else
|
||||
if (token.starts_with("SCONTO="))
|
||||
{
|
||||
clifo.put(CLI_SCONTO, token.mid(7));
|
||||
cfv.put(CFV_SCONTO, token.mid(7));
|
||||
}
|
||||
else
|
||||
if (token.starts_with("AGENT="))
|
||||
{
|
||||
clifo.put(CLI_CODAG, token.mid(6));
|
||||
cfv.put(CFV_CODAG, token.mid(6));
|
||||
}
|
||||
else
|
||||
if (token.starts_with("ASSFIS="))
|
||||
{
|
||||
cfv.put(CFV_ASSFIS, token.mid(7));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1138,7 +1166,7 @@ bool TSknet_sync::save_and_delete_doc(TDocumento*& doc) const
|
||||
TString msg;
|
||||
|
||||
msg.format(FR("Errore %d in registrazione dcoumento %s/%ld del %s"), err,
|
||||
(const char *) doc->get(DOC_CODNUM), doc->get_long(DOC_NDOC), (const char*)doc->get(DOC_DATADOC));
|
||||
(const char *)doc->get(DOC_CODNUM), doc->get_long(DOC_NDOC), (const char*)doc->get(DOC_DATADOC));
|
||||
_log->log(2, msg);
|
||||
msg << TR("\nSi desidera proseguire ugualmente?");
|
||||
if (noyes_box(msg))
|
||||
@ -1163,17 +1191,17 @@ void TSknet_sync::sync_val()
|
||||
void TSknet_sync::sync_doc()
|
||||
{
|
||||
const TString8 codcausdef = ini_get_string(CONFIG_DITTA, "bs", MOVMAG_CODCAUS, "", 2);
|
||||
/*
|
||||
/*
|
||||
if (codcausdef.blank())
|
||||
{
|
||||
_log->log(2, "Configurare parametri per movimenti Bee Store");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
TString str(255);
|
||||
str << "SELECT tieDMovMag.*, tieTBolFat.*, tieTBolFat.Annullato AS DOCANNULLATO, tieDMovMagCONAI.*\n";
|
||||
str << "FROM tieDMovMag\nRIGHT JOIN tieTBolFat ON tieDMovMag.CodTestata = tieTBolFat.Cod_PK\n";
|
||||
if(hasConai)
|
||||
if (hasConai)
|
||||
str << "LEFT JOIN tieDMovMagCONAI ON tieDMovMag.Cod_PK = tieDMovMagCONAI.Cod_PK\n";
|
||||
str << "WHERE tieTBolFat.Origine = " << their_origin();
|
||||
//str << "WHERE tieDMovMag.Origine = " << their_origin() << " AND tieDMovMag.TipoTestata = 2"; // verificare
|
||||
@ -1183,7 +1211,7 @@ void TSknet_sync::sync_doc()
|
||||
docs.connect(_dsn, _usr, _psw);
|
||||
TProgress_monitor pi(docs.items(), str);
|
||||
|
||||
long num_doc = -1, nd, codcf ;
|
||||
long num_doc = -1, nd, codcf;
|
||||
TString4 tipocf;
|
||||
TDocumento* doc = NULL;
|
||||
|
||||
@ -1194,14 +1222,18 @@ void TSknet_sync::sync_doc()
|
||||
nd = docs.get("NumRif").as_int();
|
||||
TString wrk = docs.get("CodCliente").as_string();
|
||||
|
||||
while(wrk[0] >= 'A')
|
||||
while (wrk[0] >= 'A')
|
||||
wrk.ltrim(1);
|
||||
|
||||
codcf = atol(wrk);
|
||||
tipocf = docs.get("TipoIntestatario").as_string();
|
||||
|
||||
if (tipocf != "C" && tipocf != "F")
|
||||
warning_box("Attenzione! Per il doc n.%d è presente il tipo C/F = '%s'\nIl documento verrà saltato.", nd , tipocf);
|
||||
if ((tipocf != "C" && tipocf != "F") || codcf == 0)
|
||||
{
|
||||
TString msg; msg.format("Attenzione! Per il doc n.%d è presente il tipo C/F = '%s' con cod = %d \nIl documento verrà saltato.", nd, tipocf, codcf);
|
||||
_log->log(1, msg);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nd != num_doc)
|
||||
{
|
||||
@ -1213,7 +1245,7 @@ void TSknet_sync::sync_doc()
|
||||
TString8 tipodoc;
|
||||
|
||||
// Controllo se ho ricevuto un codice Campo per il TipoDoc o devo prenderlo dalle impostazioni
|
||||
if(docs.get("TipoDocCE").is_empty())
|
||||
if (docs.get("TipoDocCE").is_empty())
|
||||
{
|
||||
switch (docs.get("TipoDoc").as_int())
|
||||
{
|
||||
@ -1247,7 +1279,7 @@ void TSknet_sync::sync_doc()
|
||||
tipodoc = docs.get("TipoDocCE").as_string();
|
||||
}
|
||||
|
||||
if(numdoc.blank() || tipodoc.blank())
|
||||
if (numdoc.blank() || tipodoc.blank())
|
||||
{
|
||||
_log->log(2, "Configurare parametri per movimenti Bee Store");
|
||||
return;
|
||||
@ -1301,6 +1333,17 @@ void TSknet_sync::sync_doc()
|
||||
doc->put(DOC_ASPBENI2, asp.smid(50));
|
||||
doc->put(DOC_NCOLLI, ncolli);
|
||||
doc->put(DOC_CAUSMAG, codcaus);
|
||||
|
||||
const TString codAg = docs.get("CodAgente").as_string();
|
||||
const TString codPag = docs.get("CodPagamento").as_string();
|
||||
|
||||
if (!codAg.blank())
|
||||
doc->put(DOC_CODAG, codAg);
|
||||
|
||||
if (!codPag.blank())
|
||||
doc->put(DOC_CODPAG, codPag);
|
||||
|
||||
|
||||
}
|
||||
const int tipoart = docs.get("TipoArticolo").as_int();
|
||||
TString4 tiporiga;
|
||||
@ -1349,7 +1392,7 @@ void TSknet_sync::sync_doc()
|
||||
TLocalisamfile codcor(LF_CODCORR); codcor.setkey(2);
|
||||
TRectype rcodcor(LF_CODCORR);
|
||||
rcodcor.put(CODCORR_CODARTALT, codart);
|
||||
if(codcor.read(rcodcor, _isequal) == NOERR)
|
||||
if (codcor.read(rcodcor, _isequal) == NOERR)
|
||||
tiporiga = ini_get_string(CONFIG_DITTA, "BS", "SKNumCustomRiga", "14");
|
||||
}
|
||||
|
||||
@ -1359,7 +1402,7 @@ void TSknet_sync::sync_doc()
|
||||
|
||||
if (tipoart == 2)
|
||||
{
|
||||
if (cache().get("SPP" , codart).not_empty())
|
||||
if (cache().get("SPP", codart).not_empty())
|
||||
rdoc.put(RDOC_CODARTMAG, codart);
|
||||
}
|
||||
else
|
||||
@ -1369,7 +1412,7 @@ void TSknet_sync::sync_doc()
|
||||
}
|
||||
|
||||
rdoc.put(RDOC_CODARTMAG, codart);
|
||||
// rdoc.check_row();
|
||||
// rdoc.check_row();
|
||||
|
||||
const TString descr = docs.get("DSRiga").as_string();
|
||||
|
||||
@ -1382,7 +1425,7 @@ void TSknet_sync::sync_doc()
|
||||
rdoc.put(RDOC_CODMAG, docs.get("CodMagazzino").as_string().left(5));
|
||||
rdoc.put(RDOC_CODMAGC, docs.get("CodMagazDest").as_string().left(5));
|
||||
TString ums = docs.get("CodUntMis").as_string();
|
||||
if(ums.blank() && cache().get("%TRI", tiporiga, "S7") == "M")
|
||||
if (ums.blank() && cache().get("%TRI", tiporiga, "S7") == "M")
|
||||
ums = ini_get_string(CONFIG_DITTA, "BS", "SKCodUmsDef");
|
||||
rdoc.put(RDOC_UMQTA, ums);
|
||||
rdoc.put(RDOC_QTA, docs.get("Quantita").as_real());
|
||||
@ -1423,6 +1466,9 @@ void TSknet_sync::sync_doc()
|
||||
}
|
||||
rdoc.put(RDOC_SCONTO, sconto);
|
||||
|
||||
// Provvigione agenti
|
||||
rdoc.put(RDOC_PERCPROV, docs.get("PercProvv").as_real());
|
||||
|
||||
|
||||
// "CONSCACC", "CONSCALL", "CONSCCAR", "CONSCPLA", "CONSCLEG", "CONSCVET"
|
||||
TString keyCli; keyCli << tipocf << "|" << codcf;
|
||||
|
Loading…
x
Reference in New Issue
Block a user