Patch level : 12.0 932
Files correlati : ve6.exe Commento : Corretta data inizializzazione oggetto per dichiarazione d'intento: problema a cavallo d'anno che non becca l'anno giusto
This commit is contained in:
parent
5a7d48435d
commit
0cbbbc42c5
@ -44,37 +44,37 @@ bool TFatturazione_bolle_app::process(TProgress_monitor& iw, TElaborazione & eld
|
|||||||
create_tipi_stati(tipi, stati);
|
create_tipi_stati(tipi, stati);
|
||||||
int clifo = din[0].clifor().codice();
|
int clifo = din[0].clifor().codice();
|
||||||
|
|
||||||
TDate aData(TODAY);
|
TDate aData(data_elab);
|
||||||
TLi_manager currentCli('C', clifo, aData); // Inizializzo l'oggetto per la gestione del plafond
|
TLi_manager currentCli('C', clifo, aData); // Inizializzo l'oggetto per la gestione del plafond
|
||||||
real plafond, res_plafond, tot_fat;
|
real plafond, res_plafond, tot_fat;
|
||||||
if (currentCli.has_valid_plafond())
|
if (currentCli.has_valid_plafond())
|
||||||
{
|
{
|
||||||
plafond = currentCli.get_plafond();
|
plafond = currentCli.get_plafond();
|
||||||
res_plafond = plafond - currentCli.elab_util(tipi, stati, aData);
|
res_plafond = plafond - currentCli.elab_util(tipi, stati, aData);
|
||||||
for (int i = 0; i < din.items(); ++i)
|
for (int i = 0; i < din.items(); ++i)
|
||||||
tot_fat += din[i].totale_doc();
|
tot_fat += din[i].totale_doc();
|
||||||
|
|
||||||
TLog_report lerr;
|
TLog_report lerr;
|
||||||
if (tot_fat > res_plafond)
|
if (tot_fat > res_plafond)
|
||||||
{
|
{
|
||||||
bool plur = din.items() > 1;
|
bool plur = din.items() > 1;
|
||||||
TString err;
|
TString err;
|
||||||
err << "Errore durante la generazione del plafond:\n" <<
|
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"
|
(plur ? "I documenti da elaborare superano" : "Il documento da elaborare supera") << " il plafond per questo cliente.\n"
|
||||||
"Plafond rimanente: %s\n" <<
|
"Plafond rimanente: %s\n" <<
|
||||||
(plur ? "Totale fatture: %s\n" : "Totale fattura: %s\n") <<
|
(plur ? "Totale fatture: %s\n" : "Totale fattura: %s\n") <<
|
||||||
(plur ? "Le fatture non sono state create." : "La fattura non e' stata creata.");
|
(plur ? "Le fatture non sono state create." : "La fattura non e' stata creata.");
|
||||||
return error_box(err, res_plafond.string(), tot_fat.string());
|
return error_box(err, res_plafond.string(), tot_fat.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Una volta che di documenti sono elaborati ci scrivo sopra il valore del plafond
|
// Una volta che di documenti sono elaborati ci scrivo sopra il valore del plafond
|
||||||
scrivi_plafond(dout, data_elab);
|
scrivi_plafond(dout, data_elab);
|
||||||
//if (!popola_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");
|
// return error_box("Errore durante la generazione del plafond, le fatture non son state create");
|
||||||
//}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int err = dout.write(); // Scrive documenti di output
|
int err = dout.write(); // Scrive documenti di output
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
@ -144,7 +144,7 @@ void TFatturazione_bolle_app::process_by_cli(const TMask& m)
|
|||||||
if (!iw.add_status())
|
if (!iw.add_status())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delete &eld;
|
delete &eld;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFatturazione_bolle_app::process_by_ragsoc(const TMask& m)
|
void TFatturazione_bolle_app::process_by_ragsoc(const TMask& m)
|
||||||
@ -202,7 +202,7 @@ void TFatturazione_bolle_app::process_by_ragsoc(const TMask& m)
|
|||||||
if (!iw.add_status())
|
if (!iw.add_status())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delete e;
|
delete e;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ void TFatturazione_bolle_app::process_by_doc(const TMask& m)
|
|||||||
iw.set_text(msg); // Messaggio sul cliente
|
iw.set_text(msg); // Messaggio sul cliente
|
||||||
do_events(); // Attende visualizzazione
|
do_events(); // Attende visualizzazione
|
||||||
|
|
||||||
TLista_documenti list;
|
TLista_documenti list;
|
||||||
list.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
|
list.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
|
||||||
|
|
||||||
for (int i = list.items()-1; i >= 0; i--)
|
for (int i = list.items()-1; i >= 0; i--)
|
||||||
@ -274,7 +274,7 @@ void TFatturazione_bolle_app::process_by_doc(const TMask& m)
|
|||||||
}
|
}
|
||||||
const int items = list.items();
|
const int items = list.items();
|
||||||
for (int j = 0; j < items; j++)
|
for (int j = 0; j < items; j++)
|
||||||
din.add(list[j]);
|
din.add(list[j]);
|
||||||
|
|
||||||
if (!iw.add_status())
|
if (!iw.add_status())
|
||||||
break;
|
break;
|
||||||
@ -285,7 +285,7 @@ void TFatturazione_bolle_app::process_by_doc(const TMask& m)
|
|||||||
din.sort(DOC_ZONA "|" DOC_DATADOC "|" DOC_NDOC);
|
din.sort(DOC_ZONA "|" DOC_DATADOC "|" DOC_NDOC);
|
||||||
process(iw, eld, din, data_elab);
|
process(iw, eld, din, data_elab);
|
||||||
}
|
}
|
||||||
delete e;
|
delete e;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFatturazione_bolle_app::process_by_fatt(const TMask& m)
|
void TFatturazione_bolle_app::process_by_fatt(const TMask& m)
|
||||||
@ -400,166 +400,166 @@ void TFatturazione_bolle_app::process_by_fatt(const TMask& m)
|
|||||||
if (din.items() > 0 && !iw.is_cancelled())
|
if (din.items() > 0 && !iw.is_cancelled())
|
||||||
process(iw, eld, din, data_elab);
|
process(iw, eld, din, data_elab);
|
||||||
|
|
||||||
delete e;
|
delete e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Effettuo un test per i clienti che hanno un plafond attivo, se trovo delle bolle che fuoriescono chiedo se continuare
|
// Effettuo un test per i clienti che hanno un plafond attivo, se trovo delle bolle che fuoriescono chiedo se continuare
|
||||||
bool TFatturazione_bolle_app::test_dicint(const TMask& m)
|
bool TFatturazione_bolle_app::test_dicint(const TMask& m)
|
||||||
{
|
{
|
||||||
const TDate data_elab = m.get_date(F_DATA_ELAB);
|
const TDate data_elab = m.get_date(F_DATA_ELAB);
|
||||||
const int anno = data_elab.year();
|
const int anno = data_elab.year();
|
||||||
|
|
||||||
const long dc = m.get_long(F_CODICE_CLIFO_DA);
|
const long dc = m.get_long(F_CODICE_CLIFO_DA);
|
||||||
const long ac = m.get_long(F_CODICE_CLIFO_A);
|
const long ac = m.get_long(F_CODICE_CLIFO_A);
|
||||||
const int da = m.get_int(F_CODICE_AGENTE_DA);
|
const int da = m.get_int(F_CODICE_AGENTE_DA);
|
||||||
const int aa = m.get_int(F_CODICE_AGENTE_A);
|
const int aa = m.get_int(F_CODICE_AGENTE_A);
|
||||||
const TString16 dz(m.get(F_CODICE_ZONA_DA));
|
const TString16 dz(m.get(F_CODICE_ZONA_DA));
|
||||||
const TString16 az(m.get(F_CODICE_ZONA_A));
|
const TString16 az(m.get(F_CODICE_ZONA_A));
|
||||||
|
|
||||||
const TDate dd = m.get_date(F_DATA_DOCUMENTO_DA);
|
const TDate dd = m.get_date(F_DATA_DOCUMENTO_DA);
|
||||||
TString st_da = m.get(F_DATA_DOCUMENTO_A); // qui verificare
|
TString st_da = m.get(F_DATA_DOCUMENTO_A); // qui verificare
|
||||||
const TDate ad = st_da.not_empty() ? (TDate)(const char*)st_da : data_elab;
|
const TDate ad = st_da.not_empty() ? (TDate)(const char*)st_da : data_elab;
|
||||||
const TString& codnum = m.get(F_CODICE_NUMERAZIONE);
|
const TString& codnum = m.get(F_CODICE_NUMERAZIONE);
|
||||||
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);
|
||||||
|
|
||||||
const int tot_cli = clienti.leggi_doc(eld, dd, ad, dc, ac, da, aa, dz, az);
|
const int tot_cli = clienti.leggi_doc(eld, dd, ad, dc, ac, da, aa, dz, az);
|
||||||
|
|
||||||
TString msg(80);
|
TString msg(80);
|
||||||
|
|
||||||
|
|
||||||
TLog_report lerr(TR("Errori controllo plafond e CONAI"));
|
TLog_report lerr(TR("Errori controllo plafond e CONAI"));
|
||||||
lerr.log(0,"\n");
|
lerr.log(0,"\n");
|
||||||
bool err = false;
|
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 currentCli(tipocf, codcli, ad); // Inizializzo l'oggetto per la gestione del plafond
|
TLi_manager currentCli(tipocf, codcli, ad); // Inizializzo l'oggetto per la gestione del plafond
|
||||||
|
|
||||||
if (currentCli.has_valid_plafond())
|
if (currentCli.has_valid_plafond())
|
||||||
{
|
{
|
||||||
TLista_documenti din; // Legge tutti i documenti di input
|
TLista_documenti din; // Legge tutti i documenti di input
|
||||||
din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
|
din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
|
||||||
if (din.items() > 0)
|
if (din.items() > 0)
|
||||||
{
|
{
|
||||||
err |= currentCli.test_plafond(din, lerr);
|
err |= currentCli.test_plafond(din, lerr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete &eld;
|
delete &eld;
|
||||||
if(err)
|
if(err)
|
||||||
{
|
{
|
||||||
lerr.print_or_preview();
|
lerr.print_or_preview();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Effettuo un test per i clienti che hanno un plafond attivo, se trovo delle bolle che fuoriescono chiedo se continuare
|
// Effettuo un test per i clienti che hanno un plafond attivo, se trovo delle bolle che fuoriescono chiedo se continuare
|
||||||
bool TFatturazione_bolle_app::test_CONAI(const TMask& m)
|
bool TFatturazione_bolle_app::test_CONAI(const TMask& m)
|
||||||
{
|
{
|
||||||
const TDate data_elab = m.get_date(F_DATA_ELAB);
|
const TDate data_elab = m.get_date(F_DATA_ELAB);
|
||||||
const int anno = data_elab.year();
|
const int anno = data_elab.year();
|
||||||
|
|
||||||
const long dc = m.get_long(F_CODICE_CLIFO_DA);
|
const long dc = m.get_long(F_CODICE_CLIFO_DA);
|
||||||
const long ac = m.get_long(F_CODICE_CLIFO_A);
|
const long ac = m.get_long(F_CODICE_CLIFO_A);
|
||||||
const int da = m.get_int(F_CODICE_AGENTE_DA);
|
const int da = m.get_int(F_CODICE_AGENTE_DA);
|
||||||
const int aa = m.get_int(F_CODICE_AGENTE_A);
|
const int aa = m.get_int(F_CODICE_AGENTE_A);
|
||||||
const TString16 dz(m.get(F_CODICE_ZONA_DA));
|
const TString16 dz(m.get(F_CODICE_ZONA_DA));
|
||||||
const TString16 az(m.get(F_CODICE_ZONA_A));
|
const TString16 az(m.get(F_CODICE_ZONA_A));
|
||||||
|
|
||||||
const TDate dd = m.get_date(F_DATA_DOCUMENTO_DA);
|
const TDate dd = m.get_date(F_DATA_DOCUMENTO_DA);
|
||||||
TString st_da = m.get(F_DATA_DOCUMENTO_A); // qui verificare
|
TString st_da = m.get(F_DATA_DOCUMENTO_A); // qui verificare
|
||||||
const TDate ad = st_da.not_empty() ? (TDate)(const char*)st_da : data_elab;
|
const TDate ad = st_da.not_empty() ? (TDate)(const char*)st_da : data_elab;
|
||||||
const TString& codnum = m.get(F_CODICE_NUMERAZIONE);
|
const TString& codnum = m.get(F_CODICE_NUMERAZIONE);
|
||||||
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);
|
||||||
|
|
||||||
const int tot_cli = clienti.leggi_doc(eld, dd, ad, dc, ac, da, aa, dz, az);
|
const int tot_cli = clienti.leggi_doc(eld, dd, ad, dc, ac, da, aa, dz, az);
|
||||||
TString msg(80);
|
TString msg(80);
|
||||||
|
|
||||||
TLog_report lerr(TR("Errori controllo CONAI"));
|
TLog_report lerr(TR("Errori controllo CONAI"));
|
||||||
lerr.log(0, "\n");
|
lerr.log(0, "\n");
|
||||||
bool err = false;
|
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
|
||||||
TConai conai;
|
TConai conai;
|
||||||
|
|
||||||
{
|
{
|
||||||
TLista_documenti din; // Legge tutti i documenti di input
|
TLista_documenti din; // Legge tutti i documenti di input
|
||||||
|
|
||||||
din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
|
din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
|
||||||
|
|
||||||
const int nbolle = din.items();
|
const int nbolle = din.items();
|
||||||
|
|
||||||
for (int b = 0; b < nbolle; b++)
|
for (int b = 0; b < nbolle; b++)
|
||||||
{
|
{
|
||||||
TDocumento & bolla = din[b];
|
TDocumento & bolla = din[b];
|
||||||
const int nrows = bolla.physical_rows();
|
const int nrows = bolla.physical_rows();
|
||||||
|
|
||||||
for (int r = 1; r <= nrows; r++)
|
for (int r = 1; r <= nrows; r++)
|
||||||
{
|
{
|
||||||
TRiga_documento & row = bolla[r];
|
TRiga_documento & row = bolla[r];
|
||||||
|
|
||||||
msg.format("Cliente %ld Bolla %ld Riga %d - ",
|
msg.format("Cliente %ld Bolla %ld Riga %d - ",
|
||||||
bolla.get_long(DOC_CODCF),
|
bolla.get_long(DOC_CODCF),
|
||||||
bolla.get_long(DOC_NDOC),
|
bolla.get_long(DOC_NDOC),
|
||||||
row.get_int(RDOC_NRIGA));
|
row.get_int(RDOC_NRIGA));
|
||||||
for (int i = 1; i <= FR_CMAX; i++)
|
for (int i = 1; i <= FR_CMAX; i++)
|
||||||
{
|
{
|
||||||
const TString8 sottocat = row.get(conai_sottocat_name(i));
|
const TString8 sottocat = row.get(conai_sottocat_name(i));
|
||||||
|
|
||||||
if (sottocat.full())
|
if (sottocat.full())
|
||||||
{
|
{
|
||||||
if (!conai.exist_sottocat(sottocat))
|
if (!conai.exist_sottocat(sottocat))
|
||||||
{
|
{
|
||||||
err = true;
|
err = true;
|
||||||
TString msgerr(msg);
|
TString msgerr(msg);
|
||||||
msgerr << format("Sottocategoria CONAI %s assente", (const char *)sottocat);
|
msgerr << format("Sottocategoria CONAI %s assente", (const char *)sottocat);
|
||||||
lerr.log(2, msgerr);
|
lerr.log(2, msgerr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSpesa_prest sp = conai.get_spesa(sottocat);
|
TSpesa_prest sp = conai.get_spesa(sottocat);
|
||||||
|
|
||||||
if (!sp.valid())
|
if (!sp.valid())
|
||||||
{
|
{
|
||||||
err = true;
|
err = true;
|
||||||
TString msgerr(msg);
|
TString msgerr(msg);
|
||||||
msgerr << sp.err_msg();
|
msgerr << sp.err_msg();
|
||||||
lerr.log(2, msgerr);
|
lerr.log(2, msgerr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete &eld;
|
delete &eld;
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
lerr.print_or_preview();
|
lerr.print_or_preview();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TFatturazione_bolle_app::clifo_da_fatt(const TMask& m) const
|
bool TFatturazione_bolle_app::clifo_da_fatt(const TMask& m) const
|
||||||
@ -582,32 +582,32 @@ void TFatturazione_bolle_app::main_loop()
|
|||||||
|
|
||||||
while (m.run() == K_ENTER)
|
while (m.run() == K_ENTER)
|
||||||
{
|
{
|
||||||
if(has_module(LIAUT, CHK_DONGLE) && ini_get_bool(CONFIG_DITTA, "ve", "USELETTERE") && !test_dicint(m)) // Controllo se ho documenti al di fuori del plafond
|
if(has_module(LIAUT, CHK_DONGLE) && ini_get_bool(CONFIG_DITTA, "ve", "USELETTERE") && !test_dicint(m)) // Controllo se ho documenti al di fuori del plafond
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!test_CONAI(m))
|
if (!test_CONAI(m))
|
||||||
continue;
|
continue;
|
||||||
const TString& select_from = m.get(F_SELEZIONE);
|
const TString& select_from = m.get(F_SELEZIONE);
|
||||||
if (select_from != _default_selection)
|
if (select_from != _default_selection)
|
||||||
ini_set_string(CONFIG_DITTA, "ve", "FATBOLSEL", _default_selection = select_from);
|
ini_set_string(CONFIG_DITTA, "ve", "FATBOLSEL", _default_selection = select_from);
|
||||||
|
|
||||||
const TString& orderby = m.get(F_ORDINAMENTO);
|
const TString& orderby = m.get(F_ORDINAMENTO);
|
||||||
if (orderby == "R")
|
if (orderby == "R")
|
||||||
process_by_ragsoc(m);
|
process_by_ragsoc(m);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (clifo_da_fatt(m))
|
if (clifo_da_fatt(m))
|
||||||
{
|
{
|
||||||
process_by_fatt(m);
|
process_by_fatt(m);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (select_from == "D")
|
if (select_from == "D")
|
||||||
process_by_doc(m);
|
process_by_doc(m);
|
||||||
else
|
else
|
||||||
process_by_cli(m);
|
process_by_cli(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user