Patch level : 12.0 982
Files correlati : ve0.exe ve1.exe ve5.exe ve6.exe ve0200b.msk Commento : Ristrutturato modulo li
This commit is contained in:
parent
59005050c9
commit
8bdb4472ef
@ -179,8 +179,6 @@ void TCli_for::init()
|
|||||||
// _ven_tipo = new TRecfield(_ven_rec, CFV_TIPOCF);
|
// _ven_tipo = new TRecfield(_ven_rec, CFV_TIPOCF);
|
||||||
// _ven_codice = new TRecfield(_ven_rec, CFV_CODCF);
|
// _ven_codice = new TRecfield(_ven_rec, CFV_CODCF);
|
||||||
_use_lettere = main_app().has_module(LIAUT, CHK_DONGLE);
|
_use_lettere = main_app().has_module(LIAUT, CHK_DONGLE);
|
||||||
if (_use_lettere)
|
|
||||||
_use_lettere = ini_get_bool(CONFIG_DITTA, "ve", "USELETTERE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const TString& TCli_for::find_listino_al(const TDate& datadoc) const
|
const TString& TCli_for::find_listino_al(const TDate& datadoc) const
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <occas.h>
|
#include <occas.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class TDocumento;
|
class TDocumento;
|
||||||
|
|
||||||
class TOccasionale : public TRectype
|
class TOccasionale : public TRectype
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include <toolfld.h>
|
#include <toolfld.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include "../li/lilib01.h"
|
|
||||||
#include "ve0100.h"
|
#include "ve0100.h"
|
||||||
#include "veini.h"
|
#include "veini.h"
|
||||||
|
|
||||||
@ -529,12 +528,6 @@ int TMotore_application::write( const TMask& m ) // C 90
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggiunte per il controllo plafond
|
|
||||||
if(has_module(LIAUT, CHK_DONGLE) && d.tipo().is_fattura() && ini_get_bool(CONFIG_DITTA, "ve", "USELETTERE") && check_plafond_write(d) == -1)
|
|
||||||
{
|
|
||||||
return _isnowarning;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int err = TRelation_application::write(m);
|
const int err = TRelation_application::write(m);
|
||||||
|
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
@ -559,25 +552,19 @@ int TMotore_application::rewrite( const TMask& m ) // C 90
|
|||||||
{
|
{
|
||||||
TDocumento& d = (TDocumento &) _rel->curr();
|
TDocumento& d = (TDocumento &) _rel->curr();
|
||||||
TDocumento_mask& mask = (TDocumento_mask&) m;
|
TDocumento_mask& mask = (TDocumento_mask&) m;
|
||||||
|
int err = NOERR;
|
||||||
|
|
||||||
if (d.bloccato())
|
if (!d.bloccato())
|
||||||
return NOERR;
|
|
||||||
mask.mask2doc();
|
|
||||||
d = ((TDocumento_mask&)m).doc(); // Trasferisce il documento da maschera a record
|
|
||||||
|
|
||||||
// Aggiunte per il controllo plafond
|
|
||||||
if(has_module(LIAUT, CHK_DONGLE) && d.tipo().is_fattura() && ini_get_bool(CONFIG_DITTA, "ve", "USELETTERE") && check_plafond_rewrite(d) == -1)
|
|
||||||
{
|
{
|
||||||
return _isnowarning;
|
mask.mask2doc();
|
||||||
}
|
d = ((TDocumento_mask&)m).doc(); // Trasferisce il documento da maschera a record
|
||||||
|
err = TRelation_application::rewrite(m);
|
||||||
const int err = TRelation_application::rewrite(m);
|
if (err == NOERR)
|
||||||
|
{
|
||||||
if (err == NOERR)
|
do_elab(d);
|
||||||
{
|
mask.update_father_rows();
|
||||||
do_elab(d);
|
mask.save_father_rows();
|
||||||
mask.update_father_rows();
|
}
|
||||||
mask.save_father_rows();
|
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -585,15 +572,14 @@ int TMotore_application::rewrite( const TMask& m ) // C 90
|
|||||||
bool TMotore_application::remove() // C 90
|
bool TMotore_application::remove() // C 90
|
||||||
{
|
{
|
||||||
TDocumento& d = (TDocumento &) _rel->curr();
|
TDocumento& d = (TDocumento &) _rel->curr();
|
||||||
bool ok = check_plafond_delete(d);
|
|
||||||
if(ok)
|
d.put(DOC_NOTE, "DELETING");
|
||||||
{
|
do_elab(d);
|
||||||
d.put(DOC_NOTE, "DELETING");
|
|
||||||
do_elab(d);
|
bool ok = TRelation_application::remove();
|
||||||
ok = TRelation_application::remove();
|
|
||||||
if(ok)
|
if (ok)
|
||||||
edit_mask().save_father_rows();
|
edit_mask().save_father_rows();
|
||||||
}
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1315,226 +1301,6 @@ void TMotore_application::preview()
|
|||||||
save_and_print(true, screenvis);
|
save_and_print(true, screenvis);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TMotore_application::check_plafond_write(TDocumento& d)
|
|
||||||
{
|
|
||||||
TLi_manager plafond(d.tipocf(), d.codcf(), d.data());
|
|
||||||
if(!plafond.has_valid_plafond()) // Se il cliente non mi interessa
|
|
||||||
return NOERR;
|
|
||||||
|
|
||||||
TAssoc_array tab_iva = d.tabella_iva(true);
|
|
||||||
|
|
||||||
real pla_util = ZERO;
|
|
||||||
|
|
||||||
for (TRiepilogo_iva * totali = dynamic_cast<TRiepilogo_iva *>(tab_iva.get()); totali != nullptr; totali = dynamic_cast<TRiepilogo_iva *>(tab_iva.get()))
|
|
||||||
{
|
|
||||||
if(plafond.check_iva(totali->cod_iva().codice())) // Se l'iva del documento è diversa non mi interessa
|
|
||||||
{
|
|
||||||
pla_util += totali->imp_orig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pla_util <= ZERO)
|
|
||||||
{
|
|
||||||
return NOERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
real pla_res = plafond.get_pla_res();
|
|
||||||
|
|
||||||
TToken_string used;
|
|
||||||
if(d.tipo().nota_credito())
|
|
||||||
{
|
|
||||||
used = plafond.incr_plaf(d, pla_util, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Il controllo è andato bene, adesso mi segno i plafond che ho utilizzato nel memo del documento
|
|
||||||
used = plafond.cons_plaf(pla_util, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(used.starts_with("ERRORE"))
|
|
||||||
{
|
|
||||||
plafond.revert_modifiche();
|
|
||||||
TString msg("Attenzione il plafond è stato superato di ");
|
|
||||||
msg << TCurrency(-(pla_res - pla_util)).string() << "€";
|
|
||||||
warning_box(msg);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
d.put("PLAFOND", used);
|
|
||||||
return NOERR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int TMotore_application::check_plafond_rewrite(TDocumento& d)
|
|
||||||
{
|
|
||||||
TLi_manager plafond(d.tipocf(), d.codcf(), d.data());
|
|
||||||
if(!plafond.has_valid_plafond()) // Se il cliente non mi interessa
|
|
||||||
return NOERR;
|
|
||||||
|
|
||||||
TAssoc_array tab_iva = d.tabella_iva(true);
|
|
||||||
TDocumento old_doc;
|
|
||||||
|
|
||||||
real pla_util = ZERO;
|
|
||||||
|
|
||||||
for (TRiepilogo_iva * totali = dynamic_cast<TRiepilogo_iva *>(tab_iva.get()); totali != nullptr; totali = dynamic_cast<TRiepilogo_iva *>(tab_iva.get()))
|
|
||||||
if(plafond.check_iva(totali->cod_iva().codice())) // Se l'iva del documento è diversa non mi interessa
|
|
||||||
pla_util += totali->imp_orig();
|
|
||||||
|
|
||||||
if(pla_util <= ZERO)
|
|
||||||
return NOERR;
|
|
||||||
|
|
||||||
// Prima di tutto controllo che non stia salvando la stessa roba che ho già, confronto il totale dei plafond con il totale da calcolare
|
|
||||||
TToken_string le_plafs(d.get("PLAFOND"), ',');
|
|
||||||
real tot_plaf = ZERO;
|
|
||||||
for(int i = 0; i < le_plafs.items(); i++)
|
|
||||||
{
|
|
||||||
// É + ottimizzato rispetto a farlo in una linea sola?
|
|
||||||
//static TToken_string thisPlaf; thisPlaf.cut(0) << lePlafs.get(i);
|
|
||||||
tot_plaf += static_cast<real>(static_cast<TToken_string>(le_plafs.get(i)).get(_plimporto));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calcolo le differenze tra il plafond attuale da verificare e quello precedente
|
|
||||||
if(tot_plaf == pla_util)
|
|
||||||
return NOERR;
|
|
||||||
|
|
||||||
real pla_res = plafond.get_pla_res();
|
|
||||||
TToken_string used;
|
|
||||||
/* Devo gestire queste modifiche dividendo in 4 parti:
|
|
||||||
* 1) > vecchio Doc : faccio la differenza nuovo - vecchio e provo a generare un used nuovo
|
|
||||||
* 2) > vecchio NC : aggiungo alla parte che già storno
|
|
||||||
* 3) < vecchio Doc : storno parte del plafond già utilizzato
|
|
||||||
* 4) < vecchio NC : verifico che il plafond stornato con questa NC non sia stato utilizzato, in caso negativo tutto OK, positivo blocco.
|
|
||||||
*/
|
|
||||||
if(tot_plaf < pla_util)
|
|
||||||
{
|
|
||||||
if(d.tipo().nota_credito()) // 2
|
|
||||||
{
|
|
||||||
pla_util -= tot_plaf;
|
|
||||||
used = plafond.incr_plaf(d, pla_util, true);
|
|
||||||
}
|
|
||||||
else // 1
|
|
||||||
{
|
|
||||||
pla_util -= tot_plaf;
|
|
||||||
used = plafond.cons_plaf(pla_util, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(d.tipo().nota_credito()) // 4
|
|
||||||
{
|
|
||||||
if(plafond.check_utilizzo(d, pla_util))
|
|
||||||
{
|
|
||||||
TString msg = "Attenzione! Si sta cercando di modificare una Nota di Credito che influisce le seguenti lettere di intento: \n";
|
|
||||||
for(int i = 0; i < le_plafs.items(); i++)
|
|
||||||
{
|
|
||||||
msg << i+1 << " - N." << le_plafs.get(_plnumprot) << "\n";
|
|
||||||
}
|
|
||||||
msg << "Vuoi continuare?";
|
|
||||||
if(yesno_box(msg))
|
|
||||||
{
|
|
||||||
used = plafond.storna_doc(d, tot_plaf - pla_util, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else // 3
|
|
||||||
{
|
|
||||||
used = plafond.storna_doc(d, tot_plaf - pla_util, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(used.starts_with("ERRORE"))
|
|
||||||
{
|
|
||||||
plafond.revert_modifiche();
|
|
||||||
warning_box(used);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
d.put("PLAFOND", used);
|
|
||||||
return NOERR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TMotore_application::check_plafond_delete(TDocumento& d)
|
|
||||||
{
|
|
||||||
TLi_manager plafond(d.tipocf(), d.codcf(), d.data());
|
|
||||||
if(d.get("PLAFOND").blank() || !plafond.has_valid_plafond()) // Se la fattura non ha nulla scritto in plafond non mi interessa
|
|
||||||
return true;
|
|
||||||
|
|
||||||
TAssoc_array tab_iva = d.tabella_iva(true);
|
|
||||||
TDocumento old_doc;
|
|
||||||
|
|
||||||
// Prima di tutto controllo che non stia salvando la stessa roba che ho già, confronto il totale dei plafond con il totale da calcolare
|
|
||||||
TToken_string le_plafs(d.get("PLAFOND"), ',');
|
|
||||||
real totPlaf = ZERO;
|
|
||||||
for(int i = 0; i < le_plafs.items(); i++)
|
|
||||||
{
|
|
||||||
// É + ottimizzato rispetto a farlo in una linea sola?
|
|
||||||
//static TToken_string thisPlaf; thisPlaf.cut(0) << lePlafs.get(i);
|
|
||||||
totPlaf += static_cast<real>(static_cast<TToken_string>(le_plafs.get(i)).get(_plimporto));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calcolo le differenze tra il plafond attuale da verificare e quello precedente
|
|
||||||
if(totPlaf == ZERO)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
real pla_res = plafond.get_pla_res();
|
|
||||||
TToken_string used;
|
|
||||||
/* Devo gestire queste modifiche dividendo in 4 parti:
|
|
||||||
* 1) < vecchio Doc : storno parte del plafond già utilizzato
|
|
||||||
* 2) < vecchio NC : verifico che il plafond stornato con questa NC non sia stato utilizzato, in caso negativo tutto OK, positivo blocco.
|
|
||||||
*/
|
|
||||||
if(d.tipo().nota_credito()) // 2
|
|
||||||
{
|
|
||||||
if(plafond.check_utilizzo(d, totPlaf))
|
|
||||||
{
|
|
||||||
TString msg = "Attenzione! Si sta cercando di modificare una Nota di Credito che influisce le seguenti lettere di intento: \n";
|
|
||||||
for(int i = 0; i < le_plafs.items(); i++)
|
|
||||||
{
|
|
||||||
TToken_string this_plaf(le_plafs.get(i));
|
|
||||||
msg << i+1 << " - N." << this_plaf.get(_plnumprot) << "\n";
|
|
||||||
}
|
|
||||||
msg << "Vuoi continuare?";
|
|
||||||
if(yesno_box(msg))
|
|
||||||
{
|
|
||||||
used = plafond.storna_doc(d, totPlaf, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else // 1
|
|
||||||
{
|
|
||||||
real plaf_sto = ZERO;
|
|
||||||
for(int i = 0; i < le_plafs.items(); i++)
|
|
||||||
{
|
|
||||||
TToken_string this_plaf(le_plafs.get(i));
|
|
||||||
plaf_sto += static_cast<real>(this_plaf.get(_plNC));
|
|
||||||
}
|
|
||||||
if(plaf_sto > ZERO)
|
|
||||||
{
|
|
||||||
if(!yesno_box(TR("Attenzione! Si sta cercando di eliminare un documento per cui sono presenti una o più note di variazione per un totale di %s€\nContinuare?"), TCurrency(plaf_sto).string()))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
used = plafond.storna_doc(d, totPlaf, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(used.starts_with("ERRORE"))
|
|
||||||
{
|
|
||||||
plafond.revert_modifiche();
|
|
||||||
warning_box(used);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ve0100( int argc, char* argv[])
|
int ve0100( int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TMotore_application a;
|
TMotore_application a;
|
||||||
|
@ -109,10 +109,6 @@ public:
|
|||||||
bool TMotore_application::get_next_key(TToken_string& key);
|
bool TMotore_application::get_next_key(TToken_string& key);
|
||||||
// virtual const char* get_next_key( );
|
// virtual const char* get_next_key( );
|
||||||
|
|
||||||
// Test Plafond
|
|
||||||
int check_plafond_write(TDocumento& d);
|
|
||||||
int check_plafond_rewrite(TDocumento& d);
|
|
||||||
bool check_plafond_delete(TDocumento& d);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline TMotore_application& app() { return (TMotore_application &) main_app(); }
|
inline TMotore_application& app() { return (TMotore_application &) main_app(); }
|
||||||
|
@ -77,22 +77,16 @@ BEGIN
|
|||||||
FIELD LIVPERART
|
FIELD LIVPERART
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_USELETTERE
|
|
||||||
BEGIN
|
|
||||||
PROMPT 2 14 "Utilizzo lettere d'intento"
|
|
||||||
FIELD USELETTERE
|
|
||||||
END
|
|
||||||
|
|
||||||
CURRENCY F_IMPMINFAT 10
|
CURRENCY F_IMPMINFAT 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 15 "Importo minimo fatture "
|
PROMPT 2 14 "Importo minimo fatture "
|
||||||
FIELD IMPMINFAT
|
FIELD IMPMINFAT
|
||||||
PICTURE "."
|
PICTURE "."
|
||||||
END
|
END
|
||||||
|
|
||||||
CURRENCY F_IMPMINEFF 10
|
CURRENCY F_IMPMINEFF 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 16 "Importo minimo per effetti "
|
PROMPT 2 15 "Importo minimo per effetti "
|
||||||
FIELD IMPMINEFF
|
FIELD IMPMINEFF
|
||||||
PICTURE "."
|
PICTURE "."
|
||||||
END
|
END
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <tabmod.h>
|
#include <tabmod.h>
|
||||||
|
|
||||||
#include "../cg/cglib01.h"
|
#include "../cg/cglib.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Applicazione per gestione maschere di modulo
|
// Applicazione per gestione maschere di modulo
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <reprint.h>
|
#include <reprint.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
|
|
||||||
#include "../cg/cg2103.h"
|
#include "../cg/cglib.h"
|
||||||
#include "velib.h"
|
#include "velib.h"
|
||||||
|
|
||||||
#include "ve1.h"
|
#include "ve1.h"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <textset.h>
|
#include <textset.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#include "../cg/cglib01.h"
|
#include "../cg/cglib.h"
|
||||||
#include "velib07.h"
|
#include "velib07.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -4,12 +4,8 @@
|
|||||||
|
|
||||||
int main( int argc, char** argv )
|
int main( int argc, char** argv )
|
||||||
{
|
{
|
||||||
//int r = (argc > 1) ? argv[1][1]-'0' : -1;
|
const char * s = argv[1]; s++;
|
||||||
/*
|
int r = (argc > 1) ? atoi(s) : -1;
|
||||||
if(argv[1][2] > 0)
|
|
||||||
r = r * 10 + argv[1][2]-'0';
|
|
||||||
*/
|
|
||||||
int r = (argc > 1) ? atoi(++argv[1]) : -1;
|
|
||||||
|
|
||||||
switch (r)
|
switch (r)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//#include <recset.h>
|
//#include <recset.h>
|
||||||
#include <reputils.h>
|
#include <reputils.h>
|
||||||
#include <dongle.h>
|
#include <dongle.h>
|
||||||
|
#include <utility.h>
|
||||||
|
|
||||||
#include "velib04.h"
|
#include "velib04.h"
|
||||||
#include "ve6200.h"
|
#include "ve6200.h"
|
||||||
@ -34,50 +35,17 @@ bool TFatturazione_bolle_app::process(TProgress_monitor& iw, TElaborazione & eld
|
|||||||
if (eld.elabora(din, dout, data_elab))
|
if (eld.elabora(din, dout, data_elab))
|
||||||
{
|
{
|
||||||
TString msg;
|
TString msg;
|
||||||
|
|
||||||
msg << din.items() << TR(" documenti raggruppati in ") << dout.items();
|
msg << din.items() << TR(" documenti raggruppati in ") << dout.items();
|
||||||
iw.set_text(msg); // Messaggio sul cliente
|
iw.set_text(msg); // Messaggio sul cliente
|
||||||
do_events(); // Attende visualizzazione
|
do_events(); // Attende visualizzazione
|
||||||
|
lint_batch(true);
|
||||||
|
lint_reset_msg();
|
||||||
|
|
||||||
|
int err = dout.write(); // Scrive documenti di output
|
||||||
|
|
||||||
// Test Plafond
|
lint_batch(false);
|
||||||
TToken_string tipi, stati;
|
if (err == NOERR)
|
||||||
create_tipi_stati(tipi, stati);
|
|
||||||
int clifo = din[0].clifor().codice();
|
|
||||||
|
|
||||||
TDate aData(data_elab);
|
|
||||||
TLi_manager currentCli('C', clifo, aData); // Inizializzo l'oggetto per la gestione del plafond
|
|
||||||
real plafond, res_plafond, tot_fat;
|
|
||||||
if (currentCli.has_valid_plafond())
|
|
||||||
{
|
|
||||||
plafond = currentCli.get_plafond();
|
|
||||||
res_plafond = plafond - currentCli.elab_util(tipi, stati, aData);
|
|
||||||
for (int i = 0; i < din.items(); ++i)
|
|
||||||
tot_fat += din[i].totale_doc();
|
|
||||||
|
|
||||||
TLog_report lerr;
|
|
||||||
if (tot_fat > res_plafond)
|
|
||||||
{
|
|
||||||
bool plur = din.items() > 1;
|
|
||||||
TString err;
|
|
||||||
err << "Errore durante la generazione del plafond:\n" <<
|
|
||||||
(plur ? "I documenti da elaborare superano" : "Il documento da elaborare supera") << " il plafond per questo cliente.\n"
|
|
||||||
"Plafond rimanente: %s\n" <<
|
|
||||||
(plur ? "Totale fatture: %s\n" : "Totale fattura: %s\n") <<
|
|
||||||
(plur ? "Le fatture non sono state create." : "La fattura non e' stata creata.");
|
|
||||||
return error_box(err, res_plafond.string(), tot_fat.string());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Una volta che di documenti sono elaborati ci scrivo sopra il valore del plafond
|
|
||||||
scrivi_plafond(dout, data_elab);
|
|
||||||
//if (!popola_plafond(dout, data_elab))
|
|
||||||
//{
|
|
||||||
// return error_box("Errore durante la generazione del plafond, le fatture non son state create");
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int err = dout.write(); // Scrive documenti di output
|
|
||||||
if (err == NOERR)
|
|
||||||
{
|
{
|
||||||
err = din.rewrite(); // Aggiorna stato dei documenti di input
|
err = din.rewrite(); // Aggiorna stato dei documenti di input
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
@ -85,7 +53,12 @@ bool TFatturazione_bolle_app::process(TProgress_monitor& iw, TElaborazione & eld
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
ok = error_box("Errore %d durante l'aggiornamento dei documenti da raggruppare!", err);
|
ok = error_box("Errore %d durante l'aggiornamento dei documenti da raggruppare!", err);
|
||||||
}
|
|
||||||
|
const TString & str = lint_get_msg();
|
||||||
|
|
||||||
|
if (str.full())
|
||||||
|
ok = error_box(str);
|
||||||
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,40 +396,66 @@ bool TFatturazione_bolle_app::test_dicint(const TMask& m)
|
|||||||
const long dn = m.get_long(F_NUMERO_DOCUMENTO_DA);
|
const long dn = m.get_long(F_NUMERO_DOCUMENTO_DA);
|
||||||
const long an = m.get_long(F_NUMERO_DOCUMENTO_A);
|
const long an = m.get_long(F_NUMERO_DOCUMENTO_A);
|
||||||
|
|
||||||
TElaborazione& eld = *elab(m.get(F_CODICE_ELAB));
|
TElaborazione * eld = elab(m.get(F_CODICE_ELAB));
|
||||||
TToken_string tipidoc(24), statidoc(10);
|
TToken_string tipidoc(24), statidoc(10);
|
||||||
eld.tipi_stati_iniziali(tipidoc, statidoc);
|
eld->tipi_stati_iniziali(tipidoc, statidoc);
|
||||||
|
|
||||||
TTipo_documento t(eld.tipo_iniziale(0));
|
TTipo_documento t(eld->tipo_iniziale(0));
|
||||||
char tipocf(t.tipocf());
|
char tipocf(t.tipocf());
|
||||||
TLista_cf clienti(tipocf);
|
TLista_cf clienti(tipocf);
|
||||||
|
TString msg(80);
|
||||||
|
const int tot_cli = clienti.leggi_doc(*eld, dd, ad, dc, ac, da, aa, dz, az);
|
||||||
|
TLog_report lerr(TR("Errori controllo plafond"));
|
||||||
|
bool err = false;
|
||||||
|
|
||||||
const int tot_cli = clienti.leggi_doc(eld, dd, ad, dc, ac, da, aa, dz, az);
|
lerr.log(0,"\n");
|
||||||
|
|
||||||
TString msg(80);
|
|
||||||
|
|
||||||
|
|
||||||
TLog_report lerr(TR("Errori controllo plafond e CONAI"));
|
|
||||||
lerr.log(0,"\n");
|
|
||||||
bool err = false;
|
|
||||||
for (int c = 0; c < tot_cli; c++)
|
for (int c = 0; c < tot_cli; c++)
|
||||||
{
|
{
|
||||||
const long codcli = clienti[c]; // Codice cliente in esame
|
const long codcli = clienti[c]; // Codice cliente in esame
|
||||||
|
TLi_manager cli('C', codcli, data_elab.year()); // Inizializzo l'oggetto per la gestione del plafond
|
||||||
|
|
||||||
TLi_manager currentCli(tipocf, codcli, ad); // Inizializzo l'oggetto per la gestione del plafond
|
if (cli.has_valid_plafond())
|
||||||
|
{
|
||||||
|
bool ok = true;
|
||||||
|
real plafond, res_plafond, utilizzo;
|
||||||
|
TLista_documenti din; // Legge tutti i documenti di input
|
||||||
|
din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
|
||||||
|
|
||||||
if (currentCli.has_valid_plafond())
|
lint_batch(true);
|
||||||
{
|
lint_reset_msg();
|
||||||
TLista_documenti din; // Legge tutti i documenti di input
|
plafond = cli.get_plafond();
|
||||||
din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
|
res_plafond = cli.get_residuo();
|
||||||
if (din.items() > 0)
|
for (int i = 0; i < din.items(); i++)
|
||||||
{
|
{
|
||||||
err |= currentCli.test_plafond(din, lerr);
|
const real importo_utilizzato = din[i].importo_plafond();
|
||||||
}
|
TToken_string plafs(din[i].get(DOC_PLAFOND), ',');
|
||||||
}
|
const TDate datadoc = din[i].get_date(DOC_DATADOC);
|
||||||
|
|
||||||
|
utilizzo += importo_utilizzato;
|
||||||
|
ok = cli.utilizza_plafond(din[i], plafs, importo_utilizzato);
|
||||||
|
}
|
||||||
|
cli.set_dirty(false);
|
||||||
|
lint_batch(false);
|
||||||
|
if (!ok || utilizzo > res_plafond)
|
||||||
|
{
|
||||||
|
bool plur = din.items() > 1;
|
||||||
|
TString err;
|
||||||
|
const TString & str = lint_get_msg();
|
||||||
|
|
||||||
|
msg << TR("Errore durante la generazione del plafond:\n");
|
||||||
|
msg << (plur ? TR("I documenti da elaborare superano") : TR("Il documento da elaborare supera"));
|
||||||
|
msg << TR(" il plafond per questo cliente.") << '\n';
|
||||||
|
msg << TR("Plafond rimanente: ") << res_plafond << '\n';
|
||||||
|
msg << TR("Totale plafond in fattura : ") << utilizzo << '\n';
|
||||||
|
msg << (plur ? TR("Le fatture non sono state create.") : TR("La fattura non e' stata creata."));
|
||||||
|
if (str.full())
|
||||||
|
msg << '\n' << str;
|
||||||
|
lerr.log(0, msg);
|
||||||
|
}
|
||||||
|
err &= !ok;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
safe_delete(eld);
|
||||||
delete &eld;
|
|
||||||
if(err)
|
if(err)
|
||||||
{
|
{
|
||||||
lerr.print_or_preview();
|
lerr.print_or_preview();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <reprint.h>
|
#include <reprint.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#include "../cg/cglib01.h"
|
#include "../cg/cglib.h"
|
||||||
#include "../mg/mglib.h"
|
#include "../mg/mglib.h"
|
||||||
|
|
||||||
#include "ve6.h"
|
#include "ve6.h"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
|
|
||||||
#include "../cg/cg2103.h"
|
#include "../cg/cglib.h"
|
||||||
#include "../mg/anamag.h"
|
#include "../mg/anamag.h"
|
||||||
|
|
||||||
#include <mov.h>
|
#include <mov.h>
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
// Controlla se lo stato ed il tipo del documento sono validi e rispettano la selezione
|
// Controlla se lo stato ed il tipo del documento sono validi e rispettano la selezione
|
||||||
bool doc_tipo_stato_ok(const TRectype& doc);
|
bool doc_tipo_stato_ok(const TRectype& doc);
|
||||||
// Constructor and Distructor
|
// Constructor and Distructor
|
||||||
TEliminazione_documenti_mask(): TAutomask("ve61000a") {}
|
TEliminazione_documenti_mask(): TAutomask("ve6b00a") {}
|
||||||
~TEliminazione_documenti_mask() {}
|
~TEliminazione_documenti_mask() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,7 +58,9 @@ class TSelect_color_mask;
|
|||||||
#include <rdoc.h>
|
#include <rdoc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <map>
|
#ifndef __LILIB01_H
|
||||||
|
#include "../li/lilib01.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define RIGA_MERCE 'M'
|
#define RIGA_MERCE 'M'
|
||||||
#define RIGA_SPESEDOC 'S'
|
#define RIGA_SPESEDOC 'S'
|
||||||
@ -710,9 +712,7 @@ public:
|
|||||||
|
|
||||||
TRiga_documento(TDocumento* doc, const char* tipo = NULL);
|
TRiga_documento(TDocumento* doc, const char* tipo = NULL);
|
||||||
TRiga_documento(const TRiga_documento & row);
|
TRiga_documento(const TRiga_documento & row);
|
||||||
/* Maialata inguardabile: guai a chi la riporta!
|
virtual ~TRiga_documento() {}
|
||||||
TRiga_documento(const TRiga_documento& rec, TDocumento* doc, const char* tipo = NULL); */
|
|
||||||
virtual ~TRiga_documento() {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TTipo_importo { _lordo, _netto, _imposta };
|
enum TTipo_importo { _lordo, _netto, _imposta };
|
||||||
@ -772,6 +772,7 @@ class TDocumento : public TMultiple_rectype // velib03
|
|||||||
char _stato_originale;
|
char _stato_originale;
|
||||||
|
|
||||||
TCli_for _cli_for;
|
TCli_for _cli_for;
|
||||||
|
TLi_manager *_plafond;
|
||||||
TOccasionale _occas;
|
TOccasionale _occas;
|
||||||
TPagamento _pag;
|
TPagamento _pag;
|
||||||
TAssoc_array _tabella_iva; // tabella di imponibili ed imposte
|
TAssoc_array _tabella_iva; // tabella di imponibili ed imposte
|
||||||
@ -842,6 +843,9 @@ public:
|
|||||||
const TRiepilogo_iva * riepilogo_iva(const char * cod) const { return (const TRiepilogo_iva *) _tabella_iva.objptr(cod); }
|
const TRiepilogo_iva * riepilogo_iva(const char * cod) const { return (const TRiepilogo_iva *) _tabella_iva.objptr(cod); }
|
||||||
const TRiepilogo_iva * riepilogo_iva(int index) const { return (index >= 0 && index < _cod_iva.items()) ? riepilogo_iva(_cod_iva.row(index)) : NULL; }
|
const TRiepilogo_iva * riepilogo_iva(int index) const { return (index >= 0 && index < _cod_iva.items()) ? riepilogo_iva(_cod_iva.row(index)) : NULL; }
|
||||||
TCli_for& clifor(bool force_reload = false) const;
|
TCli_for& clifor(bool force_reload = false) const;
|
||||||
|
TLi_manager & plafond(bool force_reload = false);
|
||||||
|
const real importo_plafond() const;
|
||||||
|
const real importo_plafond_salvato() const;
|
||||||
TOccasionale& occas() const;
|
TOccasionale& occas() const;
|
||||||
const TAgente& agente(bool first = true) const;
|
const TAgente& agente(bool first = true) const;
|
||||||
const TString& riferimento(TString& rif) const { return tipo().riferimento(*this, rif); }
|
const TString& riferimento(TString& rif) const { return tipo().riferimento(*this, rif); }
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#include "velib.h"
|
#include "../cg/cglib.h"
|
||||||
|
|
||||||
#include "../db/dblib.h"
|
#include "../db/dblib.h"
|
||||||
#include "../pr/prlib.h"
|
#include "../pr/prlib.h"
|
||||||
#include "../li/letint.h"
|
#include "../li/letint.h"
|
||||||
@ -18,11 +17,11 @@
|
|||||||
#include <causali.h>
|
#include <causali.h>
|
||||||
|
|
||||||
#include "veini.h"
|
#include "veini.h"
|
||||||
|
#include "velib.h"
|
||||||
#include "sconti.h"
|
#include "sconti.h"
|
||||||
#include "vepriv.h"
|
#include "vepriv.h"
|
||||||
#include "veuml.h"
|
#include "veuml.h"
|
||||||
#include <set>
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TTipo_documento_cache
|
// TTipo_documento_cache
|
||||||
@ -252,6 +251,7 @@ void TDocumento::init()
|
|||||||
_codcf = new TRecfield(*this, DOC_CODCF);
|
_codcf = new TRecfield(*this, DOC_CODCF);
|
||||||
_cod_occas = new TRecfield(*this, DOC_OCFPI);
|
_cod_occas = new TRecfield(*this, DOC_OCFPI);
|
||||||
|
|
||||||
|
_plafond = nullptr;
|
||||||
_sconto = _esenzione = _valfisc = nullptr;
|
_sconto = _esenzione = _valfisc = nullptr;
|
||||||
_stato_originale = ' ';
|
_stato_originale = ' ';
|
||||||
_dirty_deny = false;
|
_dirty_deny = false;
|
||||||
@ -309,6 +309,7 @@ TDocumento::~TDocumento()
|
|||||||
safe_delete(_sconto);
|
safe_delete(_sconto);
|
||||||
safe_delete(_esenzione);
|
safe_delete(_esenzione);
|
||||||
safe_delete(_valfisc);
|
safe_delete(_valfisc);
|
||||||
|
safe_delete(_plafond);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TString& TDocumento::codiva_spese() const
|
const TString& TDocumento::codiva_spese() const
|
||||||
@ -935,23 +936,17 @@ void TDocumento::set_riga_sconto()
|
|||||||
|
|
||||||
void TDocumento::update_esenzione()
|
void TDocumento::update_esenzione()
|
||||||
{
|
{
|
||||||
if (clifor().use_lettere())
|
if (!clifor().use_lettere())
|
||||||
{
|
{
|
||||||
bool to_update = false;
|
bool to_update = false;
|
||||||
const TString4 codiva = codesiva();
|
const TString4 codiva = codesiva();
|
||||||
for (int i = physical_rows(); !to_update && i > 0; i--)
|
|
||||||
{
|
|
||||||
const TString & cod = row(i).get(RDOC_CODIVA);
|
|
||||||
to_update = cod.full() && cod != codiva;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (to_update)
|
for (int i = physical_rows(); i > 0; i--)
|
||||||
for (int i = physical_rows(); i > 0; i--)
|
|
||||||
{
|
{
|
||||||
TRiga_documento & rdoc = row(i);
|
TRiga_documento & rdoc = row(i);
|
||||||
const TString& cod = rdoc.get(RDOC_CODIVA);
|
const TString& cod = rdoc.get(RDOC_CODIVA);
|
||||||
|
|
||||||
if (cod.full())
|
if (cod.blank())
|
||||||
{
|
{
|
||||||
if (codiva.full())
|
if (codiva.full())
|
||||||
rdoc.put(RDOC_CODIVA, codiva);
|
rdoc.put(RDOC_CODIVA, codiva);
|
||||||
@ -995,78 +990,71 @@ void TDocumento::update_esenzione()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDocumento::set_riga_esenzione()
|
void TDocumento::set_riga_esenzione()
|
||||||
{
|
{
|
||||||
TCli_for & c = clifor();
|
TCli_for & c = clifor();
|
||||||
const TCodiceIVA codes(c.vendite().get(CFV_ASSFIS));
|
|
||||||
TString16 v_esenzione;
|
|
||||||
TString16 v_data_esenzione;
|
|
||||||
TString16 n_registrazione;
|
|
||||||
TString16 n_data_registrazione;
|
|
||||||
const bool multi_plaf = c.use_lettere() && get("PLAFOND").full(); // Gestione multiplafond su documento
|
|
||||||
if (codes.codice().full() && !multi_plaf)
|
|
||||||
{
|
|
||||||
get_protocolli_esenzione(v_esenzione, v_data_esenzione, n_registrazione, n_data_registrazione);
|
|
||||||
}
|
|
||||||
// Tradotto: se ha il cod. esenzione AND (i protocolli pieni OR multiplaf)
|
|
||||||
bool esente = codes.tipo().not_empty() && ((v_esenzione.not_empty() &&
|
|
||||||
v_data_esenzione.not_empty() && n_registrazione.not_empty() &&
|
|
||||||
n_data_registrazione.not_empty()) || multi_plaf);
|
|
||||||
if (esente)
|
|
||||||
{
|
|
||||||
esente = false;
|
|
||||||
const TString4 codiva = codes.codice();
|
|
||||||
for (int i = physical_rows(); !esente && i > 0; i--)
|
|
||||||
esente = row(i).get(RDOC_CODIVA) == codiva;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!esente)
|
if (c.use_lettere())
|
||||||
{
|
{
|
||||||
if (_esenzione != NULL)
|
const TCodiceIVA codes(c.vendite().get(CFV_ASSFIS));
|
||||||
{
|
bool esente = false;
|
||||||
delete _esenzione;
|
|
||||||
_esenzione = NULL;
|
if (codes.tipo().not_empty() || iva_plafond().not_empty())
|
||||||
}
|
for (int i = physical_rows(); !esente && i > 0; i--)
|
||||||
}
|
esente = check_iva_plafond(row(i).get(RDOC_CODIVA));
|
||||||
else
|
if (!esente)
|
||||||
{
|
safe_delete(_esenzione);
|
||||||
static TString4 _tipo_riga_es;
|
else
|
||||||
static TString80 _des_esenz;
|
|
||||||
static real _bollo_es;
|
|
||||||
if (_tipo_riga_es.empty())
|
|
||||||
{
|
|
||||||
TConfig conf(CONFIG_STUDIO, "ve");
|
|
||||||
_tipo_riga_es = conf.get("TRESENZ", "ve");
|
|
||||||
_bollo_es = (real)conf.get("BOLLIES", "ve");
|
|
||||||
if (_tipo_riga_es.empty())
|
|
||||||
{
|
|
||||||
_tipo_riga_es = "05";
|
|
||||||
conf.set("TRESENZ", _tipo_riga_es);
|
|
||||||
warning_box("Il tipo riga esenzione non risultava impostato.\n L'applicazione userà automaticamente il tipo %s", (const char*) _tipo_riga_es);
|
|
||||||
}
|
|
||||||
_des_esenz = conf.get("DESESENZ", "ve");
|
|
||||||
if (_des_esenz.not_empty())
|
|
||||||
_des_esenz.insert(" ");
|
|
||||||
_des_esenz.insert("Fattura non imponibile");
|
|
||||||
}
|
|
||||||
if (_esenzione == NULL)
|
|
||||||
_esenzione = new TRiga_documento(this, _tipo_riga_es);
|
|
||||||
TString d = _des_esenz;
|
|
||||||
TToken_string le_plafs(get("PLAFOND"), ',');
|
|
||||||
d << (multi_plaf ? " come dalle vostre dichiarazioni:\n" : " come da vostra dichiarazione:\n");
|
|
||||||
for(int i = 0; i < le_plafs.items(); i++)
|
|
||||||
{
|
{
|
||||||
static TToken_string this_plaf; this_plaf.cut(0) << le_plafs.get(i);
|
static TString4 _tipo_riga_es;
|
||||||
static TString key; key.cut(0) << this_plaf.get(0) << "|" << this_plaf.get(1);
|
static TString80 _des_esenz;
|
||||||
TRectype plaf = cache().get(LF_LETINT, key);
|
static real _bollo_es;
|
||||||
d << "N. di protocollo di invio: " << plaf.get(LETINT_PROTINTF) << "-" << plaf.get(LETINT_PROTINTS) << " del " << plaf.get(LETINT_VSDATA) << "\n";
|
|
||||||
|
if (_tipo_riga_es.empty())
|
||||||
|
{
|
||||||
|
TConfig conf(CONFIG_STUDIO, "ve");
|
||||||
|
_tipo_riga_es = conf.get("TRESENZ", "ve");
|
||||||
|
_bollo_es = (real)conf.get("BOLLIES", "ve");
|
||||||
|
if (_tipo_riga_es.empty())
|
||||||
|
{
|
||||||
|
_tipo_riga_es = "05";
|
||||||
|
conf.set("TRESENZ", _tipo_riga_es);
|
||||||
|
warning_box("Il tipo riga esenzione non risultava impostato.\n L'applicazione userà automaticamente il tipo %s", (const char*)_tipo_riga_es);
|
||||||
|
}
|
||||||
|
_des_esenz = conf.get("DESESENZ", "ve");
|
||||||
|
if (_des_esenz.not_empty())
|
||||||
|
_des_esenz.insert(" ");
|
||||||
|
_des_esenz.insert("Fattura non imponibile");
|
||||||
|
}
|
||||||
|
if (_esenzione == NULL)
|
||||||
|
_esenzione = new TRiga_documento(this, _tipo_riga_es);
|
||||||
|
|
||||||
|
TString d = _des_esenz;
|
||||||
|
TToken_string plafs(get(DOC_PLAFOND), ',');
|
||||||
|
const int items = plafs.items();
|
||||||
|
|
||||||
|
d << (items > 1 ? TR("come dalle vostre dichiarazioni:\n") : TR(" come da vostra dichiarazione:\n"));
|
||||||
|
for (int i = 0; i < items; i++)
|
||||||
|
{
|
||||||
|
TToken_string plaf(plafs.get(i));
|
||||||
|
real utilizzo = plaf.get_real(_plimporto);
|
||||||
|
|
||||||
|
if (utilizzo != ZERO)
|
||||||
|
{
|
||||||
|
|
||||||
|
TToken_string key(plaf.get(_planno)); key.add(plaf.get(_plnumprot));
|
||||||
|
const TRectype & rec_plaf = cache().get(LF_LETINT, key);
|
||||||
|
|
||||||
|
d << TR("N. di protocollo di invio: ") << rec_plaf.get(LETINT_PROTINTF) << TR("-") << rec_plaf.get(LETINT_PROTINTS) << " del " << rec_plaf.get(LETINT_VSDATA) << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_esenzione->set_descr(d);
|
||||||
}
|
}
|
||||||
_esenzione->set_descr(d);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDocumento::set_riga_valfisc()
|
void TDocumento::set_riga_valfisc()
|
||||||
@ -1570,7 +1558,10 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
|||||||
((TDocumento *)this)->put(DOC_DOCEVASO, docevaso); // Tutte le righe evase -> doc evaso
|
((TDocumento *)this)->put(DOC_DOCEVASO, docevaso); // Tutte le righe evase -> doc evaso
|
||||||
} // Almeno una riga aperta -> doc aperto
|
} // Almeno una riga aperta -> doc aperto
|
||||||
|
|
||||||
err = TMultiple_rectype::write_rewrite(f, re);
|
// Aggiunte per il controllo plafond
|
||||||
|
((TDocumento &)*this).plafond().write_rewrite((TDocumento &)*this, re);
|
||||||
|
|
||||||
|
err = TMultiple_rectype::write_rewrite(f, re);
|
||||||
|
|
||||||
if (!doc_bloccato && err == NOERR)
|
if (!doc_bloccato && err == NOERR)
|
||||||
{
|
{
|
||||||
@ -1673,6 +1664,7 @@ int TDocumento::remove(TBaseisamfile& f) const
|
|||||||
TDocumento& myself = *((TDocumento *)this);
|
TDocumento& myself = *((TDocumento *)this);
|
||||||
myself.update_provvigioni(true);
|
myself.update_provvigioni(true);
|
||||||
}
|
}
|
||||||
|
((TDocumento &)*this).plafond().remove((TDocumento &)*this);
|
||||||
}
|
}
|
||||||
return TMultiple_rectype::remove(f);
|
return TMultiple_rectype::remove(f);
|
||||||
}
|
}
|
||||||
@ -2677,21 +2669,25 @@ void TDocumento::put_str(const char* fieldname, const char* val)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
dirty_fields();
|
dirty_fields();
|
||||||
} else
|
|
||||||
if (fn == DOC_CODCF)
|
|
||||||
{
|
|
||||||
const TString8 v(val);
|
|
||||||
put(DOC_SPESEUPD, TRectype::get(DOC_CODCF) == v);
|
|
||||||
TAuto_variable_rectype::put_str(fieldname, v);
|
|
||||||
dirty_fields();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TAuto_variable_rectype::put_str(fieldname, val);
|
|
||||||
dirty_fields();
|
|
||||||
if (fn == DOC_SCONTOPERC)
|
|
||||||
set_riga_sconto();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (fn == DOC_CODCF)
|
||||||
|
{
|
||||||
|
put(DOC_SPESEUPD, TRectype::get(DOC_CODCF) == val);
|
||||||
|
TAuto_variable_rectype::put_str(fieldname, val);
|
||||||
|
dirty_fields();
|
||||||
|
plafond();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TAuto_variable_rectype::put_str(fieldname, val);
|
||||||
|
dirty_fields();
|
||||||
|
if (fn == DOC_SCONTOPERC)
|
||||||
|
set_riga_sconto();
|
||||||
|
else
|
||||||
|
if (fn == DOC_DATADOC)
|
||||||
|
plafond();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TString& TDocumento::get_str(const char* fieldname) const
|
const TString& TDocumento::get_str(const char* fieldname) const
|
||||||
@ -2720,6 +2716,55 @@ TCli_for& TDocumento::clifor(bool force_reload) const
|
|||||||
return cf;
|
return cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const real TDocumento::importo_plafond() const
|
||||||
|
{
|
||||||
|
real importo_plafond;
|
||||||
|
|
||||||
|
FOR_EACH_PHYSICAL_RDOC(*this, r, row)
|
||||||
|
// Se l'iva del documento è diversa non mi interessa
|
||||||
|
if (!row->is_descrizione() && !row->is_descrizione())
|
||||||
|
{
|
||||||
|
const TString & codiva = row->iva().codice();
|
||||||
|
|
||||||
|
if (codiva.full() && check_iva_plafond(codiva))
|
||||||
|
importo_plafond += row->imponibile();
|
||||||
|
}
|
||||||
|
if (is_nota_credito())
|
||||||
|
importo_plafond = -importo_plafond;
|
||||||
|
return importo_plafond;
|
||||||
|
}
|
||||||
|
|
||||||
|
const real TDocumento::importo_plafond_salvato() const
|
||||||
|
{
|
||||||
|
real importo_plafond;
|
||||||
|
TToken_string plafs(get(DOC_PLAFOND), ',');
|
||||||
|
const int items = plafs.items();
|
||||||
|
|
||||||
|
for (int i = 0; i < items; i++)
|
||||||
|
{
|
||||||
|
TToken_string plaf(plafs.get(i));
|
||||||
|
|
||||||
|
importo_plafond += plaf.get_real(_plimporto);
|
||||||
|
}
|
||||||
|
return importo_plafond;
|
||||||
|
}
|
||||||
|
|
||||||
|
TLi_manager & TDocumento::plafond(bool force_reload)
|
||||||
|
{
|
||||||
|
const char tipo = tipocf();
|
||||||
|
const long codice = codcf();
|
||||||
|
const TDate data = get_date(DOC_DATADOC);
|
||||||
|
const int anno = data.year();
|
||||||
|
|
||||||
|
if (_plafond == nullptr)
|
||||||
|
_plafond = new TLi_manager(tipo, codice, anno);
|
||||||
|
else
|
||||||
|
if (force_reload || _plafond->tipo() != tipo || _plafond->codice() != codice ||
|
||||||
|
anno != _plafond->anno())
|
||||||
|
_plafond->read(tipo, codice, anno);
|
||||||
|
return *_plafond;
|
||||||
|
}
|
||||||
|
|
||||||
TOccasionale& TDocumento::occas() const
|
TOccasionale& TDocumento::occas() const
|
||||||
{
|
{
|
||||||
const TString16 occ_code = cod_occas(); // Codice occasionale in testata
|
const TString16 occ_code = cod_occas(); // Codice occasionale in testata
|
||||||
|
@ -436,16 +436,17 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
if (oname == RDOC_CODIVA)
|
if (oname == RDOC_CODIVA)
|
||||||
{
|
{
|
||||||
const TString4 codesiva = campione.codesiva();
|
const TString4 codesiva = campione.codesiva();
|
||||||
|
|
||||||
FOR_EACH_PHYSICAL_RDOC(campione, i, rdoc)
|
FOR_EACH_PHYSICAL_RDOC(campione, i, rdoc)
|
||||||
{
|
{
|
||||||
// Elabora solo righe articolo, spese o prestazioni valide
|
// Elabora solo righe articolo, spese o prestazioni valide
|
||||||
if (!rdoc->is_descrizione())
|
if (!rdoc->is_descrizione() && rdoc->get(RDOC_CODIVA).blank())
|
||||||
{
|
{
|
||||||
if (codesiva.full())
|
if (codesiva.full())
|
||||||
{
|
{
|
||||||
if (rdoc->imponibile().is_zero())
|
/* if (rdoc->imponibile().is_zero())
|
||||||
rdoc->zero(RDOC_CODIVA);
|
rdoc->zero(RDOC_CODIVA);
|
||||||
else
|
else */
|
||||||
rdoc->put(RDOC_CODIVA, codesiva);
|
rdoc->put(RDOC_CODIVA, codesiva);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -552,7 +553,7 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
|
|
||||||
// Aggiungilo alla lista dei documenti in uscita
|
// Aggiungilo alla lista dei documenti in uscita
|
||||||
od = doc_out.add(new_doc);
|
od = doc_out.add(new_doc);
|
||||||
new_doc->put("FATID", od + 1);
|
new_doc->put(DOC_FATID, od + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change_clifo())
|
if (change_clifo())
|
||||||
@ -634,7 +635,7 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
docrefs.destroy(i);
|
docrefs.destroy(i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
d.put("FATID", 0);
|
d.put(DOC_FATID, 0);
|
||||||
}
|
}
|
||||||
for (int i = doc_out.items() - 1; i >= 0; i--) // Aggiorna esenzione
|
for (int i = doc_out.items() - 1; i >= 0; i--) // Aggiorna esenzione
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "../ca/movana.h"
|
#include "../ca/movana.h"
|
||||||
#include "../ca/rmovana.h"
|
#include "../ca/rmovana.h"
|
||||||
#include "../ca/rrip.h"
|
#include "../ca/rrip.h"
|
||||||
#include "../cg/cg2101.h"
|
|
||||||
#include "../cg/cglib.h"
|
#include "../cg/cglib.h"
|
||||||
#include "../mg/anamag.h"
|
#include "../mg/anamag.h"
|
||||||
|
|
||||||
|
@ -2036,23 +2036,6 @@ bool codartmag_handler( TMask_field& f, KEY key )
|
|||||||
{
|
{
|
||||||
TMask & m = f.mask();
|
TMask & m = f.mask();
|
||||||
|
|
||||||
/* Modo vecchio con funzionamento dubbiamente legato a !mask.is_running
|
|
||||||
TSheet_field& s = *m.get_sheet();
|
|
||||||
TDocumento_mask& mask= (TDocumento_mask&)s.mask();
|
|
||||||
|
|
||||||
bool to_check = key == K_TAB && f.focusdirty();
|
|
||||||
if (!to_check)
|
|
||||||
to_check = !mask.is_running();
|
|
||||||
|
|
||||||
if (to_check)
|
|
||||||
{
|
|
||||||
const bool artmag = !f.empty() && TRiga_documento::tipo(m.get(FR_TIPORIGA)).is_merce();
|
|
||||||
m.show(FR_UMQTA, artmag);
|
|
||||||
m.show(FR_UMQTA2, !artmag);
|
|
||||||
mask.update_giacenza();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (key == K_TAB)
|
if (key == K_TAB)
|
||||||
{
|
{
|
||||||
// const bool artmag = !f.empty() && TRiga_documento::tipo(m.get(FR_TIPORIGA)).is_merce();
|
// const bool artmag = !f.empty() && TRiga_documento::tipo(m.get(FR_TIPORIGA)).is_merce();
|
||||||
@ -2068,7 +2051,6 @@ bool codartmag_handler( TMask_field& f, KEY key )
|
|||||||
mask.update_giacenza();
|
mask.update_giacenza();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ bool pricerange_handler(TMask_field& f, KEY key );
|
|||||||
bool link_handler( TMask_field& f, KEY key );
|
bool link_handler( TMask_field& f, KEY key );
|
||||||
bool cdc_mag_handler(TMask_field& f, KEY key);
|
bool cdc_mag_handler(TMask_field& f, KEY key);
|
||||||
bool cms_mag_handler(TMask_field& f, KEY key);
|
bool cms_mag_handler(TMask_field& f, KEY key);
|
||||||
bool evasion_check_handler( TMask_field& f, KEY key );
|
bool evasion_check_handler(TMask_field& f, KEY key );
|
||||||
bool distinta_link_handler(TMask_field& f, KEY key );
|
bool distinta_link_handler(TMask_field& f, KEY key );
|
||||||
bool gen_livelli_handler(TMask_field& f, KEY key );
|
bool gen_livelli_handler(TMask_field& f, KEY key );
|
||||||
bool peso_conai_handler(TMask_field& f, KEY key );
|
bool peso_conai_handler(TMask_field& f, KEY key );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user