Patch level : 2.0 nopatch

Files correlati     : ab0.ex
Ricompilazione Demo : [ ]
Commento            :
Sviluppo riclassificazione saldi


git-svn-id: svn://10.65.10.50/trunk@11014 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2003-04-15 12:39:47 +00:00
parent c567b87d45
commit 21d23a14ec
3 changed files with 84 additions and 21 deletions

View File

@ -8,6 +8,7 @@
#include <progind.h> #include <progind.h>
#include <relation.h> #include <relation.h>
#include <rmov.h> #include <rmov.h>
#include "saldi.h"
#include <utility.h> #include <utility.h>
#include "../cg/cglib01.h" #include "../cg/cglib01.h"
#include "../cg/cglib02.h" #include "../cg/cglib02.h"
@ -70,7 +71,7 @@ bool TRicl_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
return TRUE; return TRUE;
} }
enum TCalc_type { _ivdircee = 1, _ricl } ; enum TCalc_type {_saldi = 0, _ivdircee, _analisi } ;
class TRiga_calcolo : public TObject class TRiga_calcolo : public TObject
{ {
@ -387,6 +388,12 @@ void TRicl_saldi::get_code(const TRectype &rec, bool cee, bool reverse, TString
void TRicl_saldi::map(int gruppo, int conto, long sottoconto, bool reverse, TString & code) void TRicl_saldi::map(int gruppo, int conto, long sottoconto, bool reverse, TString & code)
{ {
const bool no_map =_calc_type == _saldi;
if(no_map)
code.format("%03d|%03d|%06ld", gruppo, conto, sottoconto);
else
{
const bool cee =_calc_type == _ivdircee; const bool cee =_calc_type == _ivdircee;
code.format("%d|%d|%ld", gruppo, conto, sottoconto); code.format("%d|%d|%ld", gruppo, conto, sottoconto);
@ -407,6 +414,7 @@ void TRicl_saldi::map(int gruppo, int conto, long sottoconto, bool reverse, TStr
get_code(recg, cee, reverse, code); get_code(recg, cee, reverse, code);
} }
} }
}
} }
void TRicl_saldi::transform() void TRicl_saldi::transform()
@ -460,11 +468,16 @@ TFile_type TRicl_saldi::open_output()
void TRicl_saldi::output_line(TFile_type t, const char * key, TRiga_output & r) void TRicl_saldi::output_line(TFile_type t, const char * key, TRiga_output & r)
{ {
TString descr; TString descr;
const bool analisi = _calc_type == _ivdircee;
const bool saldi = _calc_type == _saldi;
if (_calc_type == _ivdircee) if (analisi)
descr = cache().get("%IVD", key, "S0");
else
descr = cache().get(LF_ABPCON, key, ABPC_DESCRIZ); descr = cache().get(LF_ABPCON, key, ABPC_DESCRIZ);
else
if (saldi)
descr = cache().get(LF_PCON, key, PCN_DESCR);
else
descr = cache().get("%IVD", key, "S0");
real si = r.saldo_iniziale(); real si = r.saldo_iniziale();
char fsi = 'D'; char fsi = 'D';
@ -567,6 +580,49 @@ void TRicl_saldi::output()
_output_keys.sort(); _output_keys.sort();
const int items = _output_keys.items(); const int items = _output_keys.items();
TFile_type t = open_output(); TFile_type t = open_output();
const bool analisi = _calc_type == _analisi;
if (analisi)
{
TRelation relana(LF_ABSALDI);
TRectype & saldo = relana.curr();
saldo.put(ABS_CODDITTA, get_firm());
saldo.put(ABS_ANNO, _codes);
saldo.put(ABS_CODPDB, _codpdb);
TCursor cur(&relana, "", 1, &saldo, &saldo);
const TRecnotype items = cur.items();
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
relana.remove();
if (analisi)
{
int err = NOERR;
for (int i = 0; err == NOERR && i < items; i++)
{
TString & key = _output_keys.row(i);
TRiga_output & r = (TRiga_output &) _output[key];
saldo.zero();
saldo.put(ABS_CODDITTA, get_firm());
saldo.put(ABS_ANNO, _codes);
saldo.put(ABS_CODPDB, _codpdb);
const real si = r.saldo_iniziale();
const char fsi = si >= ZERO ? 'D' : 'A';
saldo.put(ABS_FLDA, fsi);
saldo.put(ABS_SALDO, abs(si));
saldo.put(ABS_PDARE, r.prog_dare());
saldo.put(ABS_PAVERE, r.prog_avere());
err = relana.write();
if (err == _isreinsert)
err = relana.write();
}
if (err != NOERR)
error_box("Impossibile aggiornare l'archivio saldi analisi errore n. %d", err);
}
}
for (int i = 0; i < items; i++) for (int i = 0; i < items; i++)
{ {
TString & key = _output_keys.row(i); TString & key = _output_keys.row(i);

View File

@ -5,6 +5,7 @@ PAGE "Riclassificazione" -1 -1 76 17
LIST F_TIPO 20 LIST F_TIPO 20
BEGIN BEGIN
PROMPT 2 1 "Tipo di calcolo " PROMPT 2 1 "Tipo di calcolo "
ITEM "0|Saldi Contabili"
ITEM "1|IV Direttiva CEE" ITEM "1|IV Direttiva CEE"
ITEM "2|Analisi" ITEM "2|Analisi"
END END

View File

@ -7,6 +7,12 @@
#define ABS_CODPDB "CODPDB" #define ABS_CODPDB "CODPDB"
#define ABS_TIPOBIL "TIPOBIL" #define ABS_TIPOBIL "TIPOBIL"
#define ABS_CODCBL "CODCBL" #define ABS_CODCBL "CODCBL"
#define ABS_FLDA "FLDA"
#define ABS_SALDO "SALDO"
#define ABS_PDARE "PDARE"
#define ABS_PAVERE "PAVERE"
#define ABS_RDARE "RDARE"
#define ABS_RAVERE "RAVERE"
#define ABS_DETTFIGLIO "IDMOVDETT" #define ABS_DETTFIGLIO "IDMOVDETT"
#endif //_SALDI_H #endif //_SALDI_H