Semplificazione nomenclatura combinata da tre ad un solo campo
git-svn-id: svn://10.65.10.50/branches/R_10_00@23138 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9b4d556bea
commit
6a84387e62
@ -1,3 +1,3 @@
|
||||
133
|
||||
0
|
||||
$intra|0|0|80|0|Movimenti intrastat|||
|
||||
$intra|0|0|80|0|Movimenti Intrastat|||
|
||||
|
@ -8,7 +8,7 @@ int main(int argc, char** argv)
|
||||
switch (n)
|
||||
{
|
||||
case 0 : in0100(argc, argv); break; // stampa riepiloghi
|
||||
case 1 : in0200(argc, argv); break; // generazione dischetti
|
||||
case 1 : in0200(argc, argv); break; // generazione scambi.cee
|
||||
case 5 : in0600(argc, argv); break; // gestione riepiloghi
|
||||
case 6 : in0700(argc, argv); break; // gestione rettifiche
|
||||
default: in0500(argc, argv); break; // gestione movimenti
|
||||
|
141
in/in0200.cpp
141
in/in0200.cpp
@ -55,9 +55,7 @@ public:
|
||||
void put(char chr, int pos);
|
||||
void genera_testata(const TIntra_context& ic);
|
||||
void put(const TRectype& rec, TIntra_context& ic);
|
||||
|
||||
TRecord_intra();
|
||||
virtual ~TRecord_intra() { }
|
||||
};
|
||||
|
||||
// Scrive un campo generico sul record di invio
|
||||
@ -192,24 +190,24 @@ void TRecord_intra::put(const TRectype& rec, TIntra_context& ic)
|
||||
{
|
||||
case 'A':
|
||||
put('1', 23);
|
||||
put(rec.get("STATO"), 29, 2);
|
||||
put(rec.get("PIVA"), 31, 12);
|
||||
put(rec.get_real("AMMLIRE"), 43, 13, _ndec);
|
||||
put(rec.get_real("AMMVALUTA"), 56, 13);
|
||||
put(rec.get_char("NATURA"), 69);
|
||||
put(rec.get("STATO"), 29, 2);
|
||||
put(rec.get("PIVA"), 31, 12);
|
||||
put(rec.get_real("AMMLIRE"), 43, 13, _ndec);
|
||||
put(rec.get_real("AMMVALUTA"), 56, 13);
|
||||
put(rec.get_char("NATURA"), 69);
|
||||
put(rec.get("NOMENCL").mid(0,4), 70, 4, "Z"); //il campo viene spezzato in 3 pezzi
|
||||
put(rec.get("NOMENCL").mid(4,2), 74, 2, "Z");
|
||||
put(rec.get("NOMENCL").mid(6,2), 76, 2, "Z");
|
||||
if (ic._freq == 'M')
|
||||
{
|
||||
put(rec.get_real("MASSAKG"), 78, 10, 0);
|
||||
put(rec.get_real("MASSAUMS"), 88, 10, 0);
|
||||
put(rec.get_real("VALSTAT"), 98, 13, _ndec);
|
||||
put(rec.get_real("MASSAKG"), 78, 10, 0);
|
||||
put(rec.get_real("MASSAUMS"), 88, 10, 0);
|
||||
put(rec.get_real("VALSTAT"), 98, 13, _ndec);
|
||||
put(rec.get_char("CONSEGNA"), 111);
|
||||
put(rec.get_char("TRASPORTO"), 112);
|
||||
put(rec.get("PAESE"), 113, 2);
|
||||
put(rec.get("PAESEORIG"), 115, 2);
|
||||
put(rec.get("PROV"), 117, 2);
|
||||
put(rec.get_char("TRASPORTO"),112);
|
||||
put(rec.get("PAESE"), 113, 2);
|
||||
put(rec.get("PAESEORIG"), 115, 2);
|
||||
put(rec.get("PROV"), 117, 2);
|
||||
}
|
||||
else
|
||||
put("", 78, 100);
|
||||
@ -225,40 +223,38 @@ void TRecord_intra::put(const TRectype& rec, TIntra_context& ic)
|
||||
put(rec.get("PERETT")[1], 31);
|
||||
else
|
||||
put('0', 31);
|
||||
put(rec.get("ANNORETT").right(2), 32, 2, "RZ");
|
||||
put(rec.get("STATO"), 34, 2);
|
||||
put(rec.get("PIVA"), 36, 12);
|
||||
put(rec.get("SEGNORETT"), 48, 1);
|
||||
put(rec.get_real("AMMLIRE"), 49, 13, _ndec);
|
||||
put(rec.get_real("AMMVALUTA"), 62, 13);
|
||||
put(rec.get_char("NATURA"), 75);
|
||||
put(rec.get("NOMENCL").mid(0,4), 76, 4, "Z"); //il campo viene spezzato in 3 pezzi
|
||||
put(rec.get("NOMENCL").mid(4,2), 80, 2, "Z");
|
||||
put(rec.get("NOMENCL").mid(6,2), 82, 2, "Z");
|
||||
put(rec.get("ANNORETT").right(2), 32, 2, "RZ");
|
||||
put(rec.get("STATO"), 34, 2);
|
||||
put(rec.get("PIVA"), 36, 12);
|
||||
put(rec.get("SEGNORETT"), 48, 1);
|
||||
put(rec.get_real("AMMLIRE"), 49, 13, _ndec);
|
||||
put(rec.get_real("AMMVALUTA"), 62, 13);
|
||||
put(rec.get_char("NATURA"), 75);
|
||||
put(rec.get("NOMENCL").mid(0,4), 76, 4, "Z"); //il campo viene spezzato in 3 pezzi
|
||||
put(rec.get("NOMENCL").mid(4,2), 80, 2, "Z");
|
||||
put(rec.get("NOMENCL").mid(6,2), 82, 2, "Z");
|
||||
if (ic._freq == 'M')
|
||||
put(rec.get_real("VALSTAT"), 84, 13, _ndec);
|
||||
put(rec.get_real("VALSTAT"), 84, 13, _ndec);
|
||||
else
|
||||
put("", 84, 13);
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
put('1', 23);
|
||||
put(rec.get("STATO"), 29, 2);
|
||||
put(rec.get("PIVA"), 31, 12);
|
||||
put(rec.get_real("AMMLIRE"), 43, 13, _ndec);
|
||||
put(rec.get_char("NATURA"), 56);
|
||||
put(rec.get("NOMENCL").mid(0,4), 57, 4, "Z"); //il campo viene spezzato in 3 pezzi
|
||||
put(rec.get("NOMENCL").mid(4,2), 61, 2, "Z");
|
||||
put(rec.get("NOMENCL").mid(6,2), 63, 2, "Z");
|
||||
put(rec.get("STATO"), 29, 2);
|
||||
put(rec.get("PIVA"), 31, 12);
|
||||
put(rec.get_real("AMMLIRE"), 43, 13, _ndec);
|
||||
put(rec.get_char("NATURA"), 56);
|
||||
put(rec.get("NOMENCL"), 57, 8, "Z"); //il campo NON viene spezzato in 3 pezzi
|
||||
if (ic._freq == 'M')
|
||||
{
|
||||
put(rec.get_real("MASSAKG"), 65, 10);
|
||||
put(rec.get_real("MASSAUMS"), 75, 10);
|
||||
put(rec.get_real("VALSTAT"), 85, 13, _ndec);
|
||||
put(rec.get_char("CONSEGNA"), 98);
|
||||
put(rec.get_real("MASSAKG"), 65, 10);
|
||||
put(rec.get_real("MASSAUMS"), 75, 10);
|
||||
put(rec.get_real("VALSTAT"), 85, 13, _ndec);
|
||||
put(rec.get_char("CONSEGNA"), 98);
|
||||
put(rec.get_char("TRASPORTO"), 99);
|
||||
put(rec.get("PAESE"), 100, 2);
|
||||
put(rec.get("PROV"), 102, 2);
|
||||
put(rec.get("PAESE"), 100, 2);
|
||||
put(rec.get("PROV"), 102, 2);
|
||||
}
|
||||
else
|
||||
put("", 65, 100);
|
||||
@ -278,13 +274,12 @@ void TRecord_intra::put(const TRectype& rec, TIntra_context& ic)
|
||||
put(rec.get("STATO"), 34, 2);
|
||||
put(rec.get("PIVA"), 36, 12);
|
||||
put(rec.get("SEGNORETT"), 48, 1);
|
||||
put(rec.get_real("AMMLIRE"), 49, 13, _ndec);
|
||||
put(abs(rec.get_real("AMMLIRE")), 49, 13, _ndec);
|
||||
put(rec.get("NATURA"), 62, 1);
|
||||
put(rec.get("NOMENCL").mid(0,4), 63, 4, "Z"); //il campo viene spezzato in 3 pezzi
|
||||
put(rec.get("NOMENCL").mid(4,2), 67, 2, "Z");
|
||||
put(rec.get("NOMENCL").mid(6,2), 69, 2, "Z");
|
||||
put(rec.get("NOMENCL"), 63, 8, "Z"); // il campo NON viene spezzato in 3 pezzi
|
||||
|
||||
if (ic._freq == 'M')
|
||||
put(rec.get_real("VALSTAT"), 71, 13, _ndec);
|
||||
put(abs(rec.get_real("VALSTAT")), 71, 13, _ndec);
|
||||
else
|
||||
put("", 71, 13);
|
||||
}
|
||||
@ -303,10 +298,8 @@ void TRecord_intra::print_on(ostream& o) const
|
||||
o << endl;
|
||||
}
|
||||
|
||||
TRecord_intra::TRecord_intra() : TString(132)
|
||||
{
|
||||
_ndec = TCurrency::get_firm_dec() > 0 ? 0 : -3;
|
||||
}
|
||||
TRecord_intra::TRecord_intra() : TString(132), _ndec(0)
|
||||
{ }
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -317,11 +310,11 @@ class TDischetto_mask : public TIntra_mask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
virtual short type_field() const { return F_TIPO; }
|
||||
virtual short type_field() const { return F_TIPO; }
|
||||
virtual short period_field() const { return F_PERIODO_M; }
|
||||
virtual int anno() const { return get_int(F_ANNO); }
|
||||
|
||||
long calcola_totale(TCursor& cur, real& tot) const;
|
||||
TRecnotype calcola_totale(TCursor& cur, real& tot) const;
|
||||
bool write_record(ofstream& out, const TRecord_intra& rec, TIntra_context& ic);
|
||||
|
||||
void proponi_numero();
|
||||
@ -408,10 +401,10 @@ bool TDischetto_mask::on_field_event(TOperable_field& o, TField_event e, long jo
|
||||
return TIntra_mask::on_field_event(o, e, jolly);
|
||||
}
|
||||
|
||||
long TDischetto_mask::calcola_totale(TCursor& cur, real& tot) const
|
||||
TRecnotype TDischetto_mask::calcola_totale(TCursor& cur, real& tot) const
|
||||
{
|
||||
TWait_cursor arrow;
|
||||
const long items = cur.items();
|
||||
const TRecnotype items = cur.items();
|
||||
cur.freeze();
|
||||
|
||||
tot = ZERO;
|
||||
@ -420,8 +413,8 @@ long TDischetto_mask::calcola_totale(TCursor& cur, real& tot) const
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
const char tipo = rec.get_char("TIPO");
|
||||
const real val = rec.get_real("AMMLIRE");
|
||||
// Da chiarire: come sommare le rettifiche negative!
|
||||
const real val = rec.get_real("AMMLIRE").round(0); // Arrotonda all'Euro i valori intermedi
|
||||
// Da chiarire: come sommare le rettifiche negative!
|
||||
if ((tipo == 'B' || tipo == 'D') && rec.get_char("SEGNORETT") == '-')
|
||||
tot -= val; // Rettifiche negative
|
||||
else
|
||||
@ -442,21 +435,18 @@ bool TDischetto_mask::write_record(ofstream& out, const TRecord_intra& rec, TInt
|
||||
{
|
||||
out.close();
|
||||
|
||||
TFilename name;
|
||||
name = get(F_DISCO);
|
||||
name.add(get(F_PATH));
|
||||
TFilename name = get(F_PATH);
|
||||
name.add("scambi.cee");
|
||||
message_box(TR("Inserire un nuovo dischetto prima di continuare."));
|
||||
|
||||
out.open(name);
|
||||
if (out)
|
||||
{
|
||||
ic._written = 0;
|
||||
good = TRUE;
|
||||
good = true;
|
||||
}
|
||||
}
|
||||
if (!good)
|
||||
error_box(TR("Errore di scrittura su disco: ripetere l'operazione."));
|
||||
|
||||
return good;
|
||||
}
|
||||
|
||||
@ -470,7 +460,7 @@ void TDischetto_mask::genera_dischetto(char tip, int mode)
|
||||
ic._periodo = periodo();
|
||||
ic._progr = get_long(F_NUMERO);
|
||||
|
||||
TString16 codtab; codtab.format("%c%04d%02d", ic._tipo, ic._anno, ic._periodo);
|
||||
TString8 codtab; codtab.format("%c%04d%02d", ic._tipo, ic._anno, ic._periodo);
|
||||
|
||||
TTable ird("IRD");
|
||||
ird.put("CODTAB", codtab);
|
||||
@ -478,8 +468,8 @@ void TDischetto_mask::genera_dischetto(char tip, int mode)
|
||||
|
||||
if (exist)
|
||||
{
|
||||
const char* ac = tip == 'A' ? TR("agli acquisti") : TR("alle cessioni");
|
||||
if (!yesno_box(FR("Il dischetto relativo %s del periodo indicato è già stato generato:\n"
|
||||
const char* ac = tip == 'A' ? TR("acquisti") : TR("cessioni");
|
||||
if (!yesno_box(FR("Il file %s del periodo indicato è già stato generato:\n"
|
||||
"Si desidera proseguire ugualmente?"), ac))
|
||||
return;
|
||||
}
|
||||
@ -498,32 +488,26 @@ void TDischetto_mask::genera_dischetto(char tip, int mode)
|
||||
|
||||
ic._righe_rett = calcola_totale(rett, ic._totale_rett);
|
||||
|
||||
TFilename name;
|
||||
name = get(F_DISCO);
|
||||
name.add(get(F_PATH));
|
||||
TFilename name = get(F_PATH);
|
||||
name.add("scambi.cee");
|
||||
|
||||
if (name.exist())
|
||||
{
|
||||
bool do_remove = (mode == 2);
|
||||
if (mode == 0)
|
||||
{
|
||||
do_remove = yesno_box(FR("Il file %s, esiste gia': si desiderla eliminarlo?\n"
|
||||
"Rispondendo SI i dati sul dischetto verranno azzerati.\n"
|
||||
do_remove = yesno_box(FR("Il file %s esiste già: si desiderla eliminarlo?\n"
|
||||
"Rispondendo SI i dati sul file verranno azzerati.\n"
|
||||
"Rispondendo NO i dati verranno accodati a quelli già presenti"),
|
||||
(const char*)name);
|
||||
}
|
||||
if (do_remove)
|
||||
::remove(name);
|
||||
xvt_fsys_remove_file(name);
|
||||
}
|
||||
|
||||
ofstream out(name, ios::out | ios::app);
|
||||
if (!out)
|
||||
{
|
||||
error_box(FR("Impossibile creare il file %s\n"
|
||||
"Assicurarsi di avere inserito un dischetto\n"
|
||||
"formattato e ripetere nuovamente l'operazione."),
|
||||
(const char*)name);
|
||||
cantwrite_box(name);
|
||||
return;
|
||||
}
|
||||
ic._disksize = xvt_fsys_get_disk_size(name, 'b') - (64L*1024L);
|
||||
@ -531,7 +515,7 @@ void TDischetto_mask::genera_dischetto(char tip, int mode)
|
||||
|
||||
const long total = ic._righe_riep + ic._righe_rett;
|
||||
|
||||
TProgind pi(total, TR("Generazione scambi.cee"), FALSE, TRUE);
|
||||
TProgress_monitor pi(total, TR("Generazione scambi.cee"), false);
|
||||
TRecord_intra rec;
|
||||
rec.genera_testata(ic);
|
||||
out << rec;
|
||||
@ -539,7 +523,7 @@ void TDischetto_mask::genera_dischetto(char tip, int mode)
|
||||
rec.reset_data();
|
||||
for (riep = 0L; riep.pos() < ic._righe_riep; ++riep)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
pi.add_status();
|
||||
rec.put(riep.curr(), ic);
|
||||
if (!write_record(out, rec, ic))
|
||||
return;
|
||||
@ -547,7 +531,7 @@ void TDischetto_mask::genera_dischetto(char tip, int mode)
|
||||
rec.reset_data();
|
||||
for (rett = 0L; rett.pos() < ic._righe_rett; ++rett)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
pi.add_status();
|
||||
rec.put(riep.curr(), ic);
|
||||
if (!write_record(out, rec, ic))
|
||||
return;
|
||||
@ -587,8 +571,7 @@ protected:
|
||||
|
||||
void TDischetto_app::main_loop()
|
||||
{
|
||||
open_files(LF_TABCOM, LF_TAB, LF_CLIFO,
|
||||
LF_INTRA, LF_RINTRA, LF_RIEPRETT, 0);
|
||||
open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_INTRA, LF_RINTRA, LF_RIEPRETT, 0);
|
||||
TDischetto_mask m;
|
||||
while (m.run() == K_ENTER)
|
||||
{
|
||||
@ -606,6 +589,6 @@ void TDischetto_app::main_loop()
|
||||
int in0200(int argc, char* argv[])
|
||||
{
|
||||
TDischetto_app a;
|
||||
a.run(argc, argv, TR("Generazione dischetti INTRA"));
|
||||
a.run(argc, argv, TR("Generazione scambi.cee"));
|
||||
return 0;
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
#define F_PERIODO_M 103
|
||||
#define F_PERIODO_T 104
|
||||
#define F_PERIODO_A 105
|
||||
#define F_DISCO 106
|
||||
#define F_NUMERO 107
|
||||
#define F_LAST 108
|
||||
#define F_PATH 109
|
||||
|
@ -1,10 +1,6 @@
|
||||
#include "in0200a.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <stdbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Generazione Dischetti INTRA" 0 2 0 0
|
||||
PAGE "Generazione file scambi.cee" -1 -1 43 7
|
||||
|
||||
LIST F_TIPO 1 10
|
||||
BEGIN
|
||||
@ -58,24 +54,31 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
LIST F_DISCO 2
|
||||
BEGIN
|
||||
PROMPT 1 4 "Disco destinazione "
|
||||
ITEM "A:|A:" MESSAGE CLEAR,F_PATH
|
||||
ITEM "B:|B:" MESSAGE CLEAR,F_PATH
|
||||
ITEM "C:|C:" MESSAGE ENABLE,F_PATH
|
||||
END
|
||||
|
||||
STRING F_PATH 50 29
|
||||
BEGIN
|
||||
PROMPT 1 5 "Cartella "
|
||||
END
|
||||
|
||||
BUTTON F_RIEPILOGHI 26 1
|
||||
BEGIN
|
||||
PROMPT -11 -3 "~Generazione Riepiloghi"
|
||||
DSELECT
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
||||
BUTTON DLG_OK 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 "Conferma"
|
||||
PICTURE TOOL_SAVEREC
|
||||
END
|
||||
|
||||
BUTTON F_RIEPILOGHI 2 2
|
||||
BEGIN
|
||||
PROMPT 2 1 "Riepiloghi"
|
||||
PICTURE TOOL_ELABORA
|
||||
END
|
||||
|
||||
#include <helpbar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
@ -87,17 +87,17 @@ bool TImmissione_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
case F_NUM_REG:
|
||||
if (e == fe_modify || e == fe_init)
|
||||
{
|
||||
_caus_valintra = TRUE; // Default value
|
||||
_caus_valintra = true; // Default value
|
||||
if (app().has_module(CGAUT, CHK_DONGLE))
|
||||
{
|
||||
const TString& numreg = o.get();
|
||||
if (numreg.not_empty())
|
||||
if (numreg.full())
|
||||
{
|
||||
const TRectype& mov = cache().get(LF_MOV, numreg);
|
||||
if (mov.empty())
|
||||
{
|
||||
if (e == fe_modify && !app().is_transaction())
|
||||
warning_box(FR("Il movimento contabile %s non esiste"), (const char*)numreg);
|
||||
warning_box(FR("Il movimento contabile %s non esiste."), (const char*)numreg);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -108,7 +108,7 @@ bool TImmissione_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
const TString& caus = mov.get(MOV_CODCAUS);
|
||||
const TCausale c(caus);
|
||||
if (!c.intra())
|
||||
return error_box(FR("La causale %s del movimento contabile %s non e' intracomunitaria"),
|
||||
return error_box(FR("La causale %s del movimento contabile %s non è intracomunitaria."),
|
||||
(const char*)caus, (const char*)numreg);
|
||||
_caus_valintra = c.valintra();
|
||||
}
|
||||
@ -283,60 +283,37 @@ bool TImmissione_mask::on_sheet_field_event(TOperable_field& o, TField_event e,
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_NOMENCLATURA2:
|
||||
case F_NOMENCLATURA:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TString4 str; str = o.get();
|
||||
if (str.len() != 2)
|
||||
{
|
||||
TMask& m = o.mask();
|
||||
if (!o.empty())
|
||||
{
|
||||
str.format("%02d", atoi(str));
|
||||
o.set(str);
|
||||
const TRectype& nom = cache().get("%NOC", o.get());
|
||||
|
||||
m.set(F_UMS, nom.get("S5"), 0x1);
|
||||
|
||||
bool req = frequenza(anno()) == 'M';
|
||||
if (req) // Solo la frequenza mensile puo' obbligare
|
||||
{
|
||||
const char obb = nom.get_char("S4");
|
||||
req = obb == 'E' || obb == tipo();
|
||||
}
|
||||
const CheckType chk = req ? CHECK_REQUIRED : CHECK_NORMAL;
|
||||
m.field(F_MASSA_KG).check_type(chk);
|
||||
m.field(F_UMS).check_type(chk);
|
||||
m.field(F_MASSA_UMS).check_type(chk);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.set(F_UMS, "", 0x1);
|
||||
}
|
||||
}
|
||||
case F_NOMENCLATURA1:
|
||||
case F_NOMENCLATURA3:
|
||||
if (e == fe_close)
|
||||
{
|
||||
if (frequenza() != 'A')
|
||||
{
|
||||
TMask& m = o.mask();
|
||||
TString16 key; key << m.get(F_NOMENCLATURA1) << m.get(F_NOMENCLATURA2) << m.get(F_NOMENCLATURA3);
|
||||
if (key.empty())
|
||||
return error_box(TR("La nomenclatura combinata e' obbligatoria"));
|
||||
}
|
||||
}
|
||||
else
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TMask& m = o.mask();
|
||||
if (!o.empty())
|
||||
{
|
||||
TString16 key; key << m.get(F_NOMENCLATURA1) << m.get(F_NOMENCLATURA2) << m.get(F_NOMENCLATURA3);
|
||||
const TRectype& nom = cache().get("%NOC", key);
|
||||
|
||||
m.set(F_UMS, nom.get("S5"), TRUE);
|
||||
|
||||
bool req = frequenza(anno()) == 'M';
|
||||
if (req) // Solo la frequenza mensile puo' obbligare
|
||||
{
|
||||
const char obb = nom.get_char("S4");
|
||||
req = obb == 'E' || obb == tipo();
|
||||
}
|
||||
const CheckType chk = req ? CHECK_REQUIRED : CHECK_NORMAL;
|
||||
m.field(F_MASSA_KG).check_type(chk);
|
||||
m.field(F_UMS).check_type(chk);
|
||||
m.field(F_MASSA_UMS).check_type(chk);
|
||||
}
|
||||
else
|
||||
{
|
||||
m.set(F_UMS, "", TRUE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
TImmissione_mask::TImmissione_mask()
|
||||
@ -355,15 +332,14 @@ bool TImmissione_intra::protected_record(TRectype & rec)
|
||||
const int periodo = _msk->date2periodo(d);
|
||||
|
||||
bool prot = is_riepilogo(tipo, d.year(), periodo) &&
|
||||
!yesno_box(TR("Attenzione: il movimento appartiene ad un riepilogo esistente,:\nSi desidera poterlo modificare ugualmente?"));
|
||||
!yesno_box(TR("Attenzione: il movimento appartiene ad un riepilogo esistente.\nSi desidera modificarlo ugualmente?"));
|
||||
_msk->enable(DLG_SAVEREC, !prot);
|
||||
return prot;
|
||||
}
|
||||
|
||||
bool TImmissione_intra::user_create()
|
||||
{
|
||||
open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_MOV,
|
||||
LF_INTRA, LF_RINTRA, 0);
|
||||
open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_MOV, LF_INTRA, LF_RINTRA, 0);
|
||||
_rel = new TRelation(LF_INTRA);
|
||||
_msk = new TImmissione_mask;
|
||||
return TRUE;
|
||||
|
25
in/in0500a.h
25
in/in0500a.h
@ -28,20 +28,17 @@
|
||||
#define F_AMM_LIRE 101
|
||||
#define F_AMM_VALUTA 102
|
||||
#define F_NATURA_TRANS 103
|
||||
#define F_NOMENCLATURA1 104
|
||||
#define F_NOMENCLATURA2 105
|
||||
#define F_NOMENCLATURA3 106
|
||||
|
||||
#define F_MASSA_KG 107
|
||||
#define F_MASSA_UMS 108
|
||||
#define F_UMS 109
|
||||
#define F_VALORE_STAT 110
|
||||
#define F_CONSEGNA 111
|
||||
#define F_TRASPORTO 112
|
||||
#define F_PAESE 113
|
||||
#define F_PAESE_ORIG 114
|
||||
#define F_PAESE_DUMMY 214
|
||||
#define F_PROV 115
|
||||
#define F_NOMENCLATURA 104
|
||||
#define F_MASSA_KG 105
|
||||
#define F_MASSA_UMS 106
|
||||
#define F_UMS 107
|
||||
#define F_VALORE_STAT 108
|
||||
#define F_CONSEGNA 109
|
||||
#define F_TRASPORTO 110
|
||||
#define F_PAESE 111
|
||||
#define F_PAESE_ORIG 112
|
||||
#define F_PAESE_DUMMY 212
|
||||
#define F_PROV 113
|
||||
|
||||
#define GR_CESSIONI 1
|
||||
#define GR_ACQUISTI 2
|
||||
|
@ -30,12 +30,13 @@ END
|
||||
NUMBER F_NUM_REG 7
|
||||
BEGIN
|
||||
PROMPT 1 3 "Numero registrazione "
|
||||
USE LF_INTRA
|
||||
USE LF_INTRA SELECT (#F_CLIFO="")||(#F_CLIFO==CODCF)
|
||||
JOIN LF_CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
|
||||
INPUT NUMREG F_NUM_REG
|
||||
DISPLAY "Numero" NUMREG
|
||||
DISPLAY "Data@10" DATAREG
|
||||
DISPLAY "C/A" TIPOMOV
|
||||
DISPLAY "Totale documento@R" TOTDOC
|
||||
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
||||
OUTPUT F_NUM_REG NUMREG
|
||||
CHECKTYPE REQUIRED
|
||||
@ -184,9 +185,7 @@ BEGIN
|
||||
ITEM "Ammontare\nOperaz.@18"
|
||||
ITEM "Ammontare\nValuta@18"
|
||||
ITEM "Natura\nTransaz.@7"
|
||||
ITEM "Nomenclat.\ncombinata@10"
|
||||
ITEM "@5"
|
||||
ITEM "@5"
|
||||
ITEM "Nomenclatura\ncombinata@10"
|
||||
ITEM "Massa Kg@13"
|
||||
ITEM "Massa Ums@13"
|
||||
ITEM "U.M."
|
||||
@ -210,7 +209,7 @@ ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Righe" -1 -1 78 11
|
||||
PAGE "Righe" -1 -1 78 9
|
||||
|
||||
CURRENCY F_AMM_LIRE 18
|
||||
BEGIN
|
||||
@ -240,58 +239,30 @@ BEGIN
|
||||
FIELD NATURA
|
||||
END
|
||||
|
||||
NUMBER F_NOMENCLATURA1 4
|
||||
NUMBER F_NOMENCLATURA 8
|
||||
BEGIN
|
||||
PROMPT 36 3 "Nomenclatura combinata "
|
||||
FLAGS "Z"
|
||||
USE %NOC
|
||||
INPUT CODTAB[1,4] F_NOMENCLATURA1
|
||||
INPUT CODTAB[5,6] F_NOMENCLATURA2
|
||||
INPUT CODTAB[7,8] F_NOMENCLATURA3
|
||||
INPUT CODTAB F_NOMENCLATURA
|
||||
DISPLAY "Codice" CODTAB[1,4]
|
||||
DISPLAY "@3" CODTAB[5,6]
|
||||
DISPLAY "@3" CODTAB[7,8]
|
||||
DISPLAY "@2" CODTAB[5,6]
|
||||
DISPLAY "@2" CODTAB[7,8]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NOMENCLATURA1 CODTAB[1,4]
|
||||
OUTPUT F_NOMENCLATURA2 CODTAB[5,6]
|
||||
OUTPUT F_NOMENCLATURA3 CODTAB[7,8]
|
||||
MESSAGE DIRTY,F_NOMENCLATURA3
|
||||
VALIDATE REQIF_FUNC 1 F_NOMENCLATURA2
|
||||
FIELD NOMENCL[1,4]
|
||||
WARNING "Nomenclatura combinata assente"
|
||||
END
|
||||
|
||||
STRING F_NOMENCLATURA2 2
|
||||
BEGIN
|
||||
PROMPT 67 3 ""
|
||||
COPY ALL F_NOMENCLATURA1
|
||||
MESSAGE DIRTY,F_NOMENCLATURA3
|
||||
VALIDATE REQIF_FUNC 1 F_NOMENCLATURA3
|
||||
FIELD NOMENCL[5,6]
|
||||
WARNING "Nomenclatura combinata assente"
|
||||
END
|
||||
|
||||
NUMBER F_NOMENCLATURA3 2
|
||||
BEGIN
|
||||
PROMPT 72 3 ""
|
||||
FLAGS "Z"
|
||||
COPY ALL F_NOMENCLATURA1
|
||||
CHECKTYPE NORMAL
|
||||
FIELD NOMENCL[7,8]
|
||||
WARNING "Nomenclatura combinata assente"
|
||||
OUTPUT F_NOMENCLATURA CODTAB
|
||||
FIELD NOMENCL
|
||||
VALIDATE FIXLEN_FUNC 8
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_MASSA_KG 13 5
|
||||
BEGIN
|
||||
PROMPT 1 4 "Massa Kg."
|
||||
PICTURE ".5"
|
||||
FIELD MASSAKG
|
||||
END
|
||||
|
||||
NUMBER F_MASSA_UMS 13 5
|
||||
BEGIN
|
||||
PROMPT 36 4 "Massa "
|
||||
PICTURE ".5"
|
||||
FIELD MASSAUMS
|
||||
END
|
||||
|
||||
@ -414,19 +385,23 @@ BEGIN
|
||||
FIELD PROV
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLABAR "" 0 0 0 2
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 ""
|
||||
PROMPT 1 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BEGIN
|
||||
PROMPT -23 -1 ""
|
||||
PROMPT 2 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -1 ""
|
||||
PROMPT 3 1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
@ -1,10 +1,6 @@
|
||||
#include "in0500a.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <stdbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Generazione Riepiloghi" 0 2 0 0
|
||||
PAGE "Generazione Riepiloghi" -1 -1 40 6
|
||||
|
||||
LIST R_TIPO 1 10
|
||||
BEGIN
|
||||
@ -49,4 +45,8 @@ END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <stdbar.h>
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
@ -64,7 +64,7 @@ bool TRiepiloghi_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
{
|
||||
TString16 key; key << get(F_NOMENCLATURA1) << get(F_NOMENCLATURA2) << get(F_NOMENCLATURA3);
|
||||
if (key.empty())
|
||||
return error_box(TR("La nomenclatura combinata e' obbligatoria"));
|
||||
return error_box(TR("La nomenclatura combinata è obbligatoria"));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -101,11 +101,9 @@ bool TRiepiloghi_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
if (e == fe_modify)
|
||||
{
|
||||
const TRectype& curr = efield(F_PARTITA_IVA).browse()->cursor()->curr();
|
||||
TString16 codval = curr.get("VALINTRA");
|
||||
|
||||
TString4 codval = curr.get("VALINTRA");
|
||||
if (codval.empty())
|
||||
codval = curr.get("CODVAL");
|
||||
|
||||
codval = curr.get("CODVAL");
|
||||
set(F_VALUTA, codval);
|
||||
}
|
||||
break;
|
||||
@ -165,25 +163,24 @@ public:
|
||||
|
||||
bool TRiepiloghi_intra::user_create()
|
||||
{
|
||||
open_files(LF_TABCOM, LF_TAB, LF_CLIFO,
|
||||
LF_INTRA, LF_RINTRA, LF_RIEPRETT, 0);
|
||||
open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_INTRA, LF_RINTRA, LF_RIEPRETT, 0);
|
||||
_rel = new TRelation(LF_RIEPRETT);
|
||||
_msk = new TRiepiloghi_mask;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TRiepiloghi_intra::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _rel;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TRiepiloghi_intra::get_next_key(TToken_string& k)
|
||||
{
|
||||
if (_msk->get(F_ANNO).empty() || _msk->get(F_PARTITA_IVA).empty())
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
_msk->autosave(*_rel);
|
||||
TRectype filter(_rel->curr());
|
||||
@ -199,7 +196,7 @@ bool TRiepiloghi_intra::get_next_key(TToken_string& k)
|
||||
}
|
||||
|
||||
k.cut(0); k.add(F_NUM_RIG); k.add(num_rig);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void TRiepiloghi_intra::init_insert_mode(TMask& m)
|
||||
@ -258,7 +255,7 @@ void TRiepiloghi_intra::check_existent_disk(const TMask& m)
|
||||
|
||||
const TRectype& ird = cache().get("IRD",str);
|
||||
if (!ird.empty())
|
||||
warning_box(FR("E' già stato generato il dischetto per il periodo %d dell'anno %d"), periodo,anno);
|
||||
warning_box(FR("E' già stato generato scambi.cee per il periodo %d dell'anno %d"), periodo,anno);
|
||||
|
||||
}
|
||||
|
||||
|
@ -70,17 +70,6 @@ bool TRettifiche_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
m.field(F_VALORE_STAT).check_type(chk);
|
||||
}
|
||||
break;
|
||||
case F_NOMENCLATURA2:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TString4 str; str = o.get();
|
||||
if (str.len() != 2)
|
||||
{
|
||||
str.format("%02d", atoi(str));
|
||||
o.set(str);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case O_NUM_RIG:
|
||||
if ((e == fe_init || e == fe_modify) && !o.empty())
|
||||
{
|
||||
@ -90,11 +79,11 @@ bool TRettifiche_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
bool ok = cur.ok();
|
||||
if (e == fe_modify && insert_mode())
|
||||
{
|
||||
for (short dlg = O_STATO; dlg <= O_NOMENCLATURA3; dlg++)
|
||||
for (short dlg = O_STATO; dlg <= O_NOMENCLATURA; dlg++)
|
||||
{
|
||||
switch (dlg)
|
||||
{
|
||||
case O_NUM_RIG: // Non riportare il nmumero riga!
|
||||
case O_NUM_RIG: // Non riportare il numero riga!
|
||||
break;
|
||||
default:
|
||||
const int pos = id2pos(dlg);
|
||||
|
@ -13,13 +13,11 @@
|
||||
#define O_NUM_RIG 112
|
||||
|
||||
#define O_NATURA_TRANS 121
|
||||
#define O_NOMENCLATURA1 122
|
||||
#define O_NOMENCLATURA 122
|
||||
#define O_AMMONTARE 123
|
||||
#define O_AMM_VALUTA 124
|
||||
#define O_VALUTA 125
|
||||
#define O_VALORE_STAT 126
|
||||
#define O_NOMENCLATURA2 127
|
||||
#define O_NOMENCLATURA3 128
|
||||
|
||||
#define F_TIPO 203
|
||||
#define F_ANNO 204
|
||||
@ -33,11 +31,9 @@
|
||||
#define F_NUM_RIG 212
|
||||
#define F_SEGNO 220
|
||||
#define F_NATURA_TRANS 221
|
||||
#define F_NOMENCLATURA1 222
|
||||
#define F_NOMENCLATURA 222
|
||||
#define F_AMMONTARE 223
|
||||
#define F_AMM_VALUTA 224
|
||||
#define F_VALUTA 225
|
||||
#define F_VALORE_STAT 226
|
||||
#define F_NOMENCLATURA2 227
|
||||
#define F_NOMENCLATURA3 228
|
||||
#define F_NUMREG 229
|
||||
|
@ -104,9 +104,7 @@ BEGIN
|
||||
OUTPUT O_STATO STATO
|
||||
OUTPUT O_PARTITA_IVA PIVA
|
||||
OUTPUT O_NATURA_TRANS NATURA
|
||||
OUTPUT O_NOMENCLATURA1 NOMENCL[1,4]
|
||||
OUTPUT O_NOMENCLATURA2 NOMENCL[5,6]
|
||||
OUTPUT O_NOMENCLATURA3 NOMENCL[7,8]
|
||||
OUTPUT O_NOMENCLATURA NOMENCL
|
||||
OUTPUT O_AMMONTARE AMMLIRE
|
||||
OUTPUT O_VALUTA CODVAL
|
||||
OUTPUT F_VALUTA CODVAL
|
||||
@ -162,24 +160,12 @@ BEGIN
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
NUMBER O_NOMENCLATURA1 4
|
||||
NUMBER O_NOMENCLATURA 8
|
||||
BEGIN
|
||||
PROMPT 28 7 "Nomenclatura combinata "
|
||||
FLAGS "DZ"
|
||||
END
|
||||
|
||||
STRING O_NOMENCLATURA2 2
|
||||
BEGIN
|
||||
PROMPT 58 7 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER O_NOMENCLATURA3 2
|
||||
BEGIN
|
||||
PROMPT 63 7 ""
|
||||
FLAGS "DZ"
|
||||
END
|
||||
|
||||
CURRENCY O_AMMONTARE 18
|
||||
BEGIN
|
||||
PROMPT 2 8 "Ammontare "
|
||||
@ -338,44 +324,15 @@ BEGIN
|
||||
FIELD NATURA
|
||||
END
|
||||
|
||||
NUMBER F_NOMENCLATURA1 4
|
||||
NUMBER F_NOMENCLATURA 8
|
||||
BEGIN
|
||||
PROMPT 28 15 "Nomenclatura combinata "
|
||||
FLAGS "Z"
|
||||
USE %NOC
|
||||
INPUT CODTAB[1,4] F_NOMENCLATURA1
|
||||
INPUT CODTAB[5,6] F_NOMENCLATURA2
|
||||
INPUT CODTAB[7,8] F_NOMENCLATURA3
|
||||
DISPLAY "Codice" CODTAB[1,4]
|
||||
DISPLAY "@3" CODTAB[5,6]
|
||||
DISPLAY "@3" CODTAB[7,8]
|
||||
INPUT CODTAB F_NOMENCLATURA
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NOMENCLATURA1 CODTAB[1,4]
|
||||
OUTPUT F_NOMENCLATURA2 CODTAB[5,6]
|
||||
OUTPUT F_NOMENCLATURA3 CODTAB[7,8]
|
||||
VALIDATE REQIF_FUNC 1 F_NOMENCLATURA2
|
||||
MESSAGE DIRTY,F_NOMENCLATURA3
|
||||
FIELD NOMENCL[1,4]
|
||||
WARNING "Nomenclatura combinata assente"
|
||||
END
|
||||
|
||||
STRING F_NOMENCLATURA2 2
|
||||
BEGIN
|
||||
PROMPT 58 15 ""
|
||||
COPY ALL F_NOMENCLATURA1
|
||||
VALIDATE REQIF_FUNC 1 F_NOMENCLATURA3
|
||||
MESSAGE DIRTY,F_NOMENCLATURA3
|
||||
FIELD NOMENCL[5,6]
|
||||
WARNING "Nomenclatura combinata assente"
|
||||
END
|
||||
|
||||
NUMBER F_NOMENCLATURA3 2
|
||||
BEGIN
|
||||
PROMPT 63 15 ""
|
||||
FLAGS "Z"
|
||||
COPY ALL F_NOMENCLATURA1
|
||||
CHECKTYPE NORMAL
|
||||
FIELD NOMENCL[7,8]
|
||||
OUTPUT F_NOMENCLATURA CODTAB
|
||||
FIELD NOMENCL
|
||||
WARNING "Nomenclatura combinata assente"
|
||||
END
|
||||
|
||||
|
284
in/inlib01.cpp
284
in/inlib01.cpp
@ -3,11 +3,14 @@
|
||||
#include <prefix.h>
|
||||
#include <progind.h>
|
||||
#include <recarray.h>
|
||||
#include <recset.h>
|
||||
#include <relation.h>
|
||||
|
||||
#include "inlib01.h"
|
||||
#include "in0500a.h"
|
||||
|
||||
#include "../cg/cgsaldac.h"
|
||||
|
||||
#include <mov.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -53,8 +56,8 @@ int TIntra_frequency::date2periodo(const TDate& d, char tipo) const
|
||||
|
||||
if (freq == 'A')
|
||||
return 1;
|
||||
|
||||
const int month = d.month();
|
||||
|
||||
if (freq == 'T')
|
||||
return (month / 3) + 1;
|
||||
|
||||
@ -103,7 +106,7 @@ void TIntra_mask::on_firm_change()
|
||||
|
||||
short TIntra_mask::type_field() const
|
||||
{
|
||||
NFCHECK("Non e' stato specificato il campo del tipo");
|
||||
NFCHECK("Non è stato specificato il campo del tipo");
|
||||
return DLG_NULL;
|
||||
}
|
||||
|
||||
@ -187,6 +190,7 @@ class TDati_riepilogo : public TSortable
|
||||
TToken_string _key;
|
||||
TCurrency _ammlire, _ammvaluta;
|
||||
real _valstat, _massakg, _massaums;
|
||||
long _numreg;
|
||||
|
||||
protected:
|
||||
virtual TObject* dup() const { return new TDati_riepilogo(*this); }
|
||||
@ -241,7 +245,7 @@ void TDati_riepilogo::write(TRectype& rec) const
|
||||
rec.put("PROV", provincia(str));
|
||||
|
||||
rec.put("AMMLIRE", _ammlire.get_num());
|
||||
if (_ammvaluta.is_zero())
|
||||
if (_ammvaluta.is_zero() || _ammvaluta.is_firm_value())
|
||||
{
|
||||
rec.zero("CODVAL"); // Altrimenti genera falsi codici valuta EUR ...
|
||||
rec.zero("AMMVALUTA"); // ... con importi nulli
|
||||
@ -254,6 +258,7 @@ void TDati_riepilogo::write(TRectype& rec) const
|
||||
rec.put("VALSTAT", _valstat);
|
||||
rec.put("MASSAKG", _massakg);
|
||||
rec.put("MASSAUMS", _massaums);
|
||||
rec.put("NUMREG", _numreg);
|
||||
}
|
||||
|
||||
TDati_riepilogo::TDati_riepilogo(const TDati_riepilogo& r)
|
||||
@ -269,7 +274,8 @@ TDati_riepilogo::TDati_riepilogo(const TToken_string& key,
|
||||
_ammvaluta(rec.get_real("AMMVALUTA"), codval),
|
||||
_valstat(rec.get_real("VALSTAT")),
|
||||
_massakg(rec.get_real("MASSAKG")),
|
||||
_massaums(rec.get_real("MASSAUMS"))
|
||||
_massaums(rec.get_real("MASSAUMS")),
|
||||
_numreg(rec.get_long("NUMREG"))
|
||||
{ }
|
||||
|
||||
|
||||
@ -283,7 +289,8 @@ class TRiepiloghi : public TObject
|
||||
TAssoc_array _ass;
|
||||
|
||||
public:
|
||||
void add(const TRectype& rec, const TRectype& mov);
|
||||
void destroy() { _arr.destroy(); _ass.destroy(); }
|
||||
void add(const TRectype& row, const TRectype& head, const TRectype& mov);
|
||||
|
||||
int items() const { return _arr.items(); }
|
||||
int sort() { _arr.sort(); return items(); }
|
||||
@ -292,41 +299,184 @@ public:
|
||||
{ return (const TDati_riepilogo&)_arr[r]; }
|
||||
};
|
||||
|
||||
void TRiepiloghi::add(const TRectype& rec, const TRectype& mov)
|
||||
void TRiepiloghi::add(const TRectype& row, const TRectype& head, const TRectype& mov)
|
||||
{
|
||||
TString16 cod;
|
||||
const char tipocf = mov.get_char("TIPOCF");
|
||||
cod << tipocf << '|' << mov.get("CODCF");
|
||||
TString8 cod; cod << head.get_char("TIPOCF") << '|' << head.get("CODCF");
|
||||
const TRectype& clifo = cache().get(LF_CLIFO, cod);
|
||||
|
||||
cod = mov.get("CODVAL");
|
||||
|
||||
TString4 codval = head.get("CODVAL");
|
||||
if (::is_euro_value(codval))
|
||||
codval.cut(0);
|
||||
|
||||
TToken_string key;
|
||||
key.add(clifo.get("STATOPAIV"));
|
||||
key.add(clifo.get("PAIV"));
|
||||
key.add(cod); // Non e' chiaro se raggruppare per valuta!
|
||||
key.add(rec.get("NATURA"));
|
||||
key.add(rec.get("NOMENCL"));
|
||||
key.add(rec.get("CONSEGNA"));
|
||||
key.add(rec.get("TRASPORTO"));
|
||||
key.add(rec.get("PAESE"));
|
||||
key.add(rec.get("PAESEORIG")); // Campo solo per Acquisti
|
||||
key.add(rec.get("PROV"));
|
||||
key.add(codval); // Non e' chiaro se raggruppare per valuta!
|
||||
key.add(row.get("NATURA"));
|
||||
key.add(row.get("NOMENCL"));
|
||||
key.add(row.get("CONSEGNA"));
|
||||
key.add(row.get("TRASPORTO"));
|
||||
key.add(row.get("PAESE"));
|
||||
key.add(row.get("PAESEORIG")); // Campo solo per Acquisti
|
||||
key.add(row.get("PROV"));
|
||||
|
||||
TDati_riepilogo* data = (TDati_riepilogo*)_ass.objptr(key);
|
||||
if (data == NULL)
|
||||
{
|
||||
data = new TDati_riepilogo(key, rec, cod);
|
||||
data = new TDati_riepilogo(key, row, codval);
|
||||
_ass.add(key, data);
|
||||
_arr.add(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
const TDati_riepilogo dr(key, rec, cod);
|
||||
const TDati_riepilogo dr(key, row, codval);
|
||||
*data += dr;
|
||||
}
|
||||
}
|
||||
|
||||
class TRettifiche : public TObject
|
||||
{
|
||||
TArray _rett;
|
||||
TIntra_frequency _freq;
|
||||
|
||||
protected:
|
||||
long rett2riep(const TRectype& rett) const;
|
||||
|
||||
public:
|
||||
int items() const { return _rett.items(); }
|
||||
long nc2ft(long numreg_nc) const;
|
||||
int add(const TRectype& rintra, const TRectype& mov, long nr_fattura);
|
||||
int load_manual_rett(char tipo, int anno, int periodo);
|
||||
int sort();
|
||||
const TRectype& operator[](int r) const { return (const TRectype&)_rett[r]; }
|
||||
};
|
||||
|
||||
long TRettifiche::nc2ft(long numreg_nc) const
|
||||
{
|
||||
long numreg_ft = 0L;
|
||||
|
||||
TPartite_array games;
|
||||
games.add_numreg(numreg_nc); // Carica le partite in cui è coinvolta questa nota di credito (sempre e solo una!)
|
||||
for (TPartita* p = games.first(); p != NULL && numreg_ft<=0; p = games.next())
|
||||
{
|
||||
#ifdef DBG
|
||||
if (p->conto().codclifo() == 13201)
|
||||
int farmoki = 1;
|
||||
#endif
|
||||
for (int r = p->prima_fattura(); r >= 0 && r <= p->last(); r = p->succ(r))
|
||||
{
|
||||
const TRiga_partite& partita = p->riga(r);
|
||||
const tipo_movimento tm = partita.tipo();
|
||||
if (tm == tm_fattura)
|
||||
{
|
||||
const long n = partita.get_long(PART_NREG);
|
||||
if (n > 0 && n != numreg_nc) // Puo' succedere che n==numreg_nc con le fatture negative!
|
||||
{
|
||||
numreg_ft = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return numreg_ft;
|
||||
}
|
||||
|
||||
int TRettifiche::load_manual_rett(char tipo, int anno, int periodo)
|
||||
{
|
||||
_rett.destroy();
|
||||
tipo = tipo < 'C' ? 'B' : 'D'; // forzatura tipo = B o D
|
||||
TString query, filtro;
|
||||
filtro << "TIPO=" << tipo << " ANNO=" << anno << " PERIODO=" << periodo;
|
||||
query << "USE " << LF_RIEPRETT << " SELECT NUMREG=\"\"";
|
||||
query << "\nFROM " << filtro;
|
||||
query << "\nTO " << filtro;
|
||||
TISAM_recordset rett(query);
|
||||
|
||||
for (bool good = rett.move_first(); good; good = rett.move_next())
|
||||
_rett.add(rett.cursor()->curr());
|
||||
|
||||
return _rett.items();
|
||||
}
|
||||
|
||||
long TRettifiche::rett2riep(const TRectype& rett) const
|
||||
{
|
||||
TString query, filter;
|
||||
filter << "TIPO=" << (rett.get_char("TIPO")=='B' ? 'A' : 'C')
|
||||
<< " ANNO=" << rett.get("ANNORETT") << " PERIODO=" << rett.get("PERETT");
|
||||
query << "USE " << LF_RIEPRETT
|
||||
<< "\nSELECT (NOMENCL='" << rett.get("NOMENCL") << "')&&(PIVA='" << rett.get("PIVA") << "')"
|
||||
<< "\nFROM " << filter << "\nTO " << filter;
|
||||
long nriga = 1;
|
||||
TISAM_recordset rr(query);
|
||||
if (rr.move_first())
|
||||
nriga = rr.get("NUMRIG").as_int();
|
||||
return nriga;
|
||||
}
|
||||
|
||||
int TRettifiche::add(const TRectype& rintra, const TRectype& mov, long nr_fattura)
|
||||
{
|
||||
CHECKD(rintra.num() == LF_RINTRA, "Record non INTRA ", rintra.num());
|
||||
const TDate datareg = mov.get(MOV_DATAREG);
|
||||
|
||||
TRectype rett(LF_RIEPRETT);
|
||||
const char tipo = mov.get_char(MOV_TIPO)=='F' ? 'B' : 'D';
|
||||
rett.put("TIPO", tipo);
|
||||
rett.put("ANNO", datareg.year());
|
||||
rett.put("PERIODO", _freq.date2periodo(datareg, tipo));
|
||||
rett.put("NUMRIG", 0); // Auto
|
||||
|
||||
TString8 cod; cod << mov.get_char(MOV_TIPO) << '|' << mov.get(MOV_CODCF);
|
||||
const TRectype& clifo = cache().get(LF_CLIFO, cod);
|
||||
|
||||
TString4 codval = mov.get("CODVALI");
|
||||
if (::is_euro_value(codval))
|
||||
codval.cut(0);
|
||||
|
||||
rett.put("STATO", clifo.get("STATOPAIV"));
|
||||
rett.put("PIVA", clifo.get("PAIV"));
|
||||
rett.put("NATURA", rintra.get("NATURA"));
|
||||
rett.put("NOMENCL", rintra.get("NOMENCL"));
|
||||
rett.put("CONSEGNA", rintra.get("CONSEGNA"));
|
||||
rett.put("TRASPORTO", rintra.get("TRASPORTO"));
|
||||
rett.put("PAESE", rintra.get("PAESE"));
|
||||
if (tipo == 'B') // Campi solo per Acquisti
|
||||
{
|
||||
rett.put("PAESEORIG", rintra.get("PAESEORIG"));
|
||||
rett.put("PROV", rintra.get("PROV"));
|
||||
}
|
||||
const real euri = rintra.get_real("AMMLIRE");
|
||||
rett.put("AMMLIRE", abs(euri));
|
||||
if (codval.full())
|
||||
{
|
||||
rett.put("CODVAL", codval);
|
||||
rett.put("AMMVALUTA", abs(mov.get_real("CORRVALUTA")));
|
||||
}
|
||||
rett.put("SEGNORETT", euri>ZERO ? '+': '-');
|
||||
rett.put("VALSTAT", abs(rintra.get_real("VALSTAT")));
|
||||
rett.put("MASSAKG", rintra.get("MASSAKG"));
|
||||
rett.put("MASSAUMS", rintra.get("MASSAUMS"));
|
||||
rett.put("NUMREG", mov.get(MOV_NUMREG));
|
||||
|
||||
const TDate dt_fatt = cache().get(LF_MOV, nr_fattura, MOV_DATAREG);
|
||||
rett.put("ANNORETT", dt_fatt.year());
|
||||
rett.put("PERETT", _freq.date2periodo(dt_fatt, tipo));
|
||||
rett.put("NUMRETT", rett2riep(rett));
|
||||
|
||||
return _rett.add(rett);
|
||||
}
|
||||
|
||||
int TRettifiche::sort()
|
||||
{
|
||||
_rett.pack();
|
||||
for (int i = 0; i < _rett.items(); i++)
|
||||
{
|
||||
TRectype* r = (TRectype*)_rett.objptr(i);
|
||||
r->put("NUMRIG", i+1);
|
||||
}
|
||||
return _rett.items();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TGenerazione_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -334,11 +484,12 @@ void TRiepiloghi::add(const TRectype& rec, const TRectype& mov)
|
||||
class TGenerazione_mask : public TIntra_mask
|
||||
{
|
||||
TRiepiloghi _riep;
|
||||
TRettifiche _rett;
|
||||
|
||||
protected:
|
||||
virtual short type_field() const { return R_TIPO; }
|
||||
virtual short type_field() const { return R_TIPO; }
|
||||
virtual short period_field() const { return R_PERIODO_M; }
|
||||
virtual int anno() const { return get_int(R_ANNO); }
|
||||
virtual int anno() const { return get_int(R_ANNO); }
|
||||
|
||||
public:
|
||||
bool genera_riepiloghi();
|
||||
@ -352,13 +503,22 @@ bool TGenerazione_mask::genera_riepiloghi()
|
||||
const char tipo = get(R_TIPO)[0];
|
||||
const int anno_r = anno();
|
||||
const int peri = periodo();
|
||||
int da_mese, a_mese;
|
||||
const char freq = frequenza(anno_r, tipo);
|
||||
|
||||
if (is_riepilogo(tipo, anno_r, peri) &&
|
||||
!yesno_box(TR("Attenzione esiste gia' il riepilogo\nper il periodo indicato, si desidera continuare")))
|
||||
TString msg;
|
||||
msg.format(FR("Si sta per generare il riepilogo %s del periodo %d dell'anno %d."),
|
||||
tipo == 'A' ? TR("acquisti") : TR("cessioni"), peri, anno_r);
|
||||
if (is_riepilogo(tipo, anno_r, peri))
|
||||
msg << TR("\nAttenzione questo riepilogo è già stato generato.\nSi desidera continuare ugualmente?");
|
||||
else
|
||||
msg << TR("\nSi desidera procedere?");
|
||||
if (!yesno_box(msg))
|
||||
return false;
|
||||
|
||||
_riep.destroy();
|
||||
_rett.load_manual_rett(tipo+1, anno_r, peri);
|
||||
|
||||
int da_mese = peri, a_mese = peri;
|
||||
switch (freq)
|
||||
{
|
||||
case 'T':
|
||||
@ -398,23 +558,40 @@ bool TGenerazione_mask::genera_riepiloghi()
|
||||
const long items = cur.items();
|
||||
if (items > 0)
|
||||
{
|
||||
TProgind pi(items, TR("Lettura movimenti intra..."), true, true);
|
||||
TProgress_monitor pi(items, TR("Lettura movimenti intra..."));
|
||||
cur.freeze();
|
||||
for (cur = 0; cur.pos() < items; ++cur)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
if (pi.iscancelled())
|
||||
if (!pi.add_status())
|
||||
return warning_box(TR("Operazione annullata"));
|
||||
|
||||
TDate datacomp = mov.get(MOV_DATACOMPI);
|
||||
if (!datacomp.ok())
|
||||
datacomp = head.get_date(MOV_DATAREG);
|
||||
const TDate datacomp = head.get_date(MOV_DATAREG);
|
||||
if (datacomp >= da_data && datacomp <= a_data)
|
||||
{
|
||||
bool rowok = rel.is_first_match(LF_RINTRA);
|
||||
while (rowok)
|
||||
{
|
||||
_riep.add(row, head);
|
||||
bool is_rettifica = false;
|
||||
const tipo_movimento tm = (tipo_movimento)mov.get_int(MOV_TIPOMOV);
|
||||
long numreg_ft = 0;
|
||||
if (tm_nota_credito || (tm==tm_fattura && mov.get_real(MOV_TOTDOC) < ZERO))
|
||||
{
|
||||
const long numreg_nc = mov.get_long(MOV_NUMREG);
|
||||
numreg_ft = _rett.nc2ft(numreg_nc);
|
||||
if (numreg_ft > 0)
|
||||
{
|
||||
const TRectype& head_ft = cache().get(LF_MOV, numreg_ft);
|
||||
const TDate data_ft = head_ft.get_date(MOV_DATAREG);
|
||||
const int anno_ft = data_ft.year();
|
||||
const int peri_ft = _freq.date2periodo(data_ft, tipo);
|
||||
is_rettifica = anno_ft != anno_r || peri_ft != peri; // Rettifica solo se periodo diverso dalla fattura
|
||||
}
|
||||
}
|
||||
|
||||
if (is_rettifica)
|
||||
_rett.add(row, mov, numreg_ft);
|
||||
else
|
||||
_riep.add(row, head, mov);
|
||||
rowok = rel.next_match(LF_RINTRA);
|
||||
}
|
||||
}
|
||||
@ -423,11 +600,12 @@ bool TGenerazione_mask::genera_riepiloghi()
|
||||
else
|
||||
return warning_box(TR("Non ci sono movimenti nel periodo specificato"));
|
||||
|
||||
TLocalisamfile riep(LF_RIEPRETT);
|
||||
|
||||
const int riepiloghi = _riep.sort();
|
||||
if (riepiloghi > 0)
|
||||
{
|
||||
TProgind pi(riepiloghi, TR("Scrittura riepiloghi intra..."), false, true);
|
||||
TLocalisamfile riep(LF_RIEPRETT);
|
||||
TProgress_monitor pi(riepiloghi, TR("Scrittura riepiloghi intra..."), false);
|
||||
riep.put("TIPO", tipo);
|
||||
riep.put("ANNO", anno_r);
|
||||
riep.put("PERIODO", peri);
|
||||
@ -435,7 +613,7 @@ bool TGenerazione_mask::genera_riepiloghi()
|
||||
int err = riep.read();
|
||||
for (int r = 0; r < riepiloghi; r++)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
pi.add_status();
|
||||
riep.put("TIPO", tipo);
|
||||
riep.put("ANNO", anno_r);
|
||||
riep.put("PERIODO", peri);
|
||||
@ -454,15 +632,32 @@ bool TGenerazione_mask::genera_riepiloghi()
|
||||
err = _iseof;
|
||||
}
|
||||
}
|
||||
while (err == NOERR)
|
||||
{
|
||||
riep.remove();
|
||||
err = riep.next();
|
||||
if (err == NOERR && riep.get_long("NUMRIG") == 1)
|
||||
err = _iseof;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Cancella eventuali altri riepiloghi del periodo
|
||||
TString query;
|
||||
query << "USE " << LF_RIEPRETT
|
||||
<< "\nFROM TIPO=" << tipo << " ANNO=" << anno_r << " PERIODO=" << peri << " NUMRIG=" << long(riepiloghi+1)
|
||||
<< "\nTO TIPO=" << tipo << " ANNO=" << anno_r << " PERIODO=" << peri;
|
||||
TISAM_recordset riepset(query);
|
||||
for (bool ok = riepset.move_first(); ok; ok = riepset.move_next())
|
||||
riepset.cursor()->file().remove();
|
||||
|
||||
const int rettifiche = _rett.sort();
|
||||
if (rettifiche > 0)
|
||||
{
|
||||
for (int r = 0; r < rettifiche; r++)
|
||||
_rett[r].write_rewrite(riep);
|
||||
}
|
||||
|
||||
// Cancella eventuali altre rettifiche del periodo
|
||||
query.cut(0) << "USE " << LF_RIEPRETT
|
||||
<< "\nFROM TIPO=" << char(tipo+1) << " ANNO=" << anno_r << " PERIODO=" << peri << " NUMRIG=" << long(rettifiche+1)
|
||||
<< "\nTO TIPO=" << char(tipo+1) << " ANNO=" << anno_r << " PERIODO=" << peri;
|
||||
TISAM_recordset rettset(query);
|
||||
for (bool ok = rettset.move_first(); ok; ok = rettset.move_next())
|
||||
rettset.cursor()->file().remove();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -504,7 +699,6 @@ void genera_riepiloghi(char tipo, int anno, int periodo)
|
||||
bool is_riepilogo(char tipo, int anno, int periodo)
|
||||
{
|
||||
TLocalisamfile riep(LF_RIEPRETT);
|
||||
|
||||
riep.put("TIPO", tipo);
|
||||
riep.put("ANNO", anno);
|
||||
riep.put("PERIODO", periodo);
|
||||
|
Loading…
x
Reference in New Issue
Block a user