Corretto campo Dettaglio sul piano dei conti e relativa stampa

Migliorata gestione contropartite in prima nota
Tolto azzeramento ultima riga giornale da ripristino stampa registri


git-svn-id: svn://10.65.10.50/trunk@912 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-01-26 13:55:45 +00:00
parent 7316ffc269
commit ff2c0e1ec0
12 changed files with 94 additions and 108 deletions

View File

@ -272,9 +272,9 @@ HIDDEN bool conto_handler(TMask_field& f, KEY key)
if (key == K_ENTER) if (key == K_ENTER)
{ {
const TMask& m = f.mask(); const TMask& m = f.mask();
const int gruppo = atoi(m.get(FLD_CM1_GRUPPO)); const int gruppo = m.get_int(FLD_CM1_GRUPPO);
const int conto = atoi(m.get(FLD_CM1_CONTO)); const int conto = m.get_int(FLD_CM1_CONTO);
const long sottoc = atol(m.get(FLD_CM1_SOTTOCONTO)); const long sottoc = m.get_int(FLD_CM1_SOTTOCONTO);
TLocalisamfile& pconti = app().get_relation()->lfile(); TLocalisamfile& pconti = app().get_relation()->lfile();
if (gruppo != 0 && conto != 0 && sottoc != 0) if (gruppo != 0 && conto != 0 && sottoc != 0)

View File

@ -181,7 +181,7 @@ BEGIN
PROMPT 71 7 "" PROMPT 71 7 ""
HELP "Codice del conto secondo la IV direttiva CEE" HELP "Codice del conto secondo la IV direttiva CEE"
FIELD LF_PCON->NUMIVD FIELD LF_PCON->NUMIVD
FLAGS "RZ" FLAGS "Z"
GROUP 1 5 GROUP 1 5
USE %IVD USE %IVD
INPUT CODTAB[1,1] FLD_CM1_SEZIVD INPUT CODTAB[1,1] FLD_CM1_SEZIVD
@ -311,7 +311,7 @@ END
BOOLEAN FLD_CM2_STSOTTBIL BOOLEAN FLD_CM2_STSOTTBIL
BEGIN BEGIN
PROMPT 1 14 "Stampa dettaglio sottoconti su bilanci " PROMPT 1 14 "Non stampare dettaglio sottoconti su bilanci "
HELP "Indicare se stampare il dettaglio dei sottoconti nei bilanci di verifica" HELP "Indicare se stampare il dettaglio dei sottoconti nei bilanci di verifica"
FIELD LF_PCON->STSOTTBIL FIELD LF_PCON->STSOTTBIL
GROUP 1 3 GROUP 1 3

View File

@ -1059,7 +1059,7 @@ void CG1100_application::intesta (stampe tipo)
set_header (soh++, "@20gStampa completa per IV direttiva"); set_header (soh++, "@20gStampa completa per IV direttiva");
s.fill('-'); s.fill('-');
set_header (soh++, (const char *) s); set_header (soh++, (const char *) s);
set_header (soh++, "Conto @59gSez. Classe@75gTipo@86gDettaglio@104gT@107gSpesa@118gDet.alleg.bil."); set_header (soh++, "Conto @59gSez. Classe@75gTipo@86gNo Dettaglio@104gT@107gSpesa@118gDet.alleg.bil.");
set_header (soh++, "Sottoconto @16gDescrizione@61gIV dir.@75gConto@81gC/F@86gBilancio@97gComp.@104gA@107gRicavo@114gSez@118gSot.con * Mov."); set_header (soh++, "Sottoconto @16gDescrizione@61gIV dir.@75gConto@81gC/F@86gBilancio@97gComp.@104gA@107gRicavo@114gSez@118gSot.con * Mov.");
break; break;
@ -1076,7 +1076,7 @@ void CG1100_application::intesta (stampe tipo)
set_header (soh++, "@20gStampa conti non collegati per IV direttiva"); set_header (soh++, "@20gStampa conti non collegati per IV direttiva");
s.fill('_'); s.fill('_');
set_header (soh++, (const char *) s); set_header (soh++, (const char *) s);
set_header (soh++, "Conto @75gTipo@86gDettaglio@104gT@107gSpesa@118gDet.alleg.bil."); set_header (soh++, "Conto @75gTipo@86gNo Dettaglio@104gT@107gSpesa@118gDet.alleg.bil.");
set_header (soh++, "Sottoconto @16gDescrizione@75gConto@81gC/F@86gBilancio@97gComp.@104gA@107gRicavo@114gSez@118gSot.con * Mov."); set_header (soh++, "Sottoconto @16gDescrizione@75gConto@81gC/F@86gBilancio@97gComp.@104gA@107gRicavo@114gSez@118gSot.con * Mov.");
break; break;
@ -1092,7 +1092,7 @@ void CG1100_application::intesta (stampe tipo)
case senza_ana_bil: case senza_ana_bil:
s.fill('_'); s.fill('_');
set_header (soh++, (const char *) s); set_header (soh++, (const char *) s);
set_header (soh++, "Conto @67gSez. Classe@85gTipo@96gDettaglio@112gSpesa @123gDet.bil."); set_header (soh++, "Conto @67gSez. Classe@85gTipo@96gNo Dettaglio@112gSpesa @123gDet.bil.");
set_header (soh++, "Sottoconto @16gDescrizione@68gIV dir. @85gConto @91gC/F @96gBilancio @106gComp. @112gRicavo @119gSez"); set_header (soh++, "Sottoconto @16gDescrizione@68gIV dir. @85gConto @91gC/F @96gBilancio @106gComp. @112gRicavo @119gSez");
break; break;

View File

@ -851,7 +851,7 @@ bool CG1500_application::bil_sez_contr()
{ {
compensa = _pcn->get_bool(PCN_COMPENS); compensa = _pcn->get_bool(PCN_COMPENS);
indbil_conto = _pcn->get_int (PCN_INDBIL); indbil_conto = _pcn->get_int (PCN_INDBIL);
dettaglio = _pcn->get_bool(PCN_STSOTTBIL); dettaglio = !_pcn->get_bool(PCN_STSOTTBIL);
tipo_conto = _pcn->get(PCN_TMCF)[0]; tipo_conto = _pcn->get(PCN_TMCF)[0];
if ( (tipo_conto == 'C') || (tipo_conto == 'F') ) if ( (tipo_conto == 'C') || (tipo_conto == 'F') )
{ {

View File

@ -1069,7 +1069,7 @@ void CG1600_application::crea_sort_piano_conti_scalare()
if ((g != 0) && (c != 0) && (s == 0)) if ((g != 0) && (c != 0) && (s == 0))
{ {
stsottbil = pconti.get_bool(PCN_STSOTTBIL); stsottbil = !pconti.get_bool(PCN_STSOTTBIL);
tmcf = pconti.get (PCN_TMCF)[0]; tmcf = pconti.get (PCN_TMCF)[0];
indbil = pconti.get_int (PCN_INDBIL); indbil = pconti.get_int (PCN_INDBIL);
@ -1457,7 +1457,7 @@ void CG1600_application::crea_sort_piano_conti_verifica()
if ((g != 0) && (c != 0) && (s == 0)) if ((g != 0) && (c != 0) && (s == 0))
{ {
stsottbil = pconti.get_bool(PCN_STSOTTBIL); stsottbil = !pconti.get_bool(PCN_STSOTTBIL);
tmcf = pconti.get(PCN_TMCF)[0]; tmcf = pconti.get(PCN_TMCF)[0];
indbil = pconti.get_int(PCN_INDBIL); indbil = pconti.get_int(PCN_INDBIL);

View File

@ -1,6 +1,5 @@
#include <xvt.h> #include <xvt.h>
#include <stdlib.h> #include <stdlib.h>
#include <applicat.h>
#include "cg2.h" #include "cg2.h"

View File

@ -26,11 +26,8 @@
#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_GRUPPOCLIFO 172 #define F_GRUPPOCLIFO 170
#define F_CONTOCLIFO 173 #define F_CONTOCLIFO 171
#define F_GRUPPORIC 174
#define F_CONTORIC 175
#define F_SOTTOCONTORIC 176
#define F_TOTALE 118 #define F_TOTALE 118
#define F_CODIVA 119 #define F_CODIVA 119
#define F_RITFIS 120 #define F_RITFIS 120

View File

@ -18,31 +18,6 @@ BEGIN
FLAGS "H" FLAGS "H"
END END
NUMBER F_GRUPPOCLIFO 3
BEGIN
FLAGS "H"
END
NUMBER F_CONTOCLIFO 3
BEGIN
FLAGS "H"
END
NUMBER F_GRUPPORIC 3
BEGIN
FLAGS "H"
END
NUMBER F_CONTORIC 3
BEGIN
FLAGS "H"
END
NUMBER F_SOTTOCONTORIC 6
BEGIN
FLAGS "H"
END
GROUPBOX DLG_NULL 78 3 GROUPBOX DLG_NULL 78 3
BEGIN BEGIN
PROMPT 1 0 "@BMovimento IVA" PROMPT 1 0 "@BMovimento IVA"
@ -254,14 +229,9 @@ BEGIN
OUTPUT F_CLIFO TIPOCF OUTPUT F_CLIFO TIPOCF
OUTPUT F_CLIENTE CODCF OUTPUT F_CLIENTE CODCF
OUTPUT F_RAGSOCCLIENTE RAGSOC OUTPUT F_RAGSOCCLIENTE RAGSOC
OUTPUT F_GRUPPOCLIFO GRUPPO
OUTPUT F_CONTOCLIFO CONTO
OUTPUT F_GRUPPORIC GRUPPORIC
OUTPUT F_CONTORIC CONTORIC
OUTPUT F_SOTTOCONTORIC SOTTOCRIC
OUTPUT F_CODPAG CODPAG
OUTPUT F_STATOPAIV STATOPAIV OUTPUT F_STATOPAIV STATOPAIV
OUTPUT F_PIVACLIENTE PAIV OUTPUT F_PIVACLIENTE PAIV
OUTPUT F_CODPAG CODPAG
MESSAGE COPY,F_FORNITORE MESSAGE COPY,F_FORNITORE
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
WARNING "Cliente assente" WARNING "Cliente assente"
@ -285,14 +255,9 @@ BEGIN
OUTPUT F_CLIFO TIPOCF OUTPUT F_CLIFO TIPOCF
OUTPUT F_FORNITORE CODCF OUTPUT F_FORNITORE CODCF
OUTPUT F_RAGSOCFORNITORE RAGSOC OUTPUT F_RAGSOCFORNITORE RAGSOC
OUTPUT F_GRUPPOCLIFO GRUPPO
OUTPUT F_CONTOCLIFO CONTO
OUTPUT F_GRUPPORIC GRUPPORIC
OUTPUT F_CONTORIC CONTORIC
OUTPUT F_SOTTOCONTORIC SOTTOCRIC
OUTPUT F_CODPAG CODPAG
OUTPUT F_STATOPAIV STATOPAIV OUTPUT F_STATOPAIV STATOPAIV
OUTPUT F_PIVAFORNITORE PAIV OUTPUT F_PIVAFORNITORE PAIV
OUTPUT F_CODPAG CODPAG
MESSAGE COPY,F_CLIENTE MESSAGE COPY,F_CLIENTE
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
WARNING "Fornitore assente" WARNING "Fornitore assente"

View File

@ -506,17 +506,22 @@ void TPrimanota_application::generazione_righe_cg(int r)
TImporto importo; importo = row; TImporto importo; importo = row;
if (importo.is_zero()) if (importo.is_zero())
return; return; // Ignora righe senza importo
const bool causale_ok = causale().codice()[0] > ' ';
if (r == 0 && cg.row(1).empty_items()) if (r == 0 && cg.row(1).empty_items())
{ {
TBill contro(row, 9, 0x3); TBill contro(row, 9, 0x3); // Contropartita della prima riga
if (!contro.ok()) if (!contro.ok() && causale_ok)
{
causale().bill(2, contro); // Prendi contropartita dalla causale
if (contro.ok())
{ {
causale().bill(2, contro);
contro.add_to(row, 9, 0x3); contro.add_to(row, 9, 0x3);
cg.force_update(r); cg.force_update(r);
} }
}
if (contro.ok()) if (contro.ok())
{ {
importo.swap_section(); importo.swap_section();
@ -527,13 +532,13 @@ void TPrimanota_application::generazione_righe_cg(int r)
} }
} }
if (causale().codice()[0] > ' ') if (causale_ok)
{ {
int first_not_empty = 0; int first_not_empty = 0;
for (int i = 0; i < r; i++) for (int i = 0; i < r; i++)
{ {
TImporto im; im = cg.row(i); TToken_string& r = cg.row(i);
if (!im.is_zero()) if (r.get(0)[0] > ' ' || r.get()[0] > ' ')
{ {
first_not_empty = i; first_not_empty = i;
break; break;
@ -541,21 +546,23 @@ void TPrimanota_application::generazione_righe_cg(int r)
} }
TBill conto(row, 2, 0x3); TBill conto(row, 2, 0x3);
if (first_not_empty == r) if (first_not_empty == r) // Sono la prima riga con importo ?
{ {
int last = r; int last = r;
for (i = r+1; i < cg.items(); i++) for (i = r+1; i < cg.items(); i++) // Aggiorna tutte le altre contropartite
{ {
TToken_string& rowi = cg.row(i); TToken_string& rowi = cg.row(i);
int gruppo = rowi.get_int(3); int gruppo = rowi.get_int(3);
if (gruppo != 0) if (gruppo != 0) // Considera righe con conto ...
{ {
gruppo = rowi.get_int(10); gruppo = rowi.get_int(10);
if (gruppo == 0) if (gruppo == 0) // ... e senza contropartita
{ {
char sez = 'D'; char sez = ' '; // Calcola sezione D/A della riga i
if (cg.cell_disabled(i,0)) sez = 'A'; if (cg.cell_disabled(i,0)) sez = 'A'; else
if (importo.sezione() != sez) if (cg.cell_disabled(i,1)) sez = 'D';
if (sez != ' ' && importo.sezione() != sez) // Considera solo le sezioni opposte
{ {
conto.add_to(rowi, 9, 0x3); conto.add_to(rowi, 9, 0x3);
cg.force_update(i); cg.force_update(i);
@ -569,17 +576,32 @@ void TPrimanota_application::generazione_righe_cg(int r)
{ {
importo.swap_section(); importo.swap_section();
set_cgs_imp(last, importo); set_cgs_imp(last, importo);
const int gruppo = row.get_int(10);
if (gruppo == 0) // Se non ho contropartita ...
{
TBill contro(cg.row(last), 2, 0x3); // ... copiala dalla riga corrispondente
contro.add_to(row, 9, 0x3);
cg.force_update(r);
}
} }
} }
else else
{ {
TToken_string& rowi = cg.row(first_not_empty); TToken_string& first = cg.row(first_not_empty);
const int gruppo = rowi.get_int(10); int gruppo = first.get_int(10);
if (gruppo == 0) if (gruppo == 0) // Se la prima riga non ha contropartita ...
{ {
conto.add_to(rowi, 9, 0x3); conto.add_to(first, 9, 0x3); // ... copiaci la mia partita
cg.force_update(first_not_empty); cg.force_update(first_not_empty);
} }
gruppo = row.get_int(10);
if (gruppo == 0) // Se non ho contropartita ...
{
TBill contro(first, 2, 0x3); // ... copiala dalla prima riga
contro.add_to(row, 9, 0x3);
cg.force_update(r);
}
} }
} }
} }
@ -1181,15 +1203,14 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key) bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
{ {
bool ok = TRUE; bool ok = TRUE;
TMask& m = f.mask();
if (key == K_TAB || key == K_ENTER) if ((key == K_TAB && m.is_running()) || key == K_ENTER)
{ {
const TDate dr(f.get()); // Data dell'operazione const TDate dr(f.get()); // Data dell'operazione
if (dr > TDate(TODAY)) if (dr > TDate(TODAY))
return f.error_box("La data dell'operazione e' superiore quella di sistema"); return f.error_box("La data dell'operazione e' superiore quella di sistema");
TMask& m = f.mask();
const int ae = date2esc(dr); // Anno esercizio const int ae = date2esc(dr); // Anno esercizio
if (ae == 0) if (ae == 0)
return f.error_box("La data dell'operazione non appartiene a nessun esercizio"); return f.error_box("La data dell'operazione non appartiene a nessun esercizio");
@ -1269,11 +1290,12 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
// Certified 90% // Certified 90%
bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key) bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
{ {
if (key == K_TAB || key == K_ENTER) TMask& m = f.mask();
if ((key == K_TAB && m.is_running()) || key == K_ENTER)
{ {
const TDate dc(f.get()); // Data di competenza const TDate dc(f.get()); // Data di competenza
const int ae = date2esc(dc); // Esercizio corrispondente const int ae = date2esc(dc); // Esercizio corrispondente
TMask& m = f.mask();
const char* data = "del 74/ter"; const char* data = "del 74/ter";
if (f.dlg() == F_DATACOMP) if (f.dlg() == F_DATACOMP)
@ -1382,16 +1404,16 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
{ {
// Lettura del conto dalla maschera // Lettura del conto dalla maschera
char tipo = app().clifo(); char tipo = app().clifo();
int gruppo = m.get_int(F_GRUPPOCLIFO);
int conto = m.get_int(F_CONTOCLIFO);
long codice = m.get_long(tipo == 'C' ? F_CLIENTE : F_FORNITORE); long codice = m.get_long(tipo == 'C' ? F_CLIENTE : F_FORNITORE);
TBill bill(0, 0, codice, tipo);
if (conto == 0 || causale().corrispettivi()) if (!causale().corrispettivi())
bill.find();
if (bill.conto() == 0)
{ {
// Se l'utente non ha ancora specificato un conto lo prendo dalla prima riga della causale // Se l'utente non ha ancora specificato un conto lo prendo dalla prima riga della causale
TBill bill; causale().bill(1, bill); causale().bill(1, bill);
gruppo = bill.gruppo();
conto = bill.conto();
if (causale().corrispettivi()) if (causale().corrispettivi())
{ {
tipo = ' '; tipo = ' ';
@ -1399,7 +1421,7 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
} }
} }
TBill nuovo(gruppo, conto, codice, tipo); TBill nuovo(bill.gruppo(), bill.conto(), codice, tipo);
real tot(m.get(F_TOTALE)); real tot(m.get(F_TOTALE));
@ -1434,11 +1456,10 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
// Certified 99% // Certified 99%
bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key) bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
{ {
if (!suspended_handler(f, key))
return FALSE;
if (key == K_TAB && f.active()) if (key == K_TAB && f.active())
{ {
TMask& m = f.mask();
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)
@ -1446,11 +1467,19 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
clifo.put(CLI_TIPOCF, cf); clifo.put(CLI_TIPOCF, cf);
clifo.read(); clifo.read();
} }
if (!suspended_handler(f, key))
return FALSE;
if (!m.is_running() || f.dirty())
{
app()._conto_ricavo.set(clifo.get_int(CLI_GRUPPORIC),
clifo.get_int(CLI_CONTORIC),
clifo.get_long(CLI_SOTTOCRIC));
const int alleg = clifo.get_int(CLI_ALLEG); const int alleg = clifo.get_int(CLI_ALLEG);
TMask& m = f.mask();
TEdit_field& upi = m.efield(F_RIEPILOGO); TEdit_field& upi = m.efield(F_RIEPILOGO);
upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL); upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL);
}
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
@ -1494,10 +1523,8 @@ bool TPrimanota_application::IVA2bill(const TCodiceIVA& iva, TBill& bill)
if (tipo == "NS") cau.bill(7, bill); if (tipo == "NS") cau.bill(7, bill);
} }
if (!bill.ok() && !cau.corrispettivi()) if (!bill.ok() && !cau.corrispettivi())
{ bill = _conto_ricavo;
const TMask& m = curr_mask();
bill.set(m.get_int(F_GRUPPORIC), m.get_int(F_CONTORIC), m.get_long(F_SOTTOCONTORIC));
}
if (!bill.ok()) if (!bill.ok())
cau.bill(2, bill); cau.bill(2, bill);

View File

@ -56,6 +56,8 @@ class TPrimanota_application : public TRelation_application
long _lastreg; // Numero ultima registrazione long _lastreg; // Numero ultima registrazione
int _mode; // Modo maschera corrente int _mode; // Modo maschera corrente
TBill _conto_ricavo; // Conto di ricavo del clifo
void* _app_data; void* _app_data;
static bool suspended_handler(TMask_field& f, KEY k); static bool suspended_handler(TMask_field& f, KEY k);

View File

@ -1,6 +1,5 @@
#include "cg3400a.h" #include "cg3400a.h"
//PAGE "Stampa Libro Giornale" -1 -1 78 18
PAGE "Stampa Libro Giornale" -1 -1 78 17 PAGE "Stampa Libro Giornale" -1 -1 78 17
GROUPBOX DLG_NULL 78 3 GROUPBOX DLG_NULL 78 3
@ -89,8 +88,8 @@ RADIOBUTTON DLG_NULL 12
BEGIN BEGIN
PROMPT 1 8 "" PROMPT 1 8 ""
HELP "Indicare l'intervallo di pagine da stampare" HELP "Indicare l'intervallo di pagine da stampare"
ITEM "1|Tutto" MESSAGE CLEAR,PAGINA_DA|DISABLE, PAGINA_DA ITEM "1|Tutto" MESSAGE CLEAR,PAGINA_DA|DISABLE,PAGINA_DA
ITEM "2|Da pagina " MESSAGE ENABLE, PAGINA_DA ITEM "2|Da pagina " MESSAGE ENABLE,PAGINA_DA
END END
NUMBER PAGINA_DA 5 NUMBER PAGINA_DA 5

View File

@ -146,13 +146,10 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
else else
reg.zero("D3"); reg.zero("D3");
if (giornale)
reg.put("I6", last_num); // Aggiorna ultima pagina giornale
ok = (reg.rewrite() == NOERR); ok = (reg.rewrite() == NOERR);
if (!ok) if (!ok)
error_box("Errore nell'aggiornamento del registro %s.\n Errore n. %d", error_box("Errore nell'aggiornamento del registro %s.\n Errore n. %d",
(const char * ) regist, mov.status()); (const char * ) regist, mov.status());
} }
else else
ok = error_box("Impossibile leggere il registro %s anno %s", (const char *) regist, (const char *) year); ok = error_box("Impossibile leggere il registro %s anno %s", (const char *) regist, (const char *) year);