Patch level :2.2 160
Files correlati :ca3700a.rep, ca3.exe Ricompilazione Demo : [ ] Commento :rendiconto: aggiunto il controllo sui documenti con più righe che venivano sovrascritti tante volte quante erano le righe. Aggiunto controllo sulle date nella maschera della stampa mastrini (come quello della stampa mastrini CG e delle altre stampe di analitica) git-svn-id: svn://10.65.10.50/trunk@13300 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
355c9013a3
commit
26ff35b180
@ -3,6 +3,8 @@
|
|||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <reprint.h>
|
#include <reprint.h>
|
||||||
|
|
||||||
|
#include "../cg/cglib01.h"
|
||||||
|
|
||||||
#include "pconana.h"
|
#include "pconana.h"
|
||||||
#include "movana.h"
|
#include "movana.h"
|
||||||
#include "rmovana.h"
|
#include "rmovana.h"
|
||||||
@ -89,6 +91,25 @@ bool TPrint_mastrini_ca_mask::on_field_event(TOperable_field& o, TField_event e,
|
|||||||
return error_box(TR("Impossibile trovare un report compatibile"));
|
return error_box(TR("Impossibile trovare un report compatibile"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case F_DATAINI:
|
||||||
|
case F_DATAFIN:
|
||||||
|
if (e == fe_close)
|
||||||
|
{
|
||||||
|
const int anno = get_int(F_ANNO);
|
||||||
|
if (anno > 0) //se viene selezionato un esercizio..
|
||||||
|
{
|
||||||
|
TEsercizi_contabili esc; //..le date devono essere incluse nell'esercizio selezionato!
|
||||||
|
const TDate data = o.get();
|
||||||
|
if (!data.empty() && esc.date2esc(data) != anno)
|
||||||
|
return error_box(TR("La data deve appartenere all'anno selezionato"));
|
||||||
|
}
|
||||||
|
else //se l'esercizio è vuoto le date diventano obbligatorie!!
|
||||||
|
{
|
||||||
|
if (o.empty())
|
||||||
|
return error_box(TR("La data è obbligatoria in quanto manca l'esercizio"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -206,8 +227,8 @@ TPrint_mastrini_ca_mask::TPrint_mastrini_ca_mask()
|
|||||||
const bool use_pdcc = cfg.get_bool("UsePdcc");
|
const bool use_pdcc = cfg.get_bool("UsePdcc");
|
||||||
|
|
||||||
const int logicnum = use_pdcc ? LF_PCON : LF_PCONANA;
|
const int logicnum = use_pdcc ? LF_PCON : LF_PCONANA;
|
||||||
const int nfields = ca_create_fields(*this, 0, logicnum, 2, 5, F_CDC1_INI, F_DES1_INI, 0x0, "#DACONTO");
|
const int nfields = ca_create_fields(*this, 0, logicnum, 2, 4, F_CDC1_INI, F_DES1_INI, 0x0, "#DACONTO");
|
||||||
ca_create_fields(*this, 0, logicnum, 2, 11, F_CDC1_FIN, F_DES1_FIN, 0x0, "#ACONTO");
|
ca_create_fields(*this, 0, logicnum, 2, 10, F_CDC1_FIN, F_DES1_FIN, 0x0, "#ACONTO");
|
||||||
|
|
||||||
for (int i = 0; i < nfields; i++)
|
for (int i = 0; i < nfields; i++)
|
||||||
{
|
{
|
||||||
|
@ -65,42 +65,42 @@ END
|
|||||||
|
|
||||||
GROUPBOX DLG_NULL 76 6
|
GROUPBOX DLG_NULL 76 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 4 "@bDa:"
|
PROMPT 1 3 "@bDa:"
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 76 6
|
GROUPBOX DLG_NULL 76 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 10 "@bA:"
|
PROMPT 1 9 "@bA:"
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 76 7
|
GROUPBOX DLG_NULL 76 7
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 16 "@bOpzioni stampa"
|
PROMPT 1 15 "@bOpzioni stampa"
|
||||||
END
|
END
|
||||||
|
|
||||||
TEXT 96
|
TEXT 96
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 17 "Dalla data competenza "
|
PROMPT 2 16 "Dalla data competenza "
|
||||||
END
|
END
|
||||||
|
|
||||||
TEXT 97
|
TEXT 97
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 17 "Alla data competenza "
|
PROMPT 40 16 "Alla data competenza "
|
||||||
END
|
END
|
||||||
|
|
||||||
DATE F_DATAINI
|
DATE F_DATAINI
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 26 17 ""
|
PROMPT 26 16 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
DATE F_DATAFIN
|
DATE F_DATAFIN
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 62 17 ""
|
PROMPT 62 16 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST F_TIPOCONTI 24
|
LIST F_TIPOCONTI 24
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 19 "Selezione conti "
|
PROMPT 2 18 "Selezione conti "
|
||||||
ITEM "1|Movimentati nel periodo"
|
ITEM "1|Movimentati nel periodo"
|
||||||
ITEM "2|Con saldo diverso da 0"
|
ITEM "2|Con saldo diverso da 0"
|
||||||
ITEM "3|Tutti"
|
ITEM "3|Tutti"
|
||||||
@ -108,7 +108,7 @@ END
|
|||||||
|
|
||||||
LIST F_TIPIMOV 24
|
LIST F_TIPIMOV 24
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 20 "Selezione movimenti "
|
PROMPT 2 19 "Selezione movimenti "
|
||||||
ITEM " |Qualsiasi"
|
ITEM " |Qualsiasi"
|
||||||
ITEM "N|Normale"
|
ITEM "N|Normale"
|
||||||
ITEM "P|Preventivo e variazione"
|
ITEM "P|Preventivo e variazione"
|
||||||
@ -116,7 +116,7 @@ END
|
|||||||
|
|
||||||
STRING F_REPORT 256 64
|
STRING F_REPORT 256 64
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 21 "Report "
|
PROMPT 2 20 "Report "
|
||||||
FLAGS "B"
|
FLAGS "B"
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
|
111
ca/ca3700.cpp
111
ca/ca3700.cpp
@ -357,8 +357,8 @@ protected:
|
|||||||
bool valid_record(const TRelation& rel) const;
|
bool valid_record(const TRelation& rel) const;
|
||||||
virtual void set_custom_filter(TCursor& cur) const;
|
virtual void set_custom_filter(TCursor& cur) const;
|
||||||
|
|
||||||
void crea_righe_rmovana();
|
void crea_righe_da_rmovana();
|
||||||
void crea_righe_rdoc(const TPrint_rendiconto_ca_mask& msk);
|
void crea_righe_da_rdoc(const TPrint_rendiconto_ca_mask& msk);
|
||||||
void crea_trr(const TFilename& trr) const;
|
void crea_trr(const TFilename& trr) const;
|
||||||
void salva_rmovana(const TRectype& rmovana, const TRectype& movana, const TDocumento* doc);
|
void salva_rmovana(const TRectype& rmovana, const TRectype& movana, const TDocumento* doc);
|
||||||
real somma_budget(const TString& codconto, const char* tipomovana);
|
real somma_budget(const TString& codconto, const char* tipomovana);
|
||||||
@ -507,6 +507,7 @@ const TVariant& TPrint_rendiconto_ca_recordset::get(const char* column_name) con
|
|||||||
return TISAM_recordset::get(column_name);
|
return TISAM_recordset::get(column_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//compila i campi da stampare
|
||||||
void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, const TRectype& movana, const TDocumento* doc)
|
void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, const TRectype& movana, const TDocumento* doc)
|
||||||
{
|
{
|
||||||
//tipo movimento CONSUNTIVO
|
//tipo movimento CONSUNTIVO
|
||||||
@ -515,7 +516,8 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
|
|||||||
{
|
{
|
||||||
TRectype& tmpcurr = _tmp->curr();
|
TRectype& tmpcurr = _tmp->curr();
|
||||||
tmpcurr.zero();
|
tmpcurr.zero();
|
||||||
//compila i campi da stampare
|
TString8 codnum_desc; //codnum da usare sia per compilare il campo "CODNUM"
|
||||||
|
codnum_desc.cut(0);
|
||||||
|
|
||||||
// il conto puo' essere analitico o contabile...
|
// il conto puo' essere analitico o contabile...
|
||||||
//se è compilato l'archivio di collegamento PANAPDC
|
//se è compilato l'archivio di collegamento PANAPDC
|
||||||
@ -600,7 +602,8 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
|
|||||||
//i movimenti possono essere normali o generati da documento...
|
//i movimenti possono essere normali o generati da documento...
|
||||||
if (dadoc) //movimento generato da documento
|
if (dadoc) //movimento generato da documento
|
||||||
{
|
{
|
||||||
tmpcurr.put("CODNUM", movana.get(MOVANA_DCODNUM)); //codnum del documento che origina il movana
|
codnum_desc = movana.get(MOVANA_DCODNUM); //serve anche in fondo al metodo
|
||||||
|
tmpcurr.put("CODNUM", codnum_desc); //codnum del documento che origina il movana
|
||||||
tmpcurr.put("ANNO", movana.get(MOVANA_DANNO)); //anno del doc di origine
|
tmpcurr.put("ANNO", movana.get(MOVANA_DANNO)); //anno del doc di origine
|
||||||
tmpcurr.put("NUMRD", movana.get(MOVANA_DNDOC)); //
|
tmpcurr.put("NUMRD", movana.get(MOVANA_DNDOC)); //
|
||||||
tmpcurr.put("DATA", newdoc->get(DOC_DATADOC)); //data del documento che genera movana..
|
tmpcurr.put("DATA", newdoc->get(DOC_DATADOC)); //data del documento che genera movana..
|
||||||
@ -633,11 +636,11 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
|
|||||||
const TRectype* babbo = riga.find_original_rdoc(); //cerca il doc padre della riga doc attuale
|
const TRectype* babbo = riga.find_original_rdoc(); //cerca il doc padre della riga doc attuale
|
||||||
if (babbo != NULL) //se trova il doc padre..
|
if (babbo != NULL) //se trova il doc padre..
|
||||||
{
|
{
|
||||||
const TString8 codnum = babbo->get(RDOC_CODNUM);
|
const TString8 babbo_codnum = babbo->get(RDOC_CODNUM);
|
||||||
const int anno = babbo->get_int(RDOC_ANNO);
|
const int anno = babbo->get_int(RDOC_ANNO);
|
||||||
const long ndoc = babbo->get_long(RDOC_NDOC);
|
const long ndoc = babbo->get_long(RDOC_NDOC);
|
||||||
riferimento << codnum << '-' << anno << '-' << ndoc;
|
riferimento << babbo_codnum << '-' << anno << '-' << ndoc;
|
||||||
TDocumento doc_babbo('D', anno, codnum, ndoc); //crea una copia del doc padre per prendere..
|
TDocumento doc_babbo('D', anno, babbo_codnum, ndoc); //crea una copia del doc padre per prendere..
|
||||||
tipo_babbo = doc_babbo.tipo().tipo(); //..il tipo documento..
|
tipo_babbo = doc_babbo.tipo().tipo(); //..il tipo documento..
|
||||||
totale_doc_babbo = doc_babbo.totale_doc(); //..il suo totale
|
totale_doc_babbo = doc_babbo.totale_doc(); //..il suo totale
|
||||||
} //if (babbo != NULL)..
|
} //if (babbo != NULL)..
|
||||||
@ -658,14 +661,14 @@ F=IMF*/
|
|||||||
selettore |= IMPEGNATO;
|
selettore |= IMPEGNATO;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TTipo_documento::_fattura: //fattura F -> IMF se non deriva da alcun documento origine
|
case TTipo_documento::_fattura:
|
||||||
selettore = FATTURATO;
|
selettore = FATTURATO; //fattura da bolla FB -> F
|
||||||
if (tipo_babbo == TTipo_documento::_ordine) //fattura da ordine FO -> MF
|
if (tipo_babbo == TTipo_documento::_ordine) //fattura da ordine FO -> MF
|
||||||
{
|
{
|
||||||
selettore |= MATURATO;
|
selettore |= MATURATO;
|
||||||
tmpcurr.put("IMPEGNATO", totale_doc_babbo);
|
tmpcurr.put("IMPEGNATO", totale_doc_babbo);
|
||||||
} else
|
} else
|
||||||
if (tipo_babbo = TTipo_documento::_altro) //fattura senza padri
|
if (tipo_babbo = TTipo_documento::_altro) //fattura senza padri F -> IMF
|
||||||
selettore |= (IMPEGNATO | MATURATO);
|
selettore |= (IMPEGNATO | MATURATO);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -719,24 +722,26 @@ F=IMF*/
|
|||||||
tmpcurr.put("NRIGA", rmovana.get(RMOVANA_NUMRIG)); //numero riga
|
tmpcurr.put("NRIGA", rmovana.get(RMOVANA_NUMRIG)); //numero riga
|
||||||
tmpcurr.put("DESCRIGA", rmovana.get(RMOVANA_DESCR)); //descrizione rmovana
|
tmpcurr.put("DESCRIGA", rmovana.get(RMOVANA_DESCR)); //descrizione rmovana
|
||||||
|
|
||||||
/* int err = _tmp->write(); // aggiunge i record al file temporaneo
|
int err = _tmp->write(); // aggiunge i record al file temporaneo
|
||||||
|
//procedura di controllo della scrittura su file! se il documento è già stato contbilizzato..
|
||||||
|
//..sul file temporaneo esiste già un record con la chiave del record,dovuto al doc,..
|
||||||
|
//..che deve essere qui aggiunto!significa che l'intervallo di stati della numerazione selezionato..
|
||||||
|
//..nello sheet è errato (probabilmente lo stato finale è troppo alto)
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
{
|
{
|
||||||
TString msg;
|
TString msg;
|
||||||
msg.format(FR("Errore di scrittura %d sul file temporaneo\n"), err);
|
msg.format(FR("Errore di scrittura %d sul file temporaneo.\n"), err);
|
||||||
msg << "Documento " <<
|
msg << "Documento " << codnum_desc << " " << descr << " gia' contabilizzato.\nControllare lo stato della numerazione.";
|
||||||
error_box (msg);
|
error_box (msg);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
_tmp->write(); // aggiunge i record al file temporaneo
|
|
||||||
|
|
||||||
if (should_delete)
|
if (should_delete)
|
||||||
delete newdoc;
|
delete newdoc;
|
||||||
} //if (tipomov == ..)
|
} //if (tipomov == ..)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//scanning delle righe dei movimenti di analitica
|
||||||
void TPrint_rendiconto_ca_recordset::crea_righe_rmovana()
|
void TPrint_rendiconto_ca_recordset::crea_righe_da_rmovana()
|
||||||
{
|
{
|
||||||
|
|
||||||
TRelation rel_rmovana(LF_RMOVANA);
|
TRelation rel_rmovana(LF_RMOVANA);
|
||||||
@ -803,8 +808,8 @@ void TPrint_rendiconto_ca_recordset::crea_righe_rmovana()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//scanning delle righe dei documenti
|
||||||
void TPrint_rendiconto_ca_recordset::crea_righe_rdoc(const TPrint_rendiconto_ca_mask& msk)
|
void TPrint_rendiconto_ca_recordset::crea_righe_da_rdoc(const TPrint_rendiconto_ca_mask& msk)
|
||||||
{
|
{
|
||||||
TRelation rel_rdoc(LF_RIGHEDOC);
|
TRelation rel_rdoc(LF_RIGHEDOC);
|
||||||
rel_rdoc.add(LF_DOC, "CODNUM==CODNUM|ANNO==ANNO|PROVV==PROVV|NDOC==NDOC"); //aggiunge le testate
|
rel_rdoc.add(LF_DOC, "CODNUM==CODNUM|ANNO==ANNO|PROVV==PROVV|NDOC==NDOC"); //aggiunge le testate
|
||||||
@ -894,12 +899,22 @@ void TPrint_rendiconto_ca_recordset::crea_righe_rdoc(const TPrint_rendiconto_ca_
|
|||||||
commento_progind << "Scansione righe documenti " << codnum << "...";
|
commento_progind << "Scansione righe documenti " << codnum << "...";
|
||||||
TProgind pi(rdoc_items, commento_progind);
|
TProgind pi(rdoc_items, commento_progind);
|
||||||
|
|
||||||
|
//memorizza l'ultimo doc per evitare doppioni in caso di doc con più righe (rielaborerebbe..
|
||||||
|
//..lo stesso documento tante volte quante sono le sue righe!)
|
||||||
|
TString old_key;
|
||||||
//scanning del file dei documenti alla ricerca di quelli che hanno la data ed il CODNUM
|
//scanning del file dei documenti alla ricerca di quelli che hanno la data ed il CODNUM
|
||||||
//validi nei filtri impostati dall'utente
|
//validi nei filtri impostati dall'utente
|
||||||
for (cur_rdoc = 0; cur_rdoc.pos() < rdoc_items; ++cur_rdoc)
|
for (cur_rdoc = 0; cur_rdoc.pos() < rdoc_items; ++cur_rdoc)
|
||||||
{
|
{
|
||||||
pi.addstatus(1);
|
pi.addstatus(1);
|
||||||
TDocumento doc(cur_rdoc.curr(LF_DOC));
|
const TRectype& curr_doc = cur_rdoc.curr(LF_DOC);
|
||||||
|
const TString curr_key = curr_doc.build_key();
|
||||||
|
if (curr_key == old_key)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
old_key = curr_key;
|
||||||
|
|
||||||
|
TDocumento doc(curr_doc);
|
||||||
TAnal_mov mov;
|
TAnal_mov mov;
|
||||||
cont_anal.elabora(doc, 0, NULL, false, mov);
|
cont_anal.elabora(doc, 0, NULL, false, mov);
|
||||||
for (int j = 1; j <= mov.rows(); j++)
|
for (int j = 1; j <= mov.rows(); j++)
|
||||||
@ -1016,9 +1031,9 @@ void TPrint_rendiconto_ca_recordset::set_filter(const TPrint_rendiconto_ca_mask&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//metodo per riempire il file
|
//metodo per riempire il file
|
||||||
crea_righe_rmovana();
|
crea_righe_da_rmovana();
|
||||||
|
|
||||||
crea_righe_rdoc(msk);
|
crea_righe_da_rdoc(msk);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,53 +1136,3 @@ int ca3700(int argc, char* argv[])
|
|||||||
a.run(argc, argv, TR("Stampa rendiconto"));
|
a.run(argc, argv, TR("Stampa rendiconto"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
//Prototipi di metodi di calcolo (ricordarsi di usare come importi quelli di riga)
|
|
||||||
COMM = impegnato
|
|
||||||
ACEM = maturato
|
|
||||||
CONS = fatturato
|
|
||||||
CNTBZ = checazzoneso
|
|
||||||
|
|
||||||
//Calcolatore per tipi (AN,PN),FM
|
|
||||||
calcolatore (const int tipo, const int classe, const int dare)
|
|
||||||
{
|
|
||||||
const int segno = classe * dare; //essendo classe e dare = + o - 1, il segno lo si ottiene direttamente
|
|
||||||
if (classe == 1 && dare == -1) //unico caso in cui non rispetta il prodotto dei segni
|
|
||||||
{
|
|
||||||
I_ACEM = (I_ACEM - segno * NEW_ACEMVAL) * tipo; //tipo = 1 se AN,PN; = 0 se FM
|
|
||||||
I_STIMA = I_STIMA - segno * NEW_STIMAVAL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
I_ACEM = (I_ACEM + segno * NEW_ACEMVAL) * tipo;
|
|
||||||
I_STIMA = I_STIMA + segno * NEW_STIMAVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//questa è comunque sempre corretta
|
|
||||||
I_CNTBZ = I_CNTBZ + segno * NEW_ICNTBZVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Calcolatore per tipi (OA,OV) -> impegnato, (BA,BV) -> maturato, (FA,FN) -> fatturato,
|
|
||||||
calcolatore (const int tipo)
|
|
||||||
{
|
|
||||||
switch (tipo):
|
|
||||||
case OA:
|
|
||||||
case OV:
|
|
||||||
I_COMM = I_COMM + NEW_COMMVAL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BA:
|
|
||||||
case BV:
|
|
||||||
I_ACEM = I_ACEM + NEW_ACEMVAL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FA:
|
|
||||||
case FN:
|
|
||||||
I_CONS = I_CONS + NEW_CONSVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
Loading…
x
Reference in New Issue
Block a user