Patch level :2.2 160
Files correlati :ca3700a.rep, ca3.exe Ricompilazione Demo : [ ] Commento :rendiconto! seconde modifiche richieste dal CREPA git-svn-id: svn://10.65.10.50/trunk@13298 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
555197d9dd
commit
355c9013a3
136
ca/ca3700.cpp
136
ca/ca3700.cpp
@ -85,6 +85,11 @@ bool TPrint_rendiconto_ca_mask::on_field_event(TOperable_field& o, TField_event
|
||||
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;
|
||||
case F_REPORT:
|
||||
@ -371,17 +376,6 @@ static const TPrint_rendiconto_ca_recordset* myself = NULL;
|
||||
|
||||
TPrint_rendiconto_ca_recordset* rendiconto_recordset() { return (TPrint_rendiconto_ca_recordset* ) myself;}
|
||||
|
||||
/*//metodo per riconoscere se il record corrente soddisfa i filtri della maschera...strafighissimo!
|
||||
bool TPrint_rendiconto_ca_recordset::valid_record(const TRelation& rel) const
|
||||
{
|
||||
return true;
|
||||
}*/
|
||||
|
||||
/*bool TPrint_rendiconto_ca_recordset::mov_filter(const TRelation* rel)
|
||||
{
|
||||
return myself->valid_record(*rel);
|
||||
}*/
|
||||
|
||||
void TPrint_rendiconto_ca_recordset::set_custom_filter(TCursor& cur) const
|
||||
{
|
||||
relation()->replace(_tmp); //sostituisce il vero file rmovana con quello temporaneo
|
||||
@ -597,9 +591,9 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
|
||||
bool should_delete = false;
|
||||
if (newdoc == NULL && movana.get(MOVANA_DNDOC).not_empty())
|
||||
{
|
||||
const TString16 dacodnum = movana.get(MOVANA_DCODNUM);
|
||||
const TString4 dacodnum = movana.get(MOVANA_DCODNUM);
|
||||
newdoc = new TDocumento('D', movana.get_int(MOVANA_DANNO), dacodnum, movana.get_long(MOVANA_DNDOC));
|
||||
should_delete = true;
|
||||
should_delete = true; //settato true per cancellare il doc al termine del metodo(sennò addio memoria!)
|
||||
}
|
||||
const bool dadoc = newdoc != NULL;
|
||||
|
||||
@ -613,12 +607,13 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
|
||||
} //..non esiste il campo in movana
|
||||
else //movimento normale (senza documento)
|
||||
{
|
||||
tmpcurr.put("CODNUM", movana.get(MOVANA_NUMDOC));
|
||||
tmpcurr.put("CODNUM", "");
|
||||
tmpcurr.put("ANNO", movana.get(MOVANA_ANNOES)); //anno del movimento
|
||||
tmpcurr.put("NUMRD", movana.get(MOVANA_NUMREG)); //numreg del movana
|
||||
tmpcurr.put("DATA", movana.get(MOVANA_DATACOMP)); //data del movana
|
||||
}
|
||||
|
||||
//ricerca del mitico documento padre della riga documento attuale!
|
||||
int selettore = 0;
|
||||
if (newdoc != NULL)
|
||||
{
|
||||
@ -626,42 +621,58 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
|
||||
tmpcurr.put("DATADOCRIF", newdoc->get(DOC_DATADOCRIF)); //datadocrif del documento originante il movana
|
||||
|
||||
const int tipo_documento = newdoc->tipo().tipo();
|
||||
int tipo_babbo = 0;
|
||||
int tipo_babbo = TTipo_documento::_altro;
|
||||
|
||||
TString80 riferimento; //stringa su cui scrivere gli estremi del doc padre (se lo trova!)
|
||||
real totale_doc_babbo; //totale del doc padre
|
||||
const int rows = newdoc->physical_rows(); //righe del doc attuale
|
||||
|
||||
TString80 riferimento;
|
||||
const int rows = newdoc->physical_rows();
|
||||
for (int i = 1; riferimento.empty() && i <= rows; i++)
|
||||
{
|
||||
const TRiga_documento& riga = (*newdoc)[i];
|
||||
const TRectype* babbo = riga.find_original_rdoc();
|
||||
if (babbo != NULL)
|
||||
const TRectype* babbo = riga.find_original_rdoc(); //cerca il doc padre della riga doc attuale
|
||||
if (babbo != NULL) //se trova il doc padre..
|
||||
{
|
||||
const TString8 codnum = babbo->get(RDOC_CODNUM);
|
||||
const int anno = babbo->get_int(RDOC_ANNO);
|
||||
const long ndoc = babbo->get_long(RDOC_NDOC);
|
||||
riferimento << codnum << '-' << anno << '-' << ndoc;
|
||||
TDocumento doc_babbo('D', anno, codnum, ndoc);
|
||||
tipo_babbo = doc_babbo.tipo().tipo();
|
||||
}
|
||||
}
|
||||
|
||||
TDocumento doc_babbo('D', anno, codnum, ndoc); //crea una copia del doc padre per prendere..
|
||||
tipo_babbo = doc_babbo.tipo().tipo(); //..il tipo documento..
|
||||
totale_doc_babbo = doc_babbo.totale_doc(); //..il suo totale
|
||||
} //if (babbo != NULL)..
|
||||
} //for (int i..
|
||||
|
||||
/*[Tipo documento] //schema per destinare gli importi nei campi corretti
|
||||
O=I**
|
||||
B=IM*
|
||||
BO=*M*
|
||||
FB=**F
|
||||
FO=*MF
|
||||
F=IMF*/
|
||||
switch (tipo_documento)
|
||||
{
|
||||
case TTipo_documento::_bolla:
|
||||
case TTipo_documento::_bolla: //bolla B -> IM a meno che non sia bolla da ordine BO -> M
|
||||
selettore = MATURATO;
|
||||
if (tipo_babbo != TTipo_documento::_ordine)
|
||||
selettore |= IMPEGNATO;
|
||||
break;
|
||||
case TTipo_documento::_fattura:
|
||||
|
||||
case TTipo_documento::_fattura: //fattura F -> IMF se non deriva da alcun documento origine
|
||||
selettore = FATTURATO;
|
||||
if (tipo_babbo == TTipo_documento::_ordine)
|
||||
if (tipo_babbo == TTipo_documento::_ordine) //fattura da ordine FO -> MF
|
||||
{
|
||||
selettore |= MATURATO;
|
||||
else
|
||||
tmpcurr.put("IMPEGNATO", totale_doc_babbo);
|
||||
} else
|
||||
if (tipo_babbo = TTipo_documento::_altro) //fattura senza padri
|
||||
selettore |= (IMPEGNATO | MATURATO);
|
||||
break;
|
||||
|
||||
case TTipo_documento::_ordine:
|
||||
selettore = IMPEGNATO;
|
||||
break;
|
||||
|
||||
case TTipo_documento::_altro:
|
||||
default:
|
||||
break;
|
||||
@ -669,19 +680,6 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
|
||||
tmpcurr.put("DOCORIG", riferimento);
|
||||
} //if(newdoc != NULL)
|
||||
|
||||
|
||||
//campi comuni
|
||||
tmpcurr.put("DESC", movana.get(MOVANA_DESCR)); //descrizione movana
|
||||
tmpcurr.put("NRIGA", rmovana.get(RMOVANA_NUMRIG)); //numero riga
|
||||
tmpcurr.put("DESCRIGA", rmovana.get(RMOVANA_DESCR)); //descrizione rmovana
|
||||
|
||||
/*[Tipo documento]
|
||||
O=I**
|
||||
B=IM*
|
||||
BO=*M*
|
||||
FB=**F
|
||||
FO=*MF
|
||||
F=IMF*/
|
||||
//****modificare il metodo per accelerare
|
||||
const char sezione = rmovana.get_char(RMOVANA_SEZIONE);
|
||||
|
||||
@ -708,6 +706,28 @@ F=IMF*/
|
||||
if (selettore & IMPEGNATO)
|
||||
tmpcurr.put("IMPEGNATO", imp.valore());
|
||||
|
||||
|
||||
//campi comuni a rmovana e rdoc senza particolari operazioni
|
||||
TString descr = movana.get(MOVANA_DESCR);
|
||||
int pos = descr.find('$'); //solo per il CRPA!
|
||||
if (pos > 0)
|
||||
{
|
||||
descr.ltrim(pos+1);
|
||||
descr.trim();
|
||||
}
|
||||
tmpcurr.put("DESC", descr); //descrizione movana
|
||||
tmpcurr.put("NRIGA", rmovana.get(RMOVANA_NUMRIG)); //numero riga
|
||||
tmpcurr.put("DESCRIGA", rmovana.get(RMOVANA_DESCR)); //descrizione rmovana
|
||||
|
||||
/* int err = _tmp->write(); // aggiunge i record al file temporaneo
|
||||
if (err != NOERR)
|
||||
{
|
||||
TString msg;
|
||||
msg.format(FR("Errore di scrittura %d sul file temporaneo\n"), err);
|
||||
msg << "Documento " <<
|
||||
error_box (msg);
|
||||
}*/
|
||||
|
||||
_tmp->write(); // aggiunge i record al file temporaneo
|
||||
|
||||
if (should_delete)
|
||||
@ -798,14 +818,18 @@ void TPrint_rendiconto_ca_recordset::crea_righe_rdoc(const TPrint_rendiconto_ca_
|
||||
|
||||
//se siamo fortunati l'anno si può trovare così..
|
||||
int anno = msk.get_int(F_ANNO);
|
||||
if (anno == 0 && _dadata.year() == _adata.year())
|
||||
anno = _adata.year();
|
||||
|
||||
if (anno > 0)
|
||||
{
|
||||
dardoc.put(RDOC_ANNO, anno);
|
||||
ardoc.put(RDOC_ANNO, anno);
|
||||
}
|
||||
else
|
||||
{
|
||||
dardoc.put(RDOC_ANNO, _dadata.year());
|
||||
ardoc.put(RDOC_ANNO, _adata.year());
|
||||
if (_dadata.year() == _adata.year())
|
||||
anno = _dadata.year();
|
||||
}
|
||||
|
||||
if (_dadata.ok())
|
||||
filtro_date << "(ANSI(33->DATADOC)>=" << _dadata.date2ansi() << ")";
|
||||
@ -825,12 +849,13 @@ void TPrint_rendiconto_ca_recordset::crea_righe_rdoc(const TPrint_rendiconto_ca_
|
||||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||
{
|
||||
const TString4 codnum(row->get(0)); //prende il codice numerazione sulla riga
|
||||
if (anno > 0)
|
||||
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;
|
||||
if (filtro.not_empty())
|
||||
filtro << "&&";
|
||||
@ -838,6 +863,27 @@ void TPrint_rendiconto_ca_recordset::crea_righe_rdoc(const TPrint_rendiconto_ca_
|
||||
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();
|
||||
|
@ -102,7 +102,7 @@ MESSAGE RESET,F2.103</prescript>
|
||||
<source>ANNO</source>
|
||||
</field>
|
||||
<field x="10" type="Testo" width="1" pattern="1" text="-" />
|
||||
<field x="11" type="Numero" align="right" width="7" pattern="1">
|
||||
<field x="11" type="Stringa" width="7" pattern="1">
|
||||
<source>NUMRD</source>
|
||||
</field>
|
||||
<field x="20" type="Data" width="10" pattern="1">
|
||||
@ -160,15 +160,15 @@ MESSAGE RESET,F2.103</prescript>
|
||||
</field>
|
||||
<field x="123" y="2.5" type="Valuta" align="right" width="15" id="201" pattern="1" text="###.###.###,@@">
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<source>#H101-#101</source>
|
||||
<source>#103-#101</source>
|
||||
</field>
|
||||
<field x="139" y="2.5" type="Valuta" align="right" width="15" id="202" pattern="1" text="###.###.###,@@">
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<source>#H102-#102</source>
|
||||
<source>#103-#102</source>
|
||||
</field>
|
||||
<field x="155" y="2.5" type="Valuta" align="right" width="15" id="203" pattern="1" text="###.###.###,@@">
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<source>#H103-#103</source>
|
||||
<source>#H1.103-#103</source>
|
||||
</field>
|
||||
</section>
|
||||
<sql>USE 1000</sql>
|
||||
|
Loading…
x
Reference in New Issue
Block a user