Merge branch 'R_10_00' of http://10.65.20.33/sirio/CAMPO/campo into R_10_00

This commit is contained in:
Sirio Builder 2019-04-03 10:54:29 +02:00
commit c1b2512877
2 changed files with 30 additions and 37 deletions

View File

@ -23,7 +23,6 @@ class TSpe_check_msk : public TAutomask
private: private:
TAnagrafica _ditta; TAnagrafica _ditta;
bool _selected; bool _selected;
bool _has_fp;
TSheet_field& get_sfield(const int field); TSheet_field& get_sfield(const int field);
void fill_ninvio(); void fill_ninvio();
@ -32,7 +31,7 @@ private:
void fill_diff(); void fill_diff();
void find_homeland(TToken_string& row, TString numreg, TString codiva, TRectype& clifo); void find_homeland(TToken_string& row, TString numreg, TString codiva, TRectype& clifo);
void fill_cust(); void fill_cust();
void get_fil_flag(TString& query); void get_fil_flag(TString& query, const char* table);
void enable_edit(bool en); void enable_edit(bool en);
void select_all(); void select_all();
void save_all(); void save_all();
@ -40,7 +39,6 @@ private:
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override; bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
public: public:
void set_has_fp(const bool has_fp) { _has_fp = has_fp; }
TSpe_check_msk(); TSpe_check_msk();
virtual ~TSpe_check_msk() {}; virtual ~TSpe_check_msk() {};
}; };
@ -237,7 +235,7 @@ void TSpe_check_msk::fill_no_filter()
if(get(F_CODCF).full()) if(get(F_CODCF).full())
query << "&&STR((23.CODCF=#CODCF))"; query << "&&STR((23.CODCF=#CODCF))";
get_fil_flag(query); get_fil_flag(query, "23");
query << "\nJOIN MOV INTO NUMREG==NUMREG\n"; query << "\nJOIN MOV INTO NUMREG==NUMREG\n";
@ -263,7 +261,7 @@ void TSpe_check_msk::fill_no_filter()
if(get(F_CODCF).full()) if(get(F_CODCF).full())
rset.set_var("#CODCF", get(F_CODCF)); rset.set_var("#CODCF", get(F_CODCF));
int nrec = rset.items(); const int nrec = rset.items();
TSheet_field& s = get_sfield(F_RIGHE); TSheet_field& s = get_sfield(F_RIGHE);
@ -271,6 +269,8 @@ void TSpe_check_msk::fill_no_filter()
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
if (check_record(&rset, false)) 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);
@ -327,7 +327,7 @@ void TSpe_check_msk::fill_diff()
if(get(F_CODCF).full()) if(get(F_CODCF).full())
query << "&&STR((CODCF=#CODCF))"; query << "&&STR((CODCF=#CODCF))";
get_fil_flag(query); get_fil_flag(query, "173");
TISAM_recordset rset(query); TISAM_recordset rset(query);
TDate dadatareg = get_date(F_DATAINI); TDate dadatareg = get_date(F_DATAINI);
@ -354,8 +354,6 @@ void TSpe_check_msk::fill_diff()
TSheet_field& s = get_sfield(F_RIGHE); TSheet_field& s = get_sfield(F_RIGHE);
if(nrec <= 0) return;
TString nat; TString nat;
for(bool ok = rset.move_first(); ok; ok = rset.move_next()) for(bool ok = rset.move_first(); ok; ok = rset.move_next())
@ -501,7 +499,7 @@ void TSpe_check_msk::fill_cust()
if(get(F_CODCF).full()) if(get(F_CODCF).full())
query << "&&STR((CODCF=#CODCF))"; query << "&&STR((CODCF=#CODCF))";
get_fil_flag(query); get_fil_flag(query, "173");
TISAM_recordset rset(query); TISAM_recordset rset(query);
@ -587,18 +585,18 @@ void TSpe_check_msk::fill_cust()
enable_edit(true); enable_edit(true);
} }
void TSpe_check_msk::get_fil_flag(TString& query) void TSpe_check_msk::get_fil_flag(TString& query, const char* table)
{ {
switch(get_int(F_FLAG)) switch(get_int(F_FLAG))
{ {
case 1: case 1:
query << R"(&&((TFINVIO="")||(TFINVIO="X")||(TFINVIO="F")||(TFINVIO="E")))"; query << "&&((" << table << ".TFINVIO=\"\")||("<< table << ".TFINVIO=\"X\")||(" << table << ".TFINVIO=\"F\")||(" << table << ".TFINVIO=\"E\"))";
break; break;
case 2: case 2:
query << "&&(TFINVIO=\"I\")"; query << "&&(" << table << ".TFINVIO=\"I\")";
break; break;
case 3: case 3:
query << "&&(TFINVIO=\"N\")"; query << "&&(" << table << ".TFINVIO=\"N\")";
case 0: case 0:
default: default:
break; break;
@ -728,15 +726,14 @@ TSpe_check_msk::TSpe_check_msk() : TAutomask("tf0400a")
class TSpeCheck_app : public TSkeleton_application class TSpeCheck_app : public TSkeleton_application
{ {
public: public:
virtual void main_loop(); void main_loop() override;
}; };
TSpeCheck_app& app() { return (TSpeCheck_app&)main_app(); } TSpeCheck_app& app() { return dynamic_cast<TSpeCheck_app&>(main_app()); }
void TSpeCheck_app::main_loop() void TSpeCheck_app::main_loop()
{ {
TSpe_check_msk msk; TSpe_check_msk msk;
msk.set_has_fp(has_module(FPAUT));
msk.run(); msk.run();
} }

View File

@ -1948,25 +1948,21 @@ TRiga_documento & TDocumento::row(int index)
CHECKD(index <= rows(), "Riga documento non esistente ", index); CHECKD(index <= rows(), "Riga documento non esistente ", index);
switch (index - nrows) // Meglio scritto così che è facile da capire
{ const int index_richiesto = index - nrows;
case 1: const int index_sconto = _sconto != nullptr ? 1 : 0;
if (_sconto != NULL) const int index_esenzione = _esenzione != nullptr ? index_sconto + 1 : 0;
const int index_valfisc = _valfisc != nullptr ? index_esenzione + 1 : 0;
if(index_richiesto == index_sconto)
{ {
r = _sconto; r = _sconto;
break; } else if (index_richiesto == index_esenzione)
}
case 2:
if (_esenzione != NULL)
{ {
r = _esenzione; r = _esenzione;
break; } else if (index_richiesto == index_valfisc)
}
case 3:
{ {
r = _valfisc; r = _valfisc;
break;
}
} }
} }