From e8205abb6e6340884480af47110632461f1ce4a0 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 18 Jan 2011 17:02:43 +0000 Subject: [PATCH] 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 --- sc/sc2100.cpp | 29 ++++++++++++++++++----------- sc/sc2300.cpp | 38 +++++++++++++++++++------------------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/sc/sc2100.cpp b/sc/sc2100.cpp index 8fa2be8f5..b4772c192 100755 --- a/sc/sc2100.cpp +++ b/sc/sc2100.cpp @@ -722,25 +722,32 @@ void TEC_array::add_row(const TRiga_partite& row) } void TEC_array::arrange_scaduto(const TPartita& game) - { 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'; - + + TImporto totpag(game.importo_pagato_unassigned(in_valuta)); 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); - real imp(s.scaduto()); - if (imp.sign() < 0) - { - totpag += TImporto(sezione, -imp); - s.scaduto(ZERO); + const real val_scaduto = s.scaduto(); + if (!val_scaduto.is_zero()) + { + 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); + } } } - for (r = 0; r < items() && totpag.valore() > ZERO; r++) + + for (int r = 0; r < items() && totpag.valore() > ZERO; r++) { TEC_row& s = row(r); real imp = s.scaduto(); diff --git a/sc/sc2300.cpp b/sc/sc2300.cpp index 3b59dfa2c..4adc9ad2b 100755 --- a/sc/sc2300.cpp +++ b/sc/sc2300.cpp @@ -141,7 +141,7 @@ inline TStampaScaduto& app() {return (TStampaScaduto&)main_app();} HIDDEN void print_real(TString& dest, const real& num, const char* val) { const TCurrency cur(num, val); - dest = cur.string(TRUE); + dest = cur.string(true); dest.right_just(18); } @@ -400,7 +400,7 @@ bool TStampaScaduto::preprocess_page(int file, int counter) const bool checked = _m->selected(bill); if (!checked && !_end_printed) // Se non e' stato selezionato salta al prossimo record - return FALSE; + return false; int nriga = 1; if (_tipost == clienti || _tipost == fornitori) @@ -435,21 +435,21 @@ bool TStampaScaduto::preprocess_page(int file, int counter) set_row(nriga,TR("TOTALE GENERALE")); print_totali_rows(nriga,1); } - return TRUE; // Go back, print and exit! + return true; // Go back, print and exit! } } _cod_pre = _cod; - _pending_clifo = TRUE; + _pending_clifo = true; } if (curr.empty()) // Attenzione: Possono succedere anche queste cose! - return FALSE; + return false; TPartita p(curr); //Pesca gli estremi dalla prima riga di fattura, che non e' necessariamente la riga #1 const int r = p.prima_fattura(); if (r <= 0) - return TRUE; // se non ci sono fatture ... salta al prossimo + return true; // se non ci sono fatture ... salta al prossimo _residuo = ""; _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_row(++nriga,""); nriga++; - _pending_clifo = FALSE; + _pending_clifo = false; } set_page_part(nriga); } } } - return TRUE; + return true; } bool TStampaScaduto::preprocess_print(int file, int counter) { - return TRUE; + return true; } 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)) { rt = REPEAT_PAGE; - _end_printed = TRUE; + _end_printed = true; } return rt; } @@ -554,7 +554,7 @@ bool TStampaScaduto::user_create() _m->enable(F_VALUTA,conf.get_bool("GesVal")); enable_print_menu(); - return TRUE; + return true; } bool TStampaScaduto::user_destroy() @@ -564,7 +564,7 @@ bool TStampaScaduto::user_destroy() if (_m) delete _m; _t.destroy(); _s_date.destroy(); - return TRUE; + return true; } bool TStampaScaduto::set_print(int) @@ -584,9 +584,9 @@ bool TStampaScaduto::set_print(int) if (_m->get_who() == 'C') _tipost = clienti; else _tipost = fornitori; } - if (_m->get_key() == 1) _ordcod = TRUE; - else _ordcod = FALSE; - _end_printed = _pending_clifo = FALSE; + if (_m->get_key() == 1) _ordcod = true; + else _ordcod = false; + _end_printed = _pending_clifo = false; _gcr = _m->get_int(F_GIORNI); _stvaluta = _m->get_bool(F_VALUTA); _datas = (const char *)(_m->get(F_DATASTAMPA)); @@ -603,10 +603,10 @@ bool TStampaScaduto::set_print(int) aa.destroy(); // Totali lineari (singolo e generale) } - get_cursor(_cur1)->set_filterfunction(fil_function,TRUE); - get_cursor(_cur2)->set_filterfunction(fil_function,TRUE); - get_cursor(_cur3)->set_filterfunction(fil_function,TRUE); - get_cursor(_cur4)->set_filterfunction(fil_function,TRUE); + get_cursor(_cur1)->set_filterfunction(fil_function,true); + get_cursor(_cur2)->set_filterfunction(fil_function,true); + get_cursor(_cur3)->set_filterfunction(fil_function,true); + get_cursor(_cur4)->set_filterfunction(fil_function,true); _last_game.cut(0); TRectype filter_from(LF_PARTITE), filter_to(LF_PARTITE);