Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/branches/R_10_00@22588 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-02-24 15:00:45 +00:00
parent 077cb844e9
commit 8eda576c58
8 changed files with 27 additions and 58 deletions

View File

@ -30,41 +30,20 @@ real TCond_vendita::normalize_valuta(const real & val, const char * val_rif)
if (val.is_zero())
return ZERO;
/*
TString16 valuta_rif(val_rif);
if (is_firm_value(valuta_rif))
valuta_rif.cut(0);
TString16 valuta(_testa->get(F_CODVAL));
if (is_firm_value(valuta))
valuta.cut(0);
if (valuta == valuta_rif)
return val;
const real cambio = _condv.get_real(CONDV_CAMBIO);
const exchange_type controeuro = _condv.get_bool(CONDV_CONTROEURO) ? _exchange_contro : _exchange_base;
TPrice normalized(val, valuta_rif, cambio, controeuro);
const real cambio_dest = _testa->get_real(F_CAMBIO);
const exchange_type controeuro_dest = _testa->get_bool(F_CONTROEURO) ? _exchange_contro : _exchange_base;
normalized.change_value(valuta, cambio_dest, controeuro_dest);
*/
const TString& valuta = _testa->get(F_CODVAL);
if (same_values(val_rif, valuta))
return val;
const real cambio = _condv.get_real(CONDV_CAMBIO);
TPrice normalized(val, val_rif, cambio, _exchange_contro);
TPrice normalized(val, val_rif, cambio);
const real cambio_dest = _testa->get_real(F_CAMBIO);
normalized.change_value(valuta, cambio_dest, _exchange_contro);
normalized.change_value(valuta, cambio_dest);
return normalized.get_num();
}
void TCond_vendita::set_prezzo(const real & prezzo, const char * val_rif)
{
_prezzo = normalize_valuta(prezzo, val_rif);

View File

@ -88,7 +88,7 @@ void TFatturazione_bolle_app::process_by_cli(const TMask& m)
msg << codcli << " ...";
iw.set_text(msg); // Messaggio sul cliente
do_events(); // Attende visualizzazione
TLista_documenti din; // Legge tutti i documenti di input
din.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);
if (din.items() > 0 && !iw.iscancelled())
@ -195,7 +195,10 @@ void TFatturazione_bolle_app::process_by_doc(const TMask& m)
msg << ' ' << codcli << "...";
iw.set_text(msg); // Messaggio sul cliente
do_events(); // Attende visualizzazione
if (codcli == 203726)
int cazzone = 1;
TLista_documenti list;
list.read('D', tipocf, codcli, anno, tipidoc, statidoc, dd, ad, codnum, dn, an);

View File

@ -105,7 +105,7 @@ const TCodice_numerazione& cached_numerazione(const char * codnum)
}
// calcola il prezzo per le spese
void sppr_calc(const TRectype & rec, const TString & valuta_doc, const real & cambio, real & prezzo, exchange_type controeuro)
void sppr_calc(const TRectype & rec, const TString & valuta_doc, const real & cambio, real & prezzo)
{
const TString4 sppr_valuta(rec.get("S4"));
@ -116,14 +116,14 @@ void sppr_calc(const TRectype & rec, const TString & valuta_doc, const real & ca
{
TPrice val(prezzo, sppr_valuta);
val.change_value(valuta_doc, cambio, controeuro);
val.change_value(valuta_doc, cambio);
prezzo = val.get_num();
}
else
{
TCurrency val(prezzo, sppr_valuta);
val.change_value(valuta_doc, cambio, controeuro);
val.change_value(valuta_doc, cambio);
prezzo = val.get_num();
}
}
@ -414,9 +414,7 @@ real TDocumento::spese_incasso(real & imp, int ndec, TTipo_importo t) const
if (!cambio.is_zero())
{
// Converte le spese nella valuta del documento
const exchange_type ce = get_bool(DOC_CONTROEURO) ? _exchange_contro : _exchange_base;
imp_spese = change_currency(imp_spese, "", ZERO, _exchange_undefined,
get(DOC_CODVAL), cambio, ce, -1);
imp_spese = change_currency(imp_spese, "", ZERO, get(DOC_CODVAL), cambio, -1);
}
imp_spese.round(ndec);
@ -591,9 +589,7 @@ real TDocumento::bolli(real & imp, int ndec, TTipo_importo t) const
if (in_valuta())
{
const real cambio = get_real(DOC_CAMBIO);
const exchange_type ce = get_bool(DOC_CONTROEURO) ? _exchange_contro : _exchange_base;
tot_bolli = change_currency(tot_bolli, "", ZERO, _exchange_undefined,
get(DOC_CODVAL), cambio, ce, -1);
tot_bolli = change_currency(tot_bolli, "", ZERO, get(DOC_CODVAL), cambio, -1);
}
tot_bolli.round(ndec);
}
@ -2827,10 +2823,9 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
{
const real cambio = get_real(DOC_CAMBIO);
const TString4 valuta = get(DOC_CODVAL);
const exchange_type controeuro = get_bool(DOC_CONTROEURO) ? _exchange_contro : _exchange_base;
real prezzo = sp.prezzo();
sppr_calc(sp, valuta, cambio, prezzo, controeuro);
sppr_calc(sp, valuta, cambio, prezzo);
if (this->tipo().calcolo_lordo())
{
prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS);
@ -2983,10 +2978,9 @@ void TDocumento::update_conai()
const real cambio = get_real(DOC_CAMBIO);
const TString4 valuta = get(DOC_CODVAL);
const bool controeuro = get_bool(DOC_CONTROEURO);
real prezzo = cli_esente ? ZERO : sp.prezzo();
sppr_calc(sp, valuta, cambio, prezzo, controeuro ? _exchange_contro : _exchange_base);
sppr_calc(sp, valuta, cambio, prezzo);
if (this->tipo().calcolo_lordo())
prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS);
riga.put(RDOC_PREZZO, prezzo);
@ -3042,11 +3036,10 @@ bool TDocumento::is_nota_credito() const
}
TCurrency_documento::TCurrency_documento(const real& num, const TDocumento & doc, bool price)
: TCurrency(ZERO, "", ZERO, _exchange_base, price)
: TCurrency(ZERO, "", ZERO, price)
{
const TString4 val = doc.get(DOC_CODVAL);
const bool controeuro = doc.get_bool(DOC_CONTROEURO);
force_value(val, doc.get_real(DOC_CAMBIO), controeuro ? _exchange_contro : _exchange_base);
force_value(val, doc.get_real(DOC_CAMBIO));
set_num(num);
}

View File

@ -567,7 +567,7 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
d.sort_rows(_rowsort);
}
post_process(doc_out, doc_in);
for (int i = doc_out.items() - 1; i >=0; i--) // Forza tipo e numerazione documento.
for (int i = doc_out.items() - 1; i >=0; i--)
{
TDocumento& d = doc_out[i];

View File

@ -1323,7 +1323,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
{
mov_rec.put(MOV_CODVALI,codvali);
TExchange c(codvali);
cambioi = c.get_base_change();
cambioi = c.get_change();
mov_rec.put(MOV_CAMBIOI, cambioi);
}
else
@ -1989,7 +1989,6 @@ error_type TContabilizzazione::adjust_iva_rows(TDocumento& doc)
const int ndec = TCurrency::get_firm_dec(); // Numero di decimali della valuta di ditta
const TString4 codval(doc.get(DOC_CODVAL));
const real cambio = doc.cambio();
const exchange_type et = doc.get_bool(DOC_CONTROEURO) ? _exchange_contro : _exchange_base;
// Scorre tutti gli elementi della tabella IVA del documento (elementi per codice iva)
for (riep = (TRiepilogo_iva*) aa.first_item(); riep != NULL; riep = (TRiepilogo_iva*) aa.succ_item())
{
@ -2025,9 +2024,8 @@ error_type TContabilizzazione::adjust_iva_rows(TDocumento& doc)
{
if (ndec == 0)
{
TExchange cam(codval, cambio, et);
iva_g *= cam.get_base_change();
TExchange cam(codval, cambio);
iva_g *= cam.get_change();
if (iva_g < ZERO)
iva_g.floor(0);
else

View File

@ -1946,13 +1946,13 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
TRectype new_rec(r);
if (fl.read() != NOERR)
{
ok = yesno_box("Il codice di giacenza %s non e' legato all' articolo. Devo legarlo", (const char *)livello);
ok = yesno_box("Il codice di giacenza %s non e' legato all' articolo. Si desidera legarlo", (const char *)livello);
if (ok)
{
r = new_rec;
const int err = new_rec.write(fl);
if (err != NOERR)
return error_box("Non sono riuscito a legare il codice di giacenza. Errore %d", err);
return error_box("Impossibile legare il codice di giacenza. Errore %d", err);
}
else
return false;
@ -3928,15 +3928,13 @@ bool TDocumento_mask::codval_handler( TMask_field& f, KEY key )
m.set(F_DATACAMBIO1, datacam);
}
TExchange exc(f.get());
exchange_type et;
real cambio = exc.get_change(et); // Determino il cambio standard ed il "Contro-Euro"
real cambio = exc.get_change(); // Determino il cambio standard ed il "Contro-Euro"
TString16 key;
key.format("%-3s%s", (const char*)f.get(), (const char*)datacam.string(ANSI));
const real giornaliero(cache().get("CAM", key, "S4"));
if (!giornaliero.is_zero())
cambio = giornaliero; // Ho trovato un cambio per il giorno!
m.set(F_CAMBIO, cambio);
m.set(F_CONTROEURO, et == _exchange_contro ? "X" : "");
m.sfield(F_SHEET).force_update(); // Aggiorna punti decimali degli importi
}

View File

@ -2327,11 +2327,9 @@ bool sppr_handler( TMask_field& f, KEY key )
const real cambio = mask.get_real(F_CAMBIO);
real prezzo = sp.prezzo();
const TString& doc_valuta = mask.get(F_CODVAL);
const bool controeuro = mask.get_bool(F_CONTROEURO);
sppr_calc(sp, doc_valuta, cambio, prezzo, controeuro ? _exchange_contro : _exchange_base);
if (mask.doc().tipo().calcolo_lordo())
prezzo = TRiga_documento::iva(sp.cod_iva()).lordo(prezzo, ALL_DECIMALS);
sppr_calc(sp, doc_valuta, cambio, prezzo);
if (mask.doc().tipo().calcolo_lordo())
prezzo = TRiga_documento::iva(sp.cod_iva()).lordo(prezzo, ALL_DECIMALS);
row_mask.set(FR_PREZZO, prezzo);
}
}

View File

@ -12,7 +12,7 @@ bool sppr_handler( TMask_field& f, KEY key );
bool codartmag_handler( TMask_field& f, KEY key );
bool dcons_handler( TMask_field& f, KEY key );
bool iva_handler( TMask_field& f, KEY key );
void sppr_calc(const TRectype& rec, const TString& valuta_doc, const real& cambio, real& prezzo, exchange_type controeuro);
void sppr_calc(const TRectype& rec, const TString& valuta_doc, const real& cambio, real& prezzo);
void row_set_handler(TMask& m, const int field, const int index);
bool tipo_riga_handler(TMask_field& f, KEY key);
bool codmag_handler(TMask_field& f, KEY key);