Patch level : 10.0 316
Files correlati : ve6.exe ve6800a.msk Ricompilazione Demo : [ ] Commento : Corretto cambio stato dei documenti contabilizzati analiticamente git-svn-id: svn://10.65.10.50/trunk@18944 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
936d57a2bf
commit
118cff0593
@ -31,7 +31,7 @@
|
|||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <urldefid.h>
|
#include <defmask.h>
|
||||||
|
|
||||||
#include "velib04.h"
|
#include "velib04.h"
|
||||||
#include "../cg/cgsaldac.h"
|
#include "../cg/cgsaldac.h"
|
||||||
@ -77,24 +77,20 @@ bool TContabilizzazione_analitica_mask::on_field_event(TOperable_field& o, TFiel
|
|||||||
switch (o.dlg())
|
switch (o.dlg())
|
||||||
{
|
{
|
||||||
case F_CODICE_ELAB:
|
case F_CODICE_ELAB:
|
||||||
if (e == fe_modify)
|
if (e == fe_modify || e == fe_init)
|
||||||
{
|
{
|
||||||
if (o.empty())
|
const bool full = !o.empty();
|
||||||
disable(DLG_ELABORA);
|
if (full)
|
||||||
else
|
|
||||||
build_num_sheet();
|
build_num_sheet();
|
||||||
|
enable(DLG_USER, full);
|
||||||
|
enable(DLG_OK, full && _num_sheet->one_checked());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DLG_USER:
|
case DLG_USER:
|
||||||
if (e == fe_button)
|
if (e == fe_button && _num_sheet->run())
|
||||||
{
|
{
|
||||||
if (_num_sheet->run())
|
// Hai selezionato qualcosa ? allora abilita il pulsante di conferma
|
||||||
{
|
enable(DLG_OK, _num_sheet->one_checked());
|
||||||
if (_num_sheet->checked() != 0) // Hai selezionato qualcosa ?
|
|
||||||
enable(DLG_ELABORA); // allora abilita il pulsante di conferma
|
|
||||||
else
|
|
||||||
disable(DLG_ELABORA);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -108,49 +104,46 @@ void TContabilizzazione_analitica_mask::build_num_sheet()
|
|||||||
_num_sheet->destroy();
|
_num_sheet->destroy();
|
||||||
_tipi_doc.destroy();
|
_tipi_doc.destroy();
|
||||||
|
|
||||||
TTable num("%NUM");
|
const TContabilizzazione_analitica contanal(get(F_CODICE_ELAB));
|
||||||
TString s1,s2,s3;
|
if (!contanal.empty())
|
||||||
|
|
||||||
TContabilizzazione_analitica* contanal = new TContabilizzazione_analitica(get(F_CODICE_ELAB));
|
|
||||||
if (!contanal->empty())
|
|
||||||
{
|
{
|
||||||
TToken_string t;
|
TToken_string t;
|
||||||
TString16 tipo;
|
TString4 tipo;
|
||||||
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
|
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
|
||||||
{
|
{
|
||||||
tipo = contanal->tipo_iniziale(i);
|
tipo = contanal.tipo_iniziale(i);
|
||||||
if (tipo.not_empty())
|
if (tipo.full())
|
||||||
{
|
{
|
||||||
t = tipo;
|
t = tipo;
|
||||||
t.add(contanal->stato_iniziale(i)); // Stato iniziale
|
t.add(contanal.stato_iniziale(i)); // Stato iniziale
|
||||||
_tipi_doc.add(t); // Aggiunge questo tipo documento alla lista
|
_tipi_doc.add(t); // Aggiunge questo tipo documento alla lista
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long pos = 0l;
|
TString s1,s2,s3;
|
||||||
|
TTable num("%NUM");
|
||||||
for (num.first(); num.good(); num.next(), pos++) // scorre tutte le numerazioni possibili
|
for (num.first(); num.good(); num.next()) // scorre tutte le numerazioni possibili
|
||||||
{
|
{
|
||||||
TToken_string t,z;
|
TToken_string t,z;
|
||||||
t.add(" ");
|
t.add(" ");
|
||||||
t.add(num.get("CODTAB"));
|
t.add(num.get("CODTAB"));
|
||||||
t.add(num.get("S0"));
|
t.add(num.get("S0"));
|
||||||
_num_sheet->add(t);
|
|
||||||
s2 = num.get("S2"); // reperisce i tipi documento validi per questa numerazione
|
s2 = num.get("S2"); // reperisce i tipi documento validi per questa numerazione
|
||||||
|
|
||||||
for (int x = 0; x <= s2.len(); x += 4)
|
for (int x = 0; x <= s2.len(); x += 4)
|
||||||
z.add(s2.mid(x,4));
|
z.add(s2.mid(x,4));
|
||||||
|
|
||||||
bool found = FALSE;
|
bool found = false;
|
||||||
for (int i = _tipi_doc.last(); !found && i >= 0; i--)
|
for (int i = _tipi_doc.last(); !found && i >= 0; i--)
|
||||||
found |= (s2.find(((TToken_string &)_tipi_doc[i]).get(0)) >= 0);
|
found |= s2.find(_tipi_doc.row(i).get(0)) >= 0;
|
||||||
if (found)
|
if (found)
|
||||||
_num_sheet->enable_row(pos);
|
_num_sheet->add(t);
|
||||||
else
|
|
||||||
_num_sheet->disable_row(pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_num_sheet->items() == 1)
|
||||||
|
_num_sheet->check(0);
|
||||||
}
|
}
|
||||||
delete contanal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TContabilizzazione_analitica_mask::doc_tipo_stato_ok(const TRectype& doc)
|
bool TContabilizzazione_analitica_mask::doc_tipo_stato_ok(const TRectype& doc)
|
||||||
@ -158,13 +151,13 @@ bool TContabilizzazione_analitica_mask::doc_tipo_stato_ok(const TRectype& doc)
|
|||||||
// differita selezionata
|
// differita selezionata
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
const TString16 tipo = doc.get(DOC_TIPODOC);
|
const TString4 tipo = doc.get(DOC_TIPODOC);
|
||||||
const char stato = doc.get_char(DOC_STATO);
|
const char stato = doc.get_char(DOC_STATO);
|
||||||
const int items = _tipi_doc.items();
|
const int items = _tipi_doc.items();
|
||||||
for (int i = 0; i < items && !found; i++)
|
for (int i = 0; i < items && !found; i++)
|
||||||
{
|
{
|
||||||
TToken_string& t = _tipi_doc.row(i);
|
TToken_string& t = _tipi_doc.row(i);
|
||||||
const TString16 tipox(t.get(0));
|
const TString4 tipox(t.get(0));
|
||||||
const char statox = t.get(1)[0];
|
const char statox = t.get(1)[0];
|
||||||
if (tipo == tipox && stato == statox)
|
if (tipo == tipox && stato == statox)
|
||||||
found = true;
|
found = true;
|
||||||
@ -262,7 +255,7 @@ void TContabilizzazione_analitica_app::contabilize()
|
|||||||
{
|
{
|
||||||
p.addstatus(1);
|
p.addstatus(1);
|
||||||
// controlla che il tipo documento e lo stato siano coerenti con la ELD selezionata
|
// controlla che il tipo documento e lo stato siano coerenti con la ELD selezionata
|
||||||
if (nums.get_pos(cur_rec.get("CODNUM")) >= 0 && _msk->doc_tipo_stato_ok(cur_rec))
|
if (nums.get_pos(cur_rec.get(DOC_CODNUM)) >= 0 && _msk->doc_tipo_stato_ok(cur_rec))
|
||||||
{
|
{
|
||||||
TDocumento* doc = new TDocumento;
|
TDocumento* doc = new TDocumento;
|
||||||
if (doc->read(doc_cur.curr()) == NOERR) // legge il documento
|
if (doc->read(doc_cur.curr()) == NOERR) // legge il documento
|
||||||
@ -288,6 +281,7 @@ void TContabilizzazione_analitica_app::contabilize()
|
|||||||
|
|
||||||
bool TContabilizzazione_analitica_app::create()
|
bool TContabilizzazione_analitica_app::create()
|
||||||
{
|
{
|
||||||
|
open_files(LF_TABCOM, LF_TAB, LF_DOC, LF_RIGHEDOC, LF_MOVANA, LF_RMOVANA, 0);
|
||||||
_msk = new TContabilizzazione_analitica_mask();
|
_msk = new TContabilizzazione_analitica_mask();
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
}
|
}
|
||||||
@ -301,14 +295,12 @@ bool TContabilizzazione_analitica_app::destroy()
|
|||||||
void TContabilizzazione_analitica_app::main_loop()
|
void TContabilizzazione_analitica_app::main_loop()
|
||||||
{
|
{
|
||||||
while (_msk->run() == K_ENTER)
|
while (_msk->run() == K_ENTER)
|
||||||
{
|
|
||||||
contabilize();
|
contabilize();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ve6800 (int argc, char **argv)
|
int ve6800 (int argc, char **argv)
|
||||||
{
|
{
|
||||||
TContabilizzazione_analitica_app a;
|
TContabilizzazione_analitica_app a;
|
||||||
a.run(argc,argv,"Contabilizzazione analitica documenti");
|
a.run(argc,argv, TR("Contabilizzazione analitica documenti"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,6 @@
|
|||||||
#include "ve6800a.h"
|
#include "ve6800a.h"
|
||||||
|
|
||||||
TOOLBAR "topbar" 0 0 0 2
|
PAGE "Contabilizzazione Analitica documenti" -1 -1 78 8
|
||||||
|
|
||||||
BUTTON DLG_USER 10 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT -12 -1 "~Selezione"
|
|
||||||
PICTURE TOOL_MULTISEL
|
|
||||||
END
|
|
||||||
|
|
||||||
BUTTON DLG_ELABORA 10 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT -22 -1 "~Elabora"
|
|
||||||
PICTURE TOOL_ELABORA
|
|
||||||
END
|
|
||||||
|
|
||||||
#include <stdbar.h>
|
|
||||||
|
|
||||||
ENDPAGE
|
|
||||||
|
|
||||||
PAGE "Contabilizzazione Analitica documenti" 0 2 0 0
|
|
||||||
|
|
||||||
STRING F_CODICE_ELAB 8
|
STRING F_CODICE_ELAB 8
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -73,4 +55,16 @@ END
|
|||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
|
TOOLBAR "topbar" 0 0 0 2
|
||||||
|
|
||||||
|
BUTTON DLG_USER 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -12 -1 "~Selezione"
|
||||||
|
PICTURE TOOL_MULTISEL
|
||||||
|
END
|
||||||
|
|
||||||
|
#include <elabar.h>
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -717,10 +717,9 @@ static bool link_handler_ana(int n, const char* nreg)
|
|||||||
bool TContabilizzazione_analitica::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
bool TContabilizzazione_analitica::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
||||||
const TDate& data_elab, bool interattivo)
|
const TDate& data_elab, bool interattivo)
|
||||||
{
|
{
|
||||||
const TImporto zero;
|
|
||||||
TPrinter& p = printer();
|
TPrinter& p = printer();
|
||||||
TViswin v(NULL, TR("Contabilizzazione documenti in analitica"), false, true, true);
|
TViswin v(NULL, TR("Contabilizzazione documenti in analitica"), false, true, true);
|
||||||
|
_total_docs = 0;
|
||||||
|
|
||||||
p.links().add("Movimento Analitico |r|w", 0);
|
p.links().add("Movimento Analitico |r|w", 0);
|
||||||
p.setlinkhandler(link_handler_ana);
|
p.setlinkhandler(link_handler_ana);
|
||||||
@ -730,17 +729,37 @@ bool TContabilizzazione_analitica::elabora(TLista_documenti& doc_in, TLista_docu
|
|||||||
{
|
{
|
||||||
TAnal_mov mov;
|
TAnal_mov mov;
|
||||||
if (elabora(doc_in[i], 0, &v, true, mov))
|
if (elabora(doc_in[i], 0, &v, true, mov))
|
||||||
doc_in[i].stato(get_char("S4"));
|
{
|
||||||
|
// Cambia stato al documento elborato con successo
|
||||||
|
TDocumento& di = doc_in[i];
|
||||||
|
di.stato(stato_finale_doc_iniziale()[0]);
|
||||||
|
if (di.rewrite() == NOERR)
|
||||||
|
_total_docs++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg << TR("*** Impossibile cambiare stato al documento")
|
||||||
|
<< ' ' << di.get(DOC_ANNO)
|
||||||
|
<< ' ' << di.get(DOC_CODNUM)
|
||||||
|
<< ' ' << di.get(DOC_NDOC);
|
||||||
|
v.add_line(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
v.close_print();
|
v.close_print();
|
||||||
v.close_modal();
|
v.close_modal();
|
||||||
|
|
||||||
|
if (_total_docs > 0)
|
||||||
|
{
|
||||||
|
post_process_input(doc_in);
|
||||||
|
post_process_output(doc_out);
|
||||||
|
}
|
||||||
|
|
||||||
if (v.run() == K_CTRL+'S') // Ho premuto Stampa
|
if (v.run() == K_CTRL+'S') // Ho premuto Stampa
|
||||||
p.print_txt(v.text());
|
p.print_txt(v.text());
|
||||||
|
|
||||||
post_process_input(doc_in);
|
|
||||||
post_process_output(doc_out);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,7 +843,7 @@ void TDocumento_mask::cli2mask(bool force_load)
|
|||||||
set(F_STATOCF, c.get(CLI_STATOCF));
|
set(F_STATOCF, c.get(CLI_STATOCF));
|
||||||
check_field( F_CODINDSP );
|
check_field( F_CODINDSP );
|
||||||
}
|
}
|
||||||
const TString16 newcodval(get(F_CODVAL));
|
const TString4 newcodval(get(F_CODVAL));
|
||||||
|
|
||||||
short pos = id2pos(F_CAMBIO);
|
short pos = id2pos(F_CAMBIO);
|
||||||
if ((pos >= 0) && newcodval.empty())
|
if ((pos >= 0) && newcodval.empty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user