Correzioni minori alle maschere del piano dei conti e dei clienti

Correzioni prima nota e tolto menu principale dalla liquidazione


git-svn-id: svn://10.65.10.50/trunk@1332 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-05-09 13:31:10 +00:00
parent 5ee2fbbd4c
commit aa41da6683
21 changed files with 712 additions and 314 deletions

View File

@ -319,7 +319,7 @@ END
BOOLEAN FLD_CM2_COMPENS BOOLEAN FLD_CM2_COMPENS
BEGIN BEGIN
PROMPT 50 14 "Compensazione saldi" PROMPT 60 14 "Compensazione saldi"
HELP "Indicare se e' ammessa la compensazione dei saldi" HELP "Indicare se e' ammessa la compensazione dei saldi"
FIELD LF_PCON->COMPENS FIELD LF_PCON->COMPENS
GROUP 1 3 GROUP 1 3
@ -345,7 +345,7 @@ END
BOOLEAN FLD_CM2_SOSPESO BOOLEAN FLD_CM2_SOSPESO
BEGIN BEGIN
PROMPT 50 15 "Conto sospeso" PROMPT 60 15 "Conto sospeso"
HELP "Indicare se sospendere il conto in prima nota" HELP "Indicare se sospendere il conto in prima nota"
FIELD LF_PCON->SOSPESO FIELD LF_PCON->SOSPESO
GROUP 1 2 GROUP 1 2

View File

@ -256,7 +256,7 @@ HELP "Nome del comune del recapito"
ADD RUN ba4 -0 ADD RUN ba4 -0
END END
LIST F_TIPOPERS 1 11 LIST F_TIPOPERS 1 15
BEGIN BEGIN
PROMPT 2 12 "Tipo persona " PROMPT 2 12 "Tipo persona "
FIELD LF_CLIFO->TIPOPERS FIELD LF_CLIFO->TIPOPERS
@ -452,7 +452,7 @@ BEGIN
PROMPT 1 11 "Percipiente" PROMPT 1 11 "Percipiente"
END END
LIST F_TIPOAPER 1 9 LIST F_TIPOAPER 1 15
BEGIN BEGIN
PROMPT 2 12 "Tipo " PROMPT 2 12 "Tipo "
FIELD LF_CLIFO->TIPOAPER FIELD LF_CLIFO->TIPOAPER

View File

@ -72,7 +72,7 @@ BEGIN
HELP "Indicare il tipo di stampa" HELP "Indicare il tipo di stampa"
ITEM "1|Per date limite" ITEM "1|Per date limite"
MESSAGE SHOW,F_DATALIM|SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO MESSAGE SHOW,F_DATALIM|SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO
ITEM "2|All' ultima immissione" ITEM "2|All'ultima immissione"
MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM
MESSAGE SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO MESSAGE SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO
END END
@ -84,7 +84,7 @@ BEGIN
HELP "Indicare il tipo di stampa" HELP "Indicare il tipo di stampa"
ITEM "1|Per date limite" ITEM "1|Per date limite"
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV
ITEM "2|All' ultima immissione" ITEM "2|All'ultima immissione"
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV
MESSAGE COPY,F_STAMPA MESSAGE COPY,F_STAMPA
END END

View File

@ -519,10 +519,11 @@ const char* TPrimanota_application::get_next_key()
k.add(F_CODCAUS); k.add(m.get(F_CODCAUS)); // Ricopia causale k.add(F_CODCAUS); k.add(m.get(F_CODCAUS)); // Ricopia causale
k.add(F_DATAREG); k.add(m.get(F_DATAREG)); // data operazione k.add(F_DATAREG); k.add(m.get(F_DATAREG)); // data operazione
k.add(F_DATACOMP); k.add(m.get(F_DATACOMP)); // competenza k.add(F_DATACOMP); k.add(m.get(F_DATACOMP)); // competenza
k.add(F_DATADOC); k.add(m.get(F_DATADOC)); // documento
if (iva() == iva_vendite) if (iva() == iva_vendite)
{ {
k.add(F_DATADOC); k.add(m.get(F_DATADOC)); // Ricopia data documento
const long n = m.get_long(F_NUMDOC); const long n = m.get_long(F_NUMDOC);
if (n > 0) if (n > 0)
{ k.add(F_NUMDOC); k.add(n+1); } // incrementa numero documento { k.add(F_NUMDOC); k.add(n+1); } // incrementa numero documento
@ -537,6 +538,9 @@ const char* TPrimanota_application::get_next_key()
void TPrimanota_application::init_insert_mode(TMask& m) void TPrimanota_application::init_insert_mode(TMask& m)
{ {
init_mask(m); init_mask(m);
m.first_focus(_firstfocus);
if (causale().reg().agenzia_viaggi()) if (causale().reg().agenzia_viaggi())
m.set(F_DATA74TER, m.get(F_DATAREG)); m.set(F_DATA74TER, m.get(F_DATAREG));
@ -603,7 +607,7 @@ int TPrimanota_application::read(TMask& m)
m.set_exchange(FALSE, cambio); m.set_exchange(FALSE, cambio);
_saldi.reset(); // Azzera saldi _saldi.reset(); // Azzera saldi
_saldi.set_movprovv(_rel->lfile().get_bool("PROVVIS")); _saldi.set_movprovv(_rel->lfile().get_char("PROVVIS") > ' ');
_saldi.set_movap(causale().apertura()); _saldi.set_movap(causale().apertura());
_saldi.set_anno_es(m.get_int(F_ANNOES)); _saldi.set_anno_es(m.get_int(F_ANNOES));
_saldi.set_num_ulmov(m.get_long(F_NUMREG)); _saldi.set_num_ulmov(m.get_long(F_NUMREG));
@ -692,7 +696,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
const TDate datareg(m.get(F_DATAREG)); const TDate datareg(m.get(F_DATAREG));
const int annoes = m.get_int(F_ANNOES); const int annoes = m.get_int(F_ANNOES);
_saldi.set_movprovv(m.get_bool(F_PROVVISORIO)); _saldi.set_movprovv(m.get(F_PROVVISORIO)[0] > ' ');
_saldi.set_movap(causale().apertura()); _saldi.set_movap(causale().apertura());
_saldi.set_anno_es(annoes); _saldi.set_anno_es(annoes);
_saldi.set_num_ulmov(numreg); _saldi.set_num_ulmov(numreg);
@ -837,7 +841,9 @@ void TPrimanota_application::check_saldi()
int TPrimanota_application::write(const TMask& m) int TPrimanota_application::write(const TMask& m)
{ {
static int lasterr = NOERR;
const long numreg = m.get_long(F_NUMREG); const long numreg = m.get_long(F_NUMREG);
if (numreg > _lastreg) _lastreg = numreg; // Aggiorna ultima registrazione if (numreg > _lastreg) _lastreg = numreg; // Aggiorna ultima registrazione
@ -864,9 +870,15 @@ int TPrimanota_application::write(const TMask& m)
else else
{ {
if (_is_saldaconto) if (_is_saldaconto)
{
const long nreg = numreg - (lasterr == _isreinsert ? 1 : 0);
_partite.update_reg_num(nreg, _rel->lfile().curr());
_partite.write(); _partite.write();
}
} }
} }
lasterr = err;
return err; return err;
} }
@ -902,7 +914,8 @@ bool TPrimanota_application::remove()
if (_is_saldaconto && iva() == nessuna_iva) if (_is_saldaconto && iva() == nessuna_iva)
{ {
// TBI _partite.remove(); notify_cgline_deletion(0); // Notify deletion of all cg lines
_partite.rewrite();
} }
} }
return ok; return ok;

View File

@ -23,9 +23,11 @@
#define F_RAGSOCCLIENTE 152 #define F_RAGSOCCLIENTE 152
#define F_STATOPAIV 153 #define F_STATOPAIV 153
#define F_PIVACLIENTE 154 #define F_PIVACLIENTE 154
#define F_COFICLIENTE 155
#define F_FORNITORE 161 #define F_FORNITORE 161
#define F_RAGSOCFORNITORE 162 #define F_RAGSOCFORNITORE 162
#define F_PIVAFORNITORE 164 #define F_PIVAFORNITORE 164
#define F_COFIFORNITORE 165
#define F_GRUPPOCLIFO 170 #define F_GRUPPOCLIFO 170
#define F_CONTOCLIFO 171 #define F_CONTOCLIFO 171
#define F_TOTALE 118 #define F_TOTALE 118

View File

@ -202,13 +202,29 @@ END
NUMBER F_RIEPILOGO 5 NUMBER F_RIEPILOGO 5
BEGIN BEGIN
PROMPT 51 9 "Riepilogo fino al n. " PROMPT 31 9 "Riepilogo fino al n. "
HELP "Numero finale del documento ripilogativo di protocollo IVA" HELP "Numero finale del documento ripilogativo di protocollo IVA"
FIELD LF_MOV->UPROTIVA FIELD LF_MOV->UPROTIVA
NUM_EXPR {(#F_RIEPILOGO==0)||(#F_RIEPILOGO>=#F_PROTIVA)} NUM_EXPR {(#F_RIEPILOGO==0)||(#F_RIEPILOGO>=#F_PROTIVA)}
WARNING "Inserire un riepilogo non inferiore al protocollo IVA (Obbigatorio se il cliete/fornitore ha codice inserimento in allegati uguale a 3)" WARNING "Inserire un riepilogo non inferiore al protocollo IVA (Obbigatorio se il cliete/fornitore ha codice inserimento in allegati uguale a 3)"
END END
STRING F_CODPAG 4
BEGIN
PROMPT 60 9 "Pagamento "
HELP "Codice del pagamento concordato per il movimento"
FIELD CODPAG
FLAGS "UZ"
USE %CPG
INPUT CODTAB F_CODPAG
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODPAG CODTAB
CHECKTYPE NORMAL
ADD RUN ba3 -6
WARNING "Codice pagamento assente"
END
STRING F_CLIFO 1 STRING F_CLIFO 1
BEGIN BEGIN
PROMPT 0 10 "" PROMPT 0 10 ""
@ -235,6 +251,7 @@ BEGIN
OUTPUT F_RAGSOCCLIENTE RAGSOC OUTPUT F_RAGSOCCLIENTE RAGSOC
OUTPUT F_STATOPAIV STATOPAIV OUTPUT F_STATOPAIV STATOPAIV
OUTPUT F_PIVACLIENTE PAIV OUTPUT F_PIVACLIENTE PAIV
OUTPUT F_COFICLIENTE COFI
OUTPUT F_CODPAG CODPAG OUTPUT F_CODPAG CODPAG
MESSAGE COPY,F_FORNITORE MESSAGE COPY,F_FORNITORE
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
@ -261,6 +278,7 @@ BEGIN
OUTPUT F_RAGSOCFORNITORE RAGSOC OUTPUT F_RAGSOCFORNITORE RAGSOC
OUTPUT F_STATOPAIV STATOPAIV OUTPUT F_STATOPAIV STATOPAIV
OUTPUT F_PIVAFORNITORE PAIV OUTPUT F_PIVAFORNITORE PAIV
OUTPUT F_COFIFORNITORE COFI
OUTPUT F_CODPAG CODPAG OUTPUT F_CODPAG CODPAG
MESSAGE COPY,F_CLIENTE MESSAGE COPY,F_CLIENTE
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
@ -301,41 +319,9 @@ BEGIN
ADD RUN cg0 -1 C ADD RUN cg0 -1 C
END END
STRING F_PIVACLIENTE 14 LIST F_STATOPAIV 16
BEGIN BEGIN
PROMPT 1 11 "Partita IVA " PROMPT 1 11 "Partita IVA "
HELP "Partita IVA del cliente del documento"
GROUP 1 7
USE LF_CLIFO KEY 5
INPUT TIPOCF "C"
INPUT STATOPAIV F_STATOPAIV
INPUT PAIV F_PIVACLIENTE
DISPLAY "Partita IVA@12" PAIV
DISPLAY "Ragione Sociale@50" RAGSOC
DISPLAY "Codice" CODCF
COPY OUTPUT F_CLIENTE
CHECKTYPE NORMAL
ADD RUN cg0 -1 C
END
STRING F_PIVAFORNITORE 14
BEGIN
PROMPT 1 11 "Partita IVA "
HELP "Partita IVA del fornitore del documento"
GROUP 2 7
USE LF_CLIFO KEY 5
INPUT TIPOCF "F"
INPUT STATOPAIV F_STATOPAIV
INPUT PAIV F_PIVAFORNITORE
COPY DISPLAY F_PIVACLIENTE
COPY OUTPUT F_FORNITORE
CHECKTYPE NORMAL
ADD RUN cg0 -1 F
END
LIST F_STATOPAIV 18
BEGIN
PROMPT 32 11 "Stato "
HELP "Codice ISO dello stato per la partita IVA" HELP "Codice ISO dello stato per la partita IVA"
ITEM " |Italia o extra CEE" ITEM " |Italia o extra CEE"
ITEM "BE|Belgio" ITEM "BE|Belgio"
@ -353,28 +339,76 @@ BEGIN
GROUP 1 7 GROUP 1 7
END END
STRING F_PIVACLIENTE 14
BEGIN
PROMPT 34 11 ""
HELP "Partita IVA del cliente del documento"
GROUP 1 7
USE LF_CLIFO KEY 5
INPUT TIPOCF "C"
INPUT STATOPAIV F_STATOPAIV
INPUT PAIV F_PIVACLIENTE
DISPLAY "Partita IVA@12" PAIV
DISPLAY "Ragione Sociale@50" RAGSOC
DISPLAY "Codice" CODCF
COPY OUTPUT F_CLIENTE
CHECKTYPE NORMAL
ADD RUN cg0 -1 C
END
STRING F_PIVAFORNITORE 14
BEGIN
PROMPT 34 11 ""
HELP "Partita IVA del fornitore del documento"
GROUP 2 7
USE LF_CLIFO KEY 5
INPUT TIPOCF "F"
INPUT STATOPAIV F_STATOPAIV
INPUT PAIV F_PIVAFORNITORE
COPY DISPLAY F_PIVACLIENTE
COPY OUTPUT F_FORNITORE
CHECKTYPE NORMAL
ADD RUN cg0 -1 F
END
STRING F_COFICLIENTE 16
BEGIN
PROMPT 54 11 "C.F. "
HELP "Codice fiscale del cliente del documento"
GROUP 1 7
USE LF_CLIFO KEY 4
INPUT TIPOCF "C"
INPUT COFI F_COFICLIENTE
DISPLAY "Codice fiscale@16" COFI
DISPLAY "Ragione Sociale@50" RAGSOC
DISPLAY "Codice" CODCF
COPY OUTPUT F_CLIENTE
CHECKTYPE NORMAL
ADD RUN cg0 -1 C
END
STRING F_COFIFORNITORE 16
BEGIN
PROMPT 54 11 "C.F. "
HELP "Codice fiscale del fornitore del documento"
GROUP 2 7
USE LF_CLIFO KEY 4
INPUT TIPOCF "F"
INPUT COFI F_COFIFORNITORE
COPY DISPLAY F_COFICLIENTE
COPY OUTPUT F_FORNITORE
CHECKTYPE NORMAL
ADD RUN cg0 -1 F
END
BUTTON F_OCCASEDIT 56 BUTTON F_OCCASEDIT 56
BEGIN BEGIN
PROMPT 1 11 "Dati anagrafici del cliente o fornitore occasionale" PROMPT 1 11 "Dati anagrafici del cliente o fornitore occasionale"
FLAGS "H" FLAGS "H"
END END
STRING F_CODPAG 4
BEGIN
PROMPT 60 11 "Pagamento "
HELP "Codice del pagamento concordato per il movimento"
FIELD CODPAG
FLAGS "UZ"
USE %CPG
INPUT CODTAB F_CODPAG
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODPAG CODTAB
CHECKTYPE NORMAL
ADD RUN ba3 -6
WARNING "Codice pagamento assente"
END
STRING F_VALUTA 3 STRING F_VALUTA 3
BEGIN BEGIN
PROMPT 1 12 "Valuta " PROMPT 1 12 "Valuta "
@ -420,6 +454,23 @@ BEGIN
PICTURE "." PICTURE "."
END END
STRING F_CODIVA 4
BEGIN
PROMPT 60 13 "Codice IVA "
HELP "Codice IVA del documento generante il movimento"
FLAGS "U"
USE %IVA
INPUT CODTAB F_CODIVA
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
DISPLAY "%@6" R0
DISPLAY "Tipo" S1
OUTPUT F_CODIVA CODTAB
CHECKTYPE NORMAL
VALIDATE ZEROFILL_FUNC 2
WARNING "Codice IVA assente"
END
NUMBER F_RITFIS 15 NUMBER F_RITFIS 15
BEGIN BEGIN
PROMPT 1 14 "Ritenute fiscali " PROMPT 1 14 "Ritenute fiscali "
@ -438,23 +489,6 @@ BEGIN
PICTURE "." PICTURE "."
END END
STRING F_CODIVA 4
BEGIN
PROMPT 60 13 "Codice IVA "
HELP "Codice IVA del documento generante il movimento"
FLAGS "U"
USE %IVA
INPUT CODTAB F_CODIVA
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
DISPLAY "%@6" R0
DISPLAY "Tipo" S1
OUTPUT F_CODIVA CODTAB
CHECKTYPE NORMAL
VALIDATE ZEROFILL_FUNC 2
WARNING "Codice IVA assente"
END
DATE F_DATA74TER DATE F_DATA74TER
BEGIN BEGIN
PROMPT 54 14 "Data 74/ter " PROMPT 54 14 "Data 74/ter "
@ -501,6 +535,7 @@ BEGIN
// OUTPUT F_CAMBIOINTRA R10 // OUTPUT F_CAMBIOINTRA R10
CHECKTYPE NORMAL CHECKTYPE NORMAL
WARNING "Codice valuta assente" WARNING "Codice valuta assente"
VALIDATE REQIF_FUNC 1 F_CORRVALUTA
END END
NUMBER F_CAMBIOINTRA 12 5 NUMBER F_CAMBIOINTRA 12 5
@ -531,6 +566,7 @@ BEGIN
FLAGS "R" FLAGS "R"
PICTURE ".2" PICTURE ".2"
GROUP 4 GROUP 4
VALIDATE REQIF_FUNC 1 F_VALUTAINTRA
END END
ENDPAGE ENDPAGE
@ -579,8 +615,8 @@ BEGIN
ITEM "Iva@4" ITEM "Iva@4"
ITEM "Det@1" ITEM "Det@1"
ITEM "Imposta@15" ITEM "Imposta@15"
ITEM "C/R@1" ITEM "CR@1"
ITEM "C/F@1" ITEM "CF@1"
ITEM "Gr." ITEM "Gr."
ITEM "Co." ITEM "Co."
ITEM "Sottoc.@6" ITEM "Sottoc.@6"

View File

@ -89,15 +89,42 @@ real TPrimanota_application::totale_documento()
bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k) bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k)
{ {
bool ok = TRUE;
if (k == K_SPACE) if (k == K_SPACE)
{ {
TSheet_field& s = app().cgs(); TSheet_field& s = app().cgs();
const int riga = s.selected(); const int riga = s.selected();
app().edit_partite(riga); const bool dirty = app().edit_partite(riga);
if (dirty) k = K_ENTER;
} }
return TRUE; if (k == K_ENTER)
{
TSheet_field& s = app().cgs();
const int sel = s.selected();
const int currig = sel+1;
const long curreg = app().curr_mask().get_long(F_NUMREG);
TImporto importo; importo = app().cgs().row(sel);
TImporto speso = app()._partite.importo_speso(curreg, currig);
if (importo != speso)
{
ok = yesno_box("L'importo dei pagamenti %c %s\ne' diverso dall'importo sulla riga %d.\n"
"Si desidera correggerlo?", speso.sezione(), speso.valore().string("."), currig);
if (ok)
{
TMask& m = f.mask();
const bool dare = speso.sezione() == 'D';
m.set(101, dare ? speso.valore().string() : "");
m.set(102, dare ? "" : speso.valore().string());
}
}
}
return ok;
} }
@ -226,10 +253,10 @@ int TPrimanota_application::det_used(char det) const
int users = 0; int users = 0;
const bool detraib = det == 'D'; const bool detraib = det == 'D';
const TArray& rows = ivas().rows_array(); TString_array& arr = ivas().rows_array();
for (int i = 0; i < rows.items(); i++) for (int i = 0; i < arr.items(); i++)
{ {
TToken_string& row = (TToken_string&)rows[i]; TToken_string& row = arr.row(i);
if (!row.empty_items()) if (!row.empty_items())
{ {
const bool d = detraibile(row); const bool d = detraibile(row);
@ -507,11 +534,12 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
TSheet_field& cg = app().cgs(); TSheet_field& cg = app().cgs();
bool empty = TRUE; bool empty = TRUE;
const int max = cg.items(); for (int i = 0; i < cg.items(); i++)
for (int i = 0; i < max; i++)
{ {
TToken_string& r = cg.row(i); TToken_string& r = cg.row(i);
if (!can_remove(r)) TImporto importo; importo = r;
if (!importo.is_zero())
{ {
const TBill c(r, 3, 0x0); const TBill c(r, 3, 0x0);
if (!c.ok()) if (!c.ok())
@ -519,7 +547,21 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
const TBill co(r, 10, 0x0); const TBill co(r, 10, 0x0);
if (!co.empty() && !co.ok()) if (!co.empty() && !co.ok())
return f.error_box("La contropartita della riga %d non e' completa", i+1); return f.error_box("La contropartita della riga %d non e' completa", i+1);
empty = FALSE; empty = FALSE;
if (app().iva() == nessuna_iva && app().is_saldaconto())
{
const long numreg = f.mask().get_long(F_NUMREG);
const int currig = i+1;
const TImporto speso = app()._partite.importo_speso(numreg, currig);
if (importo != speso)
{
bool ok = yesno_box("L'importo dei pagamenti %c %s\ne' diverso dall'importo sulla riga %d.\n"
"Si desidera correggerlo?", speso.sezione(), speso.valore().string("."), currig);
if (ok) app().set_cgs_imp(i, speso);
else return FALSE;
}
}
} }
} }
@ -810,7 +852,7 @@ bool TPrimanota_application::detrazione_handler(TMask_field& f, KEY key)
bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key) bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key)
{ {
if (key == K_ENTER) if (key == K_ENTER || key == K_TAB)
{ {
const real imponibile(f.mask().get(101)); const real imponibile(f.mask().get(101));
const real& percent = app().causale().corrispettivi() ? ZERO : cod2IVA(f.mask()); const real& percent = app().causale().corrispettivi() ? ZERO : cod2IVA(f.mask());
@ -822,7 +864,6 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key)
if (val != imposta) if (val != imposta)
{ {
f.warning_box("L'imposta dovrebbe essere %s", (const char*)imposta.string(".")); f.warning_box("L'imposta dovrebbe essere %s", (const char*)imposta.string("."));
if (imposta.is_zero()) f.reset();
} }
} else } else
if (key == K_F8) if (key == K_F8)
@ -1051,7 +1092,7 @@ return TRUE;
} }
// Handler dello sheet di contabilita' // Handler dello sheet
// Certified 90% // Certified 90%
bool TPrimanota_application::iva_handler(TMask_field& f, KEY k) bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
{ {
@ -1076,7 +1117,7 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
const real im(row.get(0)); const real im(row.get(0));
if (!im.is_zero()) if (!im.is_zero())
{ {
TBill c(row, 6, 0x0); TBill c(row, 5, 0x1);
if (!c.ok() || !c.find()) if (!c.ok() || !c.find())
return error_box("Il conto della riga iva %d e' errato o incompleto", i+1); return error_box("Il conto della riga iva %d e' errato o incompleto", i+1);
} }
@ -1192,6 +1233,12 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
app()._skip_bollato_check = ok; app()._skip_bollato_check = ok;
} }
if (ok && mov.get_bool("INVIATO"))
{
ok = yesno_box("Il movimento e' stato inviato ad un'altra contabilita':\n"
"si desidera continuare ugualmente");
}
if (ok) if (ok)
{ {
m.set(F_DATAREG, mov.get("DATAREG")); m.set(F_DATAREG, mov.get("DATAREG"));
@ -1293,7 +1340,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
const long numreg = m.get_long(F_NUMREG); const long numreg = m.get_long(F_NUMREG);
const bool error = numreg == 0 || numreg > app()._lastreg; const bool error = numreg == 0 || numreg > app()._lastreg;
if (!app()._skip_giornale_check) if (key != K_ENTER && !app()._skip_giornale_check)
{ {
const TLibro_giornale& gio = app().giornale(); const TLibro_giornale& gio = app().giornale();
if (dr < gio.last_print()) if (dr < gio.last_print())
@ -1550,9 +1597,11 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
const char cf = app().clifo(); const char cf = app().clifo();
TLocalisamfile& clifo = ((TEdit_field&)f).browse()->cursor()->file(); TLocalisamfile& clifo = ((TEdit_field&)f).browse()->cursor()->file();
if (clifo.get_char(CLI_TIPOCF) != cf)
if (clifo.get_char(CLI_TIPOCF) != cf || clifo.get(CLI_CODCF) != f.get())
{ {
clifo.put(CLI_TIPOCF, cf); clifo.put(CLI_TIPOCF, cf);
clifo.put(CLI_CODCF, f.get());
clifo.read(); clifo.read();
} }
if (!suspended_handler(f, key)) if (!suspended_handler(f, key))
@ -1571,7 +1620,14 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
const bool occas = clifo.get_bool(CLI_OCCAS); const bool occas = clifo.get_bool(CLI_OCCAS);
m.show(F_OCCASEDIT, occas); // Dati anagrfici m.show(F_OCCASEDIT, occas); // Dati anagrfici
m.show(-7, !occas); // Partita IVA e stato partita IVA
if (occas)
m.hide(-7); // Partita IVA e stato partita IVA
else
{
m.show(-7);
m.hide(cf == 'F' ? F_PIVACLIENTE : F_PIVAFORNITORE);
}
if (f.focusdirty()) if (f.focusdirty())
{ {
@ -1591,7 +1647,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
} }
} }
} }
if (occas) if (occas && app().occas_mask().get(O_CODICE).empty())
m.send_key(K_SPACE, F_OCCASEDIT); // Lancia maschera occasionali m.send_key(K_SPACE, F_OCCASEDIT); // Lancia maschera occasionali
} }
} }
@ -1893,7 +1949,11 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)
if (key == K_ENTER && f.get().empty()) if (key == K_ENTER && f.get().empty())
{ {
if (m.get(F_CORRVALUTA).not_empty()) if (m.get(F_CORRVALUTA).not_empty())
m.field(F_CORRVALUTA).on_hit(); {
TMask_field& cv = m.field(F_CORRVALUTA);
cv.set_focusdirty();
cv.on_hit();
}
else else
key = K_F8; key = K_F8;
} }

View File

@ -546,7 +546,9 @@ bool TPrimanota_application::edit_partite(int riga)
} }
end_wait(); end_wait();
bool dirty = FALSE;
KEY k = a.items() > 0 ? K_ENTER : K_ESC; // Esce se non ci sono righe KEY k = a.items() > 0 ? K_ENTER : K_ESC; // Esce se non ci sono righe
while (k == K_ENTER) while (k == K_ENTER)
{ {
@ -555,11 +557,11 @@ bool TPrimanota_application::edit_partite(int riga)
{ {
const int anno = a.row().get_int(0); const int anno = a.row().get_int(0);
const TString16 num = a.row().get(1); const TString16 num = a.row().get(1);
edit_scadenze(anno, num); // Edita pagamenti dirty |= edit_scadenze(anno, num); // Edita pagamenti
} }
} }
return TRUE; return dirty;
} }
@ -597,13 +599,13 @@ int TPrimanota_application::nuovo_pagamento(TPartita& partita, int rata, int rmo
part.zero(PART_IMPOSTA); part.zero(PART_IMPOSTA);
part.zero(PART_SPESE); part.zero(PART_SPESE);
TString80 tmp;
part.zero(PART_CODVAL); part.zero(PART_CODVAL);
part.zero(PART_CAMBIO); part.zero(PART_CAMBIO);
part.zero(PART_IMPORTOVAL); part.zero(PART_IMPORTOVAL);
part.zero(PART_DATACAM); part.zero(PART_DATACAM);
TString80 tmp;
const TRectype& scadenza = partita.rata(rata); const TRectype& scadenza = partita.rata(rata);
tmp = scadenza.get(SCAD_CODPAG); tmp = scadenza.get(SCAD_CODPAG);
part.put(PART_CODPAG, tmp); part.put(PART_CODPAG, tmp);
@ -701,7 +703,7 @@ bool TPrimanota_application::edit_scadenze(int anno, const char* num)
TToken_string r(80); // Work string TToken_string r(80); // Work string
KEY k = K_ENTER; KEY k = K_ENTER;
bool dirty = TRUE; bool dirty = TRUE, one_dirty = FALSE;
while (k == K_ENTER) while (k == K_ENTER)
{ {
@ -758,10 +760,11 @@ bool TPrimanota_application::edit_scadenze(int anno, const char* num)
part = partita.riga(nrig); part = partita.riga(nrig);
dirty = edit_pagamento(partita, part); dirty = edit_pagamento(partita, part);
one_dirty |= dirty;
} // if k == K_ENTER } // if k == K_ENTER
} // while k == K_ENTER } // while k == K_ENTER
return TRUE; return one_dirty;
} }
@ -823,8 +826,8 @@ bool TPrimanota_application::edit_pagamento(TPartita& p, TRectype& part)
m.set(S_IMPORTOVAL, scaden.get(SCAD_IMPORTOVAL)); // " in valuta m.set(S_IMPORTOVAL, scaden.get(SCAD_IMPORTOVAL)); // " in valuta
m.set(S_RATA, scaden.get(SCAD_NRATA)); m.set(S_RATA, scaden.get(SCAD_NRATA));
const char sez = parbas.get_char(PART_SEZ); // Sezione importo e rituenute const char sez = part.get_char(PART_SEZ); // Sezione importo e rituenute
const char controsez = sez == 'D' ? 'A' : 'D'; // Sezione opposta const char controsez = sez == 'D' ? 'A' : 'D'; // Sezione opposta (contropartita)
// Memorizza importi prima di eventuali variazioni // Memorizza importi prima di eventuali variazioni
const real old_importo(part.get(PART_IMPORTO)); const real old_importo(part.get(PART_IMPORTO));
@ -852,7 +855,7 @@ bool TPrimanota_application::edit_pagamento(TPartita& p, TRectype& part)
const TImporto new_importo(controsez, part.get_real(PART_IMPORTO)); const TImporto new_importo(controsez, part.get_real(PART_IMPORTO));
if (!new_importo.is_zero()) if (!new_importo.is_zero())
{ {
TBill new_conto; conto.get(part, TRUE); TBill new_conto; new_conto.get(part, TRUE);
const int riga = bill2pos(new_conto, 'I'); const int riga = bill2pos(new_conto, 'I');
if (riga < 0) if (riga < 0)
set_cgs_row(riga, new_importo, new_conto, part.get(PART_DESCR), 'I'); set_cgs_row(riga, new_importo, new_conto, part.get(PART_DESCR), 'I');
@ -894,38 +897,46 @@ bool TPrimanota_application::notify_cgline_deletion(TPartita& partita, long nreg
const long reg = pag.get_long(PART_NREG); const long reg = pag.get_long(PART_NREG);
if (reg == nreg) // Se la registrazione corrisponde if (reg == nreg) // Se la registrazione corrisponde
{ {
const int num = pag.get_int(PART_NUMRIG); if (numrig > 0)
if (num == numrig) // Se la riga corrisponde
{ {
const real ritenute = pag.get_real(PART_RITENUTE); const int num = pag.get_int(PART_NUMRIG);
if (!ritenute.is_zero()) if (num == numrig) // Se anche la riga corrisponde
{ {
if (riga_ritenute >= 0) const real ritenute(pag.get(PART_RITENUTE));
sub_cgs_imp(riga_ritenute, ritenute); if (!ritenute.is_zero())
else {
error_box("Non esiste la riga delle ritenute di un pagamento della riga %d", numrig); if (riga_ritenute >= 0)
} sub_cgs_imp(riga_ritenute, ritenute);
const real importo = pag.get_real(PART_IMPORTO); else
if (!importo.is_zero()) error_box("Non esiste la riga delle ritenute di un pagamento della riga %d", numrig);
{ }
TBill contro; contro.get(pag); const real importo(pag.get(PART_IMPORTO));
const int riga_contro = bill2pos(contro, 'I'); if (!importo.is_zero())
if (riga_contro >= 0) {
sub_cgs_imp(riga_contro, importo); TBill contro; contro.get(pag);
else const int riga_contro = bill2pos(contro, 'I');
error_box("Non esiste la riga dell'importo di un pagamento della riga %d", numrig); if (riga_contro >= 0)
} sub_cgs_imp(riga_contro, importo);
partita.remove_riga(pag); else
found = TRUE; error_box("Non esiste la riga dell'importo di un pagamento della riga %d", numrig);
} }
else partita.remove_riga(pag);
if (num > numrig) // Se la riga e' successiva found = TRUE;
{
pag.put(PART_NUMRIG, num-1);
partita.add_riga(pag);
} }
} else
{
const int n = pag.get_int(PART_NUMRIG);
pag.put(PART_NUMRIG, n-1);
partita.add_riga(pag);
}
}
else // numrig == 0
{
partita.remove_riga(pag); // Cancellazione pura e semplice
found = TRUE; // usata solo da ::remove
}
} // if reg == numreg
} }
return found; return found;

View File

@ -1,11 +1,14 @@
#include <applicat.h> #include <applicat.h>
#include <mask.h> #include <mask.h>
#include <progind.h> #include <progind.h>
#include <tabutil.h>
#include <urldefid.h> #include <urldefid.h>
#include "cg2200.h" #include "cg2200.h"
#include "cg2101.h" #include "cg2101.h"
#include "cglib.h"
#include <causali.h>
#include <mov.h> #include <mov.h>
#include <rmov.h> #include <rmov.h>
#include <rmoviva.h> #include <rmoviva.h>
@ -33,108 +36,286 @@ TString& add_plural(TString& s, long num, const char* name)
return s; return s;
} }
class TDeleteprovv_app : public TApplication class TProvvisori_app : public TApplication
{ {
protected: TLocalisamfile* _sal;
TLocalisamfile* _cau;
TTable* _reg;
TString16 _from_caus, _to_caus;
TSaldo_agg _saldi;
protected: // TApplication
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
virtual bool menu(MENU_TAG m); virtual bool menu(MENU_TAG m);
public: public:
TDeleteprovv_app() {}; void inizia_saldi(const TRectype& mov);
void aggiungi_saldi(const TRectype& rmov, bool lettura);
void aggiorna_saldi();
bool confirm_provv(TCursor& cur, TProgind& pi);
bool delete_provv(TCursor& cur, TProgind& pi);
static bool filter(const TRelation* rel);
TProvvisori_app() {};
}; };
bool TDeleteprovv_app::create() inline TProvvisori_app& app()
{ return (TProvvisori_app&)main_app(); }
bool TProvvisori_app::create()
{ {
TApplication::create(); TApplication::create();
_cau = new TLocalisamfile(LF_CAUSALI);
_sal = new TLocalisamfile(LF_SALDI);
_reg = new TTable("REG");
dispatch_e_menu(BAR_ITEM(1)); dispatch_e_menu(BAR_ITEM(1));
return TRUE; return TRUE;
} }
bool TDeleteprovv_app::destroy() bool TProvvisori_app::destroy()
{ {
delete _reg;
delete _sal;
delete _cau;
return TApplication::destroy(); return TApplication::destroy();
} }
bool TDeleteprovv_app::menu(MENU_TAG) void TProvvisori_app::inizia_saldi(const TRectype& r)
{
CHECK(r.num() == LF_MOV, "Voglio un movimento");
_saldi.reset();
bool apertura = FALSE;
const TString& c = r.get(MOV_CODCAUS);
if (c.not_empty())
{
_cau->put(CAU_CODCAUS, c);
if (_cau->read() == NOERR)
apertura = _cau->get_bool(CAU_MOVAP);
}
_saldi.set_movap(apertura);
_saldi.set_anno_es(r.get_int(MOV_ANNOES));
_saldi.set_num_ulmov(r.get_long(MOV_NUMREG));
_saldi.set_data_ulmov(r.get_date(MOV_DATAREG));
}
void TProvvisori_app::aggiungi_saldi(const TRectype& r, bool lettura)
{
CHECK(r.num() == LF_RMOV, "Voglio la riga di un movimento");
TBill conto; conto.get(r);
TImporto importo(r.get_char(RMV_SEZIONE), r.get_real(RMV_IMPORTO));
_saldi.set_movprovv(lettura); // In lettura sono tutti provvisori
_saldi.aggiorna(conto, importo, !lettura); // In lettura devo sottrarre l'importo
}
void TProvvisori_app::aggiorna_saldi()
{
_saldi.registra();
}
bool TProvvisori_app::confirm_provv(TCursor& cur, TProgind& pi)
{
TLocalisamfile& mov = cur.file(LF_MOV);
TLocalisamfile rmov(LF_RMOV);
for (cur = 0; cur.pos() < cur.items(); ++cur)
{
const long numreg = mov.get_long(MOV_NUMREG);
inizia_saldi(mov.curr());
int err = cur.lock();
for (int rig = 1; err == NOERR; rig++)
{
rmov.put(RMV_NUMREG, numreg);
rmov.put(RMV_NUMRIG, rig);
if (rmov.read(_isequal, _lock) != NOERR) break;
aggiungi_saldi(rmov.curr(), TRUE);
aggiungi_saldi(rmov.curr(), FALSE);
}
if (err == NOERR)
{
mov.zero(MOV_PROVVIS);
err = mov.rewrite();
if (err == NOERR)
{
aggiorna_saldi();
pi.addstatus(1);
}
}
if (err != NOERR)
return error_box("Errore nella conferma del movimento %ld", numreg);
}
return TRUE;
}
bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi)
{ {
TMask m("cg2200a");
TCursor& cur = *m.efield(F_FROMDATE).browse()->cursor();
TLocalisamfile& mov = cur.file(LF_MOV); TLocalisamfile& mov = cur.file(LF_MOV);
TLocalisamfile rmov(LF_RMOV); TLocalisamfile rmov(LF_RMOV);
TLocalisamfile rmoviva(LF_RMOVIVA); TLocalisamfile rmoviva(LF_RMOVIVA);
while (m.run() != K_QUIT) TString256 error;
{
TRecnotype last = cur.items()-1; for (cur = 0; cur.pos() < cur.items(); ++cur)
mov.zero(); {
const char* s = m.get(F_TODATE); const long numreg = mov.get_long(MOV_NUMREG);
if (*s)
int err = cur.lock();
inizia_saldi(mov.curr());
for (int rig = 1; err == NOERR; rig++)
{ {
mov.put(MOV_DATAREG, s); rmov.put(RMV_NUMREG, numreg);
mov.put(MOV_NUMREG, m.get(F_TOREG)); rmov.put(RMV_NUMRIG, rig);
last = cur.read(); if (rmov.read(_isequal, _lock) != NOERR) break;
}
aggiungi_saldi(rmov.curr(), TRUE);
err = rmov.remove();
if (err != NOERR)
error.format("riga contabile %d", rig);
}
for (rig = 1; err == NOERR; rig++)
{
rmoviva.put(RMI_NUMREG, numreg);
rmoviva.put(RMI_NUMRIG, rig);
if (rmoviva.read(_isequal, _lock) != NOERR) break;
err = rmov.remove();
if (err != NOERR)
error.format("riga IVA %d", rig);
}
if (err == NOERR)
{
const TRecnotype n = mov.recno();
mov.setkey(1); // Isam bug on remove with key != 1
mov.readat(n);
err = mov.remove();
if (err != NOERR)
error = "testata";
}
if (err == NOERR)
{
aggiorna_saldi();
pi.addstatus(1);
}
else
return error_box("Errore %d nella cancellazione della %s del movimento %ld",
err, (const char*)error, numreg);
}
return TRUE;
}
bool TProvvisori_app::filter(const TRelation* rel)
{
TLocalisamfile& mov = rel->lfile();
if (mov.get_char(MOV_PROVVIS) <= ' ')
return FALSE;
const char* caus = mov.get(MOV_CODCAUS);
if (app()._from_caus.not_empty() && app()._from_caus > caus)
return FALSE;
if (app()._to_caus.not_empty() && app()._to_caus < caus)
return FALSE;
return TRUE;
}
bool TProvvisori_app::menu(MENU_TAG)
{
TMask m("cg2200a");
TCursor& cur = *m.efield(F_FROMDATE).browse()->cursor();
TLocalisamfile& mov = cur.file(LF_MOV);
KEY key;
while ((key = m.run()) != K_QUIT)
{
mov.zero(); mov.zero();
mov.put(MOV_DATAREG, m.get(F_FROMDATE)); TRectype from(mov.curr());
mov.put(MOV_NUMREG, m.get(F_FROMREG)); TRectype to(mov.curr());
const TRecnotype first = cur.read();
const TRecnotype total = first >= 0L ? last-first+1 : 0L; const char* s = m.get(F_FROMDATE);
TString80 caption("Cancellazione di ");
add_plural(caption, total, "movimento"); if (key == K_ENTER)
{
const TDate da(s);
const TLibro_giornale lg(da.year());
const TDate lp(lg.last_print());
if (da < lp)
{
s = lp.string();
const bool ok = yesno_box("Il libro giornale e stato stampato il %s:\n",
"Si desidera modificare la data iniziale?", s);
if (!ok) continue;
}
}
if (*s) from.put(MOV_DATAREG, s);
s = m.get(F_FROMREG);
if (*s) from.put(MOV_NUMREG, s);
_from_caus = m.get(F_FROMCAUS);
s = m.get(F_TODATE);
if (*s) to.put(MOV_DATAREG, s);
s = m.get(F_TOREG);
if (*s) to.put(MOV_NUMREG, s);
_to_caus = m.get(F_TOCAUS);
if (!yesno_box(caption) || total < 1) cur.setregion(from, to);
cur.set_filterfunction(filter);
const TRecnotype total = cur.items();
TString80 action(key == K_ENTER ? "conferma" : "cancellazione");
action << " di "; add_plural(action, total, "movimento");
TString256 caption("E' stata richiesta la ");
caption << action << '.';
if (total > 0)
{
caption << "\nSi desidera continuare?";
if (!yesno_box(caption)) continue;
}
else
{
warning_box(caption);
continue; continue;
}
TProgind pi(total, caption, FALSE, TRUE, 24); action[0] = toupper(action[0]);
TProgind pi(total, action, FALSE, TRUE, 24);
cur.freeze(); cur.freeze();
for (cur = first; cur.pos() <= last; ++cur)
{ if (key == K_ENTER)
const long numreg = mov.get_long(MOV_NUMREG); confirm_provv(cur, pi);
else
int err = cur.lock(); delete_provv(cur, pi);
for (int rig = 1; err == NOERR; rig++)
{
rmov.put(RMV_NUMREG, numreg);
rmov.put(RMV_NUMRIG, rig);
if (rmov.read(_isequal, _lock) != NOERR) break;
err = rmov.remove();
if (err != NOERR)
caption.format("riga contabile %d", rig);
}
for (rig = 1; err == NOERR; rig++)
{
rmoviva.put(RMI_NUMREG, numreg);
rmoviva.put(RMI_NUMRIG, rig);
if (rmoviva.read(_isequal, _lock) != NOERR) break;
err = rmov.remove();
if (err != NOERR)
caption.format("riga IVA %d", rig);
}
if (err == NOERR)
{
const TRecnotype n = mov.recno();
mov.setkey(1); // Isam bug on remove with key != 1
mov.readat(n);
err = mov.remove();
if (err != NOERR)
caption = "testata";
}
if (err == NOERR)
pi.addstatus(1);
else
{
error_box("Errore %d nella cancellazione della %s del movimento %ld",
err, (const char*)caption, numreg);
break;
}
}
cur.freeze(FALSE); cur.freeze(FALSE);
from.zero(); to.zero();
cur.setregion(from, to);
cur.set_filterfunction(NULL);
} }
return FALSE; return FALSE;
@ -143,7 +324,7 @@ bool TDeleteprovv_app::menu(MENU_TAG)
int cg2200(int argc, char** argv) int cg2200(int argc, char** argv)
{ {
TDeleteprovv_app a; TProvvisori_app a;
a.run(argc, argv, "Eliminazione provvisori"); a.run(argc, argv, "Gestione provvisori");
return 0; return 0;
} }

View File

@ -1,4 +1,8 @@
#define F_FROMDATE 101 #define F_FROMDATE 101
#define F_FROMREG 102 #define F_FROMREG 102
#define F_TODATE 103 #define F_FROMCAUS 103
#define F_TOREG 104 #define F_FROMCAUSDESC 104
#define F_TODATE 111
#define F_TOREG 112
#define F_TOCAUS 113
#define F_TOCAUSDESC 114

View File

@ -1,16 +1,16 @@
#include "cg2200.h" #include "cg2200.h"
PAGE "Eliminazione Movimenti Provvisori" -1 -1 42 9 PAGE "Gestione Movimenti Provvisori" -1 -1 52 11
GROUPBOX DLG_NULL 40 3 GROUPBOX DLG_NULL 50 4
BEGIN BEGIN
PROMPT 1 1 "Dal movimento" PROMPT 1 1 "Dalla data/causale"
END END
DATE F_FROMDATE DATE F_FROMDATE
BEGIN BEGIN
PROMPT 2 2 "Data " PROMPT 2 2 "Data "
HELP "Data del primo movimento provvisorio da eliminare" HELP "Data del primo movimento provvisorio"
USE LF_MOV KEY 2 SELECT PROVVIS="P" USE LF_MOV KEY 2 SELECT PROVVIS="P"
INPUT DATAREG F_FROMDATE INPUT DATAREG F_FROMDATE
INPUT NUMREG F_FROMREG INPUT NUMREG F_FROMREG
@ -25,19 +25,41 @@ END
NUMBER F_FROMREG 5 NUMBER F_FROMREG 5
BEGIN BEGIN
PROMPT 22 2 "Operazione " PROMPT 32 2 "Operazione "
FLAGS "DR" FLAGS "DR"
END END
GROUPBOX DLG_NULL 40 3 STRING F_FROMCAUS 3
BEGIN BEGIN
PROMPT 1 4 "Al movimento" PROMPT 2 3 "Causale "
HELP "Data dell'ultimo movimento provvisorio da eliminare" USE LF_CAUSALI
INPUT CODCAUS F_FROMCAUS
DISPLAY "Codice" CODCAUS
DISPLAY "Descrizione@50" DESCR
OUTPUT F_FROMCAUS CODCAUS
OUTPUT F_FROMCAUSDESC DESCR
CHECKTYPE NORMAL
END
STRING F_FROMCAUSDESC 50 30
BEGIN
PROMPT 16 3 ""
USE LF_CAUSALI KEY 2
INPUT DESCR F_FROMCAUSDESC
DISPLAY "Descrizione@50" DESCR
DISPLAY "Codice" CODCAUS
COPY OUTPUT F_FROMCAUS
END
GROUPBOX DLG_NULL 50 4
BEGIN
PROMPT 1 5 "Alla data/causale"
HELP "Data dell'ultimo movimento provvisorio"
END END
DATE F_TODATE DATE F_TODATE
BEGIN BEGIN
PROMPT 2 5 "Data " PROMPT 2 6 "Data "
COPY USE F_FROMDATE COPY USE F_FROMDATE
INPUT DATAREG F_TODATE INPUT DATAREG F_TODATE
INPUT NUMREG F_TOREG INPUT NUMREG F_TOREG
@ -48,18 +70,46 @@ END
NUMBER F_TOREG 5 NUMBER F_TOREG 5
BEGIN BEGIN
PROMPT 22 5 "Operazione " PROMPT 32 6 "Operazione "
FLAGS "DR" FLAGS "DR"
END END
STRING F_TOCAUS 3
BEGIN
PROMPT 2 7 "Causale "
COPY USE F_FROMCAUS
INPUT CODCAUS F_TOCAUS
COPY DISPLAY F_FROMCAUS
OUTPUT F_TOCAUS CODCAUS
OUTPUT F_TOCAUSDESC DESCR
CHECKTYPE NORMAL
END
STRING F_TOCAUSDESC 50 30
BEGIN
PROMPT 16 7 ""
COPY USE F_FROMCAUSDESC
INPUT DESCR F_TOCAUSDESC
COPY DISPLAY F_FROMCAUSDESC
COPY OUTPUT F_TOCAUS
END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -13 -1 ""
END END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 "~Elimina"
MESSAGE EXIT,K_DEL
END
BUTTON DLG_QUIT 10 2 BUTTON DLG_QUIT 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -33 -1 ""
END END
ENDPAGE ENDPAGE

View File

@ -464,7 +464,7 @@ END
BOOLEAN F_STAMPAPROGRE BOOLEAN F_STAMPAPROGRE
BEGIN BEGIN
PROMPT 44 12 "Stampa progressivi attuali" PROMPT 44 12 "Stampa progressivi attuali"
HELP "Indcare se stampare dati attuali a fondo pagina" HELP "Indicare se stampare dati attuali a fondo pagina"
END END
BOOLEAN F_STAMPAMOVPROV BOOLEAN F_STAMPAMOVPROV
@ -475,7 +475,7 @@ END
LIST F_STAMPANUM 15 LIST F_STAMPANUM 15
BEGIN BEGIN
PROMPT 4 15 "Stampa numerazione " PROMPT 4 15 "Stampa numerazione "
HELP "Indicare il tipo di numerazione da stampare" HELP "Indicare il tipo di numerazione da stampare"
ITEM "1|Operazione" ITEM "1|Operazione"
ITEM "2|Riga giornale" ITEM "2|Riga giornale"
@ -484,7 +484,7 @@ END
LIST F_TIPOSTAMPA 34 LIST F_TIPOSTAMPA 34
BEGIN BEGIN
PROMPT 4 16 "Tipo stampa " PROMPT 4 16 "Tipo stampa "
HELP "Indicare il tipo di stampa da ottenere" HELP "Indicare il tipo di stampa da ottenere"
ITEM "1|Mastrini movimentati nel periodo" ITEM "1|Mastrini movimentati nel periodo"
ITEM "2|Mastrini con saldi diversi da 0" ITEM "2|Mastrini con saldi diversi da 0"

View File

@ -1,13 +1,12 @@
// cg3400 - Stampa libro giornale // cg3400 - Stampa libro giornale
#include <isam.h>
#include <mask.h>
#include <utility.h>
#include <tabutil.h>
#include <urldefid.h>
#include <printapp.h>
#include <config.h> #include <config.h>
#include <mask.h>
#include <tabutil.h>
#include <printapp.h>
#include <progind.h> #include <progind.h>
#include <utility.h>
#include <urldefid.h>
#include <mov.h> #include <mov.h>
#include <rmov.h> #include <rmov.h>
@ -514,7 +513,7 @@ void CG3400_application::postclose_print()
{ {
const int ultima_fatta = printer().getcurrentpage() - 1; const int ultima_fatta = printer().getcurrentpage() - 1;
if (yesno_box("La stampa e' corretta ? ")) if (yesno_box("La stampa e' corretta ?"))
{ {
aggiorna_mov (); aggiorna_mov ();
aggiorna_tabreg (_pagina_da, ultima_fatta); aggiorna_tabreg (_pagina_da, ultima_fatta);

View File

@ -17,9 +17,11 @@ MENUBAR MENU_BAR(2)
MENU MENU_BAR(2) MENU MENU_BAR(2)
SUBMENU MENU_FILE "~File" SUBMENU MENU_FILE "~File"
/*
ITEM BAR_ITEM(1) "~Liquidazione" ITEM BAR_ITEM(1) "~Liquidazione"
ITEM BAR_ITEM(2) "~Deleghe" ITEM BAR_ITEM(2) "~Deleghe"
ITEM BAR_ITEM(3) "~Acconto" ITEM BAR_ITEM(3) "~Acconto"
*/
/* cg4 -3 Stampa registri IVA */ /* cg4 -3 Stampa registri IVA */

View File

@ -5,26 +5,25 @@
// ------------------------------------------------------------ // ------------------------------------------------------------
#include <defmask.h> #include <defmask.h>
#include <mailbox.h>
#include <prefix.h>
#include <progind.h> #include <progind.h>
#include <sheet.h> #include <sheet.h>
#include <prefix.h>
#include <utility.h> #include <utility.h>
#include "cg4300.h" #include "cg4300.h"
#include "cg4300a.h" #include "cg4300a.h"
#include <mov.h> #include <mov.h>
#include <mailbox.h>
#include <xvtility.h>
real TLiquidazione_app::CENTO(100.0); real TLiquidazione_app::CENTO(100.0);
inline TLiquidazione_app& app() inline TLiquidazione_app& app()
{ return (TLiquidazione_app&)main_app(); } { return (TLiquidazione_app&)main_app(); }
TLiquidazione_app::TLiquidazione_app() : TLiquidazione_app::TLiquidazione_app(int m) :
_ditte(NULL), _selected(10000), _ditte(NULL), _selected(10000),
_year(4), _nomiditte(100) _year(4), _nomiditte(100), _menu(m)
{ {
_isprint = _is_interactive = _canprint = TRUE; _isprint = _is_interactive = _canprint = TRUE;
_isplafond = _printonly = _is_visliq = FALSE; _isplafond = _printonly = _is_visliq = FALSE;
@ -38,9 +37,9 @@ _year(4), _nomiditte(100)
bool TLiquidazione_app::user_create() bool TLiquidazione_app::user_create()
{ {
// vediamo se c'e' il messaggio per calcolare in batch // vediamo se c'e' il messaggio per calcolare in batch
TMailbox m; TMailbox mail;
TProgind* pnd = NULL; TProgind* pnd = NULL;
TMessage* msg = m.next_s("RCL"); TMessage* msg = mail.next_s("RCL");
TToken_string subj(36); TToken_string subj(36);
_is_interactive = msg == NULL; _is_interactive = msg == NULL;
bool recalc_only = FALSE; bool recalc_only = FALSE;
@ -268,7 +267,7 @@ bool TLiquidazione_app::user_create()
// se ci sono altri mesi dopo l'ultimo calcolato, invalida il // se ci sono altri mesi dopo l'ultimo calcolato, invalida il
// flag 'calcolato' del primo, per causare il ricalcolo dei // flag 'calcolato' del primo, per causare il ricalcolo dei
// successivi (evitando problemi per credito precedente) // successivi (evitando problemi per credito precedente)
for (int m = _month+1; m <= 13; m++) for (m = _month+1; m <= 13; m++)
if (look_lim(m)) if (look_lim(m))
{ {
_lim->put("B0",""); _lim->put("B0","");
@ -339,12 +338,12 @@ bool TLiquidazione_app::user_destroy()
return TRUE; return TRUE;
} }
bool TLiquidazione_app::set_print(int n) bool TLiquidazione_app::set_print(int)
{ {
_descr_arr.destroy(); _descr_arr.destroy();
_errors.destroy(); _errors.destroy();
switch(n) switch(_menu)
{ {
case 1: // liquidazione case 1: // liquidazione
_isprint = TRUE; _isprint = TRUE;
@ -601,13 +600,13 @@ void TLiquidazione_app::set_choice_limits(TMask& m)
{ {
if (_selected[i]) if (_selected[i])
{ {
long dit = _ditte->row(i).get_long(1); const long dit = _ditte->row(i).get_long(1);
if (first == -1l) first = dit; if (first == -1l) first = dit;
if (last < dit) last = dit; if (last < dit) last = dit;
} }
} }
if (first != -1) m.field(CG43_FLD_DFR).set(format("%ld",first)); if (first != -1) m.set(CG43_FLD_DFR, first);
if (last != -1) m.field(CG43_FLD_DTO).set(format("%ld",last)); if (last != -1) m.set(CG43_FLD_DTO, last);
m.set(CG43_FLD_SELECTED, _selected.ones()); m.set(CG43_FLD_SELECTED, _selected.ones());
} }
@ -622,14 +621,14 @@ void TLiquidazione_app::build_ditte_sheet(wht what)
*d = (TToken_string&)_nomiditte[i]; *d = (TToken_string&)_nomiditte[i];
const char vers = d->get_char(2); const char vers = d->get_char(2);
bool selectable = vers == '?'; bool unselectable = vers == '?';
if ((what == mnt && vers == 'T') || (what == trimestre && vers == 'M')) if ((what == mnt && vers == 'T') || (what == trimestre && vers == 'M'))
continue; continue;
d->insert(" |", 0); d->insert(" |", 0);
const long pos = _ditte->add(d); const long pos = _ditte->add(d);
if (selectable) _ditte->disable(pos); if (unselectable) _ditte->disable(pos);
else if (_selected[i]) _ditte->check(pos); else if (_selected[i]) _ditte->check(pos);
} }
} }
@ -706,20 +705,34 @@ bool TLiquidazione_app::set_liquidazione()
int cg4300(int argc, char* argv[]) int cg4300(int argc, char* argv[])
{ {
TLiquidazione_app main_app;
TApplication::check_parameters(argc, argv); TApplication::check_parameters(argc, argv);
const char* title = "Liquidazione IVA"; const char* title = "Liquidazione IVA";
int menu = 1;
if (argc > 2) if (argc > 2)
{ {
if (strcmp(argv[2], "-S") == 0) const char mode = argv[2][1];
title = "Stampa liquidazione"; switch (mode)
else if (strcmp(argv[2], "-C") == 0) {
case 'A':
menu = 3;
break;
case 'C':
title = "Ricalcolo progressivi IVA"; title = "Ricalcolo progressivi IVA";
break;
case 'D':
menu = 2;
break;
case 'S':
title = "Stampa liquidazione";
break;
default:
break;
}
} }
TLiquidazione_app main_app(menu);
main_app.run(argc, argv, title); main_app.run(argc, argv, title);
return TRUE; return TRUE;
} }

View File

@ -167,6 +167,7 @@ class TLiquidazione_app : public TPrint_application
TArray_sheet* _ditte; TArray_sheet* _ditte;
wht _what; wht _what;
TBit_array _selected; TBit_array _selected;
int _menu; // 1 = Liquidazione, 2 = Deleghe, 3 = Deleghe
TString _year; // anno di calcolo TString _year; // anno di calcolo
int _month; // mese da calcolare int _month; // mese da calcolare
TDate _date; // data di stampa TDate _date; // data di stampa
@ -478,7 +479,7 @@ public:
void set_acchead_p(_DescrItem& d); void set_acchead_p(_DescrItem& d);
// cippiuppiu' // cippiuppiu'
TLiquidazione_app(); TLiquidazione_app(int men);
virtual ~TLiquidazione_app() {} virtual ~TLiquidazione_app() {}
}; };

View File

@ -5,8 +5,6 @@
#include "cg4400a.h" #include "cg4400a.h"
#include "cg4400b.h" #include "cg4400b.h"
static TString256 TMP;
inline CG4400_application& app() { return (CG4400_application&)main_app(); } inline CG4400_application& app() { return (CG4400_application&)main_app(); }
bool CG4400_application::filter_func (const TRelation * r) bool CG4400_application::filter_func (const TRelation * r)
@ -537,7 +535,7 @@ bool CG4400_application::to_ditt_handler(TMask_field& f, KEY key)
{ {
const long l = app().select_firm_range(m.get_long(DA_CODICE), m.get_long(A_CODICE)); const long l = app().select_firm_range(m.get_long(DA_CODICE), m.get_long(A_CODICE));
app().set_choice_limits(m); app().set_choice_limits(m);
m.field(F_SELECT).set(format("%ld", l)); m.set(F_SELECT, l);
} }
return TRUE; return TRUE;
} }
@ -553,7 +551,7 @@ bool CG4400_application::fr_ditt_handler(TMask_field& f, KEY key)
{ {
const long l = app().select_firm_range(m.get_long(DA_CODICE), m.get_long(A_CODICE)); const long l = app().select_firm_range(m.get_long(DA_CODICE), m.get_long(A_CODICE));
app().set_choice_limits(m); app().set_choice_limits(m);
m.field(F_SELECT).set(format("%ld", l)); m.set(F_SELECT, l);
} }
return TRUE; return TRUE;
} }
@ -604,8 +602,8 @@ void CG4400_application::set_choice_limits(TMask& m)
if (last < dit) last = dit; if (last < dit) last = dit;
} }
} }
if (first != -1) m.field(DA_CODICE).set(format("%ld",first)); if (first != -1) m.set(DA_CODICE,first);
if (last != -1) m.field(A_CODICE).set(format("%ld",last)); if (last != -1) m.set(A_CODICE,last);
m.set(F_SELECT, _selected.ones()); m.set(F_SELECT, _selected.ones());
} }
@ -2533,7 +2531,7 @@ print_action CG4400_application::postprocess_page (int file, int counter)
bool CG4400_application::set_print(int n) bool CG4400_application::set_print(int n)
{ {
TMask m ("cg4400a"); TMask m("cg4400a");
int giorni_del_mese; int giorni_del_mese;
bool ok; bool ok;
@ -2754,7 +2752,7 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
bool ok = FALSE; bool ok = FALSE;
for (int i = 0; i < _ditte->items(); i++) for (int i = 0; i < _ditte->items(); i++)
{ {
if (_selected[(long)i]) if (_selected[i])
{ {
bool msg = TRUE; bool msg = TRUE;
_ditta = _ditte->row(i).get_long(1); _ditta = _ditte->row(i).get_long(1);

View File

@ -398,8 +398,8 @@ bool CG4600_application::set()
costi (); costi ();
_sld->reset(); //Azzera la tabella dei conti dell'oggetto TSaldo_agg _sld->reset(); //Azzera la tabella dei conti dell'oggetto TSaldo_agg
_pn->destroy_rows(); //Azzero l'oggetto pn.
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
*_cur = 0l; *_cur = 0l;
ricavi(); ricavi();
@ -409,15 +409,15 @@ bool CG4600_application::set()
_totale_saldo = ZERO; _totale_saldo = ZERO;
_sld->reset(); _sld->reset();
_pn->destroy_rows(); //Azzero l'oggetto pn.
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
*_cur = 0l; *_cur = 0l;
attivita(); attivita();
_sld->reset(); _sld->reset();
_pn->destroy_rows(); //Azzero l'oggetto pn.
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
*_cur = 0l; *_cur = 0l;
passivita(); passivita();
@ -438,7 +438,8 @@ void CG4600_application::compila_testata(int annoes,TDate& datareg,
_pn->lfile().put(MOV_NUMREG, _numreg); _pn->lfile().put(MOV_NUMREG, _numreg);
} }
void CG4600_application::rmov_proper(int anno,long numrig,TDate& datareg,TRectype& rmov, TConto& tc,real& tot_saldo, bool sezione_opposta) void CG4600_application::rmov_proper(int anno,long numrig,TDate& datareg,TRectype& rmov,
TConto& tc,real& tot_saldo, bool sezione_opposta)
{ {
char sez_rmov = ' '; char sez_rmov = ' ';
char sezione = ' '; char sezione = ' ';
@ -469,13 +470,13 @@ void CG4600_application::rmov_proper(int anno,long numrig,TDate& datareg,TRectyp
if (sezione_opposta) if (sezione_opposta)
{ {
rmov.put(RMV_SEZIONE, sez_rmov); rmov.put(RMV_SEZIONE, sez_rmov);
_sld->aggiorna(tc,totale,sez_rmov);//Aggiorno anche i saldi con l'oggetto _sld->aggiorna(tc,TImporto(sez_rmov,totale));//Aggiorno anche i saldi con l'oggetto
//TSaldo_agg //TSaldo_agg
} }
else else
{ {
rmov.put(RMV_SEZIONE, sezione); rmov.put(RMV_SEZIONE, sezione);
_sld->aggiorna(tc,totale,sezione);//Aggiorno anche i saldi con l'oggetto _sld->aggiorna(tc,TImporto(sezione,totale));//Aggiorno anche i saldi con l'oggetto
//TSaldo_agg //TSaldo_agg
} }
rmov.put(RMV_IMPORTO, totale); rmov.put(RMV_IMPORTO, totale);
@ -597,7 +598,7 @@ else // riga con importo di sezione opposta
rmov.put(RMV_NUMRIG, numrig); rmov.put(RMV_NUMRIG, numrig);
TBill tc(g,c,s); TBill tc(g,c,s);
_sld->aggiorna(tc,_saldo,sez_rmov); //l'oggetto TSaldo_agg _sld->aggiorna(tc,TImporto(sez_rmov,_saldo)); //l'oggetto TSaldo_agg
j++; j++;
} }
if (_saldi->eof()) break; if (_saldi->eof()) break;
@ -607,7 +608,7 @@ else // riga con importo di sezione opposta
_pn->write(); _pn->write();
_sld->registra(); _sld->registra();
j = 0; j = 0;
_pn->destroy_rows(); //Azzero l'oggetto pn. _pn->destroy_rows(0); //Azzero l'oggetto pn.
} }
} // if (indbil == 3) } // if (indbil == 3)
} // for pcon } // for pcon
@ -728,7 +729,7 @@ else // riga con importo di sezione opposta
rmov.put(RMV_NUMRIG, numrig); rmov.put(RMV_NUMRIG, numrig);
TBill tc(g,c,s); TBill tc(g,c,s);
_sld->aggiorna(tc,_saldo,sez_rmov); //l'oggetto TSaldo_agg _sld->aggiorna(tc,TImporto(sez_rmov,_saldo)); //l'oggetto TSaldo_agg
j++; j++;
} }
if (_saldi->eof()) break; if (_saldi->eof()) break;
@ -738,7 +739,7 @@ else // riga con importo di sezione opposta
_pn->write(); _pn->write();
_sld->registra(); _sld->registra();
j = 0; j = 0;
_pn->destroy_rows(); //Azzero l'oggetto pn. _pn->destroy_rows(0); //Azzero l'oggetto pn.
} }
} // if (indbil == 4) } // if (indbil == 4)
} // for pcon } // for pcon
@ -772,9 +773,9 @@ void CG4600_application::chiusura_conto_economico()
//Compilo la testata per perdite di es. c.patrimon. a Perdita di es. c. econom. //Compilo la testata per perdite di es. c.patrimon. a Perdita di es. c. econom.
//Chiusura capitale netto //Chiusura capitale netto
_pn->destroy_rows(); //Azzero l'oggetto pn.
j = 0; j = 0;
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 4 compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 4
@ -794,9 +795,9 @@ void CG4600_application::chiusura_conto_economico()
//Apertura capitale netto //Apertura capitale netto
_sld->set_anno_es(_annoesap); _sld->set_anno_es(_annoesap);
_pn->destroy_rows(); //Azzero l'oggetto pn.
j = 0; j = 0;
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 10 compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 10
@ -820,9 +821,9 @@ void CG4600_application::chiusura_conto_economico()
//Compilo la testata per Profitti e perdite a Utile di es. c.economico //Compilo la testata per Profitti e perdite a Utile di es. c.economico
//Chiusura conto economico //Chiusura conto economico
_pn->destroy_rows(); //Azzero l'oggetto pn.
j = 0; j = 0;
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 3 compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 3
TRectype& rmov1 = _pn->cg(j); TRectype& rmov1 = _pn->cg(j);
@ -840,9 +841,9 @@ void CG4600_application::chiusura_conto_economico()
//Compilo la testata per Utile di es. c.economico a Utile di es. c.patrimoniale //Compilo la testata per Utile di es. c.economico a Utile di es. c.patrimoniale
//Chiusura capitale netto //Chiusura capitale netto
_pn->destroy_rows(); //Azzero l'oggetto pn.
j = 0; j = 0;
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 4 compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 4
TRectype& rmov3 = _pn->cg(j); TRectype& rmov3 = _pn->cg(j);
@ -861,9 +862,9 @@ void CG4600_application::chiusura_conto_economico()
//Apertura capitale netto //Apertura capitale netto
_sld->set_anno_es(_annoesap); _sld->set_anno_es(_annoesap);
_pn->destroy_rows(); //Azzero l'oggetto pn.
j = 0; j = 0;
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 10 compila_testata(_annoesap,_dataregap,_codcausap); //Reg. 10
@ -893,9 +894,9 @@ void CG4600_application::chiusura_conto_patrimoniale()
//Compilo la testata per Bilancio di chiusura a Perdita di es. c. patrimoniale //Compilo la testata per Bilancio di chiusura a Perdita di es. c. patrimoniale
//Chiusura conto patrimoniale //Chiusura conto patrimoniale
_pn->destroy_rows(); //Azzero l'oggetto pn.
j = 0; j = 0;
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 7 compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 7
TRectype& rmov1 = _pn->cg(j); TRectype& rmov1 = _pn->cg(j);
@ -916,9 +917,9 @@ else
//Compilo la testata per Utile di es. c.patrimon. a Bilancio di chiusura //Compilo la testata per Utile di es. c.patrimon. a Bilancio di chiusura
//Chiusura conto patrimoniale //Chiusura conto patrimoniale
_pn->destroy_rows(); //Azzero l'oggetto pn.
j = 0; j = 0;
ultima_registrazione(); ultima_registrazione();
_pn->destroy_rows(_numreg); //Azzero l'oggetto pn.
compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 7 compila_testata(_annoesch,_dataregch,_codcausch); //Reg. 7
TRectype& rmov1 = _pn->cg(j); TRectype& rmov1 = _pn->cg(j);
@ -1050,7 +1051,7 @@ else // riga con importo di sezione opposta
rmov.put(RMV_NUMRIG, numrig); rmov.put(RMV_NUMRIG, numrig);
TBill tc(g,c,s); TBill tc(g,c,s);
_sld->aggiorna(tc,_saldo,sez_rmov); //l'oggetto TSaldo_agg _sld->aggiorna(tc,TImporto(sez_rmov,_saldo)); //l'oggetto TSaldo_agg
j++; j++;
} }
@ -1100,13 +1101,13 @@ else // riga con importo di sezione opposta
rmov.put(RMV_CONTO, _tcbilap.conto()); rmov.put(RMV_CONTO, _tcbilap.conto());
rmov.put(RMV_SOTTOCONTO, _tcbilap.sottoconto()); //bilancio di chiusura lo rmov.put(RMV_SOTTOCONTO, _tcbilap.sottoconto()); //bilancio di chiusura lo
rmov.put(RMV_SEZIONE, sez_rmov); //sostituisco con quello di rmov.put(RMV_SEZIONE, sez_rmov); //sostituisco con quello di
_sld->aggiorna(_tcbilap,importo,sez_rmov); //apertura, non girando l'importo _sld->aggiorna(_tcbilap,TImporto(sez_rmov,importo)); //apertura, non girando l'importo
} //perche' non l'avevo girato } //perche' non l'avevo girato
else //precedentemente, mentre per gli altri else //precedentemente, mentre per gli altri
{ //conti l'importo deve essere girato, { //conti l'importo deve essere girato,
rmov.put(RMV_SEZIONE, sez_rmov); //perche' erano gia' stati girati rmov.put(RMV_SEZIONE, sez_rmov); //perche' erano gia' stati girati
TBill tc(gruppo,conto,sottoc); //precedentemente per fare la chiusura TBill tc(gruppo,conto,sottoc); //precedentemente per fare la chiusura
_sld->aggiorna(tc,importo,sez_rmov); _sld->aggiorna(tc,TImporto(sez_rmov,importo));
} }
j++; j++;
} }
@ -1114,7 +1115,7 @@ else // riga con importo di sezione opposta
_pn->write(); _pn->write();
_sld->registra(); _sld->registra();
j = 0; j = 0;
_pn->destroy_rows(); //Azzero l'oggetto pn. _pn->destroy_rows(0); //Azzero l'oggetto pn.
} }
} // if (indbil == 1) } // if (indbil == 1)
} // for pcon } // for pcon
@ -1236,7 +1237,7 @@ else // riga con importo di sezione opposta
rmov.put(RMV_NUMRIG, numrig); rmov.put(RMV_NUMRIG, numrig);
TBill tc(g,c,s); TBill tc(g,c,s);
_sld->aggiorna(tc,_saldo,sez_rmov); //l'oggetto TSaldo_agg _sld->aggiorna(tc,TImporto(sez_rmov,_saldo)); //l'oggetto TSaldo_agg
j++; j++;
} }
@ -1286,13 +1287,13 @@ else // riga con importo di sezione opposta
rmov.put(RMV_CONTO, _tcbilap.conto()); rmov.put(RMV_CONTO, _tcbilap.conto());
rmov.put(RMV_SOTTOCONTO, _tcbilap.sottoconto()); //bilancio di chiusura lo rmov.put(RMV_SOTTOCONTO, _tcbilap.sottoconto()); //bilancio di chiusura lo
rmov.put(RMV_SEZIONE, sez_rmov); //sostituisco con quello di rmov.put(RMV_SEZIONE, sez_rmov); //sostituisco con quello di
_sld->aggiorna(_tcbilap,importo,sez_rmov); //apertura, non girando l'importo _sld->aggiorna(_tcbilap,TImporto(sez_rmov,importo)); //apertura, non girando l'importo
} //perche' non l'avevo girato } //perche' non l'avevo girato
else //precedentemente, mentre per gli altri else //precedentemente, mentre per gli altri
{ //conti l'importo deve essere girato, { //conti l'importo deve essere girato,
rmov.put(RMV_SEZIONE, sez_rmov); //perche' erano gia' stati girati rmov.put(RMV_SEZIONE, sez_rmov); //perche' erano gia' stati girati
TBill tc(gruppo,conto,sottoc); //precedentemente per fare la chiusura TBill tc(gruppo,conto,sottoc); //precedentemente per fare la chiusura
_sld->aggiorna(tc,importo,sez_rmov); _sld->aggiorna(tc,TImporto(sez_rmov,importo));
} }
j++; j++;
} }
@ -1300,7 +1301,7 @@ else // riga con importo di sezione opposta
_pn->write(); _pn->write();
_sld->registra(); _sld->registra();
j = 0; j = 0;
_pn->destroy_rows(); _pn->destroy_rows(0);
} }
} // if (indbil == 2) } // if (indbil == 2)
} // for pcon } // for pcon

View File

@ -1,5 +1,4 @@
#include <confapp.h> #include <confapp.h>
//#include <files.h>
#include <isam.h> #include <isam.h>
#include <tabutil.h> #include <tabutil.h>
#include <attiv.h> #include <attiv.h>
@ -76,11 +75,11 @@ void TParametri_ditta::check_registers(int year)
switch (reg.get_int("I0")) switch (reg.get_int("I0"))
{ {
case 1: // vendite case 1: // vendite
flags |= R_VEN; flags |= R_VEN; break;
break;
case 2: // acquisti case 2: // acquisti
flags |= R_ACQ; flags |= R_ACQ; break;
break; default:
break;
} }
if (flags == R_ALL && is_giornale) break; if (flags == R_ALL && is_giornale) break;
} }

View File

@ -2,9 +2,9 @@
#include "pagament.h" #include "pagament.h"
#include <mov.h>
#include <scadenze.h> #include <scadenze.h>
int TPagamento::_rata_ifield(int n, int f) const int TPagamento::_rata_ifield(int n, int f) const
{ {
TToken_string& t = (TToken_string&)_rate[n]; TToken_string& t = (TToken_string&)_rate[n];
@ -1103,9 +1103,9 @@ bool TPartita::rata_pagata(int r) const
return pagata; return pagata;
} }
real TPartita::importo_speso(long nreg, int numrig) const TImporto TPartita::importo_speso(long nreg, int numrig) const
{ {
real imp; TImporto imp;
for (int r = righe(); r > 0; r--) for (int r = righe(); r > 0; r--)
{ {
@ -1116,13 +1116,32 @@ real TPartita::importo_speso(long nreg, int numrig) const
{ {
const int num = pag.get_int(PART_NUMRIG); const int num = pag.get_int(PART_NUMRIG);
if (num == numrig) if (num == numrig)
imp += pag.get_real(PART_IMPORTO); imp += TImporto(pag.get_char(PART_SEZ), pag.get_real(PART_IMPORTO));
} }
} }
return imp; return imp;
} }
void TPartita::update_reg_num(long nreg, const TRectype& mov)
{
for (int r = righe(); r > 0; r--)
{
TRectype& pag = _part.row(r, FALSE);
const long reg = pag.get_long(PART_NREG);
if (reg == nreg)
{
pag.put(PART_NREG, mov.get(MOV_NUMREG));
pag.put(PART_DATAREG, mov.get(MOV_DATAREG));
pag.put(PART_NUMDOC, mov.get(MOV_NUMDOC));
pag.put(PART_DATADOC, mov.get(MOV_DATADOC));
}
}
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TPartite_array // TPartite_array
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -1212,13 +1231,20 @@ int TPartite_array::add_reg_num(long nreg, int numrig)
return (int)cur.items(); return (int)cur.items();
} }
real TPartite_array::importo_speso(long nreg, int numrig) TImporto TPartite_array::importo_speso(long nreg, int numrig)
{ {
real imp; TImporto imp;
const int found = add_reg_num(nreg, numrig); add_reg_num(nreg, numrig);
if (found) for (TPartita* game = first(); game; game = next())
for (TPartita* game = first(); game; game = next()) imp += game->importo_speso(nreg, numrig);
imp += game->importo_speso(nreg, numrig);
return imp; return imp;
} }
void TPartite_array::update_reg_num(long nreg, const TRectype& mov)
{
add_reg_num(nreg, 0);
for (TPartita* game = first(); game; game = next())
game->update_reg_num(nreg, mov);
}

View File

@ -9,14 +9,14 @@
#include <msksheet.h> #include <msksheet.h>
#endif #endif
#ifndef __TABUTIL_H
#include <tabutil.h>
#endif
#ifndef __RELATION_H #ifndef __RELATION_H
#include <relation.h> #include <relation.h>
#endif #endif
#ifndef __TABUTIL_H
#include <tabutil.h>
#endif
#ifndef __CONTO_H #ifndef __CONTO_H
#include "conto.h" #include "conto.h"
#endif #endif
@ -182,8 +182,9 @@ public:
const TString& descrizione() const { return riga(1).get(PART_DESCR); } const TString& descrizione() const { return riga(1).get(PART_DESCR); }
const TImporto& totale() const { return _totale; } const TImporto& totale() const { return _totale; }
real importo_speso(long numreg, int numrig) const; TImporto importo_speso(long numreg, int numrig) const;
void update_reg_num(long nreg, const TRectype& mov);
TPartita(int anno, const char* num); TPartita(int anno, const char* num);
}; };
@ -208,7 +209,8 @@ public:
bool rewrite() { return write(TRUE); } bool rewrite() { return write(TRUE); }
int add_reg_num(long numreg, int numrig); int add_reg_num(long numreg, int numrig);
real importo_speso(long numreg, int numrig); TImporto importo_speso(long numreg, int numrig);
void update_reg_num(long nreg, const TRectype& mov);
TPartita* first() { restart(); return next(); } TPartita* first() { restart(); return next(); }
TPartita* next() { return (TPartita*)get(); } TPartita* next() { return (TPartita*)get(); }