git-svn-id: svn://10.65.10.50/branches/R_10_00@22928 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
526ec34d8a
commit
7fcde8da9b
@ -372,7 +372,14 @@ const char* TMotore_application::get_next_key( )
|
||||
return "";
|
||||
}
|
||||
|
||||
int TMotore_application::read( TMask& m )
|
||||
const char* TMotore_application::record_description(const TRelation& rel) const
|
||||
{
|
||||
const TString4 tipodoc = rel.curr().get(DOC_TIPODOC);
|
||||
const TString& desc = cache().get("%TIP", tipodoc, "S0");
|
||||
return desc.empty() ? TR("Documento") : desc;
|
||||
}
|
||||
|
||||
int TMotore_application::read(TMask& m)
|
||||
{
|
||||
TDocumento_mask& mask = (TDocumento_mask&) m;
|
||||
TRelation_application::read(m);
|
||||
|
@ -79,6 +79,8 @@ protected:
|
||||
virtual bool last_doc(char provv, int anno, const char* codnum, long& ndoc, TDate& datadoc) const;
|
||||
bool save_and_print(bool savedoc, TPrtype mode);
|
||||
|
||||
virtual const char* record_description(const TRelation& rel) const;
|
||||
|
||||
public:
|
||||
virtual void do_elab(TDocumento& doc, int w = 0); // w 0=Save; 1=Print; 2=Definitive
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ TMask* TVendite_tabapp::set_mask(TMask* m)
|
||||
TFilename mn; get_mask_name(mn);
|
||||
TVendite_mask* vm = new TVendite_mask(mn);
|
||||
|
||||
if (has_module(CAAUT, CHK_DONGLE) || has_module(CMAUT, CHK_DONGLE))
|
||||
if (ca_config().get_int("Authorizations") != 0)
|
||||
{
|
||||
// Crea i campi per i conti analitici (vendite e acquisti)
|
||||
if (vm->table_code() == "SPP")
|
||||
|
@ -56,7 +56,7 @@ class TRighe_condizioni_vendita: public TRelation_application
|
||||
static bool handle_price(TMask_field &, KEY); // handler del prezzo netto e lordo
|
||||
static bool handle_qta(TMask_field &, KEY); // handler della quantita' limite per scaglione
|
||||
static bool handle_sca(TMask_field &, KEY); // handler dello scaglione
|
||||
static void fill_rec(TRectype& r, TMask& m);
|
||||
static void fill_rec(TRectype& r, const TMask& m);
|
||||
static real find_prev_qta(const TRectype& r);
|
||||
static real find_next_qta(const TRectype& r);
|
||||
static const char* look_codiva(char tipo, TString& cod);
|
||||
@ -384,7 +384,7 @@ bool TRighe_condizioni_vendita::handle_price(TMask_field &f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TRighe_condizioni_vendita::fill_rec(TRectype &r, TMask& m)
|
||||
void TRighe_condizioni_vendita::fill_rec(TRectype &r, const TMask& m)
|
||||
{
|
||||
const char c = app()._rcondven[0];
|
||||
short id = (c == 'C' ? F_R_C_COD : (c == 'L' ? F_R_L_COD : F_R_O_COD));
|
||||
@ -406,64 +406,56 @@ bool TRighe_condizioni_vendita::handle_qta(TMask_field &f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
real qta_prev,qta_next;
|
||||
real current_qta(f.get());
|
||||
TRectype r1(LF_RCONDV);
|
||||
fill_rec(r1,m);
|
||||
TRectype r2(r1);
|
||||
|
||||
qta_prev = find_prev_qta(r1);
|
||||
qta_next = find_next_qta(r2);
|
||||
int sca = m.get_int(F_R_NSCAGL);
|
||||
if (sca == 1 && current_qta == 0.0)
|
||||
const TMask& m = f.mask();
|
||||
const real current_qta = f.get();
|
||||
const int sca = m.get_int(F_R_NSCAGL);
|
||||
if (sca > 1)
|
||||
{
|
||||
f.error_box("La quantita' limite deve essere maggiore di 0");
|
||||
return FALSE;
|
||||
TRectype r1(LF_RCONDV); fill_rec(r1,m);
|
||||
const real qta_prev = find_prev_qta(r1);
|
||||
if (qta_prev >= current_qta)
|
||||
return f.error_box(FR("La quantità limite deve maggiore di %s (scaglione %d)"),
|
||||
qta_prev.stringa(), sca-1);
|
||||
}
|
||||
if (sca == 9 && current_qta == 0.0) return TRUE;
|
||||
if (qta_next <= current_qta)
|
||||
else
|
||||
{
|
||||
f.error_box("La quantita' limite deve essere minore di %s.",
|
||||
(const char*)qta_next.string());
|
||||
return FALSE;
|
||||
if (current_qta.is_zero())
|
||||
return f.error_box(TR("La quantità limite deve essere maggiore di 0"));
|
||||
}
|
||||
if (qta_prev >= current_qta)
|
||||
|
||||
if (sca < 9)
|
||||
{
|
||||
f.error_box("La quantita' limite deve maggiore di %s.",
|
||||
(const char*)qta_prev.string());
|
||||
return FALSE;
|
||||
TRectype r2(LF_RCONDV); fill_rec(r2,m);
|
||||
const real qta_next = find_next_qta(r2);
|
||||
if (qta_next > ZERO && qta_next <= current_qta)
|
||||
return f.error_box(FR("La quantità limite deve essere minore di %s (scaglione %d)"),
|
||||
qta_next.stringa(), sca+1);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TRighe_condizioni_vendita::handle_sca(TMask_field &f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
int sca = atoi(f.get());
|
||||
if (sca == 1) return TRUE;
|
||||
|
||||
TRectype r(LF_RCONDV);
|
||||
fill_rec(r, m);
|
||||
TLocalisamfile cond(LF_RCONDV);
|
||||
|
||||
cond.curr() = r;
|
||||
cond.read();
|
||||
if (cond.bad()) // se non l'ha trovato significa che e' in inserimento
|
||||
const int sca = atoi(f.get());
|
||||
if (sca > 1)
|
||||
{
|
||||
sca--;
|
||||
r.put("NSCAGL",sca); //cerca quello precedente...
|
||||
if (cond.read(r) != NOERR) // se non lo trova segnala l'errore di errata sequenza
|
||||
TMask& m = f.mask();
|
||||
TRectype r(LF_RCONDV);
|
||||
fill_rec(r, m);
|
||||
|
||||
TLocalisamfile cond(LF_RCONDV);
|
||||
if (cond.read() != NOERR) // se non l'ha trovato significa che e' in inserimento
|
||||
{
|
||||
f.error_box("Il numero di scaglione immesso non e' in sequenza.");
|
||||
return FALSE;
|
||||
r.put("NSCAGL", sca-1); //cerca quello precedente...
|
||||
if (cond.read(r) != NOERR) // se non lo trova segnala l'errore di errata sequenza
|
||||
return f.error_box(TR("Numero di scaglione fuori sequenza"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* TRighe_condizioni_vendita::look_codiva(char tipo, TString& cod)
|
||||
@ -504,7 +496,7 @@ real TRighe_condizioni_vendita::find_prev_qta(const TRectype& r)
|
||||
TLocalisamfile f(LF_RCONDV);
|
||||
real qta = ZERO;
|
||||
f.curr() = r;
|
||||
int nscagl = r.get_int("NSCAGL");
|
||||
const int nscagl = r.get_int("NSCAGL");
|
||||
f.put("NSCAGL", nscagl-1);
|
||||
if (f.read() == NOERR)
|
||||
qta = f.get_real("QLIM");
|
||||
@ -516,7 +508,7 @@ real TRighe_condizioni_vendita::find_next_qta(const TRectype& r)
|
||||
TLocalisamfile f(LF_RCONDV);
|
||||
real qta(1e10);
|
||||
f.curr() = r;
|
||||
int nscagl = r.get_int("NSCAGL");
|
||||
const int nscagl = r.get_int("NSCAGL");
|
||||
f.put("NSCAGL", nscagl+1);
|
||||
if (f.read() == NOERR)
|
||||
qta = f.get_real("QLIM");
|
||||
|
@ -38,8 +38,8 @@ class TStampa_condizioni_vendita: public TPrint_application
|
||||
bool _testastamp; // booleano di testata completa già stampata
|
||||
bool _gest_val, _gest_um, _gest_sca, _gest_so; // booleani per l'abilitazione di valute, unità di misura, scaglioni e sconti/omaggi
|
||||
bool _filter_by_grm; //Filtro per gruppo merceologico nel caso di stampa righe articoli
|
||||
TString4 _codiva, _um, _descragg;
|
||||
TString _strprezzo, _stromaggio, _strstorico; //stringhe per la stampa del prezzo dell'articolo (normale, omaggiato e storico!)
|
||||
TString4 _codiva, _um;
|
||||
TString _strprezzo, _stromaggio, _strstorico, _descragg; //stringhe per la stampa del prezzo dell'articolo (normale, omaggiato e storico!)
|
||||
|
||||
protected:
|
||||
static bool tipo_handler(TMask_field& f, KEY k);
|
||||
@ -314,8 +314,8 @@ bool TStampa_condizioni_vendita::preprocess_page(int i, int c)
|
||||
{
|
||||
if (i == LF_RCONDV)
|
||||
{
|
||||
TLocalisamfile &rcondv= current_cursor()->file();
|
||||
TLocalisamfile &anamag= current_cursor()->file(-ART1);
|
||||
const TRectype& rcondv= current_cursor()->curr();
|
||||
const TRectype& anamag= current_cursor()->curr(-ART1);
|
||||
_codiva = rcondv.get("CODIVA");
|
||||
_um = rcondv.get("UM");
|
||||
if (_printdesagg)
|
||||
@ -327,7 +327,7 @@ bool TStampa_condizioni_vendita::preprocess_page(int i, int c)
|
||||
if (_codiva.empty())
|
||||
_codiva = anamag.get("CODIVA");
|
||||
if (_um.empty())
|
||||
_um = current_cursor()->file(LF_UMART).get("UM"); // Prima unità di misura per sto articolo
|
||||
_um = current_cursor()->curr(LF_UMART).get("UM"); // Prima unità di misura per sto articolo
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -597,9 +597,9 @@ void TStampa_condizioni_vendita::set_page(int file, int) {
|
||||
}
|
||||
}
|
||||
|
||||
int ve3200(int argc, char **argv) {
|
||||
int ve3200(int argc, char **argv)
|
||||
{
|
||||
TStampa_condizioni_vendita a;
|
||||
|
||||
a.run(argc, argv, "Stampa condizioni vendita");
|
||||
a.run(argc, argv, TR("Stampa condizioni vendita"));
|
||||
return 0;
|
||||
}
|
||||
|
@ -249,6 +249,7 @@ public:
|
||||
// Funzioni che effettuano la cache di importanti valori contenuti nel profilo
|
||||
const char tipocf() const;
|
||||
void set_defaults(TMask& m) const;
|
||||
const TString_array& get_defaults() const;
|
||||
const TString_array& keys_descrs() const;
|
||||
const TString_array& sheet_columns() const;
|
||||
const TPointer_array& handlers() const;
|
||||
@ -891,13 +892,18 @@ public:
|
||||
virtual ~TDocumento();
|
||||
};
|
||||
|
||||
/*
|
||||
#define FOR_EACH_PHYSICAL_RDOC(__doc, __r, __rdoc) TRiga_documento* __rdoc=NULL; \
|
||||
TRecord_array& bodyof##__rdoc = (__doc).body(); \
|
||||
for (int __r = bodyof##__rdoc.first_row(); bodyof##__rdoc.exist(__r) && (__rdoc=&(__doc)[__r])!=NULL; __r=bodyof##__rdoc.succ_row(__r))
|
||||
*/
|
||||
#define FOR_EACH_PHYSICAL_RDOC(__doc, __r, __rdoc) TRiga_documento* __rdoc=NULL; \
|
||||
TRecord_array& bodyof##__rdoc = (__doc).body(); \
|
||||
for (int __r = bodyof##__rdoc.first_row(); bodyof##__rdoc.exist(__r) && (__rdoc=&(TRiga_documento&)bodyof##__rdoc.row(__r))!=NULL; __r=bodyof##__rdoc.succ_row(__r))
|
||||
|
||||
#define FOR_EACH_PHYSICAL_RDOC_BACK(__doc, __r, __rdoc) TRiga_documento* __rdoc=NULL; \
|
||||
TRecord_array& bodyof##__rdoc = (__doc).body(); \
|
||||
for (int __r = bodyof##__rdoc.last_row(); __r>0 && (__rdoc=&(__doc)[__r])!= NULL; __r = bodyof##__rdoc.pred_row(__r))
|
||||
for (int __r = bodyof##__rdoc.last_row(); __r>0 && (__rdoc=&(TRiga_documento&)bodyof##__rdoc.row(__r))!= NULL; __r = bodyof##__rdoc.pred_row(__r))
|
||||
|
||||
class TCurrency_documento : public TCurrency
|
||||
{
|
||||
@ -984,6 +990,7 @@ protected:
|
||||
|
||||
int insert_anal_fields(TMask& m, int page, int lf, int& y, short& dlg, short& dlgd, bool required);
|
||||
void insert_anal_page();
|
||||
void set_or_def(short id, const TString& val);
|
||||
|
||||
public:
|
||||
virtual bool is_omaggio_enabled() { return true;}
|
||||
|
135
ve/velib03.cpp
135
ve/velib03.cpp
@ -17,10 +17,6 @@
|
||||
#include "vepriv.h"
|
||||
#include "veuml.h"
|
||||
|
||||
//#include <doc.h>
|
||||
//#include <clifo.h>
|
||||
//#include <cfven.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTipo_documento_cache
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -48,15 +44,13 @@ TObject* TTipo_documento_cache::rec2obj(const TRectype& curr) const
|
||||
return new TTipo_documento(curr);
|
||||
}
|
||||
|
||||
TTipo_documento & TTipo_documento_cache::tipo(const char* key)
|
||||
TTipo_documento& TTipo_documento_cache::tipo(const char* key)
|
||||
{
|
||||
TString8 k;
|
||||
k << "TIP|" << key;
|
||||
TTipo_documento & tipo = (TTipo_documento &) query(k);
|
||||
return tipo;
|
||||
TString8 k; k << "TIP|" << key;
|
||||
return (TTipo_documento&)query(k);
|
||||
}
|
||||
|
||||
const TTipo_documento & cached_tipodoc(const char * tipodoc)
|
||||
const TTipo_documento& cached_tipodoc(const char* tipodoc)
|
||||
{
|
||||
HIDDEN TTipo_documento_cache __cache_tipi_documento;
|
||||
return __cache_tipi_documento.tipo(tipodoc);
|
||||
@ -73,7 +67,6 @@ protected:
|
||||
public:
|
||||
TCodice_numerazione & num(const char* key);
|
||||
TNumerazione_cache();
|
||||
virtual ~TNumerazione_cache() { }
|
||||
};
|
||||
|
||||
TNumerazione_cache::TNumerazione_cache()
|
||||
@ -90,11 +83,8 @@ TObject* TNumerazione_cache::rec2obj(const TRectype& curr) const
|
||||
|
||||
TCodice_numerazione & TNumerazione_cache::num(const char* key)
|
||||
{
|
||||
TString8 k;
|
||||
|
||||
k << "NUM|" << key;
|
||||
TCodice_numerazione & num = (TCodice_numerazione &) query(k);
|
||||
return num;
|
||||
TString8 k; k << "NUM|" << key;
|
||||
return (TCodice_numerazione&)query(k);
|
||||
}
|
||||
|
||||
const TCodice_numerazione& cached_numerazione(const char * codnum)
|
||||
@ -328,15 +318,15 @@ void TDocumento::set_variables(TExpression * e) const
|
||||
|
||||
switch (field.file())
|
||||
{
|
||||
case LF_CLIFO :
|
||||
e->setvar(i, clifor().get(field.name()));
|
||||
break;
|
||||
case LF_CFVEN :
|
||||
e->setvar(i, clifor().vendite().get(field.name()));
|
||||
break;
|
||||
default:
|
||||
e->setvar(i, get(field.name()));
|
||||
break;
|
||||
case LF_CLIFO :
|
||||
e->setvar(i, clifor().get(field.name()));
|
||||
break;
|
||||
case LF_CFVEN :
|
||||
e->setvar(i, clifor().vendite().get(field.name()));
|
||||
break;
|
||||
default:
|
||||
e->setvar(i, get(field.name()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1128,9 +1118,9 @@ static real doc_inventory_qta(const TCausale_magazzino & cau, const TString & co
|
||||
real q = qta - giac;
|
||||
switch (cau.sgn(s_giac))
|
||||
{
|
||||
case 1: break;
|
||||
case -1: q = -q; break;
|
||||
default: break;
|
||||
case 1: break;
|
||||
case -1: q = -q; break;
|
||||
default: break;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
@ -2190,8 +2180,8 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
||||
TArray imponibili;
|
||||
const bool fatt_comm = tipo().fattura_commerciale();
|
||||
|
||||
TString4 codiva_es;
|
||||
iva_esente(codiva_es);
|
||||
TString4 codiva_es; iva_esente(codiva_es);
|
||||
|
||||
for (int i = items; i > 0; i--)
|
||||
{
|
||||
const TRiga_documento& r = row(i);
|
||||
@ -2207,8 +2197,8 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
||||
else
|
||||
if (!r.is_descrizione())
|
||||
{
|
||||
const real imposta = doc_al_lordo ? ZERO :r.imposta(FALSE);
|
||||
// Aggiorna o aggiunge l'elemento se non esiste
|
||||
const real imposta = doc_al_lordo ? ZERO : r.imposta(false);
|
||||
// Aggiorna o aggiunge l'elemento se non esiste
|
||||
const TCodiceIVA & iva = r.iva();
|
||||
|
||||
if (iva.ok())
|
||||
@ -2231,7 +2221,7 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
||||
}
|
||||
}
|
||||
|
||||
if (table.items() == 0)
|
||||
if (table.empty())
|
||||
return;
|
||||
|
||||
if (tot_sconti != ZERO)
|
||||
@ -2244,17 +2234,18 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
||||
FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
|
||||
{
|
||||
TRiepilogo_iva* aliquota = (TRiepilogo_iva*)o;
|
||||
d.add(aliquota->imp() - aliquota->imp_spese_row());
|
||||
const real i = aliquota->imp() - aliquota->imp_spese_row();
|
||||
d.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
|
||||
{
|
||||
TRiepilogo_iva * aliquota = (TRiepilogo_iva *) o;
|
||||
const TCodiceIVA & ci = aliquota->cod_iva();
|
||||
const real i(d.get());
|
||||
real & imponibile = aliquota->imp();
|
||||
|
||||
TRiepilogo_iva& aliquota = *(TRiepilogo_iva*)o;
|
||||
const TCodiceIVA& ci = aliquota.cod_iva();
|
||||
const real i = d.get();
|
||||
|
||||
real& imponibile = aliquota.imp();
|
||||
imponibile += i;
|
||||
|
||||
TGeneric_distrib s(i, ndec);
|
||||
@ -2262,10 +2253,10 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
||||
s.add(tot_sconti_imp);
|
||||
s.add(tot_sconti_perc);
|
||||
|
||||
aliquota->sconto_imp() = s.get();
|
||||
aliquota->sconto_perc() = s.get();
|
||||
aliquota.sconto_imp() = s.get();
|
||||
aliquota.sconto_perc() = s.get();
|
||||
|
||||
real & iva = aliquota->iva();
|
||||
real& iva = aliquota.iva();
|
||||
|
||||
/* if (doc_al_lordo)
|
||||
{
|
||||
@ -2287,7 +2278,7 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
|
||||
const real imposta(ci.imposta(i, ndec));
|
||||
|
||||
iva += imposta;
|
||||
aliquota->iva_sconto() = imposta;
|
||||
aliquota.iva_sconto() = imposta;
|
||||
tot_doc += imposta;
|
||||
}
|
||||
}
|
||||
@ -2759,7 +2750,7 @@ void TDocumento::update_raee()
|
||||
}
|
||||
}
|
||||
|
||||
void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old, TSheet_field * sh)
|
||||
void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old, TSheet_field* sh)
|
||||
{
|
||||
const bool updated = get_bool(DOC_SPESEUPD);
|
||||
if (updated)
|
||||
@ -2800,7 +2791,7 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
|
||||
const TString& s = spese_aut.row(i);
|
||||
|
||||
if (sp.read(s) != NOERR)
|
||||
message_box("Codice spesa %s assente", (const char *) s);
|
||||
warning_box("Codice spesa '%s' assente", (const char*)s);
|
||||
else
|
||||
{
|
||||
const TString4 tipo(sp.tipo_riga());
|
||||
@ -2815,34 +2806,34 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
|
||||
riga.put(RDOC_CODIVA, cod_iva_cli);
|
||||
switch (sp.tipo())
|
||||
{
|
||||
case 'Q':
|
||||
{
|
||||
real qta = sp.qta();
|
||||
if (qta == ZERO)
|
||||
qta = UNO;
|
||||
riga.put("QTA", qta);
|
||||
}
|
||||
// Continua perche' e' quantita' e valore
|
||||
case 'V':
|
||||
{
|
||||
const real cambio = get_real(DOC_CAMBIO);
|
||||
const TString4 valuta = get(DOC_CODVAL);
|
||||
real prezzo = sp.prezzo();
|
||||
case 'Q':
|
||||
{
|
||||
real qta = sp.qta();
|
||||
if (qta == ZERO)
|
||||
qta = UNO;
|
||||
riga.put("QTA", qta);
|
||||
}
|
||||
// Continua perche' e' quantita' e valore
|
||||
case 'V':
|
||||
{
|
||||
const real cambio = get_real(DOC_CAMBIO);
|
||||
const TString4 valuta = get(DOC_CODVAL);
|
||||
real prezzo = sp.prezzo();
|
||||
|
||||
sppr_calc(sp, valuta, cambio, prezzo);
|
||||
if (this->tipo().calcolo_lordo())
|
||||
{
|
||||
prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS);
|
||||
riga.put(RDOC_PREZZOL, prezzo);
|
||||
}
|
||||
riga.put(RDOC_PREZZO, prezzo);
|
||||
riga.put(RDOC_UMQTA, sp.um());
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
default:
|
||||
riga.put(RDOC_QTA, sp.perc());
|
||||
break;
|
||||
sppr_calc(sp, valuta, cambio, prezzo);
|
||||
if (this->tipo().calcolo_lordo())
|
||||
{
|
||||
prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS);
|
||||
riga.put(RDOC_PREZZOL, prezzo);
|
||||
}
|
||||
riga.put(RDOC_PREZZO, prezzo);
|
||||
riga.put(RDOC_UMQTA, sp.um());
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
default:
|
||||
riga.put(RDOC_QTA, sp.perc());
|
||||
break;
|
||||
}
|
||||
if (cod_iva_cli.empty())
|
||||
riga.put(RDOC_CODIVA, sp.cod_iva());
|
||||
|
@ -1,11 +1,10 @@
|
||||
#include <recset.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "velib.h"
|
||||
#include "vepriv.h"
|
||||
#include "verig.h"
|
||||
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "../db/dblib.h"
|
||||
#include "../mg/mglib.h"
|
||||
|
||||
@ -307,7 +306,7 @@ const TPointer_array& TTipo_documento::handlers() const
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
void TTipo_documento::set_defaults(TMask& m) const
|
||||
const TString_array& TTipo_documento::get_defaults() const
|
||||
{
|
||||
if (_defaults.empty()) // Carica lo string_array con i defaults
|
||||
{
|
||||
@ -323,11 +322,15 @@ void TTipo_documento::set_defaults(TMask& m) const
|
||||
((TTipo_documento*)this)->_defaults.add(s.get(), field);
|
||||
}
|
||||
}
|
||||
return _defaults;
|
||||
}
|
||||
|
||||
void TTipo_documento::set_defaults(TMask& m) const
|
||||
{
|
||||
const TString_array& def = get_defaults();
|
||||
// Setta i campi della maschera
|
||||
FOR_EACH_ARRAY_ROW(_defaults, i, tt)
|
||||
{
|
||||
m.set(i, *tt, TRUE);
|
||||
}
|
||||
FOR_EACH_ARRAY_ROW(def, i, tt)
|
||||
m.set(i, *tt, true);
|
||||
}
|
||||
|
||||
void TTipo_documento::add_formula_if_needed(TConfig& profile, TString& variable,
|
||||
|
@ -168,7 +168,7 @@ int TLista_documenti::write(bool re) const
|
||||
else
|
||||
msg.format(FR("Creazione di %d documenti"), docs);
|
||||
|
||||
TProgind pi(docs, msg, true, true);
|
||||
TProgress_monitor pi(docs, msg, true);
|
||||
int err = NOERR;
|
||||
for (int i = 0; i < docs && err == NOERR; i++)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ void TFatturazione_bolle::campi_raggruppamento_righe(TToken_string& campi_riga)
|
||||
{
|
||||
campi_riga = RDOC_CODART"|"RDOC_UMQTA; // Uguali sempre
|
||||
// Uguali se commesse attive
|
||||
if (dongle().active(CAAUT) || dongle().active(CMAUT))
|
||||
if (ca_config().get_int("Authorizations") != 0)
|
||||
{
|
||||
campi_riga.add(RDOC_CODCMS);
|
||||
campi_riga.add(RDOC_FASCMS);
|
||||
@ -123,7 +123,6 @@ void TFatturazione_bolle::elabora_riga(TRiga_documento& r, TDocumento& doc_out,
|
||||
if (rin.is_generata() && rin.get("GENTIPO").empty() && rin.is_spese())
|
||||
{
|
||||
const TSpesa_prest& sp = rin.spesa();
|
||||
|
||||
if (sp.tipo() == 'P')
|
||||
return;
|
||||
}
|
||||
@ -138,7 +137,6 @@ void TFatturazione_bolle::elabora_riga(TRiga_documento& r, TDocumento& doc_out,
|
||||
return;
|
||||
|
||||
const real q = rin.get(RDOC_QTA);
|
||||
|
||||
r.put(RDOC_QTAEVASA, q);
|
||||
r.put(RDOC_RIGAEVASA, true);
|
||||
}
|
||||
@ -452,7 +450,6 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
return error_box("Documenti incompatibili: cliente/fornitore diverso");
|
||||
|
||||
const TString4 codnum(out.get(DOC_CODNUM));
|
||||
|
||||
if (cached_numerazione(codnum).num_provv())
|
||||
out.put(DOC_PROVV, 'P');
|
||||
}
|
||||
@ -496,8 +493,10 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
// TRecfield td(campione, DOC_TIPODOC); // Uso il TRecfield per scavalcare tutti gli automatismi
|
||||
// const TString16 old_tipo_in = td; // Salvo il vecchio tipo
|
||||
// td = tipo_out; // Setto il nuovo
|
||||
TDocumento::copy_data(new_doc->head(), campione.head()); // Copio la testata
|
||||
TDocumento::copy_data(new_doc->head(), campione.head()); // Copio la testata
|
||||
// td = old_tipo_in; // Ripristino il vecchio
|
||||
|
||||
new_doc->zero(DOC_SPESEUPD); // Senno' non aggiorna le spese automatiche
|
||||
|
||||
new_doc->put(DOC_DATADOC, data_elab);
|
||||
|
||||
@ -590,10 +589,9 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
||||
else
|
||||
d.put("FATID", 0);
|
||||
}
|
||||
for (int i = doc_out.items() - 1; i >=0; i--) // Aggiorna esenzione
|
||||
for (int i = doc_out.items() - 1; i >= 0; i--) // Aggiorna esenzione
|
||||
{
|
||||
TDocumento& d = doc_out[i];
|
||||
|
||||
d.update_esenzione();
|
||||
}
|
||||
return doc_out.items() > 0;
|
||||
|
@ -1138,7 +1138,6 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
||||
descr << ' ';
|
||||
}
|
||||
|
||||
|
||||
const TString16 rif = doc.get(DOC_NUMDOCRIF);
|
||||
const bool use_rif = _caus->iva() == iva_acquisti && rif.not_empty();
|
||||
if (use_rif)
|
||||
@ -3146,7 +3145,7 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi
|
||||
if (good() && in_enabled())
|
||||
write_intra(doc);
|
||||
|
||||
if (good() && (dongle().active(CMAUT) || dongle().active(CAAUT)))
|
||||
if (good() && (ca_config().get_int("Authorizations") & 0x5)) // No CI qui
|
||||
write_anal(doc, movimento);
|
||||
|
||||
const int tipocoll = _caus->link_m770();
|
||||
@ -3225,7 +3224,7 @@ error_type TContabilizzazione::write_all_re(TDocumento& doc, TMovimentoPN_VE & m
|
||||
aggiorna_saldi(saldo, movimento, true);
|
||||
dispatch_transaction(movimento, old_numreg > 0 ? "MODIFY": "INSERT");
|
||||
|
||||
if (good() && (dongle().active(CMAUT) || dongle().active(CAAUT)))
|
||||
if (good() && (ca_config().get_int("Authorizations") & 0x5)) // No CIAUT
|
||||
write_anal(doc, movimento);
|
||||
|
||||
if (good())
|
||||
|
@ -112,35 +112,32 @@ int rows_sort_func(TSheet_field& s, int i, int j)
|
||||
{
|
||||
const TToken_string& s1 = s.row(i);
|
||||
const TToken_string& s2 = s.row(j);
|
||||
TString80 ss1, ss2;
|
||||
TDate dd1, dd2;
|
||||
real rr1, rr2;
|
||||
const int fields[] = { S_CODART, S_LIVGIAC1, S_LIVGIAC2, S_LIVGIAC3, S_LIVGIAC4,
|
||||
S_CODMAG, S_CODDEP, S_RIGAEVASA, S_DATACONS, S_QTARESIDUA, -1 };
|
||||
|
||||
const short fields[] = { S_CODART, S_LIVGIAC1, S_LIVGIAC2, S_LIVGIAC3, S_LIVGIAC4,
|
||||
S_CODMAG, S_CODDEP, S_RIGAEVASA, S_DATACONS, S_QTARESIDUA, -1 };
|
||||
int ret = 0;
|
||||
for (short field = 0; fields[field] > 0; field++)
|
||||
for (int field = 0; ret == 0 && fields[field] > 0; field++)
|
||||
{
|
||||
if (fields[field] == S_QTARESIDUA)
|
||||
{
|
||||
real rr1, rr2;
|
||||
s1.get(fields[field]-FIRST_FIELD, rr1);
|
||||
s2.get(fields[field]-FIRST_FIELD, rr2);
|
||||
ret = rr2 < rr1 ? -1 : (rr2 > rr1 ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
TString80 ss1, ss2;
|
||||
s1.get(fields[field]-FIRST_FIELD ,ss1);
|
||||
s2.get(fields[field]-FIRST_FIELD ,ss2);
|
||||
if (fields[field] == S_DATACONS)
|
||||
{
|
||||
dd1 = ss1;
|
||||
dd2 = ss2;
|
||||
const TDate dd1 = ss1, dd2 = ss2;
|
||||
ret = int (dd1.date2ansi() - dd2.date2ansi());
|
||||
}
|
||||
else
|
||||
ret = ss1.compare(ss2);
|
||||
}
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -199,10 +196,14 @@ void TConsegna_mask::doc2mask(const TDocumento& doc, const TString& articolo)
|
||||
const TString& livello = rec.get(RDOC_LIVELLO);
|
||||
for (int l = 1; l <= 4; l++)
|
||||
r.add(livelli_giacenza().unpack_grpcode(livello, l));
|
||||
if (rec.get_date(RDOC_DATACONS).ok())
|
||||
r.add(rec.get_date(RDOC_DATACONS));
|
||||
|
||||
// Reperisce data di consegna da riga o testata
|
||||
const TDate row_data_cons = rec.get(RDOC_DATACONS);
|
||||
if (row_data_cons.ok())
|
||||
r.add(row_data_cons);
|
||||
else
|
||||
r.add(doc.get_date(DOC_DATACONS));
|
||||
|
||||
r.add(rec.get(RDOC_PREZZO), s.cid2index(S_PREZZO));
|
||||
r.add(rec.get(RDOC_DESCR), s.cid2index(S_DESCR));
|
||||
r.add(rec.get(RDOC_TIPORIGA), s.cid2index(S_TIPORIGA));
|
||||
@ -226,10 +227,10 @@ TConsegna_mask::TConsegna_mask(int header_code, bool per_codice, bool ignora_des
|
||||
if (header_code == 1)
|
||||
{
|
||||
s.set_column_header(S_QTARESIDUA, HR("Quantità\nconsegnata"));
|
||||
s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Q.ta' consegnata"));
|
||||
s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Q.tà consegnata"));
|
||||
|
||||
s.set_column_header(S_QTADAEVADERE, HR("Quantità\nda fatturare"));
|
||||
s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Q.ta' da fatturare"));
|
||||
s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Q.tà da fatturare"));
|
||||
} else
|
||||
if (header_code == 2)
|
||||
{
|
||||
@ -692,12 +693,12 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
||||
if (prezzo_da_ordine())
|
||||
{
|
||||
//const bool doc_al_lordo = outdoc.tipo().calcolo_lordo();
|
||||
const TString & codart = outrec.get(RDOC_CODARTMAG);
|
||||
const TRectype & anamag = cache().get(LF_ANAMAG, codart);
|
||||
const TString& codart = outrec.get(RDOC_CODARTMAG);
|
||||
const TRectype& anamag = cache().get(LF_ANAMAG, codart);
|
||||
|
||||
if (!anamag.empty())
|
||||
{
|
||||
const TString16 field_prezzo = outdoc.tipo().field_prezzo();
|
||||
const TFixed_string field_prezzo = outdoc.tipo().field_prezzo();
|
||||
if (field_prezzo.full())
|
||||
outrec.put(RDOC_PREZZO, anamag.get_real(field_prezzo));
|
||||
else
|
||||
@ -716,6 +717,14 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TDate dc = outrec.get(RDOC_DATACONS); // Controllo che sia sempre piena la data di consegna,
|
||||
if (!dc.ok()) // che potrebbe venire da righe che non ce l'hanno perchè uguale alla testata!
|
||||
{
|
||||
dc = row->get(S_DATACONS - FIRST_FIELD);
|
||||
outrec.put(RDOC_DATACONS, dc);
|
||||
}
|
||||
|
||||
const int last_row = outdoc.physical_rows();
|
||||
if (j > 0 && last_row > 0 && gestione_riferimenti())
|
||||
{
|
||||
@ -723,6 +732,7 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
||||
if (last_rdoc.is_descrizione() && last_rdoc.get("RIFR").full())
|
||||
outdoc.destroy_row(last_row, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
111
ve/velib06.cpp
111
ve/velib06.cpp
@ -120,14 +120,9 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
||||
listbox.replace_items(keys, desc);
|
||||
|
||||
// Controlla se deve generare la pagina di analitica
|
||||
_ges_ca = dongle().active(CAAUT) || dongle().active(CMAUT);
|
||||
_ges_ca = ca_config().get_int("Authorizations") != 0;
|
||||
if (_ges_ca)
|
||||
{
|
||||
TConfig& caini = ca_config();
|
||||
_ges_ca = caini.get("Level", NULL, 1).full();
|
||||
if (_ges_ca)
|
||||
insert_anal_page();
|
||||
}
|
||||
insert_anal_page();
|
||||
|
||||
configura_sheet(*_sheet);
|
||||
|
||||
@ -140,7 +135,6 @@ 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())
|
||||
@ -989,6 +983,25 @@ void TDocumento_mask::contr2mask()
|
||||
}
|
||||
}
|
||||
|
||||
void TDocumento_mask::set_or_def(short id, const TString& val)
|
||||
{
|
||||
TMask_field* fld = find_by_id(id);
|
||||
if (fld != NULL)
|
||||
{
|
||||
if (val.blank())
|
||||
{
|
||||
const TString_array& def = doc().tipo().get_defaults();
|
||||
const TString* str = (const TString*)def.objptr(id);
|
||||
if (str != NULL && str->full())
|
||||
fld->set(*str);
|
||||
else
|
||||
fld->reset();
|
||||
}
|
||||
else
|
||||
fld->set(val);
|
||||
}
|
||||
}
|
||||
|
||||
void TDocumento_mask::cli2mask(bool force_load)
|
||||
{
|
||||
const TCli_for& c = doc().clifor();
|
||||
@ -1119,25 +1132,26 @@ void TDocumento_mask::cli2mask(bool force_load)
|
||||
set(F_CODCABP1, cfbanpr.get(CFBAN_CAB), 0x2);
|
||||
set(F_PROGBNP1, cfbanpr.get(CFBAN_PROGPR));
|
||||
}
|
||||
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));
|
||||
set(F_CODAGVIS, ven_rec.get(CFV_CODAG1));
|
||||
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));
|
||||
|
||||
set_or_def(F_RAGGR, ven_rec.get(CFV_RAGGDOC));
|
||||
set_or_def(F_RAGGREFF, ven_rec.get(CFV_RAGGEFF));
|
||||
set_or_def(F_CODINDSP, ven_rec.get(CFV_CODINDSP));
|
||||
set_or_def(F_CODAG, ven_rec.get(CFV_CODAG));
|
||||
set_or_def(F_CODAGVIS, ven_rec.get(CFV_CODAG1));
|
||||
set_or_def(F_CODSPMEZZO, ven_rec.get(CFV_CODSPMEZZO));
|
||||
set_or_def(F_CODPORTO, ven_rec.get(CFV_CODPORTO));
|
||||
set_or_def(F_CODNOTESP1, ven_rec.get(CFV_CODNOTESP1));
|
||||
set_or_def(F_CODNOTESP2, ven_rec.get(CFV_CODNOTESP2));
|
||||
set_or_def(F_CODNOTE, ven_rec.get(CFV_CODNOTE));
|
||||
set_or_def(F_CODVETT1, ven_rec.get(CFV_CODVETT1));
|
||||
set_or_def(F_CODVETT2, ven_rec.get(CFV_CODVETT2));
|
||||
set_or_def(F_CODVETT3, ven_rec.get(CFV_CODVETT3));
|
||||
set_or_def(F_SPESEINC, ven_rec.get(CFV_PERCSPINC));
|
||||
set_or_def(F_ADDBOLLI, ven_rec.get(CFV_ADDBOLLI));
|
||||
set_or_def(F_CATVEN, ven_rec.get(CFV_CATVEN));
|
||||
|
||||
const int alleg = c.get_int(CLI_ALLEG);
|
||||
const bool ivadiff = alleg == 7 && ven_rec.get_bool(CFV_FATTSOSP);
|
||||
const bool ivadiff = (alleg == 7) && ven_rec.get_bool(CFV_FATTSOSP);
|
||||
set(F_LIQDIFF, ivadiff ? "X" : "");
|
||||
|
||||
const TDate datadoc = doc().get(DOC_DATADOC);
|
||||
@ -1357,7 +1371,7 @@ void TDocumento_mask::spese2mask()
|
||||
|
||||
void TDocumento_mask::reset_masks(const TString& tipo_doc)
|
||||
{
|
||||
static TString16 last_tipo_doc;
|
||||
static TString4 last_tipo_doc;
|
||||
|
||||
if (tipo_doc != last_tipo_doc)
|
||||
{
|
||||
@ -1835,10 +1849,10 @@ bool TDocumento_mask::ss_handler(TMask_field& f, KEY key)
|
||||
const TSheet_field& ss = (TSheet_field&)f;
|
||||
TDocumento_mask& mask = (TDocumento_mask&)ss.mask();
|
||||
|
||||
TConfig& ini = ca_config();
|
||||
const short cme = mask.cms_end();
|
||||
if (mask.id2pos(cme) > 0 && app().has_module(CAAUT) && mask.get(cme).empty())
|
||||
if (mask.id2pos(cme) > 0 && mask.get(cme).empty() && (ini.get_int("Authorizations") & 0x6))
|
||||
{
|
||||
TConfig& ini = ca_config();
|
||||
if (ini.get_bool("CmsRequired") || ini.get("FathFasi").full())
|
||||
{
|
||||
const int col = ss.cid2index(mask.cms_end_sh());
|
||||
@ -2331,20 +2345,19 @@ int TLista_elaborazioni::select(TString_array & result, const char * tipo_inizia
|
||||
for (TElaborazione* el = (TElaborazione*)_elab->get(); el != NULL; el = (TElaborazione*)_elab->get())
|
||||
{
|
||||
bool ok = false;
|
||||
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;
|
||||
const TString& ti = el->tipo_iniziale(i);
|
||||
ok |= ti == tipo_iniziale && si == *stato_iniziale;
|
||||
}
|
||||
}
|
||||
else
|
||||
ok = true;
|
||||
if ((tipo_finale && *tipo_finale) && (stato_finale && *stato_finale))
|
||||
ok &= el->tipo_finale() == tipo_finale &&
|
||||
el->stato_finale() == stato_finale;
|
||||
ok &= el->tipo_finale() == tipo_finale && el->stato_finale() == stato_finale;
|
||||
if (ok)
|
||||
result.add(el->codice());
|
||||
}
|
||||
@ -2352,10 +2365,10 @@ int TLista_elaborazioni::select(TString_array & result, const char * tipo_inizia
|
||||
return result.items();
|
||||
}
|
||||
|
||||
TElaborazione & TLista_elaborazioni::operator [](const char * key) const
|
||||
TElaborazione& TLista_elaborazioni::operator[](const char * key) const
|
||||
{
|
||||
((TLista_elaborazioni *)this)->read();
|
||||
return (TElaborazione &) (*_elab)[key];
|
||||
return (TElaborazione&)(*_elab)[key];
|
||||
}
|
||||
|
||||
void TLista_elaborazioni::update()
|
||||
@ -2990,7 +3003,7 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
||||
set(F_TYPE, "");
|
||||
}
|
||||
update_ndoc_filter(true);
|
||||
const bool add_to_doc = o.get().not_empty();
|
||||
const bool add_to_doc = o.get().full();
|
||||
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 || add_to_doc;
|
||||
@ -3175,22 +3188,24 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
||||
int TElabora_mask::update_list()
|
||||
{
|
||||
TString_array elabs;
|
||||
const TString4 tipo(_main->get(F_TIPODOC));
|
||||
const TString4 stato(_main->get(F_STATO));
|
||||
const TString4 tipo_elab(get(F_TIPODOC_ELAB));
|
||||
const TString4 stato_elab(get(F_STATODOC_ELAB));
|
||||
const TString& tipo = _main->get(F_TIPODOC);
|
||||
const TString& stato = _main->get(F_STATO);
|
||||
const TString& tipo_elab = get(F_TIPODOC_ELAB);
|
||||
const TString& stato_elab = get(F_STATODOC_ELAB);
|
||||
const bool from_elab = !get_bool(F_TYPE);
|
||||
int items = 0;
|
||||
|
||||
if (from_elab)
|
||||
{
|
||||
items = _elab.select(elabs, tipo, stato,"","") ;
|
||||
items = _elab.select(elabs, tipo, stato, "", "") ;
|
||||
field(F_ANNO_ELAB).check_type(CHECK_REQUIRED);
|
||||
}
|
||||
else
|
||||
{
|
||||
field(F_ANNO_ELAB).check_type(CHECK_NONE);
|
||||
items = _elab.select(elabs, tipo_elab, stato_elab, tipo, stato);
|
||||
if (items == 0)
|
||||
items = _elab.select(elabs, "", "", tipo, stato);
|
||||
}
|
||||
|
||||
TList_field & f = lfield(F_ELAB);
|
||||
@ -3218,7 +3233,7 @@ int TElabora_mask::update_list()
|
||||
|
||||
if (codes != f.get_codes())
|
||||
f.replace_items(codes, descrs);
|
||||
const TElaborazione * e = curr_elab();
|
||||
const TElaborazione* e = curr_elab();
|
||||
if (e != NULL && e->tipo() == _consegna_ordini)
|
||||
show(-GRP_ART);
|
||||
else
|
||||
@ -3360,7 +3375,7 @@ bool TElabora_mask::elabora()
|
||||
// Toglie spunta ai documenti selezionati
|
||||
_tree.toggle_all_nodes();
|
||||
}
|
||||
const TString8 num_in = e->codice_numerazione_iniziale();
|
||||
const TString4 num_in = e->codice_numerazione_iniziale();
|
||||
set(F_CODNUM_ELAB, num_in);
|
||||
set(F_NDOC_ELAB, "");
|
||||
set(F_NUMDOCRIF_ELAB, "");
|
||||
@ -3382,8 +3397,8 @@ bool TElabora_mask::elabora()
|
||||
|
||||
TElaborazione* TElabora_mask::curr_elab()
|
||||
{
|
||||
const TString8 cod_elab(get(F_ELAB));
|
||||
return cod_elab.not_empty() ? &_elab[cod_elab] : NULL;
|
||||
const TString& cod_elab = get(F_ELAB);
|
||||
return cod_elab.full() ? &_elab[cod_elab] : NULL;
|
||||
}
|
||||
|
||||
void TElabora_mask::add_valuta_filter(TString& filter) const
|
||||
@ -3437,7 +3452,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
|
||||
}
|
||||
|
||||
set(F_UPDATE_HEADER, agg_test ? "X" : "");
|
||||
const TString8 num_in = e->codice_numerazione_iniziale();
|
||||
const TString4 num_in = e->codice_numerazione_iniziale();
|
||||
if (elab_changed)
|
||||
{
|
||||
const TString4 tipo_in(e->tipo_iniziale(0));
|
||||
@ -3445,7 +3460,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
|
||||
|
||||
set(F_CODNUM_ELAB, num_in, 0x2);
|
||||
set(F_TIPODOC_ELAB , tipo_in, 0x2);
|
||||
TString8 si; si << stato_in;
|
||||
TString4 si; si << stato_in;
|
||||
set(F_STATODOC_ELAB, si, 0x2);
|
||||
|
||||
// Azzero anno di elaborazione quando ho a che fare con degli ordini
|
||||
|
@ -184,18 +184,17 @@ bool ora_hndl( TMask_field& field, KEY key )
|
||||
{
|
||||
if (field.to_check(key,true))
|
||||
{
|
||||
TString8 ora;
|
||||
|
||||
if (field.automagic() && field.empty())
|
||||
{
|
||||
struct tm* t = xvt_time_now();
|
||||
ora.format("%02d%02d", t->tm_hour, t->tm_min);
|
||||
field.set(ora);
|
||||
const struct tm* t = xvt_time_now();
|
||||
TString4 ora; ora.format("%02d%02d", t->tm_hour, t->tm_min);
|
||||
field.set(ora);
|
||||
|
||||
TMask& m = field.mask();
|
||||
const int pos_data = m.id2pos(field.dlg()) - 1;
|
||||
TMask_field& dt = m.fld(pos_data);
|
||||
if (dt.is_kind_of(CLASS_DATE_FIELD) && dt.automagic())
|
||||
if (dt.automagic() && dt.is_kind_of(CLASS_DATE_FIELD))
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
dt.set(oggi.string());
|
||||
@ -203,8 +202,8 @@ bool ora_hndl( TMask_field& field, KEY key )
|
||||
}
|
||||
else
|
||||
{
|
||||
ora = field.get();
|
||||
if (ora.not_empty())
|
||||
const TString& ora = field.get();
|
||||
if (ora.full())
|
||||
{
|
||||
if (!isdigit(ora[0]) || !isdigit(ora[1]) || !isdigit(ora[2]) ||
|
||||
!isdigit(ora[3]) || atoi(ora.left(2)) > 23 || atoi(ora.mid(2)) > 59)
|
||||
@ -944,7 +943,7 @@ static void search_price(TEdit_field& f, KEY key )
|
||||
nums = mask.get(F_CODNUM);
|
||||
|
||||
TString4 first_num(nums.get(0));
|
||||
TString4 last_num(first_num);;
|
||||
TString4 last_num(first_num);
|
||||
|
||||
TString filter;
|
||||
filter << "((CODNUM==\"" << first_num << "\")";
|
||||
@ -1131,12 +1130,12 @@ static void search_price_article(TEdit_field& f, KEY key )
|
||||
|
||||
|
||||
from.put(RDOC_CODART, codart);
|
||||
from.put(RDOC_LIVELLO, livello);
|
||||
from.put(RDOC_LIVELLO, livello); // Non fa parte della chive 5
|
||||
from.put(RDOC_CODNUM, first_num);
|
||||
from.put(RDOC_ANNO, first_anno);
|
||||
from.put(RDOC_PROVV, 'D');
|
||||
to.put(RDOC_CODART, codart);
|
||||
to.put(RDOC_LIVELLO, livello);
|
||||
to.put(RDOC_LIVELLO, livello); // Non fa parte della chive 5
|
||||
to.put(RDOC_CODNUM, last_num);
|
||||
to.put(RDOC_ANNO, last_anno);
|
||||
to.put(RDOC_PROVV, 'D');
|
||||
|
Loading…
x
Reference in New Issue
Block a user