Patch level :2.2 nopatch per ora

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :aggiunta cancellazione del recordset e del file temporaneo dalla memoria al termine della selezione di una commessa; invertite prima e seconda pagina della maschera; invertita la selezione sulla numerazione documenti (vanno selezionati quelli che NON si vogliono stampare)


git-svn-id: svn://10.65.10.50/trunk@13311 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2005-08-22 15:53:19 +00:00
parent e3da6f6378
commit 43f2aff4be
3 changed files with 129 additions and 152 deletions

View File

@ -73,6 +73,14 @@ bool TPrint_rendiconto_ca_mask::on_field_event(TOperable_field& o, TField_event
{
switch (o.dlg())
{
/* case F_RIGHE:
if (e == fe_init) //azzera le righe dello sheet con le commesse ad inizio programma
{ //esplicita e bizzarra richiesta del CRPA
TSheet_field& s = (TSheet_field&)o;
s.destroy();
s.force_update();
}
break;*/
case F_DATAINI:
case F_DATAFIN:
if (e == fe_close)
@ -266,7 +274,7 @@ TPrint_rendiconto_ca_mask::TPrint_rendiconto_ca_mask()
if (levels >= 2 && pref < levels && esistono_riclassificazioni())
{
enable(F_PIANO);
ca_create_fields(*this, 0, LF_PCONANA, 2, 4, F_PRE1, F_PREDES1, 0x0, PCONANA_CODCONTO);
ca_create_fields(*this, 1, LF_PCONANA, 2, 4, F_PRE1, F_PREDES1, 0x0, PCONANA_CODCONTO);
// Nascondi i campi che non fanno parte del prefisso
for (int i = 0; i < levels; i++)
@ -294,8 +302,8 @@ TPrint_rendiconto_ca_mask::TPrint_rendiconto_ca_mask()
const short a_dlg = g == 5 ? F_PDC1_FIN : F_PAN1_FIN;
const short a_des = g == 5 ? F_PDCDES1_FIN : F_PANDES1_FIN;
const int nfields = ca_create_fields(*this, 0, logicnum, 2, 9, da_dlg, da_des, 0x0, PCONANA_CODCONTO);
ca_create_fields(*this, 0, logicnum, 2, 14, a_dlg, a_des, 0x0, PCONANA_CODCONTO);
const int nfields = ca_create_fields(*this, 1, logicnum, 2, 10, da_dlg, da_des, 0x0, PCONANA_CODCONTO);
ca_create_fields(*this, 1, logicnum, 2, 16, a_dlg, a_des, 0x0, PCONANA_CODCONTO);
for (int i = 0; i < nfields; i++)
{
@ -368,13 +376,15 @@ public:
virtual void set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row);
TPrint_rendiconto_ca_recordset(const TString& sql) : TISAM_recordset(sql), _riclassificato(false) { _tmp = NULL;}
~TPrint_rendiconto_ca_recordset() {}
~TPrint_rendiconto_ca_recordset();
};
static const TPrint_rendiconto_ca_recordset* myself = NULL;
static TPrint_rendiconto_ca_recordset* myself = NULL;
TPrint_rendiconto_ca_recordset::~TPrint_rendiconto_ca_recordset()
{ }
TPrint_rendiconto_ca_recordset* rendiconto_recordset() { return (TPrint_rendiconto_ca_recordset* ) myself;}
void TPrint_rendiconto_ca_recordset::set_custom_filter(TCursor& cur) const
{
@ -412,7 +422,7 @@ void TPrint_rendiconto_ca_recordset::set_custom_filter(TCursor& cur) const
cur.setregion(darec, arec);
cur.setfilter(filtro);
myself = this;
myself = (TPrint_rendiconto_ca_recordset*)this;
//cur.set_filterfunction(mov_filter, true);
}
@ -488,7 +498,7 @@ const TVariant& TPrint_rendiconto_ca_recordset::get(const char* column_name) con
else
conto = TISAM_recordset::get("CONTO").as_string();
var = rendiconto_recordset()->somma_budget(conto, "P");
var = myself->somma_budget(conto, "P");
return var;
}
if (strcmp(column_name, "#VARIAZIONE") == 0)
@ -500,7 +510,7 @@ const TVariant& TPrint_rendiconto_ca_recordset::get(const char* column_name) con
else
conto = TISAM_recordset::get("CONTO").as_string();
var = rendiconto_recordset()->somma_budget(conto, "V");
var = myself->somma_budget(conto, "V");
return var;
}
}
@ -848,83 +858,77 @@ void TPrint_rendiconto_ca_recordset::crea_righe_da_rdoc(const TPrint_rendiconto_
TContabilizzazione_analitica cont_anal; //oggetto necessario per contabilizzare il documento in osservazione
//deve filtrare per i soli documenti con codnum presente nello sheet dei codnum
//inizialmente il filtro di scansione delle righedoc coincide con quello sulle date
TString filtro = filtro_date;
//deve filtrare i soli documenti con codnum NON presente nello sheet dei codnum
TSheet_field& sheet = msk.sfield(F_RIGHE_NUM);
FOR_EACH_SHEET_ROW(sheet, r, row)
{
const TString4 codnum(row->get(0)); //prende il codice numerazione sulla riga
if (anno > 0) //se c'e' l'anno posso aggiungere codnum perchè è il campo successivo sulla chiave
{
dardoc.put(RDOC_CODNUM, codnum);
ardoc.put(RDOC_CODNUM, codnum);
}
//aggiunge il filtro per codice numerazione e stato documento
TString filtro = filtro_date;
//aggiunge al filtro il codice numerazione:
//NON vanno prese le righe dei doc con codnum indicato nello sheet!!
if (filtro.not_empty())
filtro << "&&";
filtro << "(CODNUM==\"" << codnum << "\")";
filtro << "&&(33->STATO>=\"" << row->get(2) << "\")";
filtro << "&&(33->STATO<=\"" << row->get(3) << "\")";
//poi deve aggiungere il filtro per cdc/cms/fas
if (_codcosto.not_empty())
{
if (filtro.not_empty())
filtro << "&&";
filtro << "(" << RDOC_CODCOSTO << "==\"" << _codcosto << "\")";
}
if (_codcms.not_empty())
{
if (filtro.not_empty())
filtro << "&&";
filtro << "(" << RDOC_CODCMS << "==\"" << _codcms << "\")";
}
if (_codfas.not_empty())
{
if (filtro.not_empty())
filtro << "&&";
filtro << "(" << RDOC_FASCMS << "==\"" << _codfas << "\")";
}
//il filtro è completo;può eseguire la scansione
TCursor cur_rdoc(&rel_rdoc, filtro, 1, &dardoc, &ardoc);
const long rdoc_items = cur_rdoc.items();
cur_rdoc.freeze();
if (rdoc_items > 0)
{
TString commento_progind;
commento_progind << "Scansione righe documenti " << codnum << "...";
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
//validi nei filtri impostati dall'utente
for (cur_rdoc = 0; cur_rdoc.pos() < rdoc_items; ++cur_rdoc)
{
pi.addstatus(1);
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;
cont_anal.elabora(doc, 0, NULL, false, mov);
for (int j = 1; j <= mov.rows(); j++)
{
salva_rmovana(mov.body()[j], mov, &doc);
} //for int j...
} //for cur_rdoc..
} //if rdoc_items
filtro << "(CODNUM!=\"" << codnum << "\")";
} //FOR_EACH_SHEET_ROW
//poi deve aggiungere il filtro per cdc/cms/fas
if (_codcosto.not_empty())
{
if (filtro.not_empty())
filtro << "&&";
filtro << "(" << RDOC_CODCOSTO << "==\"" << _codcosto << "\")";
}
if (_codcms.not_empty())
{
if (filtro.not_empty())
filtro << "&&";
filtro << "(" << RDOC_CODCMS << "==\"" << _codcms << "\")";
}
if (_codfas.not_empty())
{
if (filtro.not_empty())
filtro << "&&";
filtro << "(" << RDOC_FASCMS << "==\"" << _codfas << "\")";
}
//il filtro è completo;può eseguire la scansione
TCursor cur_rdoc(&rel_rdoc, filtro, 3, &dardoc, &ardoc);
const long rdoc_items = cur_rdoc.items();
cur_rdoc.freeze();
if (rdoc_items > 0)
{
TProgind pi(rdoc_items, "Scansione righe documenti...");
//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
//validi nei filtri impostati dall'utente
for (cur_rdoc = 0; cur_rdoc.pos() < rdoc_items; ++cur_rdoc)
{
pi.addstatus(1);
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;
cont_anal.elabora(doc, 0, NULL, false, mov);
for (int j = 1; j <= mov.rows(); j++)
{
salva_rmovana(mov.body()[j], mov, &doc);
} //for int j...
} //for cur_rdoc..
} //if rdoc_items
}
@ -965,11 +969,12 @@ void TPrint_rendiconto_ca_recordset::set_filter(const TPrint_rendiconto_ca_mask&
//crea il file .trr in base ai parametri del metodo
crea_trr(trr);
//svuota la memoria dal vecchio file temporaneo
if (_tmp != NULL)
delete _tmp;
_tmp = new TExternisamfile(dbf, trr);
_tmp->zap();
//prende un po' di dati dalla maschera...
_daconto, _aconto, _codcosto = _codcms = _codfas = "";
@ -1030,8 +1035,8 @@ void TPrint_rendiconto_ca_recordset::set_filter(const TPrint_rendiconto_ca_mask&
}
}
}
//metodo per riempire il file
crea_righe_da_rmovana();
//metodi per riempire il file da cui generare il report
//crea_righe_da_rmovana();
crea_righe_da_rdoc(msk);
@ -1059,16 +1064,16 @@ bool TPrint_rendiconto_ca_rep::get_usr_val(const TString& name, TVariant& var) c
bool TPrint_rendiconto_ca_rep::set_recordset(const TString& sql)
{
TPrint_rendiconto_ca_recordset* rs = new TPrint_rendiconto_ca_recordset(sql);
return TReport::set_recordset(rs);
return TAnal_report::set_recordset(rs);
}
void TPrint_rendiconto_ca_rep::set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row)
{
TPrint_rendiconto_ca_recordset* recset = NULL;
TAnal_report::set_recordset(NULL); // Forza azzeramento file Rendy.dbf prima di ricostruirlo
const char* query ="USE 1000\nJOIN MOVANA INTO NUMREG==NUMRD\nJOIN RMOVANA INTO NUMREG==NUMRD NUMRIG==NRIGA";
recset = new TPrint_rendiconto_ca_recordset(query);
TPrint_rendiconto_ca_recordset* recset = new TPrint_rendiconto_ca_recordset(query);
recset->set_filter(msk, cms_row);
TAnal_report::set_recordset(recset);

View File

@ -66,8 +66,6 @@
//elementi dello sheet dei documenti (pag.3)
#define SN_CODNUM 101
#define SN_DESCR 102
#define SN_DASTATO 103
#define SN_ASTATO 104
#endif // __CA3700_H

View File

@ -21,7 +21,7 @@ END
ENDPAGE
PAGE "Conti / Date" -1 -1 78 20
PAGE "CdC/Cms/Fasi / Date" -1 -1 78 20
NUMBER F_CODDITTA 5
BEGIN
@ -48,18 +48,9 @@ BEGIN
FLAGS "A"
END
LIST F_PIANO 1 12
BEGIN
PROMPT 26 2 "Piano dei conti "
ITEM "A|Analitico"
MESSAGE HIDE,5@|SHOW,6@
ITEM "C|Contabile"
MESSAGE HIDE,6@|SHOW,5@
END
NUMBER F_ANNO 4
BEGIN
PROMPT 60 2 "Esercizio "
PROMPT 25 2 "Esercizio "
USE ESC
INPUT CODTAB F_ANNO
DISPLAY "Codice Esercizio" CODTAB
@ -72,22 +63,21 @@ BEGIN
ADD NONE
END
GROUPBOX F_PRE0 76 6
SPREADSHEET F_RIGHE -1 -4
BEGIN
PROMPT 1 3 "@bPrefisso del piano dei conti analitico:"
GROUP 6
END
GROUPBOX F_PDC0_INI 76 6
BEGIN
PROMPT 1 8 "@bDa conto:"
GROUP 4
END
GROUPBOX F_PDC0_FIN 76 6
BEGIN
PROMPT 1 13 "@bA conto:"
GROUP 4
PROMPT 0 4 "Centro di Costo / Commessa / Fase"
ITEM "Cdc1"
ITEM "Cdc2"
ITEM "Cdc3"
ITEM "Cdc4"
ITEM "Cdc5"
ITEM "Cdc6"
ITEM "Cdc7"
ITEM "Cdc8"
ITEM "Cdc9"
ITEM "Cdc10"
ITEM "Cdc11"
ITEM "Cdc12"
END
DATE F_DATAINI
@ -109,23 +99,33 @@ END
ENDPAGE
PAGE "CdC / Cms / Fasi" -1 -1 78 20
PAGE "Conti" -1 -1 78 20
SPREADSHEET F_RIGHE -1 -2
LIST F_PIANO 1 12
BEGIN
PROMPT 0 2 ""
ITEM "Cdc1"
ITEM "Cdc2"
ITEM "Cdc3"
ITEM "Cdc4"
ITEM "Cdc5"
ITEM "Cdc6"
ITEM "Cdc7"
ITEM "Cdc8"
ITEM "Cdc9"
ITEM "Cdc10"
ITEM "Cdc11"
ITEM "Cdc12"
PROMPT 1 1 "Piano dei conti "
ITEM "A|Analitico"
MESSAGE HIDE,5@|SHOW,6@
ITEM "C|Contabile"
MESSAGE HIDE,6@|SHOW,5@
END
GROUPBOX F_PRE0 76 6
BEGIN
PROMPT 1 3 "@bPrefisso del piano dei conti analitico:"
GROUP 6
END
GROUPBOX F_PDC0_INI 76 6
BEGIN
PROMPT 1 9 "@bDa conto:"
GROUP 4
END
GROUPBOX F_PDC0_FIN 76 6
BEGIN
PROMPT 1 15 "@bA conto:"
GROUP 4
END
ENDPAGE
@ -137,8 +137,6 @@ BEGIN
PROMPT 1 2 ""
ITEM "Numerazione"
ITEM "Descrizione@50"
ITEM "Da stato"
ITEM "A stato"
END
ENDPAGE
@ -289,30 +287,6 @@ BEGIN
COPY OUTPUT SN_CODNUM
END
STRING SN_DASTATO 1
BEGIN
PROMPT 1 3 "Da stato "
USE %STD
CHECKTYPE REQUIRED
INPUT CODTAB SN_DASTATO
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT SN_DASTATO CODTAB
FLAGS "U"
END
STRING SN_ASTATO 1
BEGIN
PROMPT 1 4 "A stato "
USE %STD
CHECKTYPE REQUIRED
INPUT CODTAB SN_ASTATO
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT SN_ASTATO CODTAB
FLAGS "U"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""