Patch level :2.2 160

Files correlati     :ca3700a.rep
Ricompilazione Demo : [ ]
Commento            :rendiconto! prime modifiche richieste dal CREPA


git-svn-id: svn://10.65.10.50/trunk@13295 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2005-07-26 17:25:27 +00:00
parent a2691965e6
commit c718396297
3 changed files with 73 additions and 49 deletions

View File

@ -73,6 +73,20 @@ bool TPrint_rendiconto_ca_mask::on_field_event(TOperable_field& o, TField_event
{
switch (o.dlg())
{
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 (esc.date2esc(data) != anno)
return error_box(TR("La data deve appartenere all'anno selezionato"));
}
}
break;
case F_REPORT:
if (e == fe_button)
{
@ -88,7 +102,7 @@ bool TPrint_rendiconto_ca_mask::on_field_event(TOperable_field& o, TField_event
if (e == fe_close)
{
if (!test_compatible_report())
return error_box("Impossibile trovare un report compatibile");
return error_box(TR("Impossibile trovare un report compatibile"));
}
break;
case F_PRE1:
@ -501,19 +515,12 @@ const TVariant& TPrint_rendiconto_ca_recordset::get(const char* column_name) con
void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, const TRectype& movana, const TDocumento* doc)
{
//serve un documento da cui ricavare i parametri di stampa
const bool dadoc = doc != NULL;
TDocumento* newdoc = (TDocumento*)doc;
if (newdoc == NULL && movana.get(MOVANA_DNDOC).not_empty())
{
const TString16 dacodnum = movana.get(MOVANA_DCODNUM);
newdoc = new TDocumento('D', movana.get_int(MOVANA_DANNO), dacodnum, movana.get_long(MOVANA_DNDOC));
}
//tipo movimento CONSUNTIVO
const char tipomov = movana.get_char(MOVANA_TIPOMOV);
if (tipomov <= ' ' || tipomov == 'T')
{
TRectype& tmpcurr = _tmp->curr();
tmpcurr.zero();
//compila i campi da stampare
// il conto puo' essere analitico o contabile...
@ -553,19 +560,19 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
if (current_conto == 0 && current_sottoconto == 0)
{
conto_riclassificato = rec_panapdc.get(PANAPDC_CODCONTO);
_tmp->curr().put("CONTO", conto_riclassificato);
tmpcurr.put("CONTO", conto_riclassificato);
break; //esce dal casino e passa ai campi successivi
}
else if (conto == current_conto && current_sottoconto == 0)
{
conto_riclassificato = rec_panapdc.get(PANAPDC_CODCONTO);
_tmp->curr().put("CONTO", conto_riclassificato);
tmpcurr.put("CONTO", conto_riclassificato);
break; //esce dal casino e passa ai campi successivi
}
else if (conto == current_conto && sottoconto == current_sottoconto)
{
conto_riclassificato = rec_panapdc.get(PANAPDC_CODCONTO);
_tmp->curr().put("CONTO", conto_riclassificato);
tmpcurr.put("CONTO", conto_riclassificato);
break; //esce dal casino e passa ai campi successivi
}
} //for sugli elementi del cursore
@ -580,32 +587,43 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
}
else //...sennò si usa il normale piano dei conti analitico (cioè tutti tranne che il CRPA)
_tmp->curr().put("CONTO", rmovana.get(RMOVANA_CODCONTO)); //conto
tmpcurr.put("CONTO", rmovana.get(RMOVANA_CODCONTO)); //conto
//in ogni caso riempio il campo conto_cg
_tmp->curr().put("CONTOCG", rmovana.get(RMOVANA_CODCONTO)); //conto_cg
tmpcurr.put("CONTOCG", rmovana.get(RMOVANA_CODCONTO)); //conto_cg
//serve un documento da cui ricavare i parametri di stampa
TDocumento* newdoc = (TDocumento*)doc;
bool should_delete = false;
if (newdoc == NULL && movana.get(MOVANA_DNDOC).not_empty())
{
const TString16 dacodnum = movana.get(MOVANA_DCODNUM);
newdoc = new TDocumento('D', movana.get_int(MOVANA_DANNO), dacodnum, movana.get_long(MOVANA_DNDOC));
should_delete = true;
}
const bool dadoc = newdoc != NULL;
//i movimenti possono essere normali o generati da documento...
if (dadoc) //movimento generato da documento
{
_tmp->curr().put("CODNUM", movana.get(MOVANA_DCODNUM)); //codnum del documento che origina il movana
_tmp->curr().put("ANNO", movana.get(MOVANA_DANNO)); //anno del doc di origine
_tmp->curr().put("NUMRD", movana.get(MOVANA_DNDOC)); //numreg del movana
_tmp->curr().put("DATA", movana.get(MOVANA_DATADOC)); //data del documento che genera movana
}
else //movimento normale
tmpcurr.put("CODNUM", movana.get(MOVANA_DCODNUM)); //codnum del documento che origina il movana
tmpcurr.put("ANNO", movana.get(MOVANA_DANNO)); //anno del doc di origine
tmpcurr.put("NUMRD", movana.get(MOVANA_DNDOC)); //
tmpcurr.put("DATA", newdoc->get(DOC_DATADOC)); //data del documento che genera movana..
} //..non esiste il campo in movana
else //movimento normale (senza documento)
{
_tmp->curr().put("CODNUM", movana.get(MOVANA_NUMDOC));
_tmp->curr().put("ANNO", movana.get(MOVANA_ANNOES)); //anno del movimento
_tmp->curr().put("NUMRD", movana.get(MOVANA_NUMREG)); //numreg del movana
_tmp->curr().put("DATA", movana.get(MOVANA_DATACOMP)); //data del movana
tmpcurr.put("CODNUM", movana.get(MOVANA_NUMDOC));
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
}
int selettore = 0;
if (newdoc != NULL)
{
_tmp->curr().put("NUMDOCRIF", newdoc->get(DOC_NUMDOCRIF)); //docrif del documento originante il movana
_tmp->curr().put("DATADOCRIF", newdoc->get(DOC_DATADOCRIF)); //datadocrif del documento originante il movana
tmpcurr.put("NUMDOCRIF", newdoc->get(DOC_NUMDOCRIF)); //docrif del documento originante il movana
tmpcurr.put("DATADOCRIF", newdoc->get(DOC_DATADOCRIF)); //datadocrif del documento originante il movana
const int tipo_documento = newdoc->tipo().tipo();
int tipo_babbo = 0;
@ -648,14 +666,14 @@ void TPrint_rendiconto_ca_recordset::salva_rmovana(const TRectype& rmovana, cons
default:
break;
}
_tmp->curr().put("DOCORIG", riferimento);
tmpcurr.put("DOCORIG", riferimento);
}
//campi comuni
_tmp->curr().put("DESC", movana.get(MOVANA_DESCR)); //descrizione movana
_tmp->curr().put("NRIGA", rmovana.get(RMOVANA_NUMRIG));
_tmp->curr().put("DESCRIGA", rmovana.get(RMOVANA_DESCR)); //descrizione rmovana
tmpcurr.put("DESC", movana.get(MOVANA_DESCR)); //descrizione movana
tmpcurr.put("NRIGA", rmovana.get(RMOVANA_NUMRIG));
tmpcurr.put("DESCRIGA", rmovana.get(RMOVANA_DESCR)); //descrizione rmovana
/*[Tipo documento]
O=I**
@ -684,16 +702,17 @@ F=IMF*/
imp.normalize(sezione_normale);
if (selettore & FATTURATO)
_tmp->curr().put("FATTURATO", imp.valore());
tmpcurr.put("FATTURATO", imp.valore());
if (selettore & MATURATO)
_tmp->curr().put("MATURATO", imp.valore());
tmpcurr.put("MATURATO", imp.valore());
if (selettore & IMPEGNATO)
_tmp->curr().put("IMPEGNATO", imp.valore());
tmpcurr.put("IMPEGNATO", imp.valore());
_tmp->write(); // aggiunge i record al file temporaneo
if (should_delete)
delete newdoc;
}
if (!dadoc && newdoc != NULL)
delete newdoc;
}

View File

@ -40,15 +40,15 @@
</field>
<field border="2" x="1" y="6" type="Linea" width="169" height="0" pattern="1" />
<field x="31" y="6.5" type="Testo" width="23" pattern="1" text="Doc. cliente&#2F;fornitore" />
<field x="107" y="6.5" type="Testo" align="center" width="12" pattern="1" text="Riferimento" />
<field x="109" y="6.5" type="Testo" align="center" width="12" pattern="1" text="Riferimento" />
<field x="141" y="6.5" type="Testo" width="25" pattern="1" text="Avanzamento costi&#2F;ricavi" />
<field x="20" y="7.5" type="Testo" align="center" width="11" pattern="1" text="Data" />
<field x="31" y="7.5" type="Testo" align="center" width="6" pattern="1" text="Numero" />
<field x="41" y="7.5" type="Testo" align="center" width="10" pattern="1" text="Data" />
<field x="51" y="7.5" type="Testo" width="25" pattern="1" text="Descrizione testata" />
<field x="78" y="7.5" type="Testo" width="4" pattern="1" text="Riga" />
<field x="83" y="7.5" type="Testo" width="15" pattern="1" text="Descrizione riga" />
<field x="107" y="7.5" type="Testo" align="center" width="12" pattern="1" text="Ordine&#2F;Bolla" />
<field x="77" y="7.5" type="Testo" width="4" pattern="1" text="Riga" />
<field x="82" y="7.5" type="Testo" width="15" pattern="1" text="Descrizione riga" />
<field x="109" y="7.5" type="Testo" align="center" width="12" pattern="1" text="Ordine&#2F;Bolla" />
<field x="123" y="7.5" type="Testo" align="right" width="15" pattern="1" text="Fatturato" />
<field x="139" y="7.5" type="Testo" align="right" width="15" pattern="1" text="Maturato" />
<field x="155" y="7.5" type="Testo" align="right" width="15" pattern="1" text="Impegnato" />
@ -116,15 +116,15 @@ MESSAGE RESET,F2.103</prescript>
<field x="108" type="Stringa" align="right" dynamic_height="1" width="14" height="2" pattern="1">
<source>DOCORIG</source>
</field>
<field x="123" type="Valuta" align="right" width="15" pattern="1" hide_zero="1" text="###.###.###,@@">
<field x="123" type="Valuta" align="right" width="15" pattern="1" text="###.###.###,@@">
<source>FATTURATO</source>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.101</postscript>
</field>
<field x="139" type="Valuta" align="right" width="15" pattern="1" hide_zero="1" text="###.###.###,@@">
<field x="139" type="Valuta" align="right" width="15" pattern="1" text="###.###.###,@@">
<source>MATURATO</source>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.102</postscript>
</field>
<field x="155" type="Valuta" align="right" width="15" pattern="1" hide_zero="1" text="###.###.###,@@">
<field x="155" type="Valuta" align="right" width="15" pattern="1" text="###.###.###,@@">
<source>IMPEGNATO</source>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.103</postscript>
</field>

View File

@ -80,9 +80,9 @@ bool TContabilizzazione_analitica::search_costo_ricavo(const TRiga_documento& r,
clifo_key.format("%c|%ld", r.doc().get_char(DOC_TIPOCF), r.doc().get_long(DOC_CODCF));
const TRectype& cli_file = cache().get(LF_CLIFO, clifo_key);
const bool is_cli = cli_file.get(CLI_TIPOCF) != 'F';
const bool is_cli = cli_file.get_char(CLI_TIPOCF) != 'F';
bool skip_art_related = false;
bool skip_clifo = !cli_file.empty();
bool skip_clifo = cli_file.empty();
const TCodiceIVA codiva(r.get(RDOC_CODIVA));
const char t = r.tipo().tipo();
@ -109,7 +109,8 @@ bool TContabilizzazione_analitica::search_costo_ricavo(const TRiga_documento& r,
const int co = cli_file.get_int(CLI_CONTORIC);
const long so = cli_file.get_long(CLI_SOTTOCRIC);
conto.set(gr,co,so);
if (conto.ok()) break; // se lo trova esce (tutti != 0)
if (conto.ok())
break; // se lo trova esce (tutti != 0)
}
else
if (tok == "CA")
@ -139,7 +140,8 @@ bool TContabilizzazione_analitica::search_costo_ricavo(const TRiga_documento& r,
conto.set(gr,co,so);
}
}
if (conto.ok()) break;
if (conto.ok())
break;
}
else
if (tok == "GM" || tok == "SM" || tok == "RF")
@ -194,7 +196,8 @@ bool TContabilizzazione_analitica::search_costo_ricavo(const TRiga_documento& r,
case 'P': // righe prestazione
case 'S': // righe spese
{
const TRectype& tab = cache().get('P' ? "PRS" : "SPP", r.get(RDOC_CODART));
const TString80 codspesa = r.get(RDOC_CODART);
const TRectype& tab = cache().get(t == 'P' ? "PRS" : "SPP", codspesa);
if (!tab.empty())
{
int gr = tab.get_int(is_cli ? "I0" : "I3");
@ -448,7 +451,9 @@ bool TContabilizzazione_analitica::elabora(TDocumento& doc, long numreg_cg, TVis
continue;
// salto valori nulli
const real valore = riga.valore(true, decimals);
const real qta = riga.get(RDOC_QTA);
// const real valore = riga.valore(true, decimals);
const real valore = riga.importo(true, false);
if (valore.is_zero())
continue;