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
|
||||
BEGIN
|
||||
PROMPT 2 4 "Cod. num. "
|
||||
PROMPT 2 4 "Numerazione "
|
||||
HELP "Codice numerazione"
|
||||
USE %NUM
|
||||
INPUT CODTAB F_CODNUM_ELAB
|
||||
|
@ -180,7 +180,7 @@ public:
|
||||
bool kill_descrizione_estesa() const { return get_bool("B10"); }
|
||||
bool pack_rif() const { return get_bool("B15"); }
|
||||
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"); }
|
||||
|
||||
int intestazioni_sheet() const { return get_int("I1"); }
|
||||
@ -223,9 +223,10 @@ protected:
|
||||
bool calcola_ncolli_tara_pnetto(const TString& codart, const real& qta,
|
||||
real& nolli, real& tara, real& pnetto) const;
|
||||
bool aggiorna_ncolli_tara_pnetto(TRiga_documento& r) const;
|
||||
bool genera_righe_riferimento(const TDocumento& indoc, TDocumento& outdoc, TSheet_field& s) const;
|
||||
|
||||
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,
|
||||
const TDate& data_elab, bool interattivo = false);
|
||||
|
||||
|
@ -2293,7 +2293,7 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
||||
static TString_array tabella_ripartizione;
|
||||
if (fat_com && tabella_ripartizione.empty())
|
||||
{
|
||||
TConfig cnf(CONFIG_STUDIO);
|
||||
TConfig cnf(CONFIG_STUDIO, "ve");
|
||||
for (int k = 1; k <= MAX_IVA_SLICES; k++)
|
||||
{
|
||||
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);
|
||||
if (valid_row_type(tiporiga)) // controlla l'esistenza della riga
|
||||
{
|
||||
TBill conto;
|
||||
TBill contomat;
|
||||
TBill conto, contomat;
|
||||
real pricemat;
|
||||
const char tipo = r.tipo().tipo();
|
||||
// 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;
|
||||
char tipo_rit = '\0';
|
||||
|
||||
if (spesa)
|
||||
tipo_rit = r.spesa().tipo_ritenuta();
|
||||
|
||||
@ -2338,19 +2336,12 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
||||
if (good())
|
||||
{
|
||||
static TString16 fldvalmat("883");
|
||||
|
||||
if (fldvalmat == "883")
|
||||
{
|
||||
TConfig c(CONFIG_DITTA, "ve");
|
||||
|
||||
fldvalmat = c.get("FldValMat", "");
|
||||
|
||||
}
|
||||
fldvalmat = ini_get_string(CONFIG_DITTA, "ve", "FldValMat", "");
|
||||
if (fldvalmat.full())
|
||||
{
|
||||
pricemat = real(cache().get(LF_ANAMAG, r.get(RDOC_CODARTMAG), fldvalmat));
|
||||
|
||||
if (pricemat != ZERO)
|
||||
if (!pricemat.is_zero())
|
||||
{
|
||||
contomat = conto;
|
||||
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'
|
||||
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))
|
||||
{
|
||||
case 1 :
|
||||
_error = movement_error;
|
||||
break;
|
||||
case 2 :
|
||||
_error = cau_ritintra_error;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
case 1 : _error = movement_error; break;
|
||||
case 2 : _error = cau_ritintra_error; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
const TRegistro& registro = _caus->reg();
|
||||
const bool iva_mov = registro.ok();
|
||||
|
||||
if (!iva_mov)
|
||||
{
|
||||
static int __check_sez = 2;
|
||||
if (__check_sez > 1)
|
||||
{
|
||||
TConfig c(CONFIG_DITTA, "ve");
|
||||
|
||||
__check_sez = c.get_bool("CHECK_SEZ", false);
|
||||
}
|
||||
static int __check_sez = -1;
|
||||
if (__check_sez < 0)
|
||||
__check_sez = ini_get_bool(CONFIG_DITTA, "ve", "CHECK_SEZ");
|
||||
bool swap = false;
|
||||
|
||||
if (__check_sez)
|
||||
@ -2667,7 +2647,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc)
|
||||
{
|
||||
const int tmov = _caus->tipomov();
|
||||
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 TDate d(head.get_date(MOV_DATACAM));
|
||||
const real c(head.get_real(MOV_CAMBIO));
|
||||
|
221
ve/velib04d.cpp
221
ve/velib04d.cpp
@ -18,9 +18,7 @@ protected:
|
||||
|
||||
public:
|
||||
void doc2mask(const TDocumento& doc, const TString & articolo);
|
||||
|
||||
TConsegna_mask(TConfig & c,int header_code = 0, bool per_codice = false, bool ignora_descrizioni = false);
|
||||
virtual ~TConsegna_mask() { }
|
||||
TConsegna_mask(int header_code = 0, bool per_codice = false, bool ignora_descrizioni = false);
|
||||
};
|
||||
|
||||
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& s2 = s.row(j);
|
||||
TString ss1, ss2;
|
||||
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 };
|
||||
int ret = 0, field = 0;
|
||||
while (fields[field] >= 0)
|
||||
int ret = 0;
|
||||
for (short field = 0; fields[field] > 0; field++)
|
||||
{
|
||||
if (fields[field] == S_QTARESIDUA)
|
||||
{
|
||||
@ -143,7 +141,6 @@ int rows_sort_func(TSheet_field& s, int i, int j)
|
||||
}
|
||||
if (ret != 0)
|
||||
break;
|
||||
field++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -219,7 +216,7 @@ void TConsegna_mask::doc2mask(const TDocumento& doc, const TString & articolo)
|
||||
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),
|
||||
_ignora_descrizioni(ignora_descrizioni)
|
||||
{
|
||||
@ -228,46 +225,34 @@ TConsegna_mask::TConsegna_mask(TConfig & c, int header_code, bool per_codice, bo
|
||||
cl.set_sheet_columns(s, S_LIVGIAC1);
|
||||
if (header_code == 1)
|
||||
{
|
||||
TString h;
|
||||
h = HR("Quantita'\nconsegnata");
|
||||
s.set_column_header(S_QTARESIDUA, h);
|
||||
s.set_column_header(S_QTARESIDUA, HR("Quantita'\nconsegnata"));
|
||||
s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Q.ta' consegnata"));
|
||||
|
||||
h = HR("Quantita'\nda fatturare");
|
||||
s.set_column_header(S_QTADAEVADERE, h);
|
||||
s.set_column_header(S_QTADAEVADERE, HR("Quantita'\nda fatturare"));
|
||||
s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Q.ta' da fatturare"));
|
||||
}
|
||||
else
|
||||
} else
|
||||
if (header_code == 2)
|
||||
{
|
||||
TString h;
|
||||
h = HR("Residuo");
|
||||
s.set_column_header(S_QTARESIDUA, h);
|
||||
s.set_column_header(S_QTARESIDUA, HR("Residuo"));
|
||||
s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Residuo "));
|
||||
|
||||
h = HR("Da evadere");
|
||||
s.set_column_header(S_QTADAEVADERE, h);
|
||||
s.set_column_header(S_QTADAEVADERE, HR("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");
|
||||
TMask_field & agg1 =s.sheet_mask().field(S_CODAGG1);
|
||||
|
||||
s.set_column_header(S_CODAGG1, codagg1);
|
||||
codagg1.rpad(strlen(agg1.prompt()));
|
||||
agg1.set_prompt(codagg1);
|
||||
TString8 n; n.format("CODAGG%d", i);
|
||||
if (c.exist(n))
|
||||
{
|
||||
const short id = i == 1 ? S_CODAGG1 : S_CODAGG2;
|
||||
TString80 codagg = c.get(n);
|
||||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -313,53 +298,7 @@ bool TConsegna_ordini::aggiorna_ncolli_tara_pnetto(TRiga_documento& r) const
|
||||
return ok;
|
||||
}
|
||||
|
||||
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 = 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())
|
||||
bool TConsegna_ordini::genera_righe_riferimento(const TDocumento& indoc, TDocumento& outdoc, TSheet_field& s) const
|
||||
{
|
||||
// Determina ed eventualmente crea la riga di riferimento
|
||||
const int riga_rif = riferimenti_in_testa() ? 1 : outdoc.physical_rows()+1;
|
||||
@ -395,7 +334,6 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
||||
|
||||
if (numrif.full())
|
||||
{
|
||||
TSheet_field& s = m.sfield(F_ROWS);
|
||||
TAssoc_array doc_rows;
|
||||
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_DESCEST, memo.mid(50));
|
||||
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);
|
||||
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();
|
||||
TAssoc_array scarti;
|
||||
|
||||
TSheet_field& s = m.sfield(F_ROWS);
|
||||
FOR_EACH_SHEET_ROW(s, n, row)
|
||||
{
|
||||
const int r = row->get_int(s.cid2index(S_NUMRIGA));
|
||||
TRiga_documento& inrec = indoc[r];
|
||||
if (row->get_char(0) > ' ') // E' da consegnare?
|
||||
{
|
||||
TRiga_documento& inrec = indoc[r];
|
||||
const real daeva = row->get(S_QTADAEVADERE - FIRST_FIELD);
|
||||
const bool eva = row->get_char(S_RIGAEVASA - FIRST_FIELD) > ' ';
|
||||
if (evadi && (daeva > ZERO || eva))
|
||||
{
|
||||
ok = true; // Ho evaso almeno una riga!
|
||||
const char* fqe = inrec.field_qtaevasa();
|
||||
inrec.add(fqe, daeva); // nuovo modo di incrementare
|
||||
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);
|
||||
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();
|
||||
|
||||
const bool ordina_per_doc = ini_get_bool(CONFIG_DITTA, "ve", "ORDINA_PER_DOC", true);
|
||||
if (ordina_per_doc)
|
||||
{
|
||||
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())
|
||||
{
|
||||
//const bool doc_al_lordo = outdoc.tipo().calcolo_lordo();
|
||||
const TString & codart = outrec.get(RDOC_CODARTMAG);
|
||||
const bool doc_al_lordo = outdoc.tipo().calcolo_lordo();
|
||||
const TRectype & anamag = cache().get(LF_ANAMAG, codart);
|
||||
|
||||
if (!anamag.empty())
|
||||
{
|
||||
TString16 field_prezzo(outdoc.tipo().field_prezzo());
|
||||
|
||||
const TString16 field_prezzo = outdoc.tipo().field_prezzo();
|
||||
if (field_prezzo.full())
|
||||
outrec.put(RDOC_PREZZO, anamag.get_real(field_prezzo));
|
||||
else
|
||||
{
|
||||
const TString16 um(outrec.get(RDOC_UMQTA));
|
||||
|
||||
const TString4 um = outrec.get(RDOC_UMQTA);
|
||||
if (um.full())
|
||||
{
|
||||
TLocalisamfile umart(LF_UMART);
|
||||
umart.setkey(2);
|
||||
umart.put("CODART", codart);
|
||||
umart.put("UM", um);
|
||||
umart.put(UMART_CODART, codart);
|
||||
umart.put(UMART_UM, um);
|
||||
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();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inserisce le eventuali righe di scarto al posto giusto
|
||||
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());
|
||||
const TRiga_documento & inrec = indoc[ska.get_int()];
|
||||
outrec.set_original_rdoc_key(inrec);
|
||||
}
|
||||
}
|
||||
|
||||
if (reload_prices())
|
||||
@ -723,11 +735,9 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
||||
|
||||
if (nettifica())
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = indoc.physical_rows(); i >= 1; i--)
|
||||
FOR_EACH_PHYSICAL_RDOC_BACK(indoc, i, rdoc)
|
||||
{
|
||||
TRiga_documento& inrec = indoc[i];
|
||||
TRiga_documento& inrec = *rdoc;
|
||||
const int nrow = inrec.get_int(RDOC_NRIGA);
|
||||
|
||||
if (inrec.is_evasa())
|
||||
@ -744,11 +754,14 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
|
||||
}
|
||||
}
|
||||
if (indoc.is_evaso())
|
||||
{
|
||||
indoc.stato(stato_finale_doc_iniziale()[0]);
|
||||
}
|
||||
|
||||
if (ok) // Ho elaborato almeno una riga?
|
||||
{
|
||||
post_process_input(doc_in);
|
||||
post_process(doc_out, doc_in);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
@ -2927,6 +2927,19 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
||||
if (e == fe_modify)
|
||||
update_ndoc_filter();
|
||||
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:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
{
|
||||
@ -3128,10 +3141,10 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
||||
int TElabora_mask::update_list()
|
||||
{
|
||||
TString_array elabs;
|
||||
const TString16 tipo(_main->get(F_TIPODOC));
|
||||
const TString16 stato(_main->get(F_STATO));
|
||||
const TString16 tipo_elab(get(F_TIPODOC_ELAB));
|
||||
const TString16 stato_elab(get(F_STATODOC_ELAB));
|
||||
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 bool from_elab = !get_bool(F_TYPE);
|
||||
int items = 0;
|
||||
|
||||
@ -3146,7 +3159,7 @@ int TElabora_mask::update_list()
|
||||
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 descrs;
|
||||
for (int i = 0; i < items; i++)
|
||||
@ -3301,6 +3314,13 @@ bool TElabora_mask::elabora()
|
||||
update_mask = true;
|
||||
}
|
||||
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();
|
||||
set(F_CODNUM_ELAB, num_in);
|
||||
@ -3330,7 +3350,7 @@ TElaborazione * TElabora_mask::curr_elab()
|
||||
|
||||
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))
|
||||
{
|
||||
filter << "((CODVAL==\"" << valuta << "\")";
|
||||
@ -3435,18 +3455,18 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
|
||||
}
|
||||
else
|
||||
{
|
||||
bool almost_one = FALSE;
|
||||
bool almost_one = false;
|
||||
|
||||
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
|
||||
{
|
||||
const TString16 tipo_in(e->tipo_iniziale(i));
|
||||
if (tipo_in.not_empty())
|
||||
const TString4 tipo_in(e->tipo_iniziale(i));
|
||||
if (tipo_in.full())
|
||||
{
|
||||
if (almost_one)
|
||||
filter << "||";
|
||||
else
|
||||
filter << "&&(";
|
||||
almost_one = TRUE;
|
||||
almost_one = true;
|
||||
filter << "((TIPODOC==\"" << tipo_in << "\")";
|
||||
|
||||
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();
|
||||
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
|
||||
bool do_checks = false;
|
||||
const char stato_iniziale = m.doc().stato();
|
||||
|
||||
m.update_father_rows();
|
||||
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;
|
||||
}
|
||||
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);
|
||||
delete selection;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user