Patch level : 10.0
Files correlati : ve0100b.msk ve0.exe ve6.exe Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@21462 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8052cf0ebb
commit
70544fb760
@ -92,7 +92,7 @@ END
|
|||||||
|
|
||||||
STRING F_CODNUM_ELAB 4
|
STRING F_CODNUM_ELAB 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 4 "Cod. num. "
|
PROMPT 2 4 "Numerazione "
|
||||||
HELP "Codice numerazione"
|
HELP "Codice numerazione"
|
||||||
USE %NUM
|
USE %NUM
|
||||||
INPUT CODTAB F_CODNUM_ELAB
|
INPUT CODTAB F_CODNUM_ELAB
|
||||||
|
@ -180,7 +180,7 @@ public:
|
|||||||
bool kill_descrizione_estesa() const { return get_bool("B10"); }
|
bool kill_descrizione_estesa() const { return get_bool("B10"); }
|
||||||
bool pack_rif() const { return get_bool("B15"); }
|
bool pack_rif() const { return get_bool("B15"); }
|
||||||
bool calcola_scarti() const { return get_bool("B11"); }
|
bool calcola_scarti() const { return get_bool("B11"); }
|
||||||
bool reload_prices() { return get_bool("B13"); }
|
bool reload_prices() const { return get_bool("B13"); }
|
||||||
const TString & num_riferimenti_in() const { return get("S11"); }
|
const TString & num_riferimenti_in() const { return get("S11"); }
|
||||||
|
|
||||||
int intestazioni_sheet() const { return get_int("I1"); }
|
int intestazioni_sheet() const { return get_int("I1"); }
|
||||||
@ -223,9 +223,10 @@ protected:
|
|||||||
bool calcola_ncolli_tara_pnetto(const TString& codart, const real& qta,
|
bool calcola_ncolli_tara_pnetto(const TString& codart, const real& qta,
|
||||||
real& nolli, real& tara, real& pnetto) const;
|
real& nolli, real& tara, real& pnetto) const;
|
||||||
bool aggiorna_ncolli_tara_pnetto(TRiga_documento& r) const;
|
bool aggiorna_ncolli_tara_pnetto(TRiga_documento& r) const;
|
||||||
|
bool genera_righe_riferimento(const TDocumento& indoc, TDocumento& outdoc, TSheet_field& s) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool nettifica() { return get_bool("B12"); }
|
bool nettifica() const { return get_bool("B12"); }
|
||||||
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
||||||
const TDate& data_elab, bool interattivo = false);
|
const TDate& data_elab, bool interattivo = false);
|
||||||
|
|
||||||
|
@ -2293,7 +2293,7 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
static TString_array tabella_ripartizione;
|
static TString_array tabella_ripartizione;
|
||||||
if (fat_com && tabella_ripartizione.empty())
|
if (fat_com && tabella_ripartizione.empty())
|
||||||
{
|
{
|
||||||
TConfig cnf(CONFIG_STUDIO);
|
TConfig cnf(CONFIG_STUDIO, "ve");
|
||||||
for (int k = 1; k <= MAX_IVA_SLICES; k++)
|
for (int k = 1; k <= MAX_IVA_SLICES; k++)
|
||||||
{
|
{
|
||||||
TToken_string* tt = new TToken_string();
|
TToken_string* tt = new TToken_string();
|
||||||
@ -2312,8 +2312,7 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
const TString4 tiporiga = r.get(RDOC_TIPORIGA);
|
const TString4 tiporiga = r.get(RDOC_TIPORIGA);
|
||||||
if (valid_row_type(tiporiga)) // controlla l'esistenza della riga
|
if (valid_row_type(tiporiga)) // controlla l'esistenza della riga
|
||||||
{
|
{
|
||||||
TBill conto;
|
TBill conto, contomat;
|
||||||
TBill contomat;
|
|
||||||
real pricemat;
|
real pricemat;
|
||||||
const char tipo = r.tipo().tipo();
|
const char tipo = r.tipo().tipo();
|
||||||
// Le righe omaggio senza addebito IVA vanno saltate
|
// Le righe omaggio senza addebito IVA vanno saltate
|
||||||
@ -2322,7 +2321,6 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
{
|
{
|
||||||
const bool spesa = r.tipo().tipo() == RIGA_SPESEDOC;
|
const bool spesa = r.tipo().tipo() == RIGA_SPESEDOC;
|
||||||
char tipo_rit = '\0';
|
char tipo_rit = '\0';
|
||||||
|
|
||||||
if (spesa)
|
if (spesa)
|
||||||
tipo_rit = r.spesa().tipo_ritenuta();
|
tipo_rit = r.spesa().tipo_ritenuta();
|
||||||
|
|
||||||
@ -2338,22 +2336,15 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
if (good())
|
if (good())
|
||||||
{
|
{
|
||||||
static TString16 fldvalmat("883");
|
static TString16 fldvalmat("883");
|
||||||
|
|
||||||
if (fldvalmat == "883")
|
if (fldvalmat == "883")
|
||||||
{
|
fldvalmat = ini_get_string(CONFIG_DITTA, "ve", "FldValMat", "");
|
||||||
TConfig c(CONFIG_DITTA, "ve");
|
|
||||||
|
|
||||||
fldvalmat = c.get("FldValMat", "");
|
|
||||||
|
|
||||||
}
|
|
||||||
if (fldvalmat.full())
|
if (fldvalmat.full())
|
||||||
{
|
{
|
||||||
pricemat = real(cache().get(LF_ANAMAG, r.get(RDOC_CODARTMAG), fldvalmat));
|
pricemat = real(cache().get(LF_ANAMAG, r.get(RDOC_CODARTMAG), fldvalmat));
|
||||||
|
if (!pricemat.is_zero())
|
||||||
if (pricemat != ZERO)
|
|
||||||
{
|
{
|
||||||
contomat = conto;
|
contomat = conto;
|
||||||
search_costo_ricavo_mat(contomat,r); // l'errore eventuale viene settato qui dentro
|
search_costo_ricavo_mat(contomat, r); // l'errore eventuale viene settato qui dentro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2488,33 +2479,22 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
// crea le righe di contabilita'
|
// crea le righe di contabilita'
|
||||||
if (good())
|
if (good())
|
||||||
{
|
{
|
||||||
const TString descr_cr(doc.clifor().get(CLI_RAGSOC));
|
const TString descr_cr = doc.clifor().get(CLI_RAGSOC); // Probabile porcata ... che Pharmatex non vuole!
|
||||||
|
|
||||||
switch (_movimento->recalc_cg_rows(descr_cr, *_caus))
|
switch (_movimento->recalc_cg_rows(descr_cr, *_caus))
|
||||||
{
|
{
|
||||||
case 1 :
|
case 1 : _error = movement_error; break;
|
||||||
_error = movement_error;
|
case 2 : _error = cau_ritintra_error; break;
|
||||||
break;
|
default: break;
|
||||||
case 2 :
|
|
||||||
_error = cau_ritintra_error;
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TRegistro& registro = _caus->reg();
|
const TRegistro& registro = _caus->reg();
|
||||||
const bool iva_mov = registro.ok();
|
const bool iva_mov = registro.ok();
|
||||||
|
|
||||||
if (!iva_mov)
|
if (!iva_mov)
|
||||||
{
|
{
|
||||||
static int __check_sez = 2;
|
static int __check_sez = -1;
|
||||||
if (__check_sez > 1)
|
if (__check_sez < 0)
|
||||||
{
|
__check_sez = ini_get_bool(CONFIG_DITTA, "ve", "CHECK_SEZ");
|
||||||
TConfig c(CONFIG_DITTA, "ve");
|
|
||||||
|
|
||||||
__check_sez = c.get_bool("CHECK_SEZ", false);
|
|
||||||
}
|
|
||||||
bool swap = false;
|
bool swap = false;
|
||||||
|
|
||||||
if (__check_sez)
|
if (__check_sez)
|
||||||
@ -2667,7 +2647,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc)
|
|||||||
{
|
{
|
||||||
const int tmov = _caus->tipomov();
|
const int tmov = _caus->tipomov();
|
||||||
const TString80 desc(head.get(MOV_DESCR));
|
const TString80 desc(head.get(MOV_DESCR));
|
||||||
const TString16 codcaus(_caus->codice());
|
const TString4 codcaus(_caus->codice());
|
||||||
const TString4 v(head.get(MOV_CODVAL));
|
const TString4 v(head.get(MOV_CODVAL));
|
||||||
const TDate d(head.get_date(MOV_DATACAM));
|
const TDate d(head.get_date(MOV_DATACAM));
|
||||||
const real c(head.get_real(MOV_CAMBIO));
|
const real c(head.get_real(MOV_CAMBIO));
|
||||||
|
227
ve/velib04d.cpp
227
ve/velib04d.cpp
@ -18,9 +18,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void doc2mask(const TDocumento& doc, const TString & articolo);
|
void doc2mask(const TDocumento& doc, const TString & articolo);
|
||||||
|
TConsegna_mask(int header_code = 0, bool per_codice = false, bool ignora_descrizioni = false);
|
||||||
TConsegna_mask(TConfig & c,int header_code = 0, bool per_codice = false, bool ignora_descrizioni = false);
|
|
||||||
virtual ~TConsegna_mask() { }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TConsegna_mask::on_field_event(class TOperable_field& f, TField_event e, long jolly)
|
bool TConsegna_mask::on_field_event(class TOperable_field& f, TField_event e, long jolly)
|
||||||
@ -114,13 +112,13 @@ int rows_sort_func(TSheet_field& s, int i, int j)
|
|||||||
{
|
{
|
||||||
const TToken_string& s1 = s.row(i);
|
const TToken_string& s1 = s.row(i);
|
||||||
const TToken_string& s2 = s.row(j);
|
const TToken_string& s2 = s.row(j);
|
||||||
TString ss1, ss2;
|
TString80 ss1, ss2;
|
||||||
TDate dd1, dd2;
|
TDate dd1, dd2;
|
||||||
real rr1, rr2;
|
real rr1, rr2;
|
||||||
const int fields[] = { S_CODART, S_LIVGIAC1, S_LIVGIAC2, S_LIVGIAC3, S_LIVGIAC4,
|
const int fields[] = { S_CODART, S_LIVGIAC1, S_LIVGIAC2, S_LIVGIAC3, S_LIVGIAC4,
|
||||||
S_CODMAG, S_CODDEP, S_RIGAEVASA, S_DATACONS, S_QTARESIDUA, -1 };
|
S_CODMAG, S_CODDEP, S_RIGAEVASA, S_DATACONS, S_QTARESIDUA, -1 };
|
||||||
int ret = 0, field = 0;
|
int ret = 0;
|
||||||
while (fields[field] >= 0)
|
for (short field = 0; fields[field] > 0; field++)
|
||||||
{
|
{
|
||||||
if (fields[field] == S_QTARESIDUA)
|
if (fields[field] == S_QTARESIDUA)
|
||||||
{
|
{
|
||||||
@ -143,7 +141,6 @@ int rows_sort_func(TSheet_field& s, int i, int j)
|
|||||||
}
|
}
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
break;
|
break;
|
||||||
field++;
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -179,7 +176,7 @@ void TConsegna_mask::doc2mask(const TDocumento& doc, const TString & articolo)
|
|||||||
if (rec.is_descrizione())
|
if (rec.is_descrizione())
|
||||||
show_line = !_ignora_descrizioni;
|
show_line = !_ignora_descrizioni;
|
||||||
|
|
||||||
if ( show_line && (articolo.blank() || articolo == rec.get(RDOC_CODART)))
|
if ( show_line && (articolo.blank() || articolo == rec.get(RDOC_CODART)) )
|
||||||
{
|
{
|
||||||
TToken_string& r = s.row(-1);
|
TToken_string& r = s.row(-1);
|
||||||
r = " ";
|
r = " ";
|
||||||
@ -219,8 +216,8 @@ void TConsegna_mask::doc2mask(const TDocumento& doc, const TString & articolo)
|
|||||||
s.sort(rows_sort_func);
|
s.sort(rows_sort_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
TConsegna_mask::TConsegna_mask(TConfig & c, int header_code, bool per_codice, bool ignora_descrizioni)
|
TConsegna_mask::TConsegna_mask(int header_code, bool per_codice, bool ignora_descrizioni)
|
||||||
: TAutomask("velib04d") , _ordina_per_codice(per_codice), _doc(NULL),
|
: TAutomask("velib04d"), _ordina_per_codice(per_codice), _doc(NULL),
|
||||||
_ignora_descrizioni(ignora_descrizioni)
|
_ignora_descrizioni(ignora_descrizioni)
|
||||||
{
|
{
|
||||||
TCodgiac_livelli cl;
|
TCodgiac_livelli cl;
|
||||||
@ -228,46 +225,34 @@ TConsegna_mask::TConsegna_mask(TConfig & c, int header_code, bool per_codice, bo
|
|||||||
cl.set_sheet_columns(s, S_LIVGIAC1);
|
cl.set_sheet_columns(s, S_LIVGIAC1);
|
||||||
if (header_code == 1)
|
if (header_code == 1)
|
||||||
{
|
{
|
||||||
TString h;
|
s.set_column_header(S_QTARESIDUA, HR("Quantita'\nconsegnata"));
|
||||||
h = HR("Quantita'\nconsegnata");
|
|
||||||
s.set_column_header(S_QTARESIDUA, h);
|
|
||||||
s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Q.ta' consegnata"));
|
s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Q.ta' consegnata"));
|
||||||
|
|
||||||
h = HR("Quantita'\nda fatturare");
|
s.set_column_header(S_QTADAEVADERE, HR("Quantita'\nda fatturare"));
|
||||||
s.set_column_header(S_QTADAEVADERE, h);
|
|
||||||
s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Q.ta' da fatturare"));
|
s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Q.ta' da fatturare"));
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
if (header_code == 2)
|
if (header_code == 2)
|
||||||
{
|
{
|
||||||
TString h;
|
s.set_column_header(S_QTARESIDUA, HR("Residuo"));
|
||||||
h = HR("Residuo");
|
|
||||||
s.set_column_header(S_QTARESIDUA, h);
|
|
||||||
s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Residuo "));
|
s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Residuo "));
|
||||||
|
|
||||||
h = HR("Da evadere");
|
s.set_column_header(S_QTADAEVADERE, HR("Da evadere"));
|
||||||
s.set_column_header(S_QTADAEVADERE, h);
|
|
||||||
s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Da evadere "));
|
s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Da evadere "));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.exist("CODAGG1"))
|
TConfig c(CONFIG_DITTA, "ve");
|
||||||
|
for (int i = 1; i <= 2; i++)
|
||||||
{
|
{
|
||||||
TString80 codagg1 = c.get("CODAGG1");
|
TString8 n; n.format("CODAGG%d", i);
|
||||||
TMask_field & agg1 =s.sheet_mask().field(S_CODAGG1);
|
if (c.exist(n))
|
||||||
|
{
|
||||||
s.set_column_header(S_CODAGG1, codagg1);
|
const short id = i == 1 ? S_CODAGG1 : S_CODAGG2;
|
||||||
codagg1.rpad(strlen(agg1.prompt()));
|
TString80 codagg = c.get(n);
|
||||||
agg1.set_prompt(codagg1);
|
TMask_field& agg = s.sheet_mask().field(id);
|
||||||
|
s.set_column_header(id, codagg);
|
||||||
|
codagg.rpad(strlen(agg.prompt()));
|
||||||
|
agg.set_prompt(codagg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.exist("CODAGG2"))
|
|
||||||
{
|
|
||||||
TString80 codagg2 = c.get("CODAGG2");
|
|
||||||
TMask_field & agg2 =s.sheet_mask().field(S_CODAGG2);
|
|
||||||
|
|
||||||
s.set_column_header(S_CODAGG2, codagg2);
|
|
||||||
codagg2.rpad(strlen(agg2.prompt()));
|
|
||||||
agg2.set_prompt(codagg2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +264,7 @@ bool TConsegna_ordini::calcola_ncolli_tara_pnetto(const TString& codart, const r
|
|||||||
real& ncolli, real& tara, real& pnetto) const
|
real& ncolli, real& tara, real& pnetto) const
|
||||||
{
|
{
|
||||||
const TRectype& articolo = cache().get(LF_ANAMAG, codart);
|
const TRectype& articolo = cache().get(LF_ANAMAG, codart);
|
||||||
real ppcollo = articolo.get_real(ANAMAG_PPCOLLO);
|
const real ppcollo = articolo.get_real(ANAMAG_PPCOLLO);
|
||||||
|
|
||||||
if (ppcollo > ZERO)
|
if (ppcollo > ZERO)
|
||||||
{
|
{
|
||||||
@ -298,7 +283,7 @@ bool TConsegna_ordini::calcola_ncolli_tara_pnetto(const TString& codart, const r
|
|||||||
bool TConsegna_ordini::aggiorna_ncolli_tara_pnetto(TRiga_documento& r) const
|
bool TConsegna_ordini::aggiorna_ncolli_tara_pnetto(TRiga_documento& r) const
|
||||||
{
|
{
|
||||||
const TString& codart = r.get(RDOC_CODARTMAG);
|
const TString& codart = r.get(RDOC_CODARTMAG);
|
||||||
TArticolo & articolo = cached_article(codart);
|
TArticolo& articolo = cached_article(codart);
|
||||||
const real qta = articolo.convert_to_um(r.quantita(), NULL, r.get(RDOC_UMQTA));
|
const real qta = articolo.convert_to_um(r.quantita(), NULL, r.get(RDOC_UMQTA));
|
||||||
real ncolli, tara, pnetto;
|
real ncolli, tara, pnetto;
|
||||||
|
|
||||||
@ -313,54 +298,8 @@ bool TConsegna_ordini::aggiorna_ncolli_tara_pnetto(TRiga_documento& r) const
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
bool TConsegna_ordini::genera_righe_riferimento(const TDocumento& indoc, TDocumento& outdoc, TSheet_field& s) const
|
||||||
const TDate& data_elab, bool interattivo)
|
|
||||||
{
|
{
|
||||||
const int items_in = doc_in.items();
|
|
||||||
const int items_out = doc_out.items();
|
|
||||||
CHECK(items_in > 0, "Nessun documento da elaborare");
|
|
||||||
CHECK(items_out> 0, "Nessun documento da generare");
|
|
||||||
CHECK(items_in == 1 || items_out == 1 || items_out == items_in,
|
|
||||||
"Numero di documenti da elaborare 'strano'");
|
|
||||||
|
|
||||||
bool ok = true;
|
|
||||||
|
|
||||||
const int header_code = intestazioni_sheet();
|
|
||||||
|
|
||||||
TConfig c(CONFIG_DITTA, "ve");
|
|
||||||
const bool ordina_per_doc = c.get_bool("ORDINA_PER_DOC", "ve", -1, true);
|
|
||||||
TConsegna_mask m(c, header_code, ordina_per_codice(), get_bool("B3"));
|
|
||||||
|
|
||||||
const int items_max = items_in > items_out ? items_in : items_out;
|
|
||||||
|
|
||||||
pre_process_input(doc_in);
|
|
||||||
for (int d = 0; d < items_max && ok; d++)
|
|
||||||
{
|
|
||||||
TDocumento& indoc = doc_in[d < items_in ? d : 0];
|
|
||||||
TDocumento& outdoc = doc_out[d < items_out ? d : 0];
|
|
||||||
const TString& articolo = params().get("ARTICOLO");
|
|
||||||
|
|
||||||
m.doc2mask(indoc, articolo);
|
|
||||||
// if (articolo.full())
|
|
||||||
// params().set("QUANTITA", ZERO);
|
|
||||||
if (articolo.full())
|
|
||||||
{
|
|
||||||
m.show(F_UMQTA);
|
|
||||||
m.set(F_UMQTA, params().get("UM"));
|
|
||||||
m.show(F_QTA);
|
|
||||||
m.set(F_QTA, params().get("QUANTITA"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m.hide(F_UMQTA);
|
|
||||||
m.hide(F_QTA);
|
|
||||||
}
|
|
||||||
|
|
||||||
ok = m.run() == K_ENTER;
|
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
if (gestione_riferimenti())
|
|
||||||
{
|
|
||||||
// Determina ed eventualmente crea la riga di riferimento
|
// Determina ed eventualmente crea la riga di riferimento
|
||||||
const int riga_rif = riferimenti_in_testa() ? 1 : outdoc.physical_rows()+1;
|
const int riga_rif = riferimenti_in_testa() ? 1 : outdoc.physical_rows()+1;
|
||||||
if (riga_rif > outdoc.physical_rows())
|
if (riga_rif > outdoc.physical_rows())
|
||||||
@ -395,7 +334,6 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
|
|
||||||
if (numrif.full())
|
if (numrif.full())
|
||||||
{
|
{
|
||||||
TSheet_field& s = m.sfield(F_ROWS);
|
|
||||||
TAssoc_array doc_rows;
|
TAssoc_array doc_rows;
|
||||||
TString riferimenti;
|
TString riferimenti;
|
||||||
|
|
||||||
@ -503,8 +441,79 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
rout.put(RDOC_DESCR, memo.left(50));
|
rout.put(RDOC_DESCR, memo.left(50));
|
||||||
rout.put(RDOC_DESCEST, memo.mid(50));
|
rout.put(RDOC_DESCEST, memo.mid(50));
|
||||||
rout.put("RIFR", "X");
|
rout.put("RIFR", "X");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
||||||
|
const TDate& data_elab, bool interattivo)
|
||||||
|
{
|
||||||
|
const int items_in = doc_in.items();
|
||||||
|
const int items_out = doc_out.items();
|
||||||
|
CHECK(items_in > 0, "Nessun documento da elaborare");
|
||||||
|
CHECK(items_out> 0, "Nessun documento da generare");
|
||||||
|
CHECK(items_in == 1 || items_out == 1 || items_out == items_in,
|
||||||
|
"Numero di documenti da elaborare 'strano'");
|
||||||
|
|
||||||
|
bool ok = false; // Ho elaborato almeno una riga?
|
||||||
|
const int header_code = intestazioni_sheet();
|
||||||
|
|
||||||
|
TConsegna_mask m(header_code, ordina_per_codice(), get_bool("B3"));
|
||||||
|
|
||||||
|
const int items_max = items_in > items_out ? items_in : items_out;
|
||||||
|
|
||||||
|
const TString& articolo = params().get("ARTICOLO");
|
||||||
|
const bool multi_evasion = interattivo && articolo.full() && !real::is_null(params().get("QUANTITA"));
|
||||||
|
|
||||||
|
pre_process_input(doc_in);
|
||||||
|
|
||||||
|
for (int d = 0; d < items_max; d++)
|
||||||
|
{
|
||||||
|
TDocumento& indoc = doc_in[d < items_in ? d : 0];
|
||||||
|
TDocumento& outdoc = doc_out[d < items_out ? d : 0];
|
||||||
|
m.doc2mask(indoc, articolo);
|
||||||
|
if (multi_evasion)
|
||||||
|
{
|
||||||
|
const TString& um = params().get("UM");
|
||||||
|
m.show(F_UMQTA);
|
||||||
|
m.set(F_UMQTA, um);
|
||||||
|
|
||||||
|
int dec = 5;
|
||||||
|
TReal_field& fld_qta = (TReal_field&)m.efield(F_QTA);
|
||||||
|
const TRectype& rum = cache().get("%UMS", um);
|
||||||
|
if (!rum.empty() && rum.get_bool("B0"))
|
||||||
|
dec = rum.get_int("I0");
|
||||||
|
fld_qta.set_decimals(dec);
|
||||||
|
|
||||||
|
fld_qta.show();
|
||||||
|
fld_qta.set(params().get("QUANTITA"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m.hide(F_UMQTA);
|
||||||
|
m.hide(F_QTA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m.run() != K_ENTER)
|
||||||
|
break;
|
||||||
|
|
||||||
|
TSheet_field& s = m.sfield(F_ROWS);
|
||||||
|
bool one_checked = false;
|
||||||
|
if (!s.empty())
|
||||||
|
{
|
||||||
|
FOR_EACH_SHEET_ROW(s, n, row)
|
||||||
|
{
|
||||||
|
one_checked = row->get_char(0) > ' '; // E' da consegnare?;
|
||||||
|
if (one_checked)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!one_checked)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Genera riferimenti solo se c'e' almeno una riga spuntata
|
||||||
|
if (gestione_riferimenti())
|
||||||
|
genera_righe_riferimento(indoc, outdoc, s);
|
||||||
|
|
||||||
TToken_string campi_riga(80);
|
TToken_string campi_riga(80);
|
||||||
const bool ragg_rig = raggruppa_righe();
|
const bool ragg_rig = raggruppa_righe();
|
||||||
@ -521,17 +530,17 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
const bool evadi = outdoc.tipo().da_evadere();
|
const bool evadi = outdoc.tipo().da_evadere();
|
||||||
TAssoc_array scarti;
|
TAssoc_array scarti;
|
||||||
|
|
||||||
TSheet_field& s = m.sfield(F_ROWS);
|
|
||||||
FOR_EACH_SHEET_ROW(s, n, row)
|
FOR_EACH_SHEET_ROW(s, n, row)
|
||||||
{
|
{
|
||||||
const int r = row->get_int(s.cid2index(S_NUMRIGA));
|
const int r = row->get_int(s.cid2index(S_NUMRIGA));
|
||||||
|
TRiga_documento& inrec = indoc[r];
|
||||||
if (row->get_char(0) > ' ') // E' da consegnare?
|
if (row->get_char(0) > ' ') // E' da consegnare?
|
||||||
{
|
{
|
||||||
TRiga_documento& inrec = indoc[r];
|
|
||||||
const real daeva = row->get(S_QTADAEVADERE - FIRST_FIELD);
|
const real daeva = row->get(S_QTADAEVADERE - FIRST_FIELD);
|
||||||
const bool eva = row->get_char(S_RIGAEVASA - FIRST_FIELD) > ' ';
|
const bool eva = row->get_char(S_RIGAEVASA - FIRST_FIELD) > ' ';
|
||||||
if (evadi && (daeva > ZERO || eva))
|
if (evadi && (daeva > ZERO || eva))
|
||||||
{
|
{
|
||||||
|
ok = true; // Ho evaso almeno una riga!
|
||||||
const char* fqe = inrec.field_qtaevasa();
|
const char* fqe = inrec.field_qtaevasa();
|
||||||
inrec.add(fqe, daeva); // nuovo modo di incrementare
|
inrec.add(fqe, daeva); // nuovo modo di incrementare
|
||||||
inrec.put(RDOC_RIGAEVASA, eva ? "X" : "");
|
inrec.put(RDOC_RIGAEVASA, eva ? "X" : "");
|
||||||
@ -562,9 +571,9 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (articolo.not_empty())
|
if (multi_evasion)
|
||||||
{
|
{
|
||||||
const TString4 um(inrec.get(RDOC_UMQTA));
|
const TString4 um = inrec.get(RDOC_UMQTA);
|
||||||
const real qta = inrec.articolo().convert_to_um(daeva, params().get("UM"), um);
|
const real qta = inrec.articolo().convert_to_um(daeva, params().get("UM"), um);
|
||||||
params().set("QUANTITA", params().get_real("QUANTITA") - qta);
|
params().set("QUANTITA", params().get_real("QUANTITA") - qta);
|
||||||
}
|
}
|
||||||
@ -601,6 +610,7 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
{
|
{
|
||||||
int j = outdoc.physical_rows();
|
int j = outdoc.physical_rows();
|
||||||
|
|
||||||
|
const bool ordina_per_doc = ini_get_bool(CONFIG_DITTA, "ve", "ORDINA_PER_DOC", true);
|
||||||
if (ordina_per_doc)
|
if (ordina_per_doc)
|
||||||
{
|
{
|
||||||
TToken_string key = inrec.get_rdoc_key();
|
TToken_string key = inrec.get_rdoc_key();
|
||||||
@ -649,38 +659,41 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
|
|
||||||
if (prezzo_da_ordine())
|
if (prezzo_da_ordine())
|
||||||
{
|
{
|
||||||
|
//const bool doc_al_lordo = outdoc.tipo().calcolo_lordo();
|
||||||
const TString & codart = outrec.get(RDOC_CODARTMAG);
|
const TString & codart = outrec.get(RDOC_CODARTMAG);
|
||||||
const bool doc_al_lordo = outdoc.tipo().calcolo_lordo();
|
|
||||||
const TRectype & anamag = cache().get(LF_ANAMAG, codart);
|
const TRectype & anamag = cache().get(LF_ANAMAG, codart);
|
||||||
|
|
||||||
if (!anamag.empty())
|
if (!anamag.empty())
|
||||||
{
|
{
|
||||||
TString16 field_prezzo(outdoc.tipo().field_prezzo());
|
const TString16 field_prezzo = outdoc.tipo().field_prezzo();
|
||||||
|
|
||||||
if (field_prezzo.full())
|
if (field_prezzo.full())
|
||||||
outrec.put(RDOC_PREZZO, anamag.get_real(field_prezzo));
|
outrec.put(RDOC_PREZZO, anamag.get_real(field_prezzo));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const TString16 um(outrec.get(RDOC_UMQTA));
|
const TString4 um = outrec.get(RDOC_UMQTA);
|
||||||
|
|
||||||
if (um.full())
|
if (um.full())
|
||||||
{
|
{
|
||||||
TLocalisamfile umart(LF_UMART);
|
TLocalisamfile umart(LF_UMART);
|
||||||
umart.setkey(2);
|
umart.setkey(2);
|
||||||
umart.put("CODART", codart);
|
umart.put(UMART_CODART, codart);
|
||||||
umart.put("UM", um);
|
umart.put(UMART_UM, um);
|
||||||
if (umart.read() == NOERR)
|
if (umart.read() == NOERR)
|
||||||
outrec.put(RDOC_PREZZO, umart.get_real("PREZZO"));
|
outrec.put(RDOC_PREZZO, umart.get_real(UMART_PREZZO));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int last_row = outdoc.physical_rows();
|
const int last_row = outdoc.physical_rows();
|
||||||
if (gestione_riferimenti() && j > 0 && last_row > 0 && outdoc[last_row].tipo().tipo() == RIGA_DESCRIZIONI && outdoc[last_row].get("RIFR").full())
|
if (j > 0 && last_row > 0 && gestione_riferimenti())
|
||||||
|
{
|
||||||
|
const TRiga_documento& last_rdoc = outdoc[last_row];
|
||||||
|
if (last_rdoc.is_descrizione() && last_rdoc.get("RIFR").full())
|
||||||
outdoc.destroy_row(last_row, true);
|
outdoc.destroy_row(last_row, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Inserisce le eventuali righe di scarto al posto giusto
|
// Inserisce le eventuali righe di scarto al posto giusto
|
||||||
FOR_EACH_ASSOC_OBJECT(scarti, h, codart, obj)
|
FOR_EACH_ASSOC_OBJECT(scarti, h, codart, obj)
|
||||||
@ -707,7 +720,6 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
outrec.put(RDOC_QTA, ska.get());
|
outrec.put(RDOC_QTA, ska.get());
|
||||||
const TRiga_documento & inrec = indoc[ska.get_int()];
|
const TRiga_documento & inrec = indoc[ska.get_int()];
|
||||||
outrec.set_original_rdoc_key(inrec);
|
outrec.set_original_rdoc_key(inrec);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reload_prices())
|
if (reload_prices())
|
||||||
@ -723,11 +735,9 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
|
|
||||||
if (nettifica())
|
if (nettifica())
|
||||||
{
|
{
|
||||||
int i;
|
FOR_EACH_PHYSICAL_RDOC_BACK(indoc, i, rdoc)
|
||||||
|
|
||||||
for (i = indoc.physical_rows(); i >= 1; i--)
|
|
||||||
{
|
{
|
||||||
TRiga_documento& inrec = indoc[i];
|
TRiga_documento& inrec = *rdoc;
|
||||||
const int nrow = inrec.get_int(RDOC_NRIGA);
|
const int nrow = inrec.get_int(RDOC_NRIGA);
|
||||||
|
|
||||||
if (inrec.is_evasa())
|
if (inrec.is_evasa())
|
||||||
@ -744,11 +754,14 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (indoc.is_evaso())
|
if (indoc.is_evaso())
|
||||||
{
|
|
||||||
indoc.stato(stato_finale_doc_iniziale()[0]);
|
indoc.stato(stato_finale_doc_iniziale()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ok) // Ho elaborato almeno una riga?
|
||||||
|
{
|
||||||
post_process_input(doc_in);
|
post_process_input(doc_in);
|
||||||
post_process(doc_out, doc_in);
|
post_process(doc_out, doc_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
@ -2927,6 +2927,19 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
|||||||
if (e == fe_modify)
|
if (e == fe_modify)
|
||||||
update_ndoc_filter();
|
update_ndoc_filter();
|
||||||
break;
|
break;
|
||||||
|
case F_UMQTA:
|
||||||
|
if (e == fe_init || e == fe_modify)
|
||||||
|
{
|
||||||
|
int dec = 5;
|
||||||
|
if (!o.empty())
|
||||||
|
{
|
||||||
|
const TRectype& um = cache().get("%UMS", o.get());
|
||||||
|
if (!um.empty() && um.get_bool("B0")) // Ha dei decimali specificati?
|
||||||
|
dec = um.get_int("I0");
|
||||||
|
}
|
||||||
|
((TReal_field&)field(F_QTA)).set_decimals(dec);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case F_TYPE:
|
case F_TYPE:
|
||||||
if (e == fe_init || e == fe_modify)
|
if (e == fe_init || e == fe_modify)
|
||||||
{
|
{
|
||||||
@ -2956,7 +2969,7 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
|||||||
const TString_array& handlers = _main->doc().tipo().handlers();
|
const TString_array& handlers = _main->doc().tipo().handlers();
|
||||||
const int items = handlers.items();
|
const int items = handlers.items();
|
||||||
|
|
||||||
for (int i = 0; i < items; i ++ )
|
for (int i = 0; i < items; i++)
|
||||||
{
|
{
|
||||||
TToken_string& riga = (TToken_string&) handlers[i];
|
TToken_string& riga = (TToken_string&) handlers[i];
|
||||||
|
|
||||||
@ -3128,10 +3141,10 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
|||||||
int TElabora_mask::update_list()
|
int TElabora_mask::update_list()
|
||||||
{
|
{
|
||||||
TString_array elabs;
|
TString_array elabs;
|
||||||
const TString16 tipo(_main->get(F_TIPODOC));
|
const TString4 tipo(_main->get(F_TIPODOC));
|
||||||
const TString16 stato(_main->get(F_STATO));
|
const TString4 stato(_main->get(F_STATO));
|
||||||
const TString16 tipo_elab(get(F_TIPODOC_ELAB));
|
const TString4 tipo_elab(get(F_TIPODOC_ELAB));
|
||||||
const TString16 stato_elab(get(F_STATODOC_ELAB));
|
const TString4 stato_elab(get(F_STATODOC_ELAB));
|
||||||
const bool from_elab = !get_bool(F_TYPE);
|
const bool from_elab = !get_bool(F_TYPE);
|
||||||
int items = 0;
|
int items = 0;
|
||||||
|
|
||||||
@ -3146,7 +3159,7 @@ int TElabora_mask::update_list()
|
|||||||
items = _elab.select(elabs, tipo_elab, stato_elab, tipo, stato);
|
items = _elab.select(elabs, tipo_elab, stato_elab, tipo, stato);
|
||||||
}
|
}
|
||||||
|
|
||||||
TList_field & f = (TList_field &) field(F_ELAB);
|
TList_field & f = lfield(F_ELAB);
|
||||||
TToken_string codes;
|
TToken_string codes;
|
||||||
TToken_string descrs;
|
TToken_string descrs;
|
||||||
for (int i = 0; i < items; i++)
|
for (int i = 0; i < items; i++)
|
||||||
@ -3301,6 +3314,13 @@ bool TElabora_mask::elabora()
|
|||||||
update_mask = true;
|
update_mask = true;
|
||||||
}
|
}
|
||||||
in.rewrite();
|
in.rewrite();
|
||||||
|
|
||||||
|
// Aggiorna eventuale residuo da consegnare
|
||||||
|
if (e->tipo() == _consegna_ordini)
|
||||||
|
{
|
||||||
|
TParametri_elaborazione& p = e->params();
|
||||||
|
set(F_QTA, p.get("QUANTITA"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const TString8 num_in = e->codice_numerazione_iniziale();
|
const TString8 num_in = e->codice_numerazione_iniziale();
|
||||||
set(F_CODNUM_ELAB, num_in);
|
set(F_CODNUM_ELAB, num_in);
|
||||||
@ -3330,7 +3350,7 @@ TElaborazione * TElabora_mask::curr_elab()
|
|||||||
|
|
||||||
void TElabora_mask::add_valuta_filter(TString& filter) const
|
void TElabora_mask::add_valuta_filter(TString& filter) const
|
||||||
{
|
{
|
||||||
TString16 valuta = get(F_CODVAL_ELAB);
|
TString4 valuta = get(F_CODVAL_ELAB);
|
||||||
if (::is_firm_value(valuta))
|
if (::is_firm_value(valuta))
|
||||||
{
|
{
|
||||||
filter << "((CODVAL==\"" << valuta << "\")";
|
filter << "((CODVAL==\"" << valuta << "\")";
|
||||||
@ -3435,18 +3455,18 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool almost_one = FALSE;
|
bool almost_one = false;
|
||||||
|
|
||||||
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
|
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
|
||||||
{
|
{
|
||||||
const TString16 tipo_in(e->tipo_iniziale(i));
|
const TString4 tipo_in(e->tipo_iniziale(i));
|
||||||
if (tipo_in.not_empty())
|
if (tipo_in.full())
|
||||||
{
|
{
|
||||||
if (almost_one)
|
if (almost_one)
|
||||||
filter << "||";
|
filter << "||";
|
||||||
else
|
else
|
||||||
filter << "&&(";
|
filter << "&&(";
|
||||||
almost_one = TRUE;
|
almost_one = true;
|
||||||
filter << "((TIPODOC==\"" << tipo_in << "\")";
|
filter << "((TIPODOC==\"" << tipo_in << "\")";
|
||||||
|
|
||||||
const char stato_in[2] = { e->stato_iniziale(i), '\0' };
|
const char stato_in[2] = { e->stato_iniziale(i), '\0' };
|
||||||
@ -3599,12 +3619,12 @@ bool TDocumento_mask::elabora_handler( TMask_field& f, KEY key )
|
|||||||
{
|
{
|
||||||
TDocumento_mask& m = (TDocumento_mask&)f.mask();
|
TDocumento_mask& m = (TDocumento_mask&)f.mask();
|
||||||
m.update_progs();
|
m.update_progs();
|
||||||
if (m.check_fields()) // Check values
|
if (!m.check_fields()) // Check values
|
||||||
{
|
return false;
|
||||||
|
|
||||||
TElabora_mask* selection = new TElabora_mask(m); // No woman no stack
|
TElabora_mask* selection = new TElabora_mask(m); // No woman no stack
|
||||||
bool do_checks = false;
|
bool do_checks = false;
|
||||||
const char stato_iniziale = m.doc().stato();
|
const char stato_iniziale = m.doc().stato();
|
||||||
|
|
||||||
m.update_father_rows();
|
m.update_father_rows();
|
||||||
while (selection->run() == K_ENTER) //NON riportare modifiche dalla 3.1!! Già sistemato
|
while (selection->run() == K_ENTER) //NON riportare modifiche dalla 3.1!! Già sistemato
|
||||||
{
|
{
|
||||||
@ -3627,7 +3647,7 @@ bool TDocumento_mask::elabora_handler( TMask_field& f, KEY key )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m.get_bool(F_TYPE)) // non aggiunge al documento attuale
|
if (!selection->get_bool(F_TYPE)) // non aggiunge al documento attuale
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (do_checks) //NON riportare modifiche dalla 3.1!! Già sistemato
|
if (do_checks) //NON riportare modifiche dalla 3.1!! Già sistemato
|
||||||
@ -3648,7 +3668,6 @@ bool TDocumento_mask::elabora_handler( TMask_field& f, KEY key )
|
|||||||
m.update_father_rows(false);
|
m.update_father_rows(false);
|
||||||
delete selection;
|
delete selection;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user