Patch level : 10.0

Files correlati     : ve1.exe
Ricompilazione Demo : [ ]
Commento            :
Migliorata gestione transazioni di stampa


git-svn-id: svn://10.65.10.50/trunk@19831 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-12-22 16:56:14 +00:00
parent 420f004af4
commit 97a79e484e
2 changed files with 72 additions and 63 deletions

View File

@ -1282,10 +1282,15 @@ void TReport_doc_app::print_trans(const char* ininame)
TTrans_recordset doc(ininame);
if (doc.items() > 0)
{
const TString& a = ini_get_string(ininame, "Transaction", "Action");
const TString& m = ini_get_string(ininame, "Transaction", "Mode");
const TOutput_mode mode = key2mode(a[0]);
const bool is_definitive = m[0] == 'D';
char a='P', m='D';
if (ininame && *ininame) // Dummy test
{
TConfig ini(ininame, "Transaction");
a = ini.get("Action")[0];
m = ini.get("Mode")[0];
}
const TOutput_mode mode = key2mode(a);
const bool is_definitive = m == 'D';
print_loop(doc, mode, is_definitive);
}
else

View File

@ -80,7 +80,7 @@ TNumerazione_cache::TNumerazione_cache()
: TRecord_cache("%NUM", 1)
{
test_file_changes(); // Tieni d'occhio le modifiche sul file
set_items_limit(64); // Standard
set_items_limit(59); // Standard
}
TObject* TNumerazione_cache::rec2obj(const TRectype& curr) const
@ -147,7 +147,7 @@ const char* TMov_mag_doc::codmag_rauto(int r) const
{
const TRecord_array& b = body();
if (r > b.rows()) // Can't check non-existent rows
if (r <= 0 || r > b.rows()) // Can't check non-existent rows
return NULL;
const char tr = b[r].get_char(RMOVMAG_TIPORIGA);
@ -168,7 +168,7 @@ const char* TMov_mag_doc::codmag_rauto(int r) const
/////////////////////////////////////////////////////////////
TRiepilogo_iva& TRiepilogo_iva::copy(const TRiepilogo_iva& a)
{
(TRectype &) _codiva = (TRectype &) a._codiva;
_codiva = a.cod_iva();
_imp = a._imp;
_imp_orig = a._imp_orig;
_imp_spese = a._imp_spese;
@ -1811,7 +1811,7 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
{
if (tipo_valido())
{
TTipo_documento & tipo_doc = (TTipo_documento &) tipo();
TTipo_documento& tipo_doc = (TTipo_documento&)tipo(); // first_formula() is NOT const
const TString& tot_doc = tipo_doc.totale_doc();
for (const TFormula_documento* f = tipo_doc.first_formula(); f; f = tipo_doc.succ_formula())
@ -1853,7 +1853,6 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
src_field != NULL; src_field = rec.succ_variable_field())
{
const char* fieldname = src_field->name();
if (src_field->expression() == NULL)
put(fieldname, rec.get(fieldname));
}
@ -1869,7 +1868,6 @@ real TDocumento::imponibile(bool spese, int ndec) const
table.restart();
for (TRiepilogo_iva* ri = (TRiepilogo_iva*)table.get(); ri != NULL; ri = (TRiepilogo_iva*)table.get())
val += ri->imponibile(spese);
if (ndec == AUTO_DECIMALS)
ndec = decimals();
val.round(ndec);
@ -1984,7 +1982,8 @@ void TDocumento::calc_iva_fattura_commerciale()
case 6:
rp->sconto_imp() = rr;
break;
default: break;
default:
break;
}
}
}
@ -2314,10 +2313,7 @@ real TDocumento::basesconto() const
real TDocumento::spese() const
{
const TString& field = tipo().spese();
if (field.not_empty())
return get_real(field);
else
return ZERO;
return field.not_empty() ? get_real(field) : ZERO;
}
real TDocumento::ritenute(const char tipo, bool lordo, int ndec) const
@ -2325,8 +2321,7 @@ real TDocumento::ritenute(const char tipo, bool lordo, int ndec) const
real val;
for (int i = rows() ; i > 0; i--)
{
TRiga_documento &r = ((TRiga_documento &) ((TDocumento *)this)->row(i));
const TRiga_documento& r = operator[](i);
val += r.ritenuta(tipo, lordo, ndec);
}
return val;
@ -2743,15 +2738,25 @@ real TDocumento::calc_conai_qta(TCONAI_class type)
{
real qta;
for (int i = physical_rows(); i > 0; i--)
if (type == CONAI_CARTA)
{
const TRiga_documento& r = row(i);
if (r.is_merce())
ofstream dbg("conai.caz");
FOR_EACH_PHYSICAL_RDOC(*this, i, r) if (r->is_merce() || r->is_omaggio())
{
const real row_qta = r.calc_conai_qta(type);
const real row_qta = r->calc_conai_qta(type);
qta += row_qta;
dbg << i << '\t' << row_qta.string() << endl;
}
}
else
{
FOR_EACH_PHYSICAL_RDOC(*this, i, r) if (r->is_merce() || r->is_omaggio())
{
const real row_qta = r->calc_conai_qta(type);
qta += row_qta;
}
}
return qta;
}
@ -2771,7 +2776,7 @@ void TDocumento::update_conai()
{
const char* const conai_cod[CONAI_CLASSES] = { "CODACC", "CODALL", "CODCAR", "CODPLA", "CODLEG", "CODVET" };
TConfig c(CONFIG_DITTA, "ve");
for (int i = 0; i < 6; i++)
for (int i = 0; i < CONAI_CLASSES; i++)
conai_sp.add(c.get(conai_cod[i]));
esponi_esenti = c.get_bool("ESPONIESENTI");
@ -2799,7 +2804,7 @@ void TDocumento::update_conai()
perc_esenz = ZERO;
const bool cli_esente = (esponi_esenti) && (perc_esenz == CENTO);
if (!cli_esente)
if (!cli_esente && !perc_esenz.is_zero())
qta = qta * (CENTO - perc_esenz) / CENTO; // More precise
if (qta > ZERO)
{
@ -2827,18 +2832,17 @@ void TDocumento::update_conai()
{
if (!updated[ct])
{
real perc_esenz = cfven.get_real(__conai_cf_names[ct]);
real qta = calc_conai_qta(ct);
const real perc_esenz = cfven.get_real(__conai_cf_names[ct]);
const bool cli_esente = (esponi_esenti) && (perc_esenz == CENTO);
if (!cli_esente)
real qta = calc_conai_qta(ct);
if (!cli_esente && !qta.is_zero() && !perc_esenz.is_zero())
qta = qta * (CENTO - perc_esenz) / CENTO; // More precise
if (qta > ZERO)
{
const TString& s = conai_sp.row(ct);
if (sp.read(s) != NOERR)
message_box("Il codice spesa CONAI %s specificato nei parametri ditta e' assente: '%s'",
message_box(FR("Il codice spesa CONAI %s specificato nei parametri ditta e' assente: '%s'"),
conai_material(ct), (const char*)s);
else
{