Patch level : 12.0 428
Files correlati : tf Commento : - Aggiunta gestione caratteri minuscoli accentati vengono trasformati senza accento con apice - Aggiunto campo Esigibilità IVA - Sistemato controllo ST - Aggiunto al filtro "Da inviare" anche i records segnati come errori - Aggiunto riempimento date se non messe git-svn-id: svn://10.65.10.50/branches/R_10_00@23988 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4e88d18395
commit
dff6c2efcd
@ -1,6 +1,8 @@
|
||||
#include "tf0.h"
|
||||
#include "tf0100b.h"
|
||||
|
||||
#include "cglib03.h" // is_split_payment()
|
||||
|
||||
/* Utilities & Main App */
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -230,24 +232,24 @@ const char* decodTipo(TToken_string* strarr)
|
||||
return "TD04";
|
||||
else if(tipodoc == "ND")
|
||||
return "TD05";
|
||||
else if(tipodoc == "SD")
|
||||
else if(tipodoc == "ST")
|
||||
{
|
||||
// Devo capire a che documento è associato
|
||||
TRelation r(LF_MOV);
|
||||
TRectype filter(LF_RMOV);
|
||||
TRelation r(LF_RMOV);
|
||||
TRectype filter(r.curr());
|
||||
filter.put("NUMREG", strarr->get(_numero));
|
||||
TCursor c(&r, "", 1, &filter, &filter);
|
||||
for(c = 0; c.pos() < c.items(); ++c)
|
||||
{
|
||||
TRectype r = c.curr();
|
||||
if(r.get("tipoc") == "C")
|
||||
if(r.get("TIPOC") == "C")
|
||||
{
|
||||
if(r.get("SEZIONE") == "D")
|
||||
return "TD01";
|
||||
else
|
||||
return "TD04";
|
||||
} else
|
||||
if(r.get("tipoc") == "F")
|
||||
if(r.get("TIPOC") == "F")
|
||||
{
|
||||
if(r.get("SEZIONE") == "A")
|
||||
return "TD01";
|
||||
@ -293,6 +295,20 @@ bool saveRec(TToken_string row, bool esportato)
|
||||
return rCust.write_rewrite(trasfatt) == NOERR;
|
||||
}
|
||||
|
||||
inline char noAccent(char a)
|
||||
{
|
||||
if(a == 'à')
|
||||
return 'a';
|
||||
else if(a == 'è' || a == 'é')
|
||||
return 'e';
|
||||
else if(a == 'ì')
|
||||
return 'i';
|
||||
else if(a == 'ò')
|
||||
return 'o';
|
||||
// 'ù' altrimenti
|
||||
return 'u';
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// TTrFa_record
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -404,14 +420,27 @@ const TString& TTrFa_record::var2str(const TString& fldname, const TVariant& var
|
||||
|
||||
TString& tmp = get_tmp_string();
|
||||
tmp = str;
|
||||
TString accenti = CARATTERI_ACCENTATI;
|
||||
for(int i = 0; i < accenti.len(); i++)
|
||||
{
|
||||
for (int a = str.rfind(accenti[i]); a >= 0; a--)
|
||||
{
|
||||
if (tmp[a] == accenti[i])
|
||||
{
|
||||
tmp[a] = noAccent(accenti[i]);
|
||||
tmp.insert("''", a+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int a = str.rfind('\''); a >= 0; a--)
|
||||
{
|
||||
if (tmp[a] == '\'')
|
||||
tmp.insert("'", a);
|
||||
}
|
||||
tmp.insert("'", 0);
|
||||
tmp << '\'';
|
||||
return tmp;
|
||||
tmp.insert("'", 0);
|
||||
tmp << '\'';
|
||||
return tmp;
|
||||
}
|
||||
|
||||
// Elimina il record in base ai campi chiave
|
||||
@ -988,7 +1017,7 @@ bool TTrFa_app::tff0200(TString key)
|
||||
if(via.full() && cap.full() && nazione.full())
|
||||
{
|
||||
tff0200f.set("P2_SEDEIND", via);
|
||||
tff0200f.set("P2_SEDENRCIVICO", _ditta.civico_residenza().left(8));
|
||||
tff0200f.set("P2_SEDENRCIVICO", _ditta.civico_residenza().left(7));
|
||||
tff0200f.set("P2_SEDECAP", cap);
|
||||
tff0200f.set("P2_SEDECOMUNE", _ditta.comune_residenza());
|
||||
if(_ditta.italiano()) // Campo ritornerebbe "EE" se estero
|
||||
@ -1006,7 +1035,7 @@ bool TTrFa_app::tff0200(TString key)
|
||||
TString via = rfso.via_residenza(), cap = rfso.CAP_residenza(), nazione = rfso.stato_residenza_ISO();
|
||||
|
||||
tff0200f.set("P2_STABORGIND", via);
|
||||
tff0200f.set("P2_STABORGNRCIVICO", rfso.civico_residenza().left(8));
|
||||
tff0200f.set("P2_STABORGNRCIVICO", rfso.civico_residenza().left(7));
|
||||
tff0200f.set("P2_STABORGCAP", cap);
|
||||
tff0200f.set("P2_STABORGCOMUNE", rfso.comune_residenza());
|
||||
if(rfso.italiano())
|
||||
@ -1077,6 +1106,9 @@ bool TTrFa_app::tff0400(TSheet_field& sheet)
|
||||
TRectype r_cedeprest = getCli(vtipocf.as_string(), vcodcf.as_string(), voccas.as_string());
|
||||
TAnagrafica cedeprest;
|
||||
|
||||
if(vtipocf.as_string() == "C" && vcodcf.as_string() == "2327")
|
||||
bool tolla = true;
|
||||
|
||||
// Con l'uscita di questo programma è stato messo un collegamento in prima nota
|
||||
// per il fornitore a cui è riferita la bolla doganale
|
||||
if(strcmp(strarr->get(_codnum),"BD") == 0)
|
||||
@ -1202,7 +1234,7 @@ bool TTrFa_app::tff0400(TSheet_field& sheet)
|
||||
}
|
||||
|
||||
tff0400f.set("P4_SEDEIND", cedeprest.via_residenza());
|
||||
tff0400f.set("P4_SEDENRCIVICO", cedeprest.civico_residenza().left(8));
|
||||
tff0400f.set("P4_SEDENRCIVICO", cedeprest.civico_residenza().left(7));
|
||||
tff0400f.set("P4_SEDECAP", cedeprest.CAP_residenza());
|
||||
tff0400f.set("P4_SEDECOMUNE", cedeprest.comune_residenza());
|
||||
if(cedeprest.italiano()) // Campo ritornerebbe "EE" se estero
|
||||
@ -1264,6 +1296,8 @@ bool TTrFa_app::tff0700(TSheet_field& sheet)
|
||||
TString natura = strarr->get(_natura);
|
||||
|
||||
tff0700f.set("P7_TIPODOC", decodTipo(strarr));
|
||||
|
||||
// Controllo il tipo di esigilità
|
||||
tff0700f.set("P7_DATA", toDate(strarr->get(_datadoc)));
|
||||
tff0700f.set("P7_NUMERO", strarr->get(_numdoc));
|
||||
tff0700f.set("P7_DATAREG", toDate(strarr->get(_datareg))); // Obbligatoria nei DTR
|
||||
@ -1305,6 +1339,8 @@ bool TTrFa_app::tff2200(TToken_string* strarr, int nriga)
|
||||
tff2200f.set("PL_IMPOSTA", real(strarr->get(_importoIVA)));
|
||||
real aliquota = cache().get("%IVA", strarr->get(_aliquota), "R0");
|
||||
tff2200f.set("PL_ALIQUOTAIVA", aliquota);
|
||||
TRectype thisMov = cache().get(LF_MOV, strarr->get(_numero));
|
||||
tff2200f.set("PL_ESIGIVA", is_split_payment(thisMov) ? "S" : is_IVA_diff(thisMov) ? "D" : "I");
|
||||
tff2200f.set("PL_NATURA", strarr->get(_natura));
|
||||
real det(strarr->get(_detraibile));
|
||||
// Nella conversione la vigola viene persa e 100,00 diventa 10.000 quindi divido
|
||||
@ -1337,7 +1373,7 @@ bool TTrFa_app::tff3100(TToken_string* strarr, TRectype r_ana)
|
||||
TString via = rfso.via_residenza(), cap = rfso.CAP_residenza(), nazione = rfso.stato_residenza_ISO();
|
||||
|
||||
tff3100f.set("PH_STABORGIND", via);
|
||||
tff3100f.set("PH_STABORGNRCIVICO", rfso.civico_residenza().left(8));
|
||||
tff3100f.set("PH_STABORGNRCIVICO", rfso.civico_residenza().left(7));
|
||||
tff3100f.set("PH_STABORGCAP", cap);
|
||||
tff3100f.set("PH_STABORGCOMUNE", rfso.comune_residenza());
|
||||
if(rfso.italiano())
|
||||
|
@ -57,6 +57,7 @@ enum filter_fatt
|
||||
#define SPESOMETROBASE "ModuliSirio"
|
||||
#define REG_ATT 1
|
||||
#define REG_PAS 2
|
||||
#define CARATTERI_ACCENTATI "àèéìòù"
|
||||
|
||||
/* Così facendo basta modificare la maschera (e le dichiarazioni di conseguenza)
|
||||
* per avere l'inserimento nello sheet corretto */
|
||||
@ -112,6 +113,8 @@ bool saveRec(TToken_string row, bool esportato = false);
|
||||
inline TDate toDate(const char * date) { return TDate(date).string(); }
|
||||
// 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) continue;
|
||||
// Ritorno il carattere senza accento maiuscolo
|
||||
inline char noAccent(char a);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// TTrFa_record
|
||||
|
@ -590,6 +590,18 @@ void TTrFa_mask::load_sheet()
|
||||
const char tipo = get(F_TIPOCF)[0];
|
||||
const long codice = get_long(F_CODCF);
|
||||
TDate dal = get_date(F_DATAINI), al = get_date(F_DATAFIN);
|
||||
|
||||
// Importanti! Evito errori dopo premendo il bottone invia
|
||||
if(!dal.ok())
|
||||
{
|
||||
dal = TDate(01, 01, 2017); // Data inizio validità questo spesometro
|
||||
set(F_DATAINI, dal);
|
||||
}
|
||||
if(!al.ok())
|
||||
{
|
||||
al = TDate(TODAY);
|
||||
set(F_DATAFIN, al);
|
||||
}
|
||||
//TString key; key << "TIPOA=" << prefix().firm().get("TIPOA")<< ",CODANAGR=" << prefix().firm().get("CODANAGR");
|
||||
TString key; key << prefix().firm().get("TIPOA") << "|" << prefix().firm().get("CODANAGR");
|
||||
const TString pivaDitta = cache().get(LF_ANAG, key, "PAIV");
|
||||
@ -711,7 +723,7 @@ bool TTrFa_mask::checkInvio(const TString& invio)
|
||||
switch(get_int(F_FATTSEL))
|
||||
{
|
||||
case 0:
|
||||
ok = invio == "" || invio == FLAG_INVIO || invio == FLAG_FORZATO;
|
||||
ok = invio == "" || invio == FLAG_INVIO || invio == FLAG_FORZATO || invio == FLAG_ERRORE;
|
||||
break;
|
||||
case 1:
|
||||
ok = invio == FLAG_INVIATO;
|
||||
|
@ -191,8 +191,8 @@ int TTrFa_cursors::updateFilters(const char tipocf, const long codcf, TDate dal,
|
||||
switch(cod)
|
||||
{
|
||||
case toSend:
|
||||
query << "&&((23.TFINVIO=\"\")||(23.TFINVIO=\"X\")||(23.TFINVIO=\"F\"))";
|
||||
queryCust << "&&((TFINVIO=\"\")||(TFINVIO=\"X\")||(TFINVIO=\"F\"))";
|
||||
query << "&&((23.TFINVIO=\"\")||(23.TFINVIO=\"X\")||(23.TFINVIO=\"F\")||(23.TFINVIO=\"E\"))";
|
||||
queryCust << "&&((TFINVIO=\"\")||(TFINVIO=\"X\")||(TFINVIO=\"F\")||(TFINVIO=\"E\"))";
|
||||
break;
|
||||
case sent:
|
||||
query << "&&(23.TFINVIO=\"I\")";
|
||||
|
Loading…
x
Reference in New Issue
Block a user