Corretta stampa previsione incassi di rate bloccate in stampa scadenzario
git-svn-id: svn://10.65.10.50/branches/R_10_00@22997 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0b2bcfe6c9
commit
b21301a1ae
@ -1,27 +1,56 @@
|
||||
#include <colors.h>
|
||||
#include <mask.h>
|
||||
#include <relation.h>
|
||||
#include <recset.h>
|
||||
|
||||
#include "sc0100.h"
|
||||
#include "sc0100a.h"
|
||||
|
||||
#include <pconti.h>
|
||||
|
||||
HIDDEN bool gruppo_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
static bool ignore = FALSE;
|
||||
static bool ignore = false;
|
||||
if (key == K_TAB && f.focusdirty())
|
||||
{
|
||||
if (!ignore)
|
||||
{
|
||||
TMask_field& c = f.mask().field(F_CONTO);
|
||||
if (c.get().not_empty())
|
||||
TEdit_field& c = f.mask().efield(F_CONTO);
|
||||
if (!c.empty())
|
||||
{
|
||||
ignore = TRUE;
|
||||
ignore = true;
|
||||
c.set_dirty();
|
||||
c.on_key(K_TAB);
|
||||
ignore = FALSE;
|
||||
ignore = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
HIDDEN bool clifo_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_TAB && f.focusdirty() && !f.empty())
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const TString& tipocf = m.get(F_TIPO);
|
||||
TString8 key; key.format("%d|%d", m.get_int(F_GRUPPO), m.get_int(F_CONTO));
|
||||
const TString& tm = cache().get(LF_PCON, key, PCN_TMCF);
|
||||
if (tm != tipocf)
|
||||
{
|
||||
TString query; query << "USE PCON SELECT TMCF=\"" << tipocf << '"';
|
||||
TISAM_recordset pcon(query);
|
||||
if (pcon.move_first())
|
||||
{
|
||||
const TRectype& rec = pcon.cursor()->curr();
|
||||
m.set(F_GRUPPO, rec.get_int(PCN_GRUPPO));
|
||||
m.set(F_CONTO, rec.get_int(PCN_CONTO));
|
||||
}
|
||||
else
|
||||
return error_box(TR("Conto clienti/fornitori non valido"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -41,15 +70,13 @@ bool TSaldaconto_app::create()
|
||||
load_colors();
|
||||
|
||||
_msk = new TMask("sc0100a");
|
||||
_msk->set_handler(F_GRUPPO, gruppo_handler);
|
||||
_msk->set_handler(F_GRUPPO, gruppo_handler);
|
||||
_msk->set_handler(F_CLIENTE, clifo_handler);
|
||||
_msk->set_handler(F_FORNITORE, clifo_handler);
|
||||
|
||||
TConfig cnf(CONFIG_DITTA, "cg");
|
||||
const bool ges_sal = cnf.get_bool("GesSal");
|
||||
const bool ges_sal = ini_get_bool(CONFIG_DITTA, "cg", "GesSal");
|
||||
if (!ges_sal)
|
||||
{
|
||||
warning_box(FR("Attenzione: La ditta %ld non ha la\n"
|
||||
"la gestione del saldaconto attivata!"), get_firm());
|
||||
}
|
||||
warning_box(FR("Attenzione: La ditta %ld non ha gestione del saldaconto!"), get_firm());
|
||||
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ int main(int argc, char** argv)
|
||||
case 2: sc1300(argc,argv); break; // Allineamento partite
|
||||
case 3: sc1400(argc,argv); break; // Abbuoni automatici
|
||||
case 4: sc1500(argc,argv); break; // Controllo pagamenti doppi
|
||||
case 5: sc1600(argc,argv); break; // Controllo partite chiuse
|
||||
default: sc1100(argc,argv); break; // Archiviazione partite pareggiate
|
||||
}
|
||||
return 0;
|
||||
|
2
sc/sc1.h
2
sc/sc1.h
@ -3,4 +3,4 @@ int sc1200(int argc, char** argv);
|
||||
int sc1300(int argc, char** argv);
|
||||
int sc1400(int argc, char** argv);
|
||||
int sc1500(int argc, char** argv);
|
||||
|
||||
int sc1600(int argc, char** argv);
|
162
sc/sc2200.cpp
162
sc/sc2200.cpp
@ -75,6 +75,7 @@ class TStampaScadenzario : public TPrintapp
|
||||
TRecnotype _last_bank_rec; // ultimo record con banca stampato
|
||||
real _w_imp_pag, _w_imp_res; // Qui dentro memorizza i valori calcolati in calcola_pagamenti,
|
||||
// rispettivamente l'importo pagato e l'importo residuo, relativo alla rata.
|
||||
bool _w_imp_blocked; // rata bloccata!
|
||||
TAssoc_array _tm, _tp; // Dentro a codesti array vi sono i totali per la stampa prospetti:
|
||||
// durante l'elaborazione cerca la chiave relativa, aggiungendo o
|
||||
// aggiornando l'elemento se necessario; una volta pronto per stampare
|
||||
@ -290,32 +291,31 @@ void TStampaScadenzario::check_add_key_to_tl(tipo_pe p, int t)
|
||||
//Aggiorna xtotal (importi in scadenza, pagati, riba, rimesse e altri)
|
||||
xtotal._is += (_w_imp_pag + _w_imp_res);
|
||||
xtotal._ip += _w_imp_pag;
|
||||
switch (t)
|
||||
|
||||
if (!_w_imp_blocked)
|
||||
{
|
||||
case 1:
|
||||
xtotal._rd += _w_imp_res;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
xtotal._ri += _w_imp_res;
|
||||
break;
|
||||
case 9:
|
||||
xtotal._bo += _w_imp_res;
|
||||
break;
|
||||
default:
|
||||
xtotal._al += _w_imp_res;
|
||||
break;
|
||||
switch (t)
|
||||
{
|
||||
case 1: xtotal._rd += _w_imp_res; break;
|
||||
case 2:
|
||||
case 3: xtotal._ri += _w_imp_res; break;
|
||||
case 9: xtotal._bo += _w_imp_res; break;
|
||||
default: xtotal._al += _w_imp_res; break;
|
||||
}
|
||||
}
|
||||
xassoc.add(kl,xtotal,is_key);
|
||||
|
||||
xassoc.add(kl,xtotal,is_key);
|
||||
}
|
||||
|
||||
void TStampaScadenzario::check_add_key_to_tp(int t, char u)
|
||||
// Aggiorna i totali per i prospetti finali
|
||||
{
|
||||
TString k; // compone la chiave, valida per _tm e _tp
|
||||
{
|
||||
if (_w_imp_res.is_zero() || _w_imp_blocked)
|
||||
return;
|
||||
|
||||
TString16 k; // compone la chiave, valida per _tm e _tp
|
||||
k << t;
|
||||
if (u == '\0') u = ' '; // Per indicare che non c'e' ult class
|
||||
if (u < ' ') u = ' '; // Per indicare che non c'e' ult class
|
||||
k << u << _codval ;
|
||||
|
||||
if (_tm.is_key(k)) // Se esiste gia' in _tm allora
|
||||
@ -438,6 +438,7 @@ void TStampaScadenzario::look_in_cache(real& a, real& b, real& c,
|
||||
|
||||
void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata, TBill& bill)
|
||||
{
|
||||
_w_imp_blocked = false;
|
||||
if (!_p->esiste(riga, rata))
|
||||
{
|
||||
imp_scad = _w_imp_pag = _w_imp_res = ZERO;
|
||||
@ -528,49 +529,30 @@ void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata, T
|
||||
else
|
||||
unsins.remove(k); // Free some space when 0 reached
|
||||
}
|
||||
|
||||
|
||||
_w_imp_res = imp_scad - _w_imp_pag;
|
||||
|
||||
// Non mette in pagamento rate bloccate 11-09-2014
|
||||
_w_imp_blocked = _tipost == fornitori && rs.get_bool(SCAD_BLOCCATA);
|
||||
}
|
||||
|
||||
const char * TStampaScadenzario::tipi_tab(int tipo) const
|
||||
const char* TStampaScadenzario::tipi_tab(int tipo) const
|
||||
{
|
||||
switch (tipo)
|
||||
{
|
||||
case 0:
|
||||
return TR("Altro");
|
||||
break;
|
||||
case 1:
|
||||
return TR("Rimesse dirette");
|
||||
break;
|
||||
case 2:
|
||||
return TR("Tratte");
|
||||
break;
|
||||
case 3:
|
||||
return TR("Ricevute bancarie");
|
||||
break;
|
||||
case 4:
|
||||
return TR("Cessioni");
|
||||
break;
|
||||
case 5:
|
||||
return TR("Paghero'");
|
||||
break;
|
||||
case 6:
|
||||
return TR("Lettere di acc.");
|
||||
break;
|
||||
case 7:
|
||||
return TR("Tratte accettate");
|
||||
break;
|
||||
case 8:
|
||||
return TR("Rapp. interb. dir.");
|
||||
break;
|
||||
case 9:
|
||||
return TR("Bonifici");
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
break;
|
||||
|
||||
case 0: return TR("Altro");
|
||||
case 1: return TR("Rimesse dirette");
|
||||
case 2: return TR("Tratte");
|
||||
case 3: return TR("Ricevute bancarie");
|
||||
case 4: return TR("Cessioni");
|
||||
case 5: return TR("Pagherò");
|
||||
case 6: return TR("Lettere di acc.");
|
||||
case 7: return TR("Tratte accettate");
|
||||
case 8: return TR("Rapp. interb. dir.");
|
||||
case 9: return TR("Bonifici");
|
||||
default: break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
bool TStampaScadenzario::preprocess_page(int file, int counter)
|
||||
@ -660,28 +642,28 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
|
||||
_imp_pag = "";
|
||||
|
||||
const bool print_in_valuta = _stvaluta && is_true_value(_codval);
|
||||
|
||||
print_real(_imp_scad, imp_scad, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
const TString& divisa = print_in_valuta ? _codval : EMPTY_STRING;
|
||||
print_real(_imp_scad, imp_scad, divisa);
|
||||
|
||||
if (!_w_imp_pag.is_zero())
|
||||
print_real(_imp_pag, _w_imp_pag, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
print_real(_imp_pag, _w_imp_pag, divisa);
|
||||
|
||||
if (!_w_imp_res.is_zero())
|
||||
{
|
||||
switch (tipo_pag)
|
||||
{
|
||||
case 1: // Rimesse dirette
|
||||
print_real(_rimdir, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
print_real(_rimdir, _w_imp_res, divisa);
|
||||
break;
|
||||
case 2: // ri.ba / Tratte
|
||||
case 3:
|
||||
print_real(_riba, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
print_real(_riba, _w_imp_res, divisa);
|
||||
break;
|
||||
case 9: // Bonifici
|
||||
print_real(_bonifico, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
print_real(_bonifico, _w_imp_res, divisa);
|
||||
break;
|
||||
default: // Altri
|
||||
print_real(_altri, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
print_real(_altri, _w_imp_res, divisa);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -689,7 +671,7 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
|
||||
|
||||
if (file == LF_CLIFO)
|
||||
{
|
||||
TString80 xxx(current_cursor()->curr(LF_CLIFO).get(CLI_RAGSOC));
|
||||
TString80 xxx = current_cursor()->curr(LF_CLIFO).get(CLI_RAGSOC);
|
||||
*_ragsoc = xxx.strip_double_spaces();
|
||||
}
|
||||
if (file == LF_PCON)
|
||||
@ -748,9 +730,9 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
|
||||
}
|
||||
}
|
||||
// Tiene aggiornati tutti i totali mese/giorno/periodo (Totali lineari per valuta)
|
||||
check_add_key_to_tl(daily, tipo_pag);
|
||||
check_add_key_to_tl(daily, tipo_pag);
|
||||
check_add_key_to_tl(monthly, tipo_pag);
|
||||
check_add_key_to_tl(period, tipo_pag);
|
||||
check_add_key_to_tl(period, tipo_pag);
|
||||
if (_group_ban)
|
||||
check_add_key_to_tl(bank, tipo_pag); // totali per banca
|
||||
// Tiene aggiornati tutti i totali mese/periodo (Totali dei prospetti
|
||||
@ -1209,8 +1191,7 @@ void TStampaScadenzario::print_header()
|
||||
const TRectype & ditta = cache().get(LF_NDITTE, firm);
|
||||
|
||||
reset_header ();
|
||||
TString s;
|
||||
s = ditta.get(NDT_RAGSOC);
|
||||
const TString s = ditta.get(NDT_RAGSOC);
|
||||
TString data = _datas.string();
|
||||
TString datai = _datai.string();
|
||||
TString dataf = _dataf.string();
|
||||
@ -1223,7 +1204,7 @@ void TStampaScadenzario::print_header()
|
||||
const TString rw(201, '_');
|
||||
TString s1,s2;
|
||||
|
||||
set_header (soh++, "%6ld@9g%s@148gData@153g%s @190gPag. @#",
|
||||
set_header (soh++, "%5ld@7g%s@151gData stampa@171g%s@190gPag.@197g@#",
|
||||
firm, (const char *)s, (const char *)data);
|
||||
|
||||
if (_tipost==fornitori)
|
||||
@ -1234,7 +1215,7 @@ void TStampaScadenzario::print_header()
|
||||
else
|
||||
{
|
||||
set_header(soh++,FR("@56g** SCADENZARIO CLIENTI **"));
|
||||
s1 =""; s2 = "";
|
||||
s1 = s2 = "";
|
||||
}
|
||||
set_header (soh++,FR("@56gPeriodo dal %s al %s"),(const char*)datai,(const char*)dataf);
|
||||
|
||||
@ -1259,7 +1240,7 @@ void TStampaScadenzario::print_header()
|
||||
case altri: // Piano dei conti
|
||||
{
|
||||
TString rw(201);
|
||||
set_header (soh++, FR("%6ld@9g%s@152gData@157g%s @190gPag. @#"),
|
||||
set_header (soh++, FR("%5ld@7g%s@151gData stampa@171g%s@190gPag.@197g@#"),
|
||||
firm, (const char *)s, (const char *)data);
|
||||
set_header(soh++,FR("@61g** SCADENZARIO **"));
|
||||
set_header (soh++,FR("@61gPeriodo dal %s al %s"),(const char*)datai,(const char*)dataf);
|
||||
@ -1313,7 +1294,8 @@ void TStampaScadenzario::set_page_clifo(int nriga)
|
||||
set_row(nriga,"@148g#15t",&_riba); // Ri.ba. / tratte
|
||||
set_row(nriga,"@164g#15t",&_bonifico); // Bonifico
|
||||
set_row(nriga,"@180g#15t",&_altri); // Altri tipi di pagamento
|
||||
set_row(nriga,"@198g@1s",FLD(LF_SCADENZE,SCAD_BLOCCATA));
|
||||
//set_row(nriga,"@198g@1s",FLD(LF_SCADENZE,SCAD_BLOCCATA));
|
||||
set_row(nriga,"@197g%s", _w_imp_blocked ? "Si" : "");
|
||||
nriga++;
|
||||
set_row(nriga,"@28g#t",&_datadoc);
|
||||
set_row(nriga,"@38g#8t",&_numdoc);
|
||||
@ -1376,7 +1358,7 @@ void TStampaScadenzario::print_rows_riepilogo(int& nriga, bool type, TAssoc_arra
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
const TString& k = as.row(i);
|
||||
real& v = (real&)t[k];
|
||||
const real& v = (const real&)t[k];
|
||||
if (v.is_zero())
|
||||
continue;
|
||||
|
||||
@ -1388,13 +1370,14 @@ void TStampaScadenzario::print_rows_riepilogo(int& nriga, bool type, TAssoc_arra
|
||||
if (ult > ' ')
|
||||
{
|
||||
const char cod[3] = { tipo+'0', ult, '\0' };
|
||||
ult_class = cache().get("%CLR", cod).get("S0");
|
||||
ult_class = cache().get("%CLR", cod, "S0");
|
||||
ult_class.cut(27);
|
||||
}
|
||||
|
||||
const bool stampa_in_valuta = _stvaluta && val.full();
|
||||
const bool stampa_in_valuta = _stvaluta && is_true_value(val);
|
||||
const TString& divisa = stampa_in_valuta ? val : EMPTY_STRING;
|
||||
TString80 value;
|
||||
print_real(value, v, stampa_in_valuta ? val : "_FIRM");
|
||||
print_real(value, v, divisa);
|
||||
set_row(nriga++,"@0g! %s@25g! %s@55g! %s@61g!@64g%18s@82g!",
|
||||
tipi_tab(tipo), (const char*)ult_class, (const char*)val, (const char*)value);
|
||||
|
||||
@ -1419,7 +1402,7 @@ void TStampaScadenzario::print_riepilogo(int &nriga, bool type)
|
||||
|
||||
const TString s(83, '-');
|
||||
nriga++;
|
||||
set_row(nriga++,"%s",(const char *)s);
|
||||
set_row(nriga++, "%s", (const char*)s);
|
||||
if (!type)
|
||||
{
|
||||
if (_ordata)
|
||||
@ -1433,8 +1416,8 @@ void TStampaScadenzario::print_riepilogo(int &nriga, bool type)
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row(nriga,FR("!@5gTotali dal %s al "),_datai.string(brief));
|
||||
set_row(nriga++,"%s@82g!",_dataf.string(brief));
|
||||
set_row(nriga,FR("!@7gTotali periodo@28g%s"),_datai.string(brief));
|
||||
set_row(nriga++,"@38g%s@82g!",_dataf.string(brief));
|
||||
set_row(nriga++,"%s",(const char *)s);
|
||||
}
|
||||
print_rows_riepilogo(nriga, type, totali);
|
||||
@ -1447,11 +1430,12 @@ void TStampaScadenzario::print_riepilogo(int &nriga, bool type)
|
||||
{
|
||||
val = as.row(i);
|
||||
const bool stampa_in_valuta = _stvaluta && is_true_value(val);
|
||||
const TString& divisa = stampa_in_valuta ? val : EMPTY_STRING;
|
||||
|
||||
const real& tot = (real&)totali[val];
|
||||
print_real(value, tot, divisa);
|
||||
|
||||
print_real(value, tot, stampa_in_valuta ? val : EMPTY_STRING);
|
||||
|
||||
if (tot != ZERO)
|
||||
if (!tot.is_zero())
|
||||
{
|
||||
if (i == 0)
|
||||
set_row(nriga++,"%s",(const char *)s); // Se c'e' almeno un totale != 0 allora stampa il separe'
|
||||
@ -1563,7 +1547,7 @@ void TStampaScadenzario::print_totali(int &nriga, bool month_changed, bool ended
|
||||
set_row(nriga++,"");
|
||||
}
|
||||
set_row(nriga++,"");
|
||||
set_row(nriga,FR("@36g** TOTALI PERIODO"));
|
||||
set_row(nriga, TR("@36g** TOTALI PERIODO"));
|
||||
print_rows_totali(nriga, period);
|
||||
if (_striepilogo > 0)
|
||||
print_riepilogo(nriga,true);
|
||||
@ -1581,12 +1565,12 @@ void TStampaScadenzario::print_totali_c(int &nriga, bool ended)
|
||||
return;
|
||||
//In caso contrario continua l'avventura...
|
||||
if (_tipost==clienti) // per cliente
|
||||
set_row(nriga,FR("@56g** TOTALE CLIENTE"));
|
||||
set_row(nriga, TR("@56g** TOTALE CLIENTE"));
|
||||
else
|
||||
if (_tipost ==fornitori) // per fornitore
|
||||
set_row(nriga,FR("@56g** TOTALE FORNITORE"));
|
||||
set_row(nriga, TR("@56g** TOTALE FORNITORE"));
|
||||
else // per conto
|
||||
set_row(nriga,FR("@61g** TOTALE CONTO"));
|
||||
set_row(nriga, TR("@61g** TOTALE CONTO"));
|
||||
|
||||
print_rows_totali(nriga, single);
|
||||
if (_striepilogo > 0 )
|
||||
@ -1598,7 +1582,7 @@ void TStampaScadenzario::print_totali_c(int &nriga, bool ended)
|
||||
print_totali_bank(nriga);
|
||||
set_row(nriga++,"");set_row(nriga++,"");
|
||||
}
|
||||
set_row(nriga,FR("@56g** TOTALE GENERALE"));
|
||||
set_row(nriga, TR("@56g** TOTALE GENERALE"));
|
||||
print_rows_totali(nriga, period);
|
||||
if (_striepilogo > 0 )
|
||||
print_riepilogo(nriga,true);
|
||||
@ -1628,9 +1612,9 @@ void TStampaScadenzario::print_totali_bank(int &nriga)
|
||||
|
||||
nriga++;
|
||||
if (_ordata)
|
||||
set_row(nriga,FR("@36g** TOTALI BANCA"));
|
||||
set_row(nriga, TR("@36g** TOTALI BANCA"));
|
||||
else
|
||||
set_row(nriga,FR("@70g** TOTALE BANCA"));
|
||||
set_row(nriga, TR("@70g** TOTALE BANCA"));
|
||||
print_rows_totali(nriga, bank);
|
||||
_totbank_printed = true;
|
||||
}
|
||||
@ -1655,7 +1639,7 @@ void TStampaScadenzario::print_intestazione_banca(int &nriga)
|
||||
_desc_ban << " - " << cache().get("%BAN", _last_ban, "S0");
|
||||
}
|
||||
else
|
||||
_desc_ban = FR("NON INDICATA");
|
||||
_desc_ban = TR("NON INDICATA");
|
||||
_last_bank_rec = current_cursor()->pos();
|
||||
print_bank = true;
|
||||
}
|
||||
@ -1685,6 +1669,6 @@ TStampaScadenzario::TStampaScadenzario()
|
||||
int sc2200(int argc, char** argv)
|
||||
{
|
||||
TStampaScadenzario app;
|
||||
app.run(argc, argv, FR("Stampa Scadenzario"));
|
||||
app.run(argc, argv, TR("Stampa Scadenzario"));
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,4 +23,5 @@ Item_02 = "Creazione saldaconto da saldi", "sc1 -1", ""
|
||||
Item_03 = "Allineamento Partite", "sc1 -2", "F"
|
||||
Item_04 = "Abbuoni automatici", "sc1 -3", "F"
|
||||
Item_05 = "Controllo pagamenti doppi", "sc1 -4", "F"
|
||||
Item_06 = "Controllo partite chiuse", "sc1 -5", "F"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user