Gestione valuta e ritenute nel saldaconto

git-svn-id: svn://10.65.10.50/trunk@2200 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-11-23 14:20:03 +00:00
parent 2099aa791d
commit 13913bf186
15 changed files with 429 additions and 261 deletions

View File

@ -23,10 +23,23 @@ TPrimanota_application::TPrimanota_application()
TMask* TPrimanota_application::load_mask(int n) TMask* TPrimanota_application::load_mask(int n)
{ {
if (n == 2 && _msk[0] != NULL) int max_pages = 2; // Numero massimo di pagine della maschera
if (n == 2)
{ {
delete _msk[0]; if (is_fattura())
_msk[0] = NULL; max_pages = 3;
if (_msk[2] != NULL)
{
// Controlla se esiste pagina 3
const int pages = (_msk[2]->id2pos(FS_RATESHEET) > 0) ? 3 : 2;
// Se i numeri di pagine non coincidono distruggi la maschera
if (pages != max_pages)
{
delete _msk[2];
_msk[2] = NULL;
}
}
} }
if (_msk[n] != NULL) if (_msk[n] != NULL)
@ -34,7 +47,7 @@ TMask* TPrimanota_application::load_mask(int n)
if (n == 1 || n == 2) if (n == 1 || n == 2)
{ {
for (int i = 3; i > 0; i--) for (int i = 3; i >= 0; i--)
{ {
if (_msk[i] != NULL) if (_msk[i] != NULL)
{ {
@ -45,7 +58,7 @@ TMask* TPrimanota_application::load_mask(int n)
} }
TFilename name("cg2100"); name << char(n == 3 ? 'o' : 'a'+n); TFilename name("cg2100"); name << char(n == 3 ? 'o' : 'a'+n);
TMask* m = new TMask(name); TMask* m = new TMask(name, 0, max_pages);
switch (n) switch (n)
{ {
@ -85,7 +98,7 @@ TMask* TPrimanota_application::load_mask(int n)
m->set_handler(F_SOLAIVA, solaiva_handler); m->set_handler(F_SOLAIVA, solaiva_handler);
m->set_handler(F_SHEETIVA, iva_handler); m->set_handler(F_SHEETIVA, iva_handler);
m->set_handler(F_CODPAG, codpag_handler); m->set_handler(F_CODPAG, codpag_handler);
m->set_handler(S_CAMBIO, cambio_handler); m->set_handler(SK_CAMBIO, cambio_handler);
TSheet_field& is = (TSheet_field&)m->field(F_SHEETIVA); TSheet_field& is = (TSheet_field&)m->field(F_SHEETIVA);
is.set_notify(iva_notify); is.set_notify(iva_notify);
@ -98,17 +111,20 @@ TMask* TPrimanota_application::load_mask(int n)
ism.set_handler(209, sheet_clifo_handler); ism.set_handler(209, sheet_clifo_handler);
ism.set_handler(309, sheet_clifo_handler); ism.set_handler(309, sheet_clifo_handler);
// add saldaconto // Se esiste lo sheet delle rate
if (is_fattura())
{
TSheet_field& ps = (TSheet_field&)m->field(FS_RATESHEET); TSheet_field& ps = (TSheet_field&)m->field(FS_RATESHEET);
ps.set_notify(pag_notify); ps.set_notify(pag_notify);
m->set_handler(F_NUMRIF, numrif_handler);
m->set_handler(FS_RATESHEET, pag_sheet_handler); m->set_handler(FS_RATESHEET, pag_sheet_handler);
m->set_handler(F_NUMRIF, numrif_handler);
m->set_handler(FS_RESET, reset_handler); m->set_handler(FS_RESET, reset_handler);
m->set_handler(FS_NRATE, nrate_handler); m->set_handler(FS_NRATE, nrate_handler);
m->set_handler(FS_RECALC, recalc_handler); m->set_handler(FS_RECALC, recalc_handler);
m->set_handler(FS_NSCAB, codcab_handler); m->set_handler(FS_NSCAB, codcab_handler);
m->set_handler(FS_VSCAB, codcab_handler); m->set_handler(FS_VSCAB, codcab_handler);
} }
}
case 1: case 1:
if (m) if (m)
{ {
@ -118,7 +134,7 @@ TMask* TPrimanota_application::load_mask(int n)
m->set_handler(F_DESCR, descr_handler); m->set_handler(F_DESCR, descr_handler);
m->set_handler(F_CODCAUS, caus_modify_handler); m->set_handler(F_CODCAUS, caus_modify_handler);
m->set_handler(F_TOTALE, totdoc_handler); m->set_handler(F_TOTALE, totdoc_handler);
m->set_handler(S_TOTDOCVAL, totdocval_handler); m->set_handler(SK_TOTDOCVAL, totdocval_handler);
m->set_handler(F_SHEETCG, cg_handler); m->set_handler(F_SHEETCG, cg_handler);
TSheet_field& cg = (TSheet_field&)m->field(F_SHEETCG); TSheet_field& cg = (TSheet_field&)m->field(F_SHEETCG);
@ -227,14 +243,17 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
} }
TMask* m = _msk[iva == nessuna_iva ? 1 : 2]; TMask* m = _msk[iva == nessuna_iva ? 1 : 2];
if (m == NULL) return TRUE;
// Se sono chiamato dai campi di query ho belle che finito
if (_mode == MODE_QUERY || m == NULL)
return TRUE;
const bool ins = m->insert_mode(); const bool ins = m->insert_mode();
m->efield(F_NUMDOC).check_type(nob ? CHECK_REQUIRED : CHECK_NORMAL); // Num. doc. obbligatorio m->efield(F_NUMDOC).check_type(nob ? CHECK_REQUIRED : CHECK_NORMAL); // Num. doc. obbligatorio
m->efield(F_DATADOC).check_type(dob ? CHECK_REQUIRED : CHECK_NORMAL); // Data doc. obbligatoria m->efield(F_DATADOC).check_type(dob ? CHECK_REQUIRED : CHECK_NORMAL); // Data doc. obbligatoria
const bool nota_credito = _is_saldaconto && causale().tipomov() == 2; const bool nota_credito = is_nota_credito();
const bool show_games = is_pagamento() || nota_credito; const bool show_games = is_pagamento() || nota_credito;
TMask& cgm = cgs().sheet_mask(); TMask& cgm = cgs().sheet_mask();
cgm.set_handler(100, show_games ? showpartite_handler : NULL); // bottoncino riga cgm.set_handler(100, show_games ? showpartite_handler : NULL); // bottoncino riga
@ -242,14 +261,13 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
if (iva == nessuna_iva) if (iva == nessuna_iva)
{ {
m->enable(F_PROVVISORIO, !_is_saldaconto); // Il saldaconto vieta i movimenti provvisori m->enable(F_PROVVISORIO, !_is_saldaconto); // Il saldaconto vieta i movimenti provvisori
m->show(S_TIPORIGA, is_pagamento()); m->show(SK_TIPORIGA, is_pagamento());
} }
else else
{ {
m->efield(F_CODPAG).check_type(_is_saldaconto ? CHECK_REQUIRED : CHECK_NORMAL); m->efield(F_CODPAG).check_type(_is_saldaconto ? CHECK_REQUIRED : CHECK_NORMAL);
m->efield(F_CODPAG).enable(!nota_credito); m->efield(F_CODPAG).enable(!nota_credito);
m->enable_page(2, _is_saldaconto && !nota_credito);
m->show(F_ANNORIF, _is_saldaconto); // Mostra/nasconde anno e riferimento partita m->show(F_ANNORIF, _is_saldaconto); // Mostra/nasconde anno e riferimento partita
m->show(F_NUMRIF, _is_saldaconto); m->show(F_NUMRIF, _is_saldaconto);
@ -390,10 +408,11 @@ TMask* TPrimanota_application::get_mask(int mode)
if (giornale().year() != annoes) if (giornale().year() != annoes)
giornale().read(annoes); giornale().read(annoes);
if (caus != causale().codice() || causale().reg().year() != annoiva) const TCausale& c = causale();
causale().read(caus, annoiva); if (caus != c.codice() || (c.iva() != nessuna_iva && c.reg().year() != annoiva))
_iva = causale().iva(); read_caus(caus, annoiva);
_iva = c.iva();
return load_mask(_iva == nessuna_iva ? 1 : 2); return load_mask(_iva == nessuna_iva ? 1 : 2);
} }
@ -457,6 +476,8 @@ void TPrimanota_application::init_mask(TMask& m)
m.show(F_CODIVA, m.mode() == MODE_INS); // Codice IVA standard m.show(F_CODIVA, m.mode() == MODE_INS); // Codice IVA standard
if (pagamento() != NULL)
{
const TPartita* game = partite().first(); const TPartita* game = partite().first();
const bool scad_free = game == NULL || !game->esistono_abbuoni_diffcam(m.get_long(F_NUMREG)); const bool scad_free = game == NULL || !game->esistono_abbuoni_diffcam(m.get_long(F_NUMREG));
@ -469,6 +490,7 @@ void TPrimanota_application::init_mask(TMask& m)
if (!scad_free) m.set(FS_RECALC, "", TRUE); if (!scad_free) m.set(FS_RECALC, "", TRUE);
m.enable(FS_RECALC, scad_free); // Disabilita ricalcolo automatico m.enable(FS_RECALC, scad_free); // Disabilita ricalcolo automatico
} }
}
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3) // Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3)
const bool valuta = _ges_val && is_saldaconto() && causale().valuta(); const bool valuta = _ges_val && is_saldaconto() && causale().valuta();
@ -546,10 +568,13 @@ void TPrimanota_application::init_insert_mode(TMask& m)
{ {
occas_mask().reset(); occas_mask().reset();
if (is_fattura())
{
const TString16 dt(m.get(F_DATAREG)); const TString16 dt(m.get(F_DATAREG));
set_pagamento(NULL,dt); set_pagamento(NULL,dt);
set_scadenze(m); set_scadenze(m);
} }
}
else else
partite().destroy(); partite().destroy();
@ -956,6 +981,8 @@ bool TPrimanota_application::remove()
{ {
if (iva() == nessuna_iva) if (iva() == nessuna_iva)
{ {
const long nreg = curr_mask().get_long(F_NUMREG);
partite().add_numreg(nreg);
notify_cgline_deletion(-1); // Notify deletion of all cg lines notify_cgline_deletion(-1); // Notify deletion of all cg lines
partite().rewrite(); partite().rewrite();
} }

View File

@ -102,11 +102,11 @@
#define I_SOTTOCONTO4 234 #define I_SOTTOCONTO4 234
// Saldaconto // Saldaconto
#define S_TOTDOCVAL 301 #define SK_TOTDOCVAL 301
#define S_VALUTA 302 #define SK_VALUTA 302
#define S_DATACAMBIO 303 #define SK_DATACAMBIO 303
#define S_CAMBIO 304 #define SK_CAMBIO 304
#define S_TIPORIGA 305 #define SK_TIPORIGA 305
// copie 2a pag. // copie 2a pag.
#define K_CODDITTA 401 #define K_CODDITTA 401

View File

@ -179,7 +179,7 @@ BEGIN
GROUP 5 GROUP 5
END END
STRING S_VALUTA 3 STRING SK_VALUTA 3
BEGIN BEGIN
PROMPT 2 11 "Valuta " PROMPT 2 11 "Valuta "
HELP "Codice della valuta per movimento" HELP "Codice della valuta per movimento"
@ -187,42 +187,42 @@ BEGIN
FLAGS "UZ" FLAGS "UZ"
GROUP 3 5 GROUP 3 5
USE %VAL USE %VAL
INPUT CODTAB S_VALUTA INPUT CODTAB SK_VALUTA
DISPLAY "Codice" CODTAB DISPLAY "Codice" CODTAB
DISPLAY "Nome@50" S0 DISPLAY "Nome@50" S0
OUTPUT S_VALUTA CODTAB OUTPUT SK_VALUTA CODTAB
CHECKTYPE NORMAL CHECKTYPE NORMAL
MESSAGE EMPTY CLEAR,S_CAMBIO|CLEAR,S_TOTDOCVAL MESSAGE EMPTY CLEAR,SK_CAMBIO|CLEAR,SK_TOTDOCVAL
MESSAGE ENABLE,S_CAMBIO|ENABLE,S_TOTDOCVAL MESSAGE ENABLE,SK_CAMBIO|ENABLE,SK_TOTDOCVAL
END END
DATE S_DATACAMBIO DATE SK_DATACAMBIO
BEGIN BEGIN
PROMPT 22 11 "Data cambio " PROMPT 22 11 "Data cambio "
FIELD DATACAM FIELD DATACAM
FLAGS "R" FLAGS "R"
USE CAM USE CAM
INPUT CODTAB[1,3] S_VALUTA INPUT CODTAB[1,3] SK_VALUTA SELECT
INPUT CODTAB[4,11] S_DATACAMBIO INPUT CODTAB[4,11] SK_DATACAMBIO
DISPLAY "Valuta" CODTAB[1,3] DISPLAY "Valuta" CODTAB[1,3]
DISPLAY "Data@10" D0 DISPLAY "Data@10" D0
DISPLAY "Cambio@18" R10 DISPLAY "Cambio@18" R10
OUTPUT S_VALUTA CODTAB[1,3] OUTPUT SK_VALUTA CODTAB[1,3]
OUTPUT S_DATACAMBIO D0 OUTPUT SK_DATACAMBIO D0
OUTPUT S_CAMBIO R10 OUTPUT SK_CAMBIO R10
GROUP 3 5 GROUP 3 5
CHECKTYPE NORMAL CHECKTYPE NORMAL
END END
NUMBER S_CAMBIO 15 5 NUMBER SK_CAMBIO 15 5
BEGIN BEGIN
PROMPT 54 11 "Cambio " PROMPT 54 11 "Cambio "
HELP "Cambio della valuta"
FIELD CAMBIO FIELD CAMBIO
FLAGS "RU" FLAGS "RU"
GROUP 3 5 GROUP 3 5
PICTURE ".5" PICTURE ".5"
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
WARNING "E' stata specificata una valuta senza il cambio relativo"
END END
NUMBER F_TOTALE 15 NUMBER F_TOTALE 15
@ -231,11 +231,11 @@ BEGIN
PICTURE "." PICTURE "."
GROUP 5 GROUP 5
FIELD TOTDOC FIELD TOTDOC
VALIDATE REQIF_FUNC 1 S_TOTDOCVAL VALIDATE REQIF_FUNC 1 SK_TOTDOCVAL
MESSAGE COPY,K_TOTALE MESSAGE COPY,K_TOTALE
END END
NUMBER S_TOTDOCVAL 15 2 NUMBER SK_TOTDOCVAL 15 2
BEGIN BEGIN
PROMPT 44 12 "Totale in valuta " PROMPT 44 12 "Totale in valuta "
HELP "" HELP ""
@ -336,7 +336,7 @@ BEGIN
GROUP 5 GROUP 5
END END
LIST S_TIPORIGA 1 13 LIST SK_TIPORIGA 1 13
BEGIN BEGIN
PROMPT 60 7 "Riga " PROMPT 60 7 "Riga "
ITEM "K|Saldaconto" ITEM "K|Saldaconto"

View File

@ -392,43 +392,42 @@ BEGIN
FLAGS "H" FLAGS "H"
END END
STRING S_VALUTA 3 STRING SK_VALUTA 3
BEGIN BEGIN
PROMPT 1 12 "Valuta " PROMPT 1 12 "Valuta "
FIELD CODVAL FIELD CODVAL
FLAGS "UZ" FLAGS "UZ"
GROUP 3 GROUP 3
USE %VAL USE %VAL
INPUT CODTAB S_VALUTA INPUT CODTAB SK_VALUTA
DISPLAY "Codice" CODTAB DISPLAY "Codice" CODTAB
DISPLAY "Nome@50" S0 DISPLAY "Nome@50" S0
OUTPUT S_VALUTA CODTAB OUTPUT SK_VALUTA CODTAB
CHECKTYPE NORMAL CHECKTYPE NORMAL
WARNING "Codice valuta assente" WARNING "Codice valuta assente"
MESSAGE EMPTY CLEAR,S_CAMBIO|CLEAR,S_TOTDOCVAL|RESET,FS_VALUTA MESSAGE EMPTY CLEAR,SK_CAMBIO|CLEAR,SK_TOTDOCVAL
MESSAGE ENABLE,S_CAMBIO|ENABLE,S_TOTDOCVAL|COPY,FS_VALUTA MESSAGE ENABLE,SK_CAMBIO|ENABLE,SK_TOTDOCVAL
END END
DATE S_DATACAMBIO DATE SK_DATACAMBIO
BEGIN BEGIN
PROMPT 28 12 "Data cambio " PROMPT 28 12 "Data cambio "
FIELD DATACAM FIELD DATACAM
FLAGS "R" FLAGS "R"
USE CAM USE CAM
INPUT CODTAB[1,3] S_VALUTA SELECT INPUT CODTAB[1,3] SK_VALUTA SELECT
INPUT CODTAB[4,11] S_DATACAMBIO INPUT CODTAB[4,11] SK_DATACAMBIO
DISPLAY "Valuta" CODTAB[1,3] DISPLAY "Valuta" CODTAB[1,3]
DISPLAY "Data@10" D0 DISPLAY "Data@10" D0
DISPLAY "Cambio@18" R10 DISPLAY "Cambio@18" R10
OUTPUT S_VALUTA CODTAB[1,3] OUTPUT SK_VALUTA CODTAB[1,3]
OUTPUT S_DATACAMBIO D0 OUTPUT SK_DATACAMBIO D0
OUTPUT S_CAMBIO R10 OUTPUT SK_CAMBIO R10
GROUP 3 GROUP 3
CHECKTYPE NORMAL CHECKTYPE NORMAL
MESSAGE COPY,FS_DATACAMBIO
END END
NUMBER S_CAMBIO 15 5 NUMBER SK_CAMBIO 15 5
BEGIN BEGIN
PROMPT 55 12 "Cambio " PROMPT 55 12 "Cambio "
FIELD CAMBIO FIELD CAMBIO
@ -436,7 +435,6 @@ BEGIN
GROUP 3 GROUP 3
PICTURE ".5" PICTURE ".5"
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
MESSAGE COPY,FS_CAMBIO
END END
NUMBER F_TOTALE 15 NUMBER F_TOTALE 15
@ -446,7 +444,7 @@ BEGIN
PICTURE "." PICTURE "."
END END
NUMBER S_TOTDOCVAL 15 2 NUMBER SK_TOTDOCVAL 15 2
BEGIN BEGIN
PROMPT 35 13 "Tot. in valuta " PROMPT 35 13 "Tot. in valuta "
FIELD TOTDOCVAL FIELD TOTDOCVAL
@ -613,17 +611,15 @@ END
NUMBER F_IMPONIBILI 15 NUMBER F_IMPONIBILI 15
BEGIN BEGIN
PROMPT 1 11 "Totale imponibili " PROMPT 1 11 "Totale imponibili "
FLAGS "DGV" FLAGS "DV"
PICTURE "." PICTURE "."
MESSAGE COPY,FS_IMPONIBILI
END END
NUMBER F_IMPOSTE 15 NUMBER F_IMPOSTE 15
BEGIN BEGIN
PROMPT 41 11 "Totale imposte " PROMPT 41 11 "Totale imposte "
FLAGS "DGV" FLAGS "DV"
PICTURE "." PICTURE "."
MESSAGE COPY,FS_IMPOSTE
END END
SPREADSHEET F_SHEETCG SPREADSHEET F_SHEETCG

View File

@ -1,3 +1,6 @@
#ifndef __CG2100P_H
#define __CG2100P_H
#define P_TIPOC 101 #define P_TIPOC 101
#define P_GRUPPO 102 #define P_GRUPPO 102
#define P_CONTO 103 #define P_CONTO 103
@ -61,3 +64,9 @@
#define S_DESPAG 135 #define S_DESPAG 135
#define S_CODDESC 136 #define S_CODDESC 136
#define S_RESIDUOPAG 137 #define S_RESIDUOPAG 137
#define S_VALUTA 138
#define S_DATACAMBIO 139
#define S_CAMBIO 140
#endif

View File

@ -2,15 +2,15 @@
TOOLBAR "" 0 20 0 2 TOOLBAR "" 0 20 0 2
BUTTON P_NUOVO 10 2
BEGIN
PROMPT -12 -1 "~Nuovo"
PICTURE 105
END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -12 -1 ""
END
BUTTON P_NUOVO 10 2
BEGIN
PROMPT -22 -1 "~Nuovo"
PICTURE 105
END END
ENDPAGE ENDPAGE

View File

@ -152,7 +152,7 @@ BEGIN
PROMPT 38 8 "Ritenute professionali " PROMPT 38 8 "Ritenute professionali "
PICTURE "." PICTURE "."
FIELD RITENUTE FIELD RITENUTE
GROUP 2 MESSAGE DIRTY,S_IMPORTO|K_TAB,S_IMPORTO
END END
RADIOBUTTON S_SALDOACC 1 24 RADIOBUTTON S_SALDOACC 1 24
@ -162,7 +162,6 @@ BEGIN
ITEM "A|Acconto" ITEM "A|Acconto"
ITEM "S|Saldo" ITEM "S|Saldo"
FIELD ACCSAL FIELD ACCSAL
GROUP 2
END END
LIST S_TIPOPAG 2 35 LIST S_TIPOPAG 2 35
@ -190,6 +189,7 @@ END
TEXT DLG_NULL TEXT DLG_NULL
BEGIN BEGIN
PROMPT 2 12 "@bContropartita" PROMPT 2 12 "@bContropartita"
GROUP 2
END END
LIST S_TIPO 1 12 LIST S_TIPO 1 12
@ -251,6 +251,39 @@ BEGIN
GROUP 2 GROUP 2
END END
STRING S_VALUTA 3
BEGIN
PROMPT 2 12 "Valuta "
FLAGS "DHUZ"
GROUP 4
END
DATE S_DATACAMBIO
BEGIN
PROMPT 24 12 "Data cambio "
FLAGS "RH"
USE CAM
INPUT CODTAB[1,3] S_VALUTA SELECT
INPUT CODTAB[4,11] S_DATACAMBIO
DISPLAY "Valuta" CODTAB[1,3]
DISPLAY "Data@10" D0
DISPLAY "Cambio@18" R10
OUTPUT S_VALUTA CODTAB[1,3]
OUTPUT S_DATACAMBIO D0
OUTPUT S_CAMBIO R10
GROUP 4
CHECKTYPE NORMAL
END
NUMBER S_CAMBIO 15 5
BEGIN
PROMPT 51 12 "Cambio "
FLAGS "HRU"
GROUP 4
PICTURE ".5"
CHECKTYPE REQUIRED
END
STRING S_CODDESC 5 STRING S_CODDESC 5
BEGIN BEGIN
PROMPT 2 14 "Descriz. agg. " PROMPT 2 14 "Descriz. agg. "

View File

@ -22,23 +22,11 @@ char TPrimanota_application::row_type(const TToken_string& s)
// Determina il tipo IVA da causale+anno // Determina il tipo IVA da causale+anno
// Certified 100% // Certified 100%
TipoIVA TPrimanota_application::cau2IVA(const char* causale, int annoiva) TipoIVA TPrimanota_application::cau2IVA(const char* cod, int annoiva)
{ {
TipoIVA i = nessuna_iva; if (!read_caus(cod, annoiva))
error_box("Causale errata: '%s'", cod);
if (*causale > ' ') return causale().iva();
{
TCausale& c = app().causale();
if (c.read(causale, annoiva))
i = c.iva();
else
{
error_box("Causale errata: '%s'", causale);
i = iva_errata;
}
}
return i;
} }
// Calcolo della percentuale di un dato codice IVA // Calcolo della percentuale di un dato codice IVA
@ -291,7 +279,8 @@ TImporto TPrimanota_application::real2imp(const real& r, char row_type)
else else
{ {
dare = causale().sezione_clifo() == 'D'; dare = causale().sezione_clifo() == 'D';
if (row_type != 'T' && row_type != 'F') dare = !dare; if (row_type != 'T' && row_type != 'F')
dare = !dare;
} }
TImporto importo(dare ? 'D' : 'A', r); TImporto importo(dare ? 'D' : 'A', r);
@ -306,6 +295,12 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
int first = 0, last = 0; int first = 0, last = 0;
switch(tipo) switch(tipo)
{ {
case 'T': // Totale documento
if (!causale().corrispettivi())
{
cg.disable_cell(n, 5);
cg.disable_cell(n, 6);
}
case 'A': // Abbuoni attivi case 'A': // Abbuoni attivi
case 'C': // Differenza cambio case 'C': // Differenza cambio
case 'D': // IVA Detraibile case 'D': // IVA Detraibile
@ -315,13 +310,7 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
case 'P': // Abbuoni passsivi case 'P': // Abbuoni passsivi
case 'R': // Ritenute professionali case 'R': // Ritenute professionali
case 'S': // Ritenute Sociali case 'S': // Ritenute Sociali
case 'T': // Totale documento
last = 3; last = 3;
if (!causale().corrispettivi())
{
cg.disable_cell(n, 5);
cg.disable_cell(n, 6);
}
break; break;
case 'K': // Riga cliente/fornitore per saldaconto case 'K': // Riga cliente/fornitore per saldaconto
if (curr_mask().is_running() && n == cg.items()-1) // Sono in inserimento di una riga nuova if (curr_mask().is_running() && n == cg.items()-1) // Sono in inserimento di una riga nuova
@ -762,7 +751,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
case K_CTRL+K_INS: // Post inserimento case K_CTRL+K_INS: // Post inserimento
if (app().is_pagamento()) if (app().is_pagamento())
{ {
const char tipo = cg.mask().get(S_TIPORIGA)[0]; const char tipo = cg.mask().get(SK_TIPORIGA)[0];
if (tipo == 'K' || tipo == 'G') if (tipo == 'K' || tipo == 'G')
{ {
const int k = tipo == 'K' ? 1 : 10; const int k = tipo == 'K' ? 1 : 10;
@ -987,18 +976,24 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key)
real TPrimanota_application::calcola_imp() const real TPrimanota_application::calcola_imp() const
{ {
TArray& rows = ivas().rows_array(); TArray& rows = ivas().rows_array();
const int max = rows.items();
real imponibili, imposte; real imponibili, imposte;
for (int r = 0; r < max; r++) for (int r = rows.items()-1; r >= 0; r--)
{ {
TToken_string& row = (TToken_string&)rows[r]; TToken_string& row = (TToken_string&)rows[r];
imponibili += real(row.get(0)); imponibili += real(row.get(0));
imposte += real(row.get(3)); imposte += real(row.get(3));
} }
curr_mask().set(F_IMPONIBILI, imponibili.string(), TRUE); curr_mask().set(F_IMPONIBILI, imponibili);
curr_mask().set(F_IMPOSTE, imposte.string(), TRUE); curr_mask().set(F_IMPOSTE, imposte);
// Se e' attiva la terza pagina allora riporta i totali in testata
if (is_fattura())
{
curr_mask().set(FS_IMPONIBILI, imponibili);
curr_mask().set(FS_IMPOSTE, imposte);
}
return imponibili+imposte; return imponibili+imposte;
} }
@ -1186,7 +1181,7 @@ else
if (r == 0) // Se cambio la prima riga ... if (r == 0) // Se cambio la prima riga ...
app().add_cgs_tot(m); // ... ricalcola conti app().add_cgs_tot(m); // ... ricalcola conti
if (app().is_saldaconto() && m.insert_mode()) if (app().is_fattura() && m.insert_mode())
app().set_scadenze(m); // Aggiorna rate app().set_scadenze(m); // Aggiorna rate
} }
return TRUE; return TRUE;
@ -1361,14 +1356,15 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
// Certified 99% // Certified 99%
bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key) bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
{ {
if (!f.mask().is_running()) return TRUE; const TMask& m = f.mask();
if (!m.is_running()) return TRUE;
if (f.to_check(key)) if (f.to_check(key))
{ {
const int ann = f.mask().get_int(F_ANNOIVA); const TString16 cau = f.get();
const char* cau = f.get(); const int ann = m.get_int(F_ANNOIVA);
const TipoIVA i = cau2IVA(cau, ann); // Cerca causale e suo tipo const TipoIVA i = app().cau2IVA(cau, ann); // Cerca causale e suo tipo
if (i != iva_errata) if (i != iva_errata)
{ {
const bool ok = suspended_handler(f, key); // Controlla sospensione const bool ok = suspended_handler(f, key); // Controlla sospensione
@ -1397,7 +1393,8 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
if (!c.ok()) return FALSE; if (!c.ok()) return FALSE;
ok = app().causale().similar(c); ok = app().causale().similar(c);
if (!ok) return FALSE; if (!ok)
return FALSE; // L'errore viene gia' segnalato dalla similar
if (key == K_TAB) if (key == K_TAB)
{ {
app().read_caus(cau, ann); app().read_caus(cau, ann);
@ -1456,7 +1453,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
} }
if (m.query_mode()) if (m.query_mode())
app().causale().read(m.get(F_CODCAUS), dr.year()); app().read_caus(m.get(F_CODCAUS), dr.year());
TRegistro& reg = app().causale().reg(); TRegistro& reg = app().causale().reg();
const TString16 codreg(reg.name()); const TString16 codreg(reg.name());
@ -1727,11 +1724,11 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
if (app().is_saldaconto() && f.focusdirty()) if (app().is_saldaconto() && f.focusdirty())
{ {
if (m.field(S_VALUTA).active()) if (m.field(SK_VALUTA).active())
{ {
const TString& valuta = clifo.get(CLI_CODVAL); const TString& valuta = clifo.get(CLI_CODVAL);
if (valuta.not_empty()) if (valuta.not_empty())
m.set(S_VALUTA, valuta, TRUE); m.set(SK_VALUTA, valuta, TRUE);
} }
if (clifo.get(CLI_CODCAB).not_empty()) if (clifo.get(CLI_CODCAB).not_empty())
@ -1856,10 +1853,10 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
app().calcola_saldo(); app().calcola_saldo();
} }
TMask_field& totval = m.field(S_TOTDOCVAL); TMask_field& totval = m.field(SK_TOTDOCVAL);
if (totval.active() && totval.get().empty()) if (totval.active() && totval.get().empty())
{ {
const real cambio(m.get(S_CAMBIO)); const real cambio(m.get(SK_CAMBIO));
if (!cambio.is_zero()) if (!cambio.is_zero())
{ {
real tot(f.get()); real tot(f.get());
@ -1881,7 +1878,7 @@ bool TPrimanota_application::totdocval_handler(TMask_field& f, KEY key)
{ {
TMask& m = f.mask(); TMask& m = f.mask();
real totval(f.get()); real totval(f.get());
real cambio(m.get(S_CAMBIO)); real cambio(m.get(SK_CAMBIO));
real totale(m.get(F_TOTALE)); real totale(m.get(F_TOTALE));
if (totale.is_zero()) if (totale.is_zero())
{ {
@ -1893,9 +1890,17 @@ bool TPrimanota_application::totdocval_handler(TMask_field& f, KEY key)
if (cambio.is_zero()) if (cambio.is_zero())
{ {
totale /= totval; totale /= totval;
m.set(S_CAMBIO, totale.string(), TRUE); m.set(SK_CAMBIO, totale.string(), TRUE);
} }
} }
TPagamento* pag = app().pagamento();
if (pag != NULL) // Se e' una vera fattura
{
pag->set_total(totval, ZERO, ZERO);
pag->set_rate_auto();
pag->set_sheet(app().pags());
}
} }
return TRUE; return TRUE;

View File

@ -158,22 +158,24 @@ protected:
char clifo() const { return iva() == iva_vendite ? 'C' : 'F'; } char clifo() const { return iva() == iva_vendite ? 'C' : 'F'; }
bool gestione_valuta() const { return _ges_val; } bool gestione_valuta() const { return _ges_val; }
bool gestione_saldaconto() const { return _ges_sal; } bool gestione_saldaconto() const { return _ges_sal; }
bool is_saldaconto() const { return _is_saldaconto; }
void set_saldaconto(bool b) { _is_saldaconto = b; }
bool is_pagamento() const { return is_saldaconto() && iva() == nessuna_iva; }
bool npart_is_prot() { return _npart_is_prot; } bool npart_is_prot() { return _npart_is_prot; }
bool is_saldaconto() const { return _is_saldaconto; }
bool is_fattura() const { return gestione_saldaconto() && causale().tipomov() == 1; }
bool is_nota_credito() const { return gestione_saldaconto() && causale().tipomov() == 2; }
bool is_pagamento() const { return gestione_saldaconto() && causale().tipomov() >= 3; }
void fill_sheet(TMask& m) const; void fill_sheet(TMask& m) const;
void init_mask(TMask& m); void init_mask(TMask& m);
static TipoIVA reg2IVA(const char* registro, int anno); static TipoIVA reg2IVA(const char* registro, int anno);
static TipoIVA cau2IVA(const char* causale, int anno);
static int type2pos(char tipo); static int type2pos(char tipo);
static const real& cod2IVA(const TMask& m); static const real& cod2IVA(const TMask& m);
static real scorpora(real& imponibile, const real& percentuale); static real scorpora(real& imponibile, const real& percentuale);
static bool detraibile(TToken_string& row); static bool detraibile(TToken_string& row);
static int bill2pos(const TBill& conto, char tipo); static int bill2pos(const TBill& conto, char tipo);
TipoIVA cau2IVA(const char* causale, int anno);
bool IVA2bill(const TCodiceIVA& iva, TBill& bill); bool IVA2bill(const TCodiceIVA& iva, TBill& bill);
int bill2contr(const TBill& c, char sezione) const; int bill2contr(const TBill& c, char sezione) const;
int bill_used(const TBill& conto) const; int bill_used(const TBill& conto) const;

View File

@ -268,7 +268,7 @@ bool TCausale::read(const char* cod, int year)
{ {
TLocalisamfile caus(LF_CAUSALI); TLocalisamfile caus(LF_CAUSALI);
_rec = caus.curr(); _rec.zero(); // Delete header _rec.zero(); // Delete header
destroy(); // Delete all rows destroy(); // Delete all rows
_iva = iva_errata; // Delete misc info _iva = iva_errata; // Delete misc info
_sezione_clifo = _sezione_ritsoc = ' '; _sezione_clifo = _sezione_ritsoc = ' ';

View File

@ -216,9 +216,16 @@ bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key)
const real ex(f.get()); const real ex(f.get());
pag->set_cambio(ex); pag->set_cambio(ex);
TSheet_field& ps = app().pags(); TMask& m = f.mask();
if (m.insert_mode())
{
pag->set_rate_auto();
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
pag->set_sheet(ps); pag->set_sheet(ps);
ps.force_update(); app().pag_rows() = ps.rows_array();
}
const TValuta val(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
val.set(m, FS_VALUTA, FS_DATACAMBIO, FS_CAMBIO);
} }
} }
return TRUE; return TRUE;
@ -226,11 +233,10 @@ bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key)
bool TPrimanota_application::reset_handler(TMask_field& f, KEY key) bool TPrimanota_application::reset_handler(TMask_field& f, KEY key)
{ {
TMask& m = f.mask(); if (key == K_SPACE)
if (key == K_SPACE && m.is_running() && app().is_saldaconto())
{ {
app().reset_pagamento(f.mask()); TMask& m = f.mask();
app().reset_pagamento(m);
app().set_scadenze(m); app().set_scadenze(m);
} }
return TRUE; return TRUE;
@ -323,7 +329,8 @@ void TPrimanota_application::reset_pagamento(TMask& m)
void TPrimanota_application::recalc_scadenze(const TDate& d) void TPrimanota_application::recalc_scadenze(const TDate& d)
{ {
if (_pag == NULL) return; CHECK(_pag != NULL, "Can't handle null pagament");
_pag->set_inizio(d); _pag->set_inizio(d);
// ridefinisci lo sheet sulla base delle nuove rate // ridefinisci lo sheet sulla base delle nuove rate
TSheet_field& ps = pags(); TSheet_field& ps = pags();
@ -331,7 +338,7 @@ void TPrimanota_application::recalc_scadenze(const TDate& d)
_pag->set_sheet(ps); _pag->set_sheet(ps);
rws = ps.rows_array(); rws = ps.rows_array();
ps.force_update(); // ps.force_update();
} }
void TPrimanota_application::set_pagamento(const char* c, const char* d) void TPrimanota_application::set_pagamento(const char* c, const char* d)
@ -344,10 +351,10 @@ void TPrimanota_application::set_scadenze(TMask& m)
{ {
real imponibile, imposta; real imponibile, imposta;
const real spese(0.0); const real spese(0.0);
const real cambio(m.get(S_CAMBIO)); const real cambio(m.get(SK_CAMBIO));
TPagamento& pag = *pagamento(); TPagamento& pag = *pagamento();
if (cambio.is_zero()) if (cambio <= 1.0)
{ {
imponibile = real(m.get(F_IMPONIBILI)); imponibile = real(m.get(F_IMPONIBILI));
imposta = real(m.get(F_IMPOSTE)); imposta = real(m.get(F_IMPOSTE));
@ -355,23 +362,22 @@ void TPrimanota_application::set_scadenze(TMask& m)
else else
{ {
pag.set_cambio(cambio); pag.set_cambio(cambio);
imponibile = real(m.get(S_TOTDOCVAL)); imponibile = real(m.get(SK_TOTDOCVAL));
imposta = ZERO; imposta = ZERO;
} }
pag.set_total(imponibile, imposta, spese);
pag.set_rate_auto();
if (m.field(FS_RECALC).enabled()) if (m.field(FS_RECALC).enabled())
{ {
m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2"); m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
m.set(FS_NAMEPAG, pag.name()); m.set(FS_NAMEPAG, pag.name());
m.set(FS_TIPOPR, pag.desc_tpr()); m.set(FS_TIPOPR, pag.desc_tpr());
m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : ""); m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : "");
m.set(FS_RECALC, m.edit_mode() ? "" : "X", TRUE); m.set(FS_RECALC, m.insert_mode() ? "X" : "", TRUE);
m.set(FS_NRATE, pag.n_rate()); m.set(FS_NRATE, pag.n_rate());
} }
pag.set_total(imponibile, imposta, spese);
pag.set_rate_auto();
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET); TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
pag.set_sheet(ps); // prepara lo sheet pag.set_sheet(ps); // prepara lo sheet
_pag_rows = ps.rows_array(); // copia sheet _pag_rows = ps.rows_array(); // copia sheet
@ -400,10 +406,10 @@ bool TPrimanota_application::read_scadenze(TMask& m)
bool in_valuta = FALSE; bool in_valuta = FALSE;
if (cambio.sign() > 0) if (cambio.sign() > 0)
{ {
pag.set_cambio(cambio);
imponibile = real(m.get(S_TOTDOCVAL));
imposta = ZERO;
in_valuta = TRUE; in_valuta = TRUE;
pag.set_cambio(cambio);
imponibile = real(m.get(SK_TOTDOCVAL));
imposta = ZERO;
} }
else else
{ {
@ -450,7 +456,7 @@ bool TPrimanota_application::read_scadenze(TMask& m)
" all'ultima registrazione. Si desidera mantenere" " all'ultima registrazione. Si desidera mantenere"
" comunque la rateazione precedente"); " comunque la rateazione precedente");
// nel qual caso, of course, si disabilitano gli automatismi // nel qual caso, of course, si disabilitano gli automatismi
if(!fromscratch) m.set(FS_RECALC, "", TRUE); m.set(FS_RECALC, fromscratch ? "X" : "", TRUE);
} }
} }
@ -494,8 +500,8 @@ bool TPrimanota_application::read_scadenze(TMask& m)
m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2"); m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
m.set(FS_NAMEPAG, pag.name()); m.set(FS_NAMEPAG, pag.name());
m.set(FS_TIPOPR, pag.desc_tpr()); m.set(FS_TIPOPR, pag.desc_tpr());
m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : ""); m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : "", TRUE);
m.set(FS_RECALC, m.edit_mode() ? "" : "X", TRUE); m.set(FS_RECALC, m.insert_mode() ? "X" : "", TRUE);
m.set(FS_NRATE, pag.n_rate()); m.set(FS_NRATE, pag.n_rate());
} //else } //else
} }
@ -535,8 +541,8 @@ void TPrimanota_application::write_scadenze(const TMask& m)
const TString desc(m.get(F_DESCR)); const TString desc(m.get(F_DESCR));
const long protiva = m.get_long(F_PROTIVA); const long protiva = m.get_long(F_PROTIVA);
const TString codcaus(causale().codice()); const TString codcaus(causale().codice());
const TString codval (m.get(S_VALUTA)); const TString codval (m.get(SK_VALUTA));
const real cambio (m.get(S_CAMBIO)); const real cambio (m.get(SK_CAMBIO));
const TString agente (m.get(FS_AGENTE)); const TString agente (m.get(FS_AGENTE));
const char sezione = get_cgs_imp(0).sezione(); // Dare/Avere const char sezione = get_cgs_imp(0).sezione(); // Dare/Avere
@ -840,7 +846,7 @@ bool TPrimanota_application::notify_cgline_deletion(TPartita& partita, long nreg
for (int p = partita.last(); p > 0; p = partita.pred(p)) for (int p = partita.last(); p > 0; p = partita.pred(p))
{ {
TRiga_partite& part = partita.riga(p); TRiga_partite& part = partita.riga(p);
if (part.get_int(PART_TIPOMOV) == 1) if (part.is_fattura())
{ {
for (int r = part.rate(); r > 0; r--) for (int r = part.rate(); r > 0; r--)
{ {
@ -870,6 +876,24 @@ bool TPrimanota_application::notify_cgline_deletion(TPartita& partita, long nreg
} }
} }
TRecord_array& unas = partita.unassigned();
for (int u = unas.last_row(); u > 0; u = unas.pred_row(u))
{
const TRiga_partite& sum = partita.riga(u);
if (sum.get_long(PART_NREG) == nreg &&
(numrig <= 0 || sum.get_int(PART_NUMRIG) == numrig))
{
TRectype nul_pag(unas.row(u, FALSE));
nul_pag.zero(PAGSCA_IMPORTO);
nul_pag.zero(PAGSCA_IMPORTOVAL);
nul_pag.zero(PAGSCA_RITENUTE);
nul_pag.put(PAGSCA_ACCSAL, 'A'); // Inutile, ma l'ho copiato da sopra
const TValuta val; // Non cambiare valuta
notify_edit_pagamento(partita, nul_pag, val, numrig);
found = TRUE;
}
}
return found; return found;
} }

View File

@ -1,17 +1,12 @@
#include <execp.h>
#include <mailbox.h>
#include <defmask.h> // Serve per DLG_NEWREC #include <defmask.h> // Serve per DLG_NEWREC
#ifndef __EXTRA__
#include "cg2102.h" // Applicazione di prima nota
#include "cg2100.h" // Campi maschere prima nota
#endif
#include "cg2100p.h" // Campi maschere partite e pagamenti #include "cg2100p.h" // Campi maschere partite e pagamenti
#ifndef __EXTRA__
#include "cg2100.h" // Campi maschere prima nota
#include "cg2102.h" // Applicazione di prima nota
#endif
#include <clifo.h> // Archivio clienti/fornitori #include <clifo.h> // Archivio clienti/fornitori
#include <mov.h> // Archivio movimenti di prima nota #include <mov.h> // Archivio movimenti di prima nota
#include <pagsca.h> // Archivio pagamenti #include <pagsca.h> // Archivio pagamenti
@ -25,15 +20,14 @@
class TPay_mask : public TMask class TPay_mask : public TMask
{ {
real _da_pagare, _pagabile; real _da_pagare, _pagabile;
TValuta _valuta;
protected: protected:
static bool importo_handler(TMask_field& f, KEY k); static bool importo_handler(TMask_field& f, KEY k);
static bool cambio_handler(TMask_field& f, KEY k);
public: public:
void set_pag(const TRectype& oldpag, const TRiga_scadenze& scad, const TImporto& importo); void set_pag(const TRectype& oldpag, const TRiga_scadenze& scad, const TImporto& importo);
void get_pag(TRectype& oldpag) const; void get_pag(TRectype& oldpag) const;
const TValuta& valuta() const { return _valuta; }
TPay_mask(); TPay_mask();
virtual ~TPay_mask() {} virtual ~TPay_mask() {}
@ -66,6 +60,7 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
set(S_IMPORTOVAL_SCAD, scad.get(SCAD_IMPORTOVAL)); // Importo in valuta set(S_IMPORTOVAL_SCAD, scad.get(SCAD_IMPORTOVAL)); // Importo in valuta
const bool in_valuta = scad.in_valuta(); const bool in_valuta = scad.in_valuta();
_da_pagare = scad.residuo(in_valuta).valore(); // Calcola residuo in valuta _da_pagare = scad.residuo(in_valuta).valore(); // Calcola residuo in valuta
TReal_field& res = (TReal_field&)field(S_RESIDUORATA); TReal_field& res = (TReal_field&)field(S_RESIDUORATA);
@ -74,26 +69,30 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
set_handler(in_valuta ? S_IMPORTOVAL : S_IMPORTO, importo_handler); set_handler(in_valuta ? S_IMPORTOVAL : S_IMPORTO, importo_handler);
// Ricorda l'importo da pagare real oldimp = oldpag.get_real(in_valuta ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO);
_da_pagare += oldpag.get_real(in_valuta ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO); if (!in_valuta)
oldimp += oldpag.get_real(PAGSCA_RITENUTE);
// Attiva campi relativi alla valuta // Ricorda l'importo da pagare
show(-3, in_valuta); _da_pagare += oldimp;
TValuta val; val.get(sum);
val.set(*this, S_VALUTA, S_DATACAMBIO, S_CAMBIO);
const long numreg = sum.get_long(PART_NREG); const long numreg = sum.get_long(PART_NREG);
const int numrig = sum.get_int(PART_NUMRIG); const int numrig = sum.get_int(PART_NUMRIG);
_valuta.get(sum);
TReal_field& resp = (TReal_field&)field(S_RESIDUOPAG); TReal_field& resp = (TReal_field&)field(S_RESIDUOPAG);
resp.set_decimals(in_valuta ? 2 : 0); resp.set_decimals(in_valuta ? 2 : 0);
TImporto r(importo); TImporto r(importo);
r -= app().partite().importo_speso(numreg, numrig); r -= app().partite().importo_speso(numreg, numrig);
if (in_valuta) if (in_valuta)
_pagabile = _valuta.lit2val(r.valore()); _pagabile = val.lit2val(r.valore());
else else
_pagabile = r.valore(); _pagabile = r.valore();
resp.set(_pagabile.string()); resp.set(_pagabile.string());
_pagabile += oldpag.get_real(in_valuta ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO);
_pagabile += oldimp;
// Il flag di saldo/acconto e' attivo solo se non ci sono acconti // Il flag di saldo/acconto e' attivo solo se non ci sono acconti
bool sa = oldpag.get_int(PAGSCA_NRIGA) != TPartita::UNASSIGNED; bool sa = oldpag.get_int(PAGSCA_NRIGA) != TPartita::UNASSIGNED;
@ -107,16 +106,22 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
{ {
hide(S_RESIDUORATA); hide(S_RESIDUORATA);
} }
enable(S_SALDOACC, sa); enable(S_SALDOACC, sa); // Mostra saldo solo se non e' un acconto
show(-3, in_valuta); // Attiva campi relativi alla valuta
#ifdef __EXTRA__ #ifdef __EXTRA__
set_handler(S_CAMBIO, cambio_handler);
hide(S_RESIDUOPAG); hide(S_RESIDUOPAG);
const bool disabilita = TRUE; const bool mostra_conto = FALSE;
show(-4, in_valuta); // Attiva campi relativi al cambio
#else #else
const bool disabilita = app().causale().tipomov() == 2; const bool mostra_conto = !sum.is_nota_credito();
#endif #endif
if (disabilita) show(-2, mostra_conto); // mostra/nasconde conto contropartita
send_key(K_CTRL + K_SHIFT + 'c', -2); // Disabilita contropartita e ritenute
const bool mostra_ritenute = !(sum.is_nota_credito() || in_valuta);
show(S_RITENUTE, mostra_ritenute); // mostra/nasconde ritenute
} }
void TPay_mask::get_pag(TRectype& newpag) const void TPay_mask::get_pag(TRectype& newpag) const
@ -133,33 +138,57 @@ bool TPay_mask::importo_handler(TMask_field& f, KEY k)
if (k == K_F8) if (k == K_F8)
{ {
const real& imp = fnc_min(m._da_pagare, m._pagabile); real imp;
if (m.field(S_RESIDUORATA).shown() && m.field(S_RESIDUOPAG).shown())
imp = fnc_min(m._da_pagare, m._pagabile);
else
imp = m.field(S_RESIDUORATA).shown() ? m._da_pagare : m._pagabile;
if (m.field(S_RITENUTE).active())
imp -= real(m.get(S_RITENUTE));
f.set(imp.string()); f.set(imp.string());
k = K_TAB; k = K_TAB;
} }
if (k == K_TAB && f.focusdirty()) if (k == K_TAB && f.focusdirty())
{ {
const real i(f.get()); real i(f.get());
if (m.field(S_RITENUTE).active())
i += real(m.get(S_RITENUTE));
if (i >= m._da_pagare && m.field(S_SALDOACC).active()) if (i >= m._da_pagare && m.field(S_SALDOACC).active())
m.set(S_SALDOACC, "S"); m.set(S_SALDOACC, "S");
const real residuo(m._da_pagare - i); const real residuo(m._da_pagare - i);
m.set(S_RESIDUORATA, residuo.string()); m.set(S_RESIDUORATA, residuo);
const real residuopag(m._pagabile - i); const real residuopag(m._pagabile - i);
m.set(S_RESIDUOPAG, residuopag.string()); m.set(S_RESIDUOPAG, residuopag);
if (f.dlg() == S_IMPORTOVAL) if (f.dlg() == S_IMPORTOVAL)
{ {
const real lit = m.valuta().val2lit(i); TValuta val; val.get(m, S_VALUTA, S_DATACAMBIO, S_CAMBIO);
m.set(S_IMPORTO, lit.string()); val.val2lit(i);
m.set(S_IMPORTO, i);
} }
} }
return TRUE; return TRUE;
} }
bool TPay_mask::cambio_handler(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty())
{
TMask_field& i = f.mask().field(S_IMPORTOVAL);
i.set_dirty();
i.on_hit();
}
return TRUE;
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Maschera partite // Maschera partite
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -236,7 +265,7 @@ TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga)
TValuta val; TValuta val;
#ifndef __EXTRA__ #ifndef __EXTRA__
TMask& cm = app().curr_mask(); TMask& cm = app().curr_mask();
val.get(cm, S_VALUTA, S_DATACAMBIO, S_CAMBIO); val.get(cm, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
cerca_valuta(val); cerca_valuta(val);
val.set(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO); val.set(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
#endif #endif
@ -390,7 +419,7 @@ void TGame_mask::aggiorna_valuta(const TValuta& val)
val.val2lit(imp); val.val2lit(imp);
pag.put(PAGSCA_IMPORTO, imp); // Converte in lire l'importo in valuta pag.put(PAGSCA_IMPORTO, imp); // Converte in lire l'importo in valuta
#ifdef __EXTRA__ #ifdef __EXTRA__
game->modifica_pagamento(pag); game->modifica_pagamento(pag, val, TRUE);
#else #else
app().notify_edit_pagamento(*game, pag, val); app().notify_edit_pagamento(*game, pag, val);
#endif #endif
@ -497,11 +526,19 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
row.add(scad.get(SCAD_DATASCAD)); row.add(scad.get(SCAD_DATASCAD));
row.add(sum.get(PART_DATADOC)); row.add(sum.get(PART_DATADOC));
row.add(sum.get(PART_DESCR)); row.add(sum.get(PART_DESCR));
add_importo(row, TImporto(sez, pag.get_real(PAGSCA_IMPORTO)));
TImporto imp(sez, pag.get_real(PAGSCA_IMPORTO));
if (in_valuta) if (in_valuta)
{
add_importo(row, imp);
add_importo(row, TImporto(sez, pag.get_real(PAGSCA_IMPORTOVAL)), 2); add_importo(row, TImporto(sez, pag.get_real(PAGSCA_IMPORTOVAL)), 2);
}
else else
{
imp.valore() += pag.get_real(PAGSCA_RITENUTE);
add_importo(row, imp);
row.add(""); row.add("");
}
row.add(sum.get(PART_NREG)); row.add(sum.get(PART_NREG));
row.add(sum.get(PART_DATAREG)); row.add(sum.get(PART_DATAREG));
row.add(sum.get(PART_NUMDOC)); row.add(sum.get(PART_NUMDOC));
@ -572,6 +609,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
row.add(sum.get(PART_DATADOC)); row.add(sum.get(PART_DATADOC));
row.add(sum.get(PART_DESCR)); row.add(sum.get(PART_DESCR));
TImporto i(sum.sezione(), pag.get_real(PAGSCA_IMPORTO)); TImporto i(sum.sezione(), pag.get_real(PAGSCA_IMPORTO));
i.valore() += pag.get_real(PAGSCA_RITENUTE);
i.normalize(); i.normalize();
add_importo(row, i); add_importo(row, i);
tot_lit += i; tot_lit += i;
@ -641,10 +679,8 @@ int TGame_mask::nuova_riga(TPartita& partita) const
part.put(PART_CONTOCL, conto().conto()); part.put(PART_CONTOCL, conto().conto());
// Setta il cambio corrente // Setta il cambio corrente
const real cambio(get(P_CAMBIO)); TValuta valuta; valuta.get(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
part.put(PART_CAMBIO, cambio); valuta.put(part);
part.put(PART_CODVAL, get(P_VALUTA));
part.put(PART_DATACAM, get(P_DATACAMBIO));
#ifdef __EXTRA__ #ifdef __EXTRA__
part.put(PART_TIPOMOV, _tipomov); part.put(PART_TIPOMOV, _tipomov);
@ -658,11 +694,9 @@ int TGame_mask::nuova_riga(TPartita& partita) const
if (_tipomov == 1) if (_tipomov == 1)
{ {
part.put(PART_IMPORTO, _importo.valore()); part.put(PART_IMPORTO, _importo.valore());
if (!cambio.is_zero()) if (valuta.in_valuta())
{ {
real impval = _importo.valore(); const real impval = valuta.lit2val(_importo.valore());
impval /= cambio;
impval.round(2);
part.put(PART_IMPORTOVAL, impval); part.put(PART_IMPORTOVAL, impval);
} }
} }
@ -711,10 +745,15 @@ int TGame_mask::nuova_riga(TPartita& partita) const
int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata) const int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata) const
{ {
const TBill& conto = partita.conto(); // Legge conto principale
#ifdef __EXTRA__ #ifdef __EXTRA__
const int nrigp = nuova_riga(partita); const int nrigp = nuova_riga(partita);
if (nriga > 0)
{
const TRiga_partite& fattura = partita.riga(nriga);
const TValuta val(fattura);
TRiga_partite& somma = partita.riga(nrigp);
val.put(somma);
}
#else #else
int nrigp = partita.mov2rig(_numreg, _numrig); // Cerca riga partita relativa alla riga rmov int nrigp = partita.mov2rig(_numreg, _numrig); // Cerca riga partita relativa alla riga rmov
if (nrigp <= 0) // Devo creare una nuova riga di partita if (nrigp <= 0) // Devo creare una nuova riga di partita
@ -1134,9 +1173,9 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
{ {
nriga = p.primo_pagamento(); nriga = p.primo_pagamento();
TRiga_partite& riga = p.riga(nriga); TRiga_partite& riga = p.riga(nriga);
TRiga_scadenze& scaden = riga.new_row(); const TRiga_scadenze& scaden = riga.new_row(); // Crea una rata falsa
m.set_pag(oldpag, scaden, _importo); m.set_pag(oldpag, scaden, _importo);
riga.destroy_rows(); riga.destroy_rows(); // Distrugge la rata falsa
} }
else else
{ {
@ -1169,10 +1208,14 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
TRectype newpag(oldpag); TRectype newpag(oldpag);
m.get_pag(newpag); m.get_pag(newpag);
const TValuta val; // Non cambiare valuta! TValuta val;
#ifdef __EXTRA__ #ifdef __EXTRA__
p.modifica_pagamento(newpag); val.get(m, S_VALUTA, S_DATACAMBIO, S_CAMBIO);
p.modifica_pagamento(newpag, val, TRUE);
#else #else
if (somma.is_nota_credito())
p.modifica_pagamento(newpag, val, TRUE);
else
app().notify_edit_pagamento(p, newpag, val); app().notify_edit_pagamento(p, newpag, val);
#endif #endif
} }

View File

@ -25,8 +25,8 @@ BEGIN
PROMPT 31 1 "In valuta " PROMPT 31 1 "In valuta "
PICTURE ".2" PICTURE ".2"
FLAGS "HU" FLAGS "HU"
VALIDATE REQIF_FUNC 1 FS_VALUTA VALIDATE REQIF_FUNC 1 FS_IMPONIBILI
WARNING "E' stata specificata una valuta ma non il relativo totale documento" WARNING "Manca il totale documento in valuta"
END END
NUMBER FS_SPESE 15 NUMBER FS_SPESE 15
@ -36,7 +36,6 @@ BEGIN
FLAGS "DR" FLAGS "DR"
END END
RADIOBUTTON FS_RDIFFER 31 RADIOBUTTON FS_RDIFFER 31
BEGIN BEGIN
PROMPT 1 2 "Opzioni ricalcolo rate" PROMPT 1 2 "Opzioni ricalcolo rate"
@ -76,6 +75,7 @@ BEGIN
CHECKTYPE NORMAL CHECKTYPE NORMAL
WARNING "Codice valuta assente" WARNING "Codice valuta assente"
MESSAGE EMPTY RESET,FS_CAMBIO MESSAGE EMPTY RESET,FS_CAMBIO
GROUP 3
END END
DATE FS_DATACAMBIO DATE FS_DATACAMBIO
@ -88,10 +88,10 @@ BEGIN
DISPLAY "Valuta" CODTAB[1,3] DISPLAY "Valuta" CODTAB[1,3]
DISPLAY "Data@10" D0 DISPLAY "Data@10" D0
DISPLAY "Cambio@18" R10 DISPLAY "Cambio@18" R10
// OUTPUT FS_VALUTA CODTAB[1,3]
OUTPUT FS_DATACAMBIO D0 OUTPUT FS_DATACAMBIO D0
OUTPUT FS_CAMBIO R10 OUTPUT FS_CAMBIO R10
CHECKTYPE NORMAL CHECKTYPE NORMAL
GROUP 3
END END
NUMBER FS_CAMBIO 15 5 NUMBER FS_CAMBIO 15 5
@ -101,6 +101,7 @@ BEGIN
PICTURE ".5" PICTURE ".5"
VALIDATE REQIF_FUNC 1 FS_VALUTA VALIDATE REQIF_FUNC 1 FS_VALUTA
WARNING "E' stata specificata una valuta ma non il cambio relativo" WARNING "E' stata specificata una valuta ma non il cambio relativo"
GROUP 3
END END
STRING FS_NAMEPAG 27 STRING FS_NAMEPAG 27

View File

@ -258,7 +258,7 @@ bool TRiga_scadenze::chiusa(bool update) const
if (update) if (update)
{ {
TImporto imp(importo_da_pagare(TRUE)); TImporto imp(importo_da_pagare(TRUE));
imp += importo_pagato(TRUE, 0x3); imp += importo_pagato(TRUE);
chiusa = imp.is_zero(); chiusa = imp.is_zero();
((TRectype*)this)->put(SCAD_PAGATA, chiusa ? "X" : ""); ((TRectype*)this)->put(SCAD_PAGATA, chiusa ? "X" : "");
} }
@ -271,7 +271,7 @@ bool TRiga_scadenze::chiusa(bool update) const
// Calcola il totale dei pagamenti (eventualmente in valuta) // Calcola il totale dei pagamenti (eventualmente in valuta)
TImporto TRiga_scadenze::importo_pagato(bool val, int mode) const TImporto TRiga_scadenze::importo_pagato(bool val, int mode) const
{ {
CHECKD(mode > 0 && mode < 8, "Bad importo_pagato mode ", mode); CHECKD(mode > 0x0 && mode < 0x8, "Bad importo_pagato mode ", mode);
const TPartita& game = partita(); const TPartita& game = partita();
const bool in_val = in_valuta(); const bool in_val = in_valuta();
const char* imp_field = (val && in_val) ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO; const char* imp_field = (val && in_val) ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO;
@ -284,12 +284,16 @@ TImporto TRiga_scadenze::importo_pagato(bool val, int mode) const
const char sez = sum.sezione(); const char sez = sum.sezione();
if (mode & 0x1) if (mode & 0x1)
{
totale += TImporto(sez, pag.get_real(imp_field)); totale += TImporto(sez, pag.get_real(imp_field));
if (!in_val)
totale += TImporto(sez, pag.get_real(PAGSCA_RITENUTE));
}
if (mode & 0x2) // Voglio anche gli abbuoni if (mode & 0x2) // Voglio anche gli abbuoni
{ {
real abb(pag.get_real(PAGSCA_ABBUONI)); real abb(pag.get_real(PAGSCA_ABBUONI));
if (!val && in_val) if (in_val && !val)
{ {
abb *= sum.get_real(PART_CAMBIO); abb *= sum.get_real(PART_CAMBIO);
abb.round(); abb.round();
@ -297,7 +301,7 @@ TImporto TRiga_scadenze::importo_pagato(bool val, int mode) const
totale += TImporto(sez, abb); totale += TImporto(sez, abb);
} }
if (!val && (mode & 0x4)) // Voglio anche le differenze cambi if (in_val && !val && (mode & 0x4)) // Voglio anche le differenze cambio
{ {
const TImporto diffcam(sez, pag.get_real(PAGSCA_DIFFCAM)); const TImporto diffcam(sez, pag.get_real(PAGSCA_DIFFCAM));
totale += diffcam; totale += diffcam;
@ -382,7 +386,7 @@ TImporto TRiga_scadenze::calcola_differenza_cambio(int p, bool update)
{ {
diffcam = importo_da_pagare(FALSE); diffcam = importo_da_pagare(FALSE);
pag.zero(PAGSCA_DIFFCAM); pag.zero(PAGSCA_DIFFCAM);
diffcam += importo_pagato(FALSE, 0x7); // Conta anche gli abbuoni e le altre diffcam diffcam += importo_pagato(FALSE); // Conta anche gli abbuoni e le altre diffcam
diffcam.swap_section(); diffcam.swap_section();
diffcam.normalize(sez); diffcam.normalize(sez);
pag.put(PAGSCA_DIFFCAM, diffcam.valore()); pag.put(PAGSCA_DIFFCAM, diffcam.valore());
@ -458,7 +462,8 @@ bool TRiga_scadenze::modifica_pagamento(const TRectype& new_pag, const TValuta&
partita().chiusa(TRUE); partita().chiusa(TRUE);
const bool empty = new_pag.get_char(PAGSCA_ACCSAL) != 'S' && const bool empty = new_pag.get_char(PAGSCA_ACCSAL) != 'S' &&
new_pag.get_real(PAGSCA_IMPORTO).is_zero(); new_pag.get_real(PAGSCA_IMPORTO).is_zero() &&
new_pag.get_real(PAGSCA_RITENUTE).is_zero();
if (empty) if (empty)
rows_array().destroy_row(nrigp); rows_array().destroy_row(nrigp);
@ -471,7 +476,9 @@ bool TRiga_scadenze::elimina_pagamento(int p)
old_pag.put(PAGSCA_ACCSAL, "A"); old_pag.put(PAGSCA_ACCSAL, "A");
old_pag.zero(PAGSCA_IMPORTO); old_pag.zero(PAGSCA_IMPORTO);
old_pag.zero(PAGSCA_IMPORTOVAL); old_pag.zero(PAGSCA_IMPORTOVAL);
return partita().modifica_pagamento(old_pag); old_pag.zero(PAGSCA_RITENUTE);
TValuta val;
return partita().modifica_pagamento(old_pag, val, TRUE);
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -534,6 +541,10 @@ bool TRiga_partite::is_fattura() const
return get_int(PART_TIPOMOV) == 1; return get_int(PART_TIPOMOV) == 1;
} }
bool TRiga_partite::is_nota_credito() const
{
return get_int(PART_TIPOMOV) == 2;
}
int TRiga_partite::read(TBaseisamfile& f, word op) int TRiga_partite::read(TBaseisamfile& f, word op)
{ {
@ -945,13 +956,23 @@ TImporto TPartita::importo_speso(long nreg, int numrig) const
const TRiga_partite& part = riga(r); const TRiga_partite& part = riga(r);
if (nreg == part.get_long(PART_NREG) && numrig == part.get_int(PART_NUMRIG)) if (nreg == part.get_long(PART_NREG) && numrig == part.get_int(PART_NUMRIG))
{ {
// Importo dei pagamenti
imp += TImporto(part.sezione(), part.get_real(PART_IMPORTO)); imp += TImporto(part.sezione(), part.get_real(PART_IMPORTO));
// Abbuoni (in valuta)
TImporto abbuoni(part.get_char(PART_SEZABB), part.get_real(PART_ABBUONI)); TImporto abbuoni(part.get_char(PART_SEZABB), part.get_real(PART_ABBUONI));
const TValuta valuta(part); const TValuta valuta(part);
if (!valuta.in_lire())
if (valuta.in_lire())
{ {
// Se in lire ci possono essere le ritenute
imp += TImporto(part.sezione(), part.get_real(PART_RITENUTE));
}
else
{
// Se in valuta bisogna convertire in lire gli abbuoni ...
valuta.val2lit(abbuoni); valuta.val2lit(abbuoni);
// ... e considerare le differenze cambio
imp += TImporto(part.get_char(PART_SEZDIFCAM), part.get_real(PART_DIFFCAM)); imp += TImporto(part.get_char(PART_SEZDIFCAM), part.get_real(PART_DIFFCAM));
} }
imp += abbuoni; imp += abbuoni;
@ -1039,8 +1060,13 @@ void TPartita::calcola_saldo(TImporto& saldo, TImporto& doc, TImporto& pag, TImp
for (int r = last(); r > 0; r = pred(r)) for (int r = last(); r > 0; r = pred(r))
{ {
const TRiga_partite& row = riga(r); const TRiga_partite& row = riga(r);
TImporto i(row.get_char(PART_SEZ), row.get_real(PART_IMPORTO)); const int tipo = row.get_int(PART_TIPOMOV);
switch (row.get_int(PART_TIPOMOV))
TImporto i(row.sezione(), row.get_real(PART_IMPORTO));
if (tipo >= 3)
i.valore() += row.get_real(PART_RITENUTE);
switch (tipo)
{ {
case 1: case 1:
case 2: case 2:
@ -1135,14 +1161,13 @@ bool TPartita::modifica_pagamento(const TRectype& new_pag, const TValuta& valuta
} }
bool TPartita::modifica_pagamento(const TRectype& new_pag) bool TPartita::modifica_pagamento(const TRectype& new_pag, const TValuta& valuta, bool update)
{ {
char old_ap, new_ap; char old_ap, new_ap;
TImporto old_abbuono, new_abbuono, old_diffcam, new_diffcam; TImporto old_abbuono, new_abbuono, old_diffcam, new_diffcam;
TValuta valuta;
return modifica_pagamento(new_pag, valuta, return modifica_pagamento(new_pag, valuta,
old_ap, old_abbuono, old_diffcam, old_ap, old_abbuono, old_diffcam,
new_ap, new_abbuono, new_diffcam, FALSE); new_ap, new_abbuono, new_diffcam, update);
} }
@ -1266,7 +1291,8 @@ void TPartita::sposta_riga(int r, TPartita& part)
npg.put(fnam, pag.get(fnam)); npg.put(fnam, pag.get(fnam));
} }
} }
part.modifica_pagamento(npg); const TValuta val;
part.modifica_pagamento(npg, val, FALSE);
scd.elimina_pagamento(j); scd.elimina_pagamento(j);
} }
} }

View File

@ -97,6 +97,7 @@ public:
TValuta(); TValuta();
TValuta(const char* cod, const TDate& dat, const real& cam); TValuta(const char* cod, const TDate& dat, const real& cam);
TValuta(const TRectype& rec) { get(rec); } TValuta(const TRectype& rec) { get(rec); }
TValuta(const TMask& m, short v, short d, short c) { get(m, v, d, c); }
virtual ~TValuta() {} virtual ~TValuta() {}
}; };
@ -133,9 +134,9 @@ public:
TPartita& partita() const; TPartita& partita() const;
TRiga_partite& riga() const { return *_riga; } // Riga partite TRiga_partite& riga() const { return *_riga; } // Riga partite
TImporto importo_pagato(bool val, int mode = 0x1) const; TImporto importo_pagato(bool val, int mode = 0x7) const;
TImporto importo_da_pagare(bool val) const; TImporto importo_da_pagare(bool val) const;
TImporto residuo(bool val, int mode = 0x1) const; // Differenza delle due funzioni precedenti TImporto residuo(bool val, int mode = 0x7) const; // Differenza delle due funzioni precedenti
TRiga_scadenze(TRiga_partite* riga); TRiga_scadenze(TRiga_partite* riga);
TRiga_scadenze(const TRiga_scadenze& s); TRiga_scadenze(const TRiga_scadenze& s);
@ -165,6 +166,7 @@ public:
TRiga_scadenze& new_row(int r = 0); TRiga_scadenze& new_row(int r = 0);
bool is_fattura() const; bool is_fattura() const;
bool is_nota_credito() const;
int ultima_ratapagata() const; int ultima_ratapagata() const;
int ultimo_pagamento(int rata) const; int ultimo_pagamento(int rata) const;
int rata_con_abbuoni_diffcam() const; int rata_con_abbuoni_diffcam() const;
@ -256,7 +258,7 @@ public:
char& old_ap, TImporto& old_abb, TImporto& old_diffcam, char& old_ap, TImporto& old_abb, TImporto& old_diffcam,
char& new_ap, TImporto& new_abb, TImporto& new_diffcam, char& new_ap, TImporto& new_abb, TImporto& new_diffcam,
bool update); bool update);
bool modifica_pagamento(const TRectype& new_pag); bool modifica_pagamento(const TRectype& new_pag, const TValuta& valuta, bool update);
static void carica_allineamento(); static void carica_allineamento();
char allineamento_richiesto() const; char allineamento_richiesto() const;