Patch level : 2.2

Files correlati     : ve0
Ricompilazione Demo : [ ]
Commento            :

Aggiunta commessa automaticamente anche nelle righe spese generate


git-svn-id: svn://10.65.10.50/trunk@13754 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2006-02-02 17:59:02 +00:00
parent 0b64b3ae0f
commit 44922a7656

View File

@ -2206,26 +2206,23 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
sh->destroy(i - 1);
}
}
TString4 cod_iva_cli;
const int nspese = spese_aut.items();
if (nspese > 0)
{
TLocalisamfile cfven(LF_CFVEN);
TString16 key; key.format("%c|%ld", get_char(DOC_TIPOCF), get_long(DOC_CODCF));
const TString4 cod_iva_cli = cache().get(LF_CFVEN, key, "ASSFIS");
TSpesa_prest sp;
cfven.put("TIPOCF", get("TIPOCF"));
cfven.put("CODCF", get("CODCF"));
if (cfven.read() == NOERR)
cod_iva_cli = cfven.get("ASSFIS");
for (i = 0; i < nspese; i++)
{
const TString & s = spese_aut.row(i);
const TString& s = spese_aut.row(i);
if (sp.read(s) != NOERR)
message_box("Codice spesa %s assente", (const char *) s);
else
{
TString16 tipo(sp.tipo_riga());
TRiga_documento & riga = new_row(tipo);
const TString4 tipo(sp.tipo_riga());
TRiga_documento& riga = new_row(tipo);
riga.put(RDOC_CODART, s);
riga.generata();
@ -2236,13 +2233,14 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
{
real qta = sp.qta();
if (qta == ZERO)
qta = 1.0;
qta = UNO;
riga.put("QTA", qta);
}
// Continua perche' e' quantita' e valore
case 'V':
{
const real cambio = get_real(DOC_CAMBIO);
const TString16 valuta = get(DOC_CODVAL);
const TString4 valuta = get(DOC_CODVAL);
const exchange_type controeuro = get_bool(DOC_CONTROEURO) ? _exchange_contro : _exchange_base;
real prezzo = sp.prezzo();
@ -2257,9 +2255,14 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
break;
}
if (cod_iva_cli.empty())
riga.put("CODIVA", sp.cod_iva());
riga.put(RDOC_CODIVA, sp.cod_iva());
else
riga.put("CODIVA", cod_iva_cli);
riga.put(RDOC_CODIVA, cod_iva_cli);
riga.put(RDOC_CODCOSTO, sp.cdc());
riga.put(RDOC_CODCMS, sp.cms());
riga.put(RDOC_FASCMS, sp.fase());
if (interactive)
{
const int nrow = sh->insert(-1, FALSE);