Correzione errori vari
git-svn-id: svn://10.65.10.50/trunk@2593 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
16f2e09c60
commit
f0fb8d09d2
@ -919,6 +919,7 @@ int TPrimanota_application::write(const TMask& m)
|
|||||||
check_saldi();
|
check_saldi();
|
||||||
|
|
||||||
bool salvaconto = FALSE;
|
bool salvaconto = FALSE;
|
||||||
|
const long old_nreg = numreg - (lasterr == _isreinsert ? 1 : 0);
|
||||||
|
|
||||||
if (iva() != nessuna_iva)
|
if (iva() != nessuna_iva)
|
||||||
{
|
{
|
||||||
@ -928,9 +929,12 @@ int TPrimanota_application::write(const TMask& m)
|
|||||||
switch (causale().tipomov())
|
switch (causale().tipomov())
|
||||||
{
|
{
|
||||||
case tm_fattura:
|
case tm_fattura:
|
||||||
write_scadenze(m); break; // Salva fattura
|
partite().update_reg(_rel->curr(), old_nreg);
|
||||||
|
write_scadenze(m); // Salva fattura
|
||||||
|
break;
|
||||||
case tm_nota_credito:
|
case tm_nota_credito:
|
||||||
salvaconto = TRUE; break; // Salva nota credito
|
salvaconto = TRUE; // Salva nota credito
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -954,7 +958,7 @@ int TPrimanota_application::write(const TMask& m)
|
|||||||
if (salvaconto)
|
if (salvaconto)
|
||||||
{
|
{
|
||||||
const long old_nreg = numreg - (lasterr == _isreinsert ? 1 : 0);
|
const long old_nreg = numreg - (lasterr == _isreinsert ? 1 : 0);
|
||||||
partite().update_reg(_rel->curr(), _rel->cg_rows(), old_nreg);
|
partite().update_reg(_rel->curr(), old_nreg);
|
||||||
partite().write();
|
partite().write();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,7 +979,7 @@ int TPrimanota_application::rewrite(const TMask& m)
|
|||||||
_saldi.registra();
|
_saldi.registra();
|
||||||
check_saldi();
|
check_saldi();
|
||||||
|
|
||||||
if (_is_saldaconto)
|
if (is_saldaconto())
|
||||||
{
|
{
|
||||||
bool salvaconto = FALSE;
|
bool salvaconto = FALSE;
|
||||||
if (iva() != nessuna_iva)
|
if (iva() != nessuna_iva)
|
||||||
@ -983,7 +987,10 @@ int TPrimanota_application::rewrite(const TMask& m)
|
|||||||
if (causale().tipomov() == tm_nota_credito)
|
if (causale().tipomov() == tm_nota_credito)
|
||||||
salvaconto = TRUE;
|
salvaconto = TRUE;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
partite().update_reg(_rel->curr());
|
||||||
write_scadenze(m);
|
write_scadenze(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -992,7 +999,7 @@ int TPrimanota_application::rewrite(const TMask& m)
|
|||||||
|
|
||||||
if (salvaconto)
|
if (salvaconto)
|
||||||
{
|
{
|
||||||
partite().update_reg(_rel->curr(), _rel->cg_rows());
|
partite().update_reg(_rel->curr());
|
||||||
partite().rewrite();
|
partite().rewrite();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1014,17 +1021,15 @@ bool TPrimanota_application::remove()
|
|||||||
|
|
||||||
if (is_saldaconto())
|
if (is_saldaconto())
|
||||||
{
|
{
|
||||||
TMask& m = curr_mask();
|
|
||||||
if (is_fattura())
|
if (is_fattura())
|
||||||
{
|
{
|
||||||
|
TMask& m = curr_mask();
|
||||||
m.reset(F_ANNORIF);
|
m.reset(F_ANNORIF);
|
||||||
m.reset(F_NUMRIF);
|
m.reset(F_NUMRIF);
|
||||||
write_scadenze(m);
|
write_scadenze(m);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const long nreg = m.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();
|
||||||
}
|
}
|
||||||
@ -1307,7 +1312,7 @@ long TPrimanota_application::calcola_m770(int tipo_coll, real& spese, real& comp
|
|||||||
TString_array& rcg = cgs().rows_array();
|
TString_array& rcg = cgs().rows_array();
|
||||||
TImporto imp;
|
TImporto imp;
|
||||||
|
|
||||||
for (int i = 0; i < rcg.items(); i++)
|
for (int i = rcg.items()-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
TToken_string& row = rcg.row(i);
|
TToken_string& row = rcg.row(i);
|
||||||
imp = row;
|
imp = row;
|
||||||
|
@ -81,7 +81,6 @@ BEGIN
|
|||||||
OUTPUT F_CODCAUS CODCAUS
|
OUTPUT F_CODCAUS CODCAUS
|
||||||
OUTPUT F_DESCRCAUS DESCR
|
OUTPUT F_DESCRCAUS DESCR
|
||||||
OUTPUT F_TIPODOC TIPODOC
|
OUTPUT F_TIPODOC TIPODOC
|
||||||
OUTPUT F_TIPOMOV TIPOMOV
|
|
||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
ADD RUN cg0 -4
|
ADD RUN cg0 -4
|
||||||
MESSAGE COPY,K_CODCAUS
|
MESSAGE COPY,K_CODCAUS
|
||||||
@ -116,13 +115,6 @@ BEGIN
|
|||||||
MESSAGE COPY,K_TIPODOC
|
MESSAGE COPY,K_TIPODOC
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_TIPOMOV 1
|
|
||||||
BEGIN
|
|
||||||
PROMPT 32 6 "Tipo movimento "
|
|
||||||
FIELD TIPOMOV
|
|
||||||
FLAGS "H"
|
|
||||||
END
|
|
||||||
|
|
||||||
DATE F_DATADOC
|
DATE F_DATADOC
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 7 "Data del documento "
|
PROMPT 1 7 "Data del documento "
|
||||||
@ -234,7 +226,7 @@ BEGIN
|
|||||||
MESSAGE COPY,K_TOTALE
|
MESSAGE COPY,K_TOTALE
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER SK_TOTDOCVAL 15 2
|
NUMBER SK_TOTDOCVAL 15 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 44 12 "Totale in valuta "
|
PROMPT 44 12 "Totale in valuta "
|
||||||
HELP ""
|
HELP ""
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "cg2100p.h"
|
#include "cg2100p.h"
|
||||||
|
|
||||||
|
#ifndef NO_TOOLBAR
|
||||||
|
|
||||||
TOOLBAR "" 0 20 0 2
|
TOOLBAR "" 0 20 0 2
|
||||||
|
|
||||||
BUTTON DLG_OK 10 2
|
BUTTON DLG_OK 10 2
|
||||||
@ -20,12 +22,13 @@ END
|
|||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
PAGE "Pagamento" -1 -1 77 20
|
PAGE "Pagamento" -1 -1 77 20
|
||||||
|
|
||||||
GROUPBOX S_RATA 78 6
|
GROUPBOX S_RATA 78 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "@BPartita ANNO PARTITA Riga: RIGA Rata: RATA del DATA"
|
PROMPT 1 1 "@BCliente COD Partita ANNO NUMERO Riga:RIGA Rata:RATA del DATA"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING S_NUMDOC 7
|
STRING S_NUMDOC 7
|
||||||
@ -121,38 +124,6 @@ BEGIN
|
|||||||
WARNING "L'importo in valuta deve essere specificato"
|
WARNING "L'importo in valuta deve essere specificato"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING S_VALUTA 3
|
|
||||||
BEGIN
|
|
||||||
PROMPT 37 8 "Valuta "
|
|
||||||
FLAGS "DHUZ"
|
|
||||||
GROUP 4
|
|
||||||
END
|
|
||||||
|
|
||||||
DATE S_DATACAMBIO
|
|
||||||
BEGIN
|
|
||||||
PROMPT 52 8 "Data cambio "
|
|
||||||
FLAGS "HR"
|
|
||||||
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_DATACAMBIO D0
|
|
||||||
OUTPUT S_CAMBIO R10
|
|
||||||
GROUP 4
|
|
||||||
CHECKTYPE SEARCH
|
|
||||||
END
|
|
||||||
|
|
||||||
NUMBER S_CAMBIO 15 5
|
|
||||||
BEGIN
|
|
||||||
PROMPT 37 9 "Cambio "
|
|
||||||
FLAGS "HRU"
|
|
||||||
GROUP 4
|
|
||||||
PICTURE ".5"
|
|
||||||
CHECKTYPE REQUIRED
|
|
||||||
END
|
|
||||||
|
|
||||||
RADIOBUTTON S_SALDOACC 1 24
|
RADIOBUTTON S_SALDOACC 1 24
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 9 ""
|
PROMPT 1 9 ""
|
||||||
@ -174,12 +145,14 @@ BEGIN
|
|||||||
ITEM "7|Tratta accettata"
|
ITEM "7|Tratta accettata"
|
||||||
ITEM "8|Rapporti interbancari diretti"
|
ITEM "8|Rapporti interbancari diretti"
|
||||||
ITEM "9|Bonifico"
|
ITEM "9|Bonifico"
|
||||||
|
FIELD LF_PARTITE->TIPOPAG
|
||||||
END
|
END
|
||||||
|
|
||||||
DATE S_DATAPAG
|
DATE S_DATAPAG
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 11 "Data pag. "
|
PROMPT 2 11 "Data pag. "
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
|
FIELD LF_PARTITE->DATAPAG
|
||||||
END
|
END
|
||||||
|
|
||||||
TEXT DLG_NULL
|
TEXT DLG_NULL
|
||||||
@ -269,6 +242,7 @@ BEGIN
|
|||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
DISPLAY "Codice" CODTAB
|
DISPLAY "Codice" CODTAB
|
||||||
COPY OUTPUT S_CODDESC
|
COPY OUTPUT S_CODDESC
|
||||||
|
FIELD LF_PARTITE->DESCAGG
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER S_VSABI 5
|
NUMBER S_VSABI 5
|
||||||
|
@ -1341,11 +1341,13 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
|||||||
if (a.is_fattura() && m.insert_mode())
|
if (a.is_fattura() && m.insert_mode())
|
||||||
{
|
{
|
||||||
TPagamento& pag = a.pagamento();
|
TPagamento& pag = a.pagamento();
|
||||||
|
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||||
|
const bool inv = cambio.in_valuta();
|
||||||
real imposta, imponibile;
|
real imposta, imponibile;
|
||||||
bool inv = pag.in_valuta();
|
|
||||||
if (inv)
|
if (inv)
|
||||||
{
|
{
|
||||||
imposta = m.get_real(F_IMPOSTE) / pag.cambio(); imposta.round(3);
|
const real il(m.get(F_IMPOSTE));
|
||||||
|
imposta = cambio.lit2val(il);
|
||||||
imponibile = m.get_real(SK_TOTDOCVAL) - imposta;
|
imponibile = m.get_real(SK_TOTDOCVAL) - imposta;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2139,24 +2141,19 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
|
|||||||
if (key == K_TAB && f.focusdirty())
|
if (key == K_TAB && f.focusdirty())
|
||||||
{
|
{
|
||||||
TPrimanota_application& a = app();
|
TPrimanota_application& a = app();
|
||||||
|
a.gioca_cambi();
|
||||||
|
|
||||||
if (a.iva() != nessuna_iva)
|
if (a.iva() != nessuna_iva)
|
||||||
{
|
{
|
||||||
a.add_cgs_tot(m);
|
a.add_cgs_tot(m);
|
||||||
if (m.insert_mode()) // Se si e' in inserimento provoca ricalcolo
|
if (m.insert_mode()) // Se si e' in inserimento provoca ricalcolo
|
||||||
m.field(F_CODIVA).on_hit(); // dello sheet iva e delle scadenze
|
m.field(F_CODIVA).on_hit(); // dello sheet iva e delle scadenze
|
||||||
else
|
|
||||||
{
|
|
||||||
if (a.is_fattura())
|
|
||||||
a.set_totale_pagamento();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (a.is_pagamento())
|
if (a.is_pagamento())
|
||||||
a.calcola_saldo();
|
a.calcola_saldo();
|
||||||
}
|
}
|
||||||
|
|
||||||
a.gioca_cambi();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == K_ENTER)
|
if (key == K_ENTER)
|
||||||
@ -2164,15 +2161,18 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
|
|||||||
const real totale(f.get());
|
const real totale(f.get());
|
||||||
if (totale.is_zero())
|
if (totale.is_zero())
|
||||||
ok = yesno_box("Totale documento nullo: continuare ugualmente?");
|
ok = yesno_box("Totale documento nullo: continuare ugualmente?");
|
||||||
|
|
||||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
if (ok)
|
||||||
if (cambio.in_valuta())
|
|
||||||
{
|
{
|
||||||
const real totval(m.get(SK_TOTDOCVAL));
|
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
|
||||||
const real totlit = cambio.val2lit(totval);
|
if (cambio.in_valuta())
|
||||||
if (totale != totlit)
|
{
|
||||||
ok = yesno_box("Il totale documento dovrebbe essere %s: continuare ugualmente?",
|
const real totval(m.get(SK_TOTDOCVAL));
|
||||||
totlit.string("."));
|
const real totlit = cambio.val2lit(totval);
|
||||||
|
if (totale != totlit)
|
||||||
|
ok = yesno_box("Il totale documento in lire dovrebbe essere %s: continuare ugualmente?",
|
||||||
|
totlit.string("."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2183,16 +2183,12 @@ bool TPrimanota_application::totdocval_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
if (key == K_TAB && f.focusdirty())
|
if (key == K_TAB && f.focusdirty())
|
||||||
{
|
{
|
||||||
app().gioca_cambi();
|
TPrimanota_application& a = app();
|
||||||
|
a.gioca_cambi();
|
||||||
|
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
if (app().is_fattura()) // Se e' una fattura
|
if (a.is_fattura() && m.insert_mode())
|
||||||
{
|
a.set_scadenze(m);
|
||||||
if (m.insert_mode())
|
|
||||||
app().set_scadenze(m);
|
|
||||||
else
|
|
||||||
app().set_totale_pagamento();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2393,7 +2389,7 @@ bool TPrimanota_application::activate_numrif(bool init_pag)
|
|||||||
{
|
{
|
||||||
const TString16 dt(m.get(F_DATADOC));
|
const TString16 dt(m.get(F_DATADOC));
|
||||||
set_pagamento(NULL, dt); // Reset pagamento
|
set_pagamento(NULL, dt); // Reset pagamento
|
||||||
set_totale_pagamento();
|
set_totale_pagamento(TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
set_scadenze(m); // Inizializza pagamento
|
set_scadenze(m); // Inizializza pagamento
|
||||||
|
@ -225,7 +225,7 @@ protected:
|
|||||||
TPagamento& pagamento() const;
|
TPagamento& pagamento() const;
|
||||||
|
|
||||||
void set_pagamento(const char* c, const char* d);
|
void set_pagamento(const char* c, const char* d);
|
||||||
void set_totale_pagamento();
|
void set_totale_pagamento(bool update);
|
||||||
void reset_pagamento();
|
void reset_pagamento();
|
||||||
void set_scadenze(TMask& m);
|
void set_scadenze(TMask& m);
|
||||||
bool read_scadenze(TMask& m);
|
bool read_scadenze(TMask& m);
|
||||||
|
@ -271,8 +271,10 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
const TString is(imp.string("."));
|
const TString is(imp.string("."));
|
||||||
const TString ts(totlit.string("."));
|
const TString ts(totlit.string("."));
|
||||||
ok = error_box("Il totale in lire delle rate e' %s mentre\n"
|
ok = yesno_box("Il totale in lire delle rate e' %s mentre\n"
|
||||||
"il totale del documento e' %s.", (const char *)is, (const char *)ts);
|
"il totale del documento e' %s.\n"
|
||||||
|
"Si desidera registrare ugualmente?",
|
||||||
|
(const char *)is, (const char *)ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -675,7 +677,7 @@ void TPrimanota_application::set_pagamento(const char* c, const char* d)
|
|||||||
_pag = new TPagamento(c, d);
|
_pag = new TPagamento(c, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPrimanota_application::set_totale_pagamento()
|
void TPrimanota_application::set_totale_pagamento(bool update)
|
||||||
{
|
{
|
||||||
const TMask& m = curr_mask();
|
const TMask& m = curr_mask();
|
||||||
TPagamento& pag = pagamento();
|
TPagamento& pag = pagamento();
|
||||||
@ -697,7 +699,7 @@ void TPrimanota_application::set_totale_pagamento()
|
|||||||
pag.set_total(imponibile, imposta, spese);
|
pag.set_total(imponibile, imposta, spese);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m.is_running())
|
if (update)
|
||||||
{
|
{
|
||||||
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
||||||
pagamento().set_sheet(ps); // Aggiorna lo sheet
|
pagamento().set_sheet(ps); // Aggiorna lo sheet
|
||||||
@ -707,10 +709,10 @@ void TPrimanota_application::set_totale_pagamento()
|
|||||||
|
|
||||||
void TPrimanota_application::set_scadenze(TMask& m)
|
void TPrimanota_application::set_scadenze(TMask& m)
|
||||||
{
|
{
|
||||||
const TString16 cp(m.get(F_CODPAG));
|
const TString cp(m.get(F_CODPAG));
|
||||||
const TString16 dt(m.get(F_DATADOC));
|
const TString dt(m.get(F_DATADOC));
|
||||||
set_pagamento(cp, dt);
|
set_pagamento(cp, dt);
|
||||||
set_totale_pagamento();
|
set_totale_pagamento(FALSE);
|
||||||
|
|
||||||
TPagamento& pag = pagamento();
|
TPagamento& pag = pagamento();
|
||||||
if (m.field(FS_RECALC).enabled())
|
if (m.field(FS_RECALC).enabled())
|
||||||
@ -771,7 +773,7 @@ bool TPrimanota_application::read_scadenze(TMask& m)
|
|||||||
warning_box("Gli importi delle scadenze non corrispondono al totale documento");
|
warning_box("Gli importi delle scadenze non corrispondono al totale documento");
|
||||||
}
|
}
|
||||||
|
|
||||||
set_totale_pagamento();
|
set_totale_pagamento(FALSE);
|
||||||
|
|
||||||
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
||||||
|
|
||||||
@ -850,6 +852,8 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
|||||||
|
|
||||||
TPartita* oldgame = partite().first();
|
TPartita* oldgame = partite().first();
|
||||||
TPartita* newgame = NULL;
|
TPartita* newgame = NULL;
|
||||||
|
|
||||||
|
int nuova_riga = 0;
|
||||||
|
|
||||||
if (anno > 0 && !numpart.blank())
|
if (anno > 0 && !numpart.blank())
|
||||||
{
|
{
|
||||||
@ -868,6 +872,8 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
|||||||
|
|
||||||
const int row = newgame->prima_fattura(nreg); // Riga fattura di questo movimento
|
const int row = newgame->prima_fattura(nreg); // Riga fattura di questo movimento
|
||||||
TRiga_partite& partita = row <= 0 ? newgame->new_row() : newgame->riga(row);
|
TRiga_partite& partita = row <= 0 ? newgame->new_row() : newgame->riga(row);
|
||||||
|
nuova_riga = partita.get_int(PART_NRIGA);
|
||||||
|
|
||||||
TPagamento& pag = pagamento();
|
TPagamento& pag = pagamento();
|
||||||
|
|
||||||
// put data on partita
|
// put data on partita
|
||||||
@ -946,7 +952,9 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
|||||||
"pagamenti relativi nella nuova partita?");
|
"pagamenti relativi nella nuova partita?");
|
||||||
}
|
}
|
||||||
if (sposta)
|
if (sposta)
|
||||||
oldgame->sposta_riga(rigafatt, *newgame);
|
{
|
||||||
|
oldgame->sposta_riga(rigafatt, *newgame, nuova_riga);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oldgame->scollega_pagamenti(rigafatt);
|
oldgame->scollega_pagamenti(rigafatt);
|
||||||
@ -956,7 +964,7 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oldgame->sposta_riga(rigafatt, *newgame);
|
oldgame->sposta_riga(rigafatt, *newgame, nuova_riga);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
244
cg/cg2105.cpp
244
cg/cg2105.cpp
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#ifdef __EXTRA__
|
#ifdef __EXTRA__
|
||||||
#include "saldacon.h"
|
#include "saldacon.h"
|
||||||
|
#include "sc0100p.h"
|
||||||
#else
|
#else
|
||||||
#include "cg2100.h" // Campi maschere prima nota
|
#include "cg2100.h" // Campi maschere prima nota
|
||||||
#include "cg2102.h" // Applicazione di prima nota
|
#include "cg2102.h" // Applicazione di prima nota
|
||||||
@ -31,11 +32,6 @@ class TGame_mask : public TMask
|
|||||||
bool _changed; // Flag di modifica partite
|
bool _changed; // Flag di modifica partite
|
||||||
bool _valfirst; // La colonna della valuta precede le lire
|
bool _valfirst; // La colonna della valuta precede le lire
|
||||||
|
|
||||||
tipo_movimento _tipomov; // Dati per la creazione di un nuovo movimento
|
|
||||||
char _sezione;
|
|
||||||
TDate _datad;
|
|
||||||
TString _codpag, _descr, _numdoc;
|
|
||||||
|
|
||||||
TDecoder _causali; // Decodificatore delle causali
|
TDecoder _causali; // Decodificatore delle causali
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -55,15 +51,18 @@ protected:
|
|||||||
void fill_partite();
|
void fill_partite();
|
||||||
|
|
||||||
void aggiorna_residuo();
|
void aggiorna_residuo();
|
||||||
|
|
||||||
|
int update_partita(const TRectype& game, const TImporto& s, const TImporto& d,
|
||||||
|
const TImporto& p, const TImporto& i, int prow);
|
||||||
int update_partita(const TPartita& game, int prow);
|
int update_partita(const TPartita& game, int prow);
|
||||||
|
int update_partita(const TRectype& game, int prow);
|
||||||
|
|
||||||
void update_saldo_clifo();
|
void update_saldo_clifo();
|
||||||
int nuova_riga(TPartita& partita) const;
|
int nuova_riga(TPartita& partita, tipo_movimento tm) const;
|
||||||
int nuovo_pagamento(TPartita& partita, int nriga, int rata) const;
|
int nuovo_pagamento(TPartita& partita, int nriga, int rata, tipo_movimento tm) const;
|
||||||
bool edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) const;
|
bool edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) const;
|
||||||
|
|
||||||
char calcola_sezione() const;
|
char calcola_sezione() const;
|
||||||
void align_number(TMask_field& f) const;
|
|
||||||
long number_distance(const char* key, const char* num) const;
|
long number_distance(const char* key, const char* num) const;
|
||||||
bool same_number(const char* key, const char* num) const;
|
bool same_number(const char* key, const char* num) const;
|
||||||
void append_conto(TString& s) const;
|
void append_conto(TString& s) const;
|
||||||
@ -101,7 +100,8 @@ class TPay_mask : public TMask
|
|||||||
real _da_pagare, _pagabile;
|
real _da_pagare, _pagabile;
|
||||||
const TGame_mask& _parent;
|
const TGame_mask& _parent;
|
||||||
|
|
||||||
TDecoder _causale;
|
TDecoder _causale;
|
||||||
|
bool _can_solder;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool importo_handler(TMask_field& f, KEY k);
|
static bool importo_handler(TMask_field& f, KEY k);
|
||||||
@ -129,15 +129,17 @@ TPay_mask::TPay_mask(const TGame_mask& parent)
|
|||||||
void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
||||||
const TImporto& residuo)
|
const TImporto& residuo)
|
||||||
{
|
{
|
||||||
TRelation rel(LF_PAGSCA); // Working relation
|
|
||||||
rel.curr() = oldpag;
|
|
||||||
autoload(&rel); // Load current record on mask
|
|
||||||
|
|
||||||
const TPartita& p = scad.partita();
|
const TPartita& p = scad.partita();
|
||||||
const int nrigp = oldpag.get_int(PAGSCA_NRIGP);
|
const int nrigp = oldpag.get_int(PAGSCA_NRIGP);
|
||||||
const TRiga_partite& sum = p.riga(nrigp);
|
const TRiga_partite& sum = p.riga(nrigp);
|
||||||
const TRiga_partite& fatt = scad.riga();
|
const TRiga_partite& fatt = scad.riga();
|
||||||
const bool assigned = oldpag.get_int(PAGSCA_NRIGA) != TPartita::UNASSIGNED;
|
const bool assigned = oldpag.get_int(PAGSCA_NRIGA) != TPartita::UNASSIGNED;
|
||||||
|
|
||||||
|
TRelation rel(LF_PAGSCA); // Working relation
|
||||||
|
rel.add(LF_PARTITE, "ANNO=ANNO|NUMERO=NUMERO");
|
||||||
|
rel.curr() = oldpag;
|
||||||
|
rel.curr(LF_PARTITE) = sum;
|
||||||
|
autoload(&rel); // Load current record on mask
|
||||||
|
|
||||||
TMask_field& group = field(S_RATA);
|
TMask_field& group = field(S_RATA);
|
||||||
TString prompt(80);
|
TString prompt(80);
|
||||||
@ -172,10 +174,6 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
|||||||
}
|
}
|
||||||
set(S_DESCR, desfat);
|
set(S_DESCR, desfat);
|
||||||
|
|
||||||
set(S_DATAPAG, sum.get(PART_DATAPAG)); // Data pagamento
|
|
||||||
set(S_TIPOPAG, sum.get(PART_TIPOPAG)); // Tipo pagamento
|
|
||||||
set(S_DESCAGG, sum.get(PART_DESCR)); // Descrizione documento
|
|
||||||
|
|
||||||
const bool in_valuta = fatt.in_valuta();
|
const bool in_valuta = fatt.in_valuta();
|
||||||
|
|
||||||
if (assigned)
|
if (assigned)
|
||||||
@ -192,7 +190,6 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
|||||||
_da_pagare = ZERO;
|
_da_pagare = ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TReal_field& res = (TReal_field&)field(S_RESIDUORATA);
|
TReal_field& res = (TReal_field&)field(S_RESIDUORATA);
|
||||||
res.set_decimals(in_valuta ? 3 : 0);
|
res.set_decimals(in_valuta ? 3 : 0);
|
||||||
if (get(S_SALDOACC)[0] != 'S')
|
if (get(S_SALDOACC)[0] != 'S')
|
||||||
@ -230,16 +227,16 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
|||||||
|
|
||||||
// Il flag di saldo/acconto e' attivo solo se non ci sono acconti, cioe':
|
// Il flag di saldo/acconto e' attivo solo se non ci sono acconti, cioe':
|
||||||
// pagamento non assegnato o con data documento antecedente quella della fattura
|
// pagamento non assegnato o con data documento antecedente quella della fattura
|
||||||
bool sa = oldpag.get_int(PAGSCA_NRIGA) != TPartita::UNASSIGNED;
|
_can_solder = oldpag.get_int(PAGSCA_NRIGA) != TPartita::UNASSIGNED;
|
||||||
if (sa)
|
if (_can_solder)
|
||||||
{
|
{
|
||||||
const tipo_movimento tm = sum.tipo();
|
const tipo_movimento tm = sum.tipo();
|
||||||
sa = !(tm == tm_nota_credito || tm == tm_insoluto);
|
_can_solder = !(tm == tm_nota_credito || tm == tm_insoluto);
|
||||||
if (sa)
|
if (_can_solder)
|
||||||
{
|
{
|
||||||
const TDate datasca(fatt.get(PART_DATADOC));
|
const TDate datasca(fatt.get(PART_DATADOC));
|
||||||
const TDate datapag(sum.get(PART_DATADOC));
|
const TDate datapag(sum.get(PART_DATADOC));
|
||||||
sa = datapag >= datasca;
|
_can_solder = datapag >= datasca;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -247,7 +244,7 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
|
|||||||
hide(S_RESIDUORATA); // Se non assegnato nascondi residuo rata
|
hide(S_RESIDUORATA); // Se non assegnato nascondi residuo rata
|
||||||
}
|
}
|
||||||
// Mostra saldo solo se non e' ne' un acconto, ne' una nota di credito
|
// Mostra saldo solo se non e' ne' un acconto, ne' una nota di credito
|
||||||
enable(S_SALDOACC, sa);
|
enable(S_SALDOACC, _can_solder);
|
||||||
|
|
||||||
show(-3, in_valuta); // Attiva campi relativi alla valuta
|
show(-3, in_valuta); // Attiva campi relativi alla valuta
|
||||||
show(-4, in_valuta); // Attiva campi relativi al cambio
|
show(-4, in_valuta); // Attiva campi relativi al cambio
|
||||||
@ -286,7 +283,7 @@ void TPay_mask::gioca_cambi(int force)
|
|||||||
const real totale = get(S_IMPORTO);
|
const real totale = get(S_IMPORTO);
|
||||||
const real totval = get(S_IMPORTOVAL);
|
const real totval = get(S_IMPORTOVAL);
|
||||||
#ifdef __EXTRA__
|
#ifdef __EXTRA__
|
||||||
const TValuta cambio(this, S_VALUTA, S_DATACAMBIO, S_CAMBIO);
|
const TValuta cambio(*this, E_VALUTA, E_DATACAMBIO, E_CAMBIO);
|
||||||
#else
|
#else
|
||||||
const TValuta cambio(_parent, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
const TValuta cambio(_parent, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||||
#endif
|
#endif
|
||||||
@ -333,18 +330,27 @@ bool TPay_mask::importo_handler(TMask_field& f, KEY k)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (k == K_TAB && f.focusdirty())
|
if (k == K_TAB && f.focusdirty())
|
||||||
{
|
{
|
||||||
if (m.field(S_IMPORTOVAL).active())
|
const bool in_valuta = m.field(S_IMPORTOVAL).active();
|
||||||
|
if (in_valuta)
|
||||||
m.gioca_cambi();
|
m.gioca_cambi();
|
||||||
|
|
||||||
real i(f.get());
|
real i(f.get());
|
||||||
if (m.field(S_RITENUTE).active())
|
if (m.field(S_RITENUTE).active())
|
||||||
i += real(m.get(S_RITENUTE));
|
i += real(m.get(S_RITENUTE));
|
||||||
|
|
||||||
if (i >= m._da_pagare && m.mode() == NO_MODE && m.field(S_SALDOACC).active())
|
TMask_field& sa = m.field(S_SALDOACC);
|
||||||
m.set(S_SALDOACC, "S");
|
if (m._can_solder && m.mode() == NO_MODE)
|
||||||
|
{
|
||||||
|
if (i >= m._da_pagare)
|
||||||
|
sa.set("S");
|
||||||
|
/*
|
||||||
|
Eliminato perche' rende ingestibili due pagamenti in valuta a saldo
|
||||||
|
if (in_valuta) sa.enable(i != m._da_pagare);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
if (m.get(S_SALDOACC)[0] != 'S')
|
if (sa.get()[0] != 'S')
|
||||||
{
|
{
|
||||||
const real residuo(m._da_pagare - i);
|
const real residuo(m._da_pagare - i);
|
||||||
m.set(S_RESIDUORATA, residuo);
|
m.set(S_RESIDUORATA, residuo);
|
||||||
@ -423,6 +429,34 @@ bool TPay_mask::conto_handler(TMask_field& f, KEY k)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Maschera gestione nuovo pagamento / fattura
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TNew_mask : public TMask
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TNew_mask(char tipocf, bool fatt, bool edit);
|
||||||
|
virtual ~TNew_mask() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
TNew_mask::TNew_mask(char tipocf, bool fatt, bool edit)
|
||||||
|
: TMask(fatt ? "cg2100n" : "sc0100n")
|
||||||
|
{
|
||||||
|
#ifdef __EXTRA__
|
||||||
|
enable(P_NUOVO);
|
||||||
|
#else
|
||||||
|
disable(P_NUOVO);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enable(P_ANNO, edit);
|
||||||
|
enable(P_NUMERO, edit);
|
||||||
|
if (edit)
|
||||||
|
first_focus(P_NUMERO);
|
||||||
|
|
||||||
|
const char a = TPartita::allineamento_richiesto(tipocf);
|
||||||
|
field(P_NUMERO).set_justify(a == 'R');
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Maschera partite
|
// Maschera partite
|
||||||
@ -574,9 +608,7 @@ bool TGame_mask::cambio_handler(TMask_field& f, KEY k)
|
|||||||
// Aggiorna il campo con il residuo da spendere sui pagamenti
|
// Aggiorna il campo con il residuo da spendere sui pagamenti
|
||||||
void TGame_mask::aggiorna_residuo()
|
void TGame_mask::aggiorna_residuo()
|
||||||
{
|
{
|
||||||
#ifdef __EXTRA__
|
#ifndef __EXTRA__
|
||||||
return ZERO;
|
|
||||||
#else
|
|
||||||
_importo = app().get_cgs_imp(_numrig-1); // Importo sulla riga contabile
|
_importo = app().get_cgs_imp(_numrig-1); // Importo sulla riga contabile
|
||||||
_residuo = _importo;
|
_residuo = _importo;
|
||||||
|
|
||||||
@ -958,7 +990,7 @@ char TGame_mask::calcola_sezione() const
|
|||||||
return sezione;
|
return sezione;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TGame_mask::nuova_riga(TPartita& partita) const
|
int TGame_mask::nuova_riga(TPartita& partita, tipo_movimento tm) const
|
||||||
{
|
{
|
||||||
TRiga_partite& part = partita.new_row(); // Creazione nuova riga vuota
|
TRiga_partite& part = partita.new_row(); // Creazione nuova riga vuota
|
||||||
const int nriga = part.get_int(PART_NRIGA);
|
const int nriga = part.get_int(PART_NRIGA);
|
||||||
@ -975,30 +1007,11 @@ int TGame_mask::nuova_riga(TPartita& partita) const
|
|||||||
const TValuta valuta(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
const TValuta valuta(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||||
valuta.put(part);
|
valuta.put(part);
|
||||||
|
|
||||||
#ifdef __EXTRA__
|
part.put(PART_TIPOMOV, (int)tm);
|
||||||
part.put(PART_TIPOMOV, (int)_tipomov);
|
|
||||||
part.put(PART_DESCR, _descr);
|
#ifndef __EXTRA__
|
||||||
part.put(PART_NUMDOC, _numdoc);
|
|
||||||
part.put(PART_DATADOC, _datadoc);
|
|
||||||
part.put(PART_DATAPAG, _datadoc);
|
|
||||||
part.put(PART_DATAREG, TDate(TODAY));
|
|
||||||
part.put(PART_SEZ, _sezione);
|
|
||||||
part.put(PART_SEZABB, _sezione);
|
|
||||||
part.put(PART_SEZDIFCAM,_sezione);
|
|
||||||
if (_tipomov == tm_fattura)
|
|
||||||
{
|
|
||||||
part.put(PART_IMPORTO, _importo.valore());
|
|
||||||
if (valuta.in_valuta())
|
|
||||||
{
|
|
||||||
const real impval = valuta.lit2val(_importo.valore());
|
|
||||||
part.put(PART_IMPORTOVAL, impval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
TMask& cm = app().curr_mask();
|
TMask& cm = app().curr_mask();
|
||||||
const TCausale& causale = app().causale();
|
const TCausale& causale = app().causale();
|
||||||
const tipo_movimento tm = (tipo_movimento)causale.tipomov();
|
|
||||||
part.put(PART_TIPOMOV, (int)tm);
|
|
||||||
part.put(PART_NUMDOC, cm.get(F_NUMDOC));
|
part.put(PART_NUMDOC, cm.get(F_NUMDOC));
|
||||||
part.put(PART_DATADOC, cm.get(F_DATADOC));
|
part.put(PART_DATADOC, cm.get(F_DATADOC));
|
||||||
part.put(PART_DATAREG, cm.get(F_DATAREG));
|
part.put(PART_DATAREG, cm.get(F_DATAREG));
|
||||||
@ -1033,10 +1046,10 @@ int TGame_mask::nuova_riga(TPartita& partita) const
|
|||||||
return nriga;
|
return nriga;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata) const
|
int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata, tipo_movimento tm) const
|
||||||
{
|
{
|
||||||
#ifdef __EXTRA__
|
#ifdef __EXTRA__
|
||||||
const int nrigp = nuova_riga(partita);
|
const int nrigp = nuova_riga(partita, tm);
|
||||||
if (nriga > 0 && nriga != TPartita::UNASSIGNED)
|
if (nriga > 0 && nriga != TPartita::UNASSIGNED)
|
||||||
{
|
{
|
||||||
const TRiga_partite& fattura = partita.riga(nriga);
|
const TRiga_partite& fattura = partita.riga(nriga);
|
||||||
@ -1047,7 +1060,7 @@ int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata) const
|
|||||||
#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
|
||||||
nrigp = nuova_riga(partita);
|
nrigp = nuova_riga(partita, tm);
|
||||||
#endif
|
#endif
|
||||||
TRectype& pagamento = partita.pagamento(nriga, rata, nrigp); // Crea nuovo pagamento
|
TRectype& pagamento = partita.pagamento(nriga, rata, nrigp); // Crea nuovo pagamento
|
||||||
|
|
||||||
@ -1122,14 +1135,27 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
return f.error_box("La fattura deve essere pagata in %s.", (const char*)c);
|
return f.error_box("La fattura deve essere pagata in %s.", (const char*)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tipo_movimento tm;
|
||||||
|
|
||||||
#ifdef __EXTRA__
|
#ifdef __EXTRA__
|
||||||
gm._tipomov = tm_pagamento;
|
TMask* nm = new TNew_mask(gm.conto().tipo(), FALSE, FALSE);
|
||||||
gm._descr = "";
|
nm->set(P_ANNO, game.anno());
|
||||||
gm._numdoc = "";
|
nm->set(P_NUMERO, game.numero());
|
||||||
gm._datadoc = TDate(TODAY);
|
const KEY k = nm->run();
|
||||||
gm._sezione = game.riga(nriga).sezione() == 'D' ? 'A' : 'D';
|
delete nm;
|
||||||
|
|
||||||
|
if (k == K_ENTER)
|
||||||
|
tm = (tipo_movimento)nm->get_int(P_NUOVO);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (was == NULL) giochi.destroy(game);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
tm = (tipo_movimento)app().causale().tipomov();
|
||||||
#endif
|
#endif
|
||||||
nrigp = gm.nuovo_pagamento(game, nriga, nrata);
|
|
||||||
|
nrigp = gm.nuovo_pagamento(game, nriga, nrata, tm);
|
||||||
nreg = gm._numreg;
|
nreg = gm._numreg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1167,11 +1193,11 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
#else
|
#else
|
||||||
if (nreg != gm._numreg || nrata == 0)
|
if (nreg != gm._numreg || nrata == 0)
|
||||||
{
|
{
|
||||||
if (was == NULL) giochi.destroy(game);
|
|
||||||
if (nreg == 0)
|
if (nreg == 0)
|
||||||
f.error_box("Utilizzare la gestione extra-contabile");
|
f.error_box("Utilizzare la gestione extra-contabile");
|
||||||
else
|
else
|
||||||
f.error_box("Modificare il movimento %ld", nreg);
|
f.error_box("Modificare il movimento %ld", nreg);
|
||||||
|
if (was == NULL) giochi.destroy(game);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1215,14 +1241,6 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TGame_mask::align_number(TMask_field& f) const
|
|
||||||
{
|
|
||||||
const TPartita game(conto(), 0, "*");
|
|
||||||
const char a = game.allineamento_richiesto();
|
|
||||||
f.set_justify(a == 'R');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_SPACE)
|
if (k == K_SPACE)
|
||||||
@ -1231,16 +1249,15 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
|||||||
int anno;
|
int anno;
|
||||||
TString numero;
|
TString numero;
|
||||||
|
|
||||||
TMask* new_game = new TMask("cg2100n"); // We must create mask on the heap!
|
TMask* new_game = new TNew_mask(gm.conto().tipo(), TRUE, TRUE);
|
||||||
gm.align_number(new_game->field(P_NUMERO));
|
|
||||||
new_game->first_focus(P_NUMERO);
|
|
||||||
|
|
||||||
|
tipo_movimento tm;
|
||||||
|
|
||||||
#ifndef __EXTRA__
|
#ifndef __EXTRA__
|
||||||
const TMask& cm = app().curr_mask();
|
const TMask& cm = app().curr_mask();
|
||||||
new_game->disable(P_NUOVO);
|
tm = (tipo_movimento)app().causale().tipomov();
|
||||||
gm._tipomov = (tipo_movimento)app().causale().tipomov();
|
new_game->set(P_NUOVO, tm);
|
||||||
new_game->set(P_NUOVO, gm._tipomov);
|
if (tm == tm_nota_credito)
|
||||||
if (gm._tipomov == 2)
|
|
||||||
{
|
{
|
||||||
new_game->set(P_ANNO, cm.get(F_ANNORIF));
|
new_game->set(P_ANNO, cm.get(F_ANNORIF));
|
||||||
new_game->set(P_NUMERO, cm.get(F_NUMRIF));
|
new_game->set(P_NUMERO, cm.get(F_NUMRIF));
|
||||||
@ -1251,7 +1268,7 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
|||||||
anno = new_game->get_int(P_ANNO);
|
anno = new_game->get_int(P_ANNO);
|
||||||
numero = new_game->get(P_NUMERO);
|
numero = new_game->get(P_NUMERO);
|
||||||
|
|
||||||
gm._tipomov = (tipo_movimento)new_game->get_int(P_NUOVO);
|
tm = (tipo_movimento)new_game->get_int(P_NUOVO);
|
||||||
|
|
||||||
delete new_game; new_game = NULL;
|
delete new_game; new_game = NULL;
|
||||||
|
|
||||||
@ -1259,14 +1276,16 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
|||||||
{
|
{
|
||||||
TPartita& game = app().partite().partita(gm.conto(), anno, numero);
|
TPartita& game = app().partite().partita(gm.conto(), anno, numero);
|
||||||
|
|
||||||
if (gm._tipomov != tm_fattura)
|
if (tm != tm_fattura)
|
||||||
{
|
{
|
||||||
|
#ifndef __EXTRA__
|
||||||
if (game.ok())
|
if (game.ok())
|
||||||
return error_box("La partita %d '%s' esiste gia'.", anno, (const char*)game.numero());
|
return error_box("La partita %d '%s' esiste gia'.", anno, (const char*)game.numero());
|
||||||
|
#endif
|
||||||
|
|
||||||
const int nriga = TPartita::UNASSIGNED;
|
const int nriga = TPartita::UNASSIGNED;
|
||||||
const int nrata = TPartita::UNASSIGNED;
|
const int nrata = TPartita::UNASSIGNED;
|
||||||
const int nrigp = gm.nuovo_pagamento(game, nriga, nrata);
|
const int nrigp = gm.nuovo_pagamento(game, nriga, nrata, tm);
|
||||||
gm.edit_pagamento(game, nriga, nrata, nrigp);
|
gm.edit_pagamento(game, nriga, nrata, nrigp);
|
||||||
}
|
}
|
||||||
#ifdef __EXTRA__
|
#ifdef __EXTRA__
|
||||||
@ -1345,20 +1364,14 @@ TImporto TGame_mask::get_importo(TToken_string& s, int pos) const
|
|||||||
return TImporto(sez, i);
|
return TImporto(sez, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TGame_mask::update_partita(const TRectype& riga,
|
||||||
int TGame_mask::update_partita(const TPartita& game, int prow)
|
const TImporto& saldo, const TImporto& doc,
|
||||||
|
const TImporto& pag, const TImporto& imp, int prow)
|
||||||
{
|
{
|
||||||
TImporto saldo, doc, pag, imp;
|
|
||||||
game.calcola_saldo(saldo, doc, pag, imp);
|
|
||||||
|
|
||||||
int riga_fatt = game.prima_fattura();
|
|
||||||
if (riga_fatt <= 0) riga_fatt = game.first(); // E' un anticipo
|
|
||||||
|
|
||||||
TSheet_field& games = partite();
|
TSheet_field& games = partite();
|
||||||
TToken_string &r = games.row(prow); // Stringa di lavoro per lo sheet
|
TToken_string &r = games.row(prow); // Stringa di lavoro per lo sheet
|
||||||
if (game.esiste(riga_fatt)) // Esiste veramente
|
if (!riga.empty()) // Esiste veramente
|
||||||
{
|
{
|
||||||
const TRiga_partite& riga = game.riga(riga_fatt);
|
|
||||||
r.cut(0);
|
r.cut(0);
|
||||||
r.add(riga.get(PART_ANNO)); r.right_just(4); // Mette gli spazi se ce n'e' bisogno
|
r.add(riga.get(PART_ANNO)); r.right_just(4); // Mette gli spazi se ce n'e' bisogno
|
||||||
r.add(riga.get(PART_NUMPART));
|
r.add(riga.get(PART_NUMPART));
|
||||||
@ -1390,13 +1403,32 @@ int TGame_mask::update_partita(const TPartita& game, int prow)
|
|||||||
|
|
||||||
if (prow == 0)
|
if (prow == 0)
|
||||||
{
|
{
|
||||||
const char all = game.allineamento_richiesto();
|
const char all = TPartita::allineamento_richiesto(conto().tipo());
|
||||||
field(P_NUMERO).set_justify(all == 'R');
|
field(P_NUMERO).set_justify(all == 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
return prow;
|
return prow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TGame_mask::update_partita(const TPartita& part, int prow)
|
||||||
|
{
|
||||||
|
int r = part.prima_fattura();
|
||||||
|
if (r <= 0) r = part.first();
|
||||||
|
|
||||||
|
TImporto saldo, doc, pag, imp;
|
||||||
|
part.calcola_saldo(saldo, doc, pag, imp);
|
||||||
|
return update_partita(part.riga(r), saldo, doc, pag, imp, prow);
|
||||||
|
}
|
||||||
|
|
||||||
|
int TGame_mask::update_partita(const TRectype& riga, int prow)
|
||||||
|
{
|
||||||
|
TImporto saldo, doc, pag, imp;
|
||||||
|
|
||||||
|
TRectype rec = riga;
|
||||||
|
const int err = TPartita::read_saldo(rec, saldo, doc, pag, imp);
|
||||||
|
return update_partita(rec, saldo, doc, pag, imp, prow);
|
||||||
|
}
|
||||||
|
|
||||||
void TGame_mask::update_saldo_clifo()
|
void TGame_mask::update_saldo_clifo()
|
||||||
{
|
{
|
||||||
TString_array& s = partite().rows_array();
|
TString_array& s = partite().rows_array();
|
||||||
@ -1505,11 +1537,11 @@ void TGame_mask::fill_partite()
|
|||||||
{
|
{
|
||||||
if (!giochi.exist(curpar))
|
if (!giochi.exist(curpar))
|
||||||
{
|
{
|
||||||
TPartita game(curpar);
|
if (all || curpar.get_bool(PART_CHIUSA) == FALSE)
|
||||||
if (all || !game.chiusa())
|
update_partita(curpar, -1);
|
||||||
update_partita(game, -1);
|
|
||||||
}
|
}
|
||||||
curpar.put(PART_NRIGA, 9999); // Forza lettura partita successiva nella prossima read
|
// Forza lettura partita successiva nella prossima read
|
||||||
|
curpar.put(PART_NRIGA, (int)TPartita::UNASSIGNED);
|
||||||
}
|
}
|
||||||
|
|
||||||
a.sort();
|
a.sort();
|
||||||
@ -1584,9 +1616,6 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
|
|||||||
somma.put(PART_DESCR, m.get(S_DESCAGG)); // Aggiorna descrizione (comune alla riga)
|
somma.put(PART_DESCR, m.get(S_DESCAGG)); // Aggiorna descrizione (comune alla riga)
|
||||||
somma.put(PART_DATAPAG, m.get(S_DATAPAG)); // Aggiorna data pagamento (comune alla riga)
|
somma.put(PART_DATAPAG, m.get(S_DATAPAG)); // Aggiorna data pagamento (comune alla riga)
|
||||||
somma.put(PART_TIPOPAG, m.get(S_TIPOPAG)); // Aggiorna tipo pagamento (comune alla riga)
|
somma.put(PART_TIPOPAG, m.get(S_TIPOPAG)); // Aggiorna tipo pagamento (comune alla riga)
|
||||||
#ifndef __EXTRA__
|
|
||||||
// aggiorna_sorelle(somma); // Tolta chiamata alla aggiorna sorelle lasciare la funzione perche potrebbe servire in futuro
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TValuta val;
|
TValuta val;
|
||||||
@ -1624,11 +1653,10 @@ bool TPrimanota_application::edit_partite(const TMask& m, int riga)
|
|||||||
|
|
||||||
TMovimentoPN* pn = (TMovimentoPN*)get_relation();
|
TMovimentoPN* pn = (TMovimentoPN*)get_relation();
|
||||||
curr_mask().autosave(pn); // Aggiorna i dati della testata sulle partite
|
curr_mask().autosave(pn); // Aggiorna i dati della testata sulle partite
|
||||||
const TRectype& mov = pn->curr();
|
partite().update_reg(pn->curr());
|
||||||
partite().update_reg(mov, pn->cg_rows());
|
|
||||||
|
|
||||||
// Esecuzione maschera di selezione partite
|
// Esecuzione maschera di selezione partite
|
||||||
TGame_mask* mask = new TGame_mask(b, mov.get_long(MOV_NUMREG), riga+1);
|
TGame_mask* mask = new TGame_mask(b, pn->curr().get_long(MOV_NUMREG), riga+1);
|
||||||
mask->run();
|
mask->run();
|
||||||
const bool changed = mask->changed();
|
const bool changed = mask->changed();
|
||||||
delete mask;
|
delete mask;
|
||||||
|
@ -781,7 +781,7 @@ void TPagamento::strerr(word err, TString& s)
|
|||||||
char pic[3] = ".0";
|
char pic[3] = ".0";
|
||||||
pic[1] += _roundlit;
|
pic[1] += _roundlit;
|
||||||
s << "- la somma degli importi in lire (" << imp.string(pic);
|
s << "- la somma degli importi in lire (" << imp.string(pic);
|
||||||
s << ") e' diversa dal\ntotale del pagamento in lire(" << tot.string(pic) << ")\n";
|
s << ") e' diversa dal\ntotale del documento in lire(" << tot.string(pic) << ")\n";
|
||||||
}
|
}
|
||||||
if (err & P_TOTNCVAL)
|
if (err & P_TOTNCVAL)
|
||||||
{
|
{
|
||||||
@ -792,7 +792,7 @@ void TPagamento::strerr(word err, TString& s)
|
|||||||
char pic[3] = ".0";
|
char pic[3] = ".0";
|
||||||
pic[1] += _roundval;
|
pic[1] += _roundval;
|
||||||
s << "- la somma degli importi in valuta (" << imp.string(pic);
|
s << "- la somma degli importi in valuta (" << imp.string(pic);
|
||||||
s << ") e' diversa dal\ntotale del pagamento in valuta(" << tot.string(pic) << ")\n";
|
s << ") e' diversa dal\ntotale del documento in valuta(" << tot.string(pic) << ")\n";
|
||||||
}
|
}
|
||||||
if (err & P_MCOMM)
|
if (err & P_MCOMM)
|
||||||
s << "- scadenze incompatibili con il mese commerciale\n";
|
s << "- scadenze incompatibili con il mese commerciale\n";
|
||||||
|
186
cg/saldacon.cpp
186
cg/saldacon.cpp
@ -854,7 +854,7 @@ void TPartita::carica_allineamento()
|
|||||||
_for_align = cd.get_bool("NrForDx") ? 'R' : 'L';
|
_for_align = cd.get_bool("NrForDx") ? 'R' : 'L';
|
||||||
}
|
}
|
||||||
|
|
||||||
char TPartita::allineamento_richiesto() const
|
char TPartita::allineamento_richiesto(char tipocf)
|
||||||
{
|
{
|
||||||
char all;
|
char all;
|
||||||
if (_cli_align <= ' ' || _for_align <= ' ')
|
if (_cli_align <= ' ' || _for_align <= ' ')
|
||||||
@ -867,7 +867,7 @@ char TPartita::allineamento_richiesto() const
|
|||||||
carica_allineamento();
|
carica_allineamento();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (conto().tipo())
|
switch (tipocf)
|
||||||
{
|
{
|
||||||
case 'C': all = _cli_align; break;
|
case 'C': all = _cli_align; break;
|
||||||
case 'F': all = _for_align; break;
|
case 'F': all = _for_align; break;
|
||||||
@ -892,7 +892,7 @@ char TPartita::allineamento_corrente() const
|
|||||||
void TPartita::allinea(char all)
|
void TPartita::allinea(char all)
|
||||||
{
|
{
|
||||||
if (all <= ' ')
|
if (all <= ' ')
|
||||||
all = allineamento_richiesto();
|
all = allineamento_richiesto(conto().tipo());
|
||||||
|
|
||||||
if (all == 'R')
|
if (all == 'R')
|
||||||
_num.right_just(NUMLEN);
|
_num.right_just(NUMLEN);
|
||||||
@ -983,6 +983,9 @@ bool TPartita::read(const TBill& clifo, int year, const char* num)
|
|||||||
partita->renum_key(PART_ANNO, str); // Anno partita
|
partita->renum_key(PART_ANNO, str); // Anno partita
|
||||||
partita->renum_key(PART_NUMPART, _num); // Numero partita
|
partita->renum_key(PART_NUMPART, _num); // Numero partita
|
||||||
_part.read(partita);
|
_part.read(partita);
|
||||||
|
|
||||||
|
if (_part.exist(UNASSIGNED))
|
||||||
|
_part.destroy_row(UNASSIGNED); // Elimina riga saldo;
|
||||||
|
|
||||||
TRectype* unas = new TRectype(LF_PAGSCA); // Record pagamenti non assegnati
|
TRectype* unas = new TRectype(LF_PAGSCA); // Record pagamenti non assegnati
|
||||||
partita->copy_key_to_row(*unas);
|
partita->copy_key_to_row(*unas);
|
||||||
@ -996,11 +999,84 @@ bool TPartita::read(const TBill& clifo, int year, const char* num)
|
|||||||
bool TPartita::reread()
|
bool TPartita::reread()
|
||||||
{
|
{
|
||||||
return read(conto(), anno(), numero());
|
return read(conto(), anno(), numero());
|
||||||
|
}
|
||||||
|
|
||||||
|
int TPartita::write_saldo(bool re, TRectype* rec) const
|
||||||
|
{
|
||||||
|
TImporto saldo, doc, pag, imp;
|
||||||
|
calcola_saldo(saldo, doc, pag, imp);
|
||||||
|
|
||||||
|
TLocalisamfile part(LF_PARTITE);
|
||||||
|
TRectype& sld = part.curr();
|
||||||
|
|
||||||
|
sld = _part.key();
|
||||||
|
sld.put(PART_NRIGA, (int)UNASSIGNED);
|
||||||
|
sld.put(PART_SEZ, saldo.sezione());
|
||||||
|
sld.put(PART_IMPORTO, saldo.valore());
|
||||||
|
sld.put(PART_SEZABB, doc.sezione());
|
||||||
|
sld.put(PART_ABBUONI, doc.valore());
|
||||||
|
sld.put(PART_SEZDIFCAM, pag.sezione());
|
||||||
|
sld.put(PART_DIFFCAM, pag.valore());
|
||||||
|
sld.put(PART_REG, imp.sezione());
|
||||||
|
sld.put(PART_IMPOSTA, imp.valore());
|
||||||
|
|
||||||
|
int r = prima_fattura();
|
||||||
|
if (r <=0 ) r = first();
|
||||||
|
const TRiga_partite& row = riga(r);
|
||||||
|
sld.put(PART_NUMDOC, row.get(PART_NUMDOC));
|
||||||
|
sld.put(PART_DATADOC, row.get(PART_DATADOC));
|
||||||
|
sld.put(PART_DESCR, row.get(PART_DESCR));
|
||||||
|
|
||||||
|
if (rec != NULL)
|
||||||
|
*rec = sld;
|
||||||
|
|
||||||
|
int err = re ? part.rewrite() : part.write();
|
||||||
|
if (err != NOERR)
|
||||||
|
err = re ? part.write() : part.rewrite();
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TPartita::read_saldo(TRectype& riga,
|
||||||
|
TImporto& saldo, TImporto& doc, TImporto& pag, TImporto& imp)
|
||||||
|
{
|
||||||
|
int err = NOERR;
|
||||||
|
|
||||||
|
if (riga.get_int(PART_NRIGA) != UNASSIGNED)
|
||||||
|
{
|
||||||
|
TLocalisamfile part(LF_PARTITE);
|
||||||
|
TRectype& sld = part.curr();
|
||||||
|
sld = riga;
|
||||||
|
sld.put(PART_NRIGA, (int)UNASSIGNED);
|
||||||
|
|
||||||
|
err = part.read();
|
||||||
|
if (err != NOERR)
|
||||||
|
{
|
||||||
|
const TPartita p(riga);
|
||||||
|
err = p.write_saldo(FALSE, &sld);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err == NOERR)
|
||||||
|
riga = sld;
|
||||||
|
else
|
||||||
|
riga.zero();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
saldo.set(riga.get_char(PART_SEZ), riga.get_real(PART_IMPORTO));
|
||||||
|
doc.set(riga.get_char(PART_SEZABB), riga.get_real(PART_ABBUONI));
|
||||||
|
pag.set(riga.get_char(PART_SEZDIFCAM), riga.get_real(PART_DIFFCAM));
|
||||||
|
imp.set(riga.get_char(PART_REG), riga.get_real(PART_IMPOSTA));
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TPartita::write(bool re) const
|
bool TPartita::write(bool re) const
|
||||||
{
|
{
|
||||||
if (ok() && conto().tipo() > ' ')
|
if (ok())
|
||||||
{
|
{
|
||||||
for (int r = last(); r > 0; r = pred(r))
|
for (int r = last(); r > 0; r = pred(r))
|
||||||
{
|
{
|
||||||
@ -1013,7 +1089,7 @@ bool TPartita::write(bool re) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char cur_align = allineamento_corrente();
|
const char cur_align = allineamento_corrente();
|
||||||
const char req_align = allineamento_richiesto();
|
const char req_align = allineamento_richiesto(conto().tipo());
|
||||||
if (cur_align > ' ' && cur_align != req_align)
|
if (cur_align > ' ' && cur_align != req_align)
|
||||||
{
|
{
|
||||||
if (yesno_box("La partita %d '%s' non rispetta l'allineamento "
|
if (yesno_box("La partita %d '%s' non rispetta l'allineamento "
|
||||||
@ -1029,20 +1105,26 @@ bool TPartita::write(bool re) const
|
|||||||
int err = _part.write(re);
|
int err = _part.write(re);
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
err = _unassigned.write(re);
|
err = _unassigned.write(re);
|
||||||
|
|
||||||
// Se l'allineamento e' cambiato cancello la vecchia partita
|
if (err == NOERR)
|
||||||
if (err == NOERR && allineamento_corrente() != allineamento_iniziale())
|
{
|
||||||
{
|
// Se esiste almeno una riga scrive la riga riepilogativa della partita
|
||||||
// Costruisce il vecchio numero partita
|
if (ok()) write_saldo(re);
|
||||||
TString16 num = numero();
|
|
||||||
if (allineamento_iniziale() == 'R')
|
// Se l'allineamento e' cambiato cancello la vecchia partita
|
||||||
num.right_just(NUMLEN);
|
if (allineamento_corrente() != allineamento_iniziale())
|
||||||
else
|
{
|
||||||
num.trim();
|
// Costruisce il vecchio numero partita
|
||||||
|
TString16 num = numero();
|
||||||
// Cancella vecchia partita
|
if (allineamento_iniziale() == 'R')
|
||||||
TPartita canc(conto(), anno(), num);
|
num.right_just(NUMLEN);
|
||||||
canc.remove();
|
else
|
||||||
|
num.trim();
|
||||||
|
|
||||||
|
// Cancella vecchia partita
|
||||||
|
TPartita canc(conto(), anno(), num);
|
||||||
|
canc.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err == NOERR;
|
return err == NOERR;
|
||||||
@ -1140,7 +1222,7 @@ TImporto TPartita::importo_speso(long nreg, int numrig, bool valuta, int mode) c
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TPartita::update_reg(long nreg, const TRectype& mov, const TRecord_array& cg)
|
void TPartita::update_reg(long nreg, const TRectype& mov, TPartite_array& pa)
|
||||||
{
|
{
|
||||||
for (int r = last(); r > 0; r = pred(r))
|
for (int r = last(); r > 0; r = pred(r))
|
||||||
{
|
{
|
||||||
@ -1155,16 +1237,30 @@ void TPartita::update_reg(long nreg, const TRectype& mov, const TRecord_array& c
|
|||||||
rig.put(PART_PROTIVA, mov.get(MOV_PROTIVA));
|
rig.put(PART_PROTIVA, mov.get(MOV_PROTIVA));
|
||||||
rig.put(PART_CODCAUS, mov.get(MOV_CODCAUS));
|
rig.put(PART_CODCAUS, mov.get(MOV_CODCAUS));
|
||||||
|
|
||||||
const int numrig = rig.get_int(PART_NUMRIG);
|
if (rig.tipo() == tm_fattura)
|
||||||
if (numrig > 0 && numrig <= cg.rows())
|
|
||||||
{
|
{
|
||||||
const TRectype& cgrow = cg.row(numrig);
|
rig.put(PART_IMPTOTDOC, mov.get(MOV_TOTDOC));
|
||||||
const char sez = cgrow.get_char(RMV_SEZIONE);
|
if (rig.in_valuta())
|
||||||
const real imp = cgrow.get(RMV_IMPORTO);
|
rig.put(PART_IMPTOTVAL, mov.get(MOV_TOTDOCVAL));
|
||||||
TImporto importo(sez, imp); importo.normalize(rig.sezione());
|
else
|
||||||
rig.put(PART_IMPTOTDOC, importo.valore());
|
rig.zero(PART_IMPTOTVAL);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
const int numrig = rig.get_int(PART_NUMRIG);
|
||||||
|
CHECK(numrig > 0, "Bad NUMRIG");
|
||||||
|
|
||||||
|
const TImporto imptotdoc = pa.importo_speso(nreg, numrig, FALSE, 0x9);
|
||||||
|
rig.put(PART_IMPTOTDOC, imptotdoc.valore());
|
||||||
|
if (rig.in_valuta())
|
||||||
|
{
|
||||||
|
const TImporto imptotval = pa.importo_speso(nreg, numrig, TRUE, 0x1);
|
||||||
|
rig.put(PART_IMPTOTVAL, imptotval.valore());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rig.zero(PART_IMPTOTVAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1257,7 +1353,7 @@ void TPartita::calcola_saldo(TImporto& saldo, TImporto& doc, TImporto& pag, TImp
|
|||||||
saldo.normalize();
|
saldo.normalize();
|
||||||
doc.normalize();
|
doc.normalize();
|
||||||
pag.normalize();
|
pag.normalize();
|
||||||
imp.normalize();
|
imp.normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
TImporto TPartita::calcola_saldo(bool valuta) const
|
TImporto TPartita::calcola_saldo(bool valuta) const
|
||||||
@ -1431,12 +1527,10 @@ static void somma(const TRectype& vec, TRectype& nuo, const char* field)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TPartita::sposta_riga(int r, TPartita& part)
|
void TPartita::sposta_riga(int from_row, TPartita& part, int to_row)
|
||||||
{
|
{
|
||||||
const TRiga_partite& row = riga(r);
|
const TRiga_partite& row = riga(from_row);
|
||||||
const long nreg = row.get_long(PART_NREG);
|
TRiga_partite& nrw = part.riga(to_row);
|
||||||
const int prima = part.prima_fattura(nreg);
|
|
||||||
TRiga_partite& nrw = part.riga(prima);
|
|
||||||
|
|
||||||
const int address_size = last()+1;
|
const int address_size = last()+1;
|
||||||
int* address = new int[address_size];
|
int* address = new int[address_size];
|
||||||
@ -1479,7 +1573,7 @@ void TPartita::sposta_riga(int r, TPartita& part)
|
|||||||
address[j] = nuova.get_int(PART_NRIGA);
|
address[j] = nuova.get_int(PART_NRIGA);
|
||||||
}
|
}
|
||||||
|
|
||||||
int new_row = prima; // Nuova riga fattura
|
int new_row = to_row; // Nuova riga fattura
|
||||||
int new_sca = i; // Nuovo numero rata (uguale a prima)
|
int new_sca = i; // Nuovo numero rata (uguale a prima)
|
||||||
const int nrigp = address[j]; // Nuova riga somma (e pagamento)
|
const int nrigp = address[j]; // Nuova riga somma (e pagamento)
|
||||||
|
|
||||||
@ -1516,7 +1610,7 @@ void TPartita::sposta_riga(int r, TPartita& part)
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete address;
|
delete address;
|
||||||
rimuovi_riga(r);
|
rimuovi_riga(from_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sposta i pagamenti della riga r, dalla rata s compresa in poi, sui non assegnati
|
// Sposta i pagamenti della riga r, dalla rata s compresa in poi, sui non assegnati
|
||||||
@ -1711,13 +1805,25 @@ TImporto TPartite_array::importo_speso(long nreg, int numrig, bool valuta, int m
|
|||||||
return imp;
|
return imp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPartite_array::update_reg(const TRectype& mov, const TRecord_array& cg, long old_nreg)
|
void TPartite_array::update_reg(const TRectype& mov, long old_nreg)
|
||||||
{
|
{
|
||||||
if (old_nreg <= 0)
|
if (old_nreg <= 0)
|
||||||
old_nreg = mov.get_long(MOV_NUMREG);
|
old_nreg = mov.get_long(MOV_NUMREG);
|
||||||
add_numreg(old_nreg);
|
add_numreg(old_nreg);
|
||||||
for (TPartita* game = first(); game; game = next())
|
|
||||||
game->update_reg(old_nreg, mov, cg);
|
const int tot = items();
|
||||||
|
if (tot > 0)
|
||||||
|
{
|
||||||
|
TPartita** giochi = new TPartita*[tot];
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (TPartita* game = first(); game; game = next())
|
||||||
|
giochi[i++] = game;
|
||||||
|
while (--i >= 0)
|
||||||
|
giochi[i]->update_reg(old_nreg, mov, *this);
|
||||||
|
|
||||||
|
delete giochi;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRiga_partite* TPartite_array::mov2rig(long numreg, int numrig)
|
TRiga_partite* TPartite_array::mov2rig(long numreg, int numrig)
|
||||||
|
@ -216,6 +216,9 @@ public:
|
|||||||
virtual ~TRiga_partite() {}
|
virtual ~TRiga_partite() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TPartite_array;
|
||||||
|
|
||||||
class TPartita : public TSortable
|
class TPartita : public TSortable
|
||||||
{
|
{
|
||||||
TBill _conto;
|
TBill _conto;
|
||||||
@ -235,6 +238,8 @@ protected:
|
|||||||
char allineamento_corrente() const;
|
char allineamento_corrente() const;
|
||||||
void allinea(char all = ' ');
|
void allinea(char all = ' ');
|
||||||
|
|
||||||
|
int write_saldo(bool re, TRectype* rec = NULL) const;
|
||||||
|
|
||||||
public: // TObject
|
public: // TObject
|
||||||
virtual bool ok() const { return _part.rows() > 0; }
|
virtual bool ok() const { return _part.rows() > 0; }
|
||||||
virtual int compare(const TSortable& s) const;
|
virtual int compare(const TSortable& s) const;
|
||||||
@ -252,7 +257,7 @@ public:
|
|||||||
bool esistono_abbuoni_diffcam(long nreg = 0) const;
|
bool esistono_abbuoni_diffcam(long nreg = 0) const;
|
||||||
|
|
||||||
// assegna riga e figli ad altra partita
|
// assegna riga e figli ad altra partita
|
||||||
void sposta_riga(int r, TPartita& part);
|
void sposta_riga(int from_row, TPartita& part, int to_row);
|
||||||
// de-assegna tutti i pagamenti di una riga e li distrugge
|
// de-assegna tutti i pagamenti di una riga e li distrugge
|
||||||
void scollega_pagamenti(int riga, int rata = 1);
|
void scollega_pagamenti(int riga, int rata = 1);
|
||||||
|
|
||||||
@ -287,7 +292,7 @@ public:
|
|||||||
const TString& descrizione() const;
|
const TString& descrizione() const;
|
||||||
|
|
||||||
TImporto importo_speso(long numreg, int numrig, bool valuta, int mode = 0xF) const;
|
TImporto importo_speso(long numreg, int numrig, bool valuta, int mode = 0xF) const;
|
||||||
void update_reg(long nreg, const TRectype& mov, const TRecord_array& cg);
|
void update_reg(long nreg, const TRectype& mov, TPartite_array& pa);
|
||||||
void calcola_saldo(TImporto& saldo, TImporto& doc, TImporto& pag, TImporto& imp) const;
|
void calcola_saldo(TImporto& saldo, TImporto& doc, TImporto& pag, TImporto& imp) const;
|
||||||
TImporto calcola_saldo(bool valuta) const;
|
TImporto calcola_saldo(bool valuta) const;
|
||||||
TImporto calcola_saldo_al(bool valuta, const TDate& al, const TDate& data_rischio = botime) const;
|
TImporto calcola_saldo_al(bool valuta, const TDate& al, const TDate& data_rischio = botime) const;
|
||||||
@ -299,7 +304,9 @@ public:
|
|||||||
bool modifica_pagamento(const TRectype& new_pag, const TValuta& valuta, bool update);
|
bool modifica_pagamento(const TRectype& new_pag, const TValuta& valuta, bool update);
|
||||||
|
|
||||||
static void carica_allineamento();
|
static void carica_allineamento();
|
||||||
char allineamento_richiesto() const;
|
static char allineamento_richiesto(char tipocf);
|
||||||
|
static int read_saldo(TRectype& riga, TImporto& saldo, TImporto& doc, TImporto& pag, TImporto& imp);
|
||||||
|
|
||||||
int tipopag2causale(int tipo) const;
|
int tipopag2causale(int tipo) const;
|
||||||
|
|
||||||
TPartita(const TBill& clifo, int anno, const char* num);
|
TPartita(const TBill& clifo, int anno, const char* num);
|
||||||
@ -337,7 +344,7 @@ public:
|
|||||||
|
|
||||||
int add_numreg(long numreg); // Carica tutte le partite relative alla registrazione numreg
|
int add_numreg(long numreg); // Carica tutte le partite relative alla registrazione numreg
|
||||||
TImporto importo_speso(long numreg, int numrig, bool valuta = FALSE, int mode = 0xF);
|
TImporto importo_speso(long numreg, int numrig, bool valuta = FALSE, int mode = 0xF);
|
||||||
void update_reg(const TRectype& mov, const TRecord_array& cg, long old_reg = 0);
|
void update_reg(const TRectype& mov, long old_reg = 0);
|
||||||
|
|
||||||
// Controlla se esistono righe di pagamento relative alla riga numrig
|
// Controlla se esistono righe di pagamento relative alla riga numrig
|
||||||
bool utilizzata(long numreg, int numrig);
|
bool utilizzata(long numreg, int numrig);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user