git-svn-id: svn://10.65.10.50/branches/R_10_00@23186 c028cbd2-c16b-5b4b-a496-9718f37d4682

This commit is contained in:
guy 2016-04-15 08:13:45 +00:00
parent dddb1a668f
commit 29193933ef
11 changed files with 193 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#define F_LEVEL_2 153
#define F_ATTIVA_FASI 154
#define F_FATHER_FASI 155
#define F_ATTIVA_COMP 160
#define F_CDC_1 106
#define F_CDC_2 107

View File

@ -51,6 +51,17 @@ BEGIN
FIELD FathFasi
END
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 8 "@bMovimenti"
END
BOOLEAN F_ATTIVA_COMP
BEGIN
PROMPT 2 9 "Gestione righe di analitica per competenza"
FIELD AttRmovc
END
ENDPAGE
PAGE "Configurazione campi 1" 0 0 0 2

View File

@ -9,6 +9,7 @@ int main(int argc, char** argv)
{
case 1: ca2200(argc, argv); break; // ripartizione movimenti analitica
case 2: ca2300(argc, argv); break; // ricalcolo saldi
case 3: ca2400(argc, argv); break; // ricalcolo righe competenza
default: ca2100(argc, argv); break; // gestione movimenti
}
return 0;

View File

@ -4,5 +4,6 @@
int ca2100(int argc, char* argv[]);
int ca2200(int argc, char* argv[]);
int ca2300(int argc, char* argv[]);
int ca2400(int argc, char* argv[]);
#endif // __CA2_H

View File

@ -3,6 +3,7 @@
#include <modaut.h>
#include <postman.h>
#include <recset.h>
#include <sheet.h>
#include "ca2.h"
#include "ca2100a.h"
@ -1108,6 +1109,7 @@ void TMovanal_app::write_rows(const TMask& m)
TRectype& rec = mov.new_row(); // Crea una riga nuova
_msk->row2rec(i, rec);
} //FOR_EACH_SHEET...
}

66
ca/ca2400.cpp Normal file
View File

@ -0,0 +1,66 @@
#include <applicat.h>
#include <mask.h>
#include <progind.h>
#include <recset.h>
#include <urldefid.h>
#include <toolfld.h>
#include "../ca/calib01.h"
#include "movana.h"
#include "rmovana.h"
class TRic_comp_app : public TSkeleton_application
{
public:
virtual void main_loop();
};
void TRic_comp_app::main_loop()
{
TMask m(title(), 1, 40, 6);
m.add_button_tool(DLG_OK, TR("Elabora"), TOOL_ELABORA);
m.add_button_tool(-1, NULL, 0);
m.add_button_tool(DLG_INFO, TR("Info"), TOOL_INFO);
m.add_button_tool(DLG_HELP, TR("Help"), TOOL_HELP);
m.add_button_tool(-1, NULL, 0);
m.add_button_tool(DLG_QUIT, TR("Fine"), TOOL_QUIT);
m.add_date(101, 0, PR("Data iniziale "), 1, 1);
m.add_date(102, 0, PR("Data finale "), 1, 3, "A");
if (!ini_get_bool(CONFIG_DITTA, "ca", "AttRmovc"))
{
if (yesno_box(TR("Si desidera attivare la suddivisione delle righe analitiche per competenza?")))
ini_set_bool(CONFIG_DITTA, "ca", "AttRmovc", true);
else
return;
}
while (m.run() == K_ENTER)
{
TISAM_recordset movset("USE MOVANA KEY 2\nFROM DATACOMP=#DAL\nTO DATACOMP=#AL");
movset.set_var("#DAL", m.get(101));
movset.set_var("#AL", m.get(102));
long items = 0;
{
TWait_cursor hourglass;
items = movset.items();
}
TProgress_monitor pi(items, title());
for (bool ok = movset.move_first(); ok; ok = movset.move_next())
{
TAnal_mov am(movset.get(MOVANA_NUMREG).as_int());
am.save_rmov_comp();
if (!pi.add_status())
break;
}
}
}
int ca2400(int argc, char* argv[])
{
TRic_comp_app app;
app.run(argc, argv, TR("Ricostruzione righe per competenza"));
return 0;
}

View File

@ -2512,12 +2512,104 @@ void TAnal_mov::update_datacomp() const
}
}
int TAnal_mov::save_rmov_comp() const
{
static bool __rmovc = ini_get_bool(CONFIG_DITTA, "ca", "AttRmovc", false);
if (!__rmovc)
return EBADMSG;
TAssoc_array old_rows;
{
TISAM_recordset rmac("USE RMOVANAC\nFROM NUMREG=#NR\nTO NUMREG=#NR");
rmac.set_var("#NR", get_long(MOVANA_NUMREG));
for (bool ok = rmac.move_first(); ok; ok = rmac.move_next())
{
const TRectype& curr = rmac.cursor()->curr();
old_rows.add(curr.build_key(), curr);
}
}
const TDate start = get(MOVANA_DATACOMP);
const TDate stop = get(MOVANA_DATAFCOMP);
TAssoc_array new_rows;
const TRecord_array& b = body();
for (int r = b.last_row(); r > 0; r = b.pred_row(r))
{
const TRectype& rmov = b.row(r);
TGeneric_distrib dist(rmov.get_real(RMOVANA_IMPORTO), 2);
for (TDate d = start; d <= stop; ++d)
{
TDate em(d);
if (d.year() == stop.year() && d.month() == stop.month())
em = stop;
else
em.set_end_month();
dist.add(em - d + 1L);
d = em;
}
for (TDate d = start; d <= stop; ++d)
{
TDate em(d);
if (d.year() == stop.year() && d.month() == stop.month())
em = stop;
else
em.set_end_month();
TRectype* rmovc = new TRectype(LF_RMOVANAC);
rmovc->put(RMOVANA_NUMREG, rmov.get(RMOVANA_NUMREG));
rmovc->put(RMOVANA_NUMRIG, rmov.get(RMOVANA_NUMRIG));
rmovc->put("ANNOCOMP", d.year());
rmovc->put("MESECOMP", d.month());
rmovc->put("DATACOMP", d);
rmovc->put("DATAFCOMP", em);
rmovc->put(RMOVANA_SEZIONE, rmov.get(RMOVANA_SEZIONE));
rmovc->put(RMOVANA_IMPORTO, dist.get());
rmovc->put(RMOVANA_ROWTYPE, rmov.get(RMOVANA_ROWTYPE));
new_rows.add(rmovc->build_key(), rmovc);
d = em;
}
}
TFast_isamfile file(LF_RMOVANAC);
if (!new_rows.empty())
{
FOR_EACH_ASSOC_OBJECT(new_rows, obj, key, itm)
{
const TRectype* rmov_new = (TRectype*)itm;
const TRectype* rmov_old = (TRectype*)old_rows.objptr(key);
if (rmov_old)
{
if (rmov_new->compare(*rmov_old) != 0)
rmov_new->rewrite_write(file);
}
else
rmov_new->write_rewrite(file);
}
}
if (!old_rows.empty())
{
FOR_EACH_ASSOC_OBJECT(old_rows, obj, key, itm)
{
const TRectype* rmov_old = (TRectype*)itm;
const TRectype* rmov_new = (TRectype*)new_rows.objptr(key);
if (rmov_new == NULL)
rmov_old->remove(file);
}
}
return 0;
}
int TAnal_mov::write(TBaseisamfile& f) const
{
update_datacomp();
const int err = TMultiple_rectype::write(f);
if (err == NOERR)
{
((TAnal_mov*)this)->update_saldi(false);
save_rmov_comp();
}
return err;
}

View File

@ -204,6 +204,7 @@ public:
void update_totdoc();
const char * row_anal_code(int logicnum, int i) const;
const char * row_code(int i) const;
int save_rmov_comp() const;
TAnal_mov(long numreg = 0);
TAnal_mov(const TRectype& rec); //accetta LF_MOVANA,LF_RMOVANA,LF_MOV

View File

@ -59,6 +59,7 @@ Module = ca
Flags = ""
Item_01 = "Gestione movimenti", "ca2 -0", "F"
Item_02 = "Ripartizione movimenti", "ca2 -1", "F"
Item_03 = "Ripartizione per competenza", "ca2 -3", "F"
[CAMENU_040]
Caption = "Stampe"

3
ca/f172.dir Normal file
View File

@ -0,0 +1,3 @@
172
0
$rmovanac|0|0|53|0|Righe di Analitica per competenza|||

14
ca/f172.trr Normal file
View File

@ -0,0 +1,14 @@
172
9
NUMREG|3|7|0|Numero di Registrazione
NUMRIG|2|3|0|Numero riga
ANNOCOMP|9|4|0|Anno di competenza
MESECOMP|9|2|0|Mese di competenza
DATACOMP|5|8|0|Data di fine competenza
DATAFCOMP|5|8|0|Data di inizio competenza
SEZIONE|1|1|0|Sezione
IMPORTO|4|18|3|Importo della riga
ROWTYPE|1|1|0|Tipo Riga
2
NUMREG+NUMRIG+ANNOCOMP+MESECOMP|X
ANNOCOMP+MESECOMP+NUMREG+NUMRIG|X