2002-05-31 10:35:40 +00:00
|
|
|
|
#include <automask.h>
|
2006-01-09 01:15:53 +00:00
|
|
|
|
#include <colmask.h>
|
1998-08-25 18:07:30 +00:00
|
|
|
|
#include <dongle.h>
|
2005-05-25 11:32:58 +00:00
|
|
|
|
#include <execp.h>
|
1998-08-25 18:07:30 +00:00
|
|
|
|
#include <modaut.h>
|
2008-02-05 10:55:05 +00:00
|
|
|
|
#include <postman.h>
|
2007-03-30 13:51:17 +00:00
|
|
|
|
#include <recset.h>
|
2000-05-05 15:25:49 +00:00
|
|
|
|
#include <sheet.h>
|
2004-11-30 22:02:59 +00:00
|
|
|
|
#include <smartcard.h>
|
1998-08-25 18:07:30 +00:00
|
|
|
|
#include <tabutil.h>
|
2002-05-31 10:35:40 +00:00
|
|
|
|
#include <tree.h>
|
2008-02-01 09:26:53 +00:00
|
|
|
|
#include <treectrl.h>
|
2002-07-02 16:21:23 +00:00
|
|
|
|
#include <urldefid.h>
|
2005-05-25 11:32:58 +00:00
|
|
|
|
#include <utility.h>
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
2005-05-06 10:58:49 +00:00
|
|
|
|
#include "velib04.h"
|
1997-06-12 16:15:09 +00:00
|
|
|
|
#include "vepriv.h"
|
1998-08-25 18:07:30 +00:00
|
|
|
|
#include "verig.h"
|
1997-06-12 16:15:09 +00:00
|
|
|
|
|
2001-05-02 13:40:49 +00:00
|
|
|
|
#include "ve0100.h"
|
1998-08-25 18:07:30 +00:00
|
|
|
|
#include "ve0100b1.h"
|
2008-06-11 11:31:27 +00:00
|
|
|
|
#include "ve0100c.h"
|
1998-08-25 18:07:30 +00:00
|
|
|
|
#include "ve0100o.h"
|
1997-06-12 16:15:09 +00:00
|
|
|
|
#include "veuml.h"
|
|
|
|
|
#include "veuml1.h"
|
1998-08-25 18:07:30 +00:00
|
|
|
|
#include "veini.h"
|
2008-03-26 12:38:22 +00:00
|
|
|
|
|
2008-11-14 14:40:28 +00:00
|
|
|
|
#include <multirel.h>
|
2005-08-23 08:54:32 +00:00
|
|
|
|
#include "sconti.h"
|
2007-09-18 14:25:15 +00:00
|
|
|
|
#include "rcondv.h"
|
2008-03-26 12:38:22 +00:00
|
|
|
|
#include <occas.h>
|
2002-05-31 10:35:40 +00:00
|
|
|
|
|
2009-03-17 11:05:49 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TOriginal_row_mask
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2005-05-23 12:17:02 +00:00
|
|
|
|
class TOriginal_row_mask : public TAutomask
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
2005-05-23 12:17:02 +00:00
|
|
|
|
protected:
|
2005-08-23 08:54:32 +00:00
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
2005-05-23 12:17:02 +00:00
|
|
|
|
virtual bool on_key(KEY key);
|
|
|
|
|
|
|
|
|
|
public:
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TOriginal_row_mask() : TAutomask("ve0100c") { }
|
2005-05-23 12:17:02 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool TOriginal_row_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TOriginal_row_mask::on_key(KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_SHIFT + K_F12)
|
|
|
|
|
enable(-1);
|
|
|
|
|
return TAutomask::on_key(key);
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-17 11:05:49 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TColor_rule
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TColor_rule::TColor_rule(const char* desc, const char* expr, TTypeexp type, COLOR back, COLOR fore)
|
|
|
|
|
: TExpr_documento(expr, type), _back(back), _fore(fore), _def_back(back), _def_fore(fore)
|
|
|
|
|
{
|
|
|
|
|
_desc = dictionary_translate(desc);
|
|
|
|
|
_key = desc; _key.trim(); _key.strip_double_spaces();
|
|
|
|
|
_key.replace(' ', '_');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TDocumento_mask
|
|
|
|
|
///////////////////////////////////////////////////////////
|
2005-05-23 12:17:02 +00:00
|
|
|
|
|
2009-05-27 15:42:59 +00:00
|
|
|
|
// Data una coppia di campi, toglie il FIELD a quello invisibile dei due
|
|
|
|
|
void TDocumento_mask::kill_double_fields(short fld1, short fld2)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < 2; i++)
|
|
|
|
|
{
|
|
|
|
|
const short id = i == 0 ? fld1 : fld2;
|
|
|
|
|
if (id2pos(id) > 0)
|
|
|
|
|
{
|
|
|
|
|
TEdit_field& f = efield(id);
|
|
|
|
|
if (f.hidden())
|
|
|
|
|
f.set_field(EMPTY_STRING);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
TDocumento_mask::TDocumento_mask(const char* td)
|
2009-02-27 12:32:19 +00:00
|
|
|
|
: TVariable_mask(), _progs_page(-1), _condv(NULL), _smartcard(NULL),
|
|
|
|
|
_cms_start(-1), _cms_end(-1), _cms_start_sh(-1), _cms_end_sh(-1),
|
|
|
|
|
_cdc_start(-1), _cdc_end(-1), _cdc_start_sh(-1), _cdc_end_sh(-1)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
2009-02-27 12:32:19 +00:00
|
|
|
|
CHECK(td && *td && strlen(td) <= 4, "TDocumento_mask(TipoDocumento) not (MaskName)");
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
TMagazzini m;
|
|
|
|
|
_ges_mag = m.gestmag();
|
|
|
|
|
_ges_dep = m.gestdep();
|
|
|
|
|
_std_mag = m.standardmag();
|
|
|
|
|
_std_dep = m.standarddep();
|
|
|
|
|
}
|
2009-02-27 12:32:19 +00:00
|
|
|
|
TDocumento& d = doc();
|
2007-03-07 11:36:57 +00:00
|
|
|
|
d.set_tipo(td);
|
|
|
|
|
const TString16 mname = d.tipo().mask_name();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
read_mask(mname, 0, MAX_PAGES);
|
|
|
|
|
|
|
|
|
|
_sheet = &sfield(F_SHEET);
|
|
|
|
|
_sheet->set_handler( ss_handler );
|
|
|
|
|
_sheet->set_notify( ss_notify );
|
|
|
|
|
_sheet->set_append(FALSE);
|
|
|
|
|
|
2009-02-27 12:32:19 +00:00
|
|
|
|
TList_field& listbox = lfield(F_LBTIPORIGA);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
2009-02-27 12:32:19 +00:00
|
|
|
|
const TTipo_documento& tdoc = d.tipo();
|
|
|
|
|
const TToken_string& keys = tdoc.keys_descrs().row(0);
|
|
|
|
|
const TToken_string& desc = tdoc.keys_descrs().row(1);
|
|
|
|
|
listbox.replace_items(keys, desc);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
// Controlla se deve generare la pagina di analitica
|
2007-05-30 16:46:56 +00:00
|
|
|
|
_ges_ca = dongle().active(CAAUT) || dongle().active(CMAUT);
|
|
|
|
|
if (_ges_ca)
|
|
|
|
|
{
|
|
|
|
|
TConfig& caini = ca_config();
|
|
|
|
|
_ges_ca = caini.get("Level", NULL, 1).full();
|
|
|
|
|
}
|
|
|
|
|
if (_ges_ca)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
insert_anal_page();
|
|
|
|
|
|
|
|
|
|
configura_sheet(*_sheet);
|
|
|
|
|
|
|
|
|
|
((TVariable_sheet_field*)_sheet)->set_getmask( ss_getmask );
|
|
|
|
|
if (_doc.tipo().clifo_optional())
|
|
|
|
|
{
|
|
|
|
|
field(F_CODCF).check_type(CHECK_NORMAL);
|
|
|
|
|
field(F_RAGSOC).check_type(CHECK_NORMAL);
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-30 22:02:59 +00:00
|
|
|
|
int i;
|
|
|
|
|
for (i = fields() - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
TMask_field & f = fld(i);
|
2006-01-09 18:32:38 +00:00
|
|
|
|
if (f.is_operable())
|
2004-11-30 22:02:59 +00:00
|
|
|
|
f.set_handler(universal_handler);
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
2004-11-30 22:02:59 +00:00
|
|
|
|
set_field_handler( F_OCCASEDIT, occas_handler );
|
2005-08-23 08:54:32 +00:00
|
|
|
|
set_field_handler( F_CODCF, clifo_handler );
|
|
|
|
|
set_field_handler( F_CODPAG, condpag_hndl );
|
|
|
|
|
set_field_handler( F_DATAINSC, condpag_hndl );
|
|
|
|
|
set_field_handler( F_CODNOTE, note_hndl );
|
|
|
|
|
set_field_handler( F_DATADOC, data_hndl );
|
|
|
|
|
set_field_handler( F_CODLIST, codlist_handler );
|
|
|
|
|
set_field_handler( F_CODLIST1, codlist_handler );
|
|
|
|
|
set_field_handler( F_CODCONT, codcont_handler );
|
|
|
|
|
set_field_handler( F_CODCONT1, codcont_handler );
|
|
|
|
|
set_field_handler( F_CODCAMP, codcamp_handler );
|
|
|
|
|
set_field_handler( F_CODVAL, codval_handler );
|
|
|
|
|
set_field_handler( F_CODVAL1, codval_handler );
|
|
|
|
|
set_field_handler( F_NUMDOCRIF, datadocrif_handler);
|
|
|
|
|
set_field_handler( F_DATADOCRIF, datadocrif_handler);
|
|
|
|
|
set_handler( DLG_ELABORA, elabora_handler );
|
|
|
|
|
set_handler( DLG_PRINT, print_handler );
|
2009-03-23 15:48:33 +00:00
|
|
|
|
set_handler( DLG_PREVIEW, print_handler );
|
2009-01-30 10:44:46 +00:00
|
|
|
|
set_handler( DLG_CONFERMA, confirm_handler );
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
const TString_array& handlers = tdoc.handlers();
|
2009-03-26 16:31:58 +00:00
|
|
|
|
FOR_EACH_ARRAY_ROW(handlers, r, riga)
|
|
|
|
|
user_set_handler( riga->get_int(0), riga->get_int(1) );
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
_livelli_giac = new TCodgiac_livelli;
|
|
|
|
|
|
|
|
|
|
for (i = 4; i > 0; i--)
|
|
|
|
|
{
|
|
|
|
|
const short pos = _sheet->cid2index(FR_LIV1 + i -1);
|
|
|
|
|
if (_livelli_giac->enabled(i))
|
|
|
|
|
{
|
|
|
|
|
const TString & header = _livelli_giac->name(i);
|
|
|
|
|
const int len = header.len() + 1;
|
|
|
|
|
const int f_len = _livelli_giac->code_length(i);
|
|
|
|
|
_sheet->set_column_header(pos, header);
|
|
|
|
|
_sheet->set_column_width(pos, (len > f_len ? len : f_len) * 8);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_sheet->sheet_mask().hide(FR_LIV1 + i -1);
|
|
|
|
|
_sheet->delete_column(pos);
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
|
|
|
|
// configurazione campi
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TConfig cfg(CONFIG_DITTA, "ve");
|
|
|
|
|
const bool gesval = cfg.get_bool("GESVAL");
|
|
|
|
|
const bool gescambi = cfg.get_bool("GESVALAC");
|
|
|
|
|
|
|
|
|
|
if (gesval)
|
|
|
|
|
{
|
|
|
|
|
const bool enable_controeuro = cfg.get_bool("CONTROEURO");
|
|
|
|
|
|
|
|
|
|
enable(F_CONTROEURO, enable_controeuro);
|
|
|
|
|
show(F_CODVAL, !gescambi);
|
|
|
|
|
show(F_DATACAMBIO, !gescambi);
|
|
|
|
|
show(F_NOMEVAL, !gescambi);
|
|
|
|
|
show(F_CODVAL1, gescambi);
|
|
|
|
|
show(F_DATACAMBIO1, gescambi);
|
|
|
|
|
show(F_NOMEVAL1, gescambi);
|
|
|
|
|
show(F_CAMBIO);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
disable(F_CODVAL);
|
|
|
|
|
disable(F_DATACAMBIO);
|
|
|
|
|
disable(F_CONTROEURO);
|
|
|
|
|
disable(F_NOMEVAL);
|
|
|
|
|
hide(F_CODVAL1);
|
|
|
|
|
hide(F_DATACAMBIO1);
|
|
|
|
|
hide(F_NOMEVAL1);
|
|
|
|
|
disable(F_CAMBIO);
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-27 15:42:59 +00:00
|
|
|
|
const bool geslin = cfg.get_bool("GESLIN");
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
enable(F_CODLIN, geslin);
|
|
|
|
|
enable(F_DESLIN, geslin);
|
|
|
|
|
|
|
|
|
|
const bool geslis = cfg.get_bool("GES", NULL, 1);
|
|
|
|
|
const bool gesliscatven = cfg.get_bool("GESLISCV");
|
|
|
|
|
|
|
|
|
|
if (geslis)
|
|
|
|
|
{
|
|
|
|
|
show(F_CODLIST, !gesliscatven);
|
|
|
|
|
show(F_CODLIST1, gesliscatven);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
disable(F_CODLIST);
|
|
|
|
|
hide(F_CODLIST1);
|
|
|
|
|
}
|
2009-05-27 15:42:59 +00:00
|
|
|
|
kill_double_fields(F_CODLIST, F_CODLIST1);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
const bool gescontr = cfg.get_bool("GES", "ve", 2);
|
|
|
|
|
const bool gescontrcli = cfg.get_bool("GESCONCC");
|
|
|
|
|
|
|
|
|
|
if (gescontr)
|
|
|
|
|
{
|
|
|
|
|
show(F_CODCONT1, gescontrcli);
|
|
|
|
|
show(F_CODCONT, !gescontrcli);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-03-26 16:43:54 +00:00
|
|
|
|
hide(F_CODCONT);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
hide(F_CODCONT1);
|
|
|
|
|
}
|
2009-05-27 15:42:59 +00:00
|
|
|
|
kill_double_fields(F_CODCONT, F_CODCONT1);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
const bool gesoff = cfg.get_bool("GES", "ve", 3);
|
|
|
|
|
enable(F_CODCAMP, gesoff);
|
|
|
|
|
|
|
|
|
|
const bool gessco = cfg.get_char("GESSCO") != 'N';
|
|
|
|
|
enable(F_SCONTOPERC, gessco);
|
|
|
|
|
|
|
|
|
|
const bool gesage = cfg.get_bool("GESAGE");
|
|
|
|
|
enable(F_CODAG, gesage);
|
|
|
|
|
enable(F_DESAG, gesage);
|
|
|
|
|
enable(F_CODAGVIS, gesage);
|
|
|
|
|
enable(F_DESAGVIS, gesage);
|
|
|
|
|
|
|
|
|
|
const bool has_movmag = dongle().active(MGAUT) && _doc.tipo().mov_mag();
|
|
|
|
|
int pos = id2pos(F_CAUSMAG);
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
fld(pos).show(has_movmag);
|
|
|
|
|
pos = id2pos(F_DESCRMAG);
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
fld(pos).show(has_movmag);
|
|
|
|
|
pos = id2pos(F_CAUSMAGC);
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
fld(pos).show(has_movmag);
|
|
|
|
|
pos = id2pos(F_DESCRMAGC);
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
fld(pos).show(has_movmag);
|
|
|
|
|
pos = id2pos(F_CURGIAC);
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
fld(pos).show(has_movmag);
|
|
|
|
|
pos = id2pos(F_CURDISP);
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
fld(pos).show(has_movmag);
|
2004-11-30 22:02:59 +00:00
|
|
|
|
|
2008-03-26 12:38:22 +00:00
|
|
|
|
FOR_EACH_MASK_FIELD((*this), j, f)
|
2008-03-26 16:43:54 +00:00
|
|
|
|
{
|
|
|
|
|
if (f->dlg() > BASE_PIEDE)
|
|
|
|
|
_calculated_pages.set(f->page());
|
2004-11-30 22:02:59 +00:00
|
|
|
|
}
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
|
2009-03-17 11:05:49 +00:00
|
|
|
|
TFilename pn; d.tipo().profile_name(pn);
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
TConfig prof(pn, "Colors");
|
|
|
|
|
prof.write_protect(true);
|
|
|
|
|
|
2009-03-17 11:05:49 +00:00
|
|
|
|
COLOR back = prof.get_color("BgCol", NULL, 0, COLOR_YELLOW); // FOCUS_BACK_COLOR
|
|
|
|
|
COLOR fore = prof.get_color("FgCol", NULL, 0, COLOR_BLACK); // FOCUS_COLOR
|
|
|
|
|
color_rules().add(new TColor_rule("Righe collegate a documento", "", _numexpr, back, fore));
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
|
2009-03-17 11:05:49 +00:00
|
|
|
|
for (int i = 1; ; i++)
|
|
|
|
|
{
|
|
|
|
|
const TString& name = prof.get("RuleName", NULL, i);
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
if (name.full())
|
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
const TString& expr = prof.get("Rule", NULL, i);
|
|
|
|
|
const TTypeexp type = prof.get_char("RuleType", NULL, i, 'N') == 'S' ? _strexpr : _numexpr ;
|
|
|
|
|
back = prof.get_color("BgCol", NULL, i, NORMAL_BACK_COLOR);
|
|
|
|
|
fore = prof.get_color("FgCol", NULL, i, NORMAL_COLOR);
|
|
|
|
|
color_rules().add(new TColor_rule(name, expr, type, back, fore));
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-04-20 00:06:09 +00:00
|
|
|
|
_sh_y = prof.get_int("SHEET_LINE", "MAIN");
|
|
|
|
|
|
2009-03-17 11:05:49 +00:00
|
|
|
|
// Legge i colori personalizzati dal .ini gestito dalla TSelect_color_mask
|
|
|
|
|
TString tmp; tmp << doc().tipo().mask_name() << "_0"; tmp.lower();
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
TConfig conf(CONFIG_GUI, tmp);
|
2009-03-17 11:05:49 +00:00
|
|
|
|
conf.write_protect();
|
|
|
|
|
FOR_EACH_ARRAY_ITEM(color_rules(), j, o)
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
TColor_rule& c = *(TColor_rule*)o;
|
|
|
|
|
tmp = c.key();
|
|
|
|
|
COLOR fore = conf.get_color(tmp);
|
|
|
|
|
tmp << "_Bg";
|
|
|
|
|
COLOR back = conf.get_color(tmp);
|
|
|
|
|
if (back != fore)
|
|
|
|
|
c.set_colors(back, fore);
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TDocumento_mask::~TDocumento_mask()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (_condv)
|
|
|
|
|
delete _condv;
|
|
|
|
|
if (_livelli_giac)
|
|
|
|
|
delete _livelli_giac;
|
|
|
|
|
if (_smartcard)
|
|
|
|
|
delete _smartcard;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TDocumento_mask::insert_anal_fields(TMask& m, int page, int lf, int& y,
|
|
|
|
|
short& dlg, short& dlgd, bool required)
|
|
|
|
|
{
|
|
|
|
|
const int h = ca_create_fields(m, page, lf, 2, y, dlg, dlgd);
|
|
|
|
|
|
|
|
|
|
const bool main_mask = m.id2pos(F_SHEET) > 0;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < h; i++)
|
|
|
|
|
{
|
|
|
|
|
TEdit_field& fld = m.efield(dlg+i);
|
|
|
|
|
int logic = lf;
|
|
|
|
|
if (logic == LF_FASI)
|
|
|
|
|
{
|
|
|
|
|
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
|
|
|
|
|
if (fasinfo.parent() != 0)
|
|
|
|
|
{
|
|
|
|
|
const TMultilevel_code_info& parinfo = ca_multilevel_code_info(fasinfo.parent());
|
|
|
|
|
if (i < parinfo.levels())
|
|
|
|
|
logic = fasinfo.parent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char* fieldname = NULL;
|
|
|
|
|
switch(logic)
|
|
|
|
|
{
|
|
|
|
|
case LF_COMMESSE: fieldname = DOC_CODCMS; break;
|
|
|
|
|
case LF_FASI : fieldname = DOC_FASCMS; break;
|
2006-02-02 13:49:19 +00:00
|
|
|
|
default : fieldname = DOC_CODCOSTO; break;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
TFieldref* f = (TFieldref*)fld.field();
|
|
|
|
|
f->set_name(fieldname);
|
|
|
|
|
|
|
|
|
|
fld.check_type(required ? CHECK_REQUIRED : CHECK_NORMAL);
|
|
|
|
|
|
|
|
|
|
TEdit_field& dfld = m.efield(dlgd+i);
|
|
|
|
|
dfld.set_field(EMPTY_STRING); // Toglie campi che fan saltare gli output!
|
|
|
|
|
|
|
|
|
|
if (main_mask)
|
|
|
|
|
{
|
|
|
|
|
TSheet_field& sf = sfield(F_SHEET);
|
|
|
|
|
const TString head = fld.prompt();
|
|
|
|
|
const int colid = FR_CDC1+(fld.dlg()-F_CDC1);
|
|
|
|
|
sf.set_column_header(colid, head);
|
|
|
|
|
if (fld.size() > head.len())
|
|
|
|
|
sf.set_column_width(colid, fld.size()*8); // XI_FU_MULTIPLE
|
|
|
|
|
|
|
|
|
|
TMask& sm = sf.sheet_mask();
|
|
|
|
|
TString80 str; str << *fld.field();
|
|
|
|
|
sm.efield(colid).set_field(str); // Ricopia il campo nella maschera di riga per poterlo salvare!
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
y += h+1;
|
|
|
|
|
dlg += h; dlgd += h;
|
|
|
|
|
return h;
|
2005-05-05 10:37:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TDocumento_mask::insert_anal_page()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
int newpage = win2page(_sheet->parent());
|
2005-05-08 21:07:59 +00:00
|
|
|
|
if (newpage == 0)
|
|
|
|
|
newpage++;
|
2009-02-12 17:02:23 +00:00
|
|
|
|
create_page("Analitica", newpage); // Inserisce una pagina vuota con un titolo a caso
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_groupbox(DLG_NULL, newpage, "", 1, 0, 78, 6);
|
|
|
|
|
add_string(DLG_NULL, newpage, TR("Cod. num. "), 2, 1, 4, "D").set_group(2);
|
|
|
|
|
add_string(DLG_NULL, newpage, "", 24, 1, 50, "D").set_group(3);
|
|
|
|
|
add_string(DLG_NULL, newpage, TR("Tipo doc. "), 2, 2, 4, "D").set_group(4);
|
|
|
|
|
add_string(DLG_NULL, newpage, "", 24, 2, 50, "D").set_group(5);
|
|
|
|
|
add_number(DLG_NULL, newpage, TR("Esercizio "), 2, 3, 4, "D").set_group(9);
|
|
|
|
|
add_number(DLG_NULL, newpage, TR("Numero doc. "), 24, 3, 6, "D").set_group(6);
|
|
|
|
|
add_date(DLG_NULL, newpage, TR("Data "), 46, 3, "D").set_group(7);
|
|
|
|
|
add_string(DLG_NULL, newpage, TR("Stato "), 67, 3, 1, "D").set_group(8);
|
|
|
|
|
add_number(DLG_NULL, newpage, TR("Cliente "), 2, 4, 6, "D").set_group(10);
|
|
|
|
|
add_string(DLG_NULL, newpage, "", 24, 4, 50, "D").set_group(11);
|
|
|
|
|
|
|
|
|
|
add_groupbox(DLG_NULL, newpage, TR("Contabilita' Analitica"), 1, 6, 78, 14);
|
|
|
|
|
|
|
|
|
|
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
|
|
|
|
|
const bool use_fsc = fasinfo.levels() > 0;
|
2005-09-19 17:17:27 +00:00
|
|
|
|
TConfig& ini = ca_config();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const bool fsc_req = use_fsc && ini.get_bool("FscRequired");
|
|
|
|
|
|
|
|
|
|
int y = 7;
|
|
|
|
|
short dlg = F_CDC1; // id del primo campo da generare
|
|
|
|
|
short dlgd = F_DESCDC1;
|
|
|
|
|
|
2008-06-13 08:45:21 +00:00
|
|
|
|
for (int i = 0; i < 2; i++)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2
|
|
|
|
|
if (level == "CDC") // Crea centro di costo
|
|
|
|
|
{
|
2007-11-16 13:46:49 +00:00
|
|
|
|
_cdc_start = dlg;
|
|
|
|
|
_cdc_end = dlg + ca_multilevel_code_info(LF_CDC).levels()-1;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (use_fsc && fasinfo.parent() == LF_CDC)
|
|
|
|
|
insert_anal_fields(*this, newpage, LF_FASI, y, dlg, dlgd, fsc_req);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const bool cdc_req = ini.get_bool("CdcRequired");
|
|
|
|
|
|
|
|
|
|
insert_anal_fields(*this, newpage, LF_CDC, y, dlg, dlgd, cdc_req);
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (level == "CMS") // Crea commessa
|
|
|
|
|
{
|
2007-11-16 13:46:49 +00:00
|
|
|
|
_cms_start = dlg;
|
|
|
|
|
_cms_end = dlg + ca_multilevel_code_info(LF_COMMESSE).levels()-1;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (use_fsc && fasinfo.parent() == LF_COMMESSE)
|
|
|
|
|
insert_anal_fields(*this, newpage, LF_FASI, y, dlg, dlgd, fsc_req);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const bool cms_req = ini.get_bool("CmsRequired");
|
|
|
|
|
|
|
|
|
|
insert_anal_fields(*this, newpage, LF_COMMESSE, y, dlg, dlgd, cms_req);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-12-03 14:04:02 +00:00
|
|
|
|
if (_cms_start > 0 && _cdc_start > 0)
|
|
|
|
|
set_field_handler(_cms_end, codcms_handler);
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (use_fsc && fasinfo.parent() <= 0)
|
|
|
|
|
insert_anal_fields(*this, newpage, LF_FASI, y, dlg, dlgd, fsc_req);
|
2005-05-05 10:37:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
void TDocumento_mask::configura_sheet(TSheet_field& sheet)
|
1998-08-25 18:07:30 +00:00
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TBit_array to_delete(MAX_COLUMNS);
|
|
|
|
|
to_delete.set();
|
|
|
|
|
const TTipo_documento& tdoc = _doc.tipo();
|
|
|
|
|
const TString_array& sheet_columns = tdoc.sheet_columns();
|
|
|
|
|
const int ncols = sheet_columns.items();
|
|
|
|
|
|
|
|
|
|
TToken_string colonne;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
colonne = "0";
|
|
|
|
|
for (i = 0; i < ncols; i ++ )
|
|
|
|
|
{
|
|
|
|
|
TToken_string& sheet_col = (TToken_string&)sheet_columns.row(i);
|
|
|
|
|
const int field_id = sheet_col.get_int(0);
|
|
|
|
|
const int coltomove = sheet.cid2index(field_id);
|
|
|
|
|
to_delete.reset(coltomove);
|
|
|
|
|
|
|
|
|
|
const TString80 descr(sheet_col.get(1));
|
|
|
|
|
if (descr.not_empty() )
|
|
|
|
|
sheet.set_column_header( field_id, descr);
|
|
|
|
|
|
|
|
|
|
const int size = sheet_col.get_int(2) * 8; // XI_FU_MULTIPLE
|
|
|
|
|
if (size != 0)
|
|
|
|
|
sheet.set_column_width( field_id, size);
|
|
|
|
|
|
2007-03-07 11:36:57 +00:00
|
|
|
|
if (field_id != FR_LORDO)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
colonne.add(field_id);
|
2008-01-30 11:31:54 +00:00
|
|
|
|
if (field_id == FR_CODIVA && tdoc.is_costo())
|
|
|
|
|
{
|
|
|
|
|
const int col = sheet.cid2index(FR_TIPODET);
|
|
|
|
|
|
|
|
|
|
to_delete.reset(col);
|
|
|
|
|
colonne.add(col);
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-03-07 11:36:57 +00:00
|
|
|
|
to_delete.set(0L);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
to_delete.reset(1);
|
|
|
|
|
|
|
|
|
|
if (!to_delete[sheet.cid2index(FR_CODDEP)])
|
|
|
|
|
sheet.enable_column(FR_CODDEP, _ges_dep && _ges_mag);
|
|
|
|
|
if (!to_delete[sheet.cid2index(FR_CODMAG)])
|
|
|
|
|
sheet.enable_column(FR_CODMAG, _ges_mag);
|
|
|
|
|
if (!to_delete[sheet.cid2index(FR_CODDEPC)])
|
|
|
|
|
sheet.enable_column(FR_CODDEPC, _ges_dep && _ges_mag);
|
|
|
|
|
if (!to_delete[sheet.cid2index(FR_CODMAGC)])
|
|
|
|
|
sheet.enable_column(FR_CODMAGC, _ges_mag);
|
|
|
|
|
to_delete.set(sheet.cid2index(FR_CODARTMAG));
|
|
|
|
|
to_delete.set(sheet.cid2index(FR_CHECKED));
|
|
|
|
|
|
2007-05-30 16:46:56 +00:00
|
|
|
|
if (_ges_ca)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
const TMultilevel_code_info& cdc = ca_multilevel_code_info(LF_CDC);
|
|
|
|
|
const TMultilevel_code_info& cms = ca_multilevel_code_info(LF_COMMESSE);
|
|
|
|
|
const TMultilevel_code_info& fas = ca_multilevel_code_info(LF_FASI);
|
|
|
|
|
const int levels = cdc.levels() + cms.levels() + fas.levels();
|
|
|
|
|
for (short cid = FR_CDC1; cid <= FR_CDC12; cid++)
|
|
|
|
|
{
|
|
|
|
|
const int level = cid-FR_CDC1;
|
|
|
|
|
to_delete.set(sheet.cid2index(cid), level >= levels);
|
|
|
|
|
if (level < levels)
|
|
|
|
|
colonne.add(cid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( i = MAX_COLUMNS - 1; i >= 0; i-- )
|
|
|
|
|
{
|
|
|
|
|
if( to_delete[i] )
|
|
|
|
|
{
|
2007-11-16 13:46:49 +00:00
|
|
|
|
sheet.enable_column( i + FIRST_FIELD, false);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
sheet.delete_column( i + FIRST_FIELD);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!sheet.user_saved_columns_order())
|
|
|
|
|
sheet.set_columns_order(&colonne);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TCond_vendita& TDocumento_mask::condv() const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (_condv == NULL)
|
|
|
|
|
{
|
|
|
|
|
TDocumento_mask* myself = (TDocumento_mask*)this;
|
|
|
|
|
myself->_condv = new TCond_vendita(myself, NULL);
|
|
|
|
|
}
|
|
|
|
|
return *_condv;
|
1997-06-12 16:15:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-11-30 22:02:59 +00:00
|
|
|
|
void TDocumento_mask::update_progs(bool stop_run)
|
|
|
|
|
{
|
|
|
|
|
static bool updating_progs = false;
|
|
|
|
|
|
|
|
|
|
if (!updating_progs)
|
|
|
|
|
{
|
|
|
|
|
updating_progs = true;
|
|
|
|
|
TWait_cursor hourglass;
|
|
|
|
|
const int page = curr_page();
|
|
|
|
|
const int last_field = fields() - 1;
|
|
|
|
|
|
2007-03-07 16:22:28 +00:00
|
|
|
|
for (int f = last_field; f >= 0; f--)
|
2004-11-30 22:02:59 +00:00
|
|
|
|
{
|
|
|
|
|
const TMask_field & mf = fld(f);
|
|
|
|
|
const int id = mf.dlg();
|
|
|
|
|
const int field_page = mf.page();
|
|
|
|
|
|
|
|
|
|
if ((page == field_page || stop_run) && id > BASE_PIEDE)
|
|
|
|
|
{
|
2005-09-20 12:51:40 +00:00
|
|
|
|
const TFieldref* recfld = mf.field();
|
2004-11-30 22:02:59 +00:00
|
|
|
|
if (recfld != NULL)
|
|
|
|
|
{
|
|
|
|
|
const TString & name = recfld->name();
|
2007-03-07 11:36:57 +00:00
|
|
|
|
const TString& val = doc().get(name);
|
2004-11-30 22:02:59 +00:00
|
|
|
|
set(id, val, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
updating_progs = false;
|
|
|
|
|
}
|
2001-05-02 13:40:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-06-12 16:15:09 +00:00
|
|
|
|
void TDocumento_mask::next_page(int p)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
TMask::next_page(p);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (is_calculated_page(curr_page()))
|
|
|
|
|
update_progs();
|
2001-05-02 13:40:49 +00:00
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
2004-11-30 22:02:59 +00:00
|
|
|
|
void TDocumento_mask::start_run()
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
2004-11-30 22:02:59 +00:00
|
|
|
|
TSmart_card * s = smartcard();
|
|
|
|
|
|
|
|
|
|
if (s != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (edit_mode() && s->with_card(*this))
|
|
|
|
|
disable(DLG_SAVEREC);
|
|
|
|
|
if (s->card_connected())
|
|
|
|
|
{
|
|
|
|
|
disable(F_CODCF);
|
|
|
|
|
disable(F_RAGSOC);
|
|
|
|
|
s->disable_prot_fields(*this);
|
|
|
|
|
if (s->with_card(*this))
|
|
|
|
|
enable(DLG_SAVEREC);
|
|
|
|
|
|
|
|
|
|
smartcard_error err = s->read();
|
|
|
|
|
if (err == no_smarterror)
|
|
|
|
|
s->card2mask(*this);
|
|
|
|
|
else
|
|
|
|
|
s->display_error(err);
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TVariable_mask::start_run();
|
2004-11-30 22:02:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-02 13:40:49 +00:00
|
|
|
|
bool TDocumento_mask::stop_run(KEY key)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
if (key != K_ESC && key != K_QUIT)
|
|
|
|
|
update_progs(true);
|
2004-11-30 22:02:59 +00:00
|
|
|
|
else
|
|
|
|
|
if (key == K_ESC)
|
|
|
|
|
{
|
|
|
|
|
TSmart_card * s = smartcard();
|
|
|
|
|
|
|
|
|
|
if (s != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (s->card_connected())
|
|
|
|
|
{
|
|
|
|
|
s->disconnect_card();
|
|
|
|
|
enable(F_CODCF);
|
|
|
|
|
enable(F_RAGSOC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
return TVariable_mask::stop_run(key);
|
1997-06-12 16:15:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::on_key(KEY key)
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (key == K_SHIFT + K_F12)
|
|
|
|
|
{
|
|
|
|
|
TRelation r(LF_DOC);
|
|
|
|
|
r.curr()=doc();
|
2008-03-26 12:38:22 +00:00
|
|
|
|
bool can_save = !doc().bloccato() && !doc().chiuso();
|
|
|
|
|
if (can_save && ::user_can_write(&r))
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
TMask_field& stato = field(F_STATO);
|
|
|
|
|
stato.enable();
|
|
|
|
|
enable(DLG_SAVEREC);
|
|
|
|
|
enable(DLG_DELREC);
|
2004-11-30 22:02:59 +00:00
|
|
|
|
TSmart_card * s = smartcard();
|
|
|
|
|
|
|
|
|
|
if (s != NULL && s->card_connected())
|
|
|
|
|
s->enable_prot_fields(*this);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
warning_box("L'utente %s non puo' modificare questo documento",
|
|
|
|
|
(const char*)user());
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2005-05-23 12:17:02 +00:00
|
|
|
|
else
|
|
|
|
|
if (key == K_F7)
|
|
|
|
|
{
|
|
|
|
|
const TSheet_field & sf = sfield(F_SHEET);
|
|
|
|
|
TDocumento & d = doc();
|
|
|
|
|
TRiga_documento & riga = d[sf.selected() + 1];
|
|
|
|
|
TOriginal_row_mask sm;
|
|
|
|
|
const TRectype * or_row = riga.find_original_rdoc();
|
|
|
|
|
|
|
|
|
|
if (or_row != NULL)
|
|
|
|
|
{
|
|
|
|
|
sm.set(F_DACODNUM, or_row->get(RDOC_CODNUM));
|
|
|
|
|
sm.set(F_DAANNO, or_row->get(RDOC_ANNO));
|
|
|
|
|
sm.set(F_DAPROVV, or_row->get(RDOC_PROVV));
|
|
|
|
|
sm.set(F_DANDOC, or_row->get(RDOC_NDOC));
|
|
|
|
|
sm.set(F_DANRIGA, or_row->get(RDOC_NRIGA));
|
|
|
|
|
sm.disable(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sm.run() == K_ENTER && sm.field(F_DACODNUM).enabled())
|
|
|
|
|
{
|
|
|
|
|
TToken_string key(sm.get(F_DACODNUM));
|
|
|
|
|
key.add(sm.get(F_DAANNO));
|
|
|
|
|
key.add(sm.get(F_DAPROVV));
|
|
|
|
|
key.add(sm.get(F_DANDOC));
|
|
|
|
|
key.add(sm.get(F_DANRIGA));
|
|
|
|
|
|
|
|
|
|
const TRectype & or_row_mod = cache().get(LF_RIGHEDOC, key);
|
|
|
|
|
if (or_row_mod.empty())
|
|
|
|
|
riga.reset_original_rdoc_key();
|
|
|
|
|
else
|
|
|
|
|
riga.set_original_rdoc_key(or_row_mod);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
return TVariable_mask::on_key(key);
|
1997-06-12 16:15:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
void TDocumento_mask::occ2mask()
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
const TOccasionale& o = doc().occas();
|
|
|
|
|
|
|
|
|
|
reset(F_COFI);
|
|
|
|
|
reset(F_PAIVA);
|
|
|
|
|
set(F_OCFPI, o.get(OCC_CFPI));
|
|
|
|
|
const TString & ragsoc = o.get(OCC_RAGSOC);
|
|
|
|
|
set(F_RAGSOC, ragsoc);
|
|
|
|
|
set(F_RAGSOCSP, ragsoc);
|
|
|
|
|
const TString & indir = o.get(OCC_INDIR);
|
|
|
|
|
set(F_INDCF, indir);
|
|
|
|
|
set(F_INDSP, indir);
|
|
|
|
|
const TString & civ = o.get(OCC_CIV);
|
|
|
|
|
set(F_CIVCF, civ);
|
|
|
|
|
set(F_CIVSP, civ);
|
|
|
|
|
const TString & cap = o.get(OCC_CAP);
|
|
|
|
|
set(F_CAPCF, cap);
|
|
|
|
|
set(F_CAPSP, cap);
|
|
|
|
|
const TString & com = o.get(OCC_COM);
|
|
|
|
|
set(F_COMCF, com);
|
|
|
|
|
set( F_COMSP, com);
|
|
|
|
|
const TString & stato = o.get(OCC_STATO);
|
|
|
|
|
set(F_STATOCF, stato);
|
|
|
|
|
set( F_STATOSP, stato);
|
|
|
|
|
if (id2pos(F_CODINDSP) >= 0)
|
|
|
|
|
reset(F_CODINDSP);
|
|
|
|
|
// Sugli occasionali non c'<27> la localit<69>
|
|
|
|
|
const TString & localita = o.get(OCC_LOCALITA);
|
|
|
|
|
set(F_LOCALITACF, localita);
|
|
|
|
|
set(F_LOCALITASP, localita);
|
|
|
|
|
check_field(F_COMSP);
|
|
|
|
|
check_field(F_STATOSP);
|
1997-06-12 16:15:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-04-17 08:18:32 +00:00
|
|
|
|
void TDocumento_mask::cli2mask(bool force_load)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
TCli_for & c = doc().clifor();
|
|
|
|
|
|
|
|
|
|
const bool onload = !is_running();
|
|
|
|
|
|
|
|
|
|
// Setta i campi che appartengono al file LF_CLIFO
|
|
|
|
|
const bool occas = c.occasionale();
|
|
|
|
|
|
|
|
|
|
show(F_OCCASEDIT, occas);
|
|
|
|
|
if (!occas)
|
|
|
|
|
reset(F_OCFPI);
|
|
|
|
|
show(F_OCFPI, occas);
|
|
|
|
|
// In forse per l'Occasionale, sicuri per il Normale
|
|
|
|
|
show(F_COFI, !occas);
|
|
|
|
|
show(F_STATOPAIVA, !occas);
|
|
|
|
|
show(F_PAIVA, !occas);
|
|
|
|
|
set(F_RAGSOC, c.get(CLI_RAGSOC));
|
|
|
|
|
enable(F_RAGSOC, !occas);
|
|
|
|
|
|
|
|
|
|
const TRectype & ven_rec = c.vendite();
|
|
|
|
|
|
2009-04-17 08:18:32 +00:00
|
|
|
|
if(force_load || !onload)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
short pos = id2pos(F_CODVAL);
|
|
|
|
|
const TString16 codval = c.get(CLI_CODVAL); // Attenzione: Non usare TString& qui!
|
|
|
|
|
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
set(F_CODVAL, codval, TRUE);
|
|
|
|
|
pos = id2pos(F_CODVAL1);
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
set(F_CODVAL1, codval, TRUE);
|
|
|
|
|
pos = id2pos(F_CODLIN);
|
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
fld(pos).set(c.get(CLI_CODLIN));
|
|
|
|
|
set(F_CODPAG, c.get(CLI_CODPAG));
|
|
|
|
|
set(F_CODABIA, c.get(CLI_CODABI));
|
|
|
|
|
set(F_CODCABA, c.get(CLI_CODCAB));
|
|
|
|
|
if (id2pos(F_IBAN_STATO) > 0)
|
|
|
|
|
{
|
|
|
|
|
const TString80 iban = c.get(CLI_IBAN);
|
|
|
|
|
set(F_IBAN, iban);
|
|
|
|
|
efield(F_IBAN_STATO).validate(K_TAB);
|
|
|
|
|
if (iban.not_empty())
|
|
|
|
|
{
|
|
|
|
|
set(F_IBAN_STATO, iban.left(2));
|
|
|
|
|
set(F_IBAN_CHECK, iban.mid(2,2));
|
|
|
|
|
set(F_BBAN , iban.mid(4));
|
|
|
|
|
set(F_BBAN_CIN , iban.mid(4,1));
|
|
|
|
|
set(F_BBAN_ABI , iban.mid(5,5));
|
|
|
|
|
set(F_BBAN_CAB , iban.mid(10,5));
|
|
|
|
|
set(F_BBAN_CONTO, iban.mid(15,12));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Setta i campi che appartengono al file LF_CFVEN
|
|
|
|
|
set(F_CODABIP, ven_rec.get(CFV_CODABIPR));
|
|
|
|
|
set(F_CODCABP, ven_rec.get(CFV_CODCABPR));
|
|
|
|
|
set(F_RAGGR, ven_rec.get(CFV_RAGGDOC));
|
|
|
|
|
set(F_RAGGREFF, ven_rec.get(CFV_RAGGEFF));
|
|
|
|
|
set(F_CODINDSP, ven_rec.get(CFV_CODINDSP));
|
|
|
|
|
set(F_CODAG, ven_rec.get(CFV_CODAG));
|
2009-03-10 14:31:20 +00:00
|
|
|
|
set(F_CODAGVIS, ven_rec.get(CFV_CODAG1));
|
2005-08-23 08:54:32 +00:00
|
|
|
|
set(F_CODSPMEZZO, ven_rec.get(CFV_CODSPMEZZO));
|
|
|
|
|
set(F_CODPORTO, ven_rec.get(CFV_CODPORTO));
|
|
|
|
|
set(F_CODNOTESP1, ven_rec.get(CFV_CODNOTESP1));
|
|
|
|
|
set(F_CODNOTESP2, ven_rec.get(CFV_CODNOTESP2));
|
|
|
|
|
set(F_CODNOTE, ven_rec.get(CFV_CODNOTE));
|
|
|
|
|
set(F_CODVETT1, ven_rec.get(CFV_CODVETT1));
|
|
|
|
|
set(F_CODVETT2, ven_rec.get(CFV_CODVETT2));
|
|
|
|
|
set(F_CODVETT3, ven_rec.get(CFV_CODVETT3));
|
|
|
|
|
set(F_SPESEINC, ven_rec.get(CFV_PERCSPINC));
|
|
|
|
|
set(F_ADDBOLLI, ven_rec.get(CFV_ADDBOLLI));
|
|
|
|
|
set(F_CATVEN, ven_rec.get(CFV_CATVEN));
|
|
|
|
|
pos = id2pos(F_CODLIST);
|
2009-05-27 15:42:59 +00:00
|
|
|
|
const TString4 codlist = ven_rec.get(CFV_CODLIST);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
{
|
|
|
|
|
TEdit_field & f = (TEdit_field&) fld(pos);
|
|
|
|
|
|
|
|
|
|
f.set(codlist);
|
|
|
|
|
f.check();
|
|
|
|
|
f.on_hit();
|
|
|
|
|
}
|
|
|
|
|
pos = id2pos(F_CODLIST1);
|
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
{
|
|
|
|
|
TEdit_field & f = (TEdit_field&) fld(pos);
|
|
|
|
|
|
|
|
|
|
f.set(codlist);
|
|
|
|
|
f.check();
|
|
|
|
|
f.on_hit();
|
|
|
|
|
}
|
2009-03-10 14:31:20 +00:00
|
|
|
|
/* pos = id2pos(F_CODAG);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
2009-03-10 14:31:20 +00:00
|
|
|
|
fld(pos).set(ven_rec.get(CFV_CODAG)); */
|
2007-09-18 14:25:15 +00:00
|
|
|
|
set(F_CODZON, ven_rec.get(CFV_CODZONA), 0x3);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
set(F_RAGGR, ven_rec.get(CFV_RAGGDOC));
|
|
|
|
|
sconto_testa2mask();
|
|
|
|
|
spese2mask();
|
|
|
|
|
}
|
|
|
|
|
enable( F_CODINDSP , !occas);
|
|
|
|
|
if (occas)
|
|
|
|
|
occ2mask();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
set(F_COFI, c.get(CLI_COFI));
|
|
|
|
|
set(F_INDCF, c.get(CLI_INDCF));
|
|
|
|
|
set(F_CIVCF, c.get(CLI_CIVCF));
|
|
|
|
|
set(F_STATOPAIVA, c.get(CLI_STATOPAIV));
|
|
|
|
|
set(F_PAIVA, c.get(CLI_PAIV));
|
|
|
|
|
set(F_LOCALITACF, c.get(CLI_LOCCF));
|
|
|
|
|
set(F_CAPCF, c.get(CLI_CAPCF));
|
|
|
|
|
set(F_COMCF, c.get(CLI_COMCF));
|
|
|
|
|
set(F_STATOCF, c.get(CLI_STATOCF));
|
|
|
|
|
check_field( F_CODINDSP );
|
|
|
|
|
}
|
2009-05-27 09:52:28 +00:00
|
|
|
|
const TString4 newcodval(get(F_CODVAL));
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
2007-09-18 14:25:15 +00:00
|
|
|
|
short pos = id2pos(F_CAMBIO);
|
|
|
|
|
if ((pos >= 0) && newcodval.empty())
|
|
|
|
|
fld(pos).reset();
|
|
|
|
|
pos = id2pos(F_CODVAL);
|
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
fld(pos).check(STARTING_CHECK);
|
|
|
|
|
pos = id2pos(F_CODVAL1);
|
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
fld(pos).check(STARTING_CHECK);
|
|
|
|
|
check_field(F_COMCF);
|
|
|
|
|
check_field(F_STATOCF);
|
|
|
|
|
check_field( F_CODPAG );
|
|
|
|
|
pos = id2pos(F_CODLIN);
|
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
fld(pos).check();
|
|
|
|
|
check_field( F_CODCABA );
|
|
|
|
|
pos = id2pos(F_CODLIST);
|
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
fld(pos).check();
|
|
|
|
|
pos = id2pos(F_CODLIST1);
|
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
fld(pos).check();
|
|
|
|
|
check_field( F_CODCABP );
|
|
|
|
|
pos = id2pos(F_CODAG);
|
2009-03-10 14:31:20 +00:00
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
fld(pos).check();
|
|
|
|
|
pos = id2pos(F_CODAGVIS);
|
2007-09-18 14:25:15 +00:00
|
|
|
|
if (pos >= 0 && fld(pos).active())
|
|
|
|
|
fld(pos).check();
|
|
|
|
|
|
|
|
|
|
check_field( F_CODSPMEZZO );
|
|
|
|
|
check_field( F_CODPORTO );
|
|
|
|
|
check_field( F_CODNOTESP1 );
|
|
|
|
|
check_field( F_CODNOTESP2 );
|
|
|
|
|
check_field( F_CODNOTE );
|
|
|
|
|
check_field( F_CODVETT1 );
|
|
|
|
|
check_field( F_CODVETT2 );
|
|
|
|
|
check_field( F_CODVETT3 );
|
|
|
|
|
check_field( F_CATVEN );
|
|
|
|
|
check_field( F_CODZON );
|
|
|
|
|
|
|
|
|
|
//gestione contratti
|
|
|
|
|
bool gescontr = ven_rec.get_bool(CFV_GESTCONTR);
|
|
|
|
|
if (gescontr)
|
|
|
|
|
{
|
|
|
|
|
TConfig ditta(CONFIG_DITTA, "ve");
|
|
|
|
|
gescontr = ditta.get_bool("GES", "ve", 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enable(F_CODCONT1, gescontr);
|
|
|
|
|
enable(F_CODCONT, gescontr);
|
1997-06-12 16:15:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
void TDocumento_mask::sconto_testa2mask()
|
1997-06-12 16:15:09 +00:00
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TCli_for & c = doc().clifor();
|
|
|
|
|
TConfig ditta(CONFIG_DITTA, "ve");
|
|
|
|
|
const char tipogestione = ditta.get("GESSCO", "ve")[ 0 ];
|
|
|
|
|
switch( tipogestione )
|
|
|
|
|
{
|
|
|
|
|
case 'N': // Sconti non gestiti: pussa via!
|
|
|
|
|
break;
|
|
|
|
|
case 'P': // Percentuale su anagrafica cliente
|
|
|
|
|
set( F_SCONTOPERC, c.vendite().get(CFV_SCONTO));
|
|
|
|
|
break;
|
|
|
|
|
case 'T': // Gestione tabella sconti
|
|
|
|
|
{
|
|
|
|
|
const TString16 codsconto(c.vendite().get(CFV_CODSCC));
|
|
|
|
|
|
|
|
|
|
if (codsconto.not_empty())
|
|
|
|
|
{
|
|
|
|
|
TTable sconti("%SCC");
|
|
|
|
|
sconti.setkey(1);
|
|
|
|
|
sconti.zero();
|
|
|
|
|
sconti.put("CODTAB", codsconto);
|
|
|
|
|
if (sconti.read( ) == NOERR)
|
|
|
|
|
set(F_SCONTOPERC, sconti.get("S1"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'A': // Gestione archivio sconti
|
|
|
|
|
{
|
|
|
|
|
TString16 cod;
|
|
|
|
|
const TRectype & ven_rec = c.vendite();
|
|
|
|
|
TLocalisamfile sconti(LF_SCONTI );
|
|
|
|
|
|
|
|
|
|
sconti.setkey(1);
|
|
|
|
|
sconti.zero();
|
|
|
|
|
sconti.put("TIPO", "I");
|
|
|
|
|
if(ditta.get_bool("SCOKEY", "ve", 1))
|
|
|
|
|
sconti.put("CODCAT", ven_rec.get(CFV_CATVEN));
|
|
|
|
|
if(ditta.get_bool("SCOKEY", "ve", 2))
|
|
|
|
|
cod.format("%-2s", (const char *)ven_rec.get(CFV_CODSCC));
|
|
|
|
|
else
|
|
|
|
|
cod = " ";
|
|
|
|
|
if( ditta.get_bool("SCOKEY", "ve", 3))
|
|
|
|
|
{
|
|
|
|
|
TString8 cz; cz.format("%-2s", (const char*)ven_rec.get(CFV_CODZONA));
|
|
|
|
|
cod << cz;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cod << " ";
|
|
|
|
|
if( ditta.get_bool("SCOKEY", "ve", 4))
|
|
|
|
|
cod << c.get(CLI_CODPAG);
|
|
|
|
|
sconti.put("CODART", cod);
|
|
|
|
|
if(sconti.read() == NOERR)
|
|
|
|
|
set(F_SCONTOPERC, sconti.get( "SCONTO"));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return;
|
1997-06-12 16:15:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
void TDocumento_mask::spese2mask()
|
1997-06-12 16:15:09 +00:00
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TSheet_field & sh = (TSheet_field &) field(F_SHEET);
|
|
|
|
|
TCli_for & c = doc().clifor();
|
|
|
|
|
|
|
|
|
|
TString16 name("CODSP0");
|
|
|
|
|
TString_array spese;
|
2006-07-10 13:30:29 +00:00
|
|
|
|
const TRectype & ven_rec = c.vendite();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
for (int i = 1; i <= 4; i++)
|
|
|
|
|
{
|
|
|
|
|
name.rtrim(1); name << i;
|
|
|
|
|
const TString16 s(ven_rec.get(name));
|
|
|
|
|
|
|
|
|
|
if (s.not_empty())
|
|
|
|
|
spese.add(s);
|
|
|
|
|
}
|
|
|
|
|
|
2006-07-17 13:50:22 +00:00
|
|
|
|
doc().put(DOC_SPESEUPD, false);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
doc().put(DOC_CODVAL, get(F_CODVAL));
|
|
|
|
|
doc().put(DOC_CAMBIO, get(F_CAMBIO));
|
|
|
|
|
doc().put(DOC_CONTROEURO, get(F_CONTROEURO));
|
|
|
|
|
|
2007-11-16 13:46:49 +00:00
|
|
|
|
doc().update_spese_aut(spese, false, &sh);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
sh.force_update();
|
1997-06-12 16:15:09 +00:00
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
void TDocumento_mask::reset_masks(const TString& tipo_doc)
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
static TString16 last_tipo_doc;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (tipo_doc != last_tipo_doc)
|
|
|
|
|
{
|
|
|
|
|
FOR_EACH_ASSOC_OBJECT(_maskriga, h, k, o)
|
|
|
|
|
{
|
|
|
|
|
TMask* m = (TMask*)o;
|
|
|
|
|
m->enable_default();
|
|
|
|
|
if (!_sheet->exist_column(FR_PREZZO))
|
|
|
|
|
m->hide(FR_PREZZO);
|
|
|
|
|
}
|
|
|
|
|
last_tipo_doc = tipo_doc;
|
|
|
|
|
}
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-04-17 16:26:10 +00:00
|
|
|
|
void TDocumento_mask::doc2mask(bool reload_clifo, bool force_load, bool update)
|
1998-08-26 10:54:46 +00:00
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TSheet_field& s = sfield(F_SHEET);
|
|
|
|
|
s.destroy( );
|
|
|
|
|
|
|
|
|
|
for (int p = fields()-1; p >= 0; p--)
|
|
|
|
|
{
|
|
|
|
|
TMask_field& f = fld(p);
|
|
|
|
|
const TFieldref* fr = f.field();
|
|
|
|
|
if (fr)
|
|
|
|
|
f.set(fr->read(doc()));
|
2004-11-30 22:02:59 +00:00
|
|
|
|
else
|
|
|
|
|
f.reset();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (reload_clifo)
|
2009-04-17 08:18:32 +00:00
|
|
|
|
cli2mask(force_load);
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const int righe = doc().physical_rows();
|
|
|
|
|
for (int i = 0; i < righe; i++)
|
|
|
|
|
{
|
2007-04-02 09:14:19 +00:00
|
|
|
|
TRiga_documento & r = doc()[i + 1];
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
s.insert(-1, FALSE);
|
|
|
|
|
s.row(i); // qui verificare
|
|
|
|
|
doc()[i+1].autoload(s);
|
2008-12-16 12:51:47 +00:00
|
|
|
|
s.check_row(i, 0x3);
|
2007-03-30 13:51:17 +00:00
|
|
|
|
if (r.tipo().tipo() == RIGA_PRESTAZIONI)
|
|
|
|
|
{
|
|
|
|
|
const TSpesa_prest & spesa = r.spesa();
|
|
|
|
|
|
|
|
|
|
if (spesa.tipo() == 'V')
|
|
|
|
|
s.disable_cell(i, s.cid2index(FR_QTA));
|
|
|
|
|
}
|
2007-09-18 14:25:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reset_masks(get(F_TIPODOC));
|
2009-02-09 13:36:03 +00:00
|
|
|
|
//aggiorna i colori delle righe e forza l'update dello sheet
|
2009-04-17 16:26:10 +00:00
|
|
|
|
if (update)
|
|
|
|
|
highlight();
|
2007-09-18 14:25:15 +00:00
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
|
|
|
|
void TDocumento_mask::mask2doc()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
for (int p = fields()-1; p >= 0; p--)
|
|
|
|
|
{
|
|
|
|
|
TMask_field& f = fld(p);
|
|
|
|
|
const TFieldref* fr = f.field();
|
|
|
|
|
if (fr)
|
|
|
|
|
fr->write(f.get(), doc());
|
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-04-17 16:40:42 +00:00
|
|
|
|
bool TDocumento_mask::new_mask(int numriga) const
|
|
|
|
|
{
|
|
|
|
|
const TRiga_documento& riga = doc()[numriga + 1];
|
|
|
|
|
const TTipo_riga_documento& tiporiga = riga.tipo();
|
|
|
|
|
TString16 name; tiporiga.mask_name(name);
|
|
|
|
|
|
|
|
|
|
return _maskriga.objptr(name) == NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
TVariable_mask* TDocumento_mask::riga_mask(int numriga)
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const TRiga_documento& riga = doc()[numriga + 1];
|
|
|
|
|
const TTipo_riga_documento& tiporiga = riga.tipo();
|
|
|
|
|
TString16 name; tiporiga.mask_name(name);
|
|
|
|
|
|
|
|
|
|
TVariable_mask* m = (TVariable_mask*)_maskriga.objptr(name);
|
|
|
|
|
if (m == NULL)
|
|
|
|
|
{
|
|
|
|
|
m = new TVariable_mask(name);
|
2008-12-03 08:47:27 +00:00
|
|
|
|
m->set_handler(FR_TIPORIGA, tipo_riga_handler);
|
|
|
|
|
m->set_handler( FR_QTA, qta_handler );
|
|
|
|
|
m->set_handler( FR_UMQTA, um_handler );
|
|
|
|
|
m->set_handler( FR_DATACONS, dcons_handler);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
2008-12-04 16:09:41 +00:00
|
|
|
|
_maskriga.add(name, m);
|
2008-12-03 08:47:27 +00:00
|
|
|
|
|
|
|
|
|
TList_field & htr = lfield(F_LBTIPORIGA);
|
2005-05-25 11:32:58 +00:00
|
|
|
|
const TString codes(htr.get_codes());
|
|
|
|
|
const TString values(htr.get_values());
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
m->lfield(FR_TIPORIGA).replace_items(codes, values);
|
|
|
|
|
|
|
|
|
|
const int pos = m->id2pos(FR_CODART);
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
{
|
2008-12-04 16:12:30 +00:00
|
|
|
|
const TMask_field & f = m->fld(pos);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (f.is_edit())
|
|
|
|
|
{
|
|
|
|
|
TBrowse * browse = ((TEdit_field &) f).browse();
|
|
|
|
|
const char tipo_r = tiporiga.tipo();
|
|
|
|
|
|
|
|
|
|
if (browse )
|
|
|
|
|
{
|
|
|
|
|
const TCursor * cur = browse->cursor();
|
|
|
|
|
if (cur)
|
|
|
|
|
{
|
|
|
|
|
const int num = cur->file().num();
|
|
|
|
|
if (num == LF_ANAMAG || num == LF_CODCORR)
|
|
|
|
|
{
|
|
|
|
|
m->set_handler( FR_CODMAG, codmag_handler );
|
|
|
|
|
m->set_handler( FR_CODMAGC, codmag_coll_handler );
|
|
|
|
|
m->set_handler( FR_CODART, codart_handler );
|
|
|
|
|
m->set_handler( FR_LIV1, liv_handler );
|
|
|
|
|
m->set_handler( FR_LIV2, liv_handler );
|
|
|
|
|
m->set_handler( FR_LIV3, liv_handler );
|
|
|
|
|
m->set_handler( FR_LIV4, liv_handler );
|
|
|
|
|
m->set_handler( FR_UMQTA, umart_handler );
|
|
|
|
|
m->set_handler( FR_CODARTMAG, codartmag_handler );
|
|
|
|
|
m->set_handler( FR_DESCR, descr_handler );
|
|
|
|
|
m->set_handler( FR_QTA, qtaart_handler );
|
|
|
|
|
if (livelli().autoinsert(1))
|
|
|
|
|
m->field(FR_LIV1).check_type(CHECK_NONE);
|
|
|
|
|
if (livelli().autoinsert(2))
|
|
|
|
|
m->field(FR_LIV2).check_type(CHECK_NONE);
|
|
|
|
|
if (livelli().autoinsert(3))
|
|
|
|
|
m->field(FR_LIV3).check_type(CHECK_NONE);
|
|
|
|
|
if (livelli().autoinsert(4))
|
|
|
|
|
m->field(FR_LIV4).check_type(CHECK_NONE);
|
|
|
|
|
}
|
|
|
|
|
else
|
2005-12-08 03:05:30 +00:00
|
|
|
|
if (tipo_r == RIGA_SPESEDOC || tipo_r == RIGA_PRESTAZIONI ||
|
|
|
|
|
tipo_r == RIGA_RISORSE || tipo_r == RIGA_ATTREZZATURE)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
m->set_handler( FR_CODART, sppr_handler );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
m->set_handler(FR_QTAEVASA, qta_evasa_handler);
|
|
|
|
|
m->set_handler(FR_CAUS, causmag_handler);
|
|
|
|
|
|
|
|
|
|
if (m->id2pos(FR_CODIVA) >= 0)
|
|
|
|
|
{
|
|
|
|
|
m->set_handler(FR_CODIVA, iva_handler);
|
|
|
|
|
const TString& tipiva = doc().tipo().tipi_iva_validi();
|
|
|
|
|
if (tipiva.not_empty())
|
|
|
|
|
{
|
|
|
|
|
TBrowse& browse = *(m->efield(FR_CODIVA)).browse();
|
|
|
|
|
TString filter = browse.get_filter();
|
|
|
|
|
|
|
|
|
|
bool close_filter = FALSE;
|
|
|
|
|
if (filter.not_empty())
|
|
|
|
|
{
|
|
|
|
|
filter.insert("(");
|
|
|
|
|
filter << ")&&(";
|
|
|
|
|
close_filter = TRUE;
|
|
|
|
|
}
|
|
|
|
|
bool firstor = TRUE;
|
|
|
|
|
for (int i = tipiva.len()-1; i >= 0; i--) if (tipiva[i] != ' ')
|
|
|
|
|
{
|
|
|
|
|
if (firstor)
|
|
|
|
|
firstor = FALSE;
|
|
|
|
|
else
|
|
|
|
|
filter << "||";
|
|
|
|
|
filter << "(S1==\"";
|
|
|
|
|
switch(i)
|
|
|
|
|
{
|
|
|
|
|
case 1: filter << "VE"; break;
|
|
|
|
|
case 2: filter << "ES"; break;
|
|
|
|
|
case 3: filter << "NI"; break;
|
|
|
|
|
case 4: filter << "NS"; break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
filter << "\")";
|
|
|
|
|
}
|
|
|
|
|
if (close_filter) filter << ')';
|
|
|
|
|
browse.set_filter(filter);
|
|
|
|
|
}
|
2008-12-04 16:09:41 +00:00
|
|
|
|
}
|
2009-02-26 23:32:16 +00:00
|
|
|
|
m->set_handler(DLG_USER, link_handler);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
2007-05-30 16:46:56 +00:00
|
|
|
|
// Quasi qualsiasi cosa analitica va bene
|
|
|
|
|
const bool ca_active = _ges_ca && !(riga.is_descrizione() || riga.is_omaggio() || riga.is_sconto());
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (ca_active)
|
|
|
|
|
{
|
|
|
|
|
const int page = m->win2page(m->fld(m->fields()-1).parent()); // Calcolo bastardo dell'ultima pagina
|
|
|
|
|
|
2005-09-19 17:17:27 +00:00
|
|
|
|
TConfig& ini = ca_config();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
|
|
|
|
|
const bool use_fsc = fasinfo.levels() > 0;
|
|
|
|
|
|
|
|
|
|
int y = 1;
|
2006-12-29 14:16:28 +00:00
|
|
|
|
int i;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
short dlg = FR_CDC1; // id del primo campo da generare
|
|
|
|
|
short dlgd = FR_DESCDC1;
|
|
|
|
|
|
2007-11-16 13:46:49 +00:00
|
|
|
|
_cdc_start_sh = _cdc_end_sh = -1 ;
|
|
|
|
|
_cms_start_sh = _cms_end_sh = -1 ;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
|
{
|
|
|
|
|
const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2
|
|
|
|
|
if (level == "CDC") // Crea centro di costo
|
|
|
|
|
{
|
2007-11-16 13:46:49 +00:00
|
|
|
|
if (_cdc_start_sh < 0)
|
|
|
|
|
{
|
|
|
|
|
_cdc_start_sh = dlg;
|
|
|
|
|
_cdc_end_sh = dlg + ca_multilevel_code_info(LF_CDC).levels()-1;
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (use_fsc && fasinfo.parent() == LF_CDC)
|
|
|
|
|
insert_anal_fields(*m, page, LF_FASI, y, dlg, dlgd, false);
|
|
|
|
|
else
|
|
|
|
|
insert_anal_fields(*m, page, LF_CDC, y, dlg, dlgd, false);
|
2007-11-16 13:46:49 +00:00
|
|
|
|
m->set_handler( _cdc_end_sh, cdc_mag_handler);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
if (level == "CMS") // Crea commessa
|
|
|
|
|
{
|
2007-11-16 13:46:49 +00:00
|
|
|
|
if (_cms_start_sh < 0)
|
|
|
|
|
{
|
|
|
|
|
_cms_start_sh = dlg;
|
|
|
|
|
_cms_end_sh = dlg + ca_multilevel_code_info(LF_COMMESSE).levels()-1;
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (use_fsc && fasinfo.parent() == LF_COMMESSE)
|
|
|
|
|
insert_anal_fields(*m, page, LF_FASI, y, dlg, dlgd, false);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
insert_anal_fields(*m, page, LF_COMMESSE, y, dlg, dlgd, false);
|
|
|
|
|
}
|
2007-11-16 13:46:49 +00:00
|
|
|
|
m->set_handler(_cms_end_sh, cms_mag_handler);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (use_fsc && fasinfo.parent() <= 0)
|
|
|
|
|
insert_anal_fields(*m, page, LF_FASI, y, dlg, dlgd, false);
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-26 16:31:58 +00:00
|
|
|
|
TFilename proname; tiporiga.profile_name(proname);
|
|
|
|
|
TConfig pro( proname, "HANDLERS" );
|
|
|
|
|
TAssoc_array& handlers = pro.list_variables();
|
|
|
|
|
FOR_EACH_ASSOC_STRING(handlers, obj, key, str)
|
|
|
|
|
{
|
|
|
|
|
int id = 0, hd = 0;
|
|
|
|
|
if (*key == 'H' && strchr(str, '|') == NULL) // Provo a gestire il caso Handler(105) = 3
|
|
|
|
|
{
|
|
|
|
|
const TFixed_string k(key);
|
|
|
|
|
id = atoi(k.after('('));
|
|
|
|
|
hd = atoi(str);
|
|
|
|
|
}
|
|
|
|
|
else // Provo a gestire il caso 1 = 105|3
|
|
|
|
|
{
|
|
|
|
|
const TToken_string riga = str;
|
|
|
|
|
riga.get(0, id);
|
|
|
|
|
riga.get(1, hd);
|
|
|
|
|
}
|
|
|
|
|
if (id >= DLG_USER && hd > 0)
|
|
|
|
|
user_set_row_handler(*m, id, hd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m->id2pos(FR_PREZZO) >= 0)
|
|
|
|
|
{
|
|
|
|
|
TEditable_field& f = (TEditable_field&)m->efield(FR_PREZZO);
|
|
|
|
|
f.reset_driver(F_CODVAL);
|
|
|
|
|
f.add_driver(-F_CODVAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m->id2pos(FR_IMPFISSO) >= 0)
|
|
|
|
|
{
|
|
|
|
|
TEditable_field& f = m->efield(FR_IMPFISSO);
|
|
|
|
|
f.reset_driver(); // Perche' qui non c'e' scritto f.reset_driver(F_CODVAL) ?
|
|
|
|
|
f.add_driver(-F_CODVAL);
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
2009-03-26 16:31:58 +00:00
|
|
|
|
m->set_sheet(&sfield(F_SHEET));
|
2005-08-23 08:54:32 +00:00
|
|
|
|
return m;
|
1998-11-04 18:04:26 +00:00
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
|
void TDocumento_mask::update_giacenza()
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
2006-07-11 13:12:41 +00:00
|
|
|
|
if (id2pos(F_CURGIAC)<0 || !is_running())
|
2005-08-23 08:54:32 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2008-10-07 00:50:22 +00:00
|
|
|
|
TSheet_field& sf = sfield(F_SHEET);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TToken_string& row = sf.row(sf.selected());
|
2006-12-14 23:27:54 +00:00
|
|
|
|
TString codart = row.get(sf.cid2index(FR_CODARTMAG));
|
2008-10-07 00:50:22 +00:00
|
|
|
|
|
|
|
|
|
if (codart.blank())
|
|
|
|
|
{
|
|
|
|
|
reset(F_CURGIAC);
|
|
|
|
|
reset(F_CURDISP);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TString16 causmag = row.get(sf.cid2index(FR_CAUS));
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
|
|
if (causmag.blank())
|
|
|
|
|
causmag = get(F_CAUSMAG);
|
|
|
|
|
|
2008-10-07 00:50:22 +00:00
|
|
|
|
if (causmag.full())
|
2006-12-13 16:22:33 +00:00
|
|
|
|
{
|
2008-10-07 00:50:22 +00:00
|
|
|
|
TCausale_magazzino & c = cached_causale_magazzino(causmag);
|
|
|
|
|
|
|
|
|
|
if (c.scarica_alternativi())
|
|
|
|
|
{
|
|
|
|
|
const TString& alt = cached_article(codart).get(ANAMAG_CODARTALT);
|
|
|
|
|
if (alt.full())
|
|
|
|
|
codart = alt;
|
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
real giac, disp;
|
2008-10-07 00:50:22 +00:00
|
|
|
|
TString8 codmag = row.get(sf.cid2index(FR_CODMAG));
|
|
|
|
|
if (codmag.full())
|
|
|
|
|
{
|
|
|
|
|
const TString4 coddep = row.get(sf.cid2index(FR_CODDEP));
|
|
|
|
|
if (coddep.full())
|
|
|
|
|
codmag << coddep;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{ // Cerca di determinare il magazzino di default, se manca sulla riga
|
|
|
|
|
if (causmag.full())
|
2006-12-15 09:26:08 +00:00
|
|
|
|
{
|
2008-10-07 00:50:22 +00:00
|
|
|
|
TCausale_magazzino & c = cached_causale_magazzino(causmag);
|
2006-12-15 09:26:08 +00:00
|
|
|
|
|
2008-10-07 00:50:22 +00:00
|
|
|
|
if (c.has_default_mag())
|
|
|
|
|
{
|
|
|
|
|
codmag = c.default_mag();
|
|
|
|
|
if (c.has_default_dep())
|
|
|
|
|
codmag << c.default_dep();
|
2006-04-13 17:56:02 +00:00
|
|
|
|
}
|
2006-12-15 09:26:08 +00:00
|
|
|
|
}
|
2008-10-07 00:50:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TString16 livello;
|
2006-12-15 09:26:08 +00:00
|
|
|
|
|
2008-10-07 00:50:22 +00:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
const char* liv = row.get(sf.cid2index(FR_LIV1+i));
|
|
|
|
|
if (*liv > ' ')
|
|
|
|
|
livello << liv;
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
2006-12-15 09:26:08 +00:00
|
|
|
|
|
2008-10-07 00:50:22 +00:00
|
|
|
|
const TString8 annoes = get(F_ANNO);
|
|
|
|
|
TArticolo_giacenza & art = cached_article_balances(codart);
|
|
|
|
|
|
|
|
|
|
giac = art.disponibilita(annoes, codmag, livello, TRUE);
|
|
|
|
|
disp = art.disponibilita(annoes, codmag, livello, FALSE);
|
|
|
|
|
|
|
|
|
|
const TString4 um = row.get(sf.cid2index(FR_UMQTA));
|
|
|
|
|
|
|
|
|
|
art.convert_to_um(giac, um);
|
|
|
|
|
art.convert_to_um(disp, um);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
set(F_CURGIAC, giac.string());
|
|
|
|
|
set(F_CURDISP, disp.string());
|
1999-04-26 15:58:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Handlers and notifiers
|
2005-08-23 08:54:32 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
bool TDocumento_mask::ss_handler(TMask_field& f, KEY key)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
2007-09-18 14:25:15 +00:00
|
|
|
|
bool ok = TRUE;
|
|
|
|
|
if (key == K_ENTER && f.mask().insert_mode())
|
|
|
|
|
{
|
|
|
|
|
TSheet_field& ss = (TSheet_field&)f;
|
2008-03-26 16:43:54 +00:00
|
|
|
|
if (!app().is_transaction() && ss.empty())
|
|
|
|
|
ok = yesno_box(TR("Il documento e' privo di righe:\n"
|
|
|
|
|
"Si desidera continuare ugualmente?"));
|
2007-09-18 14:25:15 +00:00
|
|
|
|
}
|
|
|
|
|
return ok;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
|
|
|
|
{
|
2007-02-01 15:19:17 +00:00
|
|
|
|
static bool selecting = false;
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TDocumento_mask& m = (TDocumento_mask&)ss.mask();
|
|
|
|
|
TDocumento& doc = m.doc();
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
2007-02-01 15:19:17 +00:00
|
|
|
|
switch (key)
|
|
|
|
|
{
|
|
|
|
|
case K_ENTER: // modifica
|
|
|
|
|
{
|
|
|
|
|
TRiga_documento& riga = doc[r + 1];
|
|
|
|
|
riga.autosave(ss);
|
|
|
|
|
|
|
|
|
|
if (m.is_calculated_page(m.curr_page()))
|
|
|
|
|
m.update_progs();
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
m.highlight_row(r);
|
2007-02-01 15:19:17 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2007-11-16 13:46:49 +00:00
|
|
|
|
case K_CTRL + K_ENTER: // inizio modifica
|
|
|
|
|
{
|
|
|
|
|
TRiga_documento& riga = doc[r + 1];
|
|
|
|
|
|
|
|
|
|
m.codcms_sh() = riga.get(RDOC_CODCMS);
|
|
|
|
|
}
|
2007-02-01 15:19:17 +00:00
|
|
|
|
case K_DEL: // Cancellazione
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
doc.destroy_row(r + 1, TRUE);
|
|
|
|
|
if (r < doc.rows())
|
|
|
|
|
{
|
|
|
|
|
TRiga_documento & riga = doc[r + 1];
|
|
|
|
|
if (riga.is_omaggio() && riga.is_generata())
|
|
|
|
|
{
|
|
|
|
|
ss.destroy(r + 1);
|
2008-03-26 12:38:22 +00:00
|
|
|
|
doc.destroy_row(r + 1, true);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-07 11:36:57 +00:00
|
|
|
|
doc.dirty_fields();
|
2008-03-26 12:38:22 +00:00
|
|
|
|
if (m.is_calculated_page(ss.page()))
|
2007-03-07 11:36:57 +00:00
|
|
|
|
m.update_progs();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
2007-02-06 11:31:12 +00:00
|
|
|
|
break;
|
2008-03-26 16:43:54 +00:00
|
|
|
|
case K_INS: // Inserimento
|
|
|
|
|
{
|
|
|
|
|
if (r < doc.rows())
|
|
|
|
|
{
|
|
|
|
|
TRiga_documento & riga = doc[r + 1];
|
|
|
|
|
if (riga.is_omaggio() && riga.is_generata())
|
2007-03-07 16:22:28 +00:00
|
|
|
|
{
|
|
|
|
|
const bool enabled = ss.cell_enabled(r, 0);
|
|
|
|
|
|
|
|
|
|
if (!enabled) ss.enable_row(r);
|
|
|
|
|
ss.force_update(r);
|
|
|
|
|
ss.select(r);
|
|
|
|
|
m.send_key(K_CTRL + '+', 0);
|
|
|
|
|
if (!enabled) ss.disable_row(r);
|
|
|
|
|
ss.force_update(r);
|
2008-03-26 12:38:22 +00:00
|
|
|
|
return false;
|
2008-03-26 16:43:54 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
doc.insert_row(r + 1, m.get( F_LBTIPORIGA ));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case K_CTRL + K_INS:
|
|
|
|
|
{
|
|
|
|
|
TRiga_documento & riga = doc[r + 1];
|
|
|
|
|
TRectype & ven_rec = doc.clifor().vendite();
|
|
|
|
|
TString8 s(ven_rec.get(CFV_CODMAG));
|
|
|
|
|
const TTipo_riga_documento & t = riga.tipo();
|
|
|
|
|
|
|
|
|
|
if (s.full())
|
2008-08-28 13:28:46 +00:00
|
|
|
|
{
|
2008-03-26 16:43:54 +00:00
|
|
|
|
s.left_just(3);
|
|
|
|
|
s << ven_rec.get(CFV_CODDEP);
|
2008-08-28 13:28:46 +00:00
|
|
|
|
}
|
2008-03-26 16:43:54 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
s = m.get(F_CAUSMAG);
|
|
|
|
|
if (s.full())
|
2007-03-07 11:36:57 +00:00
|
|
|
|
{
|
2008-03-26 16:43:54 +00:00
|
|
|
|
const TRectype & c=cache().get("%CAU", s);
|
|
|
|
|
if (!c.empty() && c.get_char("S10") > ' ') // Ignora magazzini non validi
|
|
|
|
|
s = c.get("S10");
|
|
|
|
|
else
|
2007-03-07 11:36:57 +00:00
|
|
|
|
{
|
2008-03-26 16:43:54 +00:00
|
|
|
|
s = m._std_mag;
|
2007-03-07 11:36:57 +00:00
|
|
|
|
s.left_just(3);
|
2008-03-26 16:43:54 +00:00
|
|
|
|
s << m._std_dep;
|
2007-03-07 11:36:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2008-03-26 16:43:54 +00:00
|
|
|
|
}
|
|
|
|
|
if (s.full())
|
|
|
|
|
riga.put("CODMAG", s);
|
|
|
|
|
|
|
|
|
|
riga.autoload(ss);
|
|
|
|
|
ss.check_row(r);
|
|
|
|
|
t.set_defaults(ss, r + 1);
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
m.highlight_row(r);
|
2008-03-26 16:43:54 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case K_TAB: // ingresso nella riga
|
|
|
|
|
if (!selecting && m.is_running())
|
2007-02-01 15:19:17 +00:00
|
|
|
|
{
|
2008-11-15 09:41:12 +00:00
|
|
|
|
const TRectype& rdoc = doc[r + 1];
|
|
|
|
|
|
2008-11-14 14:40:28 +00:00
|
|
|
|
if (r < doc.physical_rows())
|
|
|
|
|
{
|
2008-11-15 09:41:12 +00:00
|
|
|
|
m.update_giacenza();
|
|
|
|
|
set_curr_um(rdoc.get(RDOC_UMQTA));
|
|
|
|
|
}
|
2007-02-01 15:19:17 +00:00
|
|
|
|
|
2008-03-26 16:43:54 +00:00
|
|
|
|
if (rdoc.get(RDOC_CODART).empty() && rdoc.get(RDOC_DESCR).empty())
|
|
|
|
|
{
|
|
|
|
|
selecting = true; // semaforo per impedire l'evento di selezione doppio
|
|
|
|
|
ss.select(r, 1, false);
|
|
|
|
|
selecting = false;
|
|
|
|
|
}
|
2007-02-01 15:19:17 +00:00
|
|
|
|
}
|
2008-03-26 16:43:54 +00:00
|
|
|
|
break;
|
2008-11-14 14:40:28 +00:00
|
|
|
|
case K_CTRL + K_TAB: // uscita dalla riga
|
|
|
|
|
{
|
|
|
|
|
bool ok = true;
|
|
|
|
|
static int checkgiac = 3;
|
|
|
|
|
if (checkgiac > 2)
|
|
|
|
|
{
|
|
|
|
|
TConfig c(CONFIG_DITTA);
|
|
|
|
|
checkgiac = c.get_bool("LIVPERART", "ve");
|
|
|
|
|
}
|
|
|
|
|
if (checkgiac)
|
|
|
|
|
{
|
|
|
|
|
TString livello;
|
|
|
|
|
TToken_string & row = ss.row(r);
|
|
|
|
|
|
|
|
|
|
for (int l = 0; l<4 ; l++)
|
|
|
|
|
doc.livelli().pack_grpcode(livello, row.get(ss.cid2index(FR_LIV1+l)), l+1);
|
|
|
|
|
if (livello.full())
|
|
|
|
|
{
|
|
|
|
|
const TString80 codart(row.get(ss.cid2index(FR_CODART)));
|
|
|
|
|
const TRectype & rec = cache().get(LF_ANAMAG, codart);
|
|
|
|
|
const bool check_art = rec.get_bool(ANAMAG_LIVPERART);
|
|
|
|
|
|
|
|
|
|
if (check_art)
|
|
|
|
|
{
|
|
|
|
|
TLocalisamfile fl(LF_MULTIREL);
|
|
|
|
|
TRectype & r = fl.curr();
|
|
|
|
|
|
|
|
|
|
r.put(MULTI_COD, "ARTLV");
|
|
|
|
|
r.put(MULTI_FIRST, codart);
|
|
|
|
|
r.put(MULTI_SECOND, livello);
|
|
|
|
|
|
|
|
|
|
TRectype new_rec(r);
|
|
|
|
|
if (fl.read() != NOERR)
|
|
|
|
|
{
|
|
|
|
|
ok = yesno_box("Il codice di giacenza %s non e' legato all' articolo. Devo legarlo", (const char *)livello);
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
r = new_rec;
|
|
|
|
|
const int err = new_rec.write(fl);
|
|
|
|
|
if (err != NOERR)
|
|
|
|
|
return error_box("Non sono riuscito a legare il codice di giacenza. Errore %d", err);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2008-03-26 16:43:54 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
2007-02-01 15:19:17 +00:00
|
|
|
|
}
|
2007-02-06 11:38:26 +00:00
|
|
|
|
return true;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Funzione che dato il profilo di riga ottiene la maschera
|
|
|
|
|
// Serve per ottenere una maschera diversa per ogni riga
|
|
|
|
|
TMask* TDocumento_mask::ss_getmask(int numriga, TMask& fullmask)
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TSheet_field* sf = fullmask.get_sheet();
|
|
|
|
|
TDocumento_mask& m = (TDocumento_mask&)sf->mask();
|
|
|
|
|
const TDocumento& doc = m.doc();
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (numriga < doc.physical_rows())
|
|
|
|
|
return m.riga_mask(numriga);
|
|
|
|
|
else
|
|
|
|
|
return &fullmask;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::occas_code_handler(TMask_field& f, KEY key)
|
|
|
|
|
{
|
2008-03-26 12:38:22 +00:00
|
|
|
|
TMask& m = f.mask();
|
|
|
|
|
if (key == K_TAB && (f.dirty() || !m.is_running()))
|
|
|
|
|
{
|
|
|
|
|
const TString& code = f.get();
|
|
|
|
|
if (code.full())
|
|
|
|
|
{
|
|
|
|
|
TRelation occas(LF_OCCAS);
|
|
|
|
|
occas.curr().put(OCC_CFPI, code);
|
|
|
|
|
if (occas.read(_isequal) == NOERR)
|
|
|
|
|
{
|
|
|
|
|
m.autoload(occas);
|
|
|
|
|
m.send_key(K_TAB, O_COMUNE); // Forza decodifica comuni
|
|
|
|
|
m.send_key(K_TAB, O_COMUNENAS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::occas_cfpi_handler(TMask_field& f, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_ENTER)
|
|
|
|
|
{
|
|
|
|
|
const TMask& om = f.mask();
|
|
|
|
|
if (om.field(O_COFI).empty() && om.field(O_PAIV).empty())
|
|
|
|
|
return f.error_box(TR("E' necessario specificare il codice fiscale o la partita IVA"));
|
|
|
|
|
}
|
|
|
|
|
return true;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::occas_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TDocumento_mask & m = (TDocumento_mask &)f.mask();
|
|
|
|
|
if ( key == K_SPACE && m.is_running( ) )
|
|
|
|
|
{
|
|
|
|
|
TDocumento& doc = m.doc();
|
|
|
|
|
TOccasionale& occ = doc.occas();
|
2008-03-26 12:38:22 +00:00
|
|
|
|
|
|
|
|
|
TMask occas_mask("ve0100o");
|
|
|
|
|
occas_mask.set_handler(O_CODICE, occas_code_handler );
|
2008-03-26 16:43:54 +00:00
|
|
|
|
occas_mask.set_handler(O_COFI, occas_cfpi_handler );
|
|
|
|
|
occas_mask.set_handler(O_PAIV, occas_cfpi_handler );
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
2007-09-18 14:25:15 +00:00
|
|
|
|
for (int i = occas_mask.fields() - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
TMask_field & f = occas_mask.fld(i);
|
|
|
|
|
const TFieldref * c = f.field();
|
|
|
|
|
if (c)
|
|
|
|
|
f.set(c->read(occ));
|
|
|
|
|
}
|
|
|
|
|
if (occas_mask.run() != K_ESC)
|
|
|
|
|
{
|
|
|
|
|
const TString ocfpi(occas_mask.get(O_CODICE));
|
|
|
|
|
doc.put("OCFPI", ocfpi);
|
|
|
|
|
m.set(F_OCFPI, ocfpi);
|
|
|
|
|
|
|
|
|
|
for (int i = occas_mask.fields() - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
const TMask_field& f = occas_mask.fld(i);
|
|
|
|
|
const TFieldref* c = f.field();
|
|
|
|
|
if (c)
|
|
|
|
|
{
|
|
|
|
|
const char* val = f.get();
|
|
|
|
|
c->write(val, occ);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
m.occ2mask();
|
|
|
|
|
}
|
|
|
|
|
f.set_focus( );
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::clifo_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2006-05-18 22:03:16 +00:00
|
|
|
|
if (key != K_ENTER && f.to_check(key, true))
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
TDocumento_mask & m = (TDocumento_mask &) f.mask();
|
|
|
|
|
TDocumento & d = m.doc();
|
|
|
|
|
|
|
|
|
|
TTipo_documento& tdoc = (TTipo_documento&) d.tipo();
|
|
|
|
|
d.put(DOC_TIPOCF, tdoc.tipocf());
|
|
|
|
|
d.put(DOC_CODCF, f.get());
|
|
|
|
|
|
|
|
|
|
TCli_for & cli_for = d.clifor();
|
|
|
|
|
cli_for.put(CLI_CODCF, ""); // force reload
|
|
|
|
|
|
|
|
|
|
if ( cli_for.get_bool(CLI_SOSPESO) )
|
|
|
|
|
return f.error_box( "Il codice '%ld' e' sospeso e non puo' essere utilizzato", atol(f.get()));
|
2006-05-18 22:03:16 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
m.cli2mask();
|
2006-05-18 22:03:16 +00:00
|
|
|
|
|
2007-03-30 13:51:17 +00:00
|
|
|
|
if (m.id2pos(F_CODCONT) >= 0)
|
|
|
|
|
{
|
|
|
|
|
const short id = m.field(F_CODCONT).active() ? F_CODCONT : F_CODCONT1;
|
|
|
|
|
TEdit_field & e = m.efield(id);
|
|
|
|
|
|
|
|
|
|
if (e.active())
|
|
|
|
|
{
|
|
|
|
|
e.set_dirty();
|
|
|
|
|
e.on_hit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-26 12:38:22 +00:00
|
|
|
|
if (cli_for.occasionale())
|
|
|
|
|
{
|
|
|
|
|
const TOccasionale& occas = d.occas();
|
|
|
|
|
if(m.id2pos(F_OCCASEDIT) > 0 && f.to_check(key) && occas.codice().blank())
|
|
|
|
|
m.send_key( K_SPACE, F_OCCASEDIT ); // Lancia maschera occasionali
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
d.zero(DOC_OCFPI);
|
|
|
|
|
}
|
2007-03-30 13:51:17 +00:00
|
|
|
|
return true;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-04-20 00:06:09 +00:00
|
|
|
|
void TDocumento_mask::highlight_row(int row, COLOR back, COLOR fore, bool dirty, bool update)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
TRiga_documento& rigadoc = doc()[row + 1];
|
2009-02-27 12:32:19 +00:00
|
|
|
|
TSheet_field& sf = sfield(F_SHEET);
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
|
2009-04-20 00:06:09 +00:00
|
|
|
|
// COLOR back = COLOR_INVALID, fore = COLOR_INVALID;
|
2009-02-27 12:32:19 +00:00
|
|
|
|
|
2009-03-17 11:05:49 +00:00
|
|
|
|
FOR_EACH_ARRAY_ITEM_BACK(color_rules(), rule, o)
|
2009-02-27 12:32:19 +00:00
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
TColor_rule& expr = *(TColor_rule*)o;
|
|
|
|
|
bool on = false;
|
|
|
|
|
if (rule == 0)
|
|
|
|
|
on = rigadoc.linked(); // Regola standard
|
|
|
|
|
else
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
expr.set_row(&rigadoc);
|
|
|
|
|
// SET VARS
|
|
|
|
|
const int vars = expr.numvar();
|
|
|
|
|
TString name;
|
|
|
|
|
for (int i = 0; i < vars; i++)
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
name = expr.varname(i);
|
|
|
|
|
if (name.starts_with("DIRTY"))
|
|
|
|
|
expr.setvar(i, dirty ? UNO : ZERO);
|
|
|
|
|
else
|
|
|
|
|
if (name.starts_with("#"))
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
const short id = atoi(name.mid(1));
|
|
|
|
|
if (id > 0)
|
|
|
|
|
{
|
|
|
|
|
TToken_string& sheet_row = sf.row(row);
|
|
|
|
|
expr.setvar(i, sheet_row.get(sf.cid2index(id)));
|
|
|
|
|
}
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
else
|
2009-03-17 11:05:49 +00:00
|
|
|
|
expr.setvar(i, get(-id));
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
}
|
2009-03-17 11:05:49 +00:00
|
|
|
|
else
|
|
|
|
|
if (name.starts_with("33.") || name.starts_with("DOC."))
|
|
|
|
|
{
|
|
|
|
|
const TString& fldname = name.after('.');
|
|
|
|
|
expr.setvar(i, doc().get(fldname));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const TString& fldname = name.find('.') > 0 ? name.after('.') : name;
|
|
|
|
|
expr.setvar(i, rigadoc.get(fldname));
|
|
|
|
|
}
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
}
|
2009-03-17 11:05:49 +00:00
|
|
|
|
on = expr.as_bool();
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
}
|
2009-03-17 11:05:49 +00:00
|
|
|
|
if (on)
|
|
|
|
|
{
|
|
|
|
|
expr.colors(back, fore);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
2009-02-27 12:32:19 +00:00
|
|
|
|
|
|
|
|
|
sf.set_back_and_fore_color(back, fore, row);
|
|
|
|
|
if (update)
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
sf.force_update(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TDocumento_mask::highlight()
|
|
|
|
|
{
|
2009-02-27 12:32:19 +00:00
|
|
|
|
TSheet_field& sf = sfield(F_SHEET);
|
|
|
|
|
FOR_EACH_SHEET_ROW(sf, i, r)
|
2009-04-21 21:23:10 +00:00
|
|
|
|
highlight_row(i, COLOR_INVALID, COLOR_INVALID, false, false);
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
sf.force_update();
|
2002-07-02 16:21:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-20 16:15:03 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TLista_elaborazioni
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
class TLista_elaborazioni : public TObject // velib04
|
|
|
|
|
{
|
|
|
|
|
TAssoc_array * _elab;
|
|
|
|
|
|
2005-05-06 10:58:49 +00:00
|
|
|
|
protected:
|
2005-08-23 08:54:32 +00:00
|
|
|
|
void read();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TElaborazione & operator [](const char * key) const;
|
|
|
|
|
int select(TString_array & result, const char * tipo_iniziale = NULL, const char * stato_iniziale = NULL, const char * tipo_finale = NULL, const char * stato_finale = NULL);
|
|
|
|
|
void update();
|
|
|
|
|
TLista_elaborazioni() : _elab(NULL) {}
|
|
|
|
|
virtual ~TLista_elaborazioni();
|
2005-05-06 10:58:49 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-12-20 16:15:03 +00:00
|
|
|
|
void TLista_elaborazioni::read()
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
if (_elab == NULL)
|
|
|
|
|
{
|
|
|
|
|
_elab = new TAssoc_array();
|
|
|
|
|
|
|
|
|
|
TTable eld("%ELD");
|
|
|
|
|
|
|
|
|
|
for (int err = eld.first(); err == NOERR; err = eld.next())
|
|
|
|
|
{
|
|
|
|
|
TElaborazione * el = NULL;
|
|
|
|
|
switch (eld.curr().get_int("I0"))
|
|
|
|
|
{
|
|
|
|
|
case _esterna :
|
|
|
|
|
el = new TElaborazione_esterna(eld.curr());
|
|
|
|
|
break;
|
|
|
|
|
case _consegna_ordini:
|
|
|
|
|
el = new TConsegna_ordini(eld.curr());
|
|
|
|
|
break;
|
|
|
|
|
case _fatturazione_bolle :
|
|
|
|
|
el = new TFatturazione_bolle(eld.curr());
|
|
|
|
|
break;
|
|
|
|
|
case _contabilizzazione :
|
|
|
|
|
el = new TContabilizzazione(eld.curr());
|
|
|
|
|
break;
|
|
|
|
|
case _copia_documento :
|
|
|
|
|
el = new TCopia_documento(eld.curr());
|
|
|
|
|
break;
|
|
|
|
|
case _generazione_effetti :
|
|
|
|
|
el = new TGenerazione_effetti(eld.curr());
|
|
|
|
|
break;
|
|
|
|
|
case _consuntivazione_produzione :
|
|
|
|
|
el = new TConsuntivazione_produzione(eld.curr());
|
|
|
|
|
break;
|
|
|
|
|
case _contabilizzazione_analitica :
|
|
|
|
|
el = new TContabilizzazione_analitica(eld.curr());
|
|
|
|
|
break;
|
|
|
|
|
default :
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
_elab->add(el->codice(), el);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-12-20 16:15:03 +00:00
|
|
|
|
|
|
|
|
|
int TLista_elaborazioni::select(TString_array & result, const char * tipo_iniziale, const char * stato_iniziale, const char * tipo_finale, const char * stato_finale)
|
|
|
|
|
{
|
2007-09-18 14:25:15 +00:00
|
|
|
|
read();
|
|
|
|
|
_elab->restart();
|
|
|
|
|
result.destroy();
|
|
|
|
|
for (TElaborazione * el = (TElaborazione *)_elab->get(); el ; el = (TElaborazione *) _elab->get())
|
|
|
|
|
{
|
2008-03-26 12:38:22 +00:00
|
|
|
|
bool ok = false;
|
2007-09-18 14:25:15 +00:00
|
|
|
|
TString ti;
|
|
|
|
|
if ((tipo_iniziale && *tipo_iniziale) && (stato_iniziale && *stato_iniziale))
|
|
|
|
|
for (int i = 0; !ok && i < TElaborazione::_max_tipi_doc_elab; i++)
|
|
|
|
|
{
|
|
|
|
|
ti = el->tipo_iniziale(i);
|
|
|
|
|
const char si = el->stato_iniziale(i);
|
|
|
|
|
ok |= ti == tipo_iniziale &&
|
|
|
|
|
si == *stato_iniziale;
|
|
|
|
|
}
|
|
|
|
|
else
|
2008-03-26 12:38:22 +00:00
|
|
|
|
ok = true;
|
2007-09-18 14:25:15 +00:00
|
|
|
|
if ((tipo_finale && *tipo_finale) && (stato_finale && *stato_finale))
|
|
|
|
|
ok &= el->tipo_finale() == tipo_finale &&
|
|
|
|
|
el->stato_finale() == stato_finale;
|
|
|
|
|
if (ok)
|
|
|
|
|
result.add(el->codice());
|
|
|
|
|
}
|
|
|
|
|
return result.items();
|
2002-12-20 16:15:03 +00:00
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
2002-12-20 16:15:03 +00:00
|
|
|
|
TElaborazione & TLista_elaborazioni::operator [](const char * key) const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
((TLista_elaborazioni *)this)->read();
|
|
|
|
|
return (TElaborazione &) (*_elab)[key];
|
2002-12-20 16:15:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TLista_elaborazioni::update()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
delete _elab; _elab = NULL;
|
|
|
|
|
read();
|
|
|
|
|
}
|
2002-12-20 16:15:03 +00:00
|
|
|
|
|
|
|
|
|
TLista_elaborazioni::~TLista_elaborazioni()
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
if (_elab)
|
|
|
|
|
delete _elab;
|
|
|
|
|
}
|
2002-12-20 16:15:03 +00:00
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TDocument_tree
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TDocument_tree : public TBidirectional_tree
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TRelation* _relation;
|
|
|
|
|
TCursor* _cursor;
|
|
|
|
|
TToken_string _curnode;
|
2005-05-25 11:32:58 +00:00
|
|
|
|
bool _multiple_selection;
|
|
|
|
|
TAssoc_array _selected_docs;
|
|
|
|
|
TString _selected;
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void node2id(const TObject* node, TString& id) const;
|
|
|
|
|
bool on_head() const;
|
|
|
|
|
bool on_row() const;
|
|
|
|
|
|
|
|
|
|
void format_field(const TRectype& rec, const TString& field, TString& str) const;
|
|
|
|
|
void append_custom_fields(const TTipo_documento& tipo, const TRectype& rec, TString& str) const;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
public:
|
2005-05-25 11:32:58 +00:00
|
|
|
|
void multiple_selection(bool on);
|
|
|
|
|
bool multiple_selection() const { return _multiple_selection;}
|
|
|
|
|
bool node_selected(const TObject* node = NULL) const;
|
|
|
|
|
void select_node(const TObject* node = NULL, bool on = true);
|
|
|
|
|
real select_doc(long numdoc);
|
|
|
|
|
void build_doc_list(TLista_documenti & docs);
|
|
|
|
|
void unselect_node(const TObject* node) { select_node(node, false);}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
virtual bool goto_root();
|
|
|
|
|
virtual bool goto_firstson();
|
|
|
|
|
virtual bool goto_rbrother();
|
|
|
|
|
virtual bool goto_node(const TString &id);
|
|
|
|
|
virtual bool has_son() const;
|
|
|
|
|
virtual bool has_rbrother() const;
|
|
|
|
|
virtual bool has_father() const;
|
|
|
|
|
virtual bool has_lbrother() const;
|
|
|
|
|
virtual bool goto_father();
|
|
|
|
|
virtual bool goto_lbrother();
|
|
|
|
|
virtual TObject* curr_node() const { return &(TToken_string&)_curnode; }
|
|
|
|
|
virtual bool get_description(TString& str) const;
|
|
|
|
|
virtual TImage* image(bool selected) const;
|
2005-05-25 11:32:58 +00:00
|
|
|
|
|
|
|
|
|
void select(TString & id) { _selected = id;}
|
|
|
|
|
const TString & selected() const { return _selected;}
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const TRectype& testata() const;
|
|
|
|
|
const TRectype& riga() const;
|
|
|
|
|
const TRectype& record() const;
|
2005-05-25 11:32:58 +00:00
|
|
|
|
const real totale_doc() const { TDocumento d(testata()); return d.totale_doc();}
|
2002-05-31 10:35:40 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
void set_cursor(char tipocf, long codcf, int anno, const char* filter, FILTERFUNCTION ff = NULL);
|
|
|
|
|
TCursor* get_cursor() { return _cursor; }
|
2002-05-31 10:35:40 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TDocument_tree();
|
|
|
|
|
~TDocument_tree();
|
2002-05-31 10:35:40 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const TRectype& TDocument_tree::testata() const
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
TDocument_tree& me = (TDocument_tree&)*this;
|
|
|
|
|
const TRecnotype pos = me._curnode.get_long(0);
|
|
|
|
|
if (_cursor->pos() != pos || _relation->curr(LF_RIGHEDOC).empty())
|
|
|
|
|
*me._cursor = pos;
|
|
|
|
|
return _relation->curr();
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TRectype& TDocument_tree::riga() const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TDocument_tree& me = (TDocument_tree&)*this;
|
|
|
|
|
const TRectype& rec = _relation->curr(LF_RIGHEDOC);
|
|
|
|
|
const TRecnotype pos = me._curnode.get_long(0);
|
|
|
|
|
const int nriga = me._curnode.get_int(1);
|
|
|
|
|
if (_cursor->pos() != pos || rec.get_int(RDOC_NRIGA) > nriga)
|
|
|
|
|
*me._cursor = pos;
|
|
|
|
|
for (int i = rec.get_int(RDOC_NRIGA); i < nriga; i++)
|
|
|
|
|
_relation->next_match(LF_RIGHEDOC);
|
|
|
|
|
return rec;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TRectype& TDocument_tree::record() const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
return on_row() ? riga() : testata();
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TDocument_tree::node2id(const TObject* node, TString& id) const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
id = *(TString*)node;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::on_head() const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TDocument_tree& me = (TDocument_tree&)*this;
|
|
|
|
|
return me._curnode.get_int(1) == 0;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::on_row() const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TDocument_tree& me = (TDocument_tree&)*this;
|
|
|
|
|
return me._curnode.get_int(1) > 0;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-05-25 11:32:58 +00:00
|
|
|
|
void TDocument_tree::multiple_selection(bool on)
|
|
|
|
|
{
|
|
|
|
|
_multiple_selection = on;
|
|
|
|
|
if (!_multiple_selection)
|
|
|
|
|
_selected_docs.destroy();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::node_selected(const TObject* node) const
|
|
|
|
|
{
|
|
|
|
|
TToken_string id;
|
|
|
|
|
|
|
|
|
|
if (node == NULL)
|
|
|
|
|
node = curr_node();
|
|
|
|
|
|
|
|
|
|
node2id(node, id);
|
|
|
|
|
id = id.get(0);
|
|
|
|
|
return _selected_docs.is_key(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TDocument_tree::select_node(const TObject* node, bool on)
|
|
|
|
|
{
|
|
|
|
|
TToken_string id;
|
|
|
|
|
|
|
|
|
|
if (node == NULL)
|
|
|
|
|
node = curr_node();
|
|
|
|
|
|
|
|
|
|
node2id(node, id);
|
|
|
|
|
id = id.get(0);
|
|
|
|
|
if (on)
|
|
|
|
|
_selected_docs.add(id);
|
|
|
|
|
else
|
|
|
|
|
_selected_docs.remove(id);
|
|
|
|
|
select(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool find_doc(TTree& tree, void* jolly, word flags)
|
|
|
|
|
{
|
|
|
|
|
TDocument_tree & t = (TDocument_tree &) tree;
|
|
|
|
|
if (!t.node_selected())
|
|
|
|
|
{
|
|
|
|
|
t.select_node();
|
|
|
|
|
real & val = *((real *) jolly);
|
|
|
|
|
val = t.totale_doc();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
real TDocument_tree::select_doc(long numdoc)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
real val;
|
|
|
|
|
if (goto_root())
|
|
|
|
|
scan_depth_first(find_doc, (void *) &val, SCAN_PRE_ORDER | SCAN_IGNORING_LEAVES);
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool add_to_list(TTree& tree, void* jolly, word flags)
|
|
|
|
|
{
|
|
|
|
|
TDocument_tree & t = (TDocument_tree &) tree;
|
|
|
|
|
if (t.node_selected())
|
|
|
|
|
{
|
|
|
|
|
TLista_documenti & docs = *((TLista_documenti *) jolly);
|
|
|
|
|
|
|
|
|
|
docs.add(new TDocumento(t.testata()));
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TDocument_tree::build_doc_list(TLista_documenti & docs)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
if (goto_root())
|
|
|
|
|
scan_depth_first(add_to_list, (void *) &docs, SCAN_PRE_ORDER | SCAN_IGNORING_LEAVES);
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
bool TDocument_tree::goto_root()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const bool ok = _cursor != NULL && _cursor->items()>0;
|
|
|
|
|
_curnode = ok ? "0" : "";
|
|
|
|
|
*_cursor = 0;
|
|
|
|
|
return ok;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::goto_firstson()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
bool ok = has_son();
|
|
|
|
|
if (ok)
|
|
|
|
|
_curnode.add(1,1);
|
|
|
|
|
return ok;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::goto_rbrother()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
bool ok = has_rbrother();
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
if (on_head())
|
|
|
|
|
{
|
|
|
|
|
const long pos = _curnode.get_long(0);
|
|
|
|
|
_curnode.add(pos+1, 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const int nriga = _curnode.get_int(1);
|
|
|
|
|
_curnode.add(nriga+1, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::goto_node(const TString &id)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
_curnode = id;
|
|
|
|
|
return TRUE;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::has_son() const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
bool ok = on_head();
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
testata();
|
|
|
|
|
const TRectype& rec = _relation->curr(LF_RIGHEDOC);
|
|
|
|
|
ok = rec.get_int(RDOC_NRIGA) > 0;
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::has_rbrother() const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
bool ok = FALSE;
|
|
|
|
|
if (on_head())
|
|
|
|
|
{
|
|
|
|
|
TDocument_tree& me = (TDocument_tree&)*this;
|
|
|
|
|
const long pos = me._curnode.get_long(0);
|
|
|
|
|
ok = pos < _cursor->items()-1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
riga(); // Posizionati sulla riga corrente
|
|
|
|
|
ok = _relation->next_match(LF_RIGHEDOC);
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::has_father() const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
return on_row();
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::has_lbrother() const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
bool ok = FALSE;
|
|
|
|
|
TDocument_tree& me = (TDocument_tree&)*this;
|
|
|
|
|
if (on_head())
|
|
|
|
|
{
|
|
|
|
|
const long pos = me._curnode.get_long(0);
|
|
|
|
|
ok = pos > 0L;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const int nriga = me._curnode.get_int(1);
|
|
|
|
|
ok = nriga > 1;
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::goto_father()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
bool ok = on_row();
|
|
|
|
|
if (ok)
|
|
|
|
|
_curnode.add(0, 1);
|
|
|
|
|
return ok;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocument_tree::goto_lbrother()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
bool ok = has_lbrother();
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
if (on_head())
|
|
|
|
|
{
|
|
|
|
|
const long pos = _curnode.get_long(0);
|
|
|
|
|
_curnode.add(pos-1, 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const int nriga = _curnode.get_int(1);
|
|
|
|
|
_curnode.add(nriga-1, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-02 16:21:23 +00:00
|
|
|
|
void TDocument_tree::format_field(const TRectype& rec, const TString& field, TString& str) const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const TFieldref fld(field, rec.num());
|
|
|
|
|
const TString& value = fld.read(rec);
|
|
|
|
|
const TFieldtypes ft = rec.type(fld.name());
|
|
|
|
|
if (ft == _realfld)
|
|
|
|
|
{
|
|
|
|
|
const int len = rec.length(fld.name());
|
|
|
|
|
const int ndec = rec.ndec(fld.name());
|
|
|
|
|
TString8 pic; pic.format(".%d", ndec);
|
|
|
|
|
const real r(value);
|
|
|
|
|
str = r.string(pic);
|
|
|
|
|
str.right_just(len);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
str = value;
|
2002-07-02 16:21:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TDocument_tree::append_custom_fields(const TTipo_documento& tipo, const TRectype& rec, TString& str) const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const TString& format = rec.num() == LF_DOC ? tipo.stringa_descrizione_documento()
|
|
|
|
|
: tipo.stringa_descrizione_riga();
|
|
|
|
|
if (format.not_empty())
|
|
|
|
|
{
|
|
|
|
|
str << ' ';
|
|
|
|
|
int ch = -1;
|
|
|
|
|
TString tmp;
|
|
|
|
|
for (int ap = format.find('{'); ap >= 0; ap = format.find('{', ch+1))
|
|
|
|
|
{
|
|
|
|
|
str << format.sub(ch+1, ap);
|
|
|
|
|
ch = format.find('}', ap);
|
|
|
|
|
const TString16 field = format.sub(ap+1, ch);
|
|
|
|
|
if (!field.blank())
|
|
|
|
|
{
|
|
|
|
|
format_field(rec, field, tmp);
|
|
|
|
|
str << tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
str << format.mid(ch+1);
|
|
|
|
|
}
|
2002-07-02 16:21:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TImage* TDocument_tree::image(bool selected) const
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
if (on_row())
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec = riga();
|
|
|
|
|
if (rec.get_bool(RDOC_RIGAEVASA))
|
2008-11-13 11:17:05 +00:00
|
|
|
|
return get_res_icon(10203);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
2005-05-25 11:32:58 +00:00
|
|
|
|
else
|
2008-01-17 11:12:05 +00:00
|
|
|
|
{
|
2005-05-25 11:32:58 +00:00
|
|
|
|
if (multiple_selection())
|
|
|
|
|
{
|
|
|
|
|
const bool sel = node_selected();
|
|
|
|
|
if (sel)
|
|
|
|
|
{
|
|
|
|
|
if (selected)
|
|
|
|
|
return get_res_image(BMP_DIRDNSEL);
|
|
|
|
|
else
|
|
|
|
|
return get_res_image(BMP_DIRSEL);
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-01-17 11:12:05 +00:00
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
return TTree::image(selected);
|
2002-07-02 16:21:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
bool TDocument_tree::get_description(TString& str) const
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (on_head())
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec = testata();
|
|
|
|
|
str = rec.get(DOC_ANNO);
|
|
|
|
|
str << ' ' << rec.get(DOC_CODNUM);
|
|
|
|
|
TString16 tmp;
|
|
|
|
|
tmp.format("%6ld", rec.get_long(DOC_NDOC));
|
|
|
|
|
str << ' ' << tmp << ' ' << rec.get(DOC_DATADOC);
|
|
|
|
|
const char tipocf = rec.get_char(DOC_TIPOCF);
|
|
|
|
|
const long codcf = rec.get_long(DOC_CODCF);
|
|
|
|
|
tmp.format(" %c%6ld ", tipocf, codcf);
|
|
|
|
|
str << tmp;
|
|
|
|
|
tmp.format("%c|%6ld", tipocf, codcf);
|
|
|
|
|
str << cache().get(LF_CLIFO, tmp, CLI_RAGSOC);
|
|
|
|
|
str.left_just(63);
|
|
|
|
|
|
|
|
|
|
const TString& tipodoc = rec.get(DOC_TIPODOC);
|
2008-10-07 00:50:22 +00:00
|
|
|
|
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
append_custom_fields(tipo, rec, str);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec = riga();
|
|
|
|
|
const TRectype& testata = _relation->curr();
|
|
|
|
|
|
|
|
|
|
const TString80 codart = rec.get(RDOC_CODART);
|
|
|
|
|
str = codart;
|
|
|
|
|
str.left_just(21);
|
|
|
|
|
str << rec.get(RDOC_DESCR).left(30);
|
|
|
|
|
str.left_just(52);
|
|
|
|
|
|
|
|
|
|
const TString& tipodoc = testata.get(DOC_TIPODOC);
|
2008-10-07 00:50:22 +00:00
|
|
|
|
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (codart.not_empty())
|
|
|
|
|
{
|
|
|
|
|
const real qta = rec.get_real(tipo.field_qta());
|
|
|
|
|
str << qta.string("###.###.##@,@@@");
|
|
|
|
|
|
|
|
|
|
if (tipo.is_ordine())
|
|
|
|
|
{
|
|
|
|
|
const real qta_evasa = rec.get_real(tipo.field_qtaevasa());
|
|
|
|
|
const real residuo = qta_evasa < qta ? (qta-qta_evasa) : ZERO;
|
|
|
|
|
str << residuo.string("###.###.##@,@@@");
|
|
|
|
|
}
|
|
|
|
|
append_custom_fields(tipo, rec, str);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TDocument_tree::set_cursor(char tipocf, long codcf, int anno, const char* filter, FILTERFUNCTION ff)
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (_relation == NULL)
|
|
|
|
|
{
|
|
|
|
|
_relation = new TRelation(LF_DOC);
|
|
|
|
|
_relation->add(LF_RIGHEDOC, "PROVV==PROVV|ANNO==ANNO|CODNUM==CODNUM|NDOC==NDOC");
|
|
|
|
|
}
|
|
|
|
|
if (_cursor == NULL)
|
|
|
|
|
{
|
|
|
|
|
_cursor = new TCursor(_relation, "", 2);
|
|
|
|
|
}
|
|
|
|
|
TRectype& rec = _relation->curr();
|
|
|
|
|
rec.zero();
|
|
|
|
|
rec.put(DOC_TIPOCF, tipocf);
|
|
|
|
|
rec.put(DOC_CODCF, codcf);
|
|
|
|
|
rec.put(DOC_PROVV, "D");
|
|
|
|
|
rec.put(DOC_ANNO, anno);
|
2008-03-26 12:38:22 +00:00
|
|
|
|
_cursor->freeze(false);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
_cursor->setfilter(""); // Force cursor rebuild
|
|
|
|
|
_cursor->setfilter(filter);
|
|
|
|
|
_cursor->setregion(rec, rec);
|
|
|
|
|
const long items = _cursor->items();
|
2008-03-26 12:38:22 +00:00
|
|
|
|
_cursor->freeze(true);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
goto_root();
|
|
|
|
|
if (items <= 3)
|
|
|
|
|
expand_all();
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TDocument_tree::TDocument_tree()
|
2005-08-23 08:54:32 +00:00
|
|
|
|
: _relation(NULL), _cursor(NULL), _multiple_selection(false)
|
2005-05-25 11:32:58 +00:00
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TDocument_tree::~TDocument_tree()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (_cursor)
|
|
|
|
|
delete _cursor;
|
|
|
|
|
if (_relation)
|
|
|
|
|
delete _relation;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TElabora_mask
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
class TElabora_mask : public TAutomask
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
TDocumento_mask* _main;
|
|
|
|
|
TLista_elaborazioni _elab;
|
|
|
|
|
TDocument_tree _tree;
|
2005-05-25 11:32:58 +00:00
|
|
|
|
int _check_fld;
|
2003-02-25 14:39:02 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TElaborazione* _last_elab;
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
// @access Protected Member
|
2005-08-23 08:54:32 +00:00
|
|
|
|
protected:
|
|
|
|
|
TString _art_filter, _liv_filter;
|
|
|
|
|
static TElabora_mask* _myself;
|
|
|
|
|
static bool article_filter(const TRelation* rel);
|
|
|
|
|
|
|
|
|
|
void add_valuta_filter(TString& filter) const;
|
|
|
|
|
|
|
|
|
|
void docrif_search();
|
|
|
|
|
int update_list();
|
|
|
|
|
void update_ndoc_filter(bool is_tipo_elaborazione = FALSE);
|
|
|
|
|
|
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
// @access Public Member
|
2005-08-23 08:54:32 +00:00
|
|
|
|
public:
|
|
|
|
|
bool elabora();
|
|
|
|
|
TElaborazione* curr_elab();
|
|
|
|
|
|
|
|
|
|
// @cmember Costruttore (crea la maschera leggendo la descrizione dal file .msk)
|
|
|
|
|
TElabora_mask(TDocumento_mask& main_mask);
|
|
|
|
|
// @cmember Distruttore
|
|
|
|
|
virtual ~TElabora_mask() {}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
TElabora_mask* TElabora_mask::_myself = NULL;
|
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
switch (o.dlg())
|
|
|
|
|
{
|
|
|
|
|
case F_CODART:
|
|
|
|
|
case F_CODNUM_ELAB:
|
|
|
|
|
if (e == fe_modify)
|
|
|
|
|
update_ndoc_filter();
|
|
|
|
|
break;
|
|
|
|
|
case F_TYPE:
|
|
|
|
|
if (e == fe_init || e == fe_modify)
|
|
|
|
|
{
|
|
|
|
|
int ne = update_list();
|
|
|
|
|
if (e == fe_init && ne == 0) // Riprova a cambiare flag e ricostruire la lista
|
|
|
|
|
{
|
|
|
|
|
set(F_TYPE, "X");
|
|
|
|
|
ne = update_list();
|
|
|
|
|
if (ne == 0)
|
|
|
|
|
set(F_TYPE, "");
|
|
|
|
|
}
|
|
|
|
|
update_ndoc_filter(TRUE);
|
2005-05-25 11:32:58 +00:00
|
|
|
|
const bool add_to_doc = o.get().not_empty();
|
2006-04-13 17:56:02 +00:00
|
|
|
|
TElaborazione * e = curr_elab();
|
|
|
|
|
const bool external = e != NULL && e->tipo() == _esterna;
|
|
|
|
|
const bool is_search = o.get().empty() || field(F_CODCF_ELAB).empty() || external;
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
o.mask().field(F_NDOC_ELAB).check_type(is_search ? CHECK_SEARCH : CHECK_NORMAL);
|
2005-05-25 11:32:58 +00:00
|
|
|
|
_tree.multiple_selection(add_to_doc);
|
|
|
|
|
bool check_tot = false;
|
|
|
|
|
if (add_to_doc)
|
|
|
|
|
{
|
|
|
|
|
if (_check_fld < -1)
|
|
|
|
|
{
|
|
|
|
|
_check_fld = -1;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const TString_array& handlers = _main->doc().tipo().handlers();
|
2005-05-25 11:32:58 +00:00
|
|
|
|
const int items = handlers.items();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
2005-05-25 11:32:58 +00:00
|
|
|
|
for (int i = 0; i < items; i ++ )
|
|
|
|
|
{
|
|
|
|
|
TToken_string& riga = (TToken_string&) handlers[i];
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
2005-05-25 11:32:58 +00:00
|
|
|
|
if (riga.get_int(1) == 2)
|
|
|
|
|
_check_fld = riga.get_int(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
check_tot = _check_fld >= 0;
|
|
|
|
|
}
|
|
|
|
|
if (!add_to_doc)
|
|
|
|
|
o.mask().set(F_TOTSEL, "");
|
|
|
|
|
o.mask().show(-GRP_CHK, check_tot);
|
|
|
|
|
if (check_tot)
|
|
|
|
|
o.mask().set(F_TOTVAL, _main->get(_check_fld));
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_STATODOC_ELAB:
|
|
|
|
|
case F_TIPODOC_ELAB:
|
|
|
|
|
if (e == fe_modify)
|
|
|
|
|
{
|
|
|
|
|
update_list();
|
|
|
|
|
update_ndoc_filter();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_ELAB:
|
|
|
|
|
if (e == fe_modify)
|
|
|
|
|
update_ndoc_filter(TRUE);
|
|
|
|
|
break;
|
|
|
|
|
case F_ANNO_ELAB:
|
|
|
|
|
if (e == fe_modify)
|
|
|
|
|
update_ndoc_filter();
|
|
|
|
|
break;
|
|
|
|
|
case F_NUMDOCRIF_ELAB:
|
|
|
|
|
if (e == fe_button)
|
|
|
|
|
docrif_search();
|
|
|
|
|
break;
|
2006-04-14 13:23:14 +00:00
|
|
|
|
case F_NDOC_ELAB:
|
2006-04-13 17:56:02 +00:00
|
|
|
|
if ((e == fe_modify || e == fe_close) && o.check_type() == CHECK_SEARCH && !o.empty())
|
|
|
|
|
{
|
|
|
|
|
TToken_string key;
|
|
|
|
|
key.add("D"); key.add(get(F_ANNO_ELAB));
|
|
|
|
|
key.add(get(F_CODNUM_ELAB)); key.add(o.get());
|
|
|
|
|
const TRectype& rec = cache().get(LF_DOC, key);
|
|
|
|
|
bool ok = !rec.empty(); // Verifica esistenza documento
|
|
|
|
|
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
TCursor* c = _tree.get_cursor();
|
|
|
|
|
c->curr() = rec;
|
|
|
|
|
ok = c->test(_isequal) == NOERR; // Verifica compatibilit<69> documento
|
|
|
|
|
}
|
|
|
|
|
if (!ok)
|
|
|
|
|
return error_box(((TEdit_field&)o).get_warning());
|
|
|
|
|
}
|
2006-04-18 16:26:03 +00:00
|
|
|
|
if (e == fe_init || e == fe_modify)
|
|
|
|
|
{
|
|
|
|
|
const long ndoc = atol(o.get());
|
|
|
|
|
|
|
|
|
|
if (ndoc > 0L)
|
|
|
|
|
{
|
|
|
|
|
real val = _tree.select_doc(ndoc);
|
|
|
|
|
if (val != ZERO)
|
|
|
|
|
{
|
|
|
|
|
val += o.mask().get_real(F_TOTSEL);
|
|
|
|
|
o.mask().set(F_TOTSEL, val);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
case F_ROWS:
|
2006-07-11 13:12:41 +00:00
|
|
|
|
if (e == fe_modify && is_running())
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
2005-05-25 11:32:58 +00:00
|
|
|
|
TString id;
|
|
|
|
|
|
|
|
|
|
_tree.curr_id(id);
|
|
|
|
|
_tree.select(id);
|
|
|
|
|
if (is_running() && !_tree.multiple_selection())
|
|
|
|
|
{
|
|
|
|
|
TCursor* c = _tree.get_cursor();
|
|
|
|
|
if (c != NULL && c->items() > 0)
|
|
|
|
|
{
|
|
|
|
|
const TRectype& head = _tree.testata();
|
|
|
|
|
set(F_DATADOC_ELAB, head.get(DOC_DATADOC)); // Anch'essa nella chiave 2!
|
|
|
|
|
set(F_ANNO_ELAB, head.get(DOC_ANNO));
|
|
|
|
|
set(F_CODNUM_ELAB, head.get(DOC_CODNUM), 2); // Check but not hit
|
|
|
|
|
set(F_NDOC_ELAB, head.get(DOC_NDOC));
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
2005-05-25 11:32:58 +00:00
|
|
|
|
else
|
2008-06-11 15:28:02 +00:00
|
|
|
|
if (e == fe_button)
|
2005-05-25 11:32:58 +00:00
|
|
|
|
{
|
|
|
|
|
if (_tree.multiple_selection())
|
|
|
|
|
{
|
|
|
|
|
const bool on = !_tree.node_selected();
|
|
|
|
|
_tree.select_node(NULL, on);
|
|
|
|
|
if (_check_fld >= 0)
|
|
|
|
|
{
|
|
|
|
|
real val = get_real(F_TOTSEL);
|
|
|
|
|
if (on)
|
|
|
|
|
val += _tree.totale_doc();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
val -= _tree.totale_doc();
|
|
|
|
|
if (_tree.testata().get_long(DOC_NDOC) == o.mask().get_long(F_NDOC_ELAB))
|
|
|
|
|
o.mask().set(F_NDOC_ELAB, "");
|
|
|
|
|
}
|
|
|
|
|
set(F_TOTSEL, val);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
break;
|
2005-05-25 11:32:58 +00:00
|
|
|
|
case DLG_LINK:
|
|
|
|
|
if (e == fe_button)
|
|
|
|
|
{
|
|
|
|
|
_tree.goto_node(_tree.selected());
|
|
|
|
|
const TRectype & rec = _tree.testata();
|
|
|
|
|
|
|
|
|
|
if (!rec.empty())
|
|
|
|
|
{
|
|
|
|
|
TFilename tempfile;
|
|
|
|
|
|
|
|
|
|
tempfile.temp("ve0");
|
|
|
|
|
tempfile.ext("ini");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
TConfig configfile(tempfile);
|
|
|
|
|
|
|
|
|
|
configfile.set("Action", "Modify", "Transaction");
|
|
|
|
|
configfile.set("NDOC", rec.get(DOC_NDOC), "33");
|
|
|
|
|
configfile.set(DOC_PROVV, rec.get(DOC_PROVV), "33");
|
|
|
|
|
configfile.set(DOC_ANNO, rec.get(DOC_ANNO), "33");
|
|
|
|
|
configfile.set(DOC_CODNUM, rec.get(DOC_CODNUM), "33");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TString commandline;
|
|
|
|
|
|
|
|
|
|
commandline.format("ve0 -0 /i%s",(const char*)tempfile);
|
|
|
|
|
|
|
|
|
|
TExternal_app ve(commandline);
|
|
|
|
|
ve.run();
|
|
|
|
|
|
|
|
|
|
remove_file(tempfile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-02 16:21:23 +00:00
|
|
|
|
int TElabora_mask::update_list()
|
1998-08-25 18:07:30 +00:00
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TString_array elabs;
|
|
|
|
|
const TString16 tipo(_main->get(F_TIPODOC));
|
|
|
|
|
const TString16 stato(_main->get(F_STATO));
|
|
|
|
|
const TString16 tipo_elab(get(F_TIPODOC_ELAB));
|
|
|
|
|
const TString16 stato_elab(get(F_STATODOC_ELAB));
|
|
|
|
|
const bool from_elab = !get_bool(F_TYPE);
|
|
|
|
|
int items = 0;
|
|
|
|
|
|
|
|
|
|
if (from_elab)
|
2005-11-09 16:31:19 +00:00
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
items = _elab.select(elabs, tipo, stato,"","") ;
|
2005-11-09 16:31:19 +00:00
|
|
|
|
field(F_ANNO_ELAB).check_type(CHECK_REQUIRED);
|
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
else
|
2005-11-09 16:31:19 +00:00
|
|
|
|
{
|
|
|
|
|
field(F_ANNO_ELAB).check_type(CHECK_NONE);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
items = _elab.select(elabs, tipo_elab, stato_elab, tipo, stato);
|
2005-11-09 16:31:19 +00:00
|
|
|
|
}
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
TList_field & f = (TList_field &) field(F_ELAB);
|
|
|
|
|
TToken_string codes;
|
|
|
|
|
TToken_string descrs;
|
|
|
|
|
for (int i = 0; i < items; i++)
|
|
|
|
|
{
|
|
|
|
|
const TElaborazione& e = _elab[elabs.row(i)];
|
|
|
|
|
|
|
|
|
|
if (!from_elab)
|
|
|
|
|
{
|
|
|
|
|
// AO20123: Impedire contabilizzazione all'indietro!
|
|
|
|
|
if (e.tipo() == _contabilizzazione || e.tipo() == _generazione_effetti)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
codes.add(e.codice());
|
|
|
|
|
descrs.add(e.descrizione());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
items = codes.items(); // Conta elementi veramente aggiunti
|
|
|
|
|
const bool ok = items > 0;
|
2009-03-23 12:21:45 +00:00
|
|
|
|
enable(DLG_OK, ok);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
enable(F_ELAB, ok);
|
|
|
|
|
|
|
|
|
|
if (codes != f.get_codes())
|
|
|
|
|
f.replace_items(codes, descrs);
|
|
|
|
|
const TElaborazione * e = curr_elab();
|
|
|
|
|
if (e != NULL && e->tipo() == _consegna_ordini)
|
|
|
|
|
show(-GRP_ART);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
reset(-GRP_ART);
|
|
|
|
|
hide(-GRP_ART);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return items;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TElabora_mask::elabora()
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
bool update_mask = FALSE;
|
|
|
|
|
|
|
|
|
|
TLista_documenti in;
|
|
|
|
|
TLista_documenti out;
|
|
|
|
|
TDocumento& app_doc = ((TDocumento_mask *)_main)->doc();
|
|
|
|
|
const long numdoc = field(F_NDOC_ELAB).active() ? get_long(F_NDOC_ELAB) : app_doc.get_long(DOC_NDOC);
|
|
|
|
|
const bool update_header = get_bool(F_UPDATE_HEADER);
|
|
|
|
|
const bool from_elab = !get_bool(F_TYPE);
|
|
|
|
|
TElaborazione * e = curr_elab();
|
|
|
|
|
|
|
|
|
|
if (e == NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (e->tipo() == _consegna_ordini)
|
|
|
|
|
{
|
|
|
|
|
TParametri_elaborazione& p = e->params();
|
|
|
|
|
p.set("ARTICOLO", get(F_CODART));
|
|
|
|
|
p.set("UM", get(F_UMQTA));
|
|
|
|
|
p.set("QUANTITA", get(F_QTA));
|
|
|
|
|
}
|
|
|
|
|
if (from_elab)
|
|
|
|
|
{
|
2005-11-09 16:31:19 +00:00
|
|
|
|
const char provv = get(F_PROVV_ELAB)[0];
|
|
|
|
|
const int anno = get_int(F_ANNO_ELAB);
|
2006-07-10 13:30:29 +00:00
|
|
|
|
const TString& codnum = get(F_CODNUM_ELAB);
|
|
|
|
|
const TString& tipo = get(F_TIPODOC_ELAB);
|
|
|
|
|
const TString& stato = get(F_STATODOC_ELAB);
|
2005-11-09 16:31:19 +00:00
|
|
|
|
|
2006-07-10 13:30:29 +00:00
|
|
|
|
if (anno <= 0 || codnum.blank() || tipo.blank() || stato.blank())
|
2005-11-09 16:31:19 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
2006-07-10 13:30:29 +00:00
|
|
|
|
TDocumento* newdoc = new TDocumento(provv, anno, codnum, numdoc);
|
2005-11-09 16:31:19 +00:00
|
|
|
|
TDocumento& d = *newdoc;
|
|
|
|
|
|
|
|
|
|
if (numdoc <= 0)
|
|
|
|
|
{
|
|
|
|
|
TDocumento::copy_data(d.head(), app_doc.head());
|
|
|
|
|
d.put(DOC_TIPODOC, tipo);
|
|
|
|
|
d.put(DOC_STATO, stato);
|
|
|
|
|
|
|
|
|
|
const TDate datadoc = d.get_date(DOC_DATADOC);
|
|
|
|
|
const TDate datainsc = d.get_date(DOC_DATAINSC);
|
|
|
|
|
const bool equal = !datainsc.ok() || datadoc == datainsc;
|
|
|
|
|
|
|
|
|
|
d.put(DOC_DATADOC, get(F_DATADOC_ELAB));
|
|
|
|
|
if (equal)
|
|
|
|
|
d.zero(DOC_DATAINSC);
|
|
|
|
|
|
|
|
|
|
const TTipo_documento & t = d.tipo();
|
|
|
|
|
|
|
|
|
|
if (t.mov_mag())
|
|
|
|
|
d.put(DOC_CAUSMAG, t.caus_mov());
|
|
|
|
|
else
|
|
|
|
|
d.zero(DOC_CAUSMAG);
|
|
|
|
|
}
|
2008-03-26 16:43:54 +00:00
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
in.add(app_doc);
|
|
|
|
|
out.add(d);
|
|
|
|
|
if (e->elabora(in, out, TDate(TODAY), TRUE))
|
|
|
|
|
{
|
|
|
|
|
if (out[0] != d)
|
|
|
|
|
out.rewrite();
|
|
|
|
|
if (app_doc != in[0])
|
|
|
|
|
{
|
|
|
|
|
in.rewrite();
|
|
|
|
|
app_doc = in[0];
|
|
|
|
|
update_mask = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-11-09 16:31:19 +00:00
|
|
|
|
delete newdoc;
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2005-05-25 11:32:58 +00:00
|
|
|
|
_tree.build_doc_list(in);
|
2008-07-23 16:01:39 +00:00
|
|
|
|
if (in.items() == 0)
|
|
|
|
|
return false;
|
2005-05-25 11:32:58 +00:00
|
|
|
|
char provv = get(F_PROVV_ELAB)[0];
|
|
|
|
|
int anno = get_int(F_ANNO_ELAB);
|
|
|
|
|
TString16 codnum(get(F_CODNUM_ELAB));
|
|
|
|
|
long ndoc = get_long(F_NDOC_ELAB);
|
|
|
|
|
|
|
|
|
|
if (ndoc > 0L && !in.find(provv, anno, codnum, ndoc))
|
|
|
|
|
{
|
|
|
|
|
TDocumento* d = new TDocumento(provv, anno, codnum, ndoc);
|
|
|
|
|
|
2008-03-26 16:43:54 +00:00
|
|
|
|
in.add(d);
|
2005-05-25 11:32:58 +00:00
|
|
|
|
}
|
2005-11-09 16:31:19 +00:00
|
|
|
|
if (update_header)
|
|
|
|
|
{
|
2008-03-26 16:43:54 +00:00
|
|
|
|
const TString4 tipo_doc(app_doc.get(DOC_TIPODOC));
|
|
|
|
|
const TString8 caus_mag(app_doc.get(DOC_CAUSMAG));
|
2005-11-09 16:31:19 +00:00
|
|
|
|
const long movmag = app_doc.get_long(DOC_MOVMAG);
|
|
|
|
|
const TDate datadoc = app_doc.get_date(DOC_DATADOC);
|
|
|
|
|
const TDate datainsc = app_doc.get_date(DOC_DATAINSC);
|
2008-06-11 11:31:27 +00:00
|
|
|
|
const TDate datapart = app_doc.get_date(DOC_DATAPART);
|
|
|
|
|
const TString8 orapart(app_doc.get(DOC_ORAPART));
|
2005-11-09 16:31:19 +00:00
|
|
|
|
const char stato = app_doc.stato();
|
|
|
|
|
|
|
|
|
|
TDocumento::copy_data(app_doc.head(), in[0].head());
|
|
|
|
|
|
|
|
|
|
app_doc.put(DOC_TIPODOC, tipo_doc);
|
|
|
|
|
app_doc.put(DOC_CAUSMAG, caus_mag);
|
|
|
|
|
app_doc.put(DOC_MOVMAG, movmag);
|
|
|
|
|
app_doc.put(DOC_DATADOC, datadoc);
|
|
|
|
|
app_doc.put(DOC_DATAINSC, datainsc);
|
|
|
|
|
app_doc.put(DOC_STATO, stato);
|
|
|
|
|
}
|
2006-05-03 12:05:30 +00:00
|
|
|
|
out.add(app_doc);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (e->elabora(in, out, TDate(TODAY), TRUE))
|
|
|
|
|
{
|
|
|
|
|
if (out[0] != app_doc)
|
|
|
|
|
{
|
|
|
|
|
out.rewrite();
|
|
|
|
|
app_doc.read(out[0].head());
|
|
|
|
|
update_mask = TRUE;
|
|
|
|
|
}
|
2005-05-25 11:32:58 +00:00
|
|
|
|
in.rewrite();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
const TString8 num_in = e->codice_numerazione_iniziale();
|
|
|
|
|
set(F_CODNUM_ELAB, num_in);
|
|
|
|
|
set(F_NDOC_ELAB, "");
|
|
|
|
|
set(F_NUMDOCRIF_ELAB, "");
|
2008-03-26 14:17:46 +00:00
|
|
|
|
((TDocumento_mask *)_main)->set_focus_field(F_SHEET);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
if (e->tipo() == _consegna_ordini)
|
|
|
|
|
{
|
|
|
|
|
TParametri_elaborazione& p = e->params();
|
|
|
|
|
if (p.get("ARTICOLO").not_empty())
|
|
|
|
|
{
|
|
|
|
|
real qta = get_real(F_QTA);
|
|
|
|
|
if (qta > ZERO)
|
|
|
|
|
{
|
|
|
|
|
const real qta_evasa = p.get_real("QUANTITA");
|
|
|
|
|
qta -= qta_evasa;
|
|
|
|
|
set(F_QTA, qta);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-09 16:31:19 +00:00
|
|
|
|
// delete newdoc;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
|
|
|
|
|
// Azzera l'anno in caso di ordini
|
|
|
|
|
if (in.items() > 0 && in[0].is_ordine())
|
|
|
|
|
{
|
|
|
|
|
reset(F_ANNO_ELAB);
|
|
|
|
|
update_mask = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (update_mask)
|
|
|
|
|
update_ndoc_filter();
|
|
|
|
|
|
|
|
|
|
return update_mask;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TElaborazione * TElabora_mask::curr_elab()
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const TString16 cod_elab(get(F_ELAB));
|
|
|
|
|
return cod_elab.not_empty() ? &_elab[cod_elab] : NULL;
|
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
bool TElabora_mask::article_filter(const TRelation* rel)
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
bool yes = FALSE;
|
|
|
|
|
TElabora_mask& m = *_myself;
|
|
|
|
|
TLocalisamfile rdoc(LF_RIGHEDOC);
|
|
|
|
|
rdoc.put(RDOC_CODNUM, rel->curr().get(DOC_CODNUM));
|
|
|
|
|
rdoc.put(RDOC_ANNO, rel->curr().get(DOC_ANNO));
|
|
|
|
|
rdoc.put(RDOC_PROVV, rel->curr().get(DOC_PROVV));
|
|
|
|
|
rdoc.put(RDOC_NDOC, rel->curr().get(DOC_NDOC));
|
|
|
|
|
rdoc.put(RDOC_NRIGA, 1);
|
|
|
|
|
int next_riga = 1;
|
|
|
|
|
for (int err = rdoc.read(); err == NOERR; err = rdoc.next())
|
|
|
|
|
{
|
|
|
|
|
const int nriga = rdoc.get_int(RDOC_NRIGA);
|
|
|
|
|
if (nriga != next_riga)
|
|
|
|
|
break;
|
|
|
|
|
next_riga++;
|
|
|
|
|
const bool evasa= rdoc.get_bool(RDOC_RIGAEVASA);
|
|
|
|
|
const TString& codart = rdoc.get(RDOC_CODART);
|
|
|
|
|
if (!evasa && codart == m._art_filter)
|
|
|
|
|
{
|
|
|
|
|
yes = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return yes;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
void TElabora_mask::add_valuta_filter(TString& filter) const
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
TString16 valuta = get(F_CODVAL_ELAB);
|
|
|
|
|
if (::is_firm_value(valuta))
|
|
|
|
|
{
|
|
|
|
|
filter << "((CODVAL==\"" << valuta << "\")";
|
|
|
|
|
if (valuta.empty())
|
|
|
|
|
valuta = TCurrency::get_firm_val();
|
|
|
|
|
else
|
|
|
|
|
valuta.cut(0);
|
|
|
|
|
filter << "||(CODVAL==\"" << valuta << "\"))";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
filter << "(CODVAL==\"" << valuta << "\")";
|
2002-05-31 10:35:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-11-04 18:04:26 +00:00
|
|
|
|
void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
|
1998-08-25 18:07:30 +00:00
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TString filter;
|
|
|
|
|
add_valuta_filter(filter);
|
|
|
|
|
|
|
|
|
|
TElaborazione * e = curr_elab();
|
|
|
|
|
const bool elab_changed = e != _last_elab;
|
|
|
|
|
_last_elab = e;
|
|
|
|
|
|
2008-01-28 15:44:05 +00:00
|
|
|
|
const bool aggiungi_doc_att = get_bool(F_TYPE);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
enable(-1, aggiungi_doc_att);
|
|
|
|
|
if (!aggiungi_doc_att && is_tipo_elaborazione )
|
|
|
|
|
reset(-1);
|
|
|
|
|
|
|
|
|
|
const bool enable_group_doc = e != NULL && e->tipo() != _generazione_effetti && e->tipo() != _contabilizzazione;
|
|
|
|
|
show(-GRP_DOC, enable_group_doc);
|
|
|
|
|
|
|
|
|
|
if (e != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (aggiungi_doc_att)
|
|
|
|
|
{
|
2008-01-28 15:44:05 +00:00
|
|
|
|
bool agg_test = e->aggiorna_testata_se_vuoto();
|
|
|
|
|
|
2008-01-28 15:51:52 +00:00
|
|
|
|
if (agg_test)
|
|
|
|
|
{
|
|
|
|
|
const int nrighe = _main->doc().physical_rows();
|
|
|
|
|
|
|
|
|
|
for (int i = 1;agg_test && i <= nrighe; i++)
|
|
|
|
|
if (!_main->doc()[i].is_generata())
|
|
|
|
|
agg_test = false;
|
|
|
|
|
}
|
2008-01-28 15:44:05 +00:00
|
|
|
|
|
2005-05-25 11:32:58 +00:00
|
|
|
|
set(F_UPDATE_HEADER, agg_test ? "X" : "");
|
2005-08-23 08:54:32 +00:00
|
|
|
|
const TString8 num_in = e->codice_numerazione_iniziale();
|
|
|
|
|
if (elab_changed)
|
|
|
|
|
{
|
|
|
|
|
const TString16 tipo_in(e->tipo_iniziale(0));
|
|
|
|
|
const char stato_in = e->stato_iniziale(0);
|
|
|
|
|
|
|
|
|
|
set(F_CODNUM_ELAB, num_in);
|
|
|
|
|
field(F_CODNUM_ELAB).check();
|
|
|
|
|
set(F_TIPODOC_ELAB , tipo_in);
|
|
|
|
|
field(F_TIPODOC_ELAB).check();
|
|
|
|
|
TString8 si; si << stato_in;
|
|
|
|
|
set(F_STATODOC_ELAB, si);
|
|
|
|
|
field(F_STATODOC_ELAB).check();
|
|
|
|
|
|
|
|
|
|
// Azzero anno di elaaborazione quando ho a che fare con degli ordini
|
2008-10-07 00:50:22 +00:00
|
|
|
|
const TTipo_documento& tipodocin = cached_tipodoc(tipo_in);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (tipodocin.is_ordine())
|
|
|
|
|
reset(F_ANNO_ELAB);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!field(F_TIPODOC_ELAB).empty())
|
|
|
|
|
{
|
|
|
|
|
const TString16 tipo(get(F_TIPODOC_ELAB));
|
|
|
|
|
TString80 td; td.format("&&(TIPODOC==\"%s\")", (const char *)tipo);
|
|
|
|
|
filter << td;
|
|
|
|
|
const TString& stato = get(F_STATODOC_ELAB);
|
|
|
|
|
if (stato.not_empty())
|
|
|
|
|
{
|
|
|
|
|
filter << "&&(STATO==\"" << stato << "\")";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool almost_one = FALSE;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
|
|
|
|
|
{
|
|
|
|
|
const TString16 tipo_in(e->tipo_iniziale(i));
|
|
|
|
|
const char stato_in = e->stato_iniziale(i);
|
|
|
|
|
|
|
|
|
|
if (tipo == tipo_in && stato_in > '0')
|
|
|
|
|
{
|
|
|
|
|
if (almost_one)
|
|
|
|
|
filter << "||";
|
|
|
|
|
else
|
|
|
|
|
filter << "&&(";
|
|
|
|
|
almost_one = TRUE;
|
|
|
|
|
|
|
|
|
|
filter << "(STATO==\"" << stato_in << "\")";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (almost_one)
|
|
|
|
|
filter << ')';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bool almost_one = FALSE;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
|
|
|
|
|
{
|
|
|
|
|
const TString16 tipo_in(e->tipo_iniziale(i));
|
|
|
|
|
if (tipo_in.not_empty())
|
|
|
|
|
{
|
|
|
|
|
if (almost_one)
|
|
|
|
|
filter << "||";
|
|
|
|
|
else
|
|
|
|
|
filter << "&&(";
|
|
|
|
|
almost_one = TRUE;
|
|
|
|
|
filter << "((TIPODOC==\"" << tipo_in << "\")";
|
|
|
|
|
|
|
|
|
|
const char stato_in[2] = { e->stato_iniziale(i), '\0' };
|
|
|
|
|
if (stato_in[0] > '0')
|
|
|
|
|
filter << "&&(STATO==\"" << stato_in << "\")";
|
|
|
|
|
filter << ')';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (almost_one)
|
|
|
|
|
filter << ')';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const TString4 tipo_fin(e->tipo_finale());
|
|
|
|
|
const TString4 stato_fin(e->stato_finale());
|
2002-05-31 10:35:40 +00:00
|
|
|
|
|
2005-05-25 11:32:58 +00:00
|
|
|
|
set(F_UPDATE_HEADER, "");
|
2005-08-23 08:54:32 +00:00
|
|
|
|
filter << "&&";
|
|
|
|
|
if (stato_fin != "0")
|
|
|
|
|
filter << '(';
|
|
|
|
|
filter << "(TIPODOC==\"" << tipo_fin << "\")";
|
|
|
|
|
if (stato_fin != "0")
|
|
|
|
|
filter << "&&(STATO==\"" << stato_fin << "\"))";
|
|
|
|
|
|
|
|
|
|
if (is_tipo_elaborazione)
|
|
|
|
|
{
|
2008-01-17 11:12:05 +00:00
|
|
|
|
const TString4 num_fin(e->codice_numerazione_finale());
|
2005-08-23 08:54:32 +00:00
|
|
|
|
set(F_CODNUM_ELAB, num_fin);
|
|
|
|
|
field(F_CODNUM_ELAB).check();
|
|
|
|
|
set(F_TIPODOC_ELAB, tipo_fin);
|
|
|
|
|
field(F_TIPODOC_ELAB).check();
|
|
|
|
|
set(F_STATODOC_ELAB, stato_fin);
|
|
|
|
|
field(F_STATODOC_ELAB).check();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!field(F_CODNUM_ELAB).empty())
|
|
|
|
|
{
|
|
|
|
|
TString80 cn; cn.format("&&(CODNUM==\"%s\")", (const char*)get(F_CODNUM_ELAB));
|
|
|
|
|
filter << cn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TBrowse& brew = *efield(F_NDOC_ELAB).browse();
|
|
|
|
|
brew.set_filter(filter);
|
|
|
|
|
|
|
|
|
|
_art_filter = get(F_CODART);
|
|
|
|
|
|
|
|
|
|
TCursor* cursor = brew.cursor();
|
|
|
|
|
if (_art_filter.not_empty() && aggiungi_doc_att)
|
|
|
|
|
cursor->set_filterfunction(article_filter);
|
|
|
|
|
else
|
|
|
|
|
cursor->set_filterfunction(NULL);
|
|
|
|
|
|
|
|
|
|
TTree_field& tf = tfield(F_ROWS);
|
|
|
|
|
if (!field(F_TIPODOC_ELAB).empty() && e != NULL)
|
|
|
|
|
{
|
2008-01-17 11:12:05 +00:00
|
|
|
|
if (aggiungi_doc_att && _art_filter.not_empty())
|
|
|
|
|
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter, article_filter);
|
|
|
|
|
else
|
|
|
|
|
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter);
|
2005-08-23 08:54:32 +00:00
|
|
|
|
tf.set_tree(&_tree);
|
2008-01-17 11:12:05 +00:00
|
|
|
|
|
|
|
|
|
TToken_string header(256, '\n');
|
2005-09-20 10:25:45 +00:00
|
|
|
|
header.add("Anno Num. N. Data Cli/For Ragione Sociale");
|
|
|
|
|
header.add(" Codice Articolo Descrizione Riga ");
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (aggiungi_doc_att && e->tipo() == _consegna_ordini)
|
2005-09-20 10:25:45 +00:00
|
|
|
|
header << "Da Evadere Residuo";
|
2005-08-23 08:54:32 +00:00
|
|
|
|
else
|
2005-09-20 10:25:45 +00:00
|
|
|
|
header << " Quantit<69>";
|
2005-08-23 08:54:32 +00:00
|
|
|
|
tf.set_header(header);
|
|
|
|
|
|
2008-03-26 12:38:22 +00:00
|
|
|
|
if (aggiungi_doc_att && _art_filter.full())
|
|
|
|
|
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter, article_filter);
|
|
|
|
|
else
|
|
|
|
|
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter);
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (aggiungi_doc_att) // GF20059
|
|
|
|
|
{
|
|
|
|
|
TCursor& cur = *_tree.get_cursor();
|
|
|
|
|
if (cur.items() == 1) // Propone l'unico documento possibile
|
|
|
|
|
{
|
|
|
|
|
cur = 0L;
|
|
|
|
|
const TRectype& curr = cur.curr();
|
|
|
|
|
set(F_ANNO_ELAB, curr.get(DOC_ANNO));
|
|
|
|
|
set(F_NDOC_ELAB, curr.get(DOC_NDOC));
|
|
|
|
|
set(F_CODNUM_ELAB, curr.get(DOC_CODNUM), 2); // Check but not hit
|
|
|
|
|
set(F_DATADOC_ELAB, curr.get(DOC_DATADOC));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
tf.set_tree(NULL);
|
|
|
|
|
tf.win().force_update();
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
void TElabora_mask::docrif_search()
|
2000-05-05 15:25:49 +00:00
|
|
|
|
{
|
2007-09-18 14:25:15 +00:00
|
|
|
|
TRectype filtrec(LF_DOC);
|
|
|
|
|
filtrec.put(DOC_TIPOCF, get(F_TIPOCF_ELAB));
|
|
|
|
|
filtrec.put(DOC_CODCF, get(F_CODCF_ELAB));
|
|
|
|
|
filtrec.put(DOC_PROVV, get(F_PROVV_ELAB));
|
|
|
|
|
filtrec.put(DOC_ANNO, get(F_ANNO_ELAB));
|
|
|
|
|
|
|
|
|
|
TRelation rel(LF_DOC);
|
|
|
|
|
rel.add(LF_CLIFO, "TIPOCF==TIPOCF|CODCF==CODCF");
|
|
|
|
|
TSorted_cursor cur(&rel, "TIPOCF|CODCF|PROVV|ANNO|CODNUM|NUMDOCRIF", "", 2, &filtrec, &filtrec);
|
|
|
|
|
TString flt(256);
|
|
|
|
|
if (!field(F_CODNUM_ELAB).empty())
|
|
|
|
|
flt << "(CODNUM==\"" << get(F_CODNUM_ELAB) << "\")&&";
|
|
|
|
|
if (!field(F_TIPODOC_ELAB).empty())
|
|
|
|
|
flt << "(TIPODOC==\"" << get(F_TIPODOC_ELAB) << "\")&&";
|
|
|
|
|
if (!field(F_STATODOC_ELAB).empty())
|
|
|
|
|
flt << "(STATO==\"" << get(F_STATODOC_ELAB) << "\")&&";
|
|
|
|
|
add_valuta_filter(flt); flt << "&&";
|
|
|
|
|
TEdit_field& f = efield(F_NUMDOCRIF_ELAB);
|
|
|
|
|
if (!f.empty())
|
|
|
|
|
flt << "(NUMDOCRIF==\"" << f.get() << "\")&&";
|
|
|
|
|
flt.rtrim(2); // Togli gli ultimi &&
|
|
|
|
|
|
|
|
|
|
cur.setfilter(flt);
|
|
|
|
|
|
|
|
|
|
TToken_string fields = "ANNO|CODNUM|TIPODOC|NUMDOCRIF|STATO|DATADOCRIF|DOC1|DOC2|DOC3|NDOC|20->RAGSOC";
|
|
|
|
|
TCursor_sheet sheet(&cur, fields,
|
|
|
|
|
"Documento di riferimento",
|
|
|
|
|
"Anno|Num.|Tipo|Docum.Rif.|Stato|Data@10|Docum.Rif.1|Docum.Rif.2|Docum.Rif.3|Documento|Ragione Sociale@50",
|
|
|
|
|
0, 1);
|
|
|
|
|
if (sheet.run() == K_ENTER)
|
|
|
|
|
{
|
|
|
|
|
const int nrifpos = fields.get_pos("NUMDOCRIF");
|
|
|
|
|
const TString16 nrif = sheet.row(-1).get(nrifpos);
|
|
|
|
|
f.set(nrif);
|
|
|
|
|
const int ndocpos = fields.get_pos("NDOC");
|
|
|
|
|
const TString16 ndoc = sheet.row(-1).get(ndocpos);
|
|
|
|
|
set(F_NDOC_ELAB, ndoc);
|
|
|
|
|
const int codnumpos = fields.get_pos("CODNUM");
|
|
|
|
|
const TString16 codnum = sheet.row(-1).get(codnumpos);
|
|
|
|
|
set(F_CODNUM_ELAB, codnum, TRUE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TElabora_mask::TElabora_mask(TDocumento_mask& main_mask)
|
|
|
|
|
: TAutomask("ve0100b"), _main(&main_mask), _last_elab(NULL), _check_fld(-883)
|
|
|
|
|
{
|
|
|
|
|
_myself = this;
|
|
|
|
|
|
|
|
|
|
const TDate oggi(TODAY);
|
|
|
|
|
set(F_ANNO_ELAB, oggi.year()); //anno della datadoc proposta (risolve bug 0000331)
|
|
|
|
|
set(F_TIPOCF_ELAB, _main->get(F_TIPOCF));
|
|
|
|
|
set(F_CODCF_ELAB, _main->get(F_CODCF));
|
|
|
|
|
set(F_CODVAL_ELAB, _main->get(F_CODVAL));
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::elabora_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2007-09-18 14:25:15 +00:00
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
{
|
|
|
|
|
TDocumento_mask& m = (TDocumento_mask&)f.mask();
|
|
|
|
|
m.update_progs();
|
|
|
|
|
if (m.check_fields()) // Check values
|
|
|
|
|
{
|
|
|
|
|
TElabora_mask* selection = new TElabora_mask(m); // No woman no stack
|
|
|
|
|
bool do_checks = false;
|
|
|
|
|
const char stato_iniziale = m.doc().stato();
|
|
|
|
|
|
2008-06-11 11:31:27 +00:00
|
|
|
|
m.update_father_rows();
|
2007-11-26 16:08:33 +00:00
|
|
|
|
while (selection->run() == K_ENTER) //NON riportare modifiche dalla 3.1!! Gi<47> sistemato
|
2007-09-18 14:25:15 +00:00
|
|
|
|
{
|
|
|
|
|
m.mask2doc();
|
|
|
|
|
const bool processed = selection->elabora();
|
2007-11-26 16:08:33 +00:00
|
|
|
|
do_checks |= processed;
|
|
|
|
|
|
2007-09-18 14:25:15 +00:00
|
|
|
|
if (m.doc().stato() != stato_iniziale)
|
2007-11-26 16:08:33 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (processed)
|
|
|
|
|
{
|
|
|
|
|
m.doc2mask(false);
|
|
|
|
|
TSheet_field& ss = m.sfield(F_SHEET);
|
|
|
|
|
for (int i = 0; i < ss.items(); i++)
|
|
|
|
|
{
|
|
|
|
|
m.ss_notify(ss,i,K_TAB);
|
|
|
|
|
m.ss_notify(ss,i,K_SPACE);
|
|
|
|
|
m.ss_notify(ss,i,K_ENTER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-18 14:25:15 +00:00
|
|
|
|
if (!m.get_bool(F_TYPE)) // non aggiunge al documento attuale
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-11-26 16:08:33 +00:00
|
|
|
|
if (do_checks) //NON riportare modifiche dalla 3.1!! Gi<47> sistemato
|
2007-09-18 14:25:15 +00:00
|
|
|
|
{
|
2007-11-26 16:08:33 +00:00
|
|
|
|
m.doc2mask(false);
|
2007-09-18 14:25:15 +00:00
|
|
|
|
// Provoca decodifiche necessarie
|
|
|
|
|
const int tutti = m.fields();
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < tutti; i++)
|
|
|
|
|
{
|
|
|
|
|
TMask_field& f = m.fld(i);
|
|
|
|
|
if (f.dlg() <= BASE_PIEDE)
|
|
|
|
|
f.check(STARTING_CHECK);
|
|
|
|
|
}
|
|
|
|
|
for (i = tutti-1; i >= 0; i--)
|
|
|
|
|
m.fld(i).set_dirty(FALSE);
|
|
|
|
|
}
|
2008-06-11 11:31:27 +00:00
|
|
|
|
m.update_father_rows(false);
|
2007-09-18 14:25:15 +00:00
|
|
|
|
delete selection;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-11-26 16:08:33 +00:00
|
|
|
|
return true;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-05-31 10:35:40 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TDocumento_mask
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
1998-08-25 18:07:30 +00:00
|
|
|
|
bool TDocumento_mask::print_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2009-03-23 15:48:33 +00:00
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
{
|
|
|
|
|
if (f.dlg() == DLG_PREVIEW)
|
|
|
|
|
main_app().preview();
|
|
|
|
|
else
|
|
|
|
|
main_app().print();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-11-30 22:02:59 +00:00
|
|
|
|
void TDocumento_mask::set_field_handler(short fieldid, CONTROL_HANDLER handler)
|
|
|
|
|
{
|
|
|
|
|
_handlers.add((TObject *)handler, fieldid);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-04 10:19:38 +00:00
|
|
|
|
void TDocumento_mask::user_set_handler(short fieldid, int index)
|
1998-08-25 18:07:30 +00:00
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
switch( index )
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
set_field_handler(fieldid, ora_hndl);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
set_field_handler(fieldid, totdoc_hndl);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
set_field_handler(fieldid, numdocrif_hndl);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
2004-11-30 22:02:59 +00:00
|
|
|
|
{
|
|
|
|
|
_smartcard = new TSmart_card();
|
|
|
|
|
if (_smartcard->type() != no_smartcard)
|
|
|
|
|
{
|
|
|
|
|
set_field_handler(fieldid, smart_hndl);
|
|
|
|
|
set_handler(fieldid, universal_handler);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
disable(fieldid);
|
|
|
|
|
delete _smartcard;
|
|
|
|
|
_smartcard = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
case 5:
|
|
|
|
|
set_field_handler(fieldid, dummy_hndl);
|
|
|
|
|
break;
|
2008-12-10 16:03:23 +00:00
|
|
|
|
case 6:
|
|
|
|
|
set_field_handler(fieldid, fido_hndl);
|
|
|
|
|
break;
|
2005-08-23 08:54:32 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-11-30 22:02:59 +00:00
|
|
|
|
bool TDocumento_mask::call_handler( TMask_field& f, KEY key)
|
|
|
|
|
{
|
|
|
|
|
const short id = f.dlg();
|
|
|
|
|
|
|
|
|
|
CONTROL_HANDLER h = (CONTROL_HANDLER) _handlers.objptr(id);
|
|
|
|
|
|
|
|
|
|
if (h != NULL)
|
|
|
|
|
return h(f, key);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::universal_handler( TMask_field& f, KEY key)
|
|
|
|
|
{
|
2008-03-26 12:38:22 +00:00
|
|
|
|
TDocumento_mask& m = (TDocumento_mask&)f.mask();
|
2004-11-30 22:02:59 +00:00
|
|
|
|
bool ok = m.call_handler(f, key);
|
|
|
|
|
|
|
|
|
|
if (ok && key == K_TAB && f.focusdirty())
|
|
|
|
|
{
|
2008-03-26 12:38:22 +00:00
|
|
|
|
const TFieldref* fr = f.field();
|
|
|
|
|
if (fr != NULL && (fr->file() == 0 || fr->file() == LF_DOC))
|
|
|
|
|
fr->write(f.get(), m.doc());
|
|
|
|
|
|
|
|
|
|
const int page = f.page();
|
|
|
|
|
if (m.is_calculated_page(page))
|
2004-11-30 22:02:59 +00:00
|
|
|
|
m.update_progs();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-24 14:53:31 +00:00
|
|
|
|
bool TDocumento_mask::anno_handler( TMask_field& f, KEY key)
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (key == K_TAB && f.to_check(key, TRUE))
|
2003-09-24 14:53:31 +00:00
|
|
|
|
app().update_navigation_bar();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
return true;
|
2003-09-24 14:53:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-10-16 06:16:56 +00:00
|
|
|
|
TString16 __codnum;
|
|
|
|
|
|
2008-10-28 20:15:28 +00:00
|
|
|
|
bool tipodoc_ok(const TString & tipodoc)
|
|
|
|
|
{
|
|
|
|
|
const TString4 module(main_app().name().left(2));
|
|
|
|
|
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
|
|
|
|
|
const TString & tipomod = tipo.module();
|
|
|
|
|
|
|
|
|
|
if (module == "ve" && tipomod.blank())
|
|
|
|
|
return true;
|
|
|
|
|
return tipomod == module;
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-16 06:16:56 +00:00
|
|
|
|
bool tip_filter(const TRelation* r)
|
|
|
|
|
{
|
|
|
|
|
if (__codnum.blank())
|
|
|
|
|
return true;
|
|
|
|
|
const TCodice_numerazione & cod_num = cached_numerazione(__codnum);
|
|
|
|
|
const TString4 tipo = r->curr().get("CODTAB");
|
|
|
|
|
|
|
|
|
|
int last = cod_num.ntipi_doc();
|
|
|
|
|
for (int i = 0; i < last; i++ )
|
|
|
|
|
{
|
|
|
|
|
const TString & curtipo = cod_num.tipo_doc(i);
|
2008-10-28 20:15:28 +00:00
|
|
|
|
|
|
|
|
|
if (curtipo == tipo && tipodoc_ok(curtipo))
|
|
|
|
|
return true;
|
2008-10-16 06:16:56 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-24 14:53:31 +00:00
|
|
|
|
bool TDocumento_mask::num_handler( TMask_field& f, KEY key)
|
1998-08-25 18:07:30 +00:00
|
|
|
|
{
|
2008-10-28 20:15:28 +00:00
|
|
|
|
if (key == K_TAB && f.to_check(key, true))
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
// Ottengo la maschera
|
|
|
|
|
TMask& m = f.mask();
|
2008-10-16 06:16:56 +00:00
|
|
|
|
const TString & codnum = f.get();
|
|
|
|
|
TCursor * cur = m.efield(F_TIPODOC).browse()->cursor();
|
|
|
|
|
TCursor * descur = m.efield(F_DESTIPODOC).browse()->cursor();
|
|
|
|
|
|
|
|
|
|
__codnum = codnum;
|
|
|
|
|
if (codnum.full())
|
2005-08-23 08:54:32 +00:00
|
|
|
|
{
|
2008-10-16 06:16:56 +00:00
|
|
|
|
const TCodice_numerazione & cod_num = cached_numerazione(codnum);
|
|
|
|
|
|
2005-08-23 08:54:32 +00:00
|
|
|
|
m.set( F_DESNUM, cod_num.descrizione());
|
|
|
|
|
// Propone il primo tipo di documento come default
|
|
|
|
|
if (m.field(F_TIPODOC).empty() || f.focusdirty())
|
|
|
|
|
{
|
|
|
|
|
m.set( F_TIPODOC, cod_num.tipo_doc(0));
|
|
|
|
|
m.send_key( K_TAB, F_TIPODOC );
|
|
|
|
|
}
|
|
|
|
|
// Se per questa numerazione e' abilitata le numerazione provvisoria
|
|
|
|
|
if (cod_num.num_provv())
|
|
|
|
|
{
|
|
|
|
|
// Setta di default la numerazione provvisoria
|
|
|
|
|
m.set( F_PROVV, "P" );
|
|
|
|
|
// Abilita il campo per la selezione della numerazione
|
|
|
|
|
m.enable( F_PROVV );
|
|
|
|
|
}
|
|
|
|
|
else // Altrimenti ...
|
|
|
|
|
{
|
|
|
|
|
// Setta la numerazione a definitiva
|
|
|
|
|
m.set( F_PROVV, "D" );
|
|
|
|
|
// Disabilita il campo per la selezione della numerazione
|
|
|
|
|
m.disable( F_PROVV );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m.set( F_DESNUM, "" );
|
|
|
|
|
m.set( F_TIPODOC, "" );
|
|
|
|
|
}
|
2008-10-16 06:16:56 +00:00
|
|
|
|
cur->set_filterfunction(tip_filter);
|
|
|
|
|
descur->set_filterfunction(tip_filter);
|
2003-09-24 14:53:31 +00:00
|
|
|
|
app().update_navigation_bar();
|
2005-08-23 08:54:32 +00:00
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::codlist_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2007-09-18 14:25:15 +00:00
|
|
|
|
if (key == K_TAB && f.focusdirty())
|
|
|
|
|
{
|
|
|
|
|
TLocalisamfile & list = ((TEdit_field &) f).browse()->cursor()->file();
|
|
|
|
|
const TDate datadoc(f.mask().get(F_DATADOC));
|
|
|
|
|
const TDate datascad(list.get_date("VALFIN"));
|
|
|
|
|
|
|
|
|
|
if (datascad.ok() && datadoc > datascad)
|
|
|
|
|
{
|
|
|
|
|
const TString16 codsucc(list.get("CODLISSUCC"));
|
|
|
|
|
|
|
|
|
|
if (codsucc.empty())
|
|
|
|
|
return error_box("Listino scaduto il %s", datascad.string());
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
f.set(codsucc);
|
|
|
|
|
f.set_focusdirty();
|
|
|
|
|
((TEdit_field &)f).check();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-03-26 12:38:22 +00:00
|
|
|
|
return true;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::codcont_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2007-09-18 14:25:15 +00:00
|
|
|
|
if (key == K_TAB && f.focusdirty())
|
|
|
|
|
{
|
2009-03-10 14:31:20 +00:00
|
|
|
|
TDocumento_mask& m = (TDocumento_mask&)f.mask();
|
2007-09-18 14:25:15 +00:00
|
|
|
|
TLocalisamfile & cont = ((TEdit_field &) f).browse()->cursor()->file();
|
|
|
|
|
const TDate datadoc(f.mask().get(F_DATADOC));
|
|
|
|
|
const TDate datascad(cont.get_date("VALFIN"));
|
|
|
|
|
|
|
|
|
|
if (datascad.ok() && datadoc > datascad)
|
|
|
|
|
return error_box("Contratto scaduto il %s", datascad.string());
|
2007-03-30 13:51:17 +00:00
|
|
|
|
|
|
|
|
|
static bool __gesconcc = false;
|
|
|
|
|
static long __cntr_firm = -1L;
|
|
|
|
|
const long firm = prefix().get_codditta();
|
|
|
|
|
if (firm != __cntr_firm)
|
|
|
|
|
{
|
|
|
|
|
TConfig c(CONFIG_DITTA, "ve");
|
|
|
|
|
__gesconcc = c.get_bool("GESCONCC");
|
|
|
|
|
__cntr_firm = firm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m.doc().tipo().load_cont() && f.get().full() && m.get_long(F_CODCF) > 0)
|
|
|
|
|
{
|
|
|
|
|
TSheet_field & s = m.sfield(F_SHEET);
|
|
|
|
|
|
|
|
|
|
if (s.items() == 0)
|
|
|
|
|
{
|
|
|
|
|
TString select("TIPO='C' CATVEN=''");
|
|
|
|
|
|
|
|
|
|
if(__gesconcc)
|
|
|
|
|
select << " " << RCONDV_TIPOCF<< "='" << m.get(F_TIPOCF) <<"' " << RCONDV_CODCF << "=" << m.get_long(F_CODCF);
|
|
|
|
|
select << " " << RCONDV_COD << "=" << f.get();
|
|
|
|
|
TString query("USE RCONDV SELECT ");
|
|
|
|
|
|
|
|
|
|
query << RCONDV_TIPORIGA << "=='A'";
|
|
|
|
|
query << "\nFROM " << select;
|
|
|
|
|
query << "\nTO " << select;
|
|
|
|
|
TISAM_recordset recset(query);
|
|
|
|
|
TString last_cod(20);
|
|
|
|
|
|
|
|
|
|
for (bool ok = recset.move_first(); ok ; ok = recset.move_next())
|
|
|
|
|
{
|
|
|
|
|
TRiga_documento & r = m.doc().new_row("01");
|
|
|
|
|
const TString & cod = recset.get(RCONDV_CODRIGA).as_string();
|
|
|
|
|
|
|
|
|
|
if (cod != last_cod)
|
|
|
|
|
{
|
|
|
|
|
r.put(RDOC_CODART, cod);
|
|
|
|
|
|
2009-04-23 15:26:54 +00:00
|
|
|
|
const int row = s.insert(-1, false);
|
2007-03-30 13:51:17 +00:00
|
|
|
|
s.row(row);
|
|
|
|
|
r.autoload(s);
|
|
|
|
|
s.check_row(row, 0x2);
|
|
|
|
|
r.autosave(s);
|
|
|
|
|
const TString & um = recset.get(RCONDV_UM).as_string();
|
|
|
|
|
|
|
|
|
|
if (um.full())
|
|
|
|
|
r.put(RDOC_UMQTA, um);
|
|
|
|
|
r.put(RDOC_PREZZO, recset.get(RCONDV_PREZZO).as_real());
|
|
|
|
|
r.put(RDOC_SCONTO, recset.get(RCONDV_SCONTO).as_string());
|
|
|
|
|
r.put(RDOC_PERCPROV, recset.get(RCONDV_PERCPROVV).as_real());
|
|
|
|
|
r.autoload(s);
|
|
|
|
|
last_cod = cod;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-18 14:25:15 +00:00
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDocumento_mask::codcamp_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2007-09-18 14:25:15 +00:00
|
|
|
|
if (key == K_TAB && f.focusdirty())
|
|
|
|
|
{
|
|
|
|
|
TLocalisamfile & camp = ((TEdit_field &) f).browse()->cursor()->file();
|
|
|
|
|
const TDate datadoc(f.mask().get(F_DATADOC));
|
|
|
|
|
const TDate datascad(camp.get_date("VALFIN"));
|
|
|
|
|
|
|
|
|
|
if (datascad.ok() && datadoc > datascad)
|
|
|
|
|
return error_box("Offerta scaduta il %s", datascad.string());
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
1998-08-25 18:07:30 +00:00
|
|
|
|
}
|
2000-05-05 15:25:49 +00:00
|
|
|
|
|
2004-11-30 22:02:59 +00:00
|
|
|
|
|
2003-02-25 14:39:02 +00:00
|
|
|
|
bool TDocumento_mask::datacambio_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
TMask& m = f.mask();
|
|
|
|
|
if (key == K_TAB && m.field(F_CAMBIO).empty())
|
|
|
|
|
{
|
|
|
|
|
const TString& codval = m.get(F_CODVAL1);
|
|
|
|
|
if (is_true_value(codval))
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec = cache().get("%VAL", codval);
|
|
|
|
|
m.set(F_CAMBIO, rec.get("S4"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
2003-02-25 14:39:02 +00:00
|
|
|
|
}
|
2003-01-28 13:33:45 +00:00
|
|
|
|
|
2000-05-05 15:25:49 +00:00
|
|
|
|
bool TDocumento_mask::codval_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2005-08-23 08:54:32 +00:00
|
|
|
|
if (key == K_TAB && f.focusdirty() && !f.empty())
|
|
|
|
|
{
|
|
|
|
|
TMask& m = f.mask();
|
|
|
|
|
|
|
|
|
|
// Cerco un cambio per la data specificata, se non lo trovo lo invento
|
|
|
|
|
TDate datacam = m.get_date(F_DATACAMBIO);
|
|
|
|
|
if (!datacam.ok())
|
|
|
|
|
{
|
|
|
|
|
datacam = m.get_date(F_DATADOC);
|
|
|
|
|
m.set(F_DATACAMBIO, datacam);
|
|
|
|
|
m.set(F_DATACAMBIO1, datacam);
|
|
|
|
|
}
|
|
|
|
|
TExchange exc(f.get());
|
|
|
|
|
exchange_type et;
|
|
|
|
|
real cambio = exc.get_change(et); // Determino il cambio standard ed il "Contro-Euro"
|
|
|
|
|
TString16 key;
|
|
|
|
|
key.format("%-3s%s", (const char*)f.get(), (const char*)datacam.string(ANSI));
|
|
|
|
|
const real giornaliero(cache().get("CAM", key, "S4"));
|
|
|
|
|
if (!giornaliero.is_zero())
|
|
|
|
|
cambio = giornaliero; // Ho trovato un cambio per il giorno!
|
|
|
|
|
m.set(F_CAMBIO, cambio);
|
|
|
|
|
m.set(F_CONTROEURO, et == _exchange_contro ? "X" : "");
|
|
|
|
|
|
|
|
|
|
m.sfield(F_SHEET).force_update(); // Aggiorna punti decimali degli importi
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
2007-11-16 13:46:49 +00:00
|
|
|
|
}
|
2008-06-11 11:31:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TDocumento_mask::update_father_rows(bool add)
|
|
|
|
|
{
|
|
|
|
|
if (_auto_reopen_nums.empty())
|
|
|
|
|
return;
|
|
|
|
|
const int rows = doc().physical_rows();
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= rows; i++)
|
|
|
|
|
{
|
|
|
|
|
const TRiga_documento & r = doc()[i];
|
|
|
|
|
|
|
|
|
|
if (r.is_merce() || r.is_omaggio()|| r.is_prestazione())
|
|
|
|
|
{
|
|
|
|
|
TRiga_documento * original_row = (TRiga_documento *) r.find_original_rdoc();
|
|
|
|
|
|
|
|
|
|
if (original_row != NULL && _auto_reopen_nums.objptr(original_row->get(RDOC_CODNUM)) != NULL)
|
|
|
|
|
{
|
|
|
|
|
TToken_string key;
|
|
|
|
|
|
|
|
|
|
key.add(original_row->get(RDOC_PROVV));
|
|
|
|
|
key.add(original_row->get(RDOC_ANNO));
|
|
|
|
|
key.add(original_row->get(RDOC_CODNUM));
|
|
|
|
|
key.add(original_row->get(RDOC_NDOC));
|
|
|
|
|
key.add(original_row->get(RDOC_IDRIGA));
|
|
|
|
|
|
|
|
|
|
real * qta = (real *) _father_rows.objptr(key);
|
|
|
|
|
|
|
|
|
|
if (qta == NULL)
|
|
|
|
|
{
|
|
|
|
|
qta = new real;
|
|
|
|
|
_father_rows.add(key, qta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
real value = r.quantita();
|
|
|
|
|
|
|
|
|
|
if (r.is_articolo())
|
|
|
|
|
{
|
2008-10-07 00:50:22 +00:00
|
|
|
|
TArticolo & art = cached_article(r.get(RDOC_CODARTMAG));
|
2008-06-11 11:31:27 +00:00
|
|
|
|
|
|
|
|
|
value = art.convert_to_um(value, original_row->get(RDOC_UMQTA), r.get(RDOC_UMQTA));
|
|
|
|
|
}
|
|
|
|
|
if(add)
|
|
|
|
|
*qta += value;
|
|
|
|
|
else
|
|
|
|
|
*qta -= value;
|
|
|
|
|
if (*qta == ZERO)
|
|
|
|
|
_father_rows.remove(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TAssoc_array TDocumento_mask::_father_rows;
|
|
|
|
|
TAssoc_array TDocumento_mask::_auto_reopen_nums;
|
|
|
|
|
TAssoc_array TDocumento_mask::_tipidoc_rels;
|
|
|
|
|
|
|
|
|
|
void TDocumento_mask::save_father_rows()
|
|
|
|
|
{
|
|
|
|
|
if (_auto_reopen_nums.empty())
|
|
|
|
|
return;
|
|
|
|
|
TLocalisamfile rdoc(LF_RIGHEDOC);
|
|
|
|
|
TString_array rows;
|
|
|
|
|
TToken_string last_doc;
|
|
|
|
|
TToken_string curr_doc;
|
|
|
|
|
int nrows = 0;
|
|
|
|
|
|
|
|
|
|
FOR_EACH_ASSOC_OBJECT(_father_rows, h, k, o)
|
|
|
|
|
{
|
|
|
|
|
rows.add(k);
|
|
|
|
|
}
|
|
|
|
|
rows.sort();
|
|
|
|
|
rows.add("");
|
|
|
|
|
|
|
|
|
|
FOR_EACH_ARRAY_ROW(rows, i, r)
|
|
|
|
|
{
|
|
|
|
|
curr_doc = r->get(0);
|
|
|
|
|
curr_doc.add(r->get());
|
|
|
|
|
curr_doc.add(r->get());
|
|
|
|
|
curr_doc.add(r->get());
|
|
|
|
|
|
|
|
|
|
if (last_doc != curr_doc && nrows > 0)
|
|
|
|
|
{
|
|
|
|
|
TDocumento d;
|
|
|
|
|
|
|
|
|
|
d.read(last_doc.get_char(0), last_doc.get_int(1), last_doc.get(2), last_doc.get_long(3), _isequal, _lock);
|
|
|
|
|
for (int j = i - nrows; j < i; j++)
|
|
|
|
|
{
|
|
|
|
|
TToken_string & key = rows.row(j);
|
|
|
|
|
const long idriga = key.get_long(4);
|
|
|
|
|
const int nrows = d.physical_rows();
|
|
|
|
|
|
|
|
|
|
for (int k = 1; k <= nrows; k++)
|
|
|
|
|
{
|
|
|
|
|
TRiga_documento & rdoc_row = d[k];
|
|
|
|
|
|
|
|
|
|
if (idriga == rdoc_row.get_long(RDOC_IDRIGA))
|
|
|
|
|
{
|
|
|
|
|
const real * qta = (const real *) _father_rows.objptr(key);
|
2008-11-14 14:40:28 +00:00
|
|
|
|
const TString& name = rdoc_row.field_qtaevasa();
|
2008-06-11 11:31:27 +00:00
|
|
|
|
real qtaevasa = rdoc_row.get_real(name) + * qta;
|
|
|
|
|
|
|
|
|
|
if (qtaevasa < ZERO)
|
|
|
|
|
qtaevasa = ZERO;
|
|
|
|
|
rdoc_row.put(name, qtaevasa);
|
|
|
|
|
if (qtaevasa < rdoc_row.quantita())
|
|
|
|
|
rdoc_row.zero(RDOC_RIGAEVASA);
|
|
|
|
|
else
|
|
|
|
|
rdoc_row.put(RDOC_RIGAEVASA, "X");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TToken_string key(d.tipo().codice());
|
|
|
|
|
|
|
|
|
|
key.add(doc().tipo().codice());
|
|
|
|
|
|
|
|
|
|
TStati * stati = (TStati *) _tipidoc_rels.objptr(key);
|
|
|
|
|
|
|
|
|
|
if (stati != NULL)
|
|
|
|
|
{
|
|
|
|
|
const int nrows = d.physical_rows();
|
|
|
|
|
bool evaso = true;
|
|
|
|
|
|
|
|
|
|
for (int k = 1; evaso && k <= nrows; k++)
|
|
|
|
|
evaso &= d[k].is_evasa();
|
|
|
|
|
d.stato(evaso ? stati->finale() : stati->iniziale());
|
|
|
|
|
}
|
|
|
|
|
d.rewrite();
|
|
|
|
|
nrows = 0;
|
|
|
|
|
}
|
|
|
|
|
last_doc = curr_doc;
|
|
|
|
|
nrows++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-26 23:32:16 +00:00
|
|
|
|
static bool conf_num_handler(TMask_field& f, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_TAB && f.to_check(key, true))
|
|
|
|
|
{
|
|
|
|
|
TMask & m = f.mask();
|
|
|
|
|
|
|
|
|
|
__codnum = f.get();
|
|
|
|
|
|
|
|
|
|
TCursor * cur = m.efield(F_TIPODOC).browse()->cursor();
|
|
|
|
|
TCursor * descur = m.efield(F_DESTIPODOC).browse()->cursor();
|
|
|
|
|
|
|
|
|
|
cur->set_filterfunction(tip_filter);
|
|
|
|
|
descur->set_filterfunction(tip_filter);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-11 11:31:27 +00:00
|
|
|
|
bool TDocumento_mask::confirm_handler( TMask_field& f, KEY key )
|
|
|
|
|
{
|
2008-06-11 15:28:02 +00:00
|
|
|
|
bool ok = true;
|
|
|
|
|
|
2008-08-27 23:23:05 +00:00
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
{
|
|
|
|
|
TMask m("ve0100d");
|
|
|
|
|
TDocumento_mask & mask = (TDocumento_mask &) f.mask();
|
|
|
|
|
const TDocumento& src = mask.doc();
|
|
|
|
|
TCodice_numerazione num(src.numerazione());
|
|
|
|
|
TString4 codnum(num.codnumdef());
|
|
|
|
|
TString4 tipodoc(num.tipodocdef());
|
|
|
|
|
if (!num.newnumdef())
|
|
|
|
|
{
|
|
|
|
|
codnum = src.get(DOC_CODNUM);
|
|
|
|
|
tipodoc = src.get(DOC_TIPODOC);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
codnum = num.get("S8");
|
|
|
|
|
tipodoc = num.get("S9");
|
|
|
|
|
}
|
|
|
|
|
bool ok = codnum.full() && tipodoc.full();
|
|
|
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
|
{
|
2009-02-26 23:32:16 +00:00
|
|
|
|
TString saved_codnum = __codnum;
|
|
|
|
|
|
2008-08-27 23:23:05 +00:00
|
|
|
|
m.set(F_CODNUM, codnum);
|
|
|
|
|
m.enable(F_CODNUM, codnum.blank());
|
2009-02-26 23:32:16 +00:00
|
|
|
|
m.set_handler(F_CODNUM, ::conf_num_handler);
|
2008-08-27 23:23:05 +00:00
|
|
|
|
m.enable(F_DESNUM, codnum.blank());
|
|
|
|
|
m.set(F_TIPODOC, tipodoc);
|
|
|
|
|
m.enable(F_TIPODOC, tipodoc.blank());
|
|
|
|
|
m.enable(F_DESTIPODOC, tipodoc.blank());
|
|
|
|
|
ok = m.run() == K_ENTER;
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
codnum = m.get(F_CODNUM);
|
|
|
|
|
tipodoc = m.get(F_TIPODOC);
|
|
|
|
|
}
|
2009-02-26 23:32:16 +00:00
|
|
|
|
__codnum = saved_codnum;
|
2008-08-27 23:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ok = codnum.full() && tipodoc.full();
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
TDocumento dest(src);
|
|
|
|
|
|
|
|
|
|
dest.put(DOC_CODNUM, codnum);
|
|
|
|
|
dest.put(DOC_TIPODOC, tipodoc);
|
|
|
|
|
dest.put(DOC_PROVV, "D");
|
|
|
|
|
dest.zero(DOC_NDOC);
|
|
|
|
|
|
|
|
|
|
int err = dest.write();
|
|
|
|
|
|
|
|
|
|
if (err == NOERR)
|
|
|
|
|
{
|
|
|
|
|
err = src.remove();
|
|
|
|
|
if (err != NOERR)
|
|
|
|
|
warning_box("Errore %d nell'eliminazione del documento provvisorio", err);
|
|
|
|
|
mask.stop_run(K_ESC);
|
|
|
|
|
TMask & qmask = app().query_mask();
|
|
|
|
|
qmask.set(F_CODNUM, codnum);
|
|
|
|
|
qmask.set(F_PROVV, dest.get_char(DOC_PROVV));
|
|
|
|
|
qmask.set(F_ANNO, dest.get_int(DOC_ANNO));
|
|
|
|
|
qmask.set(F_NDOC, dest.get_long(DOC_NDOC));
|
|
|
|
|
qmask.field(F_NDOC).update_flags("RP");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return error_box("Errore %d nella generazione del documento definitivo", err);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
|
|
|
|
|
void TDocumento_mask::sel_color()
|
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
const TString& mn = doc().tipo().mask_name();
|
|
|
|
|
TSelect_color_mask sel(mn, "0");
|
|
|
|
|
FOR_EACH_ARRAY_ITEM(color_rules(), i, o)
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
const TColor_rule& col = *(const TColor_rule*)o;
|
|
|
|
|
COLOR a, b; col.colors(a, b);
|
|
|
|
|
COLOR c, d; col.default_colors(c, d);
|
|
|
|
|
sel.add_color(col.key(), col.description(), a, b, c, d);
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sel.run() != K_ESC)
|
|
|
|
|
{
|
2009-03-17 11:05:49 +00:00
|
|
|
|
FOR_EACH_ARRAY_ITEM(color_rules(), i, o)
|
|
|
|
|
{
|
|
|
|
|
TColor_rule& col = *(TColor_rule*)o;
|
|
|
|
|
COLOR back, fore; sel.get_color(col.key(), back, fore);
|
|
|
|
|
col.set_colors(back, fore);
|
|
|
|
|
}
|
Patch level : 10.0 220
Files correlati : ve0.exe lv3.exe co0.exe
Ricompilazione Demo : [ ]
Commento :
Implementata la possibilità di colorare le righe dei documenti definendo nella maschera (file maschera.ini) delle regle come quelle sottoesposte ;
RuleName(1) = Merce Cara
Rule(1) = PREZZO>1000|N
BgCol(1) = 0,192,192
FgCol(1) = 0,0,0
RuleName(2) = Merce Carissima
Rule(2) = PREZZO>10000|N
BgCol(2) = 0,0,192
FgCol(2) = 0,0,0
RuleName(3) = Riga vuota
Rule(3) = STR(TIPORIGA!="05")&&(QTA==0)&&(PREZZO==0)|N
BgCol(3) = 128,0,128
FgCol(3) = 255,255,255
I nnumeri di riga cominciano da 1, nella regola !N significa formula numerica, i colori sono definiti come r,g,b. Si possono utilizzare campi della maschera di riga (#id camop) DELLATESTATA (#-campo) della testata documento (33.nomecampo) della riga documeno (34.nome campo) e DIRTY che significa riga modificata
git-svn-id: svn://10.65.10.50/trunk@18205 c028cbd2-c16b-5b4b-a496-9718f37d4682
2009-02-05 14:39:36 +00:00
|
|
|
|
highlight();
|
|
|
|
|
}
|
2009-03-17 11:05:49 +00:00
|
|
|
|
}
|