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,12 +1811,12 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
{
if (tipo_valido())
{
TTipo_documento & tipo_doc = (TTipo_documento &) tipo();
const TString& tot_doc = tipo_doc.totale_doc();
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())
{
TExpr_documento * exp = f->expr();
TExpr_documento* exp = f->expr();
if (exp != NULL) // Puo' succedere che sia NULL con dati incoerenti
{
if (tot_doc == f->name())
@ -1837,7 +1837,7 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
else
{
TExpr_documento tot_exp(format("%s + _BOLLI(%s)", (const char *) tot_doc_netto,
(const char *) tot_doc_netto), _numexpr, this);
(const char*)tot_doc_netto), _numexpr, this);
add_field(new TDocumento_variable_field(tot_doc, tot_exp));
}
}
@ -1849,11 +1849,10 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
}
}
for (TVariable_field * src_field = rec.first_variable_field();
for (TVariable_field* src_field = rec.first_variable_field();
src_field != NULL; src_field = rec.succ_variable_field())
{
const char * fieldname = src_field->name();
const char* fieldname = src_field->name();
if (src_field->expression() == NULL)
put(fieldname, rec.get(fieldname));
}
@ -1865,11 +1864,10 @@ real TDocumento::imponibile(bool spese, int ndec) const
real val;
if (physical_rows() > 0)
{
TAssoc_array & table = ((TDocumento *)this)->tabella_iva();
TAssoc_array& table = ((TDocumento*)this)->tabella_iva();
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);
@ -1962,29 +1960,30 @@ void TDocumento::calc_iva_fattura_commerciale()
switch (j)
{
case 0:
rp->imp() = rr;
rp->iva() = civa.imposta(rr, ndec);
break;
case 1:
rp->imp_spese() = rr;
break;
case 2:
rp->imp_spese_row() = rr;
break;
case 3:
rp->iva_spese() = rr;
break;
case 4:
rp->iva_sconto() = rr;
break;
case 5:
rp->sconto_perc() = rr;
break;
case 6:
rp->sconto_imp() = rr;
break;
default: break;
case 0:
rp->imp() = rr;
rp->iva() = civa.imposta(rr, ndec);
break;
case 1:
rp->imp_spese() = rr;
break;
case 2:
rp->imp_spese_row() = rr;
break;
case 3:
rp->iva_spese() = rr;
break;
case 4:
rp->iva_sconto() = rr;
break;
case 5:
rp->sconto_perc() = rr;
break;
case 6:
rp->sconto_imp() = rr;
break;
default:
break;
}
}
}
@ -2230,7 +2229,7 @@ real TDocumento::imposta(bool spese, int ndec) const
real val = ZERO;
if (physical_rows() > 0)
{
TAssoc_array & table = ((TDocumento *)this)->tabella_iva();
TAssoc_array& table = ((TDocumento*)this)->tabella_iva();
if (ndec == AUTO_DECIMALS)
ndec = decimals();
@ -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,21 +2738,31 @@ real TDocumento::calc_conai_qta(TCONAI_class type)
{
real qta;
for (int i = physical_rows(); i > 0; i--)
{
const TRiga_documento& r = row(i);
if (r.is_merce())
{
const real row_qta = r.calc_conai_qta(type);
qta += row_qta;
if (type == CONAI_CARTA)
{
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);
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;
}
void TDocumento::update_conai()
{
if (main_app().has_module(DCAUT, CHK_DONGLE) &&tipo().add_conai() && tipo().stati_iniziali_modifica().find(stato()) >= 0)
if (main_app().has_module(DCAUT, CHK_DONGLE) && tipo().add_conai() && tipo().stati_iniziali_modifica().find(stato()) >= 0)
{
const TRectype& cfven = clifor().vendite();
const bool cli_add_conai = cfven.get_bool("ADDCONAI");
@ -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]);
const real perc_esenz = cfven.get_real(__conai_cf_names[ct]);
const bool cli_esente = (esponi_esenti) && (perc_esenz == CENTO);
real qta = calc_conai_qta(ct);
const bool cli_esente = (esponi_esenti) && (perc_esenz == CENTO);
if (!cli_esente)
qta = qta * (CENTO - perc_esenz) / CENTO; // More precise
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
{