Patch level : 12.0 no-patch
Files correlati : tf Commento : Inizio preparazione modifiche esterometro discusse in riunione. - Aggiunti filtri clienti per webapp, esteri e soggetti - Aggiunti filtri fornitori per esteri e soggetti - Pulizia del codice generale
This commit is contained in:
parent
d273645f03
commit
3798a79bd0
@ -10,7 +10,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Le funzioni quelle belle
|
// Le funzioni quelle belle
|
||||||
TString getTipoDoc(int id)
|
TString get_tipo_doc(int id)
|
||||||
{
|
{
|
||||||
TString ret;
|
TString ret;
|
||||||
switch(id)
|
switch(id)
|
||||||
@ -42,27 +42,33 @@ TString getTipoDoc(int id)
|
|||||||
case B_TIPO_FATTSCO:
|
case B_TIPO_FATTSCO:
|
||||||
ret = "FS";
|
ret = "FS";
|
||||||
break;
|
break;
|
||||||
/*
|
case B_ESTEROMETRO:
|
||||||
case B_TIPO_CORRNINC:
|
ret = "ESTER";
|
||||||
ret = "CN";
|
|
||||||
break;
|
break;
|
||||||
case B_TIPO_CORR:
|
case B_PAF_NOT_SENT:
|
||||||
ret = "CR";
|
ret = "PAF_NS";
|
||||||
break;
|
break;
|
||||||
case B_TIPO_RICFIS:
|
case B_PAF_SENT:
|
||||||
ret = "RF";
|
ret = "PAF_S";
|
||||||
break;
|
break;
|
||||||
|
case B_PAF_SOG_FAT:
|
||||||
case B_TIPO_RICFISNI:
|
ret = "PAF_SF";
|
||||||
ret = "RN";
|
|
||||||
break;
|
break;
|
||||||
case B_TIPO_SCONT:
|
case B_PAF_ESTERI:
|
||||||
ret = "SC";
|
ret = "PAF_E";
|
||||||
break;
|
break;
|
||||||
case B_TIPO_SCONTNI:
|
case B_PAA_NOT_SENT:
|
||||||
ret = "SN";
|
ret = "PAA_NS";
|
||||||
|
break;
|
||||||
|
case B_PAA_SENT:
|
||||||
|
ret = "PAA_S";
|
||||||
|
break;
|
||||||
|
case B_PAA_ESTERI:
|
||||||
|
ret = "PAA_E";
|
||||||
|
break;
|
||||||
|
case B_PAA_SOG_FAT:
|
||||||
|
ret = "PAA_SF";
|
||||||
break;
|
break;
|
||||||
*/
|
|
||||||
default:
|
default:
|
||||||
ret = "ERR";
|
ret = "ERR";
|
||||||
break;
|
break;
|
||||||
@ -70,23 +76,17 @@ TString getTipoDoc(int id)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTipoDoc(TString id)
|
int get_tipo_doc(const TString id)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
if(id == "AF") ret = B_TIPO_AUTOFATT;
|
if(id == "AF") ret = B_TIPO_AUTOFATT;
|
||||||
else if(id == "BD") ret = B_TIPO_BOLLADOG;
|
else if(id == "BD") ret = B_TIPO_BOLLADOG;
|
||||||
// else if(id == "CN") ret = B_TIPO_CORRNINC;
|
|
||||||
// else if(id == "CR") ret = B_TIPO_CORR;
|
|
||||||
else if(id == "FA") ret = B_TIPO_FATTACQ;
|
else if(id == "FA") ret = B_TIPO_FATTACQ;
|
||||||
else if(id == "FF") ret = B_TIPO_FATTFISC;
|
else if(id == "FF") ret = B_TIPO_FATTFISC;
|
||||||
else if(id == "FS") ret = B_TIPO_FATTSCO;
|
else if(id == "FS") ret = B_TIPO_FATTSCO;
|
||||||
else if(id == "FV") ret = B_TIPO_FATTVEN;
|
else if(id == "FV") ret = B_TIPO_FATTVEN;
|
||||||
else if(id == "NC") ret = B_TIPO_NOTC;
|
else if(id == "NC") ret = B_TIPO_NOTC;
|
||||||
else if(id == "ND") ret = B_TIPO_NOTD;
|
else if(id == "ND") ret = B_TIPO_NOTD;
|
||||||
// else if(id == "RF") ret = B_TIPO_RICFIS;
|
|
||||||
// else if(id == "RN") ret = B_TIPO_RICFISNI;
|
|
||||||
// else if(id == "SC") ret = B_TIPO_SCONT;
|
|
||||||
// else if(id == "SN") ret = B_TIPO_SCONTNI;
|
|
||||||
else if(id == "ST") ret = B_TIPO_STORDOC;
|
else if(id == "ST") ret = B_TIPO_STORDOC;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ bool xvt_fsys_fupdate(const char* src, const char* dst)
|
|||||||
* TD10: Fatt di acquisto intra beni
|
* TD10: Fatt di acquisto intra beni
|
||||||
* TD11: Fatt di acquisto intra servizi
|
* TD11: Fatt di acquisto intra servizi
|
||||||
*/
|
*/
|
||||||
const char* decodTipo(TToken_string* strarr)
|
const char* decod_tipo(TToken_string* strarr)
|
||||||
{
|
{
|
||||||
const TString tipodoc = strarr->get(_codnum);
|
const TString tipodoc = strarr->get(_codnum);
|
||||||
TRectype mov = cache().get(LF_MOV, strarr->get(_numero));
|
TRectype mov = cache().get(LF_MOV, strarr->get(_numero));
|
||||||
@ -178,18 +178,18 @@ const char* decodTipo(TToken_string* strarr)
|
|||||||
intraval.get_keys(keys);
|
intraval.get_keys(keys);
|
||||||
for(int i = 0; i < keys.items(); i++)
|
for(int i = 0; i < keys.items(); i++)
|
||||||
{
|
{
|
||||||
TString key = *(TString*)keys.objptr(i);
|
TString key = *static_cast<TString*>(keys.objptr(i));
|
||||||
real valItem = *(real*)intraval.objptr(key);
|
real val_item = *static_cast<real*>(intraval.objptr(key));
|
||||||
if(valItem > max)
|
if(val_item > max)
|
||||||
{
|
{
|
||||||
keyMax = key;
|
keyMax = key;
|
||||||
max = valItem;
|
max = val_item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Una volta che ho trovato il nostro vincitore vado a prendere il tipo di fattura dal GCS
|
// Una volta che ho trovato il nostro vincitore vado a prendere il tipo di fattura dal GCS
|
||||||
TString keyPCon = keyMax.ssub(keyMax.find('|') + 1);
|
TString key_p_con = keyMax.ssub(keyMax.find('|') + 1);
|
||||||
if(cache().get(LF_PCON, keyPCon, "RICSER") == "1")
|
if(cache().get(LF_PCON, key_p_con, "RICSER") == "1")
|
||||||
return "TD11";
|
return "TD11";
|
||||||
else
|
else
|
||||||
return "TD10";
|
return "TD10";
|
||||||
@ -230,48 +230,48 @@ const char* decodTipo(TToken_string* strarr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Salvo il record modificato in TFCustom */
|
/* Salvo il record modificato in TFCustom */
|
||||||
bool saveRec(TToken_string row, bool esportato)
|
bool save_rec(TToken_string row, const bool esportato)
|
||||||
{
|
{
|
||||||
static TLocalisamfile trasfatt(LF_TRASFATT);
|
static TLocalisamfile trasfatt(LF_TRASFATT);
|
||||||
static TLocalisamfile mov(LF_MOV);
|
static TLocalisamfile mov(LF_MOV);
|
||||||
static TString invio; invio.cut(0);
|
static TString invio; invio.cut(0);
|
||||||
static TString key; key.cut(0) << row.get(_numero) << "|"<< row.get(_aliquota);
|
static TString key; key.cut(0) << row.get(_numero) << "|"<< row.get(_aliquota);
|
||||||
|
|
||||||
TRectype rCust = cache().get(LF_TRASFATT, key);
|
TRectype r_cust = cache().get(LF_TRASFATT, key);
|
||||||
// Se la riga non esiste metto la chiave
|
// Se la riga non esiste metto la chiave
|
||||||
if(rCust.empty())
|
if(r_cust.empty())
|
||||||
{
|
{
|
||||||
rCust.put("NUMREG", row.get(_numero));
|
r_cust.put("NUMREG", row.get(_numero));
|
||||||
}
|
}
|
||||||
rCust.put("TIPO", row.get(_tipocf));
|
r_cust.put("TIPO", row.get(_tipocf));
|
||||||
rCust.put("CODCF", row.get(_codcf));
|
r_cust.put("CODCF", row.get(_codcf));
|
||||||
rCust.put("OCCAS", row.get(_occas));
|
r_cust.put("OCCAS", row.get(_occas));
|
||||||
rCust.put("TIPODOC", row.get(_codnum));
|
r_cust.put("TIPODOC", row.get(_codnum));
|
||||||
rCust.put("TIPODOCAE", row.get(_codnumAE));
|
r_cust.put("TIPODOCAE", row.get(_codnumAE));
|
||||||
rCust.put("NUMDOC", row.get(_numdoc));
|
r_cust.put("NUMDOC", row.get(_numdoc));
|
||||||
rCust.put("DATAREG", row.get(_datareg));
|
r_cust.put("DATAREG", row.get(_datareg));
|
||||||
rCust.put("DATADOC", row.get(_datadoc));
|
r_cust.put("DATADOC", row.get(_datadoc));
|
||||||
rCust.put("IMPONIBILE", row.get(_imponibile));
|
r_cust.put("IMPONIBILE", row.get(_imponibile));
|
||||||
rCust.put("IMPOSTA", row.get(_importoIVA));
|
r_cust.put("IMPOSTA", row.get(_importoIVA));
|
||||||
rCust.put("CODIVA", row.get(_aliquota));
|
r_cust.put("CODIVA", row.get(_aliquota));
|
||||||
rCust.put("NATURA", row.get(_natura));
|
r_cust.put("NATURA", row.get(_natura));
|
||||||
rCust.put("AUTOFATT", row.get(_autofatt));
|
r_cust.put("AUTOFATT", row.get(_autofatt));
|
||||||
if(esportato)
|
if(esportato)
|
||||||
{
|
{
|
||||||
invio << "I";
|
invio << "I";
|
||||||
rCust.put("TFDATA", TDate(TODAY));
|
r_cust.put("TFDATA", TDate(TODAY));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
invio << row.get(_invio);
|
invio << row.get(_invio);
|
||||||
}
|
}
|
||||||
|
|
||||||
rCust.put("TFINVIO", invio);
|
r_cust.put("TFINVIO", invio);
|
||||||
|
|
||||||
return rCust.write_rewrite(trasfatt) == NOERR;
|
return r_cust.write_rewrite(trasfatt) == NOERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const char * noSpecial(char a)
|
inline const char * no_special(const char a)
|
||||||
{
|
{
|
||||||
if(a == 'à')
|
if(a == 'à')
|
||||||
return "a''";
|
return "a''";
|
||||||
@ -289,14 +289,14 @@ inline const char * noSpecial(char a)
|
|||||||
|
|
||||||
bool bd2017()
|
bool bd2017()
|
||||||
{
|
{
|
||||||
static TDate today = TDate(TODAY), lastDay = TDate(31,12,2017);
|
static TDate today = TDate(TODAY), last_day = TDate(31,12,2017);
|
||||||
return today <= lastDay;
|
return today <= last_day;
|
||||||
}
|
}
|
||||||
|
|
||||||
TTrFa_mask& msk()
|
TTrFa_mask& msk()
|
||||||
{
|
{
|
||||||
static TTrFa_mask* msk = NULL;
|
static TTrFa_mask* msk = nullptr;
|
||||||
if (msk == NULL)
|
if (msk == nullptr)
|
||||||
msk = new TTrFa_mask("tf0100a");
|
msk = new TTrFa_mask("tf0100a");
|
||||||
return *msk;
|
return *msk;
|
||||||
}
|
}
|
||||||
@ -419,7 +419,7 @@ const TString& TTrFa_record::var2str(const TString& fldname, const TVariant& var
|
|||||||
{
|
{
|
||||||
if (tmp[a] == speciali[i])
|
if (tmp[a] == speciali[i])
|
||||||
{
|
{
|
||||||
tmp2.cut(0) << tmp.left(a) << noSpecial(speciali[i]) << tmp.mid(a+1);
|
tmp2.cut(0) << tmp.left(a) << no_special(speciali[i]) << tmp.mid(a+1);
|
||||||
tmp = tmp2;
|
tmp = tmp2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,15 +544,15 @@ void TTrFa_app::log(int severity, const char* msg)
|
|||||||
{
|
{
|
||||||
if (severity < 0)
|
if (severity < 0)
|
||||||
{
|
{
|
||||||
_logTFF = msg;
|
_log_tff = msg;
|
||||||
} else
|
} else
|
||||||
if (_log == NULL)
|
if (_log == NULL)
|
||||||
{
|
{
|
||||||
_log = new TLog_report;
|
_log = new TLog_report;
|
||||||
if (_logTFF.full())
|
if (_log_tff.full())
|
||||||
{
|
{
|
||||||
TString txt;
|
TString txt;
|
||||||
txt << _logTFF << ": " << msg;
|
txt << _log_tff << ": " << msg;
|
||||||
_log->log(severity, txt);
|
_log->log(severity, txt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -685,7 +685,7 @@ bool TTrFa_app::create()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Questa funzione crea/verifica il DB
|
// Questa funzione crea/verifica il DB
|
||||||
verifyDB(create);
|
verify_db(create);
|
||||||
|
|
||||||
// Setto se ha il modulo FP
|
// Setto se ha il modulo FP
|
||||||
msk().set_has_fp(has_module(FPAUT));
|
msk().set_has_fp(has_module(FPAUT));
|
||||||
@ -694,28 +694,28 @@ bool TTrFa_app::create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sincronizzo il DB SQL con quello di campo
|
// Sincronizzo il DB SQL con quello di campo
|
||||||
bool TTrFa_app::syncronizeDB()
|
bool TTrFa_app::syncronize_db()
|
||||||
{
|
{
|
||||||
//xvt_sql_begin(_db);
|
//xvt_sql_begin(_db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrFa_app::verifyDB(const bool create)
|
bool TTrFa_app::verify_db(const bool create)
|
||||||
{
|
{
|
||||||
const TFilename ini = "tff.ini";
|
const TFilename ini = "tff.ini";
|
||||||
bool ok = ini.exist();
|
bool ok = ini.exist();
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
xvt_sql_begin(_db);
|
xvt_sql_begin(_db);
|
||||||
TScanner TFF(ini);
|
TScanner tff(ini);
|
||||||
while (ok && !TFF.eof())
|
while (ok && !tff.eof())
|
||||||
{
|
{
|
||||||
const TString& p = TFF.line();
|
const TString& p = tff.line();
|
||||||
if (p.starts_with("[TF") && p.ends_with("F]"))
|
if (p.starts_with("[TF") && p.ends_with("F]"))
|
||||||
{
|
{
|
||||||
TString16 table = p; table.strip("[]");
|
TString16 table = p; table.strip("[]");
|
||||||
ok = create_table(TFF, table);
|
ok = create_table(tff, table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ok && create)
|
if(ok && create)
|
||||||
@ -740,7 +740,7 @@ bool TTrFa_app::verifyDB(const bool create)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrFa_app::copySSA()
|
bool TTrFa_app::copy_ssa()
|
||||||
{
|
{
|
||||||
TFilename tmp;
|
TFilename tmp;
|
||||||
|
|
||||||
@ -772,14 +772,14 @@ bool TTrFa_app::copySSA()
|
|||||||
bool TTrFa_app::send(TTrFa_mask* msk)
|
bool TTrFa_app::send(TTrFa_mask* msk)
|
||||||
{
|
{
|
||||||
// Controllo se è la prima esecuzione, in caso positivo chiedo se vuole controllare p.iva e cf
|
// Controllo se è la prima esecuzione, in caso positivo chiedo se vuole controllare p.iva e cf
|
||||||
bool first = ini_get_bool(CONFIG_DITTA, "tf", "FirstExec", true);
|
const bool first = ini_get_bool(CONFIG_DITTA, "tf", "FirstExec", true);
|
||||||
if(first)
|
if(first)
|
||||||
{
|
{
|
||||||
ini_set_bool(CONFIG_DITTA, "tf", "FirstExec", false);
|
ini_set_bool(CONFIG_DITTA, "tf", "FirstExec", false);
|
||||||
if(yesno_box("Stai eseguendo il programma per la prima volta,\nvuoi controllare di avere tutti i Codici Fiscali e Partite IVA corrette?"))
|
if(yesno_box("Stai eseguendo il programma per la prima volta,\nvuoi controllare di avere tutti i Codici Fiscali e Partite IVA corrette?"))
|
||||||
{
|
{
|
||||||
TExternal_app checkApp("cg1 -2 L");
|
TExternal_app check_app("cg1 -2 L");
|
||||||
checkApp.run();
|
check_app.run();
|
||||||
if(!yesno_box("Desideri proseguire con l'esportazione?"))
|
if(!yesno_box("Desideri proseguire con l'esportazione?"))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -812,11 +812,11 @@ bool TTrFa_app::send(TTrFa_mask* msk)
|
|||||||
// Imposto l'esportazione
|
// Imposto l'esportazione
|
||||||
if(yesno_box("Vuoi segnare i record esportati?"))
|
if(yesno_box("Vuoi segnare i record esportati?"))
|
||||||
{
|
{
|
||||||
if(setEsportato(sheet))
|
if(set_esportato(sheet))
|
||||||
message_box("Record segnati correttamente!");
|
message_box("Record segnati correttamente!");
|
||||||
else
|
else
|
||||||
message_box("Ci sono stati degli errori durante la riscrittura dei records");
|
message_box("Ci sono stati degli errori durante la riscrittura dei records");
|
||||||
msk->setFilterChanged();
|
msk->set_filter_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -825,21 +825,21 @@ bool TTrFa_app::send(TTrFa_mask* msk)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TString TTrFa_app::getKey(TToken_string* strarr)
|
TString TTrFa_app::get_key(TToken_string* strarr)
|
||||||
{
|
{
|
||||||
return strarr->get_char(_tipocf) == 'C' ? DTE_PROVV : DTR_PROVV;
|
return strarr->get_char(_tipocf) == 'C' ? DTE_PROVV : DTR_PROVV;
|
||||||
}
|
}
|
||||||
|
|
||||||
TString TTrFa_app::getHeader(TToken_string* strarr)
|
TString TTrFa_app::get_header(TToken_string* strarr)
|
||||||
{
|
{
|
||||||
/* Devo crearmi una struttura dove immagazzino delle strutture di clienti e all'interno ci metto i numeratori che mi chiedono
|
/* Devo crearmi una struttura dove immagazzino delle strutture di clienti e all'interno ci metto i numeratori che mi chiedono
|
||||||
* Così facendo mando a puttane persino l'append che potevo tranquillamente implementare prima e creare fastidiose query per capire dove cazzo sto
|
* Così facendo mando a puttane persino l'append che potevo tranquillamente implementare prima e creare fastidiose query per capire dove cazzo sto
|
||||||
*/
|
*/
|
||||||
// Chiave header (20): TIPOCF(1) + CODCF(6)
|
// Chiave header (20): TIPOCF(1) + CODCF(6)
|
||||||
static long int idHeader = 0L;
|
static long int id_header = 0L;
|
||||||
|
|
||||||
// Cerco/Aggiungo il Clifo all'std::map
|
// Cerco/Aggiungo il Clifo all'std::map
|
||||||
static TString keyMap; keyMap.cut(0);
|
static TString key_map; key_map.cut(0);
|
||||||
static TString tipocf, codcf, occas;
|
static TString tipocf, codcf, occas;
|
||||||
tipocf.cut(0); codcf.cut(0); occas.cut(0);
|
tipocf.cut(0); codcf.cut(0); occas.cut(0);
|
||||||
|
|
||||||
@ -858,29 +858,29 @@ TString TTrFa_app::getHeader(TToken_string* strarr)
|
|||||||
occas << strarr->get(_occas);
|
occas << strarr->get(_occas);
|
||||||
}
|
}
|
||||||
|
|
||||||
keyMap << tipocf << "|" << codcf << "|" << occas;
|
key_map << tipocf << "|" << codcf << "|" << occas;
|
||||||
|
|
||||||
clifoDoc app;
|
clifo_doc app;
|
||||||
// Non è presente e lo inserisco per la chiave body
|
// Non è presente e lo inserisco per la chiave body
|
||||||
if(mCliDoc.find(keyMap) == mCliDoc.end())
|
if(_m_cli_doc.find(key_map) == _m_cli_doc.end())
|
||||||
{
|
{
|
||||||
idHeader++;
|
id_header++;
|
||||||
app.contCliFo = idHeader;
|
app._cont_cli_fo = id_header;
|
||||||
app.countDoc = 0L;
|
app._count_doc = 0L;
|
||||||
mCliDoc.insert(std::pair<TString,clifoDoc>(keyMap, app));
|
_m_cli_doc.insert(std::pair<TString,clifo_doc>(key_map, app));
|
||||||
}
|
}
|
||||||
static TString header;
|
static TString header;
|
||||||
static TString formatString; formatString.cut(0) << "%c%0";
|
static TString format_string; format_string.cut(0) << "%c%0";
|
||||||
if(occas.blank())
|
if(occas.blank())
|
||||||
{
|
{
|
||||||
formatString << 13 - codcf.len() << "d";
|
format_string << 13 - codcf.len() << "d";
|
||||||
header.format(formatString, tipocf[0], 0);
|
header.format(format_string, tipocf[0], 0);
|
||||||
header << codcf; // Perchè cazzo non va il %s!?
|
header << codcf; // Perchè cazzo non va il %s!?
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
formatString << 13 - occas.len() << "d";
|
format_string << 13 - occas.len() << "d";
|
||||||
header.format(formatString, 'O', 0);
|
header.format(format_string, 'O', 0);
|
||||||
header << occas;
|
header << occas;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,23 +888,23 @@ TString TTrFa_app::getHeader(TToken_string* strarr)
|
|||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
TString TTrFa_app::getBody(TToken_string* strarr, bool add)
|
TString TTrFa_app::get_body(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
|
/* 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
|
* Ok per OGNI cliente devo assegnarli un identificativo del numero della fattura
|
||||||
*/
|
*/
|
||||||
static TString keyMap; keyMap.cut(0) << strarr->get_char(_tipocf) << "|" << strarr->get_int(_codcf) << "|" << strarr->get(_occas);
|
static TString key_map; key_map.cut(0) << strarr->get_char(_tipocf) << "|" << strarr->get_int(_codcf) << "|" << strarr->get(_occas);
|
||||||
|
|
||||||
clifoDoc app = mCliDoc[keyMap];
|
clifo_doc app = _m_cli_doc[key_map];
|
||||||
static TString numDoc; numDoc.cut(0) << strarr->get(_numdoc) << "|" << TDate(strarr->get(_datadoc)).year();
|
static TString num_doc; num_doc.cut(0) << strarr->get(_numdoc) << "|" << TDate(strarr->get(_datadoc)).year();
|
||||||
if(add)
|
if(add)
|
||||||
{
|
{
|
||||||
app.countDoc += 1;
|
app._count_doc += 1;
|
||||||
app.docID.insert(std::pair<TString,long>(numDoc, app.countDoc));
|
app._doc_id.insert(std::pair<TString,long>(num_doc, app._count_doc));
|
||||||
}
|
}
|
||||||
mCliDoc[keyMap] = app;
|
_m_cli_doc[key_map] = app;
|
||||||
|
|
||||||
static TString body; body.format("%07d%07d", app.contCliFo, app.docID[numDoc]);
|
static TString body; body.format("%07d%07d", app._cont_cli_fo, app._doc_id[num_doc]);
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -934,13 +934,13 @@ bool TTrFa_app::tff0100(TSheet_field& sheet)
|
|||||||
// Controllo la presenza di un caricamento in attesa
|
// Controllo la presenza di un caricamento in attesa
|
||||||
if(dte.search(DTE_PROVV))
|
if(dte.search(DTE_PROVV))
|
||||||
{
|
{
|
||||||
bool sent = dte.get("P1_KEYPRGINVIO").as_string() == DTE_PROVV;
|
const bool sent = dte.get("P1_KEYPRGINVIO").as_string() == DTE_PROVV;
|
||||||
if(sent)
|
if(sent)
|
||||||
{
|
{
|
||||||
TString msg = "É presente un'altra esportazione non ancora elaborata vuoi eliminarla?";
|
static const TString msg = "É presente un'altra esportazione non ancora elaborata vuoi eliminarla?";
|
||||||
if(yesno_box(msg))
|
if(yesno_box(msg))
|
||||||
{
|
{
|
||||||
if(!emptyTables(DTE_PROVV))
|
if(!empty_tables(DTE_PROVV))
|
||||||
{
|
{
|
||||||
error_box("Fallita eliminazione record!!!");
|
error_box("Fallita eliminazione record!!!");
|
||||||
return false;
|
return false;
|
||||||
@ -969,13 +969,13 @@ bool TTrFa_app::tff0100(TSheet_field& sheet)
|
|||||||
// Controllo la presenza di un caricamento in attesa
|
// Controllo la presenza di un caricamento in attesa
|
||||||
if(dtr.search(DTR_PROVV))
|
if(dtr.search(DTR_PROVV))
|
||||||
{
|
{
|
||||||
bool sent = dtr.get("P1_KEYPRGINVIO").as_string() == DTR_PROVV;
|
const bool sent = dtr.get("P1_KEYPRGINVIO").as_string() == DTR_PROVV;
|
||||||
TString msg = "É presente un'altra esportazione non ancora elaborata vuoi eliminarla?";
|
static const TString msg = "É presente un'altra esportazione non ancora elaborata vuoi eliminarla?";
|
||||||
if(sent)
|
if(sent)
|
||||||
{
|
{
|
||||||
if(yesno_box(msg))
|
if(yesno_box(msg))
|
||||||
{
|
{
|
||||||
if(!emptyTables(DTR_PROVV))
|
if(!empty_tables(DTR_PROVV))
|
||||||
{
|
{
|
||||||
error_box("Fallita eliminazione record!!!");
|
error_box("Fallita eliminazione record!!!");
|
||||||
return false;
|
return false;
|
||||||
@ -999,7 +999,7 @@ bool TTrFa_app::tff0100(TSheet_field& sheet)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrFa_app::tff0200(TString key)
|
bool TTrFa_app::tff0200(const TString& key)
|
||||||
{
|
{
|
||||||
/********************************************************************************************************************
|
/********************************************************************************************************************
|
||||||
* Cedeprest *
|
* Cedeprest *
|
||||||
@ -1038,10 +1038,10 @@ bool TTrFa_app::tff0200(TString key)
|
|||||||
tff0200f.set("P2_SEDENAZ", nazione);
|
tff0200f.set("P2_SEDENAZ", nazione);
|
||||||
}
|
}
|
||||||
|
|
||||||
myrfso = "";
|
_myrfso = "";
|
||||||
if(haveRFSO(myrfso))
|
if(have_rfso(_myrfso))
|
||||||
{
|
{
|
||||||
TRectype r_ana = cache().get(LF_ANAG, TString(myrfso.left(1)) << "|" << myrfso.sub(1));
|
TRectype r_ana = cache().get(LF_ANAG, TString(_myrfso.left(1)) << "|" << _myrfso.sub(1));
|
||||||
if(r_ana.get_char("TIPORFSO") == 'S') // Stabile Organizzazione
|
if(r_ana.get_char("TIPORFSO") == 'S') // Stabile Organizzazione
|
||||||
{
|
{
|
||||||
TAnagrafica rfso(r_ana);
|
TAnagrafica rfso(r_ana);
|
||||||
@ -1161,8 +1161,8 @@ bool TTrFa_app::tff0400(TSheet_field& sheet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TTrFa_record tff0400f("TFF0400F");
|
TTrFa_record tff0400f("TFF0400F");
|
||||||
tff0400f.set("P4_KEYPRGINVIO", getKey(strarr));
|
tff0400f.set("P4_KEYPRGINVIO", get_key(strarr));
|
||||||
tff0400f.set("P4_KEYHEADERFATT", getHeader(strarr));
|
tff0400f.set("P4_KEYHEADERFATT", get_header(strarr));
|
||||||
|
|
||||||
// Autofattura
|
// Autofattura
|
||||||
if(strcmp(strarr->get(_autofatt),"X") == 0)
|
if(strcmp(strarr->get(_autofatt),"X") == 0)
|
||||||
@ -1351,30 +1351,30 @@ bool TTrFa_app::tff0700(TSheet_field& sheet)
|
|||||||
|
|
||||||
// <DatiFatturaBody>
|
// <DatiFatturaBody>
|
||||||
TTrFa_record tff0700f("TFF0700F");
|
TTrFa_record tff0700f("TFF0700F");
|
||||||
tff0700f.set("P7_KEYPRGINVIO", getKey(strarr));
|
tff0700f.set("P7_KEYPRGINVIO", get_key(strarr));
|
||||||
static TString header;
|
static TString header;
|
||||||
header.cut(0) << getHeader(strarr);
|
header.cut(0) << get_header(strarr);
|
||||||
tff0700f.set("P7_KEYHEADERFATT", header);
|
tff0700f.set("P7_KEYHEADERFATT", header);
|
||||||
tff0700f.set("P7_KEYBODYFATT", getBody(strarr));
|
tff0700f.set("P7_KEYBODYFATT", get_body(strarr));
|
||||||
|
|
||||||
TString natura = strarr->get(_natura);
|
TString natura = strarr->get(_natura);
|
||||||
|
|
||||||
tff0700f.set("P7_TIPODOC", strarr->get(_codnumAE));
|
tff0700f.set("P7_TIPODOC", strarr->get(_codnumAE));
|
||||||
|
|
||||||
// Controllo il tipo di esigilità
|
// Controllo il tipo di esigilità
|
||||||
tff0700f.set("P7_DATA", toDate(strarr->get(_datadoc)));
|
tff0700f.set("P7_DATA", to_date(strarr->get(_datadoc)));
|
||||||
static TString ndoc;
|
static TString ndoc;
|
||||||
ndoc.cut(0) << cache().get(LF_MOV, strarr->get(_numero), "NUMDOCEXT").right(20);
|
ndoc.cut(0) << cache().get(LF_MOV, strarr->get(_numero), "NUMDOCEXT").right(20);
|
||||||
if(ndoc.blank())
|
if(ndoc.blank())
|
||||||
ndoc.cut(0) << strarr->get(_numdoc);
|
ndoc.cut(0) << strarr->get(_numdoc);
|
||||||
tff0700f.set("P7_NUMERO", ndoc);
|
tff0700f.set("P7_NUMERO", ndoc);
|
||||||
tff0700f.set("P7_DATAREG", toDate(strarr->get(_datareg))); // Obbligatoria nei DTR
|
tff0700f.set("P7_DATAREG", to_date(strarr->get(_datareg))); // Obbligatoria nei DTR
|
||||||
tff0700f.set("P7_GESTIONE", "");
|
tff0700f.set("P7_GESTIONE", "");
|
||||||
|
|
||||||
// Campi di controllo
|
// Campi di controllo
|
||||||
tff0700f.set("P7_CLIFOR", header);
|
tff0700f.set("P7_CLIFOR", header);
|
||||||
tff0700f.set("P7_NRODOC", ndoc);
|
tff0700f.set("P7_NRODOC", ndoc);
|
||||||
tff0700f.set("P7_DTADOC", toDate(strarr->get(_datadoc)));
|
tff0700f.set("P7_DTADOC", to_date(strarr->get(_datadoc)));
|
||||||
|
|
||||||
|
|
||||||
ok = tff0700f.insert();
|
ok = tff0700f.insert();
|
||||||
@ -1383,7 +1383,7 @@ bool TTrFa_app::tff0700(TSheet_field& sheet)
|
|||||||
if(!ok) return false;
|
if(!ok) return false;
|
||||||
}
|
}
|
||||||
// In qualsiasi caso va messa la riga ma prima elaboro il numero della riga!
|
// In qualsiasi caso va messa la riga ma prima elaboro il numero della riga!
|
||||||
static TString newKey; newKey.cut(0) << getBody(strarr, false);
|
static TString newKey; newKey.cut(0) << get_body(strarr, false);
|
||||||
|
|
||||||
if(docRighe.find(newKey) == docRighe.end())
|
if(docRighe.find(newKey) == docRighe.end())
|
||||||
{
|
{
|
||||||
@ -1408,9 +1408,9 @@ bool TTrFa_app::tff0700(TSheet_field& sheet)
|
|||||||
bool TTrFa_app::tff2200(TToken_string* strarr, int nriga)
|
bool TTrFa_app::tff2200(TToken_string* strarr, int nriga)
|
||||||
{
|
{
|
||||||
TTrFa_record tff2200f("TFF2200F");
|
TTrFa_record tff2200f("TFF2200F");
|
||||||
tff2200f.set("PL_KEYPRGINVIO", getKey(strarr));
|
tff2200f.set("PL_KEYPRGINVIO", get_key(strarr));
|
||||||
tff2200f.set("PL_KEYHEADERFATT", getHeader(strarr));
|
tff2200f.set("PL_KEYHEADERFATT", get_header(strarr));
|
||||||
tff2200f.set("PL_KEYBODYFATT", getBody(strarr, false));
|
tff2200f.set("PL_KEYBODYFATT", get_body(strarr, false));
|
||||||
|
|
||||||
TString numriga; numriga.format("%020d", nriga);
|
TString numriga; numriga.format("%020d", nriga);
|
||||||
|
|
||||||
@ -1446,8 +1446,8 @@ bool TTrFa_app::tff2200(TToken_string* strarr, int nriga)
|
|||||||
bool TTrFa_app::tff3100(TToken_string* strarr, TRectype r_ana)
|
bool TTrFa_app::tff3100(TToken_string* strarr, TRectype r_ana)
|
||||||
{
|
{
|
||||||
TTrFa_record tff3100f("TFF3100F");
|
TTrFa_record tff3100f("TFF3100F");
|
||||||
tff3100f.set("PH_KEYPRGINVIO", getKey(strarr));
|
tff3100f.set("PH_KEYPRGINVIO", get_key(strarr));
|
||||||
tff3100f.set("PH_KEYHEADERFATT", getHeader(strarr));
|
tff3100f.set("PH_KEYHEADERFATT", get_header(strarr));
|
||||||
if(_append)
|
if(_append)
|
||||||
tff3100f.remove();
|
tff3100f.remove();
|
||||||
|
|
||||||
@ -1496,7 +1496,7 @@ bool TTrFa_app::tff3100(TToken_string* strarr, TRectype r_ana)
|
|||||||
return tff3100f.insert();
|
return tff3100f.insert();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrFa_app::setEsportato(TSheet_field& sheet)
|
bool TTrFa_app::set_esportato(TSheet_field& sheet)
|
||||||
{
|
{
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
TProgress_monitor p(sheet.items(),"Segno l'esportazione sui records");
|
TProgress_monitor p(sheet.items(),"Segno l'esportazione sui records");
|
||||||
@ -1507,7 +1507,7 @@ bool TTrFa_app::setEsportato(TSheet_field& sheet)
|
|||||||
TString modificato = strarr->get(_forzata);
|
TString modificato = strarr->get(_forzata);
|
||||||
if(modificato == "X")
|
if(modificato == "X")
|
||||||
{
|
{
|
||||||
ok = saveRec(*strarr, true);
|
ok = save_rec(*strarr, true);
|
||||||
if(!ok) return false;
|
if(!ok) return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1526,7 +1526,7 @@ bool TTrFa_app::setEsportato(TSheet_field& sheet)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrFa_app::emptyTables(TString key)
|
bool TTrFa_app::empty_tables(TString key)
|
||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
query << "DELETE FROM TFF0100F WHERE P1_KEYPRGINVIO = '" << key << "';\n";
|
query << "DELETE FROM TFF0100F WHERE P1_KEYPRGINVIO = '" << key << "';\n";
|
||||||
@ -1542,11 +1542,11 @@ bool TTrFa_app::emptyTables(TString key)
|
|||||||
void TTrFa_app::main_loop()
|
void TTrFa_app::main_loop()
|
||||||
{
|
{
|
||||||
// Sposto SSA
|
// Sposto SSA
|
||||||
if(!copySSA()) return;
|
if(!copy_ssa()) return;
|
||||||
|
|
||||||
while (msk().run() == K_ENTER)
|
while (msk().run() == K_ENTER)
|
||||||
{
|
{
|
||||||
if(msk().checkNotEmpty())
|
if(msk().check_not_empty())
|
||||||
{
|
{
|
||||||
send(&msk());
|
send(&msk());
|
||||||
//ini_set_string(CONFIG_DITTA, "tf", "LastSend", ++TDate(msk.get(F_DATAFIN)));
|
//ini_set_string(CONFIG_DITTA, "tf", "LastSend", ++TDate(msk.get(F_DATAFIN)));
|
||||||
|
112
src/tf/tf0100a.h
112
src/tf/tf0100a.h
@ -1,62 +1,72 @@
|
|||||||
#define START_MASK 401
|
#define START_MASK 401
|
||||||
|
|
||||||
#define F_DATAINI 401
|
#define F_DATAINI 401
|
||||||
#define F_DATAFIN 402
|
#define F_DATAFIN 402
|
||||||
#define F_TIPOCF 403
|
#define F_TIPOCF 403
|
||||||
#define F_CODCF 404
|
#define F_CODCF 404
|
||||||
#define F_RAGSOC 405
|
#define F_RAGSOC 405
|
||||||
#define F_FATTSEL 406
|
#define F_FATTSEL 406
|
||||||
/* Campi booleani documento */
|
/* Campi booleani documento */
|
||||||
#define START_BOOLEAN 407
|
#define START_BOOLEAN 407
|
||||||
|
#define START_BOOLEAN_FATT 407
|
||||||
|
|
||||||
#define B_TIPO_AUTOFATT 407
|
#define B_TIPO_AUTOFATT 407
|
||||||
#define B_TIPO_FATTACQ 408
|
#define B_TIPO_FATTACQ 408
|
||||||
#define B_TIPO_FATTFISC 409
|
#define B_TIPO_FATTFISC 409
|
||||||
#define B_TIPO_FATTVEN 410
|
#define B_TIPO_FATTVEN 410
|
||||||
#define B_TIPO_FATTSCO 415
|
#define B_TIPO_FATTSCO 415
|
||||||
#define B_TIPO_NOTC 411
|
#define B_TIPO_NOTC 411
|
||||||
#define B_TIPO_NOTD 412
|
#define B_TIPO_NOTD 412
|
||||||
#define B_TIPO_BOLLADOG 413
|
#define B_TIPO_BOLLADOG 413
|
||||||
#define B_TIPO_STORDOC 414
|
#define B_TIPO_STORDOC 414
|
||||||
|
|
||||||
|
#define END_BOOLEAN_FATT 415
|
||||||
|
|
||||||
// Boolean filtri FP
|
// Boolean filtri FP
|
||||||
#define B_ESTEROMETRO 416
|
#define B_ESTEROMETRO 416
|
||||||
#define B_PAF_SENT 417
|
#define B_PAF_NOT_SENT 417
|
||||||
#define B_PAF_NOT_SENT 418
|
#define B_PAF_SENT 418
|
||||||
#define B_REVCHARGE 419
|
#define B_PAF_SOG_FAT 419
|
||||||
|
#define B_PAF_ESTERI 420
|
||||||
|
|
||||||
#define END_BOOLEAN 419
|
#define B_PAA_NOT_SENT 421
|
||||||
|
#define B_PAA_SENT 422
|
||||||
|
#define B_PAA_ESTERI 423
|
||||||
|
#define B_PAA_SOG_FAT 424
|
||||||
|
|
||||||
#define END_MASK 421
|
#define END_BOOLEAN 424
|
||||||
|
|
||||||
#define F_RIGHE 301 // Sheet righe tf
|
#define END_MASK 424
|
||||||
|
|
||||||
#define START_SHEET 101
|
|
||||||
|
|
||||||
#define A_DATAREG 101
|
#define F_RIGHE 301 // Sheet righe tf
|
||||||
#define A_TIPODOC 102
|
|
||||||
#define A_TIPODOCAE 103
|
|
||||||
#define A_NUMDOC 104
|
|
||||||
#define A_DATADOC 105
|
|
||||||
#define A_ALIQUOTA 106
|
|
||||||
#define A_IMPONIBILE 107
|
|
||||||
#define A_IMPOSTA 108
|
|
||||||
#define A_NATURA 109
|
|
||||||
#define A_DETRAIB 110
|
|
||||||
#define A_TIPOCF 111
|
|
||||||
#define A_CODCF 112
|
|
||||||
#define A_OCFPI 113
|
|
||||||
#define A_RAGSOC 114
|
|
||||||
#define A_RFSO 115
|
|
||||||
#define A_RAGSOCRFSO 116
|
|
||||||
#define A_PAIV 117
|
|
||||||
#define A_COFI 118
|
|
||||||
#define A_REVERSE 119
|
|
||||||
#define A_AUTOFATT 120
|
|
||||||
#define A_SPEDITA 121
|
|
||||||
#define A_INVIO 122
|
|
||||||
#define A_FORZATA 123
|
|
||||||
#define A_NUMERO 124
|
|
||||||
#define A_CODERR 125
|
|
||||||
|
|
||||||
#define END_SHEET 125
|
#define START_SHEET 101
|
||||||
|
|
||||||
|
#define A_DATAREG 101
|
||||||
|
#define A_TIPODOC 102
|
||||||
|
#define A_TIPODOCAE 103
|
||||||
|
#define A_NUMDOC 104
|
||||||
|
#define A_DATADOC 105
|
||||||
|
#define A_ALIQUOTA 106
|
||||||
|
#define A_IMPONIBILE 107
|
||||||
|
#define A_IMPOSTA 108
|
||||||
|
#define A_NATURA 109
|
||||||
|
#define A_DETRAIB 110
|
||||||
|
#define A_TIPOCF 111
|
||||||
|
#define A_CODCF 112
|
||||||
|
#define A_OCFPI 113
|
||||||
|
#define A_RAGSOC 114
|
||||||
|
#define A_RFSO 115
|
||||||
|
#define A_RAGSOCRFSO 116
|
||||||
|
#define A_PAIV 117
|
||||||
|
#define A_COFI 118
|
||||||
|
#define A_REVERSE 119
|
||||||
|
#define A_AUTOFATT 120
|
||||||
|
#define A_SPEDITA 121
|
||||||
|
#define A_INVIO 122
|
||||||
|
#define A_FORZATA 123
|
||||||
|
#define A_NUMERO 124
|
||||||
|
#define A_CODERR 125
|
||||||
|
|
||||||
|
#define END_SHEET 125
|
@ -37,6 +37,12 @@ BEGIN
|
|||||||
PICTURE TOOL_EMAIL
|
PICTURE TOOL_EMAIL
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_PDF 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "Cambio stato"
|
||||||
|
PICTURE TOOL_EDIT
|
||||||
|
END
|
||||||
|
|
||||||
#include <helpbar.h>
|
#include <helpbar.h>
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
@ -165,38 +171,78 @@ BEGIN
|
|||||||
FLAGS ""
|
FLAGS ""
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 65 6
|
ENDPAGE
|
||||||
BEGIN
|
|
||||||
PROMPT 30 11 "Filtri clienti FP"
|
PAGE "Esterometro" 0 2 0 0
|
||||||
MODULE FP
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN B_ESTEROMETRO
|
BOOLEAN B_ESTEROMETRO
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 31 12 "Modalità esterometro"
|
PROMPT 1 1 "Modalità esterometro"
|
||||||
MESSAGE FALSE DISABLE,10@
|
MESSAGE FALSE DISABLE,10@ | DISABLE,20@
|
||||||
MESSAGE TRUE ENABLE,10@
|
MESSAGE TRUE ENABLE,10@ | ENABLE,20@
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN B_PAF_SENT
|
GROUPBOX DLG_NULL 65 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 31 13 "Fatture Inviate"
|
PROMPT 0 2 "Clienti FP"
|
||||||
GROUP 10
|
MODULE FP
|
||||||
FLAGS ""
|
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN B_PAF_NOT_SENT
|
BOOLEAN B_PAF_NOT_SENT
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 31 14 "Fatture non Inviate"
|
PROMPT 1 3 "Fatture non inviate (Fatturazione Campo)"
|
||||||
GROUP 10
|
GROUP 10
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN B_PAF_SENT
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 4 "Fatture inviate (Fatturazione Campo)"
|
||||||
|
GROUP 10
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN B_PAF_SOG_FAT
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 5 "Soggetti a fatturazione elettronica"
|
||||||
|
GROUP 10
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN B_PAF_ESTERI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 6 "Esteri"
|
||||||
|
GROUP 10
|
||||||
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 65 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 0 8 "FORNITORI FP"
|
||||||
|
MODULE FP
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN B_PAA_NOT_SENT
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 9 "Fatture non ricevute (Fatturazione Campo)"
|
||||||
|
GROUP 10
|
||||||
|
FLAGS "H"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN B_PAA_SENT
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 10 "Fatture ricevute (Fatturazione Campo)"
|
||||||
|
GROUP 10
|
||||||
|
FLAGS "H"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN B_PAA_ESTERI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 11 "Esteri"
|
||||||
|
GROUP 20
|
||||||
FLAGS ""
|
FLAGS ""
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN B_REVCHARGE
|
BOOLEAN B_PAA_SOG_FAT
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 31 15 "Fatture in reverse charge"
|
PROMPT 1 12 "Soggetti a fatturazione elettronica"
|
||||||
GROUP 10
|
GROUP 20
|
||||||
FLAGS ""
|
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
148
src/tf/tf0100b.h
148
src/tf/tf0100b.h
@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <automask.h>
|
#include <automask.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -39,7 +41,7 @@ enum return_code
|
|||||||
// Su DB: X o ''->Da inviare, F->Forzato, I->Inviato, N->Non inviare
|
// Su DB: X o ''->Da inviare, F->Forzato, I->Inviato, N->Non inviare
|
||||||
enum filter_fatt
|
enum filter_fatt
|
||||||
{
|
{
|
||||||
toSend, // "", "X", "F", "E"
|
to_send, // "", "X", "F", "E"
|
||||||
sent, // "I"
|
sent, // "I"
|
||||||
untouched, // "", "X"
|
untouched, // "", "X"
|
||||||
forced, // "F"
|
forced, // "F"
|
||||||
@ -59,8 +61,6 @@ enum filter_fatt
|
|||||||
#define FLAG_FORZATO "F"
|
#define FLAG_FORZATO "F"
|
||||||
#define FLAG_INVIATO "I"
|
#define FLAG_INVIATO "I"
|
||||||
#define SPESOMETROBASE "ModuliSirio"
|
#define SPESOMETROBASE "ModuliSirio"
|
||||||
#define REG_ATT 1
|
|
||||||
#define REG_PAS 2
|
|
||||||
|
|
||||||
#ifndef CARATTERI_SPECIALI
|
#ifndef CARATTERI_SPECIALI
|
||||||
#define CARATTERI_SPECIALI "àèéìòù°"
|
#define CARATTERI_SPECIALI "àèéìòù°"
|
||||||
@ -68,7 +68,7 @@ enum filter_fatt
|
|||||||
|
|
||||||
/* Così facendo basta modificare la maschera (e le dichiarazioni di conseguenza)
|
/* Così facendo basta modificare la maschera (e le dichiarazioni di conseguenza)
|
||||||
* per avere l'inserimento nello sheet corretto */
|
* per avere l'inserimento nello sheet corretto */
|
||||||
enum spesometroFields{
|
enum spesometro_fields{
|
||||||
_spedita = A_SPEDITA - SHEET_GAP,
|
_spedita = A_SPEDITA - SHEET_GAP,
|
||||||
_invio = A_INVIO - SHEET_GAP,
|
_invio = A_INVIO - SHEET_GAP,
|
||||||
_forzata = A_FORZATA - SHEET_GAP,
|
_forzata = A_FORZATA - SHEET_GAP,
|
||||||
@ -101,23 +101,23 @@ enum spesometroFields{
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Da un id ritorna il tipo doc corrispondente
|
// Da un id ritorna il tipo doc corrispondente
|
||||||
TString getTipoDoc(int id);
|
TString get_tipo_doc(int id);
|
||||||
int getTipoDoc(TString id);
|
int get_tipo_doc(TString id);
|
||||||
|
|
||||||
// Cerca una stringa all'interno di una SLIST (Potrebbe diventare una funzione di XVT.h)
|
// Cerca una stringa all'interno di una SLIST (Potrebbe diventare una funzione di XVT.h)
|
||||||
static SLIST_ELT xvt_slist_find_str(SLIST list, const char* str);
|
static SLIST_ELT xvt_slist_find_str(SLIST list, const char* str);
|
||||||
// Aggiorna il file dst se più vecchio di src (Potrebbe diventare una funzione di XVT.h)
|
// Aggiorna il file dst se più vecchio di src (Potrebbe diventare una funzione di XVT.h)
|
||||||
bool xvt_fsys_fupdate(const char* src, const char* dst);
|
bool xvt_fsys_fupdate(const char* src, const char* dst);
|
||||||
// Decodifica il tipo di documento per il trasferimento fatture
|
// Decodifica il tipo di documento per il trasferimento fatture
|
||||||
const char * decodTipo(TToken_string* strarr);
|
const char * decod_tipo(TToken_string* strarr);
|
||||||
// Salvo un singolo record
|
// Salvo un singolo record
|
||||||
bool saveRec(TToken_string row, bool esportato = false);
|
bool save_rec(TToken_string row, bool esportato = false);
|
||||||
// Ritorno una data in formato ANSI
|
// Ritorno una data in formato ANSI
|
||||||
inline TDate toDate(const char * date) { return TDate(date).string(); }
|
inline TDate to_date(const char * date) { return TDate(date).string(); }
|
||||||
// Salto se la riga non è abilitata
|
// Salto se la riga non è abilitata
|
||||||
#define IF_IS_ENABLED(strarr) if(strcmp(strarr->get(_invio), FLAG_INVIO) != 0 && strcmp(strarr->get(_invio), FLAG_FORZATO) != 0 && strcmp(strarr->get(_invio), FLAG_INVIATO) != 0) continue;
|
#define IF_IS_ENABLED(strarr) if(strcmp(strarr->get(_invio), FLAG_INVIO) != 0 && strcmp(strarr->get(_invio), FLAG_FORZATO) != 0 && strcmp(strarr->get(_invio), FLAG_INVIATO) != 0) continue;
|
||||||
// Ritorno il carattere senza accento maiuscolo
|
// Ritorno il carattere senza accento maiuscolo
|
||||||
inline const char * noSpecial(char a);
|
inline const char * no_special(char a);
|
||||||
// Ritorno se è ancora valida la bolla doganale senza informazioni fornitore
|
// Ritorno se è ancora valida la bolla doganale senza informazioni fornitore
|
||||||
bool bd2017();
|
bool bd2017();
|
||||||
|
|
||||||
@ -152,8 +152,8 @@ public:
|
|||||||
bool search();
|
bool search();
|
||||||
bool search(const char* k1, const char* k2 = NULL, const char* k3 = NULL);
|
bool search(const char* k1, const char* k2 = NULL, const char* k3 = NULL);
|
||||||
|
|
||||||
virtual TObject* dup() const { return new TTrFa_record(*this); }
|
TObject* dup() const override { return new TTrFa_record(*this); }
|
||||||
virtual bool ok() const { return _table.not_empty(); }
|
bool ok() const override { return _table.not_empty(); }
|
||||||
|
|
||||||
TTrFa_record& operator=(const TTrFa_record& rec) { copy(rec); return *this; }
|
TTrFa_record& operator=(const TTrFa_record& rec) { copy(rec); return *this; }
|
||||||
TTrFa_record(const TTrFa_record& rec) { copy(rec); }
|
TTrFa_record(const TTrFa_record& rec) { copy(rec); }
|
||||||
@ -170,26 +170,44 @@ public:
|
|||||||
class TTrFa_cursors : TObject
|
class TTrFa_cursors : TObject
|
||||||
{
|
{
|
||||||
friend class TCursor;
|
friend class TCursor;
|
||||||
TISAM_recordset* c_rmoviva;
|
TISAM_recordset* _c_rmoviva;
|
||||||
TISAM_recordset* c_trasfatt;
|
TISAM_recordset* _c_trasfatt;
|
||||||
bool _newMov;
|
bool _new_mov;
|
||||||
bool _newCust;
|
bool _new_cust;
|
||||||
// Se trovo un record custom devo saltare tutti quelli che trovo successivamente, per fare ciò utilizzo una TToken_string
|
// Se trovo un record custom devo saltare tutti quelli che trovo successivamente, per fare ciò utilizzo una TToken_string
|
||||||
TToken_string _alqCust;
|
TToken_string _alq_cust;
|
||||||
bool _has_fp;
|
bool _esterometro;
|
||||||
|
// paf non inviati
|
||||||
|
bool _paf_ns;
|
||||||
|
// paf inviati
|
||||||
|
bool _paf_s;
|
||||||
|
// paf sogg. fatt
|
||||||
|
bool _paf_sf;
|
||||||
|
// paf esteri
|
||||||
|
bool _paf_e;
|
||||||
|
// paa non inviati
|
||||||
|
bool _paa_ns;
|
||||||
|
// paa inviati
|
||||||
|
bool _paa_s;
|
||||||
|
// paa sogg. fatt
|
||||||
|
bool _paa_sf;
|
||||||
|
// paa esteri
|
||||||
|
bool _paa_e;
|
||||||
|
|
||||||
|
|
||||||
TRectype _next(return_code& code, TString& tipocf, TString& codcf, TString& ocfpi); // Si sposta avanti di un elemento
|
TRectype _next(return_code& code, TString& tipocf, TString& codcf, TString& ocfpi); // Si sposta avanti di un elemento
|
||||||
TRectype _nextCust(return_code& code, TString& tipocf, TString& codcf, TString& ocfpi); // Si sposta avanti di un elemento tra quelli custom
|
TRectype _next_cust(return_code& code, TString& tipocf, TString& codcf, TString& ocfpi); // Si sposta avanti di un elemento tra quelli custom
|
||||||
bool checkEnabled(TISAM_recordset* origCur);
|
bool check_enabled(TISAM_recordset* orig_cur);
|
||||||
|
void reset_esterometro();
|
||||||
public:
|
public:
|
||||||
TTrFa_cursors(bool has_fp) : c_rmoviva(nullptr), c_trasfatt(nullptr), _newMov(false), _newCust(false), _has_fp(has_fp){}
|
TTrFa_cursors();
|
||||||
~TTrFa_cursors();
|
~TTrFa_cursors();
|
||||||
long int getIvaItems() { return c_rmoviva->items(); }
|
long int get_iva_items() const { return _c_rmoviva->items(); }
|
||||||
long int getIvaPos() { return c_rmoviva->cursor()->pos(); }
|
long int get_iva_pos() const { return _c_rmoviva->cursor()->pos(); }
|
||||||
TRectype getIva() { return c_rmoviva->cursor()->curr(); }
|
TRectype get_iva() const { return _c_rmoviva->cursor()->curr(); }
|
||||||
int next(TAssoc_array& recimposte, bool& ok, TString& tipocf, TString& codcf, TString& ocfpi); // Legge tutto il prossimo movimento, in importi mette per ogni codiva la somma
|
int next(TAssoc_array& recimposte, bool& ok, TString& tipocf, TString& codcf, TString& ocfpi); // Legge tutto il prossimo movimento, in importi mette per ogni codiva la somma
|
||||||
|
|
||||||
int updateFilters(const char tipocf, const long codcf, TDate dal, TDate al, int cod = toSend);
|
int update_filters(const char tipocf, const long codcf, TDate dal, TDate al, int cod = to_send);
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -206,51 +224,51 @@ class TTrFa_mask : public TAutomask
|
|||||||
bool _has_fp;
|
bool _has_fp;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void next_page(int p);
|
void next_page(int p) override;
|
||||||
TRecnotype nuovo_progr() const;
|
static TRecnotype nuovo_progr();
|
||||||
void changeInvio(TString tipocf, TString codcf, TString numdoc, TString invio) const;
|
void change_invio(const TString& tipocf, const TString& codcf, const TString& numdoc, const TString& invio) const;
|
||||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||||||
void openJava();
|
void open_java();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_has_fp(bool has_fp) { _has_fp = has_fp; }
|
void set_has_fp(const bool has_fp) { _has_fp = has_fp; }
|
||||||
void setFilterChanged() { _filter_changed = true; }
|
void set_filter_changed() { _filter_changed = true; }
|
||||||
void load_sheet();
|
void load_sheet();
|
||||||
TTrFa_mask(TString msk);
|
TTrFa_mask(const TString& msk);
|
||||||
~TTrFa_mask();
|
~TTrFa_mask();
|
||||||
// Carico i tipi documento all'inizio
|
// Carico i tipi documento all'inizio
|
||||||
void loadConfig();
|
void load_config();
|
||||||
// Salvo i tipi documento
|
// Salvo i tipi documento
|
||||||
void saveConfig();
|
void save_config() const;
|
||||||
// Salvo tutti i records
|
// Salvo tutti i records
|
||||||
bool saveAll();
|
bool save_all() const;
|
||||||
// Controllo tutti i records
|
// Controllo tutti i records
|
||||||
bool checkAll();
|
bool check_all();
|
||||||
// Testo validità record
|
// Testo validità record
|
||||||
bool checkRec(TPrinter* stampa, TToken_string* rec);
|
static bool check_rec(TPrinter* stampa, TToken_string* rec);
|
||||||
// Controllo che siano presenti records
|
// Controllo che siano presenti records
|
||||||
bool checkNotEmpty();
|
bool check_not_empty();
|
||||||
// Controllo finale prima di inviare il tutto, se ci sono fatture
|
// Controllo finale prima di inviare il tutto, se ci sono fatture
|
||||||
// con più volte lo stesso codice aliquota disabilito il precedente
|
// con più volte lo stesso codice aliquota disabilito il precedente
|
||||||
void theFinalCheckDown();
|
void the_final_check_down();
|
||||||
// Mette il flag di invio = [flag] per la riga numero [nrow]
|
// Mette il flag di invio = [flag] per la riga numero [nrow]
|
||||||
void flagRow(int nrow, TString flag);
|
void flag_row(int nrow, const TString& flag);
|
||||||
// Salto se la riga ha un tipo invio non del filtro
|
// Salto se la riga ha un tipo invio non del filtro
|
||||||
bool checkInvio(const TString& invio);
|
bool check_invio(const TString& invio) const;
|
||||||
};
|
};
|
||||||
// Funzione inline di stampa
|
// Funzione inline di stampa
|
||||||
inline void printError(TPrinter* stampa, TString movimento, TString documento, TString msgerr);
|
inline void print_error(TPrinter* stampa, const TString& movimento, const TString& documento, const TString& msgerr);
|
||||||
TTrFa_mask& msk();
|
TTrFa_mask& msk();
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// TTrFa_app
|
// TTrFa_app
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct clifoDoc
|
struct clifo_doc
|
||||||
{
|
{
|
||||||
long contCliFo;
|
long _cont_cli_fo;
|
||||||
long countDoc;
|
long _count_doc;
|
||||||
std::map<TString, long> docID;
|
std::map<TString, long> _doc_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TTrFa_app : public TSkeleton_application
|
class TTrFa_app : public TSkeleton_application
|
||||||
@ -259,41 +277,41 @@ class TTrFa_app : public TSkeleton_application
|
|||||||
TString16 _cofi;
|
TString16 _cofi;
|
||||||
TFilename _dbname;
|
TFilename _dbname;
|
||||||
TLog_report* _log;
|
TLog_report* _log;
|
||||||
TString _logTFF;
|
TString _log_tff;
|
||||||
bool _append;
|
bool _append;
|
||||||
TString myrfso;
|
TString _myrfso;
|
||||||
static long header;
|
static long _header;
|
||||||
// Solitamente nei programmi di campo cerco di sfruttare le classi interne ma per mancanza di tempo sono costretto a usare l'std::vector
|
// Solitamente nei programmi di campo cerco di sfruttare le classi interne ma per mancanza di tempo sono costretto a usare l'std::vector
|
||||||
std::map<TString, clifoDoc> mCliDoc;
|
std::map<TString, clifo_doc> _m_cli_doc;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int parse_line(const TString& line, TString& var, TString& val) const;
|
int parse_line(const TString& line, TString& var, TString& val) const;
|
||||||
bool create_table(TScanner& TFF, const TString& table);
|
bool create_table(TScanner& tff, const TString& table);
|
||||||
TString getKey(TToken_string* strarr);
|
static TString get_key(TToken_string* strarr);
|
||||||
TString getHeader(TToken_string* strarr);
|
TString get_header(TToken_string* strarr);
|
||||||
TString getBody(TToken_string* strarr, bool add = true);
|
TString get_body(TToken_string* strarr, bool add = true);
|
||||||
bool tff0100(TSheet_field& sheet); // Header esportazione
|
bool tff0100(TSheet_field& sheet); // Header esportazione
|
||||||
bool tff0200(TString key); // Anagrafica ditta
|
bool tff0200(const TString& key); // Anagrafica ditta
|
||||||
bool tff0300(TString key, TRectype r_ana); // Rappresentante fiscale ditta
|
bool tff0300(TString key, TRectype r_ana); // Rappresentante fiscale ditta
|
||||||
bool tff0400(TSheet_field& sheet); // Anagrafica clifo
|
bool tff0400(TSheet_field& sheet); // Anagrafica clifo
|
||||||
bool tff0700(TSheet_field& sheet); // Testata documento
|
bool tff0700(TSheet_field& sheet); // Testata documento
|
||||||
bool tff2200(TToken_string* strarr, int nriga); // Riepilogo aliquote
|
bool tff2200(TToken_string* strarr, int nriga); // Riepilogo aliquote
|
||||||
bool tff3100(TToken_string* strarr, TRectype r_ana); // Rappresentante fiscale clifo
|
bool tff3100(TToken_string* strarr, TRectype r_ana); // Rappresentante fiscale clifo
|
||||||
bool setEsportato(TSheet_field& sheet);
|
bool set_esportato(TSheet_field& sheet);
|
||||||
bool emptyTables(TString key); // Cancella da tutte le tabelle i record con chiave key
|
bool empty_tables(TString key); // Cancella da tutte le tabelle i record con chiave key
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void log(int severity, const char* msg);
|
void log(int severity, const char* msg);
|
||||||
bool show_log();
|
bool show_log();
|
||||||
bool syncronizeDB();
|
bool syncronize_db();
|
||||||
bool verifyDB(const bool create);
|
bool verify_db(const bool create);
|
||||||
bool copySSA();
|
bool copy_ssa();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool create();
|
bool create() override;
|
||||||
virtual bool destroy();
|
bool destroy() override;
|
||||||
virtual void main_loop();
|
void main_loop() override;
|
||||||
bool send(TTrFa_mask* msk);
|
bool send(TTrFa_mask* msk);
|
||||||
|
|
||||||
TTrFa_app() : _log(NULL) {}
|
TTrFa_app() : _log(nullptr) {}
|
||||||
};
|
};
|
@ -53,17 +53,23 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case DLG_PDF:
|
||||||
|
{
|
||||||
|
TMask cs_mask("Cambiamento stato movimenti", 1, 20, 10);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
case F_RIGHE:
|
case F_RIGHE:
|
||||||
if (e == se_notify_add)
|
if (e == se_notify_add)
|
||||||
{
|
{
|
||||||
TSheet_field& s = (TSheet_field&)o;
|
TSheet_field& s = dynamic_cast<TSheet_field&>(o);
|
||||||
TToken_string& row = s.row(jolly);
|
TToken_string& row = s.row(jolly);
|
||||||
row.add(nuovo_progr(), s.cid2index(A_NUMERO));
|
row.add(nuovo_progr(), s.cid2index(A_NUMERO));
|
||||||
row.add(get(F_TIPOCF), s.cid2index(A_TIPOCF));
|
row.add(get(F_TIPOCF), s.cid2index(A_TIPOCF));
|
||||||
} else
|
} else
|
||||||
if (e == se_query_del)
|
if (e == se_query_del)
|
||||||
{
|
{
|
||||||
TSheet_field& s = (TSheet_field&)o;
|
TSheet_field& s = dynamic_cast<TSheet_field&>(o);
|
||||||
TToken_string& row = s.row(jolly);
|
TToken_string& row = s.row(jolly);
|
||||||
const TRecnotype progr = row.get_long(0);
|
const TRecnotype progr = row.get_long(0);
|
||||||
return progr >= MOV_CUSTOM;
|
return progr >= MOV_CUSTOM;
|
||||||
@ -78,7 +84,7 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
// Mi interessa solo fe_edit
|
// Mi interessa solo fe_edit
|
||||||
if(e != fe_modify) break;
|
if(e != fe_modify) break;
|
||||||
// Controllo che la data sia < della data documento e l'esercizio sia quello richiesto
|
// Controllo che la data sia < della data documento e l'esercizio sia quello richiesto
|
||||||
TDate datareg = o.get(), datadoc = o.mask().get(A_DATADOC);
|
TDate datareg = static_cast<const char*>(o.get()), datadoc = o.mask().get_date(A_DATADOC);
|
||||||
if(datareg >= get_date(F_DATAINI) && datareg <= get_date(F_DATAFIN))
|
if(datareg >= get_date(F_DATAINI) && datareg <= get_date(F_DATAFIN))
|
||||||
{
|
{
|
||||||
// Controllo la data del documento
|
// Controllo la data del documento
|
||||||
@ -102,7 +108,7 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
{
|
{
|
||||||
// Mi interessa solo fe_edit
|
// Mi interessa solo fe_edit
|
||||||
if(e != fe_modify) break;
|
if(e != fe_modify) break;
|
||||||
TDate datareg = o.mask().get(A_DATAREG), datadoc = o.get();
|
TDate datareg = o.mask().get_date(A_DATAREG), datadoc = static_cast<const char*>(o.get());
|
||||||
// Controllo la data di registrazione
|
// Controllo la data di registrazione
|
||||||
if(datareg.ok())
|
if(datareg.ok())
|
||||||
{
|
{
|
||||||
@ -120,7 +126,7 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
// Calcolo la natura
|
// Calcolo la natura
|
||||||
o.mask().set(A_NATURA, natura(o.get()));
|
o.mask().set(A_NATURA, natura(o.get()));
|
||||||
// Se esiste un imponibile calcolo l'imposta
|
// Se esiste un imponibile calcolo l'imposta
|
||||||
real imponibile = o.mask().get(A_IMPONIBILE), imposta = ZERO;
|
real imponibile = o.mask().get_real(A_IMPONIBILE), imposta = ZERO;
|
||||||
if(imponibile > 0)
|
if(imponibile > 0)
|
||||||
{
|
{
|
||||||
imposta = imponibile * real(cache().get("%IVA", o.get(), "R0")) / 100;
|
imposta = imponibile * real(cache().get("%IVA", o.get(), "R0")) / 100;
|
||||||
@ -133,9 +139,9 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
if(e == fe_modify)
|
if(e == fe_modify)
|
||||||
{
|
{
|
||||||
// Se esiste l'iva calcolo l'imposta
|
// Se esiste l'iva calcolo l'imposta
|
||||||
real imponibile = o.get(), imposta = ZERO;
|
real imponibile = static_cast<const char*>(o.get()), imposta = ZERO;
|
||||||
TString codiva = o.mask().get(A_ALIQUOTA);
|
TString codiva = o.mask().get(A_ALIQUOTA);
|
||||||
if(codiva != "")
|
if(codiva.full())
|
||||||
{
|
{
|
||||||
imposta = imponibile * real(cache().get("%IVA", codiva, "R0")) / 100;
|
imposta = imponibile * real(cache().get("%IVA", codiva, "R0")) / 100;
|
||||||
if(imposta != o.mask().get_real(A_IMPOSTA) && yesno_box("Aggiornare l'imposta?"))
|
if(imposta != o.mask().get_real(A_IMPOSTA) && yesno_box("Aggiornare l'imposta?"))
|
||||||
@ -147,17 +153,17 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
if(e == fe_modify)
|
if(e == fe_modify)
|
||||||
{
|
{
|
||||||
// Controllo dell'esistenza sia di codiva che dell'imponibile e verifico che l'importo immesso sia corretto
|
// Controllo dell'esistenza sia di codiva che dell'imponibile e verifico che l'importo immesso sia corretto
|
||||||
real imponibile = o.mask().get(A_IMPONIBILE), imposta = ZERO;
|
real imponibile = o.mask().get_real(A_IMPONIBILE), imposta = ZERO;
|
||||||
TString codiva = o.mask().get(A_ALIQUOTA);
|
TString codiva = o.mask().get(A_ALIQUOTA);
|
||||||
if(codiva != "" && imponibile > ZERO)
|
if(codiva.full() && imponibile > ZERO)
|
||||||
{
|
{
|
||||||
imposta = imponibile * real(cache().get("%IVA", codiva, "R0")) / 100; imposta = imposta.round(2);
|
imposta = imponibile * real(cache().get("%IVA", codiva, "R0")) / 100; imposta = imposta.round(2);
|
||||||
// Controllo che l'aliquota calcolata sia == a quella che ho qua
|
// Controllo che l'aliquota calcolata sia == a quella che ho qua
|
||||||
real impostaInserita = o.get();
|
real imposta_inserita = static_cast<const char*>(o.get());
|
||||||
if(impostaInserita != imposta)
|
if(imposta_inserita != imposta)
|
||||||
{
|
{
|
||||||
TString msg;
|
TString msg;
|
||||||
msg << "Attenzione!! Il valore immesso " << impostaInserita.string() << "€ non è corretto!\n";
|
msg << "Attenzione!! Il valore immesso " << imposta_inserita.string() << "€ non è corretto!\n";
|
||||||
msg << "Valore corretto: " << imposta.string() << "€\nVuoi proseguire?";
|
msg << "Valore corretto: " << imposta.string() << "€\nVuoi proseguire?";
|
||||||
if(!yesno_box(msg))
|
if(!yesno_box(msg))
|
||||||
{
|
{
|
||||||
@ -180,7 +186,7 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
TRectype app = getCli(tipocf, codcf, ocfpi);
|
TRectype app = getCli(tipocf, codcf, ocfpi);
|
||||||
o.mask().set(A_RAGSOC, app.get("RAGSOC"));
|
o.mask().set(A_RAGSOC, app.get("RAGSOC"));
|
||||||
o.mask().set(A_RFSO, app.get("CODRFSO"));
|
o.mask().set(A_RFSO, app.get("CODRFSO"));
|
||||||
o.mask().set(A_RAGSOCRFSO, getRFSO(app.get("CODRFSO")));
|
o.mask().set(A_RAGSOCRFSO, get_rfso(app.get("CODRFSO")));
|
||||||
o.mask().set(A_PAIV, app.get("PAIV"));
|
o.mask().set(A_PAIV, app.get("PAIV"));
|
||||||
o.mask().set(A_COFI, app.get("COFI"));
|
o.mask().set(A_COFI, app.get("COFI"));
|
||||||
|
|
||||||
@ -199,11 +205,11 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
break;
|
break;
|
||||||
case DLG_SAVEREC:
|
case DLG_SAVEREC:
|
||||||
if(e == fe_button)
|
if(e == fe_button)
|
||||||
saveAll();
|
save_all();
|
||||||
break;
|
break;
|
||||||
case DLG_ARCHIVE:
|
case DLG_ARCHIVE:
|
||||||
if(e == fe_button)
|
if(e == fe_button)
|
||||||
checkAll();
|
check_all();
|
||||||
break;
|
break;
|
||||||
case DLG_EDIT:
|
case DLG_EDIT:
|
||||||
if(e == fe_button)
|
if(e == fe_button)
|
||||||
@ -263,18 +269,18 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
// Vado a cercare la riga
|
// Vado a cercare la riga
|
||||||
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
||||||
{
|
{
|
||||||
long thisProg;
|
long this_prog;
|
||||||
TString thisAlq;
|
TString this_alq;
|
||||||
strarr->get(_numero, thisProg);
|
strarr->get(_numero, this_prog);
|
||||||
strarr->get(_aliquota, thisAlq);
|
strarr->get(_aliquota, this_alq);
|
||||||
if(thisProg == progr && thisAlq == codalq) break;
|
if(this_prog == progr && this_alq == codalq) break;
|
||||||
}
|
}
|
||||||
sheet.destroy(r); // Aggiorna in automatico
|
sheet.destroy(r); // Aggiorna in automatico
|
||||||
|
|
||||||
// Se ha cancellato un movimento custom che deriva dalla prima nota propongo di andarlo a ripescare
|
// Se ha cancellato un movimento custom che deriva dalla prima nota propongo di andarlo a ripescare
|
||||||
if(progr < MOV_CUSTOM && yesno_box("Hai cancellato una riga custom di un movimento in prima nota, vuoi ricaricare la tabella?\n(Tutti i record verranno salvati per non perdere le modifiche!)"))
|
if(progr < MOV_CUSTOM && yesno_box("Hai cancellato una riga custom di un movimento in prima nota, vuoi ricaricare la tabella?\n(Tutti i record verranno salvati per non perdere le modifiche!)"))
|
||||||
{
|
{
|
||||||
saveAll();
|
save_all();
|
||||||
load_sheet();
|
load_sheet();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -282,8 +288,25 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
break;
|
break;
|
||||||
case DLG_EMAIL:
|
case DLG_EMAIL:
|
||||||
if(e == fe_button)
|
if(e == fe_button)
|
||||||
openJava();
|
open_java();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case B_PAF_NOT_SENT:
|
||||||
|
case B_PAF_SENT:
|
||||||
|
{
|
||||||
|
const bool ena_no_wa = !(get_bool(B_PAF_NOT_SENT) || get_bool(B_PAF_SENT));
|
||||||
|
enable(B_PAF_SOG_FAT, ena_no_wa);
|
||||||
|
enable(B_PAF_ESTERI, ena_no_wa);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case B_PAA_NOT_SENT:
|
||||||
|
case B_PAA_SENT:
|
||||||
|
{
|
||||||
|
const bool ena_no_wa = !(get_bool(B_PAA_NOT_SENT) || get_bool(B_PAA_SENT));
|
||||||
|
enable(B_PAA_SOG_FAT, ena_no_wa);
|
||||||
|
enable(B_PAA_ESTERI, ena_no_wa);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -300,7 +323,7 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
{
|
{
|
||||||
TString invio = o.mask().get(A_INVIO);
|
TString invio = o.mask().get(A_INVIO);
|
||||||
if(invio != FLAG_FORZATO && invio != FLAG_ERRORE)
|
if(invio != FLAG_FORZATO && invio != FLAG_ERRORE)
|
||||||
changeInvio(o.mask().get(A_TIPOCF), o.mask().get(A_CODCF), o.mask().get(A_NUMDOC), invio);
|
change_invio(o.mask().get(A_TIPOCF), o.mask().get(A_CODCF), o.mask().get(A_NUMDOC), invio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -308,18 +331,17 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
{
|
{
|
||||||
if (id >= START_MASK && id <= END_MASK)
|
if (id >= START_MASK && id <= END_MASK)
|
||||||
{
|
{
|
||||||
setFilterChanged();
|
set_filter_changed();
|
||||||
}
|
}
|
||||||
if(id >= START_BOOLEAN && id <= END_BOOLEAN)
|
if(id >= START_BOOLEAN && id <= END_BOOLEAN)
|
||||||
saveConfig();
|
save_config();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrFa_mask::openJava()
|
void TTrFa_mask::open_java()
|
||||||
{
|
{
|
||||||
TFilename tmp;
|
TFilename tmp = SPESOMETROBASE "\\ModuliSirio.jar";
|
||||||
tmp = SPESOMETROBASE "\\ModuliSirio.jar";
|
|
||||||
tmp.make_absolute_path();
|
tmp.make_absolute_path();
|
||||||
|
|
||||||
DIRECTORY old_dir; xvt_fsys_get_dir(&old_dir);
|
DIRECTORY old_dir; xvt_fsys_get_dir(&old_dir);
|
||||||
@ -333,38 +355,49 @@ void TTrFa_mask::openJava()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error_box(FR("Impossibile eseguire Java -jar %s"), (const char*)tmp);
|
error_box(FR("Impossibile eseguire Java -jar %s"), static_cast<const char*>(tmp));
|
||||||
}
|
}
|
||||||
xvt_fsys_set_dir(&old_dir);
|
xvt_fsys_set_dir(&old_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrFa_mask::loadConfig()
|
void TTrFa_mask::load_config()
|
||||||
{
|
{
|
||||||
// Rilevo i tipi scelti
|
// Rilevo i tipi scelti
|
||||||
TToken_string tipidoc(ini_get_string(CONFIG_DITTA, "tf", "TIPIDOC"));
|
TToken_string tipidoc(ini_get_string(CONFIG_DITTA, "tf", "TIPIDOC"));
|
||||||
// Potrei fare un for su TToken_string ma non darebbe la possibilità di flaggare tutto in caso di prima installazione
|
// Potrei fare un for su TToken_string ma non darebbe la possibilità di flaggare tutto in caso di prima installazione
|
||||||
for(int pos = 0; pos < tipidoc.items(); pos++)
|
for(int pos = 0; pos < tipidoc.items(); pos++)
|
||||||
{
|
{
|
||||||
int field = getTipoDoc(tipidoc.get(pos));
|
const int field = get_tipo_doc(tipidoc.get(pos));
|
||||||
if(field != -1)
|
if(field != -1)
|
||||||
set(field, "X");
|
set(field, "X");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int id = END_BOOLEAN_FATT + 1; id <= END_BOOLEAN; id++)
|
||||||
|
{
|
||||||
|
set(id, ini_get_bool(CONFIG_DITTA, "tf", get_tipo_doc(id)) ? "X" : "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void TTrFa_mask::saveConfig()
|
void TTrFa_mask::save_config() const
|
||||||
{
|
{
|
||||||
TToken_string tipidoc;
|
TToken_string tipidoc;
|
||||||
for(int id = START_BOOLEAN; id <= END_BOOLEAN; id++)
|
int id = START_BOOLEAN_FATT;
|
||||||
|
for(; id <= END_BOOLEAN_FATT; id++)
|
||||||
{
|
{
|
||||||
if(get_bool(id))
|
if(get_bool(id))
|
||||||
{
|
{
|
||||||
tipidoc.add(getTipoDoc(id));
|
tipidoc.add(get_tipo_doc(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ini_set_string(CONFIG_DITTA, "tf", "TIPIDOC", tipidoc);
|
ini_set_string(CONFIG_DITTA, "tf", "TIPIDOC", tipidoc);
|
||||||
|
|
||||||
|
for (; id <= END_BOOLEAN; id++)
|
||||||
|
{
|
||||||
|
ini_set_bool(CONFIG_DITTA, "tf", get_tipo_doc(id), get_bool(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* salvo tutti i record modificati */
|
/* salvo tutti i record modificati */
|
||||||
bool TTrFa_mask::saveAll()
|
bool TTrFa_mask::save_all() const
|
||||||
{
|
{
|
||||||
TSheet_field& sheet = sfield(F_RIGHE);
|
TSheet_field& sheet = sfield(F_RIGHE);
|
||||||
//TString_array& strarr = sheet.rows_array();
|
//TString_array& strarr = sheet.rows_array();
|
||||||
@ -378,7 +411,7 @@ bool TTrFa_mask::saveAll()
|
|||||||
bool ok, retry = false;
|
bool ok, retry = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ok = saveRec(*strarr);
|
ok = save_rec(*strarr);
|
||||||
if(!ok)
|
if(!ok)
|
||||||
{
|
{
|
||||||
TString msg = "Errore durante il salvataggio del movimento ";
|
TString msg = "Errore durante il salvataggio del movimento ";
|
||||||
@ -401,10 +434,10 @@ bool TTrFa_mask::saveAll()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrFa_mask::checkAll()
|
bool TTrFa_mask::check_all()
|
||||||
{
|
{
|
||||||
// Controllo di avere uno sheet pieno
|
// Controllo di avere uno sheet pieno
|
||||||
if(!checkNotEmpty()) return true;
|
if(!check_not_empty()) return true;
|
||||||
|
|
||||||
if(yesno_box("Controllare tutti i C.F. P.IVA?"))
|
if(yesno_box("Controllare tutti i C.F. P.IVA?"))
|
||||||
{
|
{
|
||||||
@ -413,7 +446,7 @@ bool TTrFa_mask::checkAll()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sistemo i flag
|
// Sistemo i flag
|
||||||
theFinalCheckDown();
|
the_final_check_down();
|
||||||
|
|
||||||
static TPrinter stampa;
|
static TPrinter stampa;
|
||||||
stampa.reset();
|
stampa.reset();
|
||||||
@ -435,7 +468,7 @@ bool TTrFa_mask::checkAll()
|
|||||||
TSheet_field& sheet = sfield(F_RIGHE);
|
TSheet_field& sheet = sfield(F_RIGHE);
|
||||||
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
||||||
{
|
{
|
||||||
checkRec(&stampa, strarr);
|
check_rec(&stampa, strarr);
|
||||||
}
|
}
|
||||||
riga.reset();
|
riga.reset();
|
||||||
riga.put(TR("------------------ Fine controllo! ------------------"), 30);
|
riga.put(TR("------------------ Fine controllo! ------------------"), 30);
|
||||||
@ -444,7 +477,7 @@ bool TTrFa_mask::checkAll()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void printError(TPrinter* stampa, TString movimento, TString documento, TString msgerr)
|
inline void print_error(TPrinter* stampa, const TString& movimento, const TString& documento, const TString& msgerr)
|
||||||
{
|
{
|
||||||
TPrintrow riga;
|
TPrintrow riga;
|
||||||
riga.put(movimento, 0);
|
riga.put(movimento, 0);
|
||||||
@ -453,40 +486,42 @@ inline void printError(TPrinter* stampa, TString movimento, TString documento, T
|
|||||||
stampa->print(riga);
|
stampa->print(riga);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrFa_mask::checkRec(TPrinter* stampa, TToken_string* rec)
|
bool TTrFa_mask::check_rec(TPrinter* stampa, TToken_string* rec)
|
||||||
{
|
{
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
TString numMov = rec->get(_numero), numDoc = rec->get(_numdoc);
|
const TString num_mov = rec->get(_numero);
|
||||||
|
const TString num_doc = rec->get(_numdoc);
|
||||||
TString msgerr;
|
TString msgerr;
|
||||||
TString coderr;
|
TString coderr;
|
||||||
// Controllo date ***********************************************************************************
|
// Controllo date ***********************************************************************************
|
||||||
TDate reg = rec->get(_datareg), doc = rec->get(_datadoc);
|
const TDate reg = rec->get(_datareg), doc = rec->get(_datadoc);
|
||||||
if(reg < doc)
|
if(reg < doc)
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
msgerr.cut(0) << "Data registrazione precedente alla data del documento";
|
msgerr.cut(0) << "Data registrazione precedente alla data del documento";
|
||||||
printError(stampa, numMov, numDoc, msgerr);
|
print_error(stampa, num_mov, num_doc, msgerr);
|
||||||
coderr << "1;";
|
coderr << "1;";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Controllo aliquota, imponibile e imposta *********************************************************
|
// Controllo aliquota, imponibile e imposta *********************************************************
|
||||||
TCodiceIVA codiva(rec->get(_aliquota));
|
TCodiceIVA codiva(rec->get(_aliquota));
|
||||||
TString nat = rec->get(_natura), realNat(natura(rec->get(_aliquota)));
|
TString nat = rec->get(_natura);
|
||||||
|
const TString real_nat(natura(rec->get(_aliquota)));
|
||||||
nat.ltrim(); // Se vuoto arriva con uno spazio
|
nat.ltrim(); // Se vuoto arriva con uno spazio
|
||||||
real imponibile = rec->get(_imponibile), imposta = rec->get(_importoIVA);
|
const real imponibile = static_cast<const char*>(rec->get(_imponibile)), imposta = static_cast<const char*>(rec->get(_importoIVA));
|
||||||
if(nat != realNat)
|
if(nat != real_nat)
|
||||||
{
|
{
|
||||||
msgerr.cut(0) << "Natura del movimento errata, valore dichiarato: " << nat << " valore corretto: " << realNat;
|
msgerr.cut(0) << "Natura del movimento errata, valore dichiarato: " << nat << " valore corretto: " << real_nat;
|
||||||
printError(stampa, numMov, numDoc, msgerr);
|
print_error(stampa, num_mov, num_doc, msgerr);
|
||||||
coderr << "2;";
|
coderr << "2;";
|
||||||
}
|
}
|
||||||
|
|
||||||
real realImp = imponibile * codiva.percentuale() / CENTO;
|
real real_imp = imponibile * codiva.percentuale() / CENTO;
|
||||||
realImp.round(2);
|
real_imp.round(2);
|
||||||
if(imposta > realImp + TOLLARANZA || imposta < realImp - TOLLARANZA)
|
if(imposta > real_imp + TOLLARANZA || imposta < real_imp - TOLLARANZA)
|
||||||
{
|
{
|
||||||
msgerr.cut(0) << "Imposta errata, valore dichiarato: " << imposta.string() << " valore \"potenzialmente\" corretto: " << realImp.string();
|
msgerr.cut(0) << "Imposta errata, valore dichiarato: " << imposta.string() << " valore \"potenzialmente\" corretto: " << real_imp.string();
|
||||||
printError(stampa, numMov, numDoc, msgerr);
|
print_error(stampa, num_mov, num_doc, msgerr);
|
||||||
coderr << "3;";
|
coderr << "3;";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +529,7 @@ bool TTrFa_mask::checkRec(TPrinter* stampa, TToken_string* rec)
|
|||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
msgerr.cut(0) << "Non riesco a determinare il tipo di documento corretto per l'agenzia delle entrate!";
|
msgerr.cut(0) << "Non riesco a determinare il tipo di documento corretto per l'agenzia delle entrate!";
|
||||||
printError(stampa, numMov, numDoc, msgerr);
|
print_error(stampa, num_mov, num_doc, msgerr);
|
||||||
coderr << "4;";
|
coderr << "4;";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +539,7 @@ bool TTrFa_mask::checkRec(TPrinter* stampa, TToken_string* rec)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrFa_mask::checkNotEmpty()
|
bool TTrFa_mask::check_not_empty()
|
||||||
{
|
{
|
||||||
TSheet_field& sheet = sfield(F_RIGHE);
|
TSheet_field& sheet = sfield(F_RIGHE);
|
||||||
TString msg;
|
TString msg;
|
||||||
@ -522,49 +557,48 @@ bool TTrFa_mask::checkNotEmpty()
|
|||||||
return sheet.full();
|
return sheet.full();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrFa_mask::theFinalCheckDown() // IT'S THE FINAL CHECKDOOOOOOOWN! WE'RE CHECKING TOGEEEETHEEEEER!!!!
|
void TTrFa_mask::the_final_check_down() // IT'S THE FINAL CHECKDOOOOOOOWN! WE'RE CHECKING TOGEEEETHEEEEER!!!!
|
||||||
{
|
{
|
||||||
TSheet_field& sheet = sfield(F_RIGHE);
|
TSheet_field& sheet = sfield(F_RIGHE);
|
||||||
TAssoc_array cliDocs;
|
TAssoc_array cli_docs;
|
||||||
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
||||||
{
|
{
|
||||||
// Chiave: TIPOCF + CODCF + NUMDOC + CODIVA
|
// Chiave: TIPOCF + CODCF + NUMDOC + CODIVA
|
||||||
TString key; key << strarr->get_char(_tipocf) << "|" << strarr->get_int(_codcf) << "|" << strarr->get(_numdoc) << "|" << strarr->get(_aliquota);
|
TString key; key << strarr->get_char(_tipocf) << "|" << strarr->get_int(_codcf) << "|" << strarr->get(_numdoc) << "|" << strarr->get(_aliquota);
|
||||||
TToken_string newNumero; newNumero.add(r, 0); newNumero.add(strarr->get_char(_invio), 1);
|
TToken_string newNumero; newNumero.add(r, 0); newNumero.add(strarr->get_char(_invio), 1);
|
||||||
if(cliDocs.is_key(key))
|
if(cli_docs.is_key(key))
|
||||||
{
|
{
|
||||||
TToken_string oldnumero = *(TToken_string*)cliDocs.objptr(key);
|
TToken_string oldnumero = *dynamic_cast<TToken_string*>(cli_docs.objptr(key));
|
||||||
TString oldflag; oldnumero.get(1, oldflag);
|
TString oldflag; oldnumero.get(1, oldflag);
|
||||||
if(oldflag == FLAG_FORZATO)
|
if(oldflag == FLAG_FORZATO)
|
||||||
flagRow(r, FLAG_NINVIO);
|
flag_row(r, FLAG_NINVIO);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int oldr; oldnumero.get(0, oldr);
|
int oldr; oldnumero.get(0, oldr);
|
||||||
flagRow(oldr, FLAG_NINVIO);
|
flag_row(oldr, FLAG_NINVIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
cliDocs.add(key, newNumero);
|
cli_docs.add(key, newNumero);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cliDocs.add(key, newNumero);
|
cli_docs.add(key, newNumero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Forzo l'aggiornamento dello sheet
|
// Forzo l'aggiornamento dello sheet
|
||||||
sfield(F_RIGHE).force_update();
|
sfield(F_RIGHE).force_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrFa_mask::flagRow(int nrow, TString flag)
|
void TTrFa_mask::flag_row(const int nrow, const TString& flag)
|
||||||
{
|
{
|
||||||
TSheet_field& sheet = sfield(F_RIGHE);
|
sfield(F_RIGHE).row(nrow).add(flag, _invio);
|
||||||
TToken_string& row = sheet.row(nrow);
|
|
||||||
row.add(flag, _invio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TRecnotype TTrFa_mask::nuovo_progr() const
|
TRecnotype TTrFa_mask::nuovo_progr()
|
||||||
{
|
{
|
||||||
static TRectype app(LF_TRASFATT);
|
static TRectype app(LF_TRASFATT);
|
||||||
app.last(TLocalisamfile(LF_TRASFATT));
|
static TLocalisamfile ltrasfatt(LF_TRASFATT);
|
||||||
|
app.last(ltrasfatt);
|
||||||
// Lo inizializzo solo la prima volta poi incremento
|
// Lo inizializzo solo la prima volta poi incremento
|
||||||
static TRecnotype numreg = app.get_long("NUMREG") > MOV_CUSTOM ? app.get_long("NUMREG") : MOV_CUSTOM;
|
static TRecnotype numreg = app.get_long("NUMREG") > MOV_CUSTOM ? app.get_long("NUMREG") : MOV_CUSTOM;
|
||||||
numreg++;
|
numreg++;
|
||||||
@ -572,7 +606,7 @@ TRecnotype TTrFa_mask::nuovo_progr() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dato un cliente e il suo numero documento imposto il nuovo flag di invio su tutti i campi
|
// Dato un cliente e il suo numero documento imposto il nuovo flag di invio su tutti i campi
|
||||||
void TTrFa_mask::changeInvio(TString tipocf, TString codcf, TString numdoc, TString invio) const
|
void TTrFa_mask::change_invio(const TString& tipocf, const TString& codcf, const TString& numdoc, const TString& invio) const
|
||||||
{
|
{
|
||||||
TSheet_field& sheet = sfield(F_RIGHE);
|
TSheet_field& sheet = sfield(F_RIGHE);
|
||||||
TString rtipo, rcod, rnum, rinvio;
|
TString rtipo, rcod, rnum, rinvio;
|
||||||
@ -611,10 +645,10 @@ void TTrFa_mask::load_sheet()
|
|||||||
}
|
}
|
||||||
//TString key; key << "TIPOA=" << prefix().firm().get("TIPOA")<< ",CODANAGR=" << prefix().firm().get("CODANAGR");
|
//TString key; key << "TIPOA=" << prefix().firm().get("TIPOA")<< ",CODANAGR=" << prefix().firm().get("CODANAGR");
|
||||||
TString key; key << prefix().firm().get("TIPOA") << "|" << prefix().firm().get("CODANAGR");
|
TString key; key << prefix().firm().get("TIPOA") << "|" << prefix().firm().get("CODANAGR");
|
||||||
static const TString pivaDitta = cache().get(LF_ANAG, key, "PAIV");
|
static const TString piva_ditta = cache().get(LF_ANAG, key, "PAIV");
|
||||||
static const TString cofiDitta = cache().get(LF_ANAG, key, "COFI");
|
static const TString cofi_ditta = cache().get(LF_ANAG, key, "COFI");
|
||||||
|
|
||||||
TTrFa_cursors c(_has_fp);
|
TTrFa_cursors c;
|
||||||
|
|
||||||
TSheet_field& sheet = sfield(F_RIGHE);
|
TSheet_field& sheet = sfield(F_RIGHE);
|
||||||
|
|
||||||
@ -622,24 +656,24 @@ void TTrFa_mask::load_sheet()
|
|||||||
if(!sheet.empty())
|
if(!sheet.empty())
|
||||||
sheet.destroy();
|
sheet.destroy();
|
||||||
TAssoc_array recimposte;
|
TAssoc_array recimposte;
|
||||||
int items = c.updateFilters(tipo, codice, dal, al, get_int(F_FATTSEL));
|
const int items = c.update_filters(tipo, codice, dal, al, get_int(F_FATTSEL));
|
||||||
TString tipocf, codcf, ocfpi, nat;
|
TString tipocf, codcf, ocfpi, nat;
|
||||||
for(bool ok = true; items > 0 && ok;)
|
for(bool ok = true; items > 0 && ok;)
|
||||||
{
|
{
|
||||||
tipocf.cut(0), codcf.cut(0), ocfpi.cut(0), nat.cut(0);
|
tipocf.cut(0), codcf.cut(0), ocfpi.cut(0), nat.cut(0);
|
||||||
int err = c.next(recimposte, ok, tipocf, codcf, ocfpi);
|
const int err = c.next(recimposte, ok, tipocf, codcf, ocfpi);
|
||||||
|
|
||||||
// Carico i clienti
|
// Carico i clienti
|
||||||
TRectype cli = getCli(tipocf, codcf, ocfpi);
|
TRectype cli = getCli(tipocf, codcf, ocfpi);
|
||||||
|
|
||||||
FOR_EACH_ASSOC_OBJECT(recimposte, h, iva, rec)
|
FOR_EACH_ASSOC_OBJECT(recimposte, h, iva, rec)
|
||||||
{
|
{
|
||||||
TRectype movimento = *(TRectype*)rec;
|
TRectype movimento = *dynamic_cast<TRectype*>(rec);
|
||||||
// Controllo che sia un tipo documento da leggere
|
// Controllo che sia un tipo documento da leggere
|
||||||
int tipoDoc = getTipoDoc(movimento.get("TIPODOC"));
|
const int tipo_doc = get_tipo_doc(movimento.get("TIPODOC"));
|
||||||
if(tipoDoc != -1 && !get_bool(tipoDoc)) continue;
|
if(tipo_doc != -1 && !get_bool(tipo_doc)) continue;
|
||||||
// A volte mi pesca movimenti con invio sbagliato
|
// A volte mi pesca movimenti con invio sbagliato
|
||||||
if(!checkInvio(movimento.get("TFINVIO"))) continue;
|
if(!check_invio(movimento.get("TFINVIO"))) continue;
|
||||||
|
|
||||||
// Creo una nuova riga nello sheet
|
// Creo una nuova riga nello sheet
|
||||||
TToken_string& row = sheet.row(-1);
|
TToken_string& row = sheet.row(-1);
|
||||||
@ -647,59 +681,59 @@ void TTrFa_mask::load_sheet()
|
|||||||
/* Siccome mi cambiano l'ordine ogni volta e non ho voglia di cambiare tutto ovunque
|
/* Siccome mi cambiano l'ordine ogni volta e non ho voglia di cambiare tutto ovunque
|
||||||
* basta settare i valori negli enum e lo sheet
|
* basta settare i valori negli enum e lo sheet
|
||||||
*/
|
*/
|
||||||
TRectype isCust = getTrasFatt(movimento.get("NUMREG"), iva);
|
TRectype is_cust = getTrasFatt(movimento.get("NUMREG"), iva);
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if(isCust.full() && (err < foundcust || err > foundidcust))
|
if(is_cust.full() && (err < foundcust || err > foundidcust))
|
||||||
bool tolla = true;
|
bool tolla = true;
|
||||||
#endif
|
#endif
|
||||||
const char * toSend = movimento.get("TFINVIO").blank() ? FLAG_INVIO : movimento.get("TFINVIO");
|
const char * to_send = movimento.get("TFINVIO").blank() ? FLAG_INVIO : movimento.get("TFINVIO");
|
||||||
row.add(movimento.get("TFINVIO") == FLAG_INVIATO ? "X" : "", _spedita); // Spedita
|
row.add(movimento.get("TFINVIO") == FLAG_INVIATO ? "X" : "", _spedita); // Spedita
|
||||||
row.add(toSend); // Da spedire
|
row.add(to_send); // Da spedire
|
||||||
row.add(isCust.full() ? "X" : "", _forzata); // Modificato
|
row.add(is_cust.full() ? "X" : "", _forzata); // Modificato
|
||||||
row.add(movimento.get_long("NUMREG"), _numero); // Numero registrazione
|
row.add(movimento.get_long("NUMREG"), _numero); // Numero registrazione
|
||||||
row.add(movimento.get_date("DATAREG"), _datareg); // Data Registrazione
|
row.add(movimento.get_date("DATAREG"), _datareg); // Data Registrazione
|
||||||
row.add(movimento.get("TIPO"), _tipocf); // Tipo Cli/For
|
row.add(movimento.get("TIPO"), _tipocf); // Tipo Cli/For
|
||||||
row.add(movimento.get("CODCF"), _codcf); // Codice Cli/For
|
row.add(movimento.get("CODCF"), _codcf); // Codice Cli/For
|
||||||
row.add(movimento.get("OCCAS"), _occas); // Codice Occasionale
|
row.add(movimento.get("OCCAS"), _occas); // Codice Occasionale
|
||||||
row.add(cli.get("RAGSOC"), _ragsoc); // Ragione sociale
|
row.add(cli.get("RAGSOC"), _ragsoc); // Ragione sociale
|
||||||
row.add(cli.get("CODRFSO"), _rfso); // Codice RF/SO
|
row.add(cli.get("CODRFSO"), _rfso); // Codice RF/SO
|
||||||
row.add(getRFSO(cli.get("CODRFSO")), _ragsocrfso); // Ragione Sociale RF/SO
|
row.add(get_rfso(cli.get("CODRFSO")), _ragsocrfso); // Ragione Sociale RF/SO
|
||||||
row.add(movimento.get("NUMDOC"), _numdoc); // Numero documento
|
row.add(movimento.get("NUMDOC"), _numdoc); // Numero documento
|
||||||
row.add(movimento.get_date("DATADOC"), _datadoc); // Data documento
|
row.add(movimento.get_date("DATADOC"), _datadoc); // Data documento
|
||||||
nat.cut(0) << movimento.get("NATURA");
|
nat.cut(0) << movimento.get("NATURA");
|
||||||
row.add(nat.full() ? nat : natura(iva), _natura); // NATURA!
|
row.add(nat.full() ? nat : natura(iva), _natura); // NATURA!
|
||||||
row.add(iva, _aliquota); // Codice aliquota!
|
row.add(iva, _aliquota); // Codice aliquota!
|
||||||
row.add(findDetraib(movimento.get("TIPODET")), _detraibile); // Detraibilità
|
row.add(find_detraib(movimento.get("TIPODET")), _detraibile); // Detraibilità
|
||||||
row.add(movimento.get_real("IMPONIBILE"), _imponibile); // Imponibile
|
row.add(movimento.get_real("IMPONIBILE"), _imponibile); // Imponibile
|
||||||
row.add(movimento.get_real("IMPOSTA"), _importoIVA); // Imposta
|
row.add(movimento.get_real("IMPOSTA"), _importoIVA); // Imposta
|
||||||
row.add(revCharge(movimento.get("NUMREG"), movimento.get_date("DATAREG").year()), _reverse); // Rev.Charge
|
row.add(rev_charge(movimento.get("NUMREG"), movimento.get_date("DATAREG").year()), _reverse); // Rev.Charge
|
||||||
|
|
||||||
|
|
||||||
row.add(movimento.get("TIPODOC"), _codnum);
|
row.add(movimento.get("TIPODOC"), _codnum);
|
||||||
// Calcolo il tipo documento alla fine per sicurezza
|
// Calcolo il tipo documento alla fine per sicurezza
|
||||||
if (isCust.full())
|
if (is_cust.full())
|
||||||
{
|
{
|
||||||
row.add(movimento.get("TIPODOCAE").blank() ? decodTipo(&row) : movimento.get("TIPODOCAE"), _codnumAE); // Tipo documento
|
row.add(movimento.get("TIPODOCAE").blank() ? decod_tipo(&row) : movimento.get("TIPODOCAE"), _codnumAE); // Tipo documento
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
row.add(decodTipo(&row), _codnumAE); // Tipo documento
|
row.add(decod_tipo(&row), _codnumAE); // Tipo documento
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Possono esistere movimenti custom dove il cliente ha una partita IVA propria
|
* Possono esistere movimenti custom dove il cliente ha una partita IVA propria
|
||||||
* ma è stato flaggato l'autofattura, quindi in trasfat è presente il codice cliente con PIVA e CODFIS della ditta.
|
* ma è stato flaggato l'autofattura, quindi in trasfat è presente il codice cliente con PIVA e CODFIS della ditta.
|
||||||
* Controllo sia il movimento che il cliente
|
* Controllo sia il movimento che il cliente
|
||||||
*/
|
*/
|
||||||
if(movimento.get("AUTOFATT") == "X" || pivaDitta == cli.get("PAIV")) // Se è un autofattura
|
if(movimento.get("AUTOFATT") == "X" || piva_ditta == cli.get("PAIV")) // Se è un autofattura
|
||||||
{
|
{
|
||||||
row.add("X", _autofatt); // AutoFatt
|
row.add("X", _autofatt); // AutoFatt
|
||||||
row.add(pivaDitta, _paiv); // P.IVA
|
row.add(piva_ditta, _paiv); // P.IVA
|
||||||
row.add(cofiDitta, _codfis); // Codice Fiscale
|
row.add(cofi_ditta, _codfis); // Codice Fiscale
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
row.add("", _autofatt); // AutoFatt
|
row.add("", _autofatt); // AutoFatt
|
||||||
row.add(cli.get("PAIV"), _paiv); // P.IVA
|
row.add(cli.get("PAIV"), _paiv); // P.IVA
|
||||||
row.add(cli.get("COFI"), _codfis); // Codice Fiscale
|
row.add(cli.get("COFI"), _codfis); // Codice Fiscale
|
||||||
}
|
}
|
||||||
sheet.enable_cell(sheet.items()-1, _occas, movimento.get("OCCAS").full());
|
sheet.enable_cell(sheet.items()-1, _occas, movimento.get("OCCAS").full());
|
||||||
}
|
}
|
||||||
@ -710,19 +744,19 @@ void TTrFa_mask::load_sheet()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TTrFa_mask::checkInvio(const TString& invio)
|
bool TTrFa_mask::check_invio(const TString& invio) const
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
switch(get_int(F_FATTSEL))
|
switch(get_int(F_FATTSEL))
|
||||||
{
|
{
|
||||||
case toSend:
|
case to_send:
|
||||||
ok = invio == "" || invio == FLAG_INVIO || invio == FLAG_FORZATO || invio == FLAG_ERRORE;
|
ok = invio.empty() || invio == FLAG_INVIO || invio == FLAG_FORZATO || invio == FLAG_ERRORE;
|
||||||
break;
|
break;
|
||||||
case sent:
|
case sent:
|
||||||
ok = invio == FLAG_INVIATO;
|
ok = invio == FLAG_INVIATO;
|
||||||
break;
|
break;
|
||||||
case untouched:
|
case untouched:
|
||||||
ok = invio == "" || invio == FLAG_INVIO;
|
ok = invio.empty() || invio == FLAG_INVIO;
|
||||||
case forced:
|
case forced:
|
||||||
ok = invio == FLAG_FORZATO;
|
ok = invio == FLAG_FORZATO;
|
||||||
break;
|
break;
|
||||||
@ -741,10 +775,10 @@ bool TTrFa_mask::checkInvio(const TString& invio)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TTrFa_mask::TTrFa_mask(TString msk)
|
TTrFa_mask::TTrFa_mask(const TString& msk)
|
||||||
: TAutomask(msk), _filter_changed(true)
|
: TAutomask(msk), _filter_changed(true)
|
||||||
{
|
{
|
||||||
loadConfig();
|
load_config();
|
||||||
#ifndef DBG
|
#ifndef DBG
|
||||||
|
|
||||||
// Controllo che abbia aggiornato le causali dopo l'ultima patch cg0500
|
// Controllo che abbia aggiornato le causali dopo l'ultima patch cg0500
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
TTrFa_cursors::~TTrFa_cursors()
|
TTrFa_cursors::~TTrFa_cursors()
|
||||||
{
|
{
|
||||||
if(c_rmoviva != NULL)
|
if(_c_rmoviva != NULL)
|
||||||
delete c_rmoviva;
|
delete _c_rmoviva;
|
||||||
if(c_trasfatt != NULL)
|
if(_c_trasfatt != NULL)
|
||||||
delete c_trasfatt;
|
delete _c_trasfatt;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TTrFa_cursors::next(TAssoc_array& recimposte, bool& ok, TString& tipocf, TString& codcf, TString& ocfpi)
|
int TTrFa_cursors::next(TAssoc_array& recimposte, bool& ok, TString& tipocf, TString& codcf, TString& ocfpi)
|
||||||
@ -23,7 +23,7 @@ int TTrFa_cursors::next(TAssoc_array& recimposte, bool& ok, TString& tipocf, TSt
|
|||||||
TRectype record = _next(err, tipocf, codcf, ocfpi);
|
TRectype record = _next(err, tipocf, codcf, ocfpi);
|
||||||
if(err == eof)
|
if(err == eof)
|
||||||
{
|
{
|
||||||
record = _nextCust(err, tipocf, codcf, ocfpi);
|
record = _next_cust(err, tipocf, codcf, ocfpi);
|
||||||
}
|
}
|
||||||
while(err < nextmov)
|
while(err < nextmov)
|
||||||
{
|
{
|
||||||
@ -55,172 +55,195 @@ int TTrFa_cursors::next(TAssoc_array& recimposte, bool& ok, TString& tipocf, TSt
|
|||||||
*/
|
*/
|
||||||
TRectype TTrFa_cursors::_next(return_code& code, TString& tipocf, TString& codcf, TString& ocfpi)
|
TRectype TTrFa_cursors::_next(return_code& code, TString& tipocf, TString& codcf, TString& ocfpi)
|
||||||
{
|
{
|
||||||
TString numMov = c_rmoviva->get("23.NUMREG").as_string();
|
const TString num_mov = _c_rmoviva->get("23.NUMREG").as_string();
|
||||||
|
|
||||||
// Record di ritorno
|
// Record di ritorno
|
||||||
TRectype retRec(LF_TRASFATT);
|
TRectype ret_rec(LF_TRASFATT);
|
||||||
|
|
||||||
// Variabile di appoggio per forzare il controllo sui movimenti nuovi,
|
// Variabile di appoggio per forzare il controllo sui movimenti nuovi,
|
||||||
// così facendo riesco a entrare nel ciclo sotto. Prima c'era un else
|
// così facendo riesco a entrare nel ciclo sotto. Prima c'era un else
|
||||||
bool newMov = _newMov;
|
const bool new_mov = _new_mov;
|
||||||
|
|
||||||
// Controllo che non sia il primo record del movimento
|
// Controllo che non sia il primo record del movimento
|
||||||
if(_newMov)
|
if(_new_mov)
|
||||||
{
|
{
|
||||||
_newMov = false;
|
_new_mov = false;
|
||||||
tipocf = c_rmoviva->get("23.TIPO").as_string();
|
tipocf = _c_rmoviva->get("23.TIPO").as_string();
|
||||||
codcf = c_rmoviva->get("23.CODCF").as_string();
|
codcf = _c_rmoviva->get("23.CODCF").as_string();
|
||||||
ocfpi = c_rmoviva->get("23.OCFPI").as_string();
|
ocfpi = _c_rmoviva->get("23.OCFPI").as_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se non è un movimento o il controllo fallisce mi sposto
|
// Se non è un movimento o il controllo fallisce mi sposto
|
||||||
int tipoDoc = getTipoDoc(c_rmoviva->get("23.TIPODOC").as_string());
|
const int tipo_doc = get_tipo_doc(_c_rmoviva->get("23.TIPODOC").as_string());
|
||||||
if(!newMov || !checkRecord(c_rmoviva, _has_fp) || tipoDoc == -1 || !msk().get_bool(tipoDoc))
|
if(!new_mov ||
|
||||||
|
!check_record(_c_rmoviva, _esterometro, _paf_ns, _paf_s, _paf_sf, _paf_e, _paa_ns, _paa_s, _paa_sf, _paa_e) ||
|
||||||
|
tipo_doc == -1 || !msk().get_bool(tipo_doc))
|
||||||
{
|
{
|
||||||
static TString codiva;
|
static TString codiva;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// Se ritorna false ho finito i records
|
// Se ritorna false ho finito i records
|
||||||
if(!c_rmoviva->move_next())
|
if(!_c_rmoviva->move_next())
|
||||||
{
|
{
|
||||||
code = eof;
|
code = eof;
|
||||||
return retRec;
|
return ret_rec;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Controllo se ho cambiato movimento
|
// Controllo se ho cambiato movimento
|
||||||
_newMov = numMov != c_rmoviva->get("23.NUMREG").as_string();
|
_new_mov = num_mov != _c_rmoviva->get("23.NUMREG").as_string();
|
||||||
codiva.cut(0) << c_rmoviva->get("25.CODIVA").as_string();
|
codiva.cut(0) << _c_rmoviva->get("25.CODIVA").as_string();
|
||||||
}
|
}
|
||||||
} // Ciclo finchè non trovo un nuovo movimento o trovo cod IVA già presi da cust
|
} // Ciclo finchè non trovo un nuovo movimento o trovo cod IVA già presi da cust
|
||||||
while((!_newMov && _alqCust.get_pos(codiva) > -1) || !checkEnabled(c_rmoviva) || !checkRecord(c_rmoviva, _has_fp));
|
while((!_new_mov && _alq_cust.get_pos(codiva) > -1) || !check_enabled(_c_rmoviva) ||
|
||||||
|
!check_record(_c_rmoviva, _esterometro, _paf_ns, _paf_s, _paf_sf, _paf_e, _paa_ns, _paa_s, _paa_sf, _paa_e));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se ho cambiato movimento ritorno, leggerò poi al prossimo giro
|
// Se ho cambiato movimento ritorno, leggerò poi al prossimo giro
|
||||||
if(_newMov)
|
if(_new_mov)
|
||||||
{
|
{
|
||||||
_alqCust.cut(0);
|
_alq_cust.cut(0);
|
||||||
code = nextmov;
|
code = nextmov;
|
||||||
return retRec;
|
return ret_rec;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
code = found;
|
code = found;
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if(c_rmoviva->get("23.NUMREG").as_int() == 1930131)
|
if(_c_rmoviva->get("23.NUMREG").as_int() == 1930131)
|
||||||
bool tolla = true;
|
bool tolla = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Controllo dell'esistenza di un record custom in tasfatt
|
// Controllo dell'esistenza di un record custom in tasfatt
|
||||||
retRec = getTrasFatt(c_rmoviva->get("23.NUMREG").as_string(), c_rmoviva->get("25.CODIVA").as_string());
|
ret_rec = getTrasFatt(_c_rmoviva->get("23.NUMREG").as_string(), _c_rmoviva->get("25.CODIVA").as_string());
|
||||||
if(retRec.empty())
|
if(ret_rec.empty())
|
||||||
{
|
{
|
||||||
code = found;
|
code = found;
|
||||||
// Carico il record
|
// Carico il record
|
||||||
retRec.put("NUMREG", c_rmoviva->get("23.NUMREG").as_int());
|
ret_rec.put("NUMREG", _c_rmoviva->get("23.NUMREG").as_int());
|
||||||
retRec.put("TIPO", c_rmoviva->get("23.TIPO").as_string());
|
ret_rec.put("TIPO", _c_rmoviva->get("23.TIPO").as_string());
|
||||||
retRec.put("CODCF", c_rmoviva->get("23.CODCF").as_string());
|
ret_rec.put("CODCF", _c_rmoviva->get("23.CODCF").as_string());
|
||||||
retRec.put("OCCAS", c_rmoviva->get("23.OCFPI").as_string());
|
ret_rec.put("OCCAS", _c_rmoviva->get("23.OCFPI").as_string());
|
||||||
retRec.put("TIPODOC", c_rmoviva->get("23.TIPODOC").as_string());
|
ret_rec.put("TIPODOC", _c_rmoviva->get("23.TIPODOC").as_string());
|
||||||
retRec.put("NUMDOC", c_rmoviva->get("23.NUMDOC").as_string());
|
ret_rec.put("NUMDOC", _c_rmoviva->get("23.NUMDOC").as_string());
|
||||||
retRec.put("DATAREG", c_rmoviva->get("23.DATAREG").as_date());
|
ret_rec.put("DATAREG", _c_rmoviva->get("23.DATAREG").as_date());
|
||||||
retRec.put("DATADOC", c_rmoviva->get("23.DATADOC").as_date());
|
ret_rec.put("DATADOC", _c_rmoviva->get("23.DATADOC").as_date());
|
||||||
retRec.put("TFINVIO", c_rmoviva->get("23.TFINVIO").as_string());
|
ret_rec.put("TFINVIO", _c_rmoviva->get("23.TFINVIO").as_string());
|
||||||
retRec.put("IMPONIBILE", c_rmoviva->get("25.IMPONIBILE").as_real());
|
ret_rec.put("IMPONIBILE", _c_rmoviva->get("25.IMPONIBILE").as_real());
|
||||||
retRec.put("IMPOSTA", c_rmoviva->get("25.IMPOSTA").as_real());
|
ret_rec.put("IMPOSTA", _c_rmoviva->get("25.IMPOSTA").as_real());
|
||||||
retRec.put("CODIVA", c_rmoviva->get("25.CODIVA").as_string());
|
ret_rec.put("CODIVA", _c_rmoviva->get("25.CODIVA").as_string());
|
||||||
retRec.put("TIPODET", c_rmoviva->get("25.TIPODET").as_string());
|
ret_rec.put("TIPODET", _c_rmoviva->get("25.TIPODET").as_string());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_alqCust.add(c_rmoviva->get("25.CODIVA").as_string());
|
_alq_cust.add(_c_rmoviva->get("25.CODIVA").as_string());
|
||||||
code = foundcust;
|
code = foundcust;
|
||||||
}
|
}
|
||||||
return retRec;
|
return ret_rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRectype TTrFa_cursors::_nextCust(return_code& code, TString& tipocf, TString& codcf, TString& ocfpi)
|
TRectype TTrFa_cursors::_next_cust(return_code& code, TString& tipocf, TString& codcf, TString& ocfpi)
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
// Preparo il nuovo cursore
|
// Preparo il nuovo cursore
|
||||||
if(_newCust)
|
if(_new_cust)
|
||||||
{
|
{
|
||||||
ok = c_trasfatt->move_first();
|
ok = _c_trasfatt->move_first();
|
||||||
_newCust = false;
|
_new_cust = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ok = c_trasfatt->move_next();
|
ok = _c_trasfatt->move_next();
|
||||||
}
|
}
|
||||||
tipocf = c_trasfatt->get("TIPO").as_string();
|
tipocf = _c_trasfatt->get("TIPO").as_string();
|
||||||
codcf = c_trasfatt->get("CODCF").as_string();
|
codcf = _c_trasfatt->get("CODCF").as_string();
|
||||||
ocfpi = c_trasfatt->get("OCFPI").as_string();
|
ocfpi = _c_trasfatt->get("OCFPI").as_string();
|
||||||
code = ok ? foundidcust : eofcust;
|
code = ok ? foundidcust : eofcust;
|
||||||
return c_trasfatt->cursor()->curr();
|
return _c_trasfatt->cursor()->curr();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrFa_cursors::checkEnabled(TISAM_recordset* origCur)
|
bool TTrFa_cursors::check_enabled(TISAM_recordset* orig_cur)
|
||||||
{
|
{
|
||||||
// Controllo che il record sia effettivamente abilitato
|
// Controllo che il record sia effettivamente abilitato
|
||||||
static TString flag; flag.cut(0);
|
static TString flag; flag.cut(0);
|
||||||
// Controllo se sono su un movimento custom
|
// Controllo se sono su un movimento custom
|
||||||
if(origCur->find_column("MOV.REG") >= 0)
|
if(orig_cur->find_column("MOV.REG") >= 0)
|
||||||
{
|
{
|
||||||
TRectype rCust = getTrasFatt(c_rmoviva->get("23.NUMREG").as_string(), c_rmoviva->get("25.CODIVA").as_string());
|
TRectype r_cust = getTrasFatt(_c_rmoviva->get("23.NUMREG").as_string(), _c_rmoviva->get("25.CODIVA").as_string());
|
||||||
if(rCust.empty())
|
if(r_cust.empty())
|
||||||
flag << origCur->get("23.TFINVIO");
|
flag << orig_cur->get("23.TFINVIO");
|
||||||
else
|
else
|
||||||
flag << rCust.get("TFINVIO");
|
flag << r_cust.get("TFINVIO");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flag << origCur->get("TFINVIO").as_string();
|
flag << orig_cur->get("TFINVIO").as_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
return msk().checkInvio(flag);
|
return msk().check_invio(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TTrFa_cursors::reset_esterometro()
|
||||||
|
{
|
||||||
|
_esterometro = msk().get_bool(B_ESTEROMETRO);
|
||||||
|
_paf_ns = msk().get_bool(B_PAF_NOT_SENT);
|
||||||
|
_paf_s = msk().get_bool(B_PAF_SENT);
|
||||||
|
_paf_sf = msk().get_bool(B_PAF_SOG_FAT);
|
||||||
|
_paf_e = msk().get_bool(B_PAF_ESTERI);
|
||||||
|
_paa_ns = msk().get_bool(B_PAA_NOT_SENT);
|
||||||
|
_paa_s = msk().get_bool(B_PAA_SENT);
|
||||||
|
_paa_sf = msk().get_bool(B_PAA_ESTERI);
|
||||||
|
_paa_e = msk().get_bool(B_PAA_SOG_FAT);
|
||||||
|
}
|
||||||
|
|
||||||
int TTrFa_cursors::updateFilters(const char tipocf, const long codcf, TDate dal, TDate al, int cod)
|
TTrFa_cursors::TTrFa_cursors(): _c_rmoviva(nullptr), _c_trasfatt(nullptr), _new_mov(false), _new_cust(false),
|
||||||
|
_esterometro(false), _paf_ns(false), _paf_s(false), _paf_sf(false), _paf_e(false),
|
||||||
|
_paa_ns(false), _paa_s(false), _paa_sf(false), _paa_e(false) {}
|
||||||
|
|
||||||
|
|
||||||
|
int TTrFa_cursors::update_filters(const char tipocf, const long codcf, TDate dal, TDate al, int cod)
|
||||||
{
|
{
|
||||||
// Svuoto la cache per aggiornare i file custom
|
// Svuoto la cache per aggiornare i file custom
|
||||||
cache().discard(LF_TRASFATT);
|
cache().discard(LF_TRASFATT);
|
||||||
|
|
||||||
TString query = "USE RMOVIVA\n", queryCust = "USE TRASFATT\n";
|
// Resetto i filtri booleani
|
||||||
query << "SELECT (23.REG!=\"\")&&BETWEEN(23.DATAREG,#DADATAREG,#ADATAREG)&&(23.TIPO=\"" << tipocf << "\")";
|
reset_esterometro();
|
||||||
queryCust << "SELECT BETWEEN(DATAREG,#DADATAREG,#ADATAREG)&&(TIPO=\"" << tipocf << "\")";
|
|
||||||
|
TString query = "USE RMOVIVA\n", query_cust = "USE TRASFATT\n";
|
||||||
|
query << R"(SELECT (23.REG!="")&&BETWEEN(23.DATAREG,#DADATAREG,#ADATAREG)&&(23.TIPO=")" << tipocf << "\")";
|
||||||
|
query_cust << "SELECT BETWEEN(DATAREG,#DADATAREG,#ADATAREG)&&(TIPO=\"" << tipocf << "\")";
|
||||||
|
|
||||||
if(codcf > 0)
|
if(codcf > 0)
|
||||||
{
|
{
|
||||||
query << "&&STR((23.CODCF=#CODCF))";
|
query << "&&STR((23.CODCF=#CODCF))";
|
||||||
queryCust << "&&STR((CODCF=#CODCF))";
|
query_cust << "&&STR((CODCF=#CODCF))";
|
||||||
}
|
}
|
||||||
|
|
||||||
query << "\nJOIN MOV INTO NUMREG==NUMREG\n";
|
query << "\nJOIN MOV INTO NUMREG==NUMREG\n";
|
||||||
queryCust << "\nFROM NUMREG=" << MOV_CUSTOM;
|
query_cust << "\nFROM NUMREG=" << MOV_CUSTOM;
|
||||||
|
|
||||||
c_rmoviva = new TISAM_recordset(query);
|
_c_rmoviva = new TISAM_recordset(query);
|
||||||
c_trasfatt= new TISAM_recordset(queryCust);
|
_c_trasfatt= new TISAM_recordset(query_cust);
|
||||||
|
|
||||||
if(dal.empty()) dal = "20170101"; // Data in cui questo modulo è diventato valido
|
if(dal.empty()) dal = "20170101"; // Data in cui questo modulo è diventato valido
|
||||||
if(al.empty()) al = TODAY;
|
if(al.empty()) al = TODAY;
|
||||||
|
|
||||||
c_rmoviva->set_var("#DADATAREG", dal);
|
_c_rmoviva->set_var("#DADATAREG", dal);
|
||||||
c_rmoviva->set_var("#ADATAREG", al);
|
_c_rmoviva->set_var("#ADATAREG", al);
|
||||||
c_trasfatt->set_var("#DADATAREG", dal);
|
_c_trasfatt->set_var("#DADATAREG", dal);
|
||||||
c_trasfatt->set_var("#ADATAREG", al);
|
_c_trasfatt->set_var("#ADATAREG", al);
|
||||||
|
|
||||||
if(codcf > 0)
|
if(codcf > 0)
|
||||||
{
|
{
|
||||||
c_rmoviva->set_var("#CODCF", codcf);
|
_c_rmoviva->set_var("#CODCF", codcf);
|
||||||
c_trasfatt->set_var("#CODCF", codcf);
|
_c_trasfatt->set_var("#CODCF", codcf);
|
||||||
}
|
}
|
||||||
|
|
||||||
int items = c_rmoviva->items() + c_trasfatt->items();
|
const int items = _c_rmoviva->items() + _c_trasfatt->items();
|
||||||
if(items > 0)
|
if(items > 0)
|
||||||
{
|
{
|
||||||
_newMov = true;
|
_new_mov = true;
|
||||||
_newCust = true;
|
_new_cust = true;
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#include "tf0200a.h"
|
#include "tf0200a.h"
|
||||||
|
|
||||||
#define CAMPI_CON_BOOLEAN F_TOTOPATT
|
#define CAMPI_CON_BOOLEAN F_TOTOPATT
|
||||||
#define REG_ATT 1
|
|
||||||
#define REG_PAS 2
|
|
||||||
|
|
||||||
// ComLiqPerIva: Comunicazione Liquidazioni Periodiche IVA
|
// ComLiqPerIva: Comunicazione Liquidazioni Periodiche IVA
|
||||||
|
|
||||||
@ -470,14 +468,14 @@ void ComLiqPerIva_mask::extractinator() // Per gli amici GTFO
|
|||||||
// Se è un movimento IvaXCassa o LiqDiff
|
// Se è un movimento IvaXCassa o LiqDiff
|
||||||
if(hasIXC && (curIva.get("23.IVAXCASSA").as_bool() || curIva.get("23.LIQDIFF").as_bool()))
|
if(hasIXC && (curIva.get("23.IVAXCASSA").as_bool() || curIva.get("23.LIQDIFF").as_bool()))
|
||||||
{
|
{
|
||||||
if(tiporeg == REG_ATT)
|
if(tiporeg == iva_vendite)
|
||||||
totopattxc += imp;
|
totopattxc += imp;
|
||||||
else
|
else
|
||||||
totoppasxc += imp;
|
totoppasxc += imp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(tiporeg == REG_ATT)
|
if(tiporeg == iva_vendite)
|
||||||
{
|
{
|
||||||
// Controllo il reverse charge, non va calcolato nel totale delle operazioni attive!
|
// Controllo il reverse charge, non va calcolato nel totale delle operazioni attive!
|
||||||
// Se non ha una riga di movimento non lo sommo
|
// Se non ha una riga di movimento non lo sommo
|
||||||
@ -510,7 +508,7 @@ void ComLiqPerIva_mask::extractinator() // Per gli amici GTFO
|
|||||||
real imposta_diff, imposta_xcas;
|
real imposta_diff, imposta_xcas;
|
||||||
imposta_diff = imposta_xcas = ZERO;
|
imposta_diff = imposta_xcas = ZERO;
|
||||||
// 1 = Vendite
|
// 1 = Vendite
|
||||||
calc_inc_diff(anno, start, REG_ATT, imposta_diff, imposta_xcas);
|
calc_inc_diff(anno, start, iva_vendite, imposta_diff, imposta_xcas);
|
||||||
ivaesxc = ivaesxc + imposta_xcas;
|
ivaesxc = ivaesxc + imposta_xcas;
|
||||||
ivaesdiff = ivaesdiff + imposta_diff;
|
ivaesdiff = ivaesdiff + imposta_diff;
|
||||||
|
|
||||||
@ -519,7 +517,7 @@ void ComLiqPerIva_mask::extractinator() // Per gli amici GTFO
|
|||||||
TString pippo = ivadetxc.stringa();
|
TString pippo = ivadetxc.stringa();
|
||||||
TString pluto = imposta_xcas.stringa();
|
TString pluto = imposta_xcas.stringa();
|
||||||
// 2 = Acquisti
|
// 2 = Acquisti
|
||||||
calc_inc_diff(anno, start, REG_PAS, imposta_diff, imposta_xcas);
|
calc_inc_diff(anno, start, iva_acquisti, imposta_diff, imposta_xcas);
|
||||||
pippo = ivadetxc.stringa();
|
pippo = ivadetxc.stringa();
|
||||||
pluto = imposta_xcas.stringa();
|
pluto = imposta_xcas.stringa();
|
||||||
ivadetxc = ivadetxc + imposta_xcas;
|
ivadetxc = ivadetxc + imposta_xcas;
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
#include "modaut.h"
|
#include "modaut.h"
|
||||||
|
|
||||||
/****************************************************************************************************
|
/****************************************************************************************************
|
||||||
* TSpeCheck_msk
|
* TSpe_check_msk
|
||||||
****************************************************************************************************/
|
****************************************************************************************************/
|
||||||
|
|
||||||
class TSpeCheck_msk : public TAutomask
|
class TSpe_check_msk : public TAutomask
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
TAnagrafica _ditta;
|
TAnagrafica _ditta;
|
||||||
@ -21,24 +21,24 @@ private:
|
|||||||
bool _has_fp;
|
bool _has_fp;
|
||||||
|
|
||||||
void refresh();
|
void refresh();
|
||||||
void fillNoFilter();
|
void fill_no_filter();
|
||||||
void fillDiff();
|
void fill_diff();
|
||||||
void foundHomeland(TToken_string& row, TString numreg, TString codiva, TRectype& clifo);
|
void find_homeland(TToken_string& row, TString numreg, TString codiva, TRectype& clifo);
|
||||||
void fillCust();
|
void fill_cust();
|
||||||
void getFilFlag(TString& query);
|
void get_fil_flag(TString& query);
|
||||||
void enableEdit(bool en);
|
void enable_edit(bool en);
|
||||||
void selectAll();
|
void select_all();
|
||||||
void saveAll();
|
void save_all();
|
||||||
void deleteAll();
|
void delete_all();
|
||||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_has_fp(bool has_fp) { _has_fp = has_fp; }
|
void set_has_fp(const bool has_fp) { _has_fp = has_fp; }
|
||||||
TSpeCheck_msk();
|
TSpe_check_msk();
|
||||||
virtual ~TSpeCheck_msk() {};
|
virtual ~TSpe_check_msk() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TSpeCheck_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
bool TSpe_check_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||||
{
|
{
|
||||||
switch(o.dlg())
|
switch(o.dlg())
|
||||||
{
|
{
|
||||||
@ -52,13 +52,13 @@ bool TSpeCheck_msk::on_field_event(TOperable_field& o, TField_event e, long joll
|
|||||||
break;
|
break;
|
||||||
case DLG_ALL:
|
case DLG_ALL:
|
||||||
if(e != fe_button) break;
|
if(e != fe_button) break;
|
||||||
selectAll();
|
select_all();
|
||||||
break;
|
break;
|
||||||
case DLG_SAVEREC:
|
case DLG_SAVEREC:
|
||||||
saveAll();
|
save_all();
|
||||||
break;
|
break;
|
||||||
case DLG_DELREC:
|
case DLG_DELREC:
|
||||||
deleteAll();
|
delete_all();
|
||||||
break;
|
break;
|
||||||
case DLG_EDIT:
|
case DLG_EDIT:
|
||||||
if(e == fe_button)
|
if(e == fe_button)
|
||||||
@ -87,7 +87,7 @@ bool TSpeCheck_msk::on_field_event(TOperable_field& o, TField_event e, long joll
|
|||||||
TRectype app = getCli(tipocf, codcf, ocfpi);
|
TRectype app = getCli(tipocf, codcf, ocfpi);
|
||||||
o.mask().set(A_RAGSOC, app.get("RAGSOC"));
|
o.mask().set(A_RAGSOC, app.get("RAGSOC"));
|
||||||
o.mask().set(A_RFSO, app.get("CODRFSO"));
|
o.mask().set(A_RFSO, app.get("CODRFSO"));
|
||||||
o.mask().set(A_RAGSOCRFSO, getRFSO(app.get("CODRFSO")));
|
o.mask().set(A_RAGSOCRFSO, get_rfso(app.get("CODRFSO")));
|
||||||
o.mask().set(A_PAIV, app.get("PAIV"));
|
o.mask().set(A_PAIV, app.get("PAIV"));
|
||||||
o.mask().set(A_COFI, app.get("COFI"));
|
o.mask().set(A_COFI, app.get("COFI"));
|
||||||
|
|
||||||
@ -111,32 +111,32 @@ bool TSpeCheck_msk::on_field_event(TOperable_field& o, TField_event e, long joll
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpeCheck_msk::refresh()
|
void TSpe_check_msk::refresh()
|
||||||
{
|
{
|
||||||
switch(get_long(F_TIPOCONTROLLO))
|
switch(get_long(F_TIPOCONTROLLO))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
fillNoFilter();
|
fill_no_filter();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
fillDiff();
|
fill_diff();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
fillCust();
|
fill_cust();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpeCheck_msk::fillNoFilter()
|
void TSpe_check_msk::fill_no_filter()
|
||||||
{
|
{
|
||||||
TString query = "USE RMOVIVA\n";
|
TString query = "USE RMOVIVA\n";
|
||||||
query << "SELECT (23.REG!=\"\")&&BETWEEN(23.DATAREG,#DADATAREG,#ADATAREG)&&(23.TIPO=\"" << get(F_TIPOCF) << "\")";
|
query << R"(SELECT (23.REG!="")&&BETWEEN(23.DATAREG,#DADATAREG,#ADATAREG)&&(23.TIPO=")" << get(F_TIPOCF) << "\")";
|
||||||
if(get(F_CODCF) != "")
|
if(get(F_CODCF).full())
|
||||||
query << "&&STR((23.CODCF=#CODCF))";
|
query << "&&STR((23.CODCF=#CODCF))";
|
||||||
|
|
||||||
getFilFlag(query);
|
get_fil_flag(query);
|
||||||
|
|
||||||
query << "\nJOIN MOV INTO NUMREG==NUMREG\n";
|
query << "\nJOIN MOV INTO NUMREG==NUMREG\n";
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ void TSpeCheck_msk::fillNoFilter()
|
|||||||
// Setto le variabili
|
// Setto le variabili
|
||||||
rset.set_var("#DADATAREG", dadatareg);
|
rset.set_var("#DADATAREG", dadatareg);
|
||||||
rset.set_var("#ADATAREG", adatareg);
|
rset.set_var("#ADATAREG", adatareg);
|
||||||
if(get(F_CODCF) != "")
|
if(get(F_CODCF).full())
|
||||||
rset.set_var("#CODCF", get(F_CODCF));
|
rset.set_var("#CODCF", get(F_CODCF));
|
||||||
|
|
||||||
int nrec = rset.items();
|
int nrec = rset.items();
|
||||||
@ -176,7 +176,7 @@ void TSpeCheck_msk::fillNoFilter()
|
|||||||
for(bool ok = rset.move_first(); ok; ok = rset.move_next())
|
for(bool ok = rset.move_first(); ok; ok = rset.move_next())
|
||||||
{
|
{
|
||||||
// Devo prendere tutti quelli che non vanno bene di records
|
// Devo prendere tutti quelli che non vanno bene di records
|
||||||
if(checkRecord(&rset, _has_fp)) continue;
|
if(check_record(&rset, _has_fp)) continue;
|
||||||
|
|
||||||
TRectype clifo = getCli(rset.get("23.TIPO").as_string(), rset.get("23.CODCF").as_string(), rset.get("23.OCCAS").as_string());
|
TRectype clifo = getCli(rset.get("23.TIPO").as_string(), rset.get("23.CODCF").as_string(), rset.get("23.OCCAS").as_string());
|
||||||
TToken_string& row = s.row(-1);
|
TToken_string& row = s.row(-1);
|
||||||
@ -191,7 +191,7 @@ void TSpeCheck_msk::fillNoFilter()
|
|||||||
// NATURA
|
// NATURA
|
||||||
row.add(natura(rset.get("25.CODIVA").as_string()), s.cid2index(A_NATURA));
|
row.add(natura(rset.get("25.CODIVA").as_string()), s.cid2index(A_NATURA));
|
||||||
// DETR
|
// DETR
|
||||||
row.add(findDetraib(rset.get("25.TIPODET").as_string()), s.cid2index(A_DETRAIB));
|
row.add(find_detraib(rset.get("25.TIPODET").as_string()), s.cid2index(A_DETRAIB));
|
||||||
|
|
||||||
row.add(rset.get("23.TIPO").as_string(), s.cid2index(A_TIPOCF));
|
row.add(rset.get("23.TIPO").as_string(), s.cid2index(A_TIPOCF));
|
||||||
row.add(rset.get("23.CODCF").as_string(), s.cid2index(A_CODCF));
|
row.add(rset.get("23.CODCF").as_string(), s.cid2index(A_CODCF));
|
||||||
@ -201,9 +201,9 @@ void TSpeCheck_msk::fillNoFilter()
|
|||||||
// RFSO
|
// RFSO
|
||||||
row.add(clifo.get("CODRFSO"), s.cid2index(A_RFSO));
|
row.add(clifo.get("CODRFSO"), s.cid2index(A_RFSO));
|
||||||
// RSOC RFSO
|
// RSOC RFSO
|
||||||
row.add(getRFSO(clifo.get("CODRFSO")), s.cid2index(A_RAGSOCRFSO));
|
row.add(get_rfso(clifo.get("CODRFSO")), s.cid2index(A_RAGSOCRFSO));
|
||||||
// RC
|
// RC
|
||||||
row.add((revCharge(rset.get("NUMREG").as_string(), rset.get("23.DATAREG").as_date().year())), s.cid2index(A_REVERSE));
|
row.add((rev_charge(rset.get("NUMREG").as_string(), rset.get("23.DATAREG").as_date().year())), s.cid2index(A_REVERSE));
|
||||||
// AUTOFATT
|
// AUTOFATT
|
||||||
if(_ditta.partita_IVA() == clifo.get("PAIV"))
|
if(_ditta.partita_IVA() == clifo.get("PAIV"))
|
||||||
{
|
{
|
||||||
@ -222,10 +222,10 @@ void TSpeCheck_msk::fillNoFilter()
|
|||||||
}
|
}
|
||||||
s.force_update();
|
s.force_update();
|
||||||
s.show();
|
s.show();
|
||||||
enableEdit(false);
|
enable_edit(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpeCheck_msk::fillDiff()
|
void TSpe_check_msk::fill_diff()
|
||||||
{
|
{
|
||||||
// Apro la tabella TRASFATT e per ogni record lo ricostruisco l'originale
|
// Apro la tabella TRASFATT e per ogni record lo ricostruisco l'originale
|
||||||
TString query = "USE TRASFATT\n";
|
TString query = "USE TRASFATT\n";
|
||||||
@ -233,7 +233,7 @@ void TSpeCheck_msk::fillDiff()
|
|||||||
if(get(F_CODCF) != "")
|
if(get(F_CODCF) != "")
|
||||||
query << "&&STR((CODCF=#CODCF))";
|
query << "&&STR((CODCF=#CODCF))";
|
||||||
|
|
||||||
getFilFlag(query);
|
get_fil_flag(query);
|
||||||
|
|
||||||
TISAM_recordset rset(query);
|
TISAM_recordset rset(query);
|
||||||
TDate dadatareg = get_date(F_DATAINI);
|
TDate dadatareg = get_date(F_DATAINI);
|
||||||
@ -274,7 +274,7 @@ void TSpeCheck_msk::fillDiff()
|
|||||||
|
|
||||||
// Creo la riga della prima nota
|
// Creo la riga della prima nota
|
||||||
TToken_string& orig = s.row(-1);
|
TToken_string& orig = s.row(-1);
|
||||||
foundHomeland(orig, rset.get("NUMREG").as_string(), rset.get("CODIVA").as_string(), clifo);
|
find_homeland(orig, rset.get("NUMREG").as_string(), rset.get("CODIVA").as_string(), clifo);
|
||||||
|
|
||||||
TToken_string& row = s.row(-1);
|
TToken_string& row = s.row(-1);
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ void TSpeCheck_msk::fillDiff()
|
|||||||
nat.cut(0) << rset.get("NATURA").as_string();
|
nat.cut(0) << rset.get("NATURA").as_string();
|
||||||
row.add(nat.full() ? nat : natura(rset.get("CODIVA").as_string()), s.cid2index(A_NATURA));
|
row.add(nat.full() ? nat : natura(rset.get("CODIVA").as_string()), s.cid2index(A_NATURA));
|
||||||
// DETR
|
// DETR
|
||||||
row.add(findDetraib(rset.get("TIPODET").as_string()), s.cid2index(A_DETRAIB));
|
row.add(find_detraib(rset.get("TIPODET").as_string()), s.cid2index(A_DETRAIB));
|
||||||
|
|
||||||
row.add(rset.get("TIPO").as_string(), s.cid2index(A_TIPOCF));
|
row.add(rset.get("TIPO").as_string(), s.cid2index(A_TIPOCF));
|
||||||
row.add(rset.get("CODCF").as_string(), s.cid2index(A_CODCF));
|
row.add(rset.get("CODCF").as_string(), s.cid2index(A_CODCF));
|
||||||
@ -300,9 +300,9 @@ void TSpeCheck_msk::fillDiff()
|
|||||||
// RFSO
|
// RFSO
|
||||||
row.add(clifo.get("CODRFSO"), s.cid2index(A_RFSO));
|
row.add(clifo.get("CODRFSO"), s.cid2index(A_RFSO));
|
||||||
// RSOC RFSO
|
// RSOC RFSO
|
||||||
row.add(getRFSO(clifo.get("CODRFSO")), s.cid2index(A_RAGSOCRFSO));
|
row.add(get_rfso(clifo.get("CODRFSO")), s.cid2index(A_RAGSOCRFSO));
|
||||||
// RC
|
// RC
|
||||||
row.add((revCharge(rset.get("NUMREG").as_string(), rset.get("DATAREG").as_date().year())), s.cid2index(A_REVERSE));
|
row.add((rev_charge(rset.get("NUMREG").as_string(), rset.get("DATAREG").as_date().year())), s.cid2index(A_REVERSE));
|
||||||
// AUTOFATT
|
// AUTOFATT
|
||||||
if(rset.get("AUTOFATT").as_string() == "X" || _ditta.partita_IVA() == clifo.get("PAIV"))
|
if(rset.get("AUTOFATT").as_string() == "X" || _ditta.partita_IVA() == clifo.get("PAIV"))
|
||||||
{
|
{
|
||||||
@ -328,10 +328,10 @@ void TSpeCheck_msk::fillDiff()
|
|||||||
|
|
||||||
s.force_update();
|
s.force_update();
|
||||||
s.show();
|
s.show();
|
||||||
enableEdit(true);
|
enable_edit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpeCheck_msk::foundHomeland(TToken_string& row, TString numreg, TString codiva, TRectype& clifo)
|
void TSpe_check_msk::find_homeland(TToken_string& row, TString numreg, TString codiva, TRectype& clifo)
|
||||||
{
|
{
|
||||||
TSheet_field& s = sfield(F_RIGHE);
|
TSheet_field& s = sfield(F_RIGHE);
|
||||||
static TLocalisamfile mov(LF_MOV), rmov(LF_RMOVIVA);
|
static TLocalisamfile mov(LF_MOV), rmov(LF_RMOVIVA);
|
||||||
@ -372,7 +372,7 @@ void TSpeCheck_msk::foundHomeland(TToken_string& row, TString numreg, TString co
|
|||||||
// NATURA
|
// NATURA
|
||||||
row.add(natura(recRmov.get("CODIVA")), s.cid2index(A_NATURA));
|
row.add(natura(recRmov.get("CODIVA")), s.cid2index(A_NATURA));
|
||||||
// DETR
|
// DETR
|
||||||
row.add(findDetraib(recRmov.get("TIPODET")), s.cid2index(A_DETRAIB));
|
row.add(find_detraib(recRmov.get("TIPODET")), s.cid2index(A_DETRAIB));
|
||||||
|
|
||||||
row.add(recMov.get("TIPO"), s.cid2index(A_TIPOCF));
|
row.add(recMov.get("TIPO"), s.cid2index(A_TIPOCF));
|
||||||
row.add(recMov.get("CODCF"), s.cid2index(A_CODCF));
|
row.add(recMov.get("CODCF"), s.cid2index(A_CODCF));
|
||||||
@ -382,9 +382,9 @@ void TSpeCheck_msk::foundHomeland(TToken_string& row, TString numreg, TString co
|
|||||||
// RFSO
|
// RFSO
|
||||||
row.add(clifo.get("CODRFSO"), s.cid2index(A_RFSO));
|
row.add(clifo.get("CODRFSO"), s.cid2index(A_RFSO));
|
||||||
// RSOC RFSO
|
// RSOC RFSO
|
||||||
row.add(getRFSO(clifo.get("CODRFSO")), s.cid2index(A_RAGSOCRFSO));
|
row.add(get_rfso(clifo.get("CODRFSO")), s.cid2index(A_RAGSOCRFSO));
|
||||||
// RC
|
// RC
|
||||||
row.add((revCharge(recMov.get("NUMREG"), recMov.get_date("DATAREG").year())), s.cid2index(A_REVERSE));
|
row.add((rev_charge(recMov.get("NUMREG"), recMov.get_date("DATAREG").year())), s.cid2index(A_REVERSE));
|
||||||
// AUTOFATT
|
// AUTOFATT
|
||||||
if(_ditta.partita_IVA() == clifo.get("PAIV"))
|
if(_ditta.partita_IVA() == clifo.get("PAIV"))
|
||||||
{
|
{
|
||||||
@ -403,14 +403,14 @@ void TSpeCheck_msk::foundHomeland(TToken_string& row, TString numreg, TString co
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TSpeCheck_msk::fillCust()
|
void TSpe_check_msk::fill_cust()
|
||||||
{
|
{
|
||||||
TString query = "USE TRASFATT\n";
|
TString query = "USE TRASFATT\n";
|
||||||
query << "SELECT BETWEEN(DATAREG,#DADATAREG,#ADATAREG)&&(TIPO=\"" << get(F_TIPOCF) << "\")";
|
query << "SELECT BETWEEN(DATAREG,#DADATAREG,#ADATAREG)&&(TIPO=\"" << get(F_TIPOCF) << "\")";
|
||||||
if(get(F_CODCF) != "")
|
if(get(F_CODCF) != "")
|
||||||
query << "&&STR((CODCF=#CODCF))";
|
query << "&&STR((CODCF=#CODCF))";
|
||||||
|
|
||||||
getFilFlag(query);
|
get_fil_flag(query);
|
||||||
|
|
||||||
TISAM_recordset rset(query);
|
TISAM_recordset rset(query);
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ void TSpeCheck_msk::fillCust()
|
|||||||
nat.cut(0) << rset.get("NATURA").as_string();
|
nat.cut(0) << rset.get("NATURA").as_string();
|
||||||
row.add(nat.full() ? nat : natura(rset.get("CODIVA").as_string()), s.cid2index(A_NATURA));
|
row.add(nat.full() ? nat : natura(rset.get("CODIVA").as_string()), s.cid2index(A_NATURA));
|
||||||
// DETR
|
// DETR
|
||||||
row.add(findDetraib(rset.get("TIPODET").as_string()), s.cid2index(A_DETRAIB));
|
row.add(find_detraib(rset.get("TIPODET").as_string()), s.cid2index(A_DETRAIB));
|
||||||
|
|
||||||
row.add(rset.get("TIPO").as_string(), s.cid2index(A_TIPOCF));
|
row.add(rset.get("TIPO").as_string(), s.cid2index(A_TIPOCF));
|
||||||
row.add(rset.get("CODCF").as_string(), s.cid2index(A_CODCF));
|
row.add(rset.get("CODCF").as_string(), s.cid2index(A_CODCF));
|
||||||
@ -472,9 +472,9 @@ void TSpeCheck_msk::fillCust()
|
|||||||
// RFSO
|
// RFSO
|
||||||
row.add(clifo.get("CODRFSO"), s.cid2index(A_RFSO));
|
row.add(clifo.get("CODRFSO"), s.cid2index(A_RFSO));
|
||||||
// RSOC RFSO
|
// RSOC RFSO
|
||||||
row.add(getRFSO(clifo.get("CODRFSO")), s.cid2index(A_RAGSOCRFSO));
|
row.add(get_rfso(clifo.get("CODRFSO")), s.cid2index(A_RAGSOCRFSO));
|
||||||
// RC
|
// RC
|
||||||
row.add((revCharge(rset.get("NUMREG").as_string(), rset.get("DATAREG").as_date().year())), s.cid2index(A_REVERSE));
|
row.add((rev_charge(rset.get("NUMREG").as_string(), rset.get("DATAREG").as_date().year())), s.cid2index(A_REVERSE));
|
||||||
// AUTOFATT
|
// AUTOFATT
|
||||||
if(rset.get("AUTOFATT").as_string() == "X" || _ditta.partita_IVA() == clifo.get("PAIV"))
|
if(rset.get("AUTOFATT").as_string() == "X" || _ditta.partita_IVA() == clifo.get("PAIV"))
|
||||||
{
|
{
|
||||||
@ -493,15 +493,15 @@ void TSpeCheck_msk::fillCust()
|
|||||||
}
|
}
|
||||||
s.force_update();
|
s.force_update();
|
||||||
s.show();
|
s.show();
|
||||||
enableEdit(true);
|
enable_edit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpeCheck_msk::getFilFlag(TString& query)
|
void TSpe_check_msk::get_fil_flag(TString& query)
|
||||||
{
|
{
|
||||||
switch(get_int(F_FLAG))
|
switch(get_int(F_FLAG))
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
query << "&&((TFINVIO=\"\")||(TFINVIO=\"X\")||(TFINVIO=\"F\")||(TFINVIO=\"E\"))";
|
query << R"(&&((TFINVIO="")||(TFINVIO="X")||(TFINVIO="F")||(TFINVIO="E")))";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
query << "&&(TFINVIO=\"I\")";
|
query << "&&(TFINVIO=\"I\")";
|
||||||
@ -514,7 +514,7 @@ void TSpeCheck_msk::getFilFlag(TString& query)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpeCheck_msk::enableEdit(bool en)
|
void TSpe_check_msk::enable_edit(const bool en)
|
||||||
{
|
{
|
||||||
// Abilito i bottoni
|
// Abilito i bottoni
|
||||||
enable(DLG_ALL,en);
|
enable(DLG_ALL,en);
|
||||||
@ -554,7 +554,7 @@ void TSpeCheck_msk::enableEdit(bool en)
|
|||||||
s.force_update();
|
s.force_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpeCheck_msk::selectAll()
|
void TSpe_check_msk::select_all()
|
||||||
{
|
{
|
||||||
_selected = !_selected;
|
_selected = !_selected;
|
||||||
TSheet_field& s = sfield(F_RIGHE);
|
TSheet_field& s = sfield(F_RIGHE);
|
||||||
@ -567,7 +567,7 @@ void TSpeCheck_msk::selectAll()
|
|||||||
s.force_update();
|
s.force_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpeCheck_msk::saveAll()
|
void TSpe_check_msk::save_all()
|
||||||
{
|
{
|
||||||
TSheet_field& s = sfield(F_RIGHE);
|
TSheet_field& s = sfield(F_RIGHE);
|
||||||
FOR_EACH_SHEET_ROW(s, r, strarr)
|
FOR_EACH_SHEET_ROW(s, r, strarr)
|
||||||
@ -600,7 +600,7 @@ void TSpeCheck_msk::saveAll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSpeCheck_msk::deleteAll()
|
void TSpe_check_msk::delete_all()
|
||||||
{
|
{
|
||||||
TSheet_field& s = sfield(F_RIGHE);
|
TSheet_field& s = sfield(F_RIGHE);
|
||||||
FOR_EACH_SHEET_ROW(s, r, strarr)
|
FOR_EACH_SHEET_ROW(s, r, strarr)
|
||||||
@ -623,7 +623,7 @@ void TSpeCheck_msk::deleteAll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TSpeCheck_msk::TSpeCheck_msk() : TAutomask("tf0400a")
|
TSpe_check_msk::TSpe_check_msk() : TAutomask("tf0400a")
|
||||||
{
|
{
|
||||||
_ditta.init(LF_NDITTE, prefix().get_codditta());
|
_ditta.init(LF_NDITTE, prefix().get_codditta());
|
||||||
_selected = false;
|
_selected = false;
|
||||||
@ -643,7 +643,7 @@ TSpeCheck_app& app() { return (TSpeCheck_app&)main_app(); }
|
|||||||
|
|
||||||
void TSpeCheck_app::main_loop()
|
void TSpeCheck_app::main_loop()
|
||||||
{
|
{
|
||||||
TSpeCheck_msk msk;
|
TSpe_check_msk msk;
|
||||||
msk.set_has_fp(has_module(FPAUT));
|
msk.set_has_fp(has_module(FPAUT));
|
||||||
msk.run();
|
msk.run();
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,10 @@ TRectype getCli(const TString& tipocf, const TString& codcf, const TString& ocfp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Controlla se l'azienda ha un RFSO
|
// Controlla se l'azienda ha un RFSO
|
||||||
bool haveRFSO(TString& codrfso)
|
bool have_rfso(TString& codrfso)
|
||||||
{
|
{
|
||||||
codrfso = cache().get(LF_NDITTE, prefix().firm().codice(), "CODRFSO");
|
codrfso = cache().get(LF_NDITTE, prefix().firm().codice(), "CODRFSO");
|
||||||
if(codrfso == "") return false;
|
return codrfso.full();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * natura(const TString& codiva)
|
const char * natura(const TString& codiva)
|
||||||
@ -51,29 +50,29 @@ const char * natura(const TString& codiva)
|
|||||||
return natura;
|
return natura;
|
||||||
}
|
}
|
||||||
|
|
||||||
TString findDetraib(TString tipodet)
|
TString find_detraib(const TString& tipodet)
|
||||||
{
|
{
|
||||||
real perc = cache().get("%DET", tipodet, "R0");
|
real perc = static_cast<const char*>(cache().get("%DET", tipodet, "R0"));
|
||||||
return perc.stringa(6,2);
|
return perc.stringa(6,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
real get_IVA(const TString& codiva)
|
real get_iva(const TString& codiva)
|
||||||
{
|
{
|
||||||
const TRectype& ai = cache().get("%IVA", codiva);
|
const TRectype& ai = cache().get("%IVA", codiva);
|
||||||
return ai.get_real("R0");
|
return ai.get_real("R0");
|
||||||
}
|
}
|
||||||
|
|
||||||
TString revCharge(TString numreg, int year)
|
TString rev_charge(const TString& numreg, const int year)
|
||||||
{
|
{
|
||||||
// Controllo se la causale ha il reverse charge, se il cliente non l'ha impostata giusta sono ARAZZI suoi
|
// Controllo se la causale ha il reverse charge, se il cliente non l'ha impostata giusta sono ARAZZI suoi
|
||||||
TString key = numreg;
|
const TString& key = numreg;
|
||||||
TCausale caus(cache().get(LF_MOV, key, "CODCAUS"), year);
|
TCausale caus(cache().get(LF_MOV, key, "CODCAUS"), year);
|
||||||
if(caus.reverse_charge())
|
if(caus.reverse_charge())
|
||||||
bool tolla = true;
|
bool tolla = true;
|
||||||
return caus.reverse_charge() ? "X" : "";
|
return caus.reverse_charge() ? "X" : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
TString getRFSO(TString codrfso)
|
TString get_rfso(TString codrfso)
|
||||||
{
|
{
|
||||||
TString key; key << codrfso[0] << "|" << codrfso.mid(1);
|
TString key; key << codrfso[0] << "|" << codrfso.mid(1);
|
||||||
return cache().get(LF_ANAG, key, "RAGSOC");
|
return cache().get(LF_ANAG, key, "RAGSOC");
|
||||||
@ -82,19 +81,37 @@ TString getRFSO(TString codrfso)
|
|||||||
/* Utilizzo questa funzione per filtrare al meglio i record, tutti i casi che devo omettere verranno rilevati e ritorneranno false
|
/* Utilizzo questa funzione per filtrare al meglio i record, tutti i casi che devo omettere verranno rilevati e ritorneranno false
|
||||||
* Nota bene: viene sfruttato un puntatore di TISAM_Recordset per non creare nuovi oggetti e velocizzare la chiamata
|
* Nota bene: viene sfruttato un puntatore di TISAM_Recordset per non creare nuovi oggetti e velocizzare la chiamata
|
||||||
* a questo punto il programma non ha ancora creato un record di $trasfatt con i dati che mi interessano
|
* a questo punto il programma non ha ancora creato un record di $trasfatt con i dati che mi interessano
|
||||||
|
*
|
||||||
|
* ********************************************************************************************************************************
|
||||||
|
* Aggiornamento 06/03/2019: Aggiunta modalità esterometro! Che succede se abilito questa magia?
|
||||||
|
*
|
||||||
|
* Movimenti Attivi:
|
||||||
|
* Il ragionamento parte con questo presupposto: filtro in automatico che esclude tutti i soggetti che normalmente dovrebbero ricevere la fattura.
|
||||||
|
* Overrides:
|
||||||
|
* paf_sent: Anzichè filtrare codesti soggetti vado a vedere direttamente sui PAFFI per capire cosa ho inviato
|
||||||
|
* paf_not_sent: Stessa roba ma mostro solo i non inviati
|
||||||
|
* paf_sog_fat: Questo flag si considera solo se i primi due non sono abilitati, aggiunge allo sheet anche i soggetti a fattura (quindi è come se disabilitasse il filtro)
|
||||||
|
* paf_esteri: Questo flag si considera solo se i primi due non sono abilitati, aggiunge i clienti esteri
|
||||||
|
* I booleani paf_sent && paf_not_sent sono complementari così come paf_sog_fat && paf_esteri
|
||||||
|
* MA NOTA BENE CHE senza mod_esterometro nessun booleano viene preso in considerazione!
|
||||||
|
*
|
||||||
|
* Movimenti Passivi:
|
||||||
|
* Stessa roba sopra ma con paa_*
|
||||||
*/
|
*/
|
||||||
bool checkRecord(TISAM_recordset* rec, bool has_fp)
|
bool check_record(TISAM_recordset* rec, const bool mod_esterometro,
|
||||||
|
const bool paf_not_sent, const bool paf_sent, const bool paf_sog_fat, const bool paf_esteri,
|
||||||
|
const bool paa_not_sent, const bool paa_sent, const bool paa_sog_fat, const bool paa_esteri)
|
||||||
{
|
{
|
||||||
// Il record non è valido se non è presente un cliente
|
// Il record non è valido se non è presente un cliente
|
||||||
if(rec->get("23.TIPO").as_string()[0] == '\0' || rec->get("23.CODCF").as_int() == 0)
|
if(rec->get("23.TIPO").as_string()[0] == '\0' || rec->get("23.CODCF").as_int() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TAnagrafica anaCli(rec->get("23.TIPO").as_string()[0], rec->get("23.CODCF").as_int(), rec->get("23.OCFPI").as_string());
|
TAnagrafica ana_cli(rec->get("23.TIPO").as_string()[0], rec->get("23.CODCF").as_int(), rec->get("23.OCFPI").as_string());
|
||||||
|
|
||||||
static TString keyClifo; keyClifo.cut(0) << rec->get("23.TIPO").as_string() << "|" << rec->get("23.CODCF").as_string();
|
static TString key_clifo; key_clifo.cut(0) << rec->get("23.TIPO").as_string() << "|" << rec->get("23.CODCF").as_string();
|
||||||
TRectype rclifo = cache().get(LF_CLIFO, keyClifo);
|
TRectype rclifo = cache().get(LF_CLIFO, key_clifo);
|
||||||
// Salto le schede carburanti
|
// Salto le schede carburanti
|
||||||
if(rclifo.get("ALLEG") == "C")
|
if(rclifo.get_char("ALLEG") == 'C')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Clienti
|
// Clienti
|
||||||
@ -102,46 +119,111 @@ bool checkRecord(TISAM_recordset* rec, bool has_fp)
|
|||||||
{
|
{
|
||||||
// Tolgo tutti i movimenti di sola IVA e in reverse charge o di tipo 3 (Acquisto di beni e servizi di soggetti non residenti)
|
// Tolgo tutti i movimenti di sola IVA e in reverse charge o di tipo 3 (Acquisto di beni e servizi di soggetti non residenti)
|
||||||
TCausale caus(rec->get("23.CODCAUS").as_string(), rec->get("23.DATAREG").as_date().year());
|
TCausale caus(rec->get("23.CODCAUS").as_string(), rec->get("23.DATAREG").as_date().year());
|
||||||
const bool filter_revcharge = msk().get_bool(B_ESTEROMETRO) ? msk().get_bool(B_REVCHARGE) : false;
|
if(caus.soloiva() && (caus.reverse_charge() || caus.regime_speciale() == 3))
|
||||||
if(!filter_revcharge && caus.soloiva() && (caus.reverse_charge() || caus.regime_speciale() == 3))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// controllo se la fattura non è già stata spedita con la fatt. elettronica
|
|
||||||
static TPaf_record paf0100f("PAF0100F");
|
if (mod_esterometro)
|
||||||
// controllo se il movimento è agganciato a un documento
|
|
||||||
if(msk().get_bool(B_ESTEROMETRO) && !rec->get("23.DPROVV").is_empty() && !rec->get("23.DANNO").is_empty() && !rec->get("23.DCODNUM").is_empty() && !rec->get("23.DNDOC").is_empty())
|
|
||||||
{
|
{
|
||||||
// Controllo valido solo per utenti non F8
|
// Parte Sirio FP w/ WebApp
|
||||||
const bool check_paf_sent = msk().get_bool(B_PAF_SENT);
|
// Faccio controlli per evitare controlli
|
||||||
const bool check_paf_not_sent = msk().get_bool(B_PAF_NOT_SENT);
|
if(paf_not_sent && paf_sent)
|
||||||
// Se l'utente ha il modulo FP e uno dei due filtri possibili non è stato selezionato, abilito il controllo sui paf
|
|
||||||
if(has_fp && (!check_paf_sent || !check_paf_not_sent))
|
|
||||||
{
|
{
|
||||||
TString hfatt, bfatt;
|
return true;
|
||||||
TRectype rdoc(LF_DOC);
|
}
|
||||||
static TLocalisamfile doc(LF_DOC);
|
else if (paf_not_sent || paf_sent)
|
||||||
rdoc.put(DOC_PROVV, rec->get("23.DPROVV").as_string());
|
{
|
||||||
rdoc.put(DOC_PROVV, rec->get("23.DANNO").as_string());
|
// controllo se la fattura non è già stata spedita con la fatt. elettronica
|
||||||
rdoc.put(DOC_PROVV, rec->get("23.DCODNUM").as_string());
|
static TPaf_record paf0100f("PAF0100F");
|
||||||
rdoc.put(DOC_PROVV, rec->get("23.DNDOC").as_string());
|
// controllo se il movimento è agganciato a un documento
|
||||||
|
if (rec->get("23.DPROVV").is_full() && rec->get("23.DANNO").is_full() && rec->get("23.DCODNUM").is_full() && rec->get("23.DNDOC").is_full())
|
||||||
|
{
|
||||||
|
TString hfatt, bfatt;
|
||||||
|
TRectype rdoc(LF_DOC);
|
||||||
|
static TLocalisamfile doc(LF_DOC);
|
||||||
|
rdoc.put(DOC_PROVV, rec->get("23.DPROVV").as_string());
|
||||||
|
rdoc.put(DOC_PROVV, rec->get("23.DANNO").as_string());
|
||||||
|
rdoc.put(DOC_PROVV, rec->get("23.DCODNUM").as_string());
|
||||||
|
rdoc.put(DOC_PROVV, rec->get("23.DNDOC").as_string());
|
||||||
|
|
||||||
// Se riesco a generare la chiave, trovo il record e ha il flag di gestione in errore o un errore esterno, so che è stato inviato
|
// Se riesco a generare la chiave, trovo il record e ha il flag di gestione in errore o un errore esterno, so che è stato inviato
|
||||||
const bool paf_sent = rdoc.read(doc) == NOERR && chiave_paf(rdoc, hfatt, bfatt) && paf0100f.search(nullptr, hfatt, bfatt) && paf0100f.sq_get("P1_GESTIONE") != "E" && paf0100f.sq_get("P1_ERREST") != "*";
|
const bool is_sent = rdoc.read(doc) == NOERR && chiave_paf(rdoc, hfatt, bfatt) && paf0100f.search(nullptr, hfatt, bfatt) && paf0100f.sq_get("P1_GESTIONE") != "E" && paf0100f.sq_get("P1_ERREST") != "*";
|
||||||
// Se voglio solo quelli inviati e non è stato inviato, RUSPA!
|
|
||||||
if (check_paf_sent && !paf_sent)
|
// Se voglio solo quelli inviati e non è stato inviato o
|
||||||
|
// voglio solo quelli non inviati ed è stato inviato, RUSPA!
|
||||||
|
if ((is_sent && !paf_sent) || (is_sent && paf_not_sent))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static bool warn_user = true;
|
||||||
|
if(warn_user)
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg << "Attenzione: il movimento " << rec->get("23.NUMREG") << " non deriva da nessuna fattura.\nSi desidera includerlo nella ricerca?";
|
||||||
|
switch (yesnoall_box(msg))
|
||||||
|
{
|
||||||
|
case K_YES:
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case K_SPACE:
|
||||||
|
warn_user = false;
|
||||||
|
case K_NO:
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Se non dovrebbe capitare
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// Se voglio solo quelli non inviati ed è stato inviato, RUSPA!
|
}
|
||||||
if (check_paf_not_sent && paf_sent)
|
// Parte tirchi che non comprano la mia WebApp
|
||||||
|
// Solito controllo per evitare controlli
|
||||||
|
else if(paf_sog_fat && paf_esteri)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const bool is_fatturabile = ana_cli.stato_partita_IVA() == "IT" || ana_cli.stato_partita_IVA() == "SM";
|
||||||
|
if ((is_fatturabile && !paf_sog_fat) || (is_fatturabile && paf_esteri))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else
|
||||||
} else if(anaCli.italiano() && anaCli.partita_IVA()[0] != '0' && anaCli.partita_IVA()[0] != '1' && anaCli.codice_fiscale()[0] > '8')
|
|
||||||
// Salto tutti i fornitori con cod cf che inizia per 8 o 9 e con p.iva non valida
|
|
||||||
{
|
{
|
||||||
return false;
|
// Salto tutti i fornitori con cod cf che inizia per 8 o 9 e con p.iva non valida
|
||||||
|
if (ana_cli.italiano() && ana_cli.partita_IVA()[0] != '0' && ana_cli.partita_IVA()[0] != '1' && ana_cli.codice_fiscale()[0] > '8')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (mod_esterometro)
|
||||||
|
{
|
||||||
|
// Parte Sirio FP w/ WebApp
|
||||||
|
// Faccio controlli per evitare controlli
|
||||||
|
if (paf_not_sent && paf_sent)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (paf_not_sent || paf_sent)
|
||||||
|
{
|
||||||
|
// Disabilitato, non si vuole implementare al momento
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Parte tirchi che non comprano la mia WebApp
|
||||||
|
// Solito controllo per evitare controlli
|
||||||
|
else if (paf_sog_fat && paf_esteri)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const bool is_fatturabile = ana_cli.stato_partita_IVA() == "IT" || ana_cli.stato_partita_IVA() == "SM";
|
||||||
|
if ((is_fatturabile && !paf_sog_fat) || (is_fatturabile && paf_esteri))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef __TFUTILITY_H
|
||||||
|
#define __TFUTILITY_H
|
||||||
|
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
|
|
||||||
@ -10,16 +13,20 @@ TRectype getTrasFatt(TString reg, TString codiva);
|
|||||||
// Ritorna il cliente in un record di $clifo, con tipocf = "O" lo cerca in $occas
|
// Ritorna il cliente in un record di $clifo, con tipocf = "O" lo cerca in $occas
|
||||||
TRectype getCli(const TString& tipocf, const TString& codcf, const TString& ocfpi);
|
TRectype getCli(const TString& tipocf, const TString& codcf, const TString& ocfpi);
|
||||||
// Controlla se l'azienda ha un RFSO
|
// Controlla se l'azienda ha un RFSO
|
||||||
bool haveRFSO(TString& codrfso);
|
bool have_rfso(TString& codrfso);
|
||||||
// Ritorna la natura da un codice IVA
|
// Ritorna la natura da un codice IVA
|
||||||
const char * natura(const TString& codiva);
|
const char * natura(const TString& codiva);
|
||||||
// Ritorna l'IVA
|
// Ritorna l'IVA
|
||||||
real get_IVA(const TString& codiva);
|
real get_iva(const TString& codiva);
|
||||||
// Ritorna la % di detraibilità
|
// Ritorna la % di detraibilità
|
||||||
TString findDetraib(TString tipodet);
|
TString find_detraib(const TString& tipodet);
|
||||||
// Ritorna "X" se ha il reverse charge
|
// Ritorna "X" se ha il reverse charge
|
||||||
TString revCharge(TString numreg, int year);
|
TString rev_charge(const TString& numreg, int year);
|
||||||
// Ritorna la ragione sociale del RFSO
|
// Ritorna la ragione sociale del RFSO
|
||||||
TString getRFSO(TString codrfso);
|
TString get_rfso(TString codrfso);
|
||||||
// Controllo che sia un record che mi interessa
|
// Controllo che sia un record che mi interessa
|
||||||
bool checkRecord(TISAM_recordset* rec, bool has_fp);
|
bool check_record(TISAM_recordset* rec, const bool mod_esterometro = false,
|
||||||
|
const bool paf_not_sent = false, const bool paf_sent = false, const bool paf_sog_fat = false, const bool paf_esteri = false,
|
||||||
|
const bool paa_not_sent = false, const bool paa_sent = false, const bool paa_sog_fat = false, const bool paa_esteri = false);
|
||||||
|
|
||||||
|
#endif //!__TFUTILITY_H
|
Loading…
x
Reference in New Issue
Block a user