Patch level : 12.0 1002
Files correlati : vetbspp.msk ve0.exe ve1.exe ve5,exe ve6,exe vetabcom.txt vetbtib.msk Commento : Autoevasione degli ordini. Interno Verificare l'inserimento la cancellazione di una riga e il cmbio di codice articolo
This commit is contained in:
parent
9755f8ccbb
commit
62ada34fed
@ -982,9 +982,10 @@ public:
|
||||
|
||||
void cli2doc();
|
||||
|
||||
void update_row_auto_qta(int nrow, real & qta, bool plus = true);
|
||||
void update_row_auto_qta(int nrow, real & qta, bool plus = true, bool insert = false);
|
||||
bool check_auto_evasione() const { return _qta_evasa_auto.items() > 0; }
|
||||
void auto_evasione();
|
||||
void auto_evasione(const int nrow = -1);
|
||||
void qta_evasa_auto_pack(const int nrow) { _qta_evasa_auto.destroy(nrow, true); }
|
||||
|
||||
int find_nrow(const char * tiporiga, const char * codice) const;
|
||||
TRiga_documento & find_row(const char * tiporiga, const char * codice);
|
||||
@ -1116,7 +1117,7 @@ class TDocumento_mask : public TVariable_mask // velib06
|
||||
short _cdc_end_sh;
|
||||
short _cms_start_sh;
|
||||
short _cms_end_sh;
|
||||
TString _codcms, _codcms_sh;
|
||||
TString _codcms, _codcms_sh, _codart;
|
||||
TArray _color_rules;
|
||||
int _sh_y;
|
||||
|
||||
@ -1224,6 +1225,8 @@ public:
|
||||
const TString& codcms() const { return _codcms;}
|
||||
TString& codcms_sh() { return _codcms_sh;}
|
||||
const TString & codcms_sh() const { return _codcms_sh;}
|
||||
TString& codart() { return _codart; }
|
||||
const TString & codart() const { return _codart; }
|
||||
|
||||
TArray& color_rules() { return _color_rules; }
|
||||
|
||||
|
@ -815,6 +815,8 @@ TRiga_documento& TDocumento::insert_row(int row, const char *tipo)
|
||||
|
||||
if (tipo && *tipo)
|
||||
r.set_tipo(tipo);
|
||||
if (this->tipo().auto_evasione()) // this per spiegare che non è il parametro tipo
|
||||
_qta_evasa_auto.insert(ZERO, row); // inserisce la riga nuova nell'array
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -1679,8 +1681,8 @@ int TDocumento::remove(TBaseisamfile& f) const
|
||||
if (_has_provv && tipo().provvigioni())
|
||||
myself.update_provvigioni(true);
|
||||
myself.plafond().remove(myself);
|
||||
if (tipo().auto_evasione())
|
||||
myself.auto_evasione();
|
||||
// if (tipo().auto_evasione())
|
||||
myself.auto_evasione();
|
||||
}
|
||||
return TMultiple_rectype::remove(f);
|
||||
}
|
||||
@ -2835,6 +2837,7 @@ TDocumento& TDocumento::copy(const TDocumento & d)
|
||||
set_riga_valfisc();
|
||||
}
|
||||
_occas = d.occas();
|
||||
_qta_evasa_auto = d._qta_evasa_auto;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -3464,7 +3467,7 @@ bool TDocumento::is_split_payment() const
|
||||
|
||||
void TDocumento::cli2doc()
|
||||
{
|
||||
const TRectype& v = clifor().vendite();
|
||||
const TRectype & v = clifor().vendite();
|
||||
|
||||
put(DOC_CODVAL, get(CLI_CODVAL));
|
||||
put(DOC_CODLIN, get(CLI_CODLIN));
|
||||
@ -3547,30 +3550,60 @@ void TDocumento::cli2doc()
|
||||
put(DOC_CODPORTO, v.get(CFV_CODPORTO));
|
||||
}
|
||||
|
||||
void TDocumento::update_row_auto_qta(int nrow, real & qta, bool plus)
|
||||
void TDocumento::update_row_auto_qta(int nrow, real & qta, bool plus, bool insert)
|
||||
{
|
||||
real * qta_evasa = (real *)_qta_evasa_auto.objptr(nrow);
|
||||
real * qta_evasa = nullptr;
|
||||
|
||||
if (qta_evasa == nullptr)
|
||||
_qta_evasa_auto.add(qta_evasa = new real, nrow);
|
||||
*qta_evasa += (plus ? qta : -qta);
|
||||
if (*qta_evasa == ZERO)
|
||||
if (insert)
|
||||
{
|
||||
_qta_evasa_auto.insert(ZERO, nrow);
|
||||
qta_evasa = (real *)_qta_evasa_auto.objptr(nrow);
|
||||
}
|
||||
else
|
||||
{
|
||||
qta_evasa = (real *)_qta_evasa_auto.objptr(nrow);
|
||||
|
||||
if (qta_evasa == nullptr)
|
||||
_qta_evasa_auto.add(qta_evasa = new real, nrow);
|
||||
*qta_evasa += (plus ? qta : -qta);
|
||||
}
|
||||
if (qta_evasa != nullptr && *qta_evasa == ZERO)
|
||||
_qta_evasa_auto.destroy(nrow);
|
||||
}
|
||||
|
||||
void TDocumento::auto_evasione()
|
||||
void TDocumento::auto_evasione(const int nrow)
|
||||
{
|
||||
// TLista_documenti docs;
|
||||
TConsegna_ordini e(tipo().auto_evasione_elab());
|
||||
const char stato_evaso = e.cstato_finale_doc_iniziale();
|
||||
const char stato_aperto = e.stato_iniziale(0);
|
||||
TToken_string tipi;
|
||||
TToken_string stati;
|
||||
if (tipo().auto_evasione())
|
||||
{
|
||||
// TLista_documenti docs;
|
||||
TConsegna_ordini e(tipo().auto_evasione_elab());
|
||||
const char stato_evaso = e.cstato_finale_doc_iniziale();
|
||||
const char stato_aperto = e.stato_iniziale(0);
|
||||
TToken_string tipi;
|
||||
TToken_string stati;
|
||||
|
||||
e.tipi_stati_iniziali(tipi, stati);
|
||||
FOR_EACH_SELF_PHYSICAL_RDOC(i, rdoc)
|
||||
if (rdoc->is_evadibile() && _qta_evasa_auto.objptr(i) != nullptr)
|
||||
rdoc->update_orders((real &)_qta_evasa_auto[i], tipi, stati, stato_aperto, stato_evaso);
|
||||
e.tipi_stati_iniziali(tipi, stati);
|
||||
if (nrow < 0)
|
||||
{
|
||||
FOR_EACH_SELF_PHYSICAL_RDOC(i, rdoc)
|
||||
if (rdoc->is_evadibile() && _qta_evasa_auto.objptr(i) != nullptr)
|
||||
{
|
||||
rdoc->update_orders((real &)_qta_evasa_auto[i], tipi, stati, stato_aperto, stato_evaso);
|
||||
_qta_evasa_auto.destroy(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TRiga_documento & rdoc = row(nrow);
|
||||
|
||||
if (rdoc.is_evadibile() && _qta_evasa_auto.objptr(nrow) != nullptr)
|
||||
{
|
||||
rdoc.update_orders((real &)_qta_evasa_auto[nrow], tipi, stati, stato_aperto, stato_evaso);
|
||||
_qta_evasa_auto.destroy(nrow);
|
||||
message_box(TR("Sono stati evasi ordini legati a questo documento.\nE' necessario registrarlo"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int TDocumento::find_nrow(const char * tiporiga, const char * codice) const
|
||||
|
@ -1998,14 +1998,23 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
|
||||
TDocumento_mask& m = (TDocumento_mask&)ss.mask();
|
||||
TDocumento& doc = m.doc();
|
||||
static bool __new_row = false;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case K_ENTER: // modifica
|
||||
{
|
||||
TRiga_documento& riga = doc[r + 1];
|
||||
riga.autosave(ss);
|
||||
|
||||
if (doc.tipo().auto_evasione() && !__new_row)
|
||||
{
|
||||
const TCodice_articolo codart = ss.get_str_row_cell(r, FR_CODART);
|
||||
|
||||
if (codart != m.codart())
|
||||
doc.auto_evasione(r + 1);
|
||||
}
|
||||
__new_row = false;
|
||||
riga.autosave(ss);
|
||||
if (m.is_calculated_page(m.curr_page()))
|
||||
m.update_progs();
|
||||
m.highlight_row(r);
|
||||
@ -2023,10 +2032,13 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
case K_CTRL + K_ENTER: // inizio modifica
|
||||
{
|
||||
const TRiga_documento& riga = doc[r + 1];
|
||||
|
||||
m.codcms_sh() = riga.get(RDOC_CODCMS);
|
||||
}
|
||||
case K_DEL: // Cancellazione
|
||||
{
|
||||
doc.auto_evasione(r + 1);
|
||||
doc.qta_evasa_auto_pack(r + 1);
|
||||
doc.destroy_row(r + 1, TRUE);
|
||||
if (r < doc.rows())
|
||||
{
|
||||
@ -2040,13 +2052,14 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
doc.dirty_fields();
|
||||
if (m.is_calculated_page(ss.page()))
|
||||
m.update_progs();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case K_INS: // Inserimento
|
||||
{
|
||||
if (r < doc.rows())
|
||||
{
|
||||
TRiga_documento & riga = doc[r + 1];
|
||||
|
||||
if (riga.is_omaggio() && riga.is_generata())
|
||||
{
|
||||
const bool enabled = ss.cell_enabled(r, 0);
|
||||
@ -2060,7 +2073,8 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
doc.insert_row(r + 1, m.get( F_LBTIPORIGA ));
|
||||
doc.insert_row(r + 1, m.get( F_LBTIPORIGA ));
|
||||
__new_row = true;
|
||||
}
|
||||
break;
|
||||
case K_CTRL + K_INS:
|
||||
@ -2135,6 +2149,7 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
|
||||
if (m.gestione_note_per_articolo())
|
||||
m.send_key(K_F8, F_NAR, &ss);
|
||||
m.codart() = rdoc.get(RDOC_CODART);
|
||||
}
|
||||
break;
|
||||
case K_CTRL + K_TAB: // uscita dalla riga
|
||||
@ -2142,6 +2157,7 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
TToken_string& row = ss.row(r);
|
||||
const TCodice_articolo codart = row.get(ss.cid2index(FR_CODART));
|
||||
bool check_art = codart.full();
|
||||
|
||||
if (check_art)
|
||||
{
|
||||
const TArticolo& rec = cached_article(codart);
|
||||
|
@ -60,13 +60,13 @@ PAGE "Tipo di riga" 0 0 0 0
|
||||
ITEMS "M|<M>erce"
|
||||
ITEMS "S|<S>pese"
|
||||
ITEMS "P|<P>restazioni"
|
||||
ITEMS "R|Risorse"
|
||||
ITEMS "A|Attrezzature"
|
||||
ITEMS "R|<R>isorse"
|
||||
ITEMS "A|<A>ttrezzature"
|
||||
ITEMS "C|S<c>onti"
|
||||
ITEMS "O|<O>maggi"
|
||||
ITEMS "D|<D>escrizioni"
|
||||
ITEMS "T|Re<T>tifiche"
|
||||
FIELD S7
|
||||
FIELD S7
|
||||
END
|
||||
|
||||
BOOLEAN F_FORMFEED
|
||||
|
Loading…
x
Reference in New Issue
Block a user