Patch level : 10.0

Files correlati     : fe0.exe fe0100a.msk
Ricompilazione Demo : [ ]
Commento            :
Aggiunta possibilità di annullamento e sostituzuione invio precedente


git-svn-id: svn://10.65.10.50/branches/R_10_00@22524 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-12-16 16:23:38 +00:00
parent 3beb50c7ad
commit c6b9f7d8db
6 changed files with 131 additions and 23 deletions

View File

@ -457,6 +457,7 @@ protected:
bool controlla_mov(TRectype& mrec) const;
bool azzera_alleg(TAssoc_array& manuali) const;
void collega_variazioni() const;
const TString& primo_contratto() const;
public:
TRecnotype genera_alleg();
@ -1223,8 +1224,10 @@ bool TDati_rilevanti_msk::send_alleg()
}
TDati_rilevanti_set recset(anno);
recset.add_header(*this);
const int tipologia = recset.add_header(*this);
if (tipologia != 2) // Invio i record tranne che in caso di annullamento
{
const int tot = data.items();
if (tot > 0)
{
@ -1237,7 +1240,7 @@ bool TDati_rilevanti_msk::send_alleg()
send_rec(data[a], recset);
}
}
}
recset.add_footer();
recset.sort();
bool done = recset.save_as(temp);
@ -1511,6 +1514,20 @@ bool TDati_rilevanti_msk::check_rows(bool show_error)
return ok;
}
const TString& TDati_rilevanti_msk::primo_contratto() const
{
const TSheet_field& s = sfield(F_RIGHE);
const int c = s.cid2index(A_CONTRATTO);
FOR_EACH_SHEET_ROW(s, r, row)
{
const char* cc = row->get(c);
if (cc && *cc > ' ')
return get_tmp_string() = cc;
}
return EMPTY_STRING;
}
bool TDati_rilevanti_msk::save_if_dirty()
{
bool done = true;
@ -1525,10 +1542,11 @@ bool TDati_rilevanti_msk::save_if_dirty()
void TDati_rilevanti_msk::enable_buttons()
{
TSheet_field& s = sfield(F_RIGHE);
const int anno = get_int(F_ANNO);
const bool good_year = anno >= 2010;
const bool def = get_bool(F_DEFINITIVO);
const bool full_rows = !sfield(F_RIGHE).empty();
const bool full_rows = good_year && !s.empty();
bool one_sent = false; // Ho spedito almeno un movimento in definitivo
if (good_year)
@ -1540,6 +1558,7 @@ void TDati_rilevanti_msk::enable_buttons()
one_sent = recset.move_first();
}
enable(DLG_COPY, full_rows && get_long(F_CODCF) > 0 && primo_contratto().full());
enable(DLG_CANCEL, full_rows);
enable(DLG_SAVEREC, _sheet_dirty);
enable(DLG_EXPORT, full_rows);
@ -1667,6 +1686,40 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon
}
}
break;
case DLG_COPY:
if (e == fe_button)
{
TString80 contratto1 = primo_contratto();
contratto1.trim();
if (contratto1.not_empty() &&
yesno_box("Si desidera inserire il contratto '%s' nelle righe che ne sono prive?", (const char*)contratto1))
{
const TContratto contr(get(F_TIPOCF)[0], get_long(F_CODCF), contratto1);
const int modpag = contr.modalita_pagamento();
TSheet_field& s = sfield(F_RIGHE);
const int f = s.cid2index(A_FORZATA);
const int c = s.cid2index(A_CONTRATTO);
const int n = s.cid2index(A_NUMRETT);
const int m = s.cid2index(A_MODPAG);
TString80 contratto;
TString16 numdoc;
FOR_EACH_SHEET_ROW(s, r, row)
{
row->get(n, numdoc);
row->get(c, contratto);
if (numdoc.blank() && contratto.blank())
{
row->add("X", f);
row->add(modpag, m);
row->add(contratto1, c);
s.enable_cell(r, c);
}
}
s.force_update();
}
}
break;
case F_OUTFOLDER:
if (e == fe_init && o.empty())
{
@ -1796,3 +1849,4 @@ int fe0100(int argc, char* argv[])
app.run(argc, argv, TR("Gestione dati rilevanti"));
return 0;
}

View File

@ -19,6 +19,10 @@
#define F_INTER_COFI 322
#define F_INTER_CAF 323
#define F_TIPOLOGIA 330
#define F_PROTELE 331
#define F_PROTDOC 332
#define F_RIGHE 300
#define A_RIGA 101

View File

@ -30,6 +30,12 @@ BEGIN
PICTURE TOOL_RECALC
END
BUTTON DLG_COPY 2 2
BEGIN
PROMPT 1 3 "+Contratto"
PICTURE TOOL_COPY
END
BUTTON DLG_EXPORT 2 2
BEGIN
PROMPT 1 4 "Excel"
@ -246,6 +252,36 @@ BEGIN
PROMPT 2 10 "Data dell'impegno alla trasmissione "
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 12 "@bAnnullamento o sostituzione"
END
LIST F_TIPOLOGIA 1 15
BEGIN
PROMPT 2 13 "Tipologia invio "
ITEM "0|Normale"
MESSAGE DISABLE,F_PROTELE|DISABLE,F_PROTDOC
ITEM "1|Sostitutivo"
MESSAGE ENABLE,F_PROTELE|ENABLE,F_PROTDOC
ITEM "2|Annullamento"
MESSAGE ENABLE,F_PROTELE|ENABLE,F_PROTDOC
END
STRING F_PROTELE 17
BEGIN
PROMPT 2 14 "Protocollo da sostituire o annullare "
FLAGS "U"
CHECKTYPE REQUIRED
END
STRING F_PROTDOC 6
BEGIN
PROMPT 2 15 "Protocollo documento "
FLAGS "U"
CHECKTYPE REQUIRED
END
ENDPAGE
ENDMASK

View File

@ -58,8 +58,10 @@ void TSomma_spesometro_msk::elabora(const TString_array& infiles, const TFilenam
}
TDati_rilevanti_set outset(anno);
outset.add_header(*this);
const int tipologia = outset.add_header(*this);
if (tipologia != 2) // Invio i record solo quando non si tratta di annullamento
{
FOR_EACH_ARRAY_ROW(infiles, r, row) if (row2fname(*row, n))
{
const int len = outset.record_length();
@ -72,6 +74,7 @@ void TSomma_spesometro_msk::elabora(const TString_array& infiles, const TFilenam
outset.new_rec(row);
}
}
}
outset.add_footer();
outset.sort();

View File

@ -449,11 +449,20 @@ const TVariant& TDati_rilevanti_set::get_field(const TAS400_column_info& ci) con
return TAS400_recordset::get_field(ci);
}
void TDati_rilevanti_set::add_header(const TMask& msk, int num_inv, int tot_inv)
int TDati_rilevanti_set::add_header(const TMask& msk, int num_inv, int tot_inv)
{
const TAnagrafica ditta(LF_NDITTE, prefix().get_codditta());
new_rec("0");
const int tipologia = msk.get_int(F_TIPOLOGIA);
set(4, tipologia);
if (tipologia > 0)
{
set(5, msk.get(F_PROTELE));
set(6, msk.get(F_PROTDOC));
}
set(7, ditta.codice_fiscale());
set(8, ditta.partita_IVA());
@ -492,6 +501,8 @@ void TDati_rilevanti_set::add_header(const TMask& msk, int num_inv, int tot_inv)
{
set(25, TDate()); // Svuota data impegno
}
return tipologia;
}
void TDati_rilevanti_set::add_footer()

View File

@ -87,7 +87,7 @@ public:
bool set(unsigned int n, int v) { return set_val(n, long(v)); }
bool set(unsigned int n, const real& v) { return set_val(n, v); }
bool set(unsigned int n, const TDate& v) { return set_val(n, v); }
void add_header(const TMask& msk, int num_inv = 1, int tot_inv = 1);
int add_header(const TMask& msk, int num_inv = 1, int tot_inv = 1);
void add_footer();
bool split(const TFilename& name, const TRecnotype maxalleg = 15000);
int anno() const { return _anno; }