Corretta stampa mastrini: loop infinito e mancata cancellazione cursore
Corretta maschera sheet causali Tentata correzione tipo cr nelle righe iva git-svn-id: svn://10.65.10.50/trunk@445 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
bb4279849b
commit
ef15b9b004
122
cg/cg0100a.uml
122
cg/cg0100a.uml
@ -8,15 +8,15 @@ ENDPAGE
|
||||
|
||||
PAGE "Piano dei conti " 0 -1 0 19
|
||||
|
||||
GROUPBOX DLG_NULL 70 4
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
PROMPT 2 0 ""
|
||||
PROMPT 1 0 ""
|
||||
FLAGS "R"
|
||||
END
|
||||
|
||||
NUMBER FLD_CM1_GRUPPO 3
|
||||
BEGIN
|
||||
PROMPT 4 1 "Gruppo "
|
||||
PROMPT 6 1 "Gruppo "
|
||||
FIELD LF_PCON->GRUPPO
|
||||
FLAGS "R"
|
||||
KEY 1
|
||||
@ -30,7 +30,7 @@ END
|
||||
|
||||
NUMBER FLD_CM1_CONTO 3
|
||||
BEGIN
|
||||
PROMPT 25 1 "Conto "
|
||||
PROMPT 31 1 "Conto "
|
||||
FIELD LF_PCON->CONTO
|
||||
FLAGS "R"
|
||||
KEY 1
|
||||
@ -47,7 +47,7 @@ END
|
||||
|
||||
NUMBER FLD_CM1_SOTTOCONTO 6
|
||||
BEGIN
|
||||
PROMPT 48 1 "Sottoconto "
|
||||
PROMPT 51 1 "Sottoconto "
|
||||
FIELD LF_PCON->SOTTOCONTO
|
||||
FLAGS "R"
|
||||
KEY 1
|
||||
@ -67,7 +67,7 @@ END
|
||||
|
||||
STRING FLD_CM1_DESC 50
|
||||
BEGIN
|
||||
PROMPT 4 2 "Descrizione "
|
||||
PROMPT 6 2 "Descrizione "
|
||||
FIELD LF_PCON->DESCR
|
||||
KEY 2
|
||||
USE LF_PCON KEY 2
|
||||
@ -85,48 +85,48 @@ END
|
||||
|
||||
NUMBER FLD_CM1_CODTABANALISI 10
|
||||
BEGIN
|
||||
PROMPT 4 5 "Codice Tabella Analisi "
|
||||
PROMPT 1 5 "Codice Tabella Analisi "
|
||||
FIELD LF_PCON->CODCBL
|
||||
FLAGS "R"
|
||||
END
|
||||
|
||||
NUMBER FLD_CM1_CODANALISIH 10
|
||||
BEGIN
|
||||
PROMPT 4 5 "Codice Tabella Analisi "
|
||||
PROMPT 1 5 "Codice Tabella Analisi "
|
||||
FLAGS "RHD"
|
||||
END
|
||||
|
||||
LIST FLD_CM1_INDBIL 1 17
|
||||
LIST FLD_CM1_INDBIL 1 22
|
||||
BEGIN
|
||||
PROMPT 4 6 "Sezione di bilancio "
|
||||
PROMPT 1 6 "Sezione di bilancio "
|
||||
FIELD LF_PCON->INDBIL
|
||||
GROUP 1 3
|
||||
HELP "Inserire l' indicatore di bilancio"
|
||||
ITEM "1|Attivita'"
|
||||
ITEM "2|Passivita'"
|
||||
ITEM "3|Costi"
|
||||
ITEM "4|Ricavi"
|
||||
ITEM "5|Conti d'ordine"
|
||||
HELP "Indicatore di bilancio"
|
||||
ITEM "1|1. Attivita'"
|
||||
ITEM "2|2. Passivita'"
|
||||
ITEM "3|3. Costi"
|
||||
ITEM "4|4. Ricavi"
|
||||
ITEM "5|5. Conti d'ordine"
|
||||
END
|
||||
|
||||
LIST FLD_CM1_SEZIVD 1 19
|
||||
LIST FLD_CM1_SEZIVD 1 22
|
||||
BEGIN
|
||||
PROMPT 4 7 "Sez. e classe IV dir.: "
|
||||
PROMPT 1 7 "Sez. e classe IV dir. "
|
||||
FIELD LF_PCON->SEZIVD
|
||||
GROUP 1 4
|
||||
ITEM "0|Nessuna" MESSAGE CLEAR,5@|CLEAR,6@
|
||||
ITEM "1|Attivita'" MESSAGE ENABLE,5@|ENABLE,6@
|
||||
ITEM "2|Passivita'" MESSAGE ENABLE,5@|ENABLE,6@
|
||||
ITEM "9|Conto economico" MESSAGE ENABLE,5@|ENABLE,6@
|
||||
ITEM "5|Conto d'ordine" MESSAGE CLEAR,5@|ENABLE,6@
|
||||
ITEM "6|C.ordine attivo" MESSAGE CLEAR,5@|ENABLE,6@
|
||||
ITEM "7|C.ordine passivo" MESSAGE CLEAR,5@|ENABLE,6@
|
||||
HELP "Inserire il codice del conto secondo la IV direttiva CEE"
|
||||
ITEM "0|0. Nessuna" MESSAGE CLEAR,5@|CLEAR,6@
|
||||
ITEM "1|1. Attivita'" MESSAGE ENABLE,5@|ENABLE,6@
|
||||
ITEM "2|2. Passivita'" MESSAGE ENABLE,5@|ENABLE,6@
|
||||
ITEM "5|5. Conto d'ordine" MESSAGE CLEAR,5@|ENABLE,6@
|
||||
ITEM "6|6. C.ordine attivo" MESSAGE CLEAR,5@|ENABLE,6@
|
||||
ITEM "7|7. C.ordine passivo" MESSAGE CLEAR,5@|ENABLE,6@
|
||||
ITEM "9|9. Conto economico" MESSAGE ENABLE,5@|ENABLE,6@
|
||||
HELP "Codice del conto secondo la IV direttiva CEE"
|
||||
END
|
||||
|
||||
STRING FLD_CM1_LETTIVD 1 1
|
||||
BEGIN
|
||||
PROMPT 51 7 ""
|
||||
PROMPT 56 7 ""
|
||||
FIELD LF_PCON->LETTIVD
|
||||
GROUP 1 5
|
||||
FLAGS "U"
|
||||
@ -134,14 +134,14 @@ END
|
||||
|
||||
STRING FLD_CM1_LETTIVDH 1
|
||||
BEGIN
|
||||
PROMPT 51 7 ""
|
||||
PROMPT 56 7 ""
|
||||
FLAGS "HDU"
|
||||
GROUP 5
|
||||
END
|
||||
|
||||
NUMBER FLD_CM1_NUMRIVD 8 4
|
||||
BEGIN
|
||||
PROMPT 55 7 ""
|
||||
PROMPT 60 7 ""
|
||||
FIELD LF_PCON->NUMRIVD
|
||||
GROUP 1 5
|
||||
FLAGS "MZ"
|
||||
@ -149,14 +149,14 @@ END
|
||||
|
||||
NUMBER FLD_CM1_NUMRIVDH 8 4
|
||||
BEGIN
|
||||
PROMPT 55 7 ""
|
||||
PROMPT 60 7 ""
|
||||
FLAGS "HDMZ"
|
||||
GROUP 5
|
||||
END
|
||||
|
||||
NUMBER FLD_CM1_NUMIVD 2
|
||||
BEGIN
|
||||
PROMPT 66 7 ""
|
||||
PROMPT 71 7 ""
|
||||
FIELD LF_PCON->NUMIVD
|
||||
FLAGS "RZ"
|
||||
GROUP 1 5
|
||||
@ -180,29 +180,29 @@ END
|
||||
|
||||
NUMBER FLD_CM1_NUMIVDH 2
|
||||
BEGIN
|
||||
PROMPT 66 7 ""
|
||||
PROMPT 71 7 ""
|
||||
FLAGS "HDRZ"
|
||||
GROUP 1 5
|
||||
END
|
||||
|
||||
LIST FLD_CM1_SEZIVDOPP 1 19
|
||||
LIST FLD_CM1_SEZIVDOPP 1 22
|
||||
BEGIN
|
||||
PROMPT 4 8 "Classe segno opp.: "
|
||||
PROMPT 1 8 "Classe segno opposto "
|
||||
FIELD LF_PCON->SEZIVDOPP
|
||||
GROUP 1 2 4 6
|
||||
ITEM "0|Nessuna" MESSAGE CLEAR,7@
|
||||
ITEM "1|Attivita'" MESSAGE ENABLE,7@
|
||||
ITEM "2|Passivita'" MESSAGE ENABLE,7@
|
||||
ITEM "9|Conto economico" MESSAGE ENABLE,7@
|
||||
ITEM "5|Conto d'ordine" MESSAGE CLEAR,7@
|
||||
ITEM "6|C.ordine attivo" MESSAGE CLEAR,7@
|
||||
ITEM "7|C.ordine passivo" MESSAGE CLEAR,7@
|
||||
HELP "Inserire il codice del conto di sezione opposta secondo la IV direttiva CEE"
|
||||
ITEM "0|0. Nessuna" MESSAGE CLEAR,7@
|
||||
ITEM "1|1. Attivita'" MESSAGE ENABLE,7@
|
||||
ITEM "2|2. Passivita'" MESSAGE ENABLE,7@
|
||||
ITEM "5|5. Conto d'ordine" MESSAGE CLEAR,7@
|
||||
ITEM "6|6. C.ordine attivo" MESSAGE CLEAR,7@
|
||||
ITEM "7|7. C.ordine passivo" MESSAGE CLEAR,7@
|
||||
ITEM "9|9. Conto economico" MESSAGE ENABLE,7@
|
||||
HELP "Codice del conto di sezione opposta secondo la IV direttiva CEE"
|
||||
END
|
||||
|
||||
STRING FLD_CM1_LETTIVDOPP 1
|
||||
BEGIN
|
||||
PROMPT 51 8 ""
|
||||
PROMPT 56 8 ""
|
||||
FIELD LF_PCON->LETTIVDOPP
|
||||
FLAGS "U"
|
||||
GROUP 1 2 4 7
|
||||
@ -210,7 +210,7 @@ END
|
||||
|
||||
NUMBER FLD_CM1_NUMRIVDOPP 8 4
|
||||
BEGIN
|
||||
PROMPT 55 8 ""
|
||||
PROMPT 60 8 ""
|
||||
FIELD LF_PCON->NUMRIVDOPP
|
||||
FLAGS "MZ"
|
||||
GROUP 1 2 4 7
|
||||
@ -218,7 +218,7 @@ END
|
||||
|
||||
NUMBER FLD_CM1_NUMIVDOPP 2
|
||||
BEGIN
|
||||
PROMPT 66 8 ""
|
||||
PROMPT 71 8 ""
|
||||
FIELD LF_PCON->NUMIVDOPP
|
||||
FLAGS "RZ"
|
||||
GROUP 1 2 4 7
|
||||
@ -236,25 +236,25 @@ BEGIN
|
||||
WARNING "Codice non presente"
|
||||
END
|
||||
|
||||
LIST FLD_CM1_TIPOSPRIC 1 45
|
||||
LIST FLD_CM1_TIPOSPRIC 1 50
|
||||
BEGIN
|
||||
PROMPT 4 9 "Tipo Spesa/Ricavo "
|
||||
PROMPT 1 9 "Tipo Spesa/Ricavo "
|
||||
FIELD LF_PCON->TIPOSPRIC
|
||||
GROUP 1 2
|
||||
HELP "Specificare il tipo Spesa/Ricavo"
|
||||
ITEM "0|Acquisti o vendite in genere"
|
||||
ITEM "1|Acquisti beni per rivendita"
|
||||
ITEM "2|Acquisti beni ammortizzabili"
|
||||
ITEM "3|Acquisti beni ammortizzabili con detr. 6%"
|
||||
ITEM "4|Vendita beni strumentali art. 17"
|
||||
ITEM "5|Beni per rivendita da non ventilare"
|
||||
ITEM "8|Altri beni strumentali acquistati in leasing"
|
||||
ITEM "9|Spese Generali"
|
||||
ITEM "0|0. Acquisti o vendite in genere"
|
||||
ITEM "1|1. Acquisti beni per rivendita"
|
||||
ITEM "2|2. Acquisti beni ammortizzabili"
|
||||
ITEM "3|3. Acquisti beni ammortizzabili con detr. 6%"
|
||||
ITEM "4|4. Vendita beni strumentali art. 17"
|
||||
ITEM "5|5. Beni per rivendita da non ventilare"
|
||||
ITEM "8|8. Altri beni strumentali acquistati in leasing"
|
||||
ITEM "9|9. Spese Generali"
|
||||
END
|
||||
|
||||
LIST FLD_CM1_RICSER 1 18
|
||||
BEGIN
|
||||
PROMPT 4 10 "Ricavi per servizi "
|
||||
PROMPT 1 10 "Ricavi per servizi "
|
||||
FIELD RICSER
|
||||
FLAGS "H"
|
||||
ITEM "0|Altre attivita'"
|
||||
@ -263,7 +263,7 @@ END
|
||||
|
||||
LIST FLD_CM1_TMCF 1 13
|
||||
BEGIN
|
||||
PROMPT 4 11 "Tipo sottoconti "
|
||||
PROMPT 1 11 "Tipo sottoconti "
|
||||
FIELD LF_PCON->TMCF
|
||||
GROUP 1 3
|
||||
HELP "Inserire il tipo dei sottoconti"
|
||||
@ -274,7 +274,7 @@ END
|
||||
|
||||
LIST FLD_CM2_SEZSALDI 1 10
|
||||
BEGIN
|
||||
PROMPT 4 12 "Controllo saldo primanota "
|
||||
PROMPT 1 12 "Controllo saldo primanota "
|
||||
FIELD LF_PCON->SEZSALDI
|
||||
GROUP 1
|
||||
ITEM " |Nessuno"
|
||||
@ -284,7 +284,7 @@ END
|
||||
|
||||
BOOLEAN FLD_CM2_STSOTTBIL
|
||||
BEGIN
|
||||
PROMPT 4 14 "Stampa dettaglio sottoconti su bilanci "
|
||||
PROMPT 1 14 "Stampa dettaglio sottoconti su bilanci "
|
||||
FIELD LF_PCON->STSOTTBIL
|
||||
GROUP 1 3
|
||||
END
|
||||
@ -298,7 +298,7 @@ END
|
||||
|
||||
BOOLEAN FLD_CM2_STSOTTAB
|
||||
BEGIN
|
||||
PROMPT 4 15 "Stampa dettaglio sottoconti su analisi "
|
||||
PROMPT 1 15 "Stampa dettaglio sottoconti su analisi "
|
||||
FIELD LF_PCON->STSOTTAB
|
||||
GROUP 1 3
|
||||
MESSAGE COPY,FLD_CM2_STSOTTABS
|
||||
@ -306,7 +306,7 @@ END
|
||||
|
||||
BOOLEAN FLD_CM2_STSOTTABS
|
||||
BEGIN
|
||||
PROMPT 4 15 "Stampa dettaglio movimenti su analisi "
|
||||
PROMPT 1 15 "Stampa dettaglio movimenti su analisi "
|
||||
FIELD LF_PCON->STSOTTAB
|
||||
FLAGS "H"
|
||||
GROUP 1 2
|
||||
|
@ -30,9 +30,7 @@ BEGIN
|
||||
CHECKTYPE NORMAL
|
||||
OUTPUT 103 GRUPPO
|
||||
OUTPUT 107 DESCR
|
||||
// OUTPUT 102 TMCF
|
||||
WARNING "Gruppo assente"
|
||||
// CHECKTYPE REQUIRED
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 1
|
||||
ADD RUN CG0 -0
|
||||
@ -54,8 +52,10 @@ BEGIN
|
||||
OUTPUT 104 CONTO
|
||||
OUTPUT 103 GRUPPO
|
||||
OUTPUT 107 DESCR
|
||||
OUTPUT 207 DESCR
|
||||
OUTPUT 307 DESCR
|
||||
MESSAGE DIRTY,105|DIRTY,205|DIRTY,305
|
||||
WARNING "Conto inesistente o mancante"
|
||||
WARNING "Conto assente"
|
||||
ADD RUN CG0 -0
|
||||
GROUP 1
|
||||
END
|
||||
@ -73,11 +73,11 @@ BEGIN
|
||||
DISPLAY "Conto" CONTO
|
||||
DISPLAY "Sottoconto" SOTTOCONTO
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Tipo C/F" TMCF
|
||||
OUTPUT 105 SOTTOCONTO
|
||||
OUTPUT 102 TMCF
|
||||
OUTPUT 104 CONTO
|
||||
OUTPUT 205 SOTTOCONTO
|
||||
OUTPUT 305 SOTTOCONTO
|
||||
OUTPUT 103 GRUPPO
|
||||
OUTPUT 104 CONTO
|
||||
OUTPUT 107 DESCR
|
||||
ADD RUN CG0 -0
|
||||
CHECKTYPE NORMAL
|
||||
@ -100,6 +100,8 @@ BEGIN
|
||||
DISPLAY "Gruppo" GRUPPO
|
||||
DISPLAY "Conto" CONTO
|
||||
OUTPUT 205 CODCF
|
||||
OUTPUT 105 CODCF
|
||||
OUTPUT 305 CODCF
|
||||
OUTPUT 207 RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN CG0 -1
|
||||
@ -119,6 +121,8 @@ BEGIN
|
||||
DISPLAY "Gruppo" GRUPPO
|
||||
DISPLAY "Conto" CONTO
|
||||
OUTPUT 305 CODCF
|
||||
OUTPUT 105 CODCF
|
||||
OUTPUT 205 CODCF
|
||||
OUTPUT 307 RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN CG0 -1
|
||||
@ -157,7 +161,7 @@ END
|
||||
// Descrizione CLIENTE
|
||||
STRING 207 50
|
||||
BEGIN
|
||||
PROMPT 1 5 "Rag.sociale "
|
||||
PROMPT 1 5 "Rag. Soc. "
|
||||
FIELD LF_RCAUSALI->DESC
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
@ -175,7 +179,7 @@ END
|
||||
// Descrizione FORNITORE
|
||||
STRING 307 50
|
||||
BEGIN
|
||||
PROMPT 1 5 "Rag.sociale "
|
||||
PROMPT 1 5 "Rag. Soc. "
|
||||
FIELD LF_RCAUSALI->DESC
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "F"
|
||||
@ -190,7 +194,7 @@ BEGIN
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING 108 3
|
||||
STRING 108 5
|
||||
BEGIN
|
||||
PROMPT 1 7 "Descrizione aggiuntiva "
|
||||
FIELD LF_RCAUSALI->CODDESC
|
||||
|
@ -452,6 +452,8 @@ bool TPrimanota_application::get_conto(const TRectype& r, TBill& c) const
|
||||
{
|
||||
c.set(r.get_int("GRUPPO"), r.get_int("CONTO"),
|
||||
r.get_long("SOTTOCONTO"), r.get_char("TIPOC"));
|
||||
if (r.num() == LF_RMOVIVA)
|
||||
c.tipo_cr(r.get_int("TIPOCR"));
|
||||
return c.ok();
|
||||
}
|
||||
|
||||
|
203
cg/cg2102.cpp
203
cg/cg2102.cpp
@ -117,33 +117,15 @@ bool TPrimanota_application::suspended_handler(TMask_field& f, KEY k)
|
||||
// Certified 70%
|
||||
bool TPrimanota_application::detraibile(TToken_string& row)
|
||||
{
|
||||
if (app().iva() == iva_vendite) // Vendite sempre detraibili
|
||||
return TRUE;
|
||||
|
||||
const int tipo_det = row.get_int(2); // Leggi tipo detraibilita
|
||||
if (tipo_det != 0)
|
||||
return FALSE;
|
||||
|
||||
if (app().iva() == iva_vendite) // Vendite sempre detraibili
|
||||
return TRUE;
|
||||
|
||||
TRegistro& reg = app().causale().reg();
|
||||
TString16 chiave;
|
||||
chiave << app().curr_mask().get(F_ANNOIVA) << reg.attivita();
|
||||
|
||||
int tipoatt = 1;
|
||||
if (reg.attivita_mista()) // Se attivita mista ...
|
||||
{
|
||||
TBill bill(row, 5, 0x1);
|
||||
tipoatt = bill.tipo_att(); // ... determina attivita
|
||||
}
|
||||
chiave << tipoatt; // anno|attivita|tipo_attivita
|
||||
|
||||
TTable pla("PLA");
|
||||
pla.put("CODTAB", chiave);
|
||||
const int err = pla.read();
|
||||
real prorata;
|
||||
if (err == NOERR)
|
||||
prorata = pla.get_real("R8");
|
||||
|
||||
return prorata != 100.0;
|
||||
const real& prorata = app().causale().reg().prorata();
|
||||
return prorata != 100.0; // Se prorata = 100% e' indetraibile
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -578,15 +560,26 @@ TSheet_field& TPrimanota_application::ivas() const
|
||||
}
|
||||
|
||||
|
||||
TBill& TPrimanota_application::ivas_bill(TBill& c)
|
||||
{
|
||||
int spric = c.tipo_cr();
|
||||
if (spric == 2 || spric == 3)
|
||||
{
|
||||
const TFixed_string td(causale().tipo_doc());
|
||||
if (td == "FV" || td == "NC") c.tipo_cr(4);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
void TPrimanota_application::set_ivas_row(int nriga, const char* codiva, TBill& tc,
|
||||
const char* desc)
|
||||
{
|
||||
TToken_string& riga = ivas().row(nriga);
|
||||
riga = " "; // Importo
|
||||
riga.add (codiva); // codiva
|
||||
riga.add (" | "); // Det - Imposta
|
||||
riga.add(tc.string(0x7)); // Conto
|
||||
riga.add(desc); // Descrizione
|
||||
riga = " "; // Importo
|
||||
riga.add (codiva); // codiva
|
||||
riga.add (" | "); // Det - Imposta
|
||||
riga.add(ivas_bill(tc).string(0x7)); // Conto
|
||||
riga.add(desc); // Descrizione
|
||||
}
|
||||
|
||||
|
||||
@ -623,6 +616,7 @@ bool TPrimanota_application::codiva_handler(TMask_field& f, KEY key)
|
||||
|
||||
TCodiceIVA iva(f.get());
|
||||
TBill b; app().IVA2bill(iva, b);
|
||||
m.set(105, b.tipo_cr());
|
||||
const char tipo[2] = { b.tipo(), '\0' };
|
||||
m.set(106, tipo);
|
||||
m.set(107, b.gruppo());
|
||||
@ -726,27 +720,37 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
|
||||
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
oldimp = real(row.get(0)); // Imponibile 0
|
||||
oldiva = real(row.get(3)); // Imposta 3
|
||||
if (oldiva.is_zero() && app().causale().corrispettivi())
|
||||
{
|
||||
const TCodiceIVA i(row.get(1));
|
||||
oldimp = real(row.get(0)); // Imponibile
|
||||
oldiva = real(row.get(3)); // Imposta
|
||||
|
||||
if (oldiva.is_zero() && cau.corrispettivi())
|
||||
{ // In caso di corrispettivi ...
|
||||
const TCodiceIVA i(row.get(1));
|
||||
const real percent = i.percentuale();
|
||||
oldiva = scorpora(oldimp, percent);
|
||||
oldiva = scorpora(oldimp, percent); // ... scorpora imposta dall'imponibile
|
||||
}
|
||||
|
||||
const char tipod = detraibile(row) ? 'D' : 'N';
|
||||
oldposiva = type2pos(tipod);
|
||||
|
||||
if (oldposiva < 0 && oldiva != ZERO)
|
||||
if (oldposiva < 0 && !oldiva.is_zero())
|
||||
{
|
||||
const int ri = tipod == 'D' ? 3 : 4;
|
||||
const int ri = tipod == 'D' ? 3 : 4; // Calcola riga causale per l'IVA
|
||||
TBill c; cau.bill(ri, c);
|
||||
const TString80 d(cau.desc_agg(ri));
|
||||
oldposiva = app().set_cgs_row(-1, app().real2imp(ZERO, 'I'), c, d, tipod);
|
||||
if (c.ok())
|
||||
{
|
||||
const TString80 d(cau.desc_agg(ri));
|
||||
oldposiva = app().set_cgs_row(-1, app().real2imp(ZERO, 'I'), c, d, tipod);
|
||||
}
|
||||
else
|
||||
if (ri == 4) // Se non esiste il conto IVA indetraibile ...
|
||||
{ // ... somma imponibile e imposta
|
||||
oldimp += oldiva;
|
||||
oldiva = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
TBill oldconto(row, 6, 0x0); // g/c/s 6 7 8
|
||||
TBill oldconto(row, 6, 0x0); // g/c/s 6 7 8
|
||||
oldpos = bill2pos(oldconto, 'I');
|
||||
if (oldpos < 0 && oldconto.ok())
|
||||
{
|
||||
@ -754,88 +758,94 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
|
||||
oldpos = app().set_cgs_row(-1, app().real2imp(ZERO, 'I'), oldconto, d, 'I');
|
||||
}
|
||||
}
|
||||
if (k == K_DEL)
|
||||
if (k == K_DEL) // Cancellazione di una riga
|
||||
{
|
||||
row.add("0", 0); // Azzera imponibile
|
||||
row.add("0", 3); // Azzera imposta
|
||||
k = K_ENTER; // Elegante o Sporco trucco (dipende dai gusti!)
|
||||
row.add("0", 0); // Azzera imponibile
|
||||
row.add("0", 3); // Azzera imposta
|
||||
k = K_ENTER; // Elegante o Sporco trucco (dipende dai gusti!)
|
||||
}
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
int delimp = -1, deliva = -1;
|
||||
if (oldpos >= 0) // Il conto esisteva anche prima
|
||||
{
|
||||
const TImporto& imp = app().sub_cgs_imp(oldpos, oldimp);
|
||||
if (imp.valore().is_zero) delimp = oldpos;
|
||||
int delimp = -1, deliva = -1; // Eventuali righe da cancellare
|
||||
if (oldpos >= 0) // Se il conto esisteva anche prima ...
|
||||
{ // sottrai il vecchio imponibile
|
||||
const TImporto imp = app().sub_cgs_imp(oldpos, oldimp);
|
||||
if (imp.is_zero) delimp = oldpos;
|
||||
}
|
||||
if (oldposiva >= 0) // Il conto IVA esisteva anche prima
|
||||
{
|
||||
const TImporto& imp = app().sub_cgs_imp(oldposiva, oldiva);
|
||||
if (imp.valore().is_zero) deliva = oldposiva;
|
||||
if (oldposiva >= 0) // Se conto IVA esisteva anche prima ...
|
||||
{ // sottrai la vecchia imposta
|
||||
const TImporto imp = app().sub_cgs_imp(oldposiva, oldiva);
|
||||
if (imp.is_zero) deliva = oldposiva;
|
||||
}
|
||||
|
||||
// Aggiorna conto sulla riga contabile
|
||||
real imp(row.get(0)); // Imponibile
|
||||
real imposta(row.get(3)); // Imposta
|
||||
real imponibile(row.get(0)); // Nuovo imponibile
|
||||
real imposta(row.get(3)); // Nuova imposta
|
||||
|
||||
if (imposta.is_zero() && app().causale().corrispettivi())
|
||||
{
|
||||
const TCodiceIVA i(row.get(1));
|
||||
const real percent = i.percentuale();
|
||||
imposta = scorpora(imp, percent);
|
||||
{ // In caso di corrispettivi ...
|
||||
const TCodiceIVA i(row.get(1));
|
||||
const real percent = i.percentuale();
|
||||
imposta = scorpora(imponibile, percent); // ... scorpora imposta dall'imponibile
|
||||
}
|
||||
|
||||
TBill conto(row, 5, 0x3);
|
||||
int newpos = bill2pos(conto, 'I');
|
||||
TString80 d;
|
||||
int newpos = bill2pos(conto, 'I'); // Riga in cui andra' l'imponibile
|
||||
|
||||
const bool detrarre = detraibile(row); // Determina se IVA detraibile
|
||||
const int ri = detrarre ? 3 : 4; // Calcola riga causale col conto opportuno
|
||||
TBill contoiva; app().causale().bill(ri, contoiva);
|
||||
if (ri == 4 && !contoiva.ok()) // Se non c'e' il conto IVA indetraibile ...
|
||||
{ // ... somma imponibile e imposta
|
||||
imponibile += imposta;
|
||||
imposta = 0.0;
|
||||
}
|
||||
|
||||
// Aggiorna conto sulla riga contabile
|
||||
if (newpos < 0)
|
||||
{
|
||||
if (delimp >= 0) app().reset_cgs_row(delimp);
|
||||
if (delimp >= 0) app().reset_cgs_row(delimp); // Cancella vecchia riga
|
||||
|
||||
const TImporto val(app().real2imp(imp, 'I'));
|
||||
if (val.valore() != ZERO)
|
||||
{
|
||||
d = cau.desc_agg(2);
|
||||
const TImporto val(app().real2imp(imponibile, 'I'));
|
||||
if (!val.is_zero()) // Se c'e' imponibile ...
|
||||
{ // crea una nuova riga contabile
|
||||
const TString80 d(cau.desc_agg(2));
|
||||
app().set_cgs_row(-1, val, conto, d, 'I');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TImporto val(app().real2imp(imp, 'I'));
|
||||
TImporto val(app().real2imp(imponibile, 'I'));
|
||||
val = app().add_cgs_imp(newpos, val);
|
||||
if (val.valore().is_zero())
|
||||
{
|
||||
if (val.valore().is_zero()) // Se la riga si e' azzerata ...
|
||||
{ // ... cancellala
|
||||
app().reset_cgs_row(newpos);
|
||||
newpos = -1;
|
||||
}
|
||||
}
|
||||
oldimp = imp;
|
||||
oldimp = imponibile;
|
||||
oldpos = newpos;
|
||||
|
||||
// Aggiorna conto IVA sulla riga contabile
|
||||
|
||||
const bool detrarre = detraibile(row); // Determina se IVA detraibile
|
||||
const int ri = detrarre ? 3 : 4;
|
||||
app().causale().bill(ri, conto);
|
||||
const char tipod = detrarre ? 'D' : 'N';
|
||||
int newposiva = type2pos(tipod);
|
||||
|
||||
if (newposiva < 0)
|
||||
{
|
||||
const TImporto val(app().real2imp(imposta, 'I'));
|
||||
if (val.valore() != ZERO)
|
||||
{
|
||||
d = cau.desc_agg(ri);
|
||||
newposiva = app().set_cgs_row(-1, val, conto, d, tipod);
|
||||
if (!imposta.is_zero()) // Se c'e' imposta ...
|
||||
{ // ... crea nuova riga per l'IVA
|
||||
const TImporto val(app().real2imp(imposta, 'I'));
|
||||
const TString80 d(cau.desc_agg(ri));
|
||||
newposiva = app().set_cgs_row(-1, val, contoiva, d, tipod);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TImporto val(app().real2imp(imposta, 'I'));
|
||||
val = app().add_cgs_imp(newposiva, val);
|
||||
if (val.valore().is_zero())
|
||||
if (val.is_zero()) // Se la riga si e' azzerata ...
|
||||
{
|
||||
app().reset_cgs_row(newposiva);
|
||||
app().reset_cgs_row(newposiva); // ... cancellala
|
||||
newposiva = -1;
|
||||
}
|
||||
}
|
||||
@ -843,11 +853,11 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
|
||||
oldiva = imposta;
|
||||
oldposiva = newposiva;
|
||||
|
||||
if (r == 0)
|
||||
app().add_cgs_tot(app().curr_mask());
|
||||
app().calcola_imp();
|
||||
app().calcola_saldo();
|
||||
}
|
||||
if (r == 0) // Se cambio la prima riga ...
|
||||
app().add_cgs_tot(app().curr_mask()); // ... ricalcola conti
|
||||
app().calcola_imp(); // Ricalcola totale IVA
|
||||
app().calcola_saldo(); // Ricalcola sbilanci
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -914,14 +924,16 @@ bool TPrimanota_application::iva_sottoconto_handler(TMask_field& f, KEY key)
|
||||
|
||||
if (key == K_TAB && f.dirty() && !app().causale().corrispettivi())
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const TFixed_string td(app().causale().tipo_doc());
|
||||
if (td == "FV" || td == "NC") // Nun lo vulevo fa' CASAP
|
||||
const TLocalisamfile& piano = ((TEdit_field&)f).browse()->cursor()->file();
|
||||
int spric = piano.get_int("TIPOSPRIC");
|
||||
if (spric == 2 || spric == 3)
|
||||
{
|
||||
const int cr = m.get_int(105);
|
||||
if (cr == 2 || cr == 3)
|
||||
m.set(105, 4);
|
||||
const TFixed_string td(app().causale().tipo_doc());
|
||||
if (td == "FV" || td == "NC") spric = 4;
|
||||
}
|
||||
TMask_field& s = f.mask().field(105);
|
||||
if (app().iva() == iva_vendite || s.get().empty())
|
||||
s.set(spric > 0 ? format("%d", spric) : "");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -1009,13 +1021,8 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key)
|
||||
const TCausale c(cau, ann);
|
||||
if (!c.ok()) return FALSE;
|
||||
|
||||
|
||||
ok = app().causale().similar(c);
|
||||
if (!ok)
|
||||
{
|
||||
f.error_box("Causale incongruente con quella inserita precedentemente");
|
||||
return FALSE;
|
||||
}
|
||||
if (!ok) return FALSE;
|
||||
app().causale().read(cau, ann);
|
||||
}
|
||||
|
||||
@ -1280,6 +1287,8 @@ bool TPrimanota_application::IVA2bill(const TCodiceIVA& iva, TBill& bill)
|
||||
if (!bill.ok())
|
||||
cau.bill(2, bill);
|
||||
|
||||
ivas_bill(bill);
|
||||
|
||||
return bill.ok();
|
||||
}
|
||||
|
||||
|
@ -137,6 +137,7 @@ protected:
|
||||
int bill2contr(const TBill& c, char sezione) const;
|
||||
int bill_used(const TBill& conto) const;
|
||||
int det_used(char detraib) const;
|
||||
TBill& ivas_bill(TBill& tc);
|
||||
|
||||
bool read_caus(const char* cod, int year);
|
||||
TCausale& causale() { return _causale; }
|
||||
|
@ -58,6 +58,7 @@ bool TRegistro::read(const char* cod, int year)
|
||||
_att.zero();
|
||||
if (err != NOERR)
|
||||
_rec.zero();
|
||||
_prorata = -1.0;
|
||||
|
||||
return err == NOERR;
|
||||
}
|
||||
@ -94,12 +95,11 @@ const TString& TRegistro::name() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TRegistro& TRegistro::operator =(const TRegistro& r)
|
||||
{
|
||||
_rec = r._rec;
|
||||
_att = r._att;
|
||||
_prorata = r._prorata;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ TipoIVA TRegistro::iva() const
|
||||
}
|
||||
|
||||
bool TRegistro::read_att()
|
||||
{
|
||||
{
|
||||
if (!_att.empty())
|
||||
return TRUE;
|
||||
|
||||
@ -169,6 +169,24 @@ const TString& TRegistro::tipo_attivita()
|
||||
return _att.get("TIPOATT");
|
||||
}
|
||||
|
||||
const real& TRegistro::prorata()
|
||||
{
|
||||
if (_prorata.sign() < 0)
|
||||
{
|
||||
TString16 chiave; // Anno - Attivita' - Tipo Attivita' (fissata a 1)
|
||||
chiave << year();
|
||||
chiave << attivita() << "1";
|
||||
|
||||
TTable pla("PLA");
|
||||
pla.put("CODTAB", chiave);
|
||||
if (pla.read() == NOERR)
|
||||
_prorata = pla.get_real("R8");
|
||||
else
|
||||
_prorata = 0.0;
|
||||
}
|
||||
|
||||
return _prorata;
|
||||
}
|
||||
|
||||
// Certified 99%
|
||||
bool TRegistro::update(long protiva, const TDate& datareg)
|
||||
@ -467,12 +485,18 @@ bool TCausale::corrispettivi() const
|
||||
}
|
||||
|
||||
bool TCausale::similar(const TCausale& c) const
|
||||
{
|
||||
return iva() == c.iva() &&
|
||||
sezionale() == c.sezionale() &&
|
||||
valuta() == c.valuta() &&
|
||||
intra() == c.intra() &&
|
||||
corrispettivi() == c.corrispettivi();
|
||||
{
|
||||
const char* err = "";
|
||||
if (sezionale() != c.sezionale()) err = "il segnale di sezionale";
|
||||
if (intra() != c.intra()) err = "la gestione dei movimenti intra";
|
||||
if (valuta() != c.valuta()) err = "la gestione valuta";
|
||||
if (corrispettivi() != c.corrispettivi()) err = "la gestione dei corrispettivi";
|
||||
if (iva() != c.iva()) err = "il tipo di IVA";
|
||||
|
||||
if (*err)
|
||||
error_box("La causale e' diversa per %s", err);
|
||||
|
||||
return *err ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -27,6 +27,7 @@ class TRegistro : public TObject
|
||||
protected:
|
||||
enum TipoRegistro { libro_giornale = 5 };
|
||||
TRectype _rec, _att;
|
||||
real _prorata;
|
||||
|
||||
public:
|
||||
bool read(const char* code, int year);
|
||||
@ -47,8 +48,8 @@ public:
|
||||
|
||||
bool agenzia_viaggi();
|
||||
const TString& tipo_attivita();
|
||||
bool attivita_mista() { char a = tipo_attivita()[0]; return a == 'M' || a == 'E'; }
|
||||
|
||||
bool attivita_mista() { const char a = tipo_attivita()[0]; return a == 'M' || a == 'E'; }
|
||||
const real& prorata();
|
||||
bool update(long uprotiva, const TDate& lastreg);
|
||||
|
||||
TRegistro(const char* code = "", int year = 0);
|
||||
@ -134,6 +135,8 @@ public:
|
||||
char sezione() const { return _sezione; }
|
||||
const real& valore() const { return _valore; }
|
||||
|
||||
bool is_zero() const { return _valore.is_zero(); }
|
||||
|
||||
const TImporto& operator=(const TImporto& i) { return set(i.sezione(), i.valore()); }
|
||||
const TImporto& operator=(TToken_string& sv);
|
||||
const TImporto& operator+=(const TImporto& i);
|
||||
|
@ -89,7 +89,6 @@ BEGIN
|
||||
OUTPUT 107 GRUPPO
|
||||
OUTPUT 108 CONTO
|
||||
OUTPUT 110 DESCR
|
||||
OUTPUT 105 TIPOSPRIC
|
||||
ADD RUN cg0 -0
|
||||
MESSAGE DIRTY,109|DIRTY,209|DIRTY,309
|
||||
CHECKTYPE NORMAL
|
||||
@ -110,7 +109,6 @@ BEGIN
|
||||
DISPLAY "Sottoconto" SOTTOCONTO
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT 109 SOTTOCONTO
|
||||
OUTPUT 105 TIPOSPRIC
|
||||
OUTPUT 107 GRUPPO
|
||||
OUTPUT 108 CONTO
|
||||
OUTPUT 110 DESCR
|
||||
|
103
cg/cg3.url
103
cg/cg3.url
@ -1,54 +1,51 @@
|
||||
#include <default.url>
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -0
|
||||
* ---------------------------------------------------- */
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM BAR_ITEM(1) "~Movimenti"
|
||||
ITEM BAR_ITEM(2) "~Clienti/fornitori"
|
||||
ITEM BAR_ITEM(3) "~Sezionale"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -1
|
||||
* ---------------------------------------------------- */
|
||||
MENUBAR MENU_BAR(1)
|
||||
|
||||
MENU MENU_BAR(1)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM BAR_ITEM(1) "~Selezione"
|
||||
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -2
|
||||
* ---------------------------------------------------- */
|
||||
|
||||
MENUBAR MENU_BAR(2)
|
||||
|
||||
MENU MENU_BAR(2)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM BAR_ITEM(1) "~Scelta parametri"
|
||||
ITEM BAR_ITEM(2) "~Ricalcolo"
|
||||
ITEM BAR_ITEM(3) "~Disco"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -3
|
||||
*
|
||||
* cg3400.cpp Stampa libro giornale
|
||||
* ----------------------------------------------------*/
|
||||
|
||||
MENUBAR MENU_BAR(3)
|
||||
|
||||
MENU MENU_BAR(3)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM BAR_ITEM(1) "~Scelta parametri"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -4
|
||||
* ---------------------------------------------------- */
|
||||
MENUBAR MENU_BAR(4)
|
||||
|
||||
MENU MENU_BAR(4)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM BAR_ITEM(1) "~Selezione"
|
||||
#include <default.url>
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -0
|
||||
* ---------------------------------------------------- */
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM BAR_ITEM(1) "~Movimenti"
|
||||
ITEM BAR_ITEM(2) "~Clienti/fornitori"
|
||||
ITEM BAR_ITEM(3) "~Sezionale"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -1
|
||||
* ---------------------------------------------------- */
|
||||
MENUBAR MENU_BAR(1)
|
||||
|
||||
MENU MENU_BAR(1)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -2
|
||||
* ---------------------------------------------------- */
|
||||
|
||||
MENUBAR MENU_BAR(2)
|
||||
|
||||
MENU MENU_BAR(2)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM BAR_ITEM(1) "~Scelta parametri"
|
||||
ITEM BAR_ITEM(2) "~Ricalcolo"
|
||||
ITEM BAR_ITEM(3) "~Disco"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -3
|
||||
*
|
||||
* cg3400.cpp Stampa libro giornale
|
||||
* ----------------------------------------------------*/
|
||||
|
||||
MENUBAR MENU_BAR(3)
|
||||
|
||||
MENU MENU_BAR(3)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* ----------------------------------------------------
|
||||
* cg3 -4
|
||||
* ---------------------------------------------------- */
|
||||
MENUBAR MENU_BAR(4)
|
||||
|
||||
MENU MENU_BAR(4)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
|
120
cg/cg3200.cpp
120
cg/cg3200.cpp
@ -23,9 +23,7 @@
|
||||
#include "cglib.h"
|
||||
#include "cglib03.h"
|
||||
|
||||
const MAXSTR = 128;
|
||||
static char __tmp [MAXSTR];
|
||||
static TFixed_string tmp (__tmp, MAXSTR);
|
||||
static TString256 tmp;
|
||||
|
||||
int date2esc(const TDate& d, int* prevesc = NULL);
|
||||
|
||||
@ -66,9 +64,9 @@ class CG3200_application : public TPrintapp
|
||||
|
||||
bool _stampaprogre,_stampatotiva,_stampatot,_prima_volta,_stampa_mov_prov;
|
||||
|
||||
int _annomsk,_annoesmsk,_annomsksucc,_tipo_mask,_anno_ghost;
|
||||
int _annomsk,_annoesmsk,_annoes,_annomsksucc,_tipo_mask,_anno_ghost;
|
||||
int _anno_corrente,_anno_precedente,_indbil;
|
||||
long _sottoc,_numreg,_annoes,_numgio,_protiva;
|
||||
long _sottoc,_numreg,_numgio,_protiva;
|
||||
bool _stampa_progressivi_si,_competenza,_inizio_stampa,_puoi_stampare;
|
||||
char _tipocf,_tmcf;
|
||||
|
||||
@ -119,22 +117,20 @@ public:
|
||||
CG3200_application() {}
|
||||
};
|
||||
|
||||
HIDDEN CG3200_application * app() { return (CG3200_application*) MainApp(); }
|
||||
HIDDEN CG3200_application& app() { return (CG3200_application&) main_app(); }
|
||||
|
||||
void CG3200_application::process_link(int id, const char* txt)
|
||||
{
|
||||
const char* const app = "cg2 -0";
|
||||
TToken_string ss(10);
|
||||
|
||||
ss.add("1");
|
||||
ss.add(txt);
|
||||
const TString app("cg2");
|
||||
TMessage fs(cmd2name(app,""), MSG_LN, ss);
|
||||
TMailbox m;
|
||||
m.send(fs);
|
||||
|
||||
TMessage fs(cmd2name(app), MSG_LN, ss);
|
||||
fs.send();
|
||||
|
||||
TExternal_app pn(app);
|
||||
|
||||
if (pn.run()) beep();
|
||||
pn.run();
|
||||
}
|
||||
|
||||
int date2esc(const TDate& d, int* prevesc)
|
||||
@ -145,8 +141,8 @@ int date2esc(const TDate& d, int* prevesc)
|
||||
{
|
||||
const TDate ia(esc.get("D0")); // Data inizio esercizio
|
||||
const TDate fa(esc.get("D1")); // Data fine esercizio
|
||||
app()->_inizioEs = ia;
|
||||
app()->_fineEs = fa;
|
||||
app()._inizioEs = ia;
|
||||
app()._fineEs = fa;
|
||||
const anno = esc.get_int("CODTAB");
|
||||
if (d >= ia && d <= fa)
|
||||
return anno;
|
||||
@ -189,21 +185,21 @@ bool CG3200_application::almeno_un_record()
|
||||
datacomp = (_mov->curr().get(MOV_DATACOMP));
|
||||
|
||||
if (_annomsk == 0)
|
||||
datareg = rmov.get_date(RMV_DATAREG);
|
||||
datareg = rmov.get_date(RMV_DATAREG);
|
||||
else
|
||||
if (_annomsk != 0)
|
||||
datareg = datacomp;
|
||||
if (_annomsk != 0)
|
||||
datareg = datacomp;
|
||||
|
||||
gruppo = rmov.get_int(RMV_GRUPPO);
|
||||
conto = rmov.get_int(RMV_CONTO);
|
||||
sottoc = rmov.get_long(RMV_SOTTOCONTO);
|
||||
if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc))
|
||||
break;
|
||||
break;
|
||||
else
|
||||
if (((annoes==_annomsk)||(_annomsk==0))&&((datareg>=_data_ini)&&(datareg<=_data_fine)))
|
||||
{
|
||||
trovato = TRUE;
|
||||
break;
|
||||
trovato = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rmov.readat(record);
|
||||
@ -218,24 +214,24 @@ bool CG3200_application::data_inizio(TMask_field& f, KEY k)
|
||||
|
||||
anno = f.mask().get_int(F_ANNO);
|
||||
data = f.mask().get (F_DATAINI);
|
||||
app()->_annomsk = anno;
|
||||
app()._annomsk = anno;
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
if (anno != 0)
|
||||
{
|
||||
app()->data_fine_esercizio(anno);
|
||||
app().data_fine_esercizio(anno);
|
||||
|
||||
if (data == botime)
|
||||
app()->_data_ini = app()->_data_inizioese;
|
||||
app()._data_ini = app()._data_inizioese;
|
||||
else
|
||||
if (data < app()->_data_inizioese || data > app()->_data_finese)
|
||||
if (data < app()._data_inizioese || data > app()._data_finese)
|
||||
{
|
||||
f.error_box("La data non appartiene all' esercizio indicato");
|
||||
f.error_box("La data non appartiene all'esercizio indicato");
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
app()->_data_ini = data;
|
||||
app()._data_ini = data;
|
||||
}
|
||||
else
|
||||
if (anno == 0)
|
||||
@ -246,7 +242,7 @@ bool CG3200_application::data_inizio(TMask_field& f, KEY k)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
app()->_data_ini = data;
|
||||
app()._data_ini = data;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -260,24 +256,24 @@ bool CG3200_application::data_fine(TMask_field& f, KEY k)
|
||||
annoes = f.mask().get_int(F_ANNO);
|
||||
data = f.mask().get (F_DATAFINE);
|
||||
data_ini = f.mask().get (F_DATAINI);
|
||||
app()->_annomsk = annoes;
|
||||
app()._annomsk = annoes;
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
if (annoes != 0)
|
||||
{
|
||||
app()->data_fine_esercizio(annoes);
|
||||
app().data_fine_esercizio(annoes);
|
||||
|
||||
if (data == botime)
|
||||
app()->_data_fine = app()->_data_finese;
|
||||
app()._data_fine = app()._data_finese;
|
||||
else
|
||||
if (data < app()->_data_inizioese || data > app()->_data_finese)
|
||||
if (data < app()._data_inizioese || data > app()._data_finese)
|
||||
{
|
||||
f.error_box("La data non appartiene all' esercizio indicato");
|
||||
f.error_box("La data non appartiene all'esercizio indicato");
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
app()->_data_fine = data;
|
||||
app()._data_fine = data;
|
||||
}
|
||||
else
|
||||
if (annoes == 0)
|
||||
@ -288,15 +284,15 @@ bool CG3200_application::data_fine(TMask_field& f, KEY k)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
app()->_anno_ghost = date2esc(data_ini);
|
||||
app()._anno_ghost = date2esc(data_ini);
|
||||
|
||||
if (data < app()->_inizioEs || data > app()->_fineEs)
|
||||
if (data < app()._inizioEs || data > app()._fineEs)
|
||||
{
|
||||
f.error_box("La data non appartiene all' esercizio indicato");
|
||||
f.error_box("La data non appartiene all'esercizio indicato");
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
app()->_data_fine = data;
|
||||
app()._data_fine = data;
|
||||
}
|
||||
|
||||
if (data < data_ini)
|
||||
@ -580,7 +576,7 @@ bool CG3200_application::preprocess_page(int file, int counter)
|
||||
_mov->read();
|
||||
if (_mov->bad())
|
||||
_mov->zero();
|
||||
_annoes = atoi(_mov->curr().get(MOV_ANNOES));
|
||||
_annoes = _mov->get_int(MOV_ANNOES);
|
||||
_regiva = _mov->curr().get(MOV_REG);
|
||||
|
||||
// Controlla se saldo e' diverso da 0
|
||||
@ -848,14 +844,14 @@ void CG3200_application::documenti_iva()
|
||||
|
||||
void CG3200_application::ricerca_regiva()
|
||||
{
|
||||
TString dep;
|
||||
TString16 dep;
|
||||
|
||||
_tabreg->curr().zero();
|
||||
dep << format("%04d", _annoes);
|
||||
dep << format("%3s" , (const char*) _regiva);
|
||||
_tabreg->curr().put("CODTAB", (const char*) dep);
|
||||
_tabreg->read();
|
||||
_tipo = atoi(_tabreg->curr().get("I0"));
|
||||
_tipo = _tabreg->get_int("I0");
|
||||
}
|
||||
|
||||
bool CG3200_application::preprocess_print(int file, int counter)
|
||||
@ -991,7 +987,7 @@ bool CG3200_application::set_print(int)
|
||||
|
||||
void CG3200_application::data_fine_esercizio(int anno)
|
||||
{
|
||||
TString dep;
|
||||
TString16 dep;
|
||||
|
||||
_tabesc->curr().zero();
|
||||
dep << format ("%04d", anno);
|
||||
@ -1086,7 +1082,7 @@ void CG3200_application::crea_intestazione()
|
||||
set_header(2,"@1g%s",(const char*) sep1);
|
||||
}
|
||||
|
||||
set_header (1, "@0gDITTA@6g%5d", _codice_ditta);
|
||||
set_header (1, "@0gDITTA@6g%5ld", _codice_ditta);
|
||||
set_header (1, "@12g%-45s", (const char*) _ragsoc);
|
||||
set_header (1, "@59g%-25s", (const char*) _indulc);
|
||||
set_header (1, "@86g%-9s", (const char*) _civulc);
|
||||
@ -1096,7 +1092,7 @@ void CG3200_application::crea_intestazione()
|
||||
|
||||
set_header (3, "@0gSottoconto@12g%d", _gruppo);
|
||||
set_header (3, "@16g%d", _conto);
|
||||
set_header (3, "@20g%d", _sottoc);
|
||||
set_header (3, "@20g%ld", _sottoc);
|
||||
|
||||
// conto();
|
||||
|
||||
@ -1323,12 +1319,12 @@ void CG3200_application::calcola_progressivi()
|
||||
saldi.put(SLD_CONTO, _conto);
|
||||
saldi.put(SLD_SOTTOCONTO, _sottoc);
|
||||
|
||||
for ( saldi.read(_isgteq);!saldi.eof();saldi.next(_testandlock))
|
||||
for (saldi.read(_isgteq); saldi.good(); saldi.next())
|
||||
{
|
||||
if (saldi.eof()) break;
|
||||
int annoes_saldi = saldi.curr().get_int(SLD_ANNOES);
|
||||
if (saldi.curr() != record)
|
||||
break;
|
||||
|
||||
if (saldi.curr() > record) break;
|
||||
int annoes_saldi = saldi.curr().get_int(SLD_ANNOES);
|
||||
|
||||
//Calcola i progressivi dell'esercizio attuale
|
||||
|
||||
@ -1384,9 +1380,11 @@ void CG3200_application::calcola_progressivi()
|
||||
// finale dell'esercizio precedente devo calcolarmelo tenendo conto dell'indbil
|
||||
|
||||
if ((_indbil == 1) || (_indbil == 2) || (_indbil == 5))
|
||||
{
|
||||
{
|
||||
const TRecnotype pos = saldi.recno();
|
||||
saldo = _sld.saldofin_esprec(_anno_corrente,_gruppo,_conto,_sottoc);
|
||||
|
||||
saldi.readat(pos);
|
||||
|
||||
if (saldo> ZERO)
|
||||
{
|
||||
progredare_eseprec = saldo;// + pdarescap + pdarep;
|
||||
@ -1463,7 +1461,7 @@ void CG3200_application::ricerca_clifo()
|
||||
TString ragsoc,paiv,cofi,indcf,capcf,ptel,tel,statocf,comcf,dencom,provcom,dep;
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
TLocalisamfile pconti(LF_PCON);
|
||||
TString dataini,datafine;
|
||||
TString16 dataini,datafine;
|
||||
int numrivd;
|
||||
|
||||
clifo.setkey(1);
|
||||
@ -1517,7 +1515,7 @@ void CG3200_application::ricerca_clifo()
|
||||
set_header(3,"@27g%-30s",(const char*) descrizione_gruppo());
|
||||
set_header(3,"@59g%-30s",(const char*) descrizione_conto());
|
||||
set_header(3, "@91g%-30s",(const char*) ragsoc);
|
||||
set_header(4, "@1gClasse@8g%s", (const char*) _lettivd);
|
||||
set_header(4, "Classe@8g%s", (const char*) _lettivd);
|
||||
set_header(4, "@10g%-8s", (const char*) _numrivd);
|
||||
if (_numivd != 0)
|
||||
set_header(4, "@19g%2d", _numivd);
|
||||
@ -1532,11 +1530,10 @@ void CG3200_application::ricerca_clifo()
|
||||
set_header (5, "@22g%s", (const char*) datafine);
|
||||
}
|
||||
else
|
||||
if (_annomsk != 0)
|
||||
{
|
||||
set_header (5, "Periodo di competenza@23g%s", (const char*) dataini);
|
||||
set_header (5, "@35g%s", (const char*) datafine);
|
||||
}
|
||||
{
|
||||
set_header (5, "Periodo di competenza@23g%s", (const char*) dataini);
|
||||
set_header (5, "@35g%s", (const char*) datafine);
|
||||
}
|
||||
|
||||
set_header (5, "@34g%-11s",(const char*) paiv);
|
||||
set_header (5, "@46g%-16s",(const char*) cofi);
|
||||
@ -1604,11 +1601,10 @@ void CG3200_application::ricerca_gruppo()
|
||||
set_header (5, "@24g%s", (const char*) datafine);
|
||||
}
|
||||
else
|
||||
if (_annomsk != 0)
|
||||
{
|
||||
set_header (5, "Periodo di competenza@23g%s", (const char*) dataini);
|
||||
set_header (5, "@35g%s", (const char*) datafine);
|
||||
}
|
||||
{
|
||||
set_header (5, "Periodo di competenza@23g%s", (const char*) dataini);
|
||||
set_header (5, "@35g%s", (const char*) datafine);
|
||||
}
|
||||
}
|
||||
|
||||
//Ricerca la descrizione relativa al gruppo da stampare
|
||||
|
@ -1,19 +1,19 @@
|
||||
#include "cg3200.h"
|
||||
|
||||
PAGE "" -1 -1 78 20
|
||||
PAGE "Stampa Mastrini" -1 -1 78 20
|
||||
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 4 1 "Ditta "
|
||||
FLAGS "FRD"
|
||||
USE LF_NDITTE KEY 1
|
||||
CHECKTYPE REQUIRED
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Codice" CODDITTA
|
||||
FLAGS "FRD"
|
||||
USE LF_NDITTE KEY 1
|
||||
CHECKTYPE REQUIRED
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Codice" CODDITTA
|
||||
DISPLAY "Ragione sociale @50" RAGSOC
|
||||
OUTPUT F_CODDITTA CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
@ -474,9 +474,10 @@ BEGIN
|
||||
ITEM "2|Due"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
BUTTON DLG_PRINT 9 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
PROMPT -12 -1 "~Stampa"
|
||||
MESSAGE EXIT,K_ENTER
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 9 2
|
||||
|
@ -1313,7 +1313,6 @@ print_action CG4400_application::postprocess_print(int file, int counter)
|
||||
bool CG4400_application::set_print(int n)
|
||||
{
|
||||
TMask m("cg4400a");
|
||||
int giorni_del_mese;
|
||||
|
||||
if (set_ditte(m))
|
||||
if (_selected.ones() > 0l)
|
||||
@ -1344,19 +1343,14 @@ bool CG4400_application::set_print(int n)
|
||||
_u_stampata = m.get_int(ULTIMA_PAGINA);
|
||||
//set_page_number(_u_stampata + 1);
|
||||
}
|
||||
if (_fino_a_mese == 12)
|
||||
giorni_del_mese = 31;
|
||||
else
|
||||
{
|
||||
TDate primo = format("01/%02d/%4d", _fino_a_mese+1, _annoes);
|
||||
--primo;
|
||||
giorni_del_mese = primo.day();
|
||||
}
|
||||
_data_a=format("%02d/%02d/%4d",giorni_del_mese,_fino_a_mese,_annoes);
|
||||
|
||||
const int giorni_del_mese = TDate::last_day(_fino_a_mese, _annoes);
|
||||
_data_a=TDate(giorni_del_mese,_fino_a_mese,_annoes);
|
||||
// NB data_da viene letta nella preprocess_page
|
||||
}
|
||||
if (_tipo_stampa == 2)
|
||||
compila_lib();
|
||||
|
||||
stampa_registri_IVA(m);
|
||||
}
|
||||
else warning_box("Nessuna ditta selezionata!");
|
||||
|
19
cg/conto.cpp
19
cg/conto.cpp
@ -33,14 +33,27 @@ TBill::TBill(TToken_string& s, int from, int mode)
|
||||
}
|
||||
|
||||
|
||||
const TBill& TBill::copy(const TBill& bill)
|
||||
{
|
||||
_tipo = bill._tipo;
|
||||
_gruppo = bill._gruppo;
|
||||
_conto = bill._conto;
|
||||
_sottoconto = bill._sottoconto;
|
||||
_descrizione = bill._descrizione;
|
||||
_tipo_cr = bill._tipo_cr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// Certified 100%
|
||||
const TBill& TBill::set(int g, int c, long s, char t, const char* d)
|
||||
const TBill& TBill::set(int g, int c, long s, char t, const char* d, int r)
|
||||
{
|
||||
_tipo = (t > ' ') ? toupper(t) : ' ';
|
||||
_gruppo = g;
|
||||
_conto = c;
|
||||
_sottoconto = s;
|
||||
_descrizione = d;
|
||||
_tipo_cr = r;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -93,7 +106,7 @@ const char* TBill::describe()
|
||||
{
|
||||
int err = NOERR;
|
||||
const char* desc = NULL;
|
||||
|
||||
|
||||
if (_tipo != 'C' && _tipo != 'F')
|
||||
{
|
||||
TLocalisamfile pcon(LF_PCON, FALSE);
|
||||
@ -133,6 +146,8 @@ const char* TBill::describe()
|
||||
_gruppo = clifo.get_int("GRUPPO");
|
||||
_conto = clifo.get_int("CONTO");
|
||||
}
|
||||
if (_tipo_cr < 0)
|
||||
_tipo_cr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
13
cg/conto.h
13
cg/conto.h
@ -21,16 +21,21 @@ protected:
|
||||
virtual int compare(const TSortable& s) const;
|
||||
virtual const char* class_name() const { return "Conto"; }
|
||||
const char* describe();
|
||||
|
||||
const TBill& copy(const TBill& b);
|
||||
|
||||
public:
|
||||
TBill(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL)
|
||||
: _tipo(t), _gruppo(g), _conto(c), _sottoconto(s), _descrizione(d), _tipo_cr(-1) {}
|
||||
TBill(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL, int r = -1)
|
||||
: _tipo(t), _gruppo(g), _conto(c), _sottoconto(s), _descrizione(d), _tipo_cr(r) {}
|
||||
|
||||
TBill(TToken_string& tgcsd, int from, int mode = 0);
|
||||
TBill(const TBill& b) { copy(b); }
|
||||
virtual ~TBill() {}
|
||||
|
||||
const TBill& set(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL);
|
||||
const TBill& set(int g = 0, int c = 0, long s = 0L, char t = ' ',
|
||||
const char* d = NULL, int r = -1);
|
||||
const TBill& add_to(TToken_string& ts, int from, int mode = 0);
|
||||
const TBill& operator=(const TBill& b) { return copy(b); }
|
||||
|
||||
virtual bool ok() const; // Gruppo, Conto e Sottoconto non nulli
|
||||
bool empty() const { return _gruppo==0 && _conto==0 && _sottoconto == 0; }
|
||||
@ -42,6 +47,8 @@ public:
|
||||
|
||||
const TString& descrizione();
|
||||
int tipo_cr();
|
||||
void tipo_cr(int tcr) { _tipo_cr = tcr; }
|
||||
|
||||
int tipo_att();
|
||||
bool read(TRectype& r);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user