Patch level : 10.0 888

Files correlati     : sc2.exe
Ricompilazione Demo : [ ]
Commento            :

Riassunto	0001749: Stampa E/C : se nota di credito non viene considerata nella colonna scaduto


git-svn-id: svn://10.65.10.50/branches/R_10_00@21471 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-01-18 17:02:43 +00:00
parent 5e1447908f
commit e8205abb6e
2 changed files with 37 additions and 30 deletions

View File

@ -722,25 +722,32 @@ void TEC_array::add_row(const TRiga_partite& row)
} }
void TEC_array::arrange_scaduto(const TPartita& game) void TEC_array::arrange_scaduto(const TPartita& game)
{ {
const bool in_valuta = form().in_valuta() && row(0).in_valuta(); const bool in_valuta = form().in_valuta() && row(0).in_valuta();
TImporto totpag(game.importo_pagato_unassigned(in_valuta));
const char sezione = game.conto().tipo() == 'C' ? 'A' : 'D'; const char sezione = game.conto().tipo() == 'C' ? 'A' : 'D';
TImporto totpag(game.importo_pagato_unassigned(in_valuta));
totpag.normalize(sezione); totpag.normalize(sezione);
int r;
for (r = items()-1; r >= 0; r--) for (int r = items()-1; r >= 0; r--)
{ {
TEC_row& s = row(r); TEC_row& s = row(r);
real imp(s.scaduto()); const real val_scaduto = s.scaduto();
if (imp.sign() < 0) if (!val_scaduto.is_zero())
{ {
totpag += TImporto(sezione, -imp); TImporto imp_scadenza = s.importo();
imp_scadenza.normalize(sezione == 'A' ? 'D' : 'A'); // Sezione opposta ai pagamenti!
const int segno_scadenza = imp_scadenza.valore().sign();
const int segno_scaduto = val_scaduto.sign();
if (segno_scaduto * segno_scadenza < 0)
{
totpag += TImporto(sezione, -val_scaduto);
s.scaduto(ZERO); s.scaduto(ZERO);
} }
} }
for (r = 0; r < items() && totpag.valore() > ZERO; r++) }
for (int r = 0; r < items() && totpag.valore() > ZERO; r++)
{ {
TEC_row& s = row(r); TEC_row& s = row(r);
real imp = s.scaduto(); real imp = s.scaduto();

View File

@ -141,7 +141,7 @@ inline TStampaScaduto& app() {return (TStampaScaduto&)main_app();}
HIDDEN void print_real(TString& dest, const real& num, const char* val) HIDDEN void print_real(TString& dest, const real& num, const char* val)
{ {
const TCurrency cur(num, val); const TCurrency cur(num, val);
dest = cur.string(TRUE); dest = cur.string(true);
dest.right_just(18); dest.right_just(18);
} }
@ -400,7 +400,7 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
const bool checked = _m->selected(bill); const bool checked = _m->selected(bill);
if (!checked && !_end_printed) // Se non e' stato selezionato salta al prossimo record if (!checked && !_end_printed) // Se non e' stato selezionato salta al prossimo record
return FALSE; return false;
int nriga = 1; int nriga = 1;
if (_tipost == clienti || _tipost == fornitori) if (_tipost == clienti || _tipost == fornitori)
@ -435,21 +435,21 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
set_row(nriga,TR("TOTALE GENERALE")); set_row(nriga,TR("TOTALE GENERALE"));
print_totali_rows(nriga,1); print_totali_rows(nriga,1);
} }
return TRUE; // Go back, print and exit! return true; // Go back, print and exit!
} }
} }
_cod_pre = _cod; _cod_pre = _cod;
_pending_clifo = TRUE; _pending_clifo = true;
} }
if (curr.empty()) // Attenzione: Possono succedere anche queste cose! if (curr.empty()) // Attenzione: Possono succedere anche queste cose!
return FALSE; return false;
TPartita p(curr); TPartita p(curr);
//Pesca gli estremi dalla prima riga di fattura, che non e' necessariamente la riga #1 //Pesca gli estremi dalla prima riga di fattura, che non e' necessariamente la riga #1
const int r = p.prima_fattura(); const int r = p.prima_fattura();
if (r <= 0) if (r <= 0)
return TRUE; // se non ci sono fatture ... salta al prossimo return true; // se non ci sono fatture ... salta al prossimo
_residuo = ""; _residuo = "";
_nonscad = ""; _nonscad = "";
@ -491,18 +491,18 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
set_page_clifoco(nriga); // Setta le righe per stampare le informazioni del cli/fo/conto set_page_clifoco(nriga); // Setta le righe per stampare le informazioni del cli/fo/conto
set_row(++nriga,""); set_row(++nriga,"");
nriga++; nriga++;
_pending_clifo = FALSE; _pending_clifo = false;
} }
set_page_part(nriga); set_page_part(nriga);
} }
} }
} }
return TRUE; return true;
} }
bool TStampaScaduto::preprocess_print(int file, int counter) bool TStampaScaduto::preprocess_print(int file, int counter)
{ {
return TRUE; return true;
} }
print_action TStampaScaduto::postprocess_print(int file, int counter) print_action TStampaScaduto::postprocess_print(int file, int counter)
@ -512,7 +512,7 @@ print_action TStampaScaduto::postprocess_print(int file, int counter)
if ((file == LF_PARTITE)) if ((file == LF_PARTITE))
{ {
rt = REPEAT_PAGE; rt = REPEAT_PAGE;
_end_printed = TRUE; _end_printed = true;
} }
return rt; return rt;
} }
@ -554,7 +554,7 @@ bool TStampaScaduto::user_create()
_m->enable(F_VALUTA,conf.get_bool("GesVal")); _m->enable(F_VALUTA,conf.get_bool("GesVal"));
enable_print_menu(); enable_print_menu();
return TRUE; return true;
} }
bool TStampaScaduto::user_destroy() bool TStampaScaduto::user_destroy()
@ -564,7 +564,7 @@ bool TStampaScaduto::user_destroy()
if (_m) delete _m; if (_m) delete _m;
_t.destroy(); _t.destroy();
_s_date.destroy(); _s_date.destroy();
return TRUE; return true;
} }
bool TStampaScaduto::set_print(int) bool TStampaScaduto::set_print(int)
@ -584,9 +584,9 @@ bool TStampaScaduto::set_print(int)
if (_m->get_who() == 'C') _tipost = clienti; if (_m->get_who() == 'C') _tipost = clienti;
else _tipost = fornitori; else _tipost = fornitori;
} }
if (_m->get_key() == 1) _ordcod = TRUE; if (_m->get_key() == 1) _ordcod = true;
else _ordcod = FALSE; else _ordcod = false;
_end_printed = _pending_clifo = FALSE; _end_printed = _pending_clifo = false;
_gcr = _m->get_int(F_GIORNI); _gcr = _m->get_int(F_GIORNI);
_stvaluta = _m->get_bool(F_VALUTA); _stvaluta = _m->get_bool(F_VALUTA);
_datas = (const char *)(_m->get(F_DATASTAMPA)); _datas = (const char *)(_m->get(F_DATASTAMPA));
@ -603,10 +603,10 @@ bool TStampaScaduto::set_print(int)
aa.destroy(); // Totali lineari (singolo e generale) aa.destroy(); // Totali lineari (singolo e generale)
} }
get_cursor(_cur1)->set_filterfunction(fil_function,TRUE); get_cursor(_cur1)->set_filterfunction(fil_function,true);
get_cursor(_cur2)->set_filterfunction(fil_function,TRUE); get_cursor(_cur2)->set_filterfunction(fil_function,true);
get_cursor(_cur3)->set_filterfunction(fil_function,TRUE); get_cursor(_cur3)->set_filterfunction(fil_function,true);
get_cursor(_cur4)->set_filterfunction(fil_function,TRUE); get_cursor(_cur4)->set_filterfunction(fil_function,true);
_last_game.cut(0); _last_game.cut(0);
TRectype filter_from(LF_PARTITE), filter_to(LF_PARTITE); TRectype filter_from(LF_PARTITE), filter_to(LF_PARTITE);