Miriade di correzioni
git-svn-id: svn://10.65.10.50/branches/R_10_00@22913 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5def25b304
commit
eaf1f1a1a0
104
ve/clifor.cpp
104
ve/clifor.cpp
@ -37,7 +37,7 @@ int TCli_for::write_rewrite(TBaseisamfile& f, bool re) const
|
||||
if (err == NOERR)
|
||||
{
|
||||
TLocalisamfile v(LF_CFVEN);
|
||||
TRectype & v_rec = vendite();
|
||||
const TRectype& v_rec = vendite();
|
||||
err = v.write(v_rec);
|
||||
if (err == _isreinsert)
|
||||
err = v.write(v_rec);
|
||||
@ -50,17 +50,13 @@ TRectype& TCli_for::vendite() const
|
||||
const char t = tipo();
|
||||
const long c = codice();
|
||||
|
||||
if (_ven_rec.empty() || t != *(const char*)(*_ven_tipo) || c != (long)*_ven_codice)
|
||||
if (_ven_rec.empty() || t != _ven_rec.get_char(CFV_TIPOCF) || c != _ven_rec.get_long(CFV_CODCF))
|
||||
{
|
||||
TLocalisamfile v(LF_CFVEN);
|
||||
TRectype& vr = ((TCli_for *)this)->_ven_rec; // fool const
|
||||
|
||||
vr.zero();
|
||||
vr.put(CFV_TIPOCF,t);
|
||||
vr.put(CFV_CODCF, c);
|
||||
const TRectype v_rec(vr);
|
||||
if (vr.read(v) != NOERR)
|
||||
vr = v_rec;
|
||||
v.put(CFV_TIPOCF,t);
|
||||
v.put(CFV_CODCF, c);
|
||||
if (v.read() == NOERR)
|
||||
((TCli_for*)this)->_ven_rec = v.curr();
|
||||
}
|
||||
return (TRectype &) _ven_rec;
|
||||
}
|
||||
@ -164,10 +160,10 @@ int TCli_for::remove(TBaseisamfile& f) const
|
||||
|
||||
void TCli_for::init()
|
||||
{
|
||||
_tipo = new TRecfield(*this, CLI_TIPOCF);
|
||||
_codice = new TRecfield(*this, CLI_CODCF);
|
||||
_ven_tipo = new TRecfield(_ven_rec, CFV_TIPOCF);
|
||||
_ven_codice = new TRecfield(_ven_rec, CFV_CODCF);
|
||||
// _tipo = new TRecfield(*this, CLI_TIPOCF);
|
||||
// _codice = new TRecfield(*this, CLI_CODCF);
|
||||
// _ven_tipo = new TRecfield(_ven_rec, CFV_TIPOCF);
|
||||
// _ven_codice = new TRecfield(_ven_rec, CFV_CODCF);
|
||||
_use_lettere = main_app().has_module(LIAUT, CHK_DONGLE);
|
||||
if (_use_lettere)
|
||||
_use_lettere = ini_get_bool(CONFIG_DITTA, "ve", "USELETTERE");
|
||||
@ -179,35 +175,32 @@ const TString& TCli_for::find_listino_al(const TDate& datadoc) const
|
||||
const TRectype& v = vendite();
|
||||
TString4 listino = v.get(CFV_CODLIST);
|
||||
|
||||
TToken_string key_condv;
|
||||
key_condv = "L";
|
||||
if (gest_list_catven)
|
||||
key_condv.add(v.get(CFV_CATVEN));
|
||||
|
||||
//se il cliente ha un listino specificato -> va usato (previo controllo validità)
|
||||
while (listino.full())
|
||||
{
|
||||
TToken_string key_condv;
|
||||
key_condv.add("L");
|
||||
if (gest_list_catven)
|
||||
key_condv.add(v.get(CFV_CATVEN));
|
||||
else
|
||||
key_condv.add("");
|
||||
key_condv.add("");
|
||||
key_condv.add("");
|
||||
key_condv.add(listino);
|
||||
const TRectype& rec_condv = cache().get(LF_CONDV, key_condv);
|
||||
key_condv.add(listino, 4);
|
||||
|
||||
const TRectype& rec_condv = cache().get(LF_CONDV, key_condv);
|
||||
const TDate inizio_validita = rec_condv.get_date(CONDV_VALIN);
|
||||
const TDate fine_validita = rec_condv.get_date(CONDV_VALFIN);
|
||||
const TDate fine_validita = rec_condv.get_date(CONDV_VALFIN);
|
||||
|
||||
//usa il listino indicato sul cliente solo se è valido per la data del documento
|
||||
// usa il listino indicato sul cliente solo se è valido per la data del documento
|
||||
if (datadoc >= inizio_validita && (datadoc <= fine_validita || !fine_validita.ok()))
|
||||
break;
|
||||
else
|
||||
listino = rec_condv.get(CONDV_CODLISSUCC);
|
||||
|
||||
listino = rec_condv.get(CONDV_CODLISSUCC);
|
||||
}
|
||||
return get_tmp_string() = listino;
|
||||
}
|
||||
|
||||
void TCli_for::cli2doc(TDocumento& doc)
|
||||
{
|
||||
const TRectype & v = vendite();
|
||||
const TRectype& v = vendite();
|
||||
|
||||
doc.put(DOC_CODVAL, get(CLI_CODVAL));
|
||||
doc.put(DOC_CODLIN, get(CLI_CODLIN));
|
||||
@ -226,22 +219,18 @@ void TCli_for::cli2doc(TDocumento& doc)
|
||||
{
|
||||
doc.put(DOC_CODABIA, get(CLI_CODABI));
|
||||
doc.put(DOC_CODCABA, get(CLI_CODCAB));
|
||||
doc.put(DOC_IBAN, get(CLI_IBAN));
|
||||
doc.put(DOC_IBAN, get(CLI_IBAN));
|
||||
}
|
||||
else
|
||||
{
|
||||
doc.put(DOC_CODABIA, cfban.get(CFBAN_ABI));
|
||||
doc.put(DOC_CODCABA, cfban.get(CFBAN_CAB));
|
||||
doc.put(DOC_IBAN, get(CFBAN_IBAN));
|
||||
doc.put(DOC_IBAN, cfban.get(CFBAN_IBAN));
|
||||
}
|
||||
|
||||
key.cut(0);
|
||||
key.add(get(CLI_TIPOCF));
|
||||
key.add(get(CLI_CODCF));
|
||||
key.add("N");
|
||||
key.add("1");
|
||||
|
||||
const TRectype & cfbanpr = cache().get(LF_CFBAN, key);
|
||||
// Trasforma chiave da Vostra a Nostra banca
|
||||
key.add("N", 2);
|
||||
const TRectype& cfbanpr = cache().get(LF_CFBAN, key);
|
||||
|
||||
// Setta i campi che appartengono al file LF_CFVEN
|
||||
if (cfbanpr.empty())
|
||||
@ -255,29 +244,29 @@ void TCli_for::cli2doc(TDocumento& doc)
|
||||
doc.put(DOC_CODCABP, cfbanpr.get(CFBAN_CAB));
|
||||
doc.put(DOC_PROGBNP, cfbanpr.get(CFBAN_PROGPR));
|
||||
}
|
||||
doc.put(DOC_RAGGR, v.get(CFV_RAGGDOC));
|
||||
doc.put(DOC_RAGGREFF, v.get(CFV_RAGGEFF));
|
||||
doc.put(DOC_CODINDSP, v.get(CFV_CODINDSP));
|
||||
doc.put(DOC_CODAG, v.get(CFV_CODAG));
|
||||
doc.put(DOC_CODAGVIS, v.get(CFV_CODAG1));
|
||||
doc.put(DOC_RAGGR, v.get(CFV_RAGGDOC));
|
||||
doc.put(DOC_RAGGREFF, v.get(CFV_RAGGEFF));
|
||||
doc.put(DOC_CODINDSP, v.get(CFV_CODINDSP));
|
||||
doc.put(DOC_CODAG, v.get(CFV_CODAG));
|
||||
doc.put(DOC_CODAGVIS, v.get(CFV_CODAG1));
|
||||
doc.put(DOC_CODSPMEZZO, v.get(CFV_CODSPMEZZO));
|
||||
doc.put(DOC_CODPORTO, v.get(CFV_CODPORTO));
|
||||
doc.put(DOC_CODPORTO, v.get(CFV_CODPORTO));
|
||||
doc.put(DOC_CODNOTESP1, v.get(CFV_CODNOTESP1));
|
||||
doc.put(DOC_CODNOTESP2, v.get(CFV_CODNOTESP2));
|
||||
doc.put(DOC_CODNOTE, v.get(CFV_CODNOTE));
|
||||
doc.put(DOC_CODVETT1, v.get(CFV_CODVETT1));
|
||||
doc.put(DOC_CODVETT2, v.get(CFV_CODVETT2));
|
||||
doc.put(DOC_CODVETT3, v.get(CFV_CODVETT3));
|
||||
doc.put(DOC_PERCSPINC, v.get(CFV_PERCSPINC));
|
||||
doc.put(DOC_ADDBOLLI, v.get(CFV_ADDBOLLI));
|
||||
doc.put(DOC_CATVEN, v.get(CFV_CATVEN));
|
||||
doc.put(DOC_CODNOTE, v.get(CFV_CODNOTE));
|
||||
doc.put(DOC_CODVETT1, v.get(CFV_CODVETT1));
|
||||
doc.put(DOC_CODVETT2, v.get(CFV_CODVETT2));
|
||||
doc.put(DOC_CODVETT3, v.get(CFV_CODVETT3));
|
||||
doc.put(DOC_PERCSPINC, v.get(CFV_PERCSPINC));
|
||||
doc.put(DOC_ADDBOLLI, v.get(CFV_ADDBOLLI));
|
||||
doc.put(DOC_CATVEN, v.get(CFV_CATVEN));
|
||||
doc.put(DOC_LIQDIFF, get_int(CLI_ALLEG) == 7 && v.get_bool(CFV_FATTSOSP) ? "X" : "");
|
||||
|
||||
//listino: deve essere attiva la gestione listini nella ditta
|
||||
const bool gest_listini = ini_get_bool(CONFIG_DITTA, "ve", "GES", false, 1);
|
||||
if (gest_listini)
|
||||
{
|
||||
const TDate datadoc = doc.get_date(DOC_DATADOC);
|
||||
const TDate datadoc = doc.get_date(DOC_DATADOC);
|
||||
const TString& listino = find_listino_al(datadoc);
|
||||
doc.put(DOC_CODLIST, listino);
|
||||
}
|
||||
@ -308,15 +297,8 @@ TCli_for::TCli_for(const TRectype & rec) : TMultiple_rectype(rec), _ven_rec(LF_C
|
||||
|
||||
TCli_for::TCli_for(const TCli_for & c) : TMultiple_rectype(c), _ven_rec(c._ven_rec),
|
||||
_letint(LF_LETINT), _use_lettere(false), _lettera_found(false), _extended(false)
|
||||
{
|
||||
init();
|
||||
}
|
||||
{ init(); }
|
||||
|
||||
TCli_for::~TCli_for()
|
||||
{
|
||||
delete _tipo;
|
||||
delete _codice;
|
||||
delete _ven_tipo;
|
||||
delete _ven_codice;
|
||||
}
|
||||
{ }
|
||||
|
||||
|
17
ve/clifor.h
17
ve/clifor.h
@ -37,12 +37,7 @@ public:
|
||||
};
|
||||
|
||||
class TCli_for : public TMultiple_rectype
|
||||
{
|
||||
TRecfield * _tipo;
|
||||
TRecfield * _codice;
|
||||
TRecfield * _ven_tipo;
|
||||
TRecfield * _ven_codice;
|
||||
|
||||
{
|
||||
TRectype _ven_rec;
|
||||
TRectype _letint;
|
||||
TDate _last_data;
|
||||
@ -57,18 +52,18 @@ protected:
|
||||
public:
|
||||
bool read_lettera(const TDate & data, bool extended = false);
|
||||
bool occasionale() const { return get_bool(CLI_OCCAS); }
|
||||
TRectype & vendite() const;
|
||||
TRectype& vendite() const;
|
||||
bool use_lettere() const { return _use_lettere;}
|
||||
const TRectype & lettera() const { return _letint;}
|
||||
|
||||
char tipo() const { return *(const char *) (*_tipo); }
|
||||
long codice() const { return (long) *_codice; }
|
||||
bool ok() const { return !empty();}
|
||||
char tipo() const { return get_char(CLI_TIPOCF); }
|
||||
long codice() const { return get_long(CLI_CODCF); }
|
||||
bool ok() const { return !empty(); }
|
||||
|
||||
virtual int read(const TRectype& rec, word op = _isequal, word lockop = _nolock);
|
||||
int read(char tipo, long codice, word op = _isequal, word lockop = _nolock);
|
||||
virtual int remove(TBaseisamfile& f) const;
|
||||
void cli2doc(TDocumento & doc);
|
||||
void cli2doc(TDocumento& doc);
|
||||
const TString& find_listino_al(const TDate& datadoc) const;
|
||||
|
||||
TCli_for(char tipo = ' ', long codice = 0L);
|
||||
|
@ -1,3 +1,3 @@
|
||||
33
|
||||
0
|
||||
$doc|0|0|610|0|Documenti di vendita|||
|
||||
$doc|0|0|623|0|Documenti di vendita|||
|
||||
|
@ -1,5 +1,5 @@
|
||||
33
|
||||
93
|
||||
94
|
||||
CODNUM|1|4|0|Codice della numerazione
|
||||
ANNO|2|4|0|Anno
|
||||
PROVV|1|1|0|Tipo numerazione <P>rovvisorio <D>efinitivo
|
||||
@ -52,9 +52,9 @@ DATAPART|5|8|0|Data di partenza
|
||||
ORAPART|1|4|0|Ora di partenza
|
||||
IMPPAGATO|4|18|2|Importo pagato
|
||||
ACCSALDO|8|1|0|Saldato Si/No
|
||||
DOC1|1|12|0|Documento collegato 1
|
||||
DOC2|1|12|0|Documento collegato 2
|
||||
DOC3|1|12|0|Documento collegato 3
|
||||
DOC1|1|16|0|Documento collegato 1
|
||||
DOC2|1|16|0|Documento collegato 2
|
||||
DOC3|1|16|0|Documento collegato 3
|
||||
DATACONS|5|8|0|Data di consegna
|
||||
ASPBENI1|1|3|0|Aspetto beni 1
|
||||
ASPBENI2|1|3|0|Aspetto beni 2
|
||||
@ -93,6 +93,7 @@ CIG|1|10|0|Codice Identificativo di Gara
|
||||
CONTRATTO|1|18|0|Contratto con importo > 3000 Euro
|
||||
CONTSEP|1|6|0|Contabilita' separata
|
||||
MODPAG|2|1|0|Modalità di pagamento per contratto > 3000 Euro
|
||||
NOLEGGIO|1|1|0|Tipo noleggio (Spesometro)
|
||||
5
|
||||
PROVV+ANNO+CODNUM+NDOC|
|
||||
TIPOCF+CODCF+PROVV+ANNO+DATADOC+CODNUM+NDOC|X
|
||||
|
@ -1,3 +1,3 @@
|
||||
34
|
||||
0
|
||||
$rdoc|||572|0|Righe documenti di vendita|||
|
||||
$rdoc|||595|0|Righe documenti di vendita|||
|
||||
|
@ -1,5 +1,5 @@
|
||||
34
|
||||
61
|
||||
65
|
||||
CODNUM|1|4|0|Codice Numeriazione
|
||||
ANNO|2|4|0|Anno
|
||||
PROVV|1|1|0|Tipo numerazione <P>rovvisoria <D>efinitiva
|
||||
@ -61,6 +61,10 @@ CODAGG2|1|20|0|Codice aggiuntivo 2
|
||||
PRIORITY|3|7|0|Priorita' MSP
|
||||
TIPODET|1|1|0|Tipo detraibilità
|
||||
RG1|11|10|0|Campo memo per formule e campi virtuali
|
||||
DATAINIATT|5|8|0|Data inizio attività
|
||||
DATAFINATT|5|8|0|Data fine attività
|
||||
IDRIGACOLL|3|6|0|Identificatore riga documento collegata
|
||||
TIPOCOLL|1|1|0|Tipo legame riga collegata
|
||||
7
|
||||
CODNUM+ANNO+PROVV+NDOC+NRIGA|
|
||||
CODNUM+ANNO+PROVV+CODART+LIVELLO+CODMAG|X
|
||||
|
@ -91,7 +91,7 @@ bool TCond_vendita::cerca( int tiporicerca )
|
||||
if (codcont.blank())
|
||||
return false;
|
||||
_condv.put(CONDV_TIPO, "C");
|
||||
if(config_ditta.get_bool("GESCONCC", "ve"))
|
||||
if (config_ditta.get_bool("GESCONCC", "ve"))
|
||||
{
|
||||
_condv.put(CONDV_TIPOCF, clifo().tipo());
|
||||
_condv.put(CONDV_CODCF, clifo().codice());
|
||||
@ -114,10 +114,9 @@ bool TCond_vendita::cerca( int tiporicerca )
|
||||
break;
|
||||
case A_OFFERTE:
|
||||
{
|
||||
const TString16 codcamp(testa().get(F_CODCAMP));
|
||||
|
||||
if (codcamp.empty())
|
||||
return FALSE;
|
||||
const TString16 codcamp(testa().get(F_CODCAMP));
|
||||
if (codcamp.blank())
|
||||
return false;
|
||||
_condv.put(CONDV_TIPO, "O");
|
||||
_condv.put(CONDV_COD, codcamp);
|
||||
}
|
||||
|
@ -669,11 +669,11 @@ bool TMotore_application::user_create( )
|
||||
_msk = new TMask(query_mask_name());
|
||||
set_search_field(F_NDOC);
|
||||
|
||||
_msk->set_handler( F_ANNO, TDocumento_mask::anno_handler );
|
||||
_msk->set_handler( F_CODNUM, TDocumento_mask::num_handler );
|
||||
_msk->set_handler( F_NUMDOCRIF, TDocumento_mask::numdocrif_search_handler );
|
||||
_msk->set_handler( F_RAGSOCSEARCH, TDocumento_mask::ragsoc_search_handler );
|
||||
_msk->set_handler( F_NDOC, ndoc_handler );
|
||||
_msk->set_handler(F_ANNO, TDocumento_mask::anno_handler);
|
||||
_msk->set_handler(F_CODNUM, TDocumento_mask::num_handler);
|
||||
_msk->set_handler(F_NUMDOCRIF, TDocumento_mask::numdocrif_search_handler);
|
||||
_msk->set_handler(F_RAGSOCSEARCH, TDocumento_mask::ragsoc_search_handler);
|
||||
_msk->set_handler(F_NDOC, ndoc_handler);
|
||||
|
||||
const int args = argc() ;
|
||||
|
||||
@ -983,6 +983,8 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
msk.set(F_CODZON, ven_rec.get(CFV_CODZONA), true);
|
||||
if (!ini.exist(DOC_CODLIST))
|
||||
msk.set(F_CODLIST, ven_rec.get(CFV_CODLIST), true);
|
||||
if (!ini.exist(DOC_CODCONT) && ven_rec.get(CFV_GESTCONTR))
|
||||
((TDocumento_mask&)msk).contr2mask();
|
||||
|
||||
TSheet_field& f = msk.sfield(F_SHEET);
|
||||
|
||||
|
@ -150,18 +150,18 @@ BEGIN
|
||||
PROMPT 24 5 "Numero doc. "
|
||||
USE LF_DOC KEY 4
|
||||
INPUT TIPOCF F_TIPOCF_ELAB SELECT
|
||||
INPUT CODCF F_CODCF_ELAB SELECT
|
||||
INPUT PROVV F_PROVV_ELAB SELECT
|
||||
INPUT ANNO F_ANNO_ELAB SELECT
|
||||
INPUT CODCF F_CODCF_ELAB SELECT
|
||||
INPUT PROVV F_PROVV_ELAB SELECT
|
||||
INPUT ANNO F_ANNO_ELAB SELECT
|
||||
INPUT CODNUM F_CODNUM_ELAB
|
||||
INPUT NDOC F_NDOC_ELAB
|
||||
DISPLAY "Num." CODNUM
|
||||
DISPLAY "Anno" ANNO
|
||||
DISPLAY "Provv" PROVV
|
||||
DISPLAY "Tipo" TIPODOC
|
||||
DISPLAY "N.Doc. " NDOC
|
||||
DISPLAY "N.Doc.@7" NDOC
|
||||
DISPLAY "Stato" STATO
|
||||
DISPLAY "Data\ndocumento" DATADOC
|
||||
DISPLAY "Data\ndocumento@10" DATADOC
|
||||
OUTPUT F_DATADOC_ELAB DATADOC
|
||||
OUTPUT F_CODNUM_ELAB CODNUM
|
||||
OUTPUT F_NDOC_ELAB NDOC
|
||||
|
@ -382,12 +382,12 @@ void TFatturazione_bolle_app::main_loop()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (select_from == "D")
|
||||
process_by_doc(m);
|
||||
else
|
||||
process_by_cli(m);
|
||||
}
|
||||
}
|
||||
if (select_from == "D")
|
||||
process_by_doc(m);
|
||||
else
|
||||
process_by_cli(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ Item_02 = "Documenti", <vemenu.men>
|
||||
Item_03 = "Effetti", <efmenu.men>
|
||||
Item_04 = "Provvigioni agenti", <prmenu.men>
|
||||
Item_05 = "Ordini", <ormenu.men>
|
||||
Item_06 = "Contabilita' Industriale", <cimenu.men>
|
||||
Item_06 = "Contabilità Industriale", <cimenu.men>
|
||||
Item_07 = "Statistiche di vendita", <svmenu.men>
|
||||
Item_08 = "Servizi", [ACQVEN_021]
|
||||
Item_09 = "Configurazione", [ACQVEN_020]
|
||||
@ -46,8 +46,8 @@ Flags = ""
|
||||
Item_01 = "Categorie vendita", "ba3 -0 CVE", "F"
|
||||
Item_02 = "Note cliente", "cg0 -5 %NOT", ""
|
||||
Item_03 = "Note documento", "ba3 -0 %NDO", ""
|
||||
Item_04 = "Modalita' di spedizione", "ba3 -0 %MSP", ""
|
||||
Item_05 = "Modalita' di consegna", "ba3 -0 %POR", ""
|
||||
Item_04 = "Modalità di spedizione", "ba3 -0 %MSP", ""
|
||||
Item_05 = "Modalità di consegna", "ba3 -0 %POR", ""
|
||||
Item_06 = "Causali di trasporto", "ba3 -0 %CTR", ""
|
||||
Item_07 = "Aspetto dei beni", "ve0 -4 %ABE", ""
|
||||
Item_08 = "Vettori", "ba3 -0 %VET", ""
|
||||
@ -61,6 +61,7 @@ Item_15 = "Fatture da emettere/ricevere", "ve0 -6 &MRE", "F"
|
||||
Item_16 = "Conti ricavo dei materiali", "ve0 -6 &CMT", "F"
|
||||
Item_17 = "Sottocategorie CONAI", "ve0 -6 &SCC", "F"
|
||||
Item_18 = "Note articolo", "ve0 -4 NAR", "F"
|
||||
Item_19 = "Operatori", "ve0 -4 DIP", "F"
|
||||
|
||||
[ACQVEN_005]
|
||||
Caption = "Tabelle contabili"
|
||||
@ -68,7 +69,7 @@ Picture = <ve00>
|
||||
Module = 0
|
||||
Flags = ""
|
||||
Item_01 = "Codici IVA", "ba3 -0 %IVA", ""
|
||||
Item_02 = "Codici indetraibilita'", "ba3 -0 %DET", ""
|
||||
Item_02 = "Codici indetraibilità", "ba3 -0 %DET", ""
|
||||
Item_03 = "Condizioni pagamento", "ba3 -6", ""
|
||||
Item_04 = "Classificazione pagamento", "ba3 -0 %CLR", ""
|
||||
Item_05 = "Categorie contabili C/F", "ba3 -0 CCO", "F"
|
||||
@ -88,7 +89,7 @@ Module = 0
|
||||
Flags = ""
|
||||
Item_01 = "Gruppi merceologici", "ve0 -4 GMC", "F"
|
||||
Item_02 = "Magazzini e depositi", "mg0 -0 MAG", "F"
|
||||
Item_03 = "Unita' di misura", "ve0 -4 %UMS", ""
|
||||
Item_03 = "Unità di misura", "ve0 -4 %UMS", ""
|
||||
Item_04 = "Province d'origine", "ve0 -4 %PRV", ""
|
||||
Item_05 = "Classi fiscali articoli", "ve0 -4 ASF", "F"
|
||||
Item_06 = "Categorie ricavi articoli", "ve0 -4 CRA", "F"
|
||||
@ -119,8 +120,8 @@ Flags = ""
|
||||
Item_01 = "Categorie vendita", "ba3 -1 CVE", "F"
|
||||
Item_02 = "Note cliente", "ba3 -1 %NOT", ""
|
||||
Item_03 = "Note documento", "ba3 -1 %NDO", ""
|
||||
Item_04 = "Modalita' di spedizione", "ba3 -1 %MSP", ""
|
||||
Item_05 = "Modalita' di consegna", "ba3 -1 %POR", ""
|
||||
Item_04 = "Modalità di spedizione", "ba3 -1 %MSP", ""
|
||||
Item_05 = "Modalità di consegna", "ba3 -1 %POR", ""
|
||||
Item_06 = "Causali di trasporto", "ba3 -1 %CTR", ""
|
||||
Item_07 = "Aspetto dei beni", "ba3 -1 %ABE", ""
|
||||
Item_08 = "Vettori", "ba3 -1 %VET", ""
|
||||
@ -155,7 +156,7 @@ Module = 0
|
||||
Flags = ""
|
||||
Item_01 = "Gruppi merceologici", "ba3 -1 GMC", "F"
|
||||
Item_02 = "Magazzini e depositi", "ba3 -1 MAG", "F"
|
||||
Item_03 = "Unita' di misura", "ba3 -1 %UMS", ""
|
||||
Item_03 = "Unità di misura", "ba3 -1 %UMS", ""
|
||||
Item_04 = "Classi fiscali e articoli", "ba3 -1 ASF", "F"
|
||||
Item_05 = "Categorie ricavi articoli", "ba3 -1 CRA", "F"
|
||||
Item_06 = "Categorie acquisti articoli", "ba3 -1 CAA", "F"
|
||||
@ -210,7 +211,7 @@ Item_05 = "Contabilizzazione", "ve0 -2 -5", "F"
|
||||
Item_06 = "Conti per categoria e gruppo", "ve0 -6 &CVM", "F"
|
||||
Item_07 = "Gestione spese e bolli", "ve0 -2 -6", "F"
|
||||
Item_08 = "Articoli e Distinte", "ve0 -2 -7", "F"
|
||||
Item_09 = "Configurazione contabilita'", "cg5 -1", "F"
|
||||
Item_09 = "Configurazione contabilità", "cg5 -1", "F"
|
||||
Item_10 = "Fido cliente", "ve0 -2 -8", "F"
|
||||
|
||||
[ACQVEN_021]
|
||||
@ -258,8 +259,8 @@ Module = 0
|
||||
Flags = ""
|
||||
Item_01 = "Tabella studio per invio", "cg6 -4 %INS", "F"
|
||||
Item_02 = "Tabella ditta per invio", "cg6 -4 %IND", "F"
|
||||
Item_03 = "Invio contabilita' a sistema", "cg6 -8 S", "F"
|
||||
Item_04 = "Invio contabilita' a PC", "cg6 -8 P", "F"
|
||||
Item_03 = "Invio contabilità a sistema", "cg6 -8 S", "F"
|
||||
Item_04 = "Invio contabilità a PC", "cg6 -8 P", "F"
|
||||
Item_05 = "Ripristino movimenti da inviare", "cg6 -8 R", "F"
|
||||
Item_06 = "Eliminazione file invio", "cg6 -8 C", "FP"
|
||||
|
||||
|
@ -209,7 +209,7 @@ class TTipo_documento : public TRectype // velib03
|
||||
TString_array _keys_descrs; // Tipi riga per listbox
|
||||
TString_array _defaults; // Defaults per i campi della maschera
|
||||
TString_array _sheet_columns; // Colonne dello spreadsheet
|
||||
TString_array _handlers; // Handlers
|
||||
TPointer_array _handlers; // _handlers[fieldid] = HandlerNum
|
||||
TString16 _imponibile;
|
||||
TString16 _imposta;
|
||||
TString16 _totale;
|
||||
@ -251,7 +251,7 @@ public:
|
||||
void set_defaults(TMask& m) const;
|
||||
const TString_array& keys_descrs() const;
|
||||
const TString_array& sheet_columns() const;
|
||||
const TString_array& handlers() const;
|
||||
const TPointer_array& handlers() const;
|
||||
|
||||
const TString& mask_name() const;
|
||||
const TString& causale() const { return get("S6"); }
|
||||
@ -1024,7 +1024,8 @@ public:
|
||||
TCond_vendita & condv() const;
|
||||
|
||||
void occ2mask();
|
||||
void cli2mask(bool force_load = false);
|
||||
void contr2mask(); // Proposta contratto
|
||||
void cli2mask(bool force_load = false);
|
||||
virtual void doc2mask(bool reload_clifo = true, bool force_load = false, bool update = true);
|
||||
void mask2doc();
|
||||
|
||||
|
@ -173,6 +173,7 @@ TSpesa_prest::TSpesa_prest(const char* codice, char tipo)
|
||||
if (codice && *codice)
|
||||
{
|
||||
const int err = read(codice);
|
||||
/*
|
||||
#ifdef DBG
|
||||
if (err != NOERR)
|
||||
switch (tipo)
|
||||
@ -194,7 +195,7 @@ TSpesa_prest::TSpesa_prest(const char* codice, char tipo)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <doc.h>
|
||||
#include "../cg/cg2103.h"
|
||||
#include "../db/dblib.h"
|
||||
#include "../pr/prlib.h"
|
||||
@ -18,8 +17,9 @@
|
||||
#include "vepriv.h"
|
||||
#include "veuml.h"
|
||||
|
||||
#include <clifo.h>
|
||||
#include <cfven.h>
|
||||
//#include <doc.h>
|
||||
//#include <clifo.h>
|
||||
//#include <cfven.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTipo_documento_cache
|
||||
@ -1160,7 +1160,7 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
||||
{
|
||||
char name[8] = "CODSP0";
|
||||
TString_array spese;
|
||||
const TRectype & ven_rec = clifor().vendite();
|
||||
const TRectype& ven_rec = clifor().vendite();
|
||||
for (int i = 1; i <= 4; i++)
|
||||
{
|
||||
name[5] = '0' + i;
|
||||
@ -1173,11 +1173,13 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
||||
myself.update_conai();
|
||||
myself.update_raee();
|
||||
myself.set_row_ids();
|
||||
myself.put(DOC_UTENTE, user());
|
||||
myself.put(DOC_DATAAGG, TDate(TODAY));
|
||||
|
||||
const bool check_movmag = _has_mag && tipo().mov_mag();
|
||||
if (check_movmag)
|
||||
{
|
||||
const bool do_movmag = tipo().stato_with_mov_mag(stato_doc) && get(DOC_CAUSMAG).not_empty();
|
||||
const bool do_movmag = tipo().stato_with_mov_mag(stato_doc) && get(DOC_CAUSMAG).full();
|
||||
long num_movmag = get_long(DOC_MOVMAG);
|
||||
bool diff_inv = get_bool("DIFFINV");
|
||||
|
||||
@ -1471,20 +1473,25 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
||||
r.checked();
|
||||
}
|
||||
}
|
||||
if (r.is_evadibile() && is_ordine())
|
||||
if (r.is_evadibile() && datacons.ok()) // on 27-9-2013 was if (r.is_evadibile() && is_ordine())
|
||||
{
|
||||
docevaso &= r.is_evasa();
|
||||
const TDate dcons = r.get_date(RDOC_DATACONS);
|
||||
if (!dcons.ok())
|
||||
r.put(RDOC_DATACONS, datacons);
|
||||
}
|
||||
|
||||
|
||||
/* dal 27-9-2013 considero singolarmente i campi di analitica replicati sulle righe
|
||||
if (r.get(RDOC_CODCMS).blank() && r.get(RDOC_FASCMS).blank() && r.get(RDOC_CODCOSTO).blank())
|
||||
{
|
||||
r.put(RDOC_CODCMS, codcms);
|
||||
r.put(RDOC_FASCMS, fascms);
|
||||
r.put(RDOC_CODCOSTO, codcos);
|
||||
}
|
||||
*/
|
||||
if (r.get(RDOC_CODCMS).blank()) r.put(RDOC_CODCMS, codcms);
|
||||
if (r.get(RDOC_FASCMS).blank()) r.put(RDOC_FASCMS, fascms);
|
||||
if (r.get(RDOC_CODCOSTO).blank()) r.put(RDOC_CODCOSTO, codcos);
|
||||
}
|
||||
if (is_ordine())
|
||||
((TDocumento *)this)->put(DOC_DOCEVASO, docevaso); // Tutte le righe evase -> doc evaso
|
||||
@ -1848,7 +1855,7 @@ TRiga_documento & TDocumento::row(int index)
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECKD((index == nrows + 1 && (_sconto != NULL || _esenzione != NULL)) || (index == nrows + 2 && _sconto != NULL && _esenzione != NULL),
|
||||
CHECKD((index == nrows + 1 && (_sconto != NULL || _esenzione != NULL)) || (index == nrows + 2 && _sconto != NULL && _esenzione != NULL),
|
||||
"Riga documento non esistente ", index);
|
||||
if (index == nrows + 1)
|
||||
{
|
||||
@ -1862,8 +1869,8 @@ TRiga_documento & TDocumento::row(int index)
|
||||
|
||||
const TRiga_documento& TDocumento::physical_row(int index) const
|
||||
{
|
||||
TRecord_array & b = body();
|
||||
return (TRiga_documento&)b.row(index, FALSE);
|
||||
TRecord_array& b = body();
|
||||
return (TRiga_documento&)b.row(index, false);
|
||||
}
|
||||
|
||||
long TDocumento::get_next_key(char provv, int anno, const char* codnum) const
|
||||
@ -2073,8 +2080,7 @@ void TDocumento::calc_iva_fattura_commerciale()
|
||||
for (k = 0; k < MAX_IVA_SLICES; k++)
|
||||
{
|
||||
TString16 cod(tabella_ripartizione.row(k).get(1));
|
||||
cod.trim();
|
||||
|
||||
cod.trim();
|
||||
if (cod.empty())
|
||||
continue;
|
||||
|
||||
@ -2086,9 +2092,9 @@ void TDocumento::calc_iva_fattura_commerciale()
|
||||
table.add(cod, rp);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 7; j++)
|
||||
for (int j = 0; j < tda.items(); j++)
|
||||
{
|
||||
TDistrib& td = (TDistrib&) tda[j];
|
||||
TDistrib& td = (TDistrib&)tda[j];
|
||||
const real rr = td.get();
|
||||
|
||||
switch (j)
|
||||
@ -2237,8 +2243,7 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
||||
{
|
||||
FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
|
||||
{
|
||||
TRiepilogo_iva * aliquota = (TRiepilogo_iva *) o;
|
||||
|
||||
TRiepilogo_iva* aliquota = (TRiepilogo_iva*)o;
|
||||
d.add(aliquota->imp() - aliquota->imp_spese_row());
|
||||
}
|
||||
}
|
||||
@ -2437,23 +2442,19 @@ real TDocumento::totale_netto() const
|
||||
real TDocumento::basesconto() const
|
||||
{
|
||||
const TString& field = tipo().basesconto();
|
||||
|
||||
if (field.not_empty())
|
||||
return get_real(field);
|
||||
else
|
||||
return ZERO;
|
||||
return field.full() ? get_real(field) : ZERO;
|
||||
}
|
||||
|
||||
real TDocumento::spese() const
|
||||
{
|
||||
const TString& field = tipo().spese();
|
||||
return field.not_empty() ? get_real(field) : ZERO;
|
||||
return field.full() ? get_real(field) : ZERO;
|
||||
}
|
||||
|
||||
real TDocumento::ritenute(const char tipo, bool lordo, int ndec) const
|
||||
{
|
||||
real val;
|
||||
for (int i = rows() ; i > 0; i--)
|
||||
for (int i = rows(); i > 0; i--)
|
||||
{
|
||||
const TRiga_documento& r = operator[](i);
|
||||
val += r.ritenuta(tipo, lordo, ndec);
|
||||
@ -2632,7 +2633,8 @@ TRectype & TDocumento::operator =(const char * r)
|
||||
}
|
||||
|
||||
TRecord_array& TDocumento::body(int logicnum) const
|
||||
{
|
||||
{
|
||||
logicnum = LF_RIGHEDOC; // logicnum may be 0!
|
||||
const bool reset_data_cons = loaded_rows(logicnum) == 0;
|
||||
|
||||
if (reset_data_cons)
|
||||
@ -2646,7 +2648,8 @@ TRecord_array& TDocumento::body(int logicnum) const
|
||||
const TString80 codcms(get(DOC_CODCMS));
|
||||
const TString80 fascms(get(DOC_FASCMS));
|
||||
const TString80 codcos(get(DOC_CODCOSTO));
|
||||
const bool order = is_ordine();
|
||||
const bool order = datacons.ok(); // on 27-09-2013 was order=is_ordine();
|
||||
const bool can_reset_ca = (codcms.full() || codcos.full()) && ini_get_string(CONFIG_DITTA, "ca", "FathFasi").blank();
|
||||
|
||||
for (int i = r.last_row(); i > 0; i = r.pred_row(i))
|
||||
{
|
||||
@ -2654,14 +2657,14 @@ TRecord_array& TDocumento::body(int logicnum) const
|
||||
TRecfield dcons(rec, RDOC_DATACONS);
|
||||
if (order && datacons == dcons)
|
||||
dcons = "";
|
||||
TRecfield ccms(rec, RDOC_CODCMS);
|
||||
TRecfield fcms(rec, RDOC_FASCMS);
|
||||
TRecfield ccos(rec, RDOC_CODCOSTO);
|
||||
if (codcms == ccms && fascms == fcms && codcos == ccos)
|
||||
if (can_reset_ca)
|
||||
{
|
||||
ccms = "";
|
||||
fcms = "";
|
||||
ccos = "";
|
||||
TRecfield ccms(rec, RDOC_CODCMS);
|
||||
TRecfield fcms(rec, RDOC_FASCMS);
|
||||
TRecfield ccos(rec, RDOC_CODCOSTO);
|
||||
if (codcms == ccms) ccms = "";
|
||||
if (fascms == fcms) fcms = "";
|
||||
if (codcos == ccos) ccos = "";
|
||||
}
|
||||
}
|
||||
((TDocumento*)this)->_dirty_deny = false;
|
||||
@ -2749,7 +2752,7 @@ void TDocumento::update_raee()
|
||||
r1.put(RDOC_PREZZOL, tax);
|
||||
}
|
||||
r1.generata();
|
||||
r1.put("GENTIPO", "R");
|
||||
r1.put(RDOC_GENTIPO, "R");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2772,7 +2775,7 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
|
||||
for (i = nrows; i > 0; i--)
|
||||
{
|
||||
TRiga_documento & r = row(i);
|
||||
bool tipo_spese = r.get("GENTIPO").empty();
|
||||
bool tipo_spese = r.get(RDOC_GENTIPO).empty();
|
||||
|
||||
if (r.tipo().tipo() == RIGA_SPESEDOC && r.is_generata() && tipo_spese)
|
||||
{
|
||||
@ -3048,8 +3051,8 @@ int TDocumento::set_row_ids()
|
||||
{
|
||||
const int phrw = physical_rows();
|
||||
long maxid = 0L;
|
||||
int first_needed = 0, r;
|
||||
for (r = 1; r <= phrw; r++)
|
||||
int first_needed = 0;
|
||||
for (int r = 1; r <= phrw; r++)
|
||||
{
|
||||
const TRiga_documento& row = physical_row(r);
|
||||
const long id = row.get_long(RDOC_IDRIGA);
|
||||
@ -3057,13 +3060,13 @@ int TDocumento::set_row_ids()
|
||||
maxid = id;
|
||||
else
|
||||
{
|
||||
if (first_needed == 0)
|
||||
if (first_needed == 0 && id <= 0)
|
||||
first_needed = r;
|
||||
}
|
||||
}
|
||||
if (first_needed > 0)
|
||||
{
|
||||
for (r = first_needed; r <= phrw; r++)
|
||||
for (int r = first_needed; r <= phrw; r++)
|
||||
{
|
||||
TRiga_documento& row = (TRiga_documento&)physical_row(r);
|
||||
const long id = row.get_long(RDOC_IDRIGA);
|
||||
|
@ -273,19 +273,35 @@ const TString_array& TTipo_documento::sheet_columns() const
|
||||
return _sheet_columns;
|
||||
}
|
||||
|
||||
const TString_array& TTipo_documento::handlers() const
|
||||
const TPointer_array& TTipo_documento::handlers() const
|
||||
{
|
||||
if (_handlers.empty())
|
||||
{
|
||||
TFilename pn; profile_name(pn);
|
||||
TConfig prof(pn, "HANDLERS");
|
||||
|
||||
for (int i = 0; ; i++)
|
||||
TAssoc_array& v = prof.list_variables();
|
||||
TToken_string pair;
|
||||
FOR_EACH_ASSOC_STRING(v, h, k, s)
|
||||
{
|
||||
const TString & h = prof.get("Handler", NULL, i);
|
||||
if (h.empty())
|
||||
break;
|
||||
((TString_array &)_handlers).add(h);
|
||||
int id = 0, hnd = 0;
|
||||
pair = s;
|
||||
switch (pair.items())
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
const TFixed_string key(k);
|
||||
id = atoi(key.after('('));
|
||||
hnd = atoi(pair);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
id = pair.get_int(0);
|
||||
hnd = pair.get_int();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
if (id > 100 && id < 1000 && hnd > 0)
|
||||
((TPointer_array&)_handlers).add_long(hnd, id);
|
||||
}
|
||||
}
|
||||
return _handlers;
|
||||
@ -434,10 +450,10 @@ bool TTipo_documento::stato_with_mov_mag(const char stato) const
|
||||
{
|
||||
if (!mov_mag())
|
||||
return false;
|
||||
const char stato_finale(stato_mov_finale());
|
||||
const char stato_finale = stato_mov_finale();
|
||||
if (stato_finale > ' ' && stato > stato_finale)
|
||||
return false;
|
||||
const char stato_iniziale(stato_mov_iniziale());
|
||||
const char stato_iniziale = stato_mov_iniziale();
|
||||
return stato >= stato_iniziale;
|
||||
}
|
||||
|
||||
|
@ -263,6 +263,7 @@ protected:
|
||||
virtual bool da_raggruppare(const TRiga_documento & rin) { return true; }
|
||||
virtual void elabora_riga(TRiga_documento& r, TDocumento& doc_out, bool usa_dcons, bool ragg_rig, bool ignora_desc,
|
||||
TToken_string & campi_riga, const TDate & dcons, const TDate & ddoc);
|
||||
void init();
|
||||
|
||||
public:
|
||||
virtual bool raggruppa(TDocumento& din, TDocumento& dout);
|
||||
|
@ -1,37 +1,34 @@
|
||||
#include <cfven.h>
|
||||
#include "velib04.h"
|
||||
|
||||
#include <dongle.h>
|
||||
#include <modaut.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TFatturazione bolle
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TFatturazione_bolle::TFatturazione_bolle(const char* cod)
|
||||
: TElaborazione(cod)
|
||||
void TFatturazione_bolle::init()
|
||||
{
|
||||
TString80 name; name.format("AGGFLD(%s)", cod);
|
||||
// Attenzione: uso il TConfig perchè con varibili del tipo AGGFLD(FATPROV) la ini_get_string() NON funziona bene
|
||||
TConfig ini(CONFIG_DITTA, "ve");
|
||||
|
||||
_lista_campi = ini_get_string(CONFIG_DITTA, "ve", name);
|
||||
const char* cod = get("CODTAB");
|
||||
TString80 name;
|
||||
|
||||
name.format("AGGFLD(%s)", cod);
|
||||
_lista_campi = ini.get(name);
|
||||
|
||||
name.format("ROWSORT(%s)", cod);
|
||||
_rowsort = ini_get_string(CONFIG_DITTA, "ve", name);
|
||||
_impminfat = real(ini_get_string(CONFIG_DITTA, "ve", "IMPMINFAT"));
|
||||
_rowsort = ini.get(name);
|
||||
_impminfat = real(ini.get("IMPMINFAT"));
|
||||
}
|
||||
|
||||
TFatturazione_bolle::TFatturazione_bolle(const char* cod)
|
||||
: TElaborazione(cod)
|
||||
{ init(); }
|
||||
|
||||
TFatturazione_bolle::TFatturazione_bolle(const TRectype& rec)
|
||||
: TElaborazione(rec)
|
||||
{
|
||||
const TString8 cod = rec.get("CODTAB");
|
||||
TString80 name; name.format("AGGFLD(%s)", cod);
|
||||
|
||||
_lista_campi = ini_get_string(CONFIG_DITTA, "ve", name);
|
||||
|
||||
name.format("ROWSORT(%s)", cod);
|
||||
_rowsort = ini_get_string(CONFIG_DITTA, "ve", name);
|
||||
_impminfat = real(ini_get_string(CONFIG_DITTA, "ve", "IMPMINFAT"));
|
||||
}
|
||||
{ init(); }
|
||||
|
||||
void TFatturazione_bolle::campi_raggruppamento_righe(TToken_string& campi_riga) const
|
||||
{
|
||||
@ -347,10 +344,10 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
const TDate& data_elab, bool interattivo)
|
||||
{
|
||||
TWait_cursor hourglass;
|
||||
TToken_string campi_doc(128); // Lista di campi che devono essere uguali
|
||||
TBit_array closed;
|
||||
TArray docrefs;
|
||||
|
||||
TToken_string campi_doc(128); // Lista di campi che devono essere uguali
|
||||
campi_raggruppamento(campi_doc);
|
||||
|
||||
pre_process_input(doc_in);
|
||||
@ -380,17 +377,16 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
}
|
||||
if (_lista_campi.full())
|
||||
{
|
||||
const TCli_for& cf = campione.clifor(true);
|
||||
TToken_string s("", '=');
|
||||
for (s = _lista_campi.get(0); s.full(); s = _lista_campi.get())
|
||||
{
|
||||
const TString16 oname(s.get());
|
||||
TString16 iname(s.get());
|
||||
const TString16 oname = s.get();
|
||||
TString16 iname = s.get();
|
||||
|
||||
if (oname == RDOC_CODIVA)
|
||||
{
|
||||
const int rows = campione.physical_rows();
|
||||
const TString4 codesiva = campione.codesiva();
|
||||
|
||||
const TString4 codesiva = campione.codesiva();
|
||||
FOR_EACH_PHYSICAL_RDOC(campione, i, rdoc)
|
||||
{
|
||||
// Elabora solo righe articolo, spese o prestazioni valide
|
||||
@ -425,15 +421,17 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iname.blank())
|
||||
iname = oname;
|
||||
if (iname.starts_with("17."))
|
||||
campione.put(oname, campione.clifor().vendite().get(iname.mid(3)));
|
||||
else
|
||||
if (iname.starts_with("CFVEN."))
|
||||
campione.put(oname, campione.clifor().vendite().get(iname.mid(6)));
|
||||
else
|
||||
campione.put(oname, campione.clifor().get(iname));
|
||||
if (iname.starts_with("17.") || iname.starts_with("CFVEN."))
|
||||
{
|
||||
const TString& sfld = iname.after('.');
|
||||
const TString& sval = cf.vendite().get(sfld);
|
||||
campione.put(oname, sval);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iname.blank()) iname = oname;
|
||||
campione.put(oname, cf.get(iname));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1243,7 +1243,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
}
|
||||
|
||||
// Codice pagamento
|
||||
const TString4 codpag(doc.get(DOC_CODPAG));
|
||||
const TString4 codpag = doc.get(DOC_CODPAG);
|
||||
if (sc_enabled(data_reg) || codpag.full()) // La condizione di pagamento va controllata
|
||||
{ // se e' abilitato il saldaconto o se e' stata inserita
|
||||
_cpg->put("CODTAB",codpag);
|
||||
@ -1271,8 +1271,10 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
mov_rec.put(MOV_NUMDOC,numdoc);
|
||||
}
|
||||
mov_rec.put(MOV_TIPODOC,_caus->tipo_doc());
|
||||
mov_rec.put(MOV_CODCAUS,_caus->codice()); mov_rec.put(MOV_DESCR, descr);
|
||||
mov_rec.put(MOV_TIPOMOV,char(_caus->tipomov()+'0')); mov_rec.put(MOV_ANNOIVA,data_reg.year());
|
||||
mov_rec.put(MOV_CODCAUS,_caus->codice());
|
||||
mov_rec.put(MOV_DESCR, descr);
|
||||
mov_rec.put(MOV_TIPOMOV,char(_caus->tipomov()+'0'));
|
||||
mov_rec.put(MOV_ANNOIVA,data_reg.year());
|
||||
mov_rec.put(MOV_CODVAL,codval);
|
||||
mov_rec.put(MOV_CAMBIO,cambio);
|
||||
mov_rec.put(MOV_DATACAM,datacam);
|
||||
@ -1418,8 +1420,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
mov_rec.put(MOV_DNDOC, doc.get(DOC_NDOC));
|
||||
mov_rec.put(MOV_LIQDIFF, doc.get(DOC_LIQDIFF));
|
||||
mov_rec.put(MOV_IVAXCASSA, doc.get(DOC_IVAXCASSA));
|
||||
mov_rec.put(MOV_CONTRATTO, doc.get(DOC_CONTRATTO));
|
||||
mov_rec.put(MOV_MODPAG, doc.get(DOC_MODPAG));
|
||||
mov_rec.put(MOV_NOLEGGIO, doc.get(DOC_NOLEGGIO));
|
||||
mov_rec.put(MOV_CONTSEP, doc.get(DOC_CONTSEP));
|
||||
|
||||
return _error;
|
||||
@ -1494,8 +1495,8 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
|
||||
cod_num.complete_num(doc.numero(), numdoc);
|
||||
if (acquisto)
|
||||
{
|
||||
TString16 numdocrif(doc.get(DOC_NUMDOCRIF));
|
||||
if (numdocrif.not_empty())
|
||||
const TString& numdocrif = doc.get(DOC_NUMDOCRIF);
|
||||
if (numdocrif.full())
|
||||
numdoc = numdocrif;
|
||||
}
|
||||
|
||||
@ -1532,7 +1533,7 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
|
||||
}
|
||||
|
||||
const TString16 rif = doc.get(DOC_NUMDOCRIF);
|
||||
const bool use_rif = _caus->iva() == iva_acquisti && rif.not_empty();
|
||||
const bool use_rif = _caus->iva() == iva_acquisti && rif.full();
|
||||
if (use_rif)
|
||||
{
|
||||
descr << "n. " << rif;
|
||||
@ -1605,8 +1606,7 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
|
||||
mov_rec.put(MOV_DNDOC, doc.get(DOC_NDOC));
|
||||
mov_rec.put(MOV_LIQDIFF, doc.get(DOC_LIQDIFF));
|
||||
mov_rec.put(MOV_IVAXCASSA, doc.get(DOC_IVAXCASSA));
|
||||
mov_rec.put(MOV_CONTRATTO, doc.get(DOC_CONTRATTO));
|
||||
mov_rec.put(MOV_MODPAG, doc.get(DOC_MODPAG));
|
||||
mov_rec.put(MOV_NOLEGGIO, doc.get(DOC_NOLEGGIO));
|
||||
mov_rec.put(MOV_CONTSEP, doc.get(DOC_CONTSEP));
|
||||
|
||||
|
||||
@ -1616,11 +1616,11 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
|
||||
error_type TContabilizzazione::search_costo_ricavo(TBill& conto, const TRiga_documento& r, real & amount_to_split, const real & valore)
|
||||
{
|
||||
const int items = _search_seq->items();
|
||||
TLocalisamfile & cli_file = _clifo->lfile(); // YES, arriva qui dentro quando la relazione e' gia' posizionata
|
||||
const TRectype& cli_file = _clifo->curr(); // YES, arriva qui dentro quando la relazione e' gia' posizionata
|
||||
const bool is_cli = cli_file.get_char(CLI_TIPOCF) != 'F';
|
||||
bool skip_art_related = false;
|
||||
bool skip_clifo = _clifo->bad();
|
||||
TCodiceIVA codiva(r.get(RDOC_CODIVA));
|
||||
const TCodiceIVA codiva(r.get(RDOC_CODIVA));
|
||||
|
||||
const char t = r.tipo().tipo();
|
||||
switch (t)
|
||||
@ -2149,7 +2149,7 @@ error_type TContabilizzazione::create_iva_rows(TDocumento& doc)
|
||||
imponibile = cur.get_real(RMI_IMPONIBILE);
|
||||
imposta = cur.get_real(RMI_IMPOSTA);
|
||||
|
||||
if (in_valuta) // I documenti vanno sempre contabilizzati in lire
|
||||
if (in_valuta) // I documenti vanno sempre contabilizzati in Euro
|
||||
{
|
||||
TCurrency_documento imponval(imponibile, doc);
|
||||
imponval.change_to_firm_val();
|
||||
@ -2291,11 +2291,9 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
||||
TString4 tiporiga, codiva1, codiva2;
|
||||
const int rows = doc.rows();
|
||||
const int ndec = doc.decimals();
|
||||
real amount_to_split;
|
||||
|
||||
|
||||
const bool fat_com = doc.tipo().fattura_commerciale();
|
||||
|
||||
real amount_to_split;
|
||||
static TString_array tabella_ripartizione;
|
||||
if (fat_com && tabella_ripartizione.empty())
|
||||
{
|
||||
@ -3709,8 +3707,7 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
||||
_error = intra_rett_error;
|
||||
display_error(doc);
|
||||
_error = no_error;
|
||||
|
||||
return _error; // Non posso fare movimenti ma devo fare rettifiche
|
||||
return _error; // Non posso fare movimenti, ma devo fare rettifiche
|
||||
}
|
||||
}
|
||||
|
||||
@ -4209,8 +4206,6 @@ error_type TContabilizzazione::write_regolarizzazione(const TDocumento& doc, TMo
|
||||
}
|
||||
|
||||
const TCli_for& clifor = doc.clifor();
|
||||
|
||||
|
||||
TRectype& head = mov.curr();
|
||||
head.put(MOV_NUMREG,nr);
|
||||
|
||||
@ -4242,8 +4237,7 @@ error_type TContabilizzazione::write_regolarizzazione(const TDocumento& doc, TMo
|
||||
|
||||
head.put(MOV_TIPO, "C");
|
||||
head.put(MOV_CODCF, doc.clifor().get_long(CLI_CODCFASS));
|
||||
head.put(MOV_TOTDOC, doc.totale_doc());
|
||||
|
||||
|
||||
// Scrive sulla testata dell'anticipo il numero di documento originale
|
||||
head.put(MOV_DPROVV, doc.get(DOC_PROVV));
|
||||
head.put(MOV_DANNO, doc.get(DOC_ANNO));
|
||||
@ -4251,12 +4245,23 @@ error_type TContabilizzazione::write_regolarizzazione(const TDocumento& doc, TMo
|
||||
head.put(MOV_DNDOC, doc.get(DOC_NDOC));
|
||||
head.put(MOV_CONTSEP, doc.get(DOC_CONTSEP));
|
||||
|
||||
TRectype& rmi = mov.iva(0);
|
||||
rmi.put(RMI_IMPONIBILE, _movimento->iva(0).get(RMI_IMPONIBILE));
|
||||
rmi.put(RMI_IMPOSTA, _movimento->iva(0).get(RMI_IMPOSTA));
|
||||
rmi.put(RMI_CODIVA, _movimento->iva(0).get(RMI_CODIVA));
|
||||
TBill zio; caus.bill(2, zio);
|
||||
zio.put(rmi);
|
||||
real totdoc;
|
||||
for (int ri = 0; ri < _movimento->iva_items(); ri++)
|
||||
{
|
||||
const TRectype& rmoviva = _movimento->iva(ri);
|
||||
const real imponibile = rmoviva.get(RMI_IMPONIBILE);
|
||||
const real imposta = rmoviva.get(RMI_IMPOSTA);
|
||||
|
||||
TRectype& rmi = mov.iva(ri);
|
||||
rmi.put(RMI_IMPONIBILE, imponibile);
|
||||
rmi.put(RMI_IMPOSTA, imposta);
|
||||
rmi.put(RMI_CODIVA, rmoviva.get(RMI_CODIVA));
|
||||
TBill zio; caus.bill(2, zio);
|
||||
zio.put(rmi);
|
||||
|
||||
totdoc += imponibile + imposta; // Incrementa totdoc
|
||||
}
|
||||
head.put(MOV_TOTDOC, totdoc); // Non usare DOC_TOTDOC! Unico modo per gestire correttamente fatture e note di credito
|
||||
|
||||
const int err = do_insert ? mov.write(true) : mov.rewrite(true);
|
||||
if (err == NOERR)
|
||||
@ -4772,3 +4777,4 @@ bool TContabilizzazione::call_exe(const TDocumento& doc, const TMovimentoPN& mov
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ void TDocumentoEsteso::scadenze_recalc()
|
||||
TCurrency_documento val1(totimponibili, *this); val1.change_to_firm_val();
|
||||
TCurrency_documento val2(totimposte, *this); val2.change_to_firm_val();
|
||||
TCurrency_documento val3(totspese, *this); val3.change_to_firm_val();
|
||||
TString16 codval = valuta();
|
||||
TString4 codval = valuta();
|
||||
pag.set_total_valuta(totimponibili, totimposte, totspese, change, val1.get_num(), val2.get_num() ,val3.get_num(), codval);
|
||||
}
|
||||
else
|
||||
|
362
ve/velib06.cpp
362
ve/velib06.cpp
@ -107,7 +107,8 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
||||
read_mask(mname, 0, MAX_PAGES);
|
||||
|
||||
_sheet = &sfield(F_SHEET);
|
||||
_sheet->set_handler( ss_handler );
|
||||
//_sheet->set_handler( ss_handler );
|
||||
set_field_handler(F_SHEET, ss_handler );
|
||||
_sheet->set_notify( ss_notify );
|
||||
_sheet->set_append(FALSE);
|
||||
|
||||
@ -139,9 +140,10 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
||||
|
||||
int i;
|
||||
for (i = fields() - 1; i >= 0; i--)
|
||||
|
||||
{
|
||||
TMask_field & f = fld(i);
|
||||
if (f.is_operable())
|
||||
TMask_field& f = fld(i);
|
||||
if (f.is_operable())
|
||||
f.set_handler(universal_handler);
|
||||
}
|
||||
|
||||
@ -168,9 +170,9 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
||||
set_handler( DLG_SORT, sort_row_handler );
|
||||
set_handler( DLG_BARCODE, barcode_handler );
|
||||
|
||||
const TString_array& handlers = tdoc.handlers();
|
||||
FOR_EACH_ARRAY_ROW(handlers, r, riga)
|
||||
user_set_handler( riga->get_int(0), riga->get_int(1) );
|
||||
const TPointer_array& handlers = tdoc.handlers();
|
||||
FOR_EACH_ARRAY_ITEM(handlers, r, riga)
|
||||
user_set_handler( r, (int)riga);
|
||||
|
||||
_livelli_giac = new TCodgiac_livelli;
|
||||
|
||||
@ -523,7 +525,7 @@ int TDocumento_mask::insert_anal_fields(TMask& m, int page, int lf, int& y,
|
||||
if (main_mask)
|
||||
{
|
||||
TSheet_field& sf = sfield(F_SHEET);
|
||||
const TString head = fld.prompt();
|
||||
const TFixed_string head = fld.prompt();
|
||||
const int colid = FR_CDC1+(fld.dlg()-F_CDC1);
|
||||
sf.set_column_header(colid, head);
|
||||
if (fld.size() > head.len())
|
||||
@ -548,8 +550,7 @@ void TDocumento_mask::insert_anal_page()
|
||||
if (newpage == 0)
|
||||
newpage++;
|
||||
create_page("Analitica", newpage); // Inserisce una pagina vuota con un titolo a caso
|
||||
|
||||
|
||||
|
||||
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);
|
||||
@ -562,7 +563,7 @@ void TDocumento_mask::insert_anal_page()
|
||||
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);
|
||||
add_groupbox(DLG_NULL, newpage, TR("Contabilità Analitica"), 1, 6, 78, 14);
|
||||
|
||||
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
|
||||
const bool use_fsc = fasinfo.levels() > 0;
|
||||
@ -585,7 +586,6 @@ void TDocumento_mask::insert_anal_page()
|
||||
else
|
||||
{
|
||||
const bool cdc_req = ini.get_bool("CdcRequired");
|
||||
|
||||
insert_anal_fields(*this, newpage, LF_CDC, y, dlg, dlgd, cdc_req && doc().tipo().head_ca_required());
|
||||
}
|
||||
} else
|
||||
@ -611,9 +611,9 @@ void TDocumento_mask::insert_anal_page()
|
||||
|
||||
//aggiunge campi per date di competenza (inizio e fine)
|
||||
add_groupbox(DLG_NULL, newpage, TR("Date di competenza"), 1, 20, 78, 3);
|
||||
TString16 f_datacomp = DOC_DATACOMP;
|
||||
const TFixed_string f_datacomp = DOC_DATACOMP;
|
||||
add_date(F_DATACOMP, newpage, "Inizio ", 2, 21).set_field(f_datacomp);
|
||||
TString16 f_datafcomp = DOC_DATAFCOMP;
|
||||
const TFixed_string f_datafcomp = DOC_DATAFCOMP;
|
||||
add_date(F_DATAFCOMP, newpage, "Fine ", 25, 21).set_field(f_datafcomp);
|
||||
set_field_handler(F_DATACOMP, datacomp_handler); //gestore del campo inizio competenza..
|
||||
set_field_handler(F_DATAFCOMP, datafcomp_handler); //..e della fine competenza
|
||||
@ -955,6 +955,40 @@ void TDocumento_mask::occ2mask()
|
||||
check_field(F_STATOSP);
|
||||
}
|
||||
|
||||
// Proposta automatica contratto
|
||||
void TDocumento_mask::contr2mask()
|
||||
{
|
||||
const TCli_for& c = doc().clifor();
|
||||
const TRectype& ven_rec = c.vendite();
|
||||
|
||||
const bool gescontr = ven_rec.get_bool(CFV_GESTCONTR) && ini_get_bool(CONFIG_DITTA, "ve", "GES", false, 2);
|
||||
enable(F_CODCONT, gescontr);
|
||||
enable(F_DESCONT, gescontr);
|
||||
|
||||
if (gescontr && insert_mode())
|
||||
{
|
||||
const TDate datadoc = get(F_DATADOC);
|
||||
TString str;
|
||||
str << CONDV_TIPO << "=C " << CONDV_TIPOCF << '=' << c.tipo() << ' ' << CONDV_CODCF << '=' << c.codice();
|
||||
TString query;
|
||||
query << "USE CONDV\nFROM " << str << "\nTO " << str;
|
||||
TISAM_recordset contr(query);
|
||||
|
||||
str.cut(0);
|
||||
for (bool ok = contr.move_first(); ok; ok = contr.move_next())
|
||||
{
|
||||
const TDate data_ini = contr.get(CONDV_VALIN).as_date();
|
||||
const TDate data_fin = contr.get(CONDV_VALFIN).as_date();
|
||||
if (datadoc.between(data_ini, data_fin))
|
||||
{
|
||||
str = contr.get(CONDV_COD).as_string();
|
||||
break;
|
||||
}
|
||||
}
|
||||
set(F_CODCONT, str, 0x3);
|
||||
}
|
||||
}
|
||||
|
||||
void TDocumento_mask::cli2mask(bool force_load)
|
||||
{
|
||||
const TCli_for& c = doc().clifor();
|
||||
@ -975,7 +1009,7 @@ void TDocumento_mask::cli2mask(bool force_load)
|
||||
set(F_RAGSOC, c.get(CLI_RAGSOC));
|
||||
enable(F_RAGSOC, !occas);
|
||||
|
||||
const TRectype & ven_rec = c.vendite();
|
||||
const TRectype& ven_rec = c.vendite();
|
||||
|
||||
if (force_load || !onload)
|
||||
{
|
||||
@ -1221,32 +1255,10 @@ void TDocumento_mask::cli2mask(bool force_load)
|
||||
check_field( F_CATVEN );
|
||||
check_field( F_CODZON );
|
||||
|
||||
//gestione contratti
|
||||
const bool gescontr = ven_rec.get_bool(CFV_GESTCONTR) && ini_get_bool(CONFIG_DITTA, "ve", "GES", false, 2);
|
||||
enable(F_CODCONT, gescontr);
|
||||
enable(F_DESCONT, gescontr);
|
||||
if (gescontr && insert_mode())
|
||||
{
|
||||
const TDate datadoc = get(F_DATADOC);
|
||||
TString str;
|
||||
str << CONDV_TIPO << "=C " << CONDV_TIPOCF << '=' << c.tipo() << ' ' << CONDV_CODCF << '=' << c.codice();
|
||||
TString query;
|
||||
query << "USE CONDV\nFROM " << str << "\nTO " << str;
|
||||
TISAM_recordset contr(query);
|
||||
contr2mask();
|
||||
|
||||
str.cut(0);
|
||||
for (bool ok = contr.move_first(); ok; ok = contr.move_next())
|
||||
{
|
||||
const TDate data_ini = contr.get(CONDV_VALIN).as_date();
|
||||
const TDate data_fin = contr.get(CONDV_VALFIN).as_date();
|
||||
if (datadoc.between(data_ini, data_fin))
|
||||
{
|
||||
str = contr.get(CONDV_COD).as_string();
|
||||
break;
|
||||
}
|
||||
}
|
||||
set(F_CODCONT, str, 0x3);
|
||||
}
|
||||
if (gestione_note_per_articolo())
|
||||
send_key(K_F8, F_NAR, &field(F_CODCF));
|
||||
|
||||
// Accendi bottone mail se possibile
|
||||
const TString& email = c.get(CLI_DOCMAIL);
|
||||
@ -1817,13 +1829,37 @@ void TDocumento_mask::update_giacenza()
|
||||
|
||||
bool TDocumento_mask::ss_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
if (key == K_ENTER && f.mask().insert_mode())
|
||||
bool ok = true;
|
||||
if (key == K_ENTER )
|
||||
{
|
||||
TSheet_field& ss = (TSheet_field&)f;
|
||||
if (!app().is_transaction() && ss.empty())
|
||||
ok = yesno_box(TR("Il documento e' privo di righe:\n"
|
||||
"Si desidera continuare ugualmente?"));
|
||||
const TSheet_field& ss = (TSheet_field&)f;
|
||||
TDocumento_mask& mask = (TDocumento_mask&)ss.mask();
|
||||
|
||||
const short cme = mask.cms_end();
|
||||
if (mask.id2pos(cme) > 0 && app().has_module(CAAUT) && mask.get(cme).empty())
|
||||
{
|
||||
TConfig& ini = ca_config();
|
||||
if (ini.get_bool("CmsRequired") || ini.get("FathFasi").full())
|
||||
{
|
||||
const int col = ss.cid2index(mask.cms_end_sh());
|
||||
FOR_EACH_SHEET_ROW(ss, r, riga)
|
||||
{
|
||||
if (ss.cell_enabled(r, col))
|
||||
{
|
||||
const char* cms = riga->get(col);
|
||||
if (!(cms && *cms > ' '))
|
||||
{
|
||||
ss.error_box(FR("La commessa è obbligatoria alla riga %d"), r+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (ok && ss.empty() && mask.insert_mode() && !app().is_transaction())
|
||||
ok = yesno_box(TR("Il documento è privo di righe:\nSi desidera continuare ugualmente?"));
|
||||
*/
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -1848,19 +1884,17 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
if (doc.tipo().check_double_art())
|
||||
{
|
||||
const int rows = doc.physical_rows();
|
||||
const TString codart = riga.get(RDOC_CODART);
|
||||
|
||||
const TString80 codart = riga.get(RDOC_CODART);
|
||||
for (int i = 1; i <= rows; i++)
|
||||
if (i != r + 1 && codart == doc[i].get(RDOC_CODART))
|
||||
if ( !yesno_box(FR("L'articolo %s e' presente alla riga %d, si desidera continuare"), (const char *)codart, i))
|
||||
if (!yesno_box(FR("L'articolo %s è presente alla riga %d, si desidera continuare?"), (const char*)codart, i))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case K_CTRL + K_ENTER: // inizio modifica
|
||||
{
|
||||
TRiga_documento& riga = doc[r + 1];
|
||||
|
||||
const TRiga_documento& riga = doc[r + 1];
|
||||
m.codcms_sh() = riga.get(RDOC_CODCMS);
|
||||
}
|
||||
case K_DEL: // Cancellazione
|
||||
@ -1868,7 +1902,7 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
doc.destroy_row(r + 1, TRUE);
|
||||
if (r < doc.rows())
|
||||
{
|
||||
TRiga_documento & riga = doc[r + 1];
|
||||
TRiga_documento& riga = doc[r + 1];
|
||||
if (riga.is_omaggio() && riga.is_generata())
|
||||
{
|
||||
ss.destroy(r + 1);
|
||||
@ -2081,8 +2115,8 @@ bool TDocumento_mask::occas_handler( TMask_field& f, KEY key )
|
||||
|
||||
for (int i = occas_mask.fields() - 1; i >= 0; i--)
|
||||
{
|
||||
TMask_field & f = occas_mask.fld(i);
|
||||
const TFieldref * c = f.field();
|
||||
TMask_field& f = occas_mask.fld(i);
|
||||
const TFieldref* c = f.field();
|
||||
if (c)
|
||||
f.set(c->read(occ));
|
||||
}
|
||||
@ -2253,37 +2287,38 @@ void TLista_elaborazioni::read()
|
||||
|
||||
for (int err = eld.first(); err == NOERR; err = eld.next())
|
||||
{
|
||||
TElaborazione * el = NULL;
|
||||
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;
|
||||
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);
|
||||
if (el != NULL)
|
||||
_elab->add(el->codice(), el);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2313,6 +2348,7 @@ int TLista_elaborazioni::select(TString_array & result, const char * tipo_inizia
|
||||
if (ok)
|
||||
result.add(el->codice());
|
||||
}
|
||||
result.sort();
|
||||
return result.items();
|
||||
}
|
||||
|
||||
@ -2428,7 +2464,8 @@ public:
|
||||
const TRectype& record() const;
|
||||
const real totale_doc() const { TDocumento d(testata()); return d.totale_doc();}
|
||||
|
||||
void set_cursor(char tipocf, long codcf, int anno, const char* filter);
|
||||
void set_cursor(char tipocf, long codcf, int anno, const TString& codnum,
|
||||
const char* filter, bool allow_zero_cf);
|
||||
TCursor* get_cursor() { return _cursor; }
|
||||
|
||||
TDocument_tree();
|
||||
@ -2830,28 +2867,36 @@ bool TDocument_tree::get_description(TString& str) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void TDocument_tree::set_cursor(char tipocf, long codcf, int anno, const char* filter)
|
||||
void TDocument_tree::set_cursor(char tipocf, long codcf, int anno, const TString& codnum, const char* filter, bool allow_zero_cf)
|
||||
{
|
||||
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);
|
||||
_cursor->freeze(false);
|
||||
_cursor->setfilter(""); // Force cursor rebuild
|
||||
_cursor->setfilter(filter);
|
||||
_cursor->setregion(rec, rec);
|
||||
rec.put(DOC_CODNUM, codnum);
|
||||
|
||||
int key = 4;
|
||||
TString filtro = filter;
|
||||
if (allow_zero_cf)
|
||||
{
|
||||
key = 1;
|
||||
filtro << "&&(STR((CODCF=0)||(CODCF=" << codcf << ")))";
|
||||
}
|
||||
else
|
||||
{
|
||||
rec.put(DOC_TIPOCF, tipocf);
|
||||
rec.put(DOC_CODCF, codcf);
|
||||
}
|
||||
|
||||
if (_cursor != NULL)
|
||||
delete _cursor;
|
||||
_cursor = new TCursor(_relation, filtro, key, &rec, &rec);
|
||||
if (_art_filter.full())
|
||||
_cursor->set_filterfunction(doc_article_filter);
|
||||
else
|
||||
@ -2959,16 +3004,12 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
||||
if (_check_fld < -1)
|
||||
{
|
||||
_check_fld = -1;
|
||||
const TString_array& handlers = _main->doc().tipo().handlers();
|
||||
const int items = handlers.items();
|
||||
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
TToken_string& riga = (TToken_string&) handlers[i];
|
||||
|
||||
if (riga.get_int(1) == 2)
|
||||
_check_fld = riga.get_int(0);
|
||||
}
|
||||
const TPointer_array& handlers = _main->doc().tipo().handlers();
|
||||
FOR_EACH_ARRAY_ITEM_BACK(handlers, id, hnd)
|
||||
{
|
||||
if (long(hnd) == 2) // 2 = totdoc_handler
|
||||
_check_fld = id;
|
||||
}
|
||||
}
|
||||
check_tot = _check_fld >= 0;
|
||||
}
|
||||
@ -3327,7 +3368,7 @@ bool TElabora_mask::elabora()
|
||||
}
|
||||
|
||||
// Azzera l'anno in caso di ordini
|
||||
if (in.items() > 0 && in[0].is_ordine())
|
||||
if (in.items() > 0 && in[0].is_ordine() && !field(F_ANNO_ELAB).required())
|
||||
{
|
||||
reset(F_ANNO_ELAB);
|
||||
update_mask = true;
|
||||
@ -3366,7 +3407,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
|
||||
TString filter;
|
||||
add_valuta_filter(filter);
|
||||
|
||||
TElaborazione * e = curr_elab();
|
||||
TElaborazione* e = curr_elab();
|
||||
const bool elab_changed = e != _last_elab;
|
||||
_last_elab = e;
|
||||
|
||||
@ -3403,16 +3444,13 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
|
||||
const char stato_in = e->stato_iniziale(0);
|
||||
|
||||
set(F_CODNUM_ELAB, num_in, 0x2);
|
||||
//field(F_CODNUM_ELAB).check(); // sostituito da 0x2
|
||||
set(F_TIPODOC_ELAB , tipo_in, 0x2);
|
||||
//field(F_TIPODOC_ELAB).check(); // sostituito da 0x2
|
||||
TString8 si; si << stato_in;
|
||||
set(F_STATODOC_ELAB, si, 0x2);
|
||||
//field(F_STATODOC_ELAB).check(); // sostituito da 0x2
|
||||
|
||||
// Azzero anno di elaaborazione quando ho a che fare con degli ordini
|
||||
// Azzero anno di elaborazione quando ho a che fare con degli ordini
|
||||
const TTipo_documento& tipodocin = cached_tipodoc(tipo_in);
|
||||
if (tipodocin.is_ordine())
|
||||
if (tipodocin.is_ordine() && !field(F_ANNO_ELAB).required())
|
||||
reset(F_ANNO_ELAB);
|
||||
}
|
||||
|
||||
@ -3491,40 +3529,42 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
|
||||
|
||||
if (is_tipo_elaborazione)
|
||||
{
|
||||
const TString4 num_fin(e->codice_numerazione_finale());
|
||||
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();
|
||||
const TString4 num_fin = e->codice_numerazione_finale();
|
||||
set(F_CODNUM_ELAB, num_fin, 0x2);
|
||||
set(F_TIPODOC_ELAB, tipo_fin, 0x2);
|
||||
set(F_STATODOC_ELAB, stato_fin, 0x2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
filter << "&&(CODNUM==\""<< get(F_CODNUM_ELAB) << "\")";
|
||||
|
||||
_art_filter = get(F_CODART);
|
||||
if (!aggiungi_doc_att || _art_filter.blank())
|
||||
_art_filter.cut(0);
|
||||
|
||||
|
||||
/* Vedi sotto: copia cursore da albero
|
||||
TBrowse& brew = *efield(F_NDOC_ELAB).browse();
|
||||
brew.set_filter(filter);
|
||||
TCursor* cursor = brew.cursor();
|
||||
if (_art_filter.full() && aggiungi_doc_att)
|
||||
cursor->set_filterfunction(doc_article_filter);
|
||||
else
|
||||
cursor->set_filterfunction(NULL);
|
||||
*/
|
||||
|
||||
TTree_field& tf = tfield(F_ROWS);
|
||||
if (!field(F_TIPODOC_ELAB).empty() && e != NULL)
|
||||
if (e != NULL /*&& !field(F_TIPODOC_ELAB).empty() */ ) // 18-10-2013 tolto test tipo documento vuoto
|
||||
{
|
||||
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter);
|
||||
const char tipocf = get(F_TIPOCF_ELAB)[0];
|
||||
const TString& codnum = get(F_CODNUM_ELAB);
|
||||
const bool allow_zero_cf = tipocf == 'F' && aggiungi_doc_att && codnum.full() && e->tipo() == _consegna_ordini;
|
||||
_tree.set_cursor(tipocf, get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB),
|
||||
codnum, filter, allow_zero_cf);
|
||||
efield(F_NDOC_ELAB).browse()->replace_cursor(_tree.get_cursor());
|
||||
|
||||
tf.set_tree(&_tree);
|
||||
|
||||
TToken_string header(256, '\n');
|
||||
@ -3545,9 +3585,11 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
|
||||
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_CODNUM_ELAB, curr.get(DOC_CODNUM), 0x2); // Check but not hit
|
||||
set(F_DATADOC_ELAB, curr.get(DOC_DATADOC));
|
||||
}
|
||||
else
|
||||
reset(F_NDOC_ELAB);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -3583,8 +3625,8 @@ void TElabora_mask::docrif_search()
|
||||
|
||||
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",
|
||||
TR("Documento di riferimento"),
|
||||
HR("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)
|
||||
{
|
||||
@ -3595,7 +3637,7 @@ void TElabora_mask::docrif_search()
|
||||
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);
|
||||
const TString4 codnum = sheet.row(-1).get(codnumpos);
|
||||
set(F_CODNUM_ELAB, codnum, TRUE);
|
||||
}
|
||||
}
|
||||
@ -3604,9 +3646,9 @@ TElabora_mask::TElabora_mask(TDocumento_mask& main_mask)
|
||||
: TAutomask("ve0100b"), _main(&main_mask), _last_elab(NULL), _check_fld(-883)
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
set(F_ANNO_ELAB, oggi.year()); //anno della datadoc proposta (risolve bug 0000331)
|
||||
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_CODCF_ELAB, _main->get(F_CODCF));
|
||||
set(F_CODVAL_ELAB, _main->get(F_CODVAL));
|
||||
}
|
||||
|
||||
@ -3693,41 +3735,28 @@ void TDocumento_mask::set_field_handler(short fieldid, CONTROL_HANDLER handler)
|
||||
|
||||
void TDocumento_mask::user_set_handler(short fieldid, int index)
|
||||
{
|
||||
switch( index )
|
||||
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:
|
||||
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:
|
||||
_smartcard = new TSmart_card();
|
||||
if (_smartcard->type() != no_smartcard)
|
||||
{
|
||||
_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;
|
||||
}
|
||||
set_field_handler(fieldid, smart_hndl);
|
||||
set_handler(fieldid, universal_handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
disable(fieldid);
|
||||
delete _smartcard;
|
||||
_smartcard = NULL;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
set_field_handler(fieldid, dummy_hndl);
|
||||
break;
|
||||
case 6:
|
||||
set_field_handler(fieldid, fido_hndl);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 5: set_field_handler(fieldid, dummy_hndl); break;
|
||||
case 6: set_field_handler(fieldid, fido_hndl); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3889,8 +3918,7 @@ bool TDocumento_mask::codcont_handler( TMask_field& f, KEY key )
|
||||
const long firm = prefix().get_codditta();
|
||||
if (firm != __cntr_firm)
|
||||
{
|
||||
TConfig c(CONFIG_DITTA, "ve");
|
||||
__gesconcc = c.get_bool("GESCONCC");
|
||||
__gesconcc = ini_get_bool(CONFIG_DITTA, "ve", "GESCONCC");
|
||||
__cntr_firm = firm;
|
||||
}
|
||||
|
||||
@ -3941,7 +3969,7 @@ bool TDocumento_mask::codcont_handler( TMask_field& f, KEY key )
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TDocumento_mask::codcamp_handler( TMask_field& f, KEY key )
|
||||
|
126
ve/velib06a.cpp
126
ve/velib06a.cpp
@ -190,7 +190,7 @@ bool ora_hndl( TMask_field& field, KEY key )
|
||||
{
|
||||
struct tm* t = xvt_time_now();
|
||||
ora.format("%02d%02d", t->tm_hour, t->tm_min);
|
||||
field.set((ora));
|
||||
field.set(ora);
|
||||
|
||||
TMask& m = field.mask();
|
||||
const int pos_data = m.id2pos(field.dlg()) - 1;
|
||||
@ -2634,16 +2634,15 @@ bool link_handler( TMask_field& f, KEY key )
|
||||
bool ca_mag_handler(TMask_field& f, bool cdc = true)
|
||||
{
|
||||
TMask& row_mask = f.mask();
|
||||
const TSheet_field & sf = *f.mask().get_sheet();
|
||||
const TDocumento_mask & mask = (TDocumento_mask & )sf.mask();
|
||||
short i, first_fld, last_fld;
|
||||
const TSheet_field& sf = *f.mask().get_sheet();
|
||||
const TDocumento_mask& mask = (TDocumento_mask&)sf.mask();
|
||||
const int lffile = cdc ? LF_CDC : LF_COMMESSE;
|
||||
const TMultilevel_code_info & info = ca_multilevel_code_info(lffile);
|
||||
TString80 cod;
|
||||
|
||||
last_fld = f.dlg();
|
||||
first_fld = last_fld - info.levels() + 1;
|
||||
for (i = first_fld; i <= last_fld; i++)
|
||||
short last_fld = f.dlg();
|
||||
short first_fld = last_fld - info.levels() + 1;
|
||||
for (short i = first_fld; i <= last_fld; i++)
|
||||
cod << row_mask.get(i);
|
||||
if (cod.blank())
|
||||
{
|
||||
@ -2651,14 +2650,12 @@ bool ca_mag_handler(TMask_field& f, bool cdc = true)
|
||||
last_fld = cdc ? mask.cdc_end() : mask.cms_end();
|
||||
first_fld = last_fld - info.levels() + 1;
|
||||
|
||||
for (i = first_fld; i <= last_fld; i++)
|
||||
for (short i = first_fld; i <= last_fld; i++)
|
||||
cod << mask.get(i);
|
||||
}
|
||||
|
||||
const TRectype & rec = cache().get(lffile, cod);
|
||||
const TString16 codmag = rec.get("CODMAG");
|
||||
|
||||
if (codmag.not_empty())
|
||||
const TString8 codmag = cache().get(lffile, cod, "CODMAG");
|
||||
if (codmag.full())
|
||||
{
|
||||
row_mask.set(FR_CODMAG, codmag.left(3), true);
|
||||
row_mask.set(FR_CODDEP, codmag.mid(3), true);
|
||||
@ -2668,32 +2665,41 @@ bool ca_mag_handler(TMask_field& f, bool cdc = true)
|
||||
|
||||
bool cms_mag_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if ((key == K_TAB && f.focusdirty()) || key == K_ENTER)
|
||||
if ((key == K_TAB && f.focusdirty() && !f.empty()) || key == K_ENTER)
|
||||
{
|
||||
ca_mag_handler(f, false);
|
||||
TMask & m = f.mask();
|
||||
const TSheet_field & s = *m.get_sheet();
|
||||
TDocumento_mask & mask = (TDocumento_mask & )s.mask();
|
||||
const TRectype & curr = m.efield(mask.cms_start_sh()).browse()->cursor()->curr();
|
||||
const TString codcms = curr.get(COMMESSE_CODCMS);
|
||||
TMask& m = f.mask();
|
||||
for (int i = m.id2pos(f.dlg())+1; i < m.fields(); i++)
|
||||
{
|
||||
const TMask_field& nxt = m.fld(i);
|
||||
if (nxt.is_edit() && nxt.field() != NULL && nxt.field()->name() == f.field()->name())
|
||||
return true; // Opera solo sull'ultimo livello del codice commessa
|
||||
}
|
||||
|
||||
ca_mag_handler(f, false);
|
||||
|
||||
const TSheet_field& s = *m.get_sheet();
|
||||
TDocumento_mask& mask = (TDocumento_mask&)s.mask();
|
||||
const TRectype& curr = m.efield(mask.cms_end_sh()).browse()->cursor()->curr();
|
||||
const TString80 codcms = curr.get(COMMESSE_CODCMS);
|
||||
|
||||
if (curr.get_bool(COMMESSE_CHIUSA))
|
||||
return f.error_box(FR("Impossibile operare sulla commessa chiusa %s"), (const char*)codcms);
|
||||
|
||||
if (mask.codcms_sh() != codcms) // Cambio commessa
|
||||
{
|
||||
mask.codcms_sh() = codcms;
|
||||
|
||||
const TString codcosto = curr.get(COMMESSE_CODCOSTO);
|
||||
const TString80 codcosto = curr.get(COMMESSE_CODCOSTO);
|
||||
if (mask.cdc_start_sh() > mask.cms_start_sh() && codcosto.full())
|
||||
{
|
||||
for (short i = mask.cdc_start_sh(); i <= mask.cdc_end_sh(); i++)
|
||||
{
|
||||
TEdit_field & e = m.efield(i);
|
||||
const TFieldref * f = e.field();
|
||||
|
||||
const TFieldref* f = e.field();
|
||||
if (f != NULL)
|
||||
{
|
||||
const int from = f->from();
|
||||
const int to = f->to();
|
||||
|
||||
m.set(i, codcosto.sub(from, to), 0x2);
|
||||
}
|
||||
}
|
||||
@ -2712,12 +2718,23 @@ bool cdc_mag_handler(TMask_field& f, KEY key)
|
||||
|
||||
bool codcms_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TDocumento_mask& mask = (TDocumento_mask&)f.mask();
|
||||
const TRectype& curr = mask.efield(mask.cms_end()).browse()->cursor()->curr();
|
||||
const TString codcms = curr.get(COMMESSE_CODCMS);
|
||||
if (!f.to_check(key, true))
|
||||
return true;
|
||||
|
||||
if (f.to_check(key, TRUE))
|
||||
TDocumento_mask& mask = (TDocumento_mask&)f.mask();
|
||||
|
||||
if (f.empty() || f.dlg() < mask.cms_end())
|
||||
return true; // Opera solo sull'ultimo livello del codice commessa
|
||||
|
||||
const TRectype& curr = mask.efield(mask.cms_end()).browse()->cursor()->curr();
|
||||
const TString80 codcms = curr.get(COMMESSE_CODCMS);
|
||||
|
||||
if (f.to_check(key, true))
|
||||
{
|
||||
mask.set(F_CMSH, codcms);
|
||||
if (curr.get_bool(COMMESSE_CHIUSA))
|
||||
return f.error_box(FR("Impossibile operare sulla commessa chiusa %s"), (const char*)codcms);
|
||||
}
|
||||
if ((key == K_TAB && f.focusdirty()) || key == K_ENTER)
|
||||
{
|
||||
// Controlla se c'e' la gestione dei centri di costo al secondo livello
|
||||
@ -3154,7 +3171,7 @@ class TNar_mask : public TAutomask
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
bool add_nota(const TRectype& curr, TSheet_field& sht);
|
||||
int add_nota(const TRectype& curr, TSheet_field& sht);
|
||||
|
||||
public: // virtual methods
|
||||
virtual void open(); // : TMask : TWindow
|
||||
@ -3162,7 +3179,7 @@ public: // virtual methods
|
||||
|
||||
public:
|
||||
void set_doc_mask(TMask& docmask) { _doc_mask = &docmask; }
|
||||
bool show_note();
|
||||
int find_note();
|
||||
TNar_mask();
|
||||
};
|
||||
|
||||
@ -3215,7 +3232,7 @@ bool TNar_mask::nar_filter(const TRelation* rel)
|
||||
return codart.blank() || codart == _codart;
|
||||
}
|
||||
|
||||
bool TNar_mask::add_nota(const TRectype& curr, TSheet_field& sht)
|
||||
int TNar_mask::add_nota(const TRectype& curr, TSheet_field& sht)
|
||||
{
|
||||
TToken_string nota;
|
||||
char sn[4] = "S0";
|
||||
@ -3227,6 +3244,7 @@ bool TNar_mask::add_nota(const TRectype& curr, TSheet_field& sht)
|
||||
nota << esse << ' ';
|
||||
}
|
||||
const bool done = nota.full();
|
||||
int found = 0;
|
||||
if (done)
|
||||
{
|
||||
nota.strip_double_spaces();
|
||||
@ -3234,11 +3252,20 @@ bool TNar_mask::add_nota(const TRectype& curr, TSheet_field& sht)
|
||||
TString8 tipo;
|
||||
tipo << 'X' << nota.separator();
|
||||
if (atol(curr.get("S0").mid(1,6)) > 0)
|
||||
{
|
||||
tipo << 'C';
|
||||
found |= 1;
|
||||
}
|
||||
if (curr.get("S0").mid(7,4).full())
|
||||
{
|
||||
tipo << 'T';
|
||||
found |= 2;
|
||||
}
|
||||
if (curr.get("S0").mid(11).full())
|
||||
{
|
||||
tipo << 'A';
|
||||
found |= 4;
|
||||
}
|
||||
tipo << nota.separator();
|
||||
nota.insert(tipo, 0);
|
||||
const int n = sht.insert(-1, false, true);
|
||||
@ -3246,7 +3273,7 @@ bool TNar_mask::add_nota(const TRectype& curr, TSheet_field& sht)
|
||||
sht.set_row_height(n, 2*CHARY);
|
||||
}
|
||||
|
||||
return done;
|
||||
return found;
|
||||
}
|
||||
|
||||
static int notes_compare(TSheet_field& s, int r1, int r2)
|
||||
@ -3262,7 +3289,7 @@ static int notes_compare(TSheet_field& s, int r1, int r2)
|
||||
return cmp;
|
||||
}
|
||||
|
||||
bool TNar_mask::show_note()
|
||||
int TNar_mask::find_note()
|
||||
{
|
||||
TSheet_field& ss = _doc_mask->sfield(F_SHEET);
|
||||
const int sel = ss.selected();
|
||||
@ -3276,8 +3303,11 @@ bool TNar_mask::show_note()
|
||||
else
|
||||
_codart.cut(0);
|
||||
|
||||
close();
|
||||
if (_codart.full())
|
||||
TSheet_field& sheet = sfield(N_NOTES);
|
||||
sheet.destroy();
|
||||
|
||||
int found = 0;
|
||||
if (_codart.full() || !ss.empty())
|
||||
{
|
||||
TRelation rel(NAR_TABLE);
|
||||
TCursor cur(&rel, "", 2);
|
||||
@ -3286,20 +3316,16 @@ bool TNar_mask::show_note()
|
||||
const TRecnotype items = cur.items();
|
||||
if (items > 0)
|
||||
{
|
||||
// close(); // Pare un doppione rispetto alla close() precedente
|
||||
cur.freeze();
|
||||
const TRectype& curr = rel.curr();
|
||||
TSheet_field& sheet = sfield(N_NOTES);
|
||||
sheet.destroy();
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
add_nota(curr, sheet);
|
||||
found |= add_nota(cur.curr(), sheet);
|
||||
sheet.sort(notes_compare);
|
||||
open();
|
||||
sheet.force_update();
|
||||
}
|
||||
}
|
||||
|
||||
return is_open();
|
||||
sheet.force_update();
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
@ -3414,11 +3440,19 @@ bool nar_handler(TMask_field& f, KEY key)
|
||||
if (xvt_vobj_is_focusable(f.parent()))
|
||||
{
|
||||
if (nw == NULL)
|
||||
{
|
||||
nw = new TNar_mask;
|
||||
nw->set_doc_mask(f.mask());
|
||||
}
|
||||
nw->show_note();
|
||||
nw->set_doc_mask(f.mask());
|
||||
|
||||
TButton_field& btn = (TButton_field&)f;
|
||||
const int found = nw->find_note();
|
||||
if (found >= 4)
|
||||
btn.set_bmp(1203); else
|
||||
if (found >= 2)
|
||||
btn.set_bmp(1116); else
|
||||
if (found >= 1)
|
||||
btn.set_bmp(1204);
|
||||
else
|
||||
btn.set_prompt(PR("Note"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -24,6 +24,7 @@ BEGIN
|
||||
INPUT CODTAB F_CODICE
|
||||
DISPLAY "Codice@10" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Tipo" I0
|
||||
OUTPUT F_CODICE CODTAB
|
||||
OUTPUT F_DESCR S0
|
||||
KEY 1
|
||||
@ -53,7 +54,7 @@ BEGIN
|
||||
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@|HIDE,4@|HIDE,5@|HIDE,9@|SHOW,F_KILLDESC
|
||||
ITEM "2|Fatturazione bolle"
|
||||
MESSAGE HIDE,1@|SHOW,2@|HIDE,3@|HIDE,4@|HIDE,5@|HIDE,9@|SHOW,F_KILLDESC
|
||||
ITEM "3|Trasferimento a contabilita'"
|
||||
ITEM "3|Trasferimento a contabilità"
|
||||
MESSAGE HIDE,1@|HIDE,2@|SHOW,3@|HIDE,4@|HIDE,5@|SHOW,9@|HIDE,F_KILLDESC
|
||||
ITEM "4|Copia documento"
|
||||
MESSAGE HIDE,1@|HIDE,2@|HIDE,3@|SHOW,4@|HIDE,5@|HIDE,9@|HIDE,F_KILLDESC
|
||||
@ -61,7 +62,7 @@ BEGIN
|
||||
MESSAGE HIDE,1@|HIDE,2@|HIDE,3@|HIDE,4@|SHOW,5@|HIDE,9@|HIDE,F_KILLDESC
|
||||
ITEM "6|Consuntivazione produzione"
|
||||
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@|HIDE,4@|HIDE,5@|HIDE,9@|SHOW,F_KILLDESC
|
||||
ITEM "7|Trasferimento a contabilita' analitica"
|
||||
ITEM "7|Trasferimento a contabilità analitica"
|
||||
MESSAGE HIDE,1@|HIDE,2@|SHOW,3@|HIDE,4@|HIDE,5@|SHOW,9@|HIDE,F_KILLDESC
|
||||
FIELD I0
|
||||
END
|
||||
@ -608,7 +609,7 @@ END
|
||||
|
||||
BOOLEAN F_SPEDIZIONE
|
||||
BEGIN
|
||||
PROMPT 2 6 "Modalita'di spedizione"
|
||||
PROMPT 2 6 "Modalità di spedizione"
|
||||
FIELD S1[9,9]
|
||||
END
|
||||
|
||||
@ -668,7 +669,7 @@ END
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
BEGIN
|
||||
PROMPT 1 9 "@bModalita' di raggruppamento delle righe"
|
||||
PROMPT 1 9 "@bModalità di raggruppamento delle righe"
|
||||
FLAG "R"
|
||||
END
|
||||
|
||||
@ -714,7 +715,7 @@ BEGIN
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
GROUPBOX DLG_NULL 78 6
|
||||
BEGIN
|
||||
PROMPT 1 14 "@bGestione descrizioni"
|
||||
END
|
||||
@ -727,32 +728,31 @@ END
|
||||
|
||||
BOOLEAN F_RIFERIMENTI_IN_TESTA
|
||||
BEGIN
|
||||
PROMPT 40 15 "Tutti i riferimenti in testa"
|
||||
PROMPT 42 15 "Tutti i riferimenti in testa"
|
||||
FIELD B2
|
||||
END
|
||||
|
||||
BOOLEAN F_PACKRIF
|
||||
|
||||
BEGIN
|
||||
PROMPT 68 15 "Rif.sintetici"
|
||||
FIELD B15
|
||||
END
|
||||
|
||||
BOOLEAN F_IGNORA_DESCRIZIONI
|
||||
BEGIN
|
||||
PROMPT 2 16 "Ignora righe con solo descrizione"
|
||||
FIELD B3
|
||||
END
|
||||
|
||||
BOOLEAN F_PACKRIF
|
||||
BEGIN
|
||||
PROMPT 42 16 "Rif.sintetici"
|
||||
FIELD B15
|
||||
END
|
||||
|
||||
BOOLEAN F_USA_DOCRIF
|
||||
BEGIN
|
||||
PROMPT 40 16 "Usa documento di rif. in descr.rif."
|
||||
PROMPT 2 17 "Usa documento di riferimento in descrizione rif."
|
||||
FIELD B8
|
||||
END
|
||||
|
||||
LISTBOX F_SPALMA 1 2
|
||||
BEGIN
|
||||
PROMPT 2 17 "Spalmatura spese"
|
||||
PROMPT 68 17 "Spalmatura spese"
|
||||
ITEM " |No"
|
||||
ITEM "1|Si"
|
||||
FIELD I2
|
||||
@ -761,7 +761,7 @@ END
|
||||
|
||||
LISTBOX F_GROUP_BY_REF 1 2
|
||||
BEGIN
|
||||
PROMPT 2 17 "Raggruppare per riferimento"
|
||||
PROMPT 2 18 "Raggruppare per riferimento"
|
||||
ITEM " |Si"
|
||||
ITEM "1|No"
|
||||
FIELD I3
|
||||
@ -771,7 +771,7 @@ END
|
||||
|
||||
STRING F_RIF_DOCIN 4
|
||||
BEGIN
|
||||
PROMPT 40 17 "Numerazione documenti in entrata"
|
||||
PROMPT 39 18 "Numerazione documenti in entrata"
|
||||
USE %NUM
|
||||
INPUT CODTAB F_RIF_DOCIN
|
||||
DISPLAY "Codice" CODTAB
|
||||
@ -783,10 +783,10 @@ END
|
||||
|
||||
NUMBER F_COLONNE_CO 1
|
||||
BEGIN
|
||||
PROMPT 1 19 "Intestazioni consegna ordini "
|
||||
PROMPT 1 20 "Intestazioni consegna ordini "
|
||||
SHEET "Tipo|Colonna 1@25|Colonna 2@25"
|
||||
ITEM " |Quantita' residua|Quantita' da evadere"
|
||||
ITEM "1|Quantita' consegnata|Quantita' da fatturare"
|
||||
ITEM " |Quantità residua|Quantità da evadere"
|
||||
ITEM "1|Quantità consegnata|Quantità da fatturare"
|
||||
ITEM "2|Residuo|Da evadere"
|
||||
INPUT F_COLONNE_CO
|
||||
OUTPUT F_COLONNE_CO
|
||||
|
Loading…
x
Reference in New Issue
Block a user