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 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; }
|
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;
|
int find_nrow(const char * tiporiga, const char * codice) const;
|
||||||
TRiga_documento & find_row(const char * tiporiga, const char * codice);
|
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 _cdc_end_sh;
|
||||||
short _cms_start_sh;
|
short _cms_start_sh;
|
||||||
short _cms_end_sh;
|
short _cms_end_sh;
|
||||||
TString _codcms, _codcms_sh;
|
TString _codcms, _codcms_sh, _codart;
|
||||||
TArray _color_rules;
|
TArray _color_rules;
|
||||||
int _sh_y;
|
int _sh_y;
|
||||||
|
|
||||||
@ -1224,6 +1225,8 @@ public:
|
|||||||
const TString& codcms() const { return _codcms;}
|
const TString& codcms() const { return _codcms;}
|
||||||
TString& codcms_sh() { return _codcms_sh;}
|
TString& codcms_sh() { return _codcms_sh;}
|
||||||
const TString & codcms_sh() const { 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; }
|
TArray& color_rules() { return _color_rules; }
|
||||||
|
|
||||||
|
@ -815,6 +815,8 @@ TRiga_documento& TDocumento::insert_row(int row, const char *tipo)
|
|||||||
|
|
||||||
if (tipo && *tipo)
|
if (tipo && *tipo)
|
||||||
r.set_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;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1679,7 +1681,7 @@ int TDocumento::remove(TBaseisamfile& f) const
|
|||||||
if (_has_provv && tipo().provvigioni())
|
if (_has_provv && tipo().provvigioni())
|
||||||
myself.update_provvigioni(true);
|
myself.update_provvigioni(true);
|
||||||
myself.plafond().remove(myself);
|
myself.plafond().remove(myself);
|
||||||
if (tipo().auto_evasione())
|
// if (tipo().auto_evasione())
|
||||||
myself.auto_evasione();
|
myself.auto_evasione();
|
||||||
}
|
}
|
||||||
return TMultiple_rectype::remove(f);
|
return TMultiple_rectype::remove(f);
|
||||||
@ -2835,6 +2837,7 @@ TDocumento& TDocumento::copy(const TDocumento & d)
|
|||||||
set_riga_valfisc();
|
set_riga_valfisc();
|
||||||
}
|
}
|
||||||
_occas = d.occas();
|
_occas = d.occas();
|
||||||
|
_qta_evasa_auto = d._qta_evasa_auto;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3464,7 +3467,7 @@ bool TDocumento::is_split_payment() const
|
|||||||
|
|
||||||
void TDocumento::cli2doc()
|
void TDocumento::cli2doc()
|
||||||
{
|
{
|
||||||
const TRectype& v = clifor().vendite();
|
const TRectype & v = clifor().vendite();
|
||||||
|
|
||||||
put(DOC_CODVAL, get(CLI_CODVAL));
|
put(DOC_CODVAL, get(CLI_CODVAL));
|
||||||
put(DOC_CODLIN, get(CLI_CODLIN));
|
put(DOC_CODLIN, get(CLI_CODLIN));
|
||||||
@ -3547,20 +3550,32 @@ void TDocumento::cli2doc()
|
|||||||
put(DOC_CODPORTO, v.get(CFV_CODPORTO));
|
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 (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)
|
if (qta_evasa == nullptr)
|
||||||
_qta_evasa_auto.add(qta_evasa = new real, nrow);
|
_qta_evasa_auto.add(qta_evasa = new real, nrow);
|
||||||
*qta_evasa += (plus ? qta : -qta);
|
*qta_evasa += (plus ? qta : -qta);
|
||||||
if (*qta_evasa == ZERO)
|
}
|
||||||
|
if (qta_evasa != nullptr && *qta_evasa == ZERO)
|
||||||
_qta_evasa_auto.destroy(nrow);
|
_qta_evasa_auto.destroy(nrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDocumento::auto_evasione()
|
void TDocumento::auto_evasione(const int nrow)
|
||||||
{
|
{
|
||||||
// TLista_documenti docs;
|
if (tipo().auto_evasione())
|
||||||
|
{
|
||||||
|
// TLista_documenti docs;
|
||||||
TConsegna_ordini e(tipo().auto_evasione_elab());
|
TConsegna_ordini e(tipo().auto_evasione_elab());
|
||||||
const char stato_evaso = e.cstato_finale_doc_iniziale();
|
const char stato_evaso = e.cstato_finale_doc_iniziale();
|
||||||
const char stato_aperto = e.stato_iniziale(0);
|
const char stato_aperto = e.stato_iniziale(0);
|
||||||
@ -3568,9 +3583,27 @@ void TDocumento::auto_evasione()
|
|||||||
TToken_string stati;
|
TToken_string stati;
|
||||||
|
|
||||||
e.tipi_stati_iniziali(tipi, stati);
|
e.tipi_stati_iniziali(tipi, stati);
|
||||||
|
if (nrow < 0)
|
||||||
|
{
|
||||||
FOR_EACH_SELF_PHYSICAL_RDOC(i, rdoc)
|
FOR_EACH_SELF_PHYSICAL_RDOC(i, rdoc)
|
||||||
if (rdoc->is_evadibile() && _qta_evasa_auto.objptr(i) != nullptr)
|
if (rdoc->is_evadibile() && _qta_evasa_auto.objptr(i) != nullptr)
|
||||||
|
{
|
||||||
rdoc->update_orders((real &)_qta_evasa_auto[i], tipi, stati, stato_aperto, stato_evaso);
|
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
|
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_mask& m = (TDocumento_mask&)ss.mask();
|
||||||
TDocumento& doc = m.doc();
|
TDocumento& doc = m.doc();
|
||||||
|
static bool __new_row = false;
|
||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case K_ENTER: // modifica
|
case K_ENTER: // modifica
|
||||||
{
|
{
|
||||||
TRiga_documento& riga = doc[r + 1];
|
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()))
|
if (m.is_calculated_page(m.curr_page()))
|
||||||
m.update_progs();
|
m.update_progs();
|
||||||
m.highlight_row(r);
|
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
|
case K_CTRL + K_ENTER: // inizio modifica
|
||||||
{
|
{
|
||||||
const TRiga_documento& riga = doc[r + 1];
|
const TRiga_documento& riga = doc[r + 1];
|
||||||
|
|
||||||
m.codcms_sh() = riga.get(RDOC_CODCMS);
|
m.codcms_sh() = riga.get(RDOC_CODCMS);
|
||||||
}
|
}
|
||||||
case K_DEL: // Cancellazione
|
case K_DEL: // Cancellazione
|
||||||
{
|
{
|
||||||
|
doc.auto_evasione(r + 1);
|
||||||
|
doc.qta_evasa_auto_pack(r + 1);
|
||||||
doc.destroy_row(r + 1, TRUE);
|
doc.destroy_row(r + 1, TRUE);
|
||||||
if (r < doc.rows())
|
if (r < doc.rows())
|
||||||
{
|
{
|
||||||
@ -2047,6 +2059,7 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
|||||||
if (r < doc.rows())
|
if (r < doc.rows())
|
||||||
{
|
{
|
||||||
TRiga_documento & riga = doc[r + 1];
|
TRiga_documento & riga = doc[r + 1];
|
||||||
|
|
||||||
if (riga.is_omaggio() && riga.is_generata())
|
if (riga.is_omaggio() && riga.is_generata())
|
||||||
{
|
{
|
||||||
const bool enabled = ss.cell_enabled(r, 0);
|
const bool enabled = ss.cell_enabled(r, 0);
|
||||||
@ -2061,6 +2074,7 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
doc.insert_row(r + 1, m.get( F_LBTIPORIGA ));
|
doc.insert_row(r + 1, m.get( F_LBTIPORIGA ));
|
||||||
|
__new_row = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_CTRL + K_INS:
|
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())
|
if (m.gestione_note_per_articolo())
|
||||||
m.send_key(K_F8, F_NAR, &ss);
|
m.send_key(K_F8, F_NAR, &ss);
|
||||||
|
m.codart() = rdoc.get(RDOC_CODART);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_CTRL + K_TAB: // uscita dalla riga
|
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);
|
TToken_string& row = ss.row(r);
|
||||||
const TCodice_articolo codart = row.get(ss.cid2index(FR_CODART));
|
const TCodice_articolo codart = row.get(ss.cid2index(FR_CODART));
|
||||||
bool check_art = codart.full();
|
bool check_art = codart.full();
|
||||||
|
|
||||||
if (check_art)
|
if (check_art)
|
||||||
{
|
{
|
||||||
const TArticolo& rec = cached_article(codart);
|
const TArticolo& rec = cached_article(codart);
|
||||||
|
@ -60,8 +60,8 @@ PAGE "Tipo di riga" 0 0 0 0
|
|||||||
ITEMS "M|<M>erce"
|
ITEMS "M|<M>erce"
|
||||||
ITEMS "S|<S>pese"
|
ITEMS "S|<S>pese"
|
||||||
ITEMS "P|<P>restazioni"
|
ITEMS "P|<P>restazioni"
|
||||||
ITEMS "R|Risorse"
|
ITEMS "R|<R>isorse"
|
||||||
ITEMS "A|Attrezzature"
|
ITEMS "A|<A>ttrezzature"
|
||||||
ITEMS "C|S<c>onti"
|
ITEMS "C|S<c>onti"
|
||||||
ITEMS "O|<O>maggi"
|
ITEMS "O|<O>maggi"
|
||||||
ITEMS "D|<D>escrizioni"
|
ITEMS "D|<D>escrizioni"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user