Aggiunta conversione dei saldi. Stato delle conversioni con rispettivo
livello: FORMS e SALDI ==> 11 CA7 ==> 12 IVA ==> da definire Questo in quanto ancora non si sa se uscira' prima il 770 o CG. git-svn-id: svn://10.65.10.50/trunk@3528 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1b8778a2dc
commit
c13f9a1847
126
ba/bacnv.cpp
126
ba/bacnv.cpp
@ -21,7 +21,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <causali.h>
|
#include <causali.h>
|
||||||
|
#include <mov.h>
|
||||||
#include <rmov.h>
|
#include <rmov.h>
|
||||||
|
#include <saldi.h>
|
||||||
|
|
||||||
|
#include "..\cg\cglib.h"
|
||||||
|
|
||||||
|
|
||||||
#define usage "Errore - uso : bacnv [1|2|3|4|5|6|7|8|9|10|11|12] ditta"
|
#define usage "Errore - uso : bacnv [1|2|3|4|5|6|7|8|9|10|11|12] ditta"
|
||||||
|
|
||||||
@ -171,9 +176,11 @@ public:
|
|||||||
void convert_codreg() const;
|
void convert_codreg() const;
|
||||||
void convert_lia_pim() const;
|
void convert_lia_pim() const;
|
||||||
void build_ver_table() const;
|
void build_ver_table() const;
|
||||||
|
void convert_forms() const;
|
||||||
|
void sort_sal(int year) const;
|
||||||
|
void convert_saldi() const;
|
||||||
void convert_ca7() const;
|
void convert_ca7() const;
|
||||||
void convert_tabiva() const;
|
void convert_tabiva() const;
|
||||||
void convert_forms() const;
|
|
||||||
|
|
||||||
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
|
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
|
||||||
};
|
};
|
||||||
@ -280,11 +287,14 @@ bool TConversione_archivi::menu(MENU_TAG)
|
|||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
if (_codditta == 0)
|
if (_codditta == 0)
|
||||||
convert_ca7();
|
convert_forms();
|
||||||
|
else
|
||||||
|
convert_saldi();
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
if (_codditta == 0)
|
if (_codditta == 0)
|
||||||
convert_forms();
|
convert_ca7();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1110,6 +1120,116 @@ void TConversione_archivi::convert_forms() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TConversione_archivi::sort_sal(int year) const
|
||||||
|
{
|
||||||
|
TSystemisamfile saldi(LF_SALDI); saldi.open(_excllock);
|
||||||
|
TLocalisamfile rmov(LF_RMOV);
|
||||||
|
TLocalisamfile causali(LF_CAUSALI);
|
||||||
|
TLocalisamfile mov(LF_MOV);
|
||||||
|
TSaldo_agg sal;
|
||||||
|
|
||||||
|
int gruppo, conto;
|
||||||
|
long oldnumreg = 0L, sottoconto;
|
||||||
|
TString msg("Riordino archivio saldi ditta ");
|
||||||
|
msg << _codditta;
|
||||||
|
msg << " in corso\nLettura archivio movimenti...";
|
||||||
|
TProgind prnd(rmov.items(),msg, FALSE,TRUE,30);
|
||||||
|
|
||||||
|
causali.zero();
|
||||||
|
mov.setkey(1);
|
||||||
|
rmov.first();
|
||||||
|
sal.reset();
|
||||||
|
sal.set_anno_es(year);
|
||||||
|
sal.clear_saldi(year);
|
||||||
|
long numreg = 0L;
|
||||||
|
tiposal tsal = normale;
|
||||||
|
bool provvis = FALSE;
|
||||||
|
TDate datareg;
|
||||||
|
|
||||||
|
while (!rmov.eof())
|
||||||
|
{
|
||||||
|
if (year == rmov.get_int(RMV_ANNOES))
|
||||||
|
{
|
||||||
|
numreg = rmov.get_long(RMV_NUMREG);
|
||||||
|
|
||||||
|
gruppo = rmov.get_int(RMV_GRUPPO);
|
||||||
|
conto = rmov.get_int(RMV_CONTO);
|
||||||
|
sottoconto = rmov.get_long(RMV_SOTTOCONTO);
|
||||||
|
bool scaricato = FALSE;
|
||||||
|
|
||||||
|
if (numreg != oldnumreg)
|
||||||
|
{
|
||||||
|
if (oldnumreg !=0)
|
||||||
|
{
|
||||||
|
if (sal.items() > 0)
|
||||||
|
sal.registra();
|
||||||
|
}
|
||||||
|
oldnumreg = numreg;
|
||||||
|
mov.zero();
|
||||||
|
mov.put(MOV_NUMREG, numreg);
|
||||||
|
mov.read();
|
||||||
|
CHECK(mov.good(),"Archivi movimenti e righe inconsistenti");
|
||||||
|
|
||||||
|
causali.zero();
|
||||||
|
const char* codcaus = mov.get(MOV_CODCAUS);
|
||||||
|
|
||||||
|
tsal = normale;
|
||||||
|
if (*codcaus) // cerca causale per determinare il tipoo del saldo
|
||||||
|
{
|
||||||
|
causali.put(CAU_CODCAUS, codcaus);
|
||||||
|
const int err = causali.read();
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
const char ac = causali.get_char(CAU_MOVAP);
|
||||||
|
if (ac == 'A')
|
||||||
|
tsal = apertura;
|
||||||
|
else
|
||||||
|
if (ac == 'C')
|
||||||
|
tsal = chiusura;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scaricato = mov.get_bool(MOV_SCARCON);
|
||||||
|
provvis = mov.get(MOV_PROVVIS).not_empty();
|
||||||
|
datareg = mov.get_date(MOV_DATAREG);
|
||||||
|
|
||||||
|
sal.reset();
|
||||||
|
sal.set_anno_es(year);
|
||||||
|
sal.set_tipo_saldo(tsal);
|
||||||
|
sal.set_movprovv(provvis);
|
||||||
|
sal.set_data_ulmov(datareg);
|
||||||
|
sal.set_num_ulmov(oldnumreg);
|
||||||
|
}
|
||||||
|
const char sezione = rmov.get(RMV_SEZIONE)[0];
|
||||||
|
real importo(rmov.get(RMV_IMPORTO));
|
||||||
|
|
||||||
|
sal.aggiorna(gruppo, conto, sottoconto, importo, sezione, TRUE, scaricato);
|
||||||
|
}
|
||||||
|
rmov.next();
|
||||||
|
prnd.addstatus(1);
|
||||||
|
do_events();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sal.items() > 0)
|
||||||
|
sal.registra();
|
||||||
|
|
||||||
|
saldi.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TConversione_archivi::convert_saldi() const
|
||||||
|
// Effettua il ricalcolo saldi per tutti gli esercizi della ditta corrente
|
||||||
|
{
|
||||||
|
TTable esc("ESC");
|
||||||
|
|
||||||
|
for (esc.first();esc.good();esc.next())
|
||||||
|
{
|
||||||
|
const int year = atoi(esc.get("CODTAB"));
|
||||||
|
if (year == 0) continue;
|
||||||
|
sort_sal(year);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Programma di conversione archivi speciale
|
// Programma di conversione archivi speciale
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user