Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento : ca3: corretta la gestione dei doc_speciali che sono figli di FDR/FDE (non aveva mai funzionato nella storia) ca2: corretta la gestione saldi analitici; adesso prima di cancellare i saldana controlla di essere l'unico programma che accede a saldana git-svn-id: svn://10.65.10.50/trunk@20458 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
78a0c98a3e
commit
11be74e2b4
@ -145,22 +145,34 @@ bool TRic_saldi_app::destroy()
|
||||
|
||||
bool TRic_saldi_app::remove_saldi(const int first_anno)
|
||||
{
|
||||
//deve azzerare i saldi a partire dal primo anno di interesse
|
||||
TString query;
|
||||
query << "USE SALDANA\nFROM ANNO=#ANNO";
|
||||
|
||||
TISAM_recordset recset(query);
|
||||
recset.set_var("#ANNO", long(first_anno));
|
||||
const long recset_items = recset.items();
|
||||
TProgind pi(recset_items, "Azzeramento saldi...", true, true);
|
||||
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
TSystemisamfile saldana(LF_SALDANA);
|
||||
const bool can_do = saldana.open(_excllock) == NOERR;
|
||||
if (can_do)
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
recset.cursor()->file().remove();
|
||||
//deve azzerare i saldi a partire dal primo anno di interesse
|
||||
TString query;
|
||||
query << "USE SALDANA\nFROM ANNO=#ANNO";
|
||||
|
||||
TISAM_recordset recset(query);
|
||||
recset.set_var("#ANNO", long(first_anno));
|
||||
const long recset_items = recset.items();
|
||||
TProgind pi(recset_items, "Azzeramento saldi...", true, true);
|
||||
|
||||
const TRectype& rec_saldana = recset.cursor()->curr();
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
rec_saldana.remove(saldana);
|
||||
}
|
||||
//alla fine compatta il file
|
||||
saldana.close();
|
||||
saldana.pack(true, false);
|
||||
}
|
||||
return true;
|
||||
else
|
||||
error_box("Inpossibile procedere! File dei saldi analitici in uso");
|
||||
|
||||
return can_do;
|
||||
}
|
||||
|
||||
void TRic_saldi_app::main_loop()
|
||||
|
@ -721,8 +721,7 @@ void TPrint_rendiconto_ca_recordset::scrive_riga(TLocalisamfile& tmp, const TRec
|
||||
{
|
||||
TRectype& tmpcurr = tmp.curr();
|
||||
tmpcurr.zero();
|
||||
TString8 codnum_desc; //codnum da usare sia per compilare il campo "CODNUM"
|
||||
codnum_desc.cut(0);
|
||||
TString8 codnum; //codnum da usare sia per compilare il campo "CODNUM"
|
||||
|
||||
//----- CONTI -----//
|
||||
const TString80 codconto_originale = rmovana.get(RMOVANA_CODCONTO);
|
||||
@ -783,8 +782,8 @@ void TPrint_rendiconto_ca_recordset::scrive_riga(TLocalisamfile& tmp, const TRec
|
||||
//tipo movimento CONSUNTIVO (o TEMPORANEO); per i movimenti di budget (P o V) vedi l'else
|
||||
const char tipomov = movana.get_char(MOVANA_TIPOMOV);
|
||||
#ifdef DBG
|
||||
const long cazzone_numreg = movana.get_long(MOVANA_NUMREG);
|
||||
if (cazzone_numreg == 23004)
|
||||
const long movana_numreg = movana.get_long(MOVANA_NUMREG);
|
||||
if (movana_numreg == 23004)
|
||||
const int cazzone = 1;
|
||||
#endif
|
||||
|
||||
@ -802,8 +801,8 @@ void TPrint_rendiconto_ca_recordset::scrive_riga(TLocalisamfile& tmp, const TRec
|
||||
//i movimenti possono essere normali o generati da documento...
|
||||
if (dadoc) //movimento generato da documento
|
||||
{
|
||||
codnum_desc = movana.get(MOVANA_DCODNUM); //serve anche in fondo al metodo
|
||||
tmpcurr.put("CODNUM", codnum_desc); //codnum del documento che origina il movana
|
||||
codnum = movana.get(MOVANA_DCODNUM); //serve anche in fondo al metodo
|
||||
tmpcurr.put("CODNUM", codnum); //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)); //numero del doc che origina movana
|
||||
tmpcurr.put("DATA", newdoc->get(DOC_DATADOC)); //data del documento che genera movana..
|
||||
@ -1105,33 +1104,31 @@ void TPrint_rendiconto_ca_recordset::scrive_riga_speciale(TLocalisamfile& tmp, c
|
||||
const char tipocf = doc->get_char(DOC_TIPOCF);
|
||||
const int rows = doc->physical_rows();
|
||||
|
||||
TContabilizzazione_analitica contab;
|
||||
|
||||
for (int i = 1; i <= rows; i++)
|
||||
{
|
||||
const TRiga_documento& rigadoc = (*doc)[i];
|
||||
const TString& dacodnum = rigadoc.get(RDOC_DACODNUM);
|
||||
|
||||
if (special_docs.find(rigadoc.get(RDOC_DACODNUM)) > 0)
|
||||
if (special_docs.find(dacodnum) >= 0) // Riga proveniente da special doc
|
||||
{
|
||||
TRectype& tmpcurr = tmp.curr();
|
||||
tmpcurr.zero();
|
||||
TString8 codnum_desc;
|
||||
codnum_desc.cut(0);
|
||||
|
||||
TString codconto, codcontocg;
|
||||
TRectype& tmpcurr = tmp.curr();
|
||||
tmpcurr.zero();
|
||||
|
||||
//se usa il piano dei conti contabile -> _piano = C..
|
||||
if (_piano == "C")
|
||||
{
|
||||
//trova il conto senza movana e rmovana!!!
|
||||
TContabilizzazione_analitica contab;
|
||||
TBill conto;
|
||||
if (contab.search_costo_ricavo(rigadoc, conto, true))
|
||||
if (contab.search_costo_ricavo(rigadoc, conto, false)) // was true
|
||||
codconto = codcontocg = conto.string(0x8);
|
||||
}
|
||||
else //se ivece usa il piano dei conti analitico -> _piano = A...
|
||||
{
|
||||
if (_riclassificato)
|
||||
{
|
||||
TContabilizzazione_analitica contab;
|
||||
TBill conto;
|
||||
if (contab.search_costo_ricavo(rigadoc, conto, true))
|
||||
{
|
||||
@ -1159,12 +1156,13 @@ void TPrint_rendiconto_ca_recordset::scrive_riga_speciale(TLocalisamfile& tmp, c
|
||||
}
|
||||
}
|
||||
}
|
||||
//non trova il conto -> esce
|
||||
//non trova il conto -> esce dalla riga e passa alla successiva
|
||||
if (codconto.empty())
|
||||
return;
|
||||
continue;
|
||||
|
||||
const int indbil = codcontocg.full() ? bill2indbil(codcontocg, false)
|
||||
: bill2indbil(codconto, true) ;
|
||||
|
||||
tmpcurr.put("CONTO", codconto);
|
||||
tmpcurr.put("CONTOCG", codcontocg);
|
||||
tmpcurr.put("ORDCONT", sort_indbil(indbil));
|
||||
@ -1180,6 +1178,14 @@ void TPrint_rendiconto_ca_recordset::scrive_riga_speciale(TLocalisamfile& tmp, c
|
||||
tmpcurr.put("NUMREG", doc->get(DOC_NUMREGCA)); //numero di registrazione analitica
|
||||
tmpcurr.put("NUMREGCG", doc->get(DOC_NUMREG)); //numero di registrazione contabile
|
||||
|
||||
TToken_string clifo_key;
|
||||
clifo_key.add(tipocf);
|
||||
clifo_key.add(doc->get(DOC_CODCF));
|
||||
const TString& ragsoc = cache().get(LF_CLIFO, clifo_key, CLI_RAGSOC);
|
||||
|
||||
tmpcurr.put("DESC", ragsoc); //descrizione doc: ci mette il clifo (come nei movana normali)
|
||||
tmpcurr.put("DESCRIGA", rigadoc.get(RDOC_DESCR)); //descrizione rdoc
|
||||
|
||||
tmpcurr.put("NRIGA", rigadoc.get(RDOC_NRIGA)); //numero riga
|
||||
tmpcurr.put("CODCMS", rigadoc.get(RDOC_CODCMS)); //codice commessa
|
||||
tmpcurr.put("CODCOSTO", rigadoc.get(RDOC_CODCOSTO)); //codice cdc
|
||||
@ -1524,7 +1530,13 @@ void TPrint_rendiconto_ca_recordset::crea_righe_da_rdoc(TLocalisamfile& tmp, con
|
||||
//..importo verra' poi messo nel fatturato.
|
||||
const TRectype& curr_rdoc = cur_rdoc.curr();
|
||||
const TString& rdoc_dacodnum = curr_rdoc.get(RDOC_DACODNUM);
|
||||
const bool is_special_doc = _num_fdr.find(rdoc_dacodnum) > 0;
|
||||
#ifdef DBG
|
||||
if (rdoc_dacodnum == "FDR" && curr_rdoc.get_int(RDOC_ANNO) == 2009 && curr_rdoc.get_int(RDOC_NDOC) == 129)
|
||||
{
|
||||
int riga_doc = curr_rdoc.get_int(RDOC_NRIGA);
|
||||
}
|
||||
#endif
|
||||
const bool is_special_doc = _num_fdr.find(rdoc_dacodnum) >= 0;
|
||||
//documento non contabilizzato o fattura da ricevere con numerazione configurata speciale
|
||||
if (numregca == 0 || is_special_doc)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user