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:
parent
420f004af4
commit
97a79e484e
@ -1282,10 +1282,15 @@ void TReport_doc_app::print_trans(const char* ininame)
|
|||||||
TTrans_recordset doc(ininame);
|
TTrans_recordset doc(ininame);
|
||||||
if (doc.items() > 0)
|
if (doc.items() > 0)
|
||||||
{
|
{
|
||||||
const TString& a = ini_get_string(ininame, "Transaction", "Action");
|
char a='P', m='D';
|
||||||
const TString& m = ini_get_string(ininame, "Transaction", "Mode");
|
if (ininame && *ininame) // Dummy test
|
||||||
const TOutput_mode mode = key2mode(a[0]);
|
{
|
||||||
const bool is_definitive = m[0] == 'D';
|
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);
|
print_loop(doc, mode, is_definitive);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
122
ve/velib03.cpp
122
ve/velib03.cpp
@ -80,7 +80,7 @@ TNumerazione_cache::TNumerazione_cache()
|
|||||||
: TRecord_cache("%NUM", 1)
|
: TRecord_cache("%NUM", 1)
|
||||||
{
|
{
|
||||||
test_file_changes(); // Tieni d'occhio le modifiche sul file
|
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
|
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();
|
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;
|
return NULL;
|
||||||
|
|
||||||
const char tr = b[r].get_char(RMOVMAG_TIPORIGA);
|
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)
|
TRiepilogo_iva& TRiepilogo_iva::copy(const TRiepilogo_iva& a)
|
||||||
{
|
{
|
||||||
(TRectype &) _codiva = (TRectype &) a._codiva;
|
_codiva = a.cod_iva();
|
||||||
_imp = a._imp;
|
_imp = a._imp;
|
||||||
_imp_orig = a._imp_orig;
|
_imp_orig = a._imp_orig;
|
||||||
_imp_spese = a._imp_spese;
|
_imp_spese = a._imp_spese;
|
||||||
@ -1811,12 +1811,12 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
|
|||||||
{
|
{
|
||||||
if (tipo_valido())
|
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();
|
const TString& tot_doc = tipo_doc.totale_doc();
|
||||||
|
|
||||||
for (const TFormula_documento* f = tipo_doc.first_formula(); f; f = tipo_doc.succ_formula())
|
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 (exp != NULL) // Puo' succedere che sia NULL con dati incoerenti
|
||||||
{
|
{
|
||||||
if (tot_doc == f->name())
|
if (tot_doc == f->name())
|
||||||
@ -1837,7 +1837,7 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
TExpr_documento tot_exp(format("%s + _BOLLI(%s)", (const char *) tot_doc_netto,
|
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));
|
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())
|
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)
|
if (src_field->expression() == NULL)
|
||||||
put(fieldname, rec.get(fieldname));
|
put(fieldname, rec.get(fieldname));
|
||||||
}
|
}
|
||||||
@ -1865,11 +1864,10 @@ real TDocumento::imponibile(bool spese, int ndec) const
|
|||||||
real val;
|
real val;
|
||||||
if (physical_rows() > 0)
|
if (physical_rows() > 0)
|
||||||
{
|
{
|
||||||
TAssoc_array & table = ((TDocumento *)this)->tabella_iva();
|
TAssoc_array& table = ((TDocumento*)this)->tabella_iva();
|
||||||
table.restart();
|
table.restart();
|
||||||
for (TRiepilogo_iva* ri = (TRiepilogo_iva*)table.get(); ri != NULL; ri = (TRiepilogo_iva*)table.get())
|
for (TRiepilogo_iva* ri = (TRiepilogo_iva*)table.get(); ri != NULL; ri = (TRiepilogo_iva*)table.get())
|
||||||
val += ri->imponibile(spese);
|
val += ri->imponibile(spese);
|
||||||
|
|
||||||
if (ndec == AUTO_DECIMALS)
|
if (ndec == AUTO_DECIMALS)
|
||||||
ndec = decimals();
|
ndec = decimals();
|
||||||
val.round(ndec);
|
val.round(ndec);
|
||||||
@ -1962,29 +1960,30 @@ void TDocumento::calc_iva_fattura_commerciale()
|
|||||||
|
|
||||||
switch (j)
|
switch (j)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
rp->imp() = rr;
|
rp->imp() = rr;
|
||||||
rp->iva() = civa.imposta(rr, ndec);
|
rp->iva() = civa.imposta(rr, ndec);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
rp->imp_spese() = rr;
|
rp->imp_spese() = rr;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
rp->imp_spese_row() = rr;
|
rp->imp_spese_row() = rr;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
rp->iva_spese() = rr;
|
rp->iva_spese() = rr;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
rp->iva_sconto() = rr;
|
rp->iva_sconto() = rr;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
rp->sconto_perc() = rr;
|
rp->sconto_perc() = rr;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
rp->sconto_imp() = rr;
|
rp->sconto_imp() = rr;
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2230,7 +2229,7 @@ real TDocumento::imposta(bool spese, int ndec) const
|
|||||||
real val = ZERO;
|
real val = ZERO;
|
||||||
if (physical_rows() > 0)
|
if (physical_rows() > 0)
|
||||||
{
|
{
|
||||||
TAssoc_array & table = ((TDocumento *)this)->tabella_iva();
|
TAssoc_array& table = ((TDocumento*)this)->tabella_iva();
|
||||||
|
|
||||||
if (ndec == AUTO_DECIMALS)
|
if (ndec == AUTO_DECIMALS)
|
||||||
ndec = decimals();
|
ndec = decimals();
|
||||||
@ -2314,10 +2313,7 @@ real TDocumento::basesconto() const
|
|||||||
real TDocumento::spese() const
|
real TDocumento::spese() const
|
||||||
{
|
{
|
||||||
const TString& field = tipo().spese();
|
const TString& field = tipo().spese();
|
||||||
if (field.not_empty())
|
return field.not_empty() ? get_real(field) : ZERO;
|
||||||
return get_real(field);
|
|
||||||
else
|
|
||||||
return ZERO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
real TDocumento::ritenute(const char tipo, bool lordo, int ndec) const
|
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;
|
real val;
|
||||||
for (int i = rows() ; i > 0; i--)
|
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);
|
val += r.ritenuta(tipo, lordo, ndec);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
@ -2743,21 +2738,31 @@ real TDocumento::calc_conai_qta(TCONAI_class type)
|
|||||||
{
|
{
|
||||||
real qta;
|
real qta;
|
||||||
|
|
||||||
for (int i = physical_rows(); i > 0; i--)
|
if (type == CONAI_CARTA)
|
||||||
{
|
{
|
||||||
const TRiga_documento& r = row(i);
|
ofstream dbg("conai.caz");
|
||||||
if (r.is_merce())
|
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;
|
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;
|
return qta;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDocumento::update_conai()
|
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 TRectype& cfven = clifor().vendite();
|
||||||
const bool cli_add_conai = cfven.get_bool("ADDCONAI");
|
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" };
|
const char* const conai_cod[CONAI_CLASSES] = { "CODACC", "CODALL", "CODCAR", "CODPLA", "CODLEG", "CODVET" };
|
||||||
TConfig c(CONFIG_DITTA, "ve");
|
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]));
|
conai_sp.add(c.get(conai_cod[i]));
|
||||||
|
|
||||||
esponi_esenti = c.get_bool("ESPONIESENTI");
|
esponi_esenti = c.get_bool("ESPONIESENTI");
|
||||||
@ -2799,7 +2804,7 @@ void TDocumento::update_conai()
|
|||||||
perc_esenz = ZERO;
|
perc_esenz = ZERO;
|
||||||
const bool cli_esente = (esponi_esenti) && (perc_esenz == CENTO);
|
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
|
qta = qta * (CENTO - perc_esenz) / CENTO; // More precise
|
||||||
if (qta > ZERO)
|
if (qta > ZERO)
|
||||||
{
|
{
|
||||||
@ -2827,18 +2832,17 @@ void TDocumento::update_conai()
|
|||||||
{
|
{
|
||||||
if (!updated[ct])
|
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);
|
real qta = calc_conai_qta(ct);
|
||||||
const bool cli_esente = (esponi_esenti) && (perc_esenz == CENTO);
|
if (!cli_esente && !qta.is_zero() && !perc_esenz.is_zero())
|
||||||
|
qta = qta * (CENTO - perc_esenz) / CENTO; // More precise
|
||||||
if (!cli_esente)
|
|
||||||
qta = qta * (CENTO - perc_esenz) / CENTO; // More precise
|
|
||||||
if (qta > ZERO)
|
if (qta > ZERO)
|
||||||
{
|
{
|
||||||
const TString& s = conai_sp.row(ct);
|
const TString& s = conai_sp.row(ct);
|
||||||
|
|
||||||
if (sp.read(s) != NOERR)
|
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);
|
conai_material(ct), (const char*)s);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user