Patch level : 12.0 580
Files correlati : cg4.exe f171.trr f171.dir cg2100c.msk cg2.exe cg7.exe cg7800a.rep Modifiche alla dichiarazione e alla liquidazione per il volume d'affari (movimenti per cassa) Corretto il calcolo degli abbuoni in prima nota Corretta la ricerca per partita IVA in prima nota git-svn-id: svn://10.65.10.50/branches/R_10_00@24491 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
283f883c64
commit
6112cb94d9
97
src/cg/IVAxCasNonInc.rep
Normal file
97
src/cg/IVAxCasNonInc.rep
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<report name="ivacasnoninc" lpi="6">
|
||||||
|
<font face="Courier New" size="10" />
|
||||||
|
<section type="Head" pattern="1" />
|
||||||
|
<section type="Head" level="1" pattern="1">
|
||||||
|
<prescript description="H1 PRESCRIPT">0 #F1.102 !
|
||||||
|
0
|
||||||
|
#F1.103 !</prescript>
|
||||||
|
</section>
|
||||||
|
<section type="Head" level="2" pattern="1">
|
||||||
|
<groupby>NUMREG</groupby>
|
||||||
|
<postscript description="H2 POSTSCRIPT">0
|
||||||
|
#F2.102 !
|
||||||
|
0
|
||||||
|
#F2.103 !</postscript>
|
||||||
|
<field type="Testo" width="15" pattern="1" text="Registrazione" />
|
||||||
|
<field border="2" y="1" type="Linea" width="80" height="0" pattern="1" />
|
||||||
|
<field x="15" type="Stringa" width="10" id="101" pattern="1">
|
||||||
|
<source>NUMREG</source>
|
||||||
|
<postscript description="H2.101 POSTSCRIPT">#THIS @
|
||||||
|
#F2.101 !</postscript>
|
||||||
|
</field>
|
||||||
|
</section>
|
||||||
|
<section type="Body" pattern="1" />
|
||||||
|
<section type="Body" level="1" pattern="1">
|
||||||
|
<field type="Numero" align="right" width="10" pattern="1">
|
||||||
|
<source>NUMREG</source>
|
||||||
|
</field>
|
||||||
|
<field x="10.5" type="Numero" align="right" width="10" pattern="1">
|
||||||
|
<source>NUMREGP</source>
|
||||||
|
</field>
|
||||||
|
<field x="20.5" type="Data" width="10" pattern="1">
|
||||||
|
<source>DATAREG</source>
|
||||||
|
</field>
|
||||||
|
<field x="30.5" type="Data" width="10" pattern="1">
|
||||||
|
<source>DATAREGP</source>
|
||||||
|
</field>
|
||||||
|
<field x="41.5" type="Stringa" width="1" id="101" pattern="1">
|
||||||
|
<source>SEZIONE</source>
|
||||||
|
</field>
|
||||||
|
<field x="43.5" type="Valuta" align="right" width="10" id="102" pattern="1" text="#########,@@">
|
||||||
|
<source>IMPONIBILE</source>
|
||||||
|
<postscript description="B1.102 POSTSCRIPT">#102 @
|
||||||
|
#101 @
|
||||||
|
"D"
|
||||||
|
=
|
||||||
|
IF
|
||||||
|
#F2.102 @
|
||||||
|
+
|
||||||
|
#F2.102 !
|
||||||
|
ELSE
|
||||||
|
#F2.103 @
|
||||||
|
+
|
||||||
|
#F2.103 !
|
||||||
|
THEN
|
||||||
|
</postscript>
|
||||||
|
</field>
|
||||||
|
</section>
|
||||||
|
<section type="Foot" pattern="1" />
|
||||||
|
<section type="Foot" level="1" pattern="1">
|
||||||
|
<field x="43" type="Valuta" align="right" width="10" id="102" pattern="1" text="#########,@@" />
|
||||||
|
<field x="54" type="Valuta" align="right" width="10" id="103" pattern="1" text="#########,@@" />
|
||||||
|
<field x="66" type="Valuta" align="right" width="10" id="104" pattern="1" text="#########,@@">
|
||||||
|
<prescript description="F1.104 PRESCRIPT">#102 @
|
||||||
|
#103 @
|
||||||
|
-
|
||||||
|
#THIS !</prescript>
|
||||||
|
</field>
|
||||||
|
</section>
|
||||||
|
<section type="Foot" level="2" pattern="1">
|
||||||
|
<field border="2" y="1" type="Linea" width="80" height="0" pattern="1" />
|
||||||
|
<field y="2" type="Testo" width="10" pattern="1" text="Totale" />
|
||||||
|
<field x="9.5" y="2" type="Numero" align="right" width="10" id="101" pattern="1" />
|
||||||
|
<field x="43" y="2" type="Valuta" align="right" width="10" id="102" pattern="1" text="#########,@@">
|
||||||
|
<postscript description="F2.102 POSTSCRIPT">#102 @
|
||||||
|
#F1.102 @
|
||||||
|
+
|
||||||
|
#F1.102 !
|
||||||
|
</postscript>
|
||||||
|
</field>
|
||||||
|
<field x="54" y="2" type="Valuta" align="right" width="10" id="103" pattern="1" text="#########,@@">
|
||||||
|
<postscript description="F2.103 POSTSCRIPT">#103 @
|
||||||
|
#F1.103 @
|
||||||
|
+
|
||||||
|
#F1.103 !
|
||||||
|
</postscript>
|
||||||
|
</field>
|
||||||
|
<field x="66" y="2" type="Valuta" align="right" width="10" id="104" pattern="1" text="#########,@@">
|
||||||
|
<prescript>#102 @
|
||||||
|
#103 @
|
||||||
|
-
|
||||||
|
#THIS !</prescript>
|
||||||
|
</field>
|
||||||
|
</section>
|
||||||
|
<sql>USE IVADIFF SELECT (BETWEEN(DATAREG,#DADATA,#ADATA))((DATAREGP=="")||(BETWEEN(DATAREGP,#DADATA,#ADATA)))(TIPOIVA==1)(TIPODIFF==2)
|
||||||
|
</sql>
|
||||||
|
</report>
|
@ -22,22 +22,22 @@
|
|||||||
#define F_RITFATT 231
|
#define F_RITFATT 231
|
||||||
|
|
||||||
#define F_CLIFO 128
|
#define F_CLIFO 128
|
||||||
#define F_CLIENTE 151
|
#define F_CODCLIFOR 151
|
||||||
#define F_RAGSOCCLIENTE 152
|
#define F_RAGSOCCF 152
|
||||||
#define F_STATOPAIV 153
|
#define F_STATOPAIV 153
|
||||||
#define F_PIVACLIENTE 154
|
#define F_PIVA 154
|
||||||
#define F_COFICLIENTE 155
|
#define F_COFI 155
|
||||||
#define F_RICALTCLIENTE 156
|
#define F_RICALT 156
|
||||||
|
|
||||||
// Riferimenti al fornitore per bolle doganali
|
// Riferimenti al fornitore per bolle doganali
|
||||||
#define F_BOLLACODCLI 157
|
#define F_BOLLACODCLI 157
|
||||||
#define F_BOLLARAGCLI 158
|
#define F_BOLLARAGCLI 158
|
||||||
|
|
||||||
#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_COFIFORNITORE 165
|
||||||
#define F_RICALTFORNITORE 166
|
//#define F_RICALTFORNITORE 166
|
||||||
|
|
||||||
#define NP_CONTSEP 168
|
#define NP_CONTSEP 168
|
||||||
#define NP_DESCONTSEP 169
|
#define NP_DESCONTSEP 169
|
||||||
|
@ -192,7 +192,7 @@ BEGIN
|
|||||||
PROMPT 25 8 "Riepilogo al n."
|
PROMPT 25 8 "Riepilogo al n."
|
||||||
FIELD UPROTIVA
|
FIELD 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 cliente/fornitore ha codice inserimento in allegati uguale a 3)"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST F_DIFFERITA 1 19
|
LIST F_DIFFERITA 1 19
|
||||||
@ -202,150 +202,84 @@ BEGIN
|
|||||||
ITEM "X|periodo precedente"
|
ITEM "X|periodo precedente"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_CLIENTE 6
|
NUMBER F_CODCLIFOR 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 9 "Cliente "
|
PROMPT 1 9 "Cliente "
|
||||||
FIELD CODCF
|
FIELD CODCF
|
||||||
GROUP 1
|
GROUP 1
|
||||||
USE LF_CLIFO
|
USE LF_CLIFO
|
||||||
INPUT TIPOCF "C"
|
INPUT TIPOCF F_CLIFO SELECT
|
||||||
INPUT CODCF F_CLIENTE
|
INPUT CODCF F_CODCLIFOR
|
||||||
DISPLAY "Codice" CODCF
|
DISPLAY "Codice" CODCF
|
||||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||||
DISPLAY "Sospeso@C" SOSPESO
|
DISPLAY "Sospeso@C" SOSPESO
|
||||||
DISPLAY "Partita IVA@12" PAIV
|
DISPLAY "Partita IVA@12" PAIV
|
||||||
DISPLAY "Codice Fiscale@16" COFI
|
DISPLAY "Codice Fiscale@16" COFI
|
||||||
OUTPUT F_CLIENTE CODCF
|
OUTPUT F_CODCLIFOR CODCF
|
||||||
OUTPUT F_RAGSOCCLIENTE RAGSOC
|
OUTPUT F_RAGSOCCF RAGSOC
|
||||||
OUTPUT F_STATOPAIV STATOPAIV
|
OUTPUT F_STATOPAIV STATOPAIV
|
||||||
OUTPUT F_PIVACLIENTE PAIV
|
OUTPUT F_PIVA PAIV
|
||||||
OUTPUT F_COFICLIENTE COFI
|
OUTPUT F_COFI COFI
|
||||||
OUTPUT F_RICALTCLIENTE RICALT
|
OUTPUT F_RICALT RICALT
|
||||||
OUTPUT F_CLIFO TIPOCF
|
|
||||||
MESSAGE COPY,F_FORNITORE
|
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
WARNING "Cliente assente"
|
WARNING "Cliente/Fornitore assente"
|
||||||
ADD RUN cg0 -1 C
|
ADD RUN cg0 -1 C
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_FORNITORE 6
|
|
||||||
BEGIN
|
|
||||||
PROMPT 1 9 "Fornitore "
|
|
||||||
FIELD CODCF
|
|
||||||
GROUP 2
|
|
||||||
USE LF_CLIFO
|
|
||||||
INPUT TIPOCF "F"
|
|
||||||
INPUT CODCF F_FORNITORE
|
|
||||||
DISPLAY "Codice" CODCF
|
|
||||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
|
||||||
DISPLAY "Sospeso@C" SOSPESO
|
|
||||||
DISPLAY "Partita IVA@12" PAIV
|
|
||||||
DISPLAY "Codice Fiscale@16" COFI
|
|
||||||
OUTPUT F_FORNITORE CODCF
|
|
||||||
OUTPUT F_RAGSOCFORNITORE RAGSOC
|
|
||||||
OUTPUT F_STATOPAIV STATOPAIV
|
|
||||||
OUTPUT F_PIVAFORNITORE PAIV
|
|
||||||
OUTPUT F_COFIFORNITORE COFI
|
|
||||||
OUTPUT F_RICALTFORNITORE RICALT
|
|
||||||
OUTPUT F_CLIFO TIPOCF
|
|
||||||
MESSAGE COPY,F_CLIENTE
|
|
||||||
CHECKTYPE REQUIRED
|
|
||||||
WARNING "Fornitore assente"
|
|
||||||
ADD RUN cg0 -1 F
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_RAGSOCFORNITORE 50
|
STRING F_RAGSOCCF 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 25 9 ""
|
PROMPT 25 9 ""
|
||||||
GROUP 2
|
GROUP 2
|
||||||
USE LF_CLIFO KEY 2
|
USE LF_CLIFO KEY 2
|
||||||
INPUT TIPOCF "F"
|
INPUT TIPOCF F_CLIFO SELECT
|
||||||
INPUT RAGSOC F_RAGSOCFORNITORE
|
INPUT RAGSOC F_RAGSOCCF
|
||||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||||
DISPLAY "Codice" CODCF
|
DISPLAY "Codice" CODCF
|
||||||
DISPLAY "Sospeso@C" SOSPESO
|
DISPLAY "Sospeso@C" SOSPESO
|
||||||
DISPLAY "Partita IVA@12" PAIV
|
DISPLAY "Partita IVA@12" PAIV
|
||||||
DISPLAY "Codice Fiscale@16" COFI
|
DISPLAY "Codice Fiscale@16" COFI
|
||||||
COPY OUTPUT F_FORNITORE
|
COPY OUTPUT F_CODCLIFOR
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
ADD RUN cg0 -1 F
|
ADD RUN cg0 -1 F
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_RAGSOCCLIENTE 50
|
|
||||||
BEGIN
|
|
||||||
PROMPT 25 9 ""
|
|
||||||
GROUP 1
|
|
||||||
USE LF_CLIFO KEY 2
|
|
||||||
INPUT TIPOCF "C"
|
|
||||||
INPUT RAGSOC F_RAGSOCCLIENTE
|
|
||||||
COPY DISPLAY F_RAGSOCFORNITORE
|
|
||||||
COPY OUTPUT F_CLIENTE
|
|
||||||
CHECKTYPE REQUIRED
|
|
||||||
ADD RUN cg0 -1 C
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_COFICLIENTE 16
|
STRING F_COFI 16
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 10 "C.F. "
|
PROMPT 1 10 "C.F. "
|
||||||
GROUP 1
|
GROUP 1
|
||||||
USE LF_CLIFO KEY 4
|
USE LF_CLIFO KEY 4
|
||||||
INPUT TIPOCF "C"
|
INPUT TIPOCF F_CLIFO SELECT
|
||||||
INPUT COFI F_COFICLIENTE
|
INPUT COFI F_COFI
|
||||||
DISPLAY "Codice fiscale@16" COFI
|
DISPLAY "Codice fiscale@16" COFI
|
||||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||||
DISPLAY "Codice" CODCF
|
DISPLAY "Codice" CODCF
|
||||||
DISPLAY "Sospeso@C" SOSPESO
|
DISPLAY "Sospeso@C" SOSPESO
|
||||||
DISPLAY "Partita IVA@12" PAIV
|
DISPLAY "Partita IVA@12" PAIV
|
||||||
COPY OUTPUT F_CLIENTE
|
COPY OUTPUT F_CODCLIFOR
|
||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
ADD RUN cg0 -1 C
|
ADD RUN cg0 -1 C
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_COFIFORNITORE 16
|
STRING F_PIVA 12
|
||||||
BEGIN
|
|
||||||
PROMPT 1 10 "C.F. "
|
|
||||||
GROUP 2
|
|
||||||
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
|
|
||||||
|
|
||||||
STRING F_PIVACLIENTE 12
|
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 26 10 "P.I. "
|
PROMPT 26 10 "P.I. "
|
||||||
GROUP 1
|
GROUP 1
|
||||||
USE LF_CLIFO KEY 5
|
USE LF_CLIFO KEY 5
|
||||||
INPUT TIPOCF "C"
|
INPUT TIPOCF F_CLIFO SELECT
|
||||||
INPUT STATOPAIV F_STATOPAIV
|
INPUT STATOPAIV F_STATOPAIV
|
||||||
INPUT PAIV F_PIVACLIENTE
|
INPUT PAIV F_PIVA
|
||||||
DISPLAY "Partita IVA@12" PAIV
|
DISPLAY "Partita IVA@12" PAIV
|
||||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||||
DISPLAY "Codice" CODCF
|
DISPLAY "Codice" CODCF
|
||||||
DISPLAY "Sospeso@C" SOSPESO
|
DISPLAY "Sospeso@C" SOSPESO
|
||||||
DISPLAY "Codice Fiscale@16" COFI
|
DISPLAY "Codice Fiscale@16" COFI
|
||||||
COPY OUTPUT F_CLIENTE
|
COPY OUTPUT F_CODCLIFOR
|
||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
ADD RUN cg0 -1 C
|
ADD RUN cg0 -1 C
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_PIVAFORNITORE 12
|
|
||||||
BEGIN
|
|
||||||
PROMPT 26 10 "P.I. "
|
|
||||||
GROUP 2
|
|
||||||
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_STATOPAIV 2
|
STRING F_STATOPAIV 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 46 10 ""
|
PROMPT 46 10 ""
|
||||||
@ -358,42 +292,24 @@ BEGIN
|
|||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_RICALTCLIENTE 30 18
|
STRING F_RICALT 30 18
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 52 10 "Alt. "
|
PROMPT 52 10 "Alt. "
|
||||||
USE LF_CLIFO KEY 6
|
USE LF_CLIFO KEY 6
|
||||||
INPUT TIPOCF "C"
|
INPUT TIPOCF F_CLIFO SELECT
|
||||||
INPUT RICALT F_RICALTCLIENTE
|
INPUT RICALT F_RICALT
|
||||||
DISPLAY "Codice alternativo@30" RICALT
|
DISPLAY "Codice alternativo@30" RICALT
|
||||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||||
DISPLAY "Codice" CODCF
|
DISPLAY "Codice" CODCF
|
||||||
DISPLAY "Sospeso@C" SOSPESO
|
DISPLAY "Sospeso@C" SOSPESO
|
||||||
DISPLAY "Partita IVA@12" PAIV
|
DISPLAY "Partita IVA@12" PAIV
|
||||||
DISPLAY "Codice Fiscale@16" COFI
|
DISPLAY "Codice Fiscale@16" COFI
|
||||||
COPY OUTPUT F_CLIENTE
|
COPY OUTPUT F_CODCLIFOR
|
||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
ADD RUN cg0 -1 C
|
ADD RUN cg0 -1 C
|
||||||
GROUP 1
|
GROUP 1
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_RICALTFORNITORE 30 18
|
|
||||||
BEGIN
|
|
||||||
PROMPT 52 10 "Alt. "
|
|
||||||
USE LF_CLIFO KEY 6
|
|
||||||
INPUT TIPOCF "F"
|
|
||||||
INPUT RICALT F_RICALTFORNITORE
|
|
||||||
DISPLAY "Codice alternativo@30" RICALT
|
|
||||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
|
||||||
DISPLAY "Codice" CODCF
|
|
||||||
DISPLAY "Sospeso@C" SOSPESO
|
|
||||||
DISPLAY "Partita IVA@12" PAIV
|
|
||||||
DISPLAY "Codice Fiscale@16" COFI
|
|
||||||
COPY OUTPUT F_FORNITORE
|
|
||||||
CHECKTYPE NORMAL
|
|
||||||
ADD RUN cg0 -1 F
|
|
||||||
GROUP 2
|
|
||||||
END
|
|
||||||
|
|
||||||
BUTTON F_OCCASEDIT 50
|
BUTTON F_OCCASEDIT 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 10 "Dati del cliente o fornitore occasionale"
|
PROMPT 1 10 "Dati del cliente o fornitore occasionale"
|
||||||
|
@ -2562,7 +2562,7 @@ bool TPrimanota_application::numdoc_handler(TMask_field& f, KEY key)
|
|||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
|
|
||||||
const int annodoc = m.get_date(F_DATADOC).year();
|
const int annodoc = m.get_date(F_DATADOC).year();
|
||||||
const long fornitore = m.get_long(F_FORNITORE);
|
const long fornitore = m.get_long(F_CODCLIFOR);
|
||||||
if (annodoc > 0 && fornitore > 0)
|
if (annodoc > 0 && fornitore > 0)
|
||||||
{
|
{
|
||||||
// SELECT NUMREG,DATAREG,DATADOC,NUMDOC FROM MOV
|
// SELECT NUMREG,DATAREG,DATADOC,NUMDOC FROM MOV
|
||||||
@ -2729,7 +2729,7 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
|
|||||||
const bool corri = causale().corrispettivi();
|
const bool corri = causale().corrispettivi();
|
||||||
const TString4 tipo = corri ? " " : app().clifo();
|
const TString4 tipo = corri ? " " : app().clifo();
|
||||||
int gruppo = 0, conto = 0;
|
int gruppo = 0, conto = 0;
|
||||||
long codice = corri ? 0L : m.get_long(tipo == 'C' ? F_CLIENTE : F_FORNITORE);
|
long codice = corri ? 0L : m.get_long(F_CODCLIFOR);
|
||||||
|
|
||||||
TSheet_field& ss = cgs();
|
TSheet_field& ss = cgs();
|
||||||
const int riga_totale = type2pos('T');
|
const int riga_totale = type2pos('T');
|
||||||
@ -2858,8 +2858,8 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
m.hide(F_OCCASEDIT); // Spegni bottone occasionali
|
m.hide(F_OCCASEDIT); // Spegni bottone occasionali
|
||||||
m.show(F_STATOPAIV); // Stato partita IVA
|
m.show(F_STATOPAIV); // Stato partita IVA
|
||||||
m.show(cf == "C" ? F_PIVACLIENTE : F_PIVAFORNITORE); // Partita IVA
|
m.show(F_PIVA); // Partita IVA
|
||||||
m.show(cf == "C" ? F_COFICLIENTE : F_COFIFORNITORE); // Codice Fiscale
|
m.show(F_COFI); // Codice Fiscale
|
||||||
a.activate_numrif(m, true);
|
a.activate_numrif(m, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2947,8 +2947,8 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
m.show(F_STATOPAIV, !occas); // Stato partita IVA
|
m.show(F_STATOPAIV, !occas); // Stato partita IVA
|
||||||
if (!occas)
|
if (!occas)
|
||||||
m.set(F_STATOPAIV, clifo.get(CLI_STATOPAIV));
|
m.set(F_STATOPAIV, clifo.get(CLI_STATOPAIV));
|
||||||
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE, !occas); // Partita IVA
|
m.show(F_PIVA, !occas); // Partita IVA
|
||||||
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE, !occas); // Codice Fiscale
|
m.show(F_COFI, !occas); // Codice Fiscale
|
||||||
|
|
||||||
if (occas && a.is_fattura() && a.partite().first() != NULL)
|
if (occas && a.is_fattura() && a.partite().first() != NULL)
|
||||||
{
|
{
|
||||||
@ -3115,7 +3115,7 @@ bool TPrimanota_application::activate_split_payment(TMask& m)
|
|||||||
{
|
{
|
||||||
if (clifo() == "C" && m.get_int(F_ANNOIVA) >= 2015 && !causale().reverse_charge())
|
if (clifo() == "C" && m.get_int(F_ANNOIVA) >= 2015 && !causale().reverse_charge())
|
||||||
{
|
{
|
||||||
const TRectype& cliente = cache().get_rec(LF_CLIFO, "C", m.get(F_CLIENTE));
|
const TRectype& cliente = cache().get_rec(LF_CLIFO, "C", m.get(F_CODCLIFOR));
|
||||||
yes = cliente.get_bool(CLI_SPLITPAY);
|
yes = cliente.get_bool(CLI_SPLITPAY);
|
||||||
}
|
}
|
||||||
if (yes)
|
if (yes)
|
||||||
@ -3140,6 +3140,9 @@ const TString & TPrimanota_application::clifo() const
|
|||||||
TString & tipo = get_tmp_string();
|
TString & tipo = get_tmp_string();
|
||||||
|
|
||||||
tipo << conto.tipo();
|
tipo << conto.tipo();
|
||||||
|
if (tipo.blank())
|
||||||
|
tipo = iva() == iva_vendite ? "C" : "F";
|
||||||
|
|
||||||
return tipo;
|
return tipo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3160,7 +3163,7 @@ bool TPrimanota_application::is_split_payment() const
|
|||||||
s = 'N';
|
s = 'N';
|
||||||
if (clifo() == "C" && m.get_int(F_ANNOIVA) >= 2015 && !causale().reverse_charge())
|
if (clifo() == "C" && m.get_int(F_ANNOIVA) >= 2015 && !causale().reverse_charge())
|
||||||
{
|
{
|
||||||
const TRectype& cliente = cache().get_rec(LF_CLIFO, "C", m.get(F_CLIENTE));
|
const TRectype& cliente = cache().get_rec(LF_CLIFO, "C", m.get(F_CODCLIFOR));
|
||||||
if (cliente.get_bool(CLI_SPLITPAY))
|
if (cliente.get_bool(CLI_SPLITPAY))
|
||||||
{
|
{
|
||||||
TRelation rel(LF_MOV);
|
TRelation rel(LF_MOV);
|
||||||
@ -3211,7 +3214,7 @@ bool TPrimanota_application::ivaxcassa_handler(TMask_field& f, KEY key)
|
|||||||
return f.error_box(TR("Non è ammessa IVA per cassa con split payment"));
|
return f.error_box(TR("Non è ammessa IVA per cassa con split payment"));
|
||||||
if (m.get(F_CLIFO) == "C")
|
if (m.get(F_CLIFO) == "C")
|
||||||
{
|
{
|
||||||
TString8 key; key.format("C|%ld", m.get_long(F_CLIENTE));
|
TString8 key; key.format("C|%ld", m.get_long(F_CODCLIFOR));
|
||||||
const TRectype& clifo = cache().get(LF_CLIFO, key);
|
const TRectype& clifo = cache().get(LF_CLIFO, key);
|
||||||
if (clifo.get_int(CLI_ALLEG) == 6)
|
if (clifo.get_int(CLI_ALLEG) == 6)
|
||||||
return f.error_box(TR("Non è ammessa IVA per cassa con clienti privati"));
|
return f.error_box(TR("Non è ammessa IVA per cassa con clienti privati"));
|
||||||
@ -3734,17 +3737,8 @@ bool TPrimanota_application::quadratura_handler(TMask_field& f, KEY key)
|
|||||||
TRectype& clifo = cliforel.curr();
|
TRectype& clifo = cliforel.curr();
|
||||||
real perc;
|
real perc;
|
||||||
|
|
||||||
if (m.field(F_CLIENTE).shown())
|
clifo.put(CLI_TIPOCF, m.get(F_CLIFO));
|
||||||
{
|
clifo.put(CLI_CODCF, m.get(F_CODCLIFOR));
|
||||||
clifo.put(CLI_TIPOCF, "C");
|
|
||||||
clifo.put(CLI_CODCF, m.get(F_CLIENTE));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clifo.put(CLI_TIPOCF, "F");
|
|
||||||
clifo.put(CLI_CODCF, m.get(F_FORNITORE));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cliforel.read() == NOERR)
|
if (cliforel.read() == NOERR)
|
||||||
perc = f.read(cliforel);
|
perc = f.read(cliforel);
|
||||||
real perc_reale = ((totdoc - totdist) * CENTO) / totdist;
|
real perc_reale = ((totdoc - totdist) * CENTO) / totdist;
|
||||||
|
@ -232,8 +232,11 @@ char TCausale::sezione(int riga) const
|
|||||||
char tipocf = uno ? toupper(uno->get_char(RCA_TIPOCF)) : ' ';
|
char tipocf = uno ? toupper(uno->get_char(RCA_TIPOCF)) : ' ';
|
||||||
if (tipocf <= ' ')
|
if (tipocf <= ' ')
|
||||||
tipocf = (iva() == iva_vendite) ? 'C' : 'F'; // Guess tipocf on IVA
|
tipocf = (iva() == iva_vendite) ? 'C' : 'F'; // Guess tipocf on IVA
|
||||||
sez = (tipocf == 'C') ? 'D' : 'A';
|
if (tipomov() <= tm_nota_credito)
|
||||||
}
|
sez = (tipocf == 'C') ? 'D' : 'A';
|
||||||
|
else
|
||||||
|
sez = (tipocf == 'C') ? 'A' : 'D';
|
||||||
|
}
|
||||||
return sez;
|
return sez;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,9 +251,11 @@ char TCausale::sezione_ritsoc() const
|
|||||||
{
|
{
|
||||||
if (_sezione_ritsoc <= ' ')
|
if (_sezione_ritsoc <= ' ')
|
||||||
{
|
{
|
||||||
const tipo_movimento tm = tipo_movimento();
|
const tipo_movimento tm = tipomov();
|
||||||
(char&)_sezione_ritsoc = sezione(tm<=tm_nota_credito ? RIGA_RITENUTE_SOCIALI : RIGA_PAG_RITSOC);
|
(char&)_sezione_ritsoc = sezione(tm<=tm_nota_credito ? RIGA_RITENUTE_SOCIALI : RIGA_PAG_RITSOC);
|
||||||
}
|
if (_sezione_ritsoc < 'A')
|
||||||
|
(char&)_sezione_ritsoc = sezione_clifo();
|
||||||
|
}
|
||||||
return _sezione_ritsoc;
|
return _sezione_ritsoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +263,7 @@ char TCausale::sezione_ritfis() const
|
|||||||
{
|
{
|
||||||
if (_sezione_ritfis == ' ')
|
if (_sezione_ritfis == ' ')
|
||||||
{
|
{
|
||||||
const tipo_movimento tm = tipo_movimento();
|
const tipo_movimento tm = tipomov();
|
||||||
(char&)_sezione_ritfis = sezione(tm<=tm_nota_credito ? RIGA_RITENUTE_FISCALI : RIGA_PAG_RITFIS); // Fatture o Pagamenti
|
(char&)_sezione_ritfis = sezione(tm<=tm_nota_credito ? RIGA_RITENUTE_FISCALI : RIGA_PAG_RITFIS); // Fatture o Pagamenti
|
||||||
if (_sezione_ritfis < 'A')
|
if (_sezione_ritfis < 'A')
|
||||||
(char&)_sezione_ritfis = sezione_clifo();
|
(char&)_sezione_ritfis = sezione_clifo();
|
||||||
|
@ -335,10 +335,10 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
|
|||||||
ok = f.error_box(TR("Il codice di pagamento è obbligatorio!"));
|
ok = f.error_box(TR("Il codice di pagamento è obbligatorio!"));
|
||||||
|
|
||||||
// Nella maschera iva cerco di reperirlo dal cliente
|
// Nella maschera iva cerco di reperirlo dal cliente
|
||||||
if (m.id2pos(F_CLIENTE) > 0)
|
if (m.id2pos(F_CODCLIFOR) > 0)
|
||||||
{
|
{
|
||||||
const TString4 typ = a.clifo();
|
const TString4 typ = a.clifo();
|
||||||
const long cod = m.get_long(typ == "C" ? F_CLIENTE : F_FORNITORE);
|
const long cod = m.get_long(F_CODCLIFOR);
|
||||||
TLocalisamfile clifo(LF_CLIFO);
|
TLocalisamfile clifo(LF_CLIFO);
|
||||||
clifo.put(CLI_TIPOCF, typ);
|
clifo.put(CLI_TIPOCF, typ);
|
||||||
clifo.put(CLI_CODCF, cod);
|
clifo.put(CLI_CODCF, cod);
|
||||||
@ -396,7 +396,7 @@ bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
if (moviva && m.field(F_CODPAG).empty())
|
if (moviva && m.field(F_CODPAG).empty())
|
||||||
{
|
{
|
||||||
TMask_field& clifo = m.field(a.iva() == iva_vendite ? F_CLIENTE : F_FORNITORE);
|
TMask_field& clifo = m.field(F_CODCLIFOR);
|
||||||
clifo.set_dirty();
|
clifo.set_dirty();
|
||||||
clifo.on_hit();
|
clifo.on_hit();
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
|
|||||||
f.set(m.get(F_PROTIVA));
|
f.set(m.get(F_PROTIVA));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (a.npart_is_month() && m.id2pos(F_PROTIVA) > 0 && m.field(F_CLIENTE).shown())
|
if (a.npart_is_month() && m.id2pos(F_PROTIVA) > 0 && app().clifo() == "C")
|
||||||
f.set(format("%02d", m.get_date(F_DATADOC).month()));
|
f.set(format("%02d", m.get_date(F_DATADOC).month()));
|
||||||
else
|
else
|
||||||
f.set(m.get(F_NUMDOC));
|
f.set(m.get(F_NUMDOC));
|
||||||
@ -713,7 +713,7 @@ void TPrimanota_application::set_pagamento(const char* c, const char* d)
|
|||||||
_pag = new TPagamento(c, d);
|
_pag = new TPagamento(c, d);
|
||||||
}
|
}
|
||||||
if (_pag != NULL && iva() == iva_vendite)
|
if (_pag != NULL && iva() == iva_vendite)
|
||||||
_pag->set_clifo(curr_mask().get_long(F_CLIENTE)); // Dato indispensabile per non accettazione effetti
|
_pag->set_clifo(curr_mask().get_long(F_CODCLIFOR)); // Dato indispensabile per non accettazione effetti
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -930,7 +930,7 @@ int TPrimanota_application::cerca_conto_cf(TBill& bill) const
|
|||||||
if (iva() != nessuna_iva)
|
if (iva() != nessuna_iva)
|
||||||
{
|
{
|
||||||
const TString4 tipocf = clifo();
|
const TString4 tipocf = clifo();
|
||||||
const long codcf = curr_mask().get_long(tipocf == 'C' ? F_CLIENTE : F_FORNITORE);
|
const long codcf = curr_mask().get_long(F_CODCLIFOR);
|
||||||
for (int r = 0; r < a.items(); r++)
|
for (int r = 0; r < a.items(); r++)
|
||||||
{
|
{
|
||||||
TToken_string& row = a.row(r);
|
TToken_string& row = a.row(r);
|
||||||
@ -1277,7 +1277,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
|
|||||||
const real new_ritenute(new_pag.get(PAGSCA_RITENUTE));
|
const real new_ritenute(new_pag.get(PAGSCA_RITENUTE));
|
||||||
if (old_ritenute != new_ritenute)
|
if (old_ritenute != new_ritenute)
|
||||||
{
|
{
|
||||||
const TImporto grow_ritenute(controsez, new_ritenute-old_ritenute);
|
const TImporto grow_ritenute(sez, new_ritenute-old_ritenute);
|
||||||
const int riga = type2pos('F');
|
const int riga = type2pos('F');
|
||||||
if (riga < 0)
|
if (riga < 0)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +72,15 @@ void TQuadro_VE_recordset::load()
|
|||||||
imposta.add("5.00", TString8("VE21.2"));
|
imposta.add("5.00", TString8("VE21.2"));
|
||||||
imponibile.add("10.00",TString8("VE22.1"));
|
imponibile.add("10.00",TString8("VE22.1"));
|
||||||
imposta.add("10.00",TString8("VE22.2"));
|
imposta.add("10.00",TString8("VE22.2"));
|
||||||
|
|
||||||
|
// le imposte che non esisto più le mette nella più vicina
|
||||||
|
|
||||||
|
imponibile.add("20.00", TString8("VE23.1"));
|
||||||
|
imposta.add("20.00", TString8("VE23.2"));
|
||||||
|
imponibile.add("21.00", TString8("VE23.1"));
|
||||||
|
imposta.add("21.00", TString8("VE23.2"));
|
||||||
|
|
||||||
|
|
||||||
imponibile.add("22.00", TString8("VE23.1"));
|
imponibile.add("22.00", TString8("VE23.1"));
|
||||||
imposta.add("22.00", TString8("VE23.2"));
|
imposta.add("22.00", TString8("VE23.2"));
|
||||||
|
|
||||||
@ -111,7 +120,7 @@ void TQuadro_VE_recordset::load()
|
|||||||
real iva;
|
real iva;
|
||||||
int last_tiporec= -1;
|
int last_tiporec= -1;
|
||||||
|
|
||||||
if (classify_pim(pimr, imp, iva, tipo, true, last_tiporec))
|
if (classify_pim(pimr, imp, iva, tipo, true, last_tiporec, true))
|
||||||
{
|
{
|
||||||
good = true;
|
good = true;
|
||||||
switch (tipo)
|
switch (tipo)
|
||||||
@ -259,56 +268,101 @@ void TQuadro_VE_recordset::load()
|
|||||||
val = evaluate_recordset_imponibile(REP_PAART17, year()); // liquidazione
|
val = evaluate_recordset_imponibile(REP_PAART17, year()); // liquidazione
|
||||||
add_value("VE38.1", val);
|
add_value("VE38.1", val);
|
||||||
|
|
||||||
query.zap() << "USE IVADIFF KEY 2 SELECT (BETWEEN(DATAREG,#DAL,#AL))&&(BETWEEN(DATAREGP,0,#AL))"
|
TToken_string key; key.format("%05ld%04d", prefix().get_codditta(), year());
|
||||||
<< "\nFROM ANNOLIQ=" << year();
|
const TRectype& lia = cache().get("%LIA", key);
|
||||||
|
TDate data_end_cassa = lia.get_date("D1");
|
||||||
|
bool end_cassa = lia.get_bool("B5") && data_end_cassa.ok() && (data_end_cassa.month() < 12 && data_end_cassa.day() < 31);
|
||||||
|
|
||||||
|
if (!end_cassa)
|
||||||
|
{
|
||||||
|
key.format("%05ld%04d", prefix().get_codditta(), year() + 1);
|
||||||
|
const TRectype& lia1 = cache().get("%LIA", key);
|
||||||
|
|
||||||
|
end_cassa = !lia1.get_bool("B5");
|
||||||
|
}
|
||||||
|
|
||||||
|
query.zap();
|
||||||
|
const TDate da_datareg(1, 1, year());
|
||||||
|
const TDate a_datareg(31, 12,year());
|
||||||
|
|
||||||
|
// query << "USE IVADIFF KEY 2 SELECT BETWEEN(DATAREG,#DAL,#AL)";
|
||||||
|
query << "USE IVADIFF KEY 4";
|
||||||
|
if (!end_cassa)
|
||||||
|
query << "\nFROM DATAREG=" << da_datareg;
|
||||||
|
query << "\nTO DATAREG=" << a_datareg;
|
||||||
|
|
||||||
|
|
||||||
TISAM_recordset id(query);
|
TISAM_recordset id(query);
|
||||||
long cur_numreg = 0;
|
TString8 tipo_aliquota, codiva;
|
||||||
int cur_tipoiva = 0;
|
TImporto imp371, imp372;
|
||||||
int cur_tipodiff = 0;
|
|
||||||
|
|
||||||
id.set_var("#DAL", TDate(1, 1, year()));
|
|
||||||
id.set_var("#AL", TDate(31, 12, year()));
|
|
||||||
|
|
||||||
|
|
||||||
for (bool ok = id.move_first(); ok; ok = id.move_next())
|
for (bool ok = id.move_first(); ok; ok = id.move_next())
|
||||||
{
|
{
|
||||||
const long numreg = id.get(RMI_NUMREG).as_int();
|
const long numreg = id.get(RMI_NUMREG).as_int();
|
||||||
if (numreg != cur_numreg)
|
const int tipoiva = id.get(ID_TIPOIVA).as_int();
|
||||||
{
|
const int tipodiff = id.get(ID_TIPODIFF).as_int();
|
||||||
cur_numreg = numreg;
|
|
||||||
cur_tipoiva = id.get(ID_TIPOIVA).as_int();
|
|
||||||
cur_tipodiff = id.get(ID_TIPODIFF).as_int();
|
|
||||||
}
|
|
||||||
|
|
||||||
const TRectype & mov = cache().get(LF_MOV, numreg);
|
const TRectype & mov = cache().get(LF_MOV, numreg);
|
||||||
const char sezione = id.get(ID_SEZIONE).as_string()[0];
|
const char sezione = id.get(ID_SEZIONE).as_string()[0];
|
||||||
const int tipomov = id.get(ID_TIPOMOV).as_int();
|
const int tipomov = id.get(ID_TIPOMOV).as_int();
|
||||||
const real imp = id.get(RMI_IMPONIBILE).as_real();
|
const TImporto imp(sezione, id.get(RMI_IMPONIBILE).as_real());
|
||||||
|
const int annoliq = id.get(ID_ANNOLIQ).as_int();
|
||||||
|
const TDate datapag = id.get(ID_DATAREGP).as_date();
|
||||||
|
|
||||||
if (!imp.is_zero() && cur_tipoiva == 1) // Vendite
|
key.cut(0);
|
||||||
|
key.add(numreg);
|
||||||
|
key.add(id.get(ID_NUMRIG).as_string());
|
||||||
|
codiva = cache().get(LF_RMOVIVA, key, RMI_CODIVA);
|
||||||
|
key = codiva;
|
||||||
|
tipo_aliquota = cache().get("%IVA", key, "S1");
|
||||||
|
|
||||||
|
if (tipo_aliquota.blank() && datapag <= a_datareg && tipoiva == 1) // Vendite
|
||||||
{
|
{
|
||||||
switch (tipomov)
|
imp371 += imp;
|
||||||
{
|
if (tipodiff == 2)
|
||||||
case 1:
|
imp372 += imp;
|
||||||
add_value("VE37.1", (sezione == 'D') ? imp : -imp); // VE37.1 iva sospensione da incassare
|
|
||||||
if (cur_tipodiff == 2)
|
|
||||||
add_value("VE37.2", (sezione == 'D') ? imp : -imp); // VE37.2 iva per cassa da incassare
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
add_value("VE37.1", (sezione == 'A') ? -imp : imp); // VE37.1 2 iva sospensione da incassare
|
|
||||||
if (cur_tipodiff == 2)
|
|
||||||
add_value("VE37.2", (sezione == 'A') ? -imp : imp); // VE37.2 iva per cassa da incassare
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
add_value("VE39.1", (sezione == 'A') ? imp : -imp); // VE39.1 iva sospensione incassata
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
imp371.normalize('D');
|
||||||
|
add_value("VE37.1", imp371.valore()); // VE37.1 2 iva sospensione da incassare
|
||||||
|
imp372.normalize('D');
|
||||||
|
add_value("VE37.2", imp372.valore()); // VE37.2 iva per cassa da incassare
|
||||||
|
|
||||||
|
query.zap();
|
||||||
|
|
||||||
|
query << "USE IVADIFF KEY 3";
|
||||||
|
query << "\nFROM DATAREGP=" << da_datareg;
|
||||||
|
query << "\nTO DATAREGP=" << a_datareg;
|
||||||
|
|
||||||
|
TISAM_recordset idp(query);
|
||||||
|
TImporto imp391;
|
||||||
|
|
||||||
|
for (bool ok = idp.move_first(); ok; ok = idp.move_next())
|
||||||
|
{
|
||||||
|
const long numreg = idp.get(RMI_NUMREG).as_int();
|
||||||
|
const int tipoiva = idp.get(ID_TIPOIVA).as_int();
|
||||||
|
const TRectype & mov = cache().get(LF_MOV, numreg);
|
||||||
|
const char sezione = idp.get(ID_SEZIONE).as_string()[0];
|
||||||
|
const int tipomov = idp.get(ID_TIPOMOV).as_int();
|
||||||
|
const TImporto imp(sezione, idp.get(RMI_IMPONIBILE).as_real());
|
||||||
|
const int annoliq = idp.get(ID_DATAREG).as_date().year();
|
||||||
|
const int annopag = idp.get(ID_DATAREGP).as_date().year();
|
||||||
|
|
||||||
|
key.cut(0);
|
||||||
|
key.add(numreg);
|
||||||
|
key.add(idp.get(ID_NUMRIG).as_string());
|
||||||
|
codiva = cache().get(LF_RMOVIVA, key, RMI_CODIVA);
|
||||||
|
key = codiva;
|
||||||
|
tipo_aliquota = cache().get("%IVA", key, "S1");
|
||||||
|
|
||||||
|
if (tipo_aliquota.blank() && tipoiva == 1) // Vendite
|
||||||
|
{
|
||||||
|
if (annoliq < year() && tipomov == 3)
|
||||||
|
imp391 += imp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
imp391.normalize('A');
|
||||||
|
add_value("VE39.1", imp391.valore()); // VE39.1 iva differita incassi di anni precedenti
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ void TQuadro_VF_recordset::load()
|
|||||||
real iva;
|
real iva;
|
||||||
int last_tiporec = -1;
|
int last_tiporec = -1;
|
||||||
|
|
||||||
if (classify_pim(pimr, imp, iva, tipo, true, last_tiporec))
|
if (classify_pim(pimr, imp, iva, tipo, true, last_tiporec, true))
|
||||||
{
|
{
|
||||||
good = true;
|
good = true;
|
||||||
switch (tipo)
|
switch (tipo)
|
||||||
@ -299,56 +299,100 @@ void TQuadro_VF_recordset::load()
|
|||||||
real val1;
|
real val1;
|
||||||
real val2;
|
real val2;
|
||||||
|
|
||||||
query.zap() << "USE IVADIFF KEY 2 SELECT (BETWEEN(DATAREG,#DAL,#AL))&&(BETWEEN(DATAREGP,0,#AL))"
|
TToken_string key; key.format("%05ld%04d", prefix().get_codditta(), year());
|
||||||
<< "\nFROM ANNOLIQ=" << year();
|
const TRectype& lia = cache().get("%LIA", key);
|
||||||
|
TDate data_end_cassa = lia.get_date("D1");
|
||||||
|
bool end_cassa = lia.get_bool("B5") && data_end_cassa.ok() && (data_end_cassa.month() < 12 && data_end_cassa.day() < 31);
|
||||||
|
|
||||||
|
if (!end_cassa)
|
||||||
|
{
|
||||||
|
key.format("%05ld%04d", prefix().get_codditta(), year() + 1);
|
||||||
|
const TRectype& lia1 = cache().get("%LIA", key);
|
||||||
|
|
||||||
|
end_cassa = !lia1.get_bool("B5");
|
||||||
|
}
|
||||||
|
|
||||||
|
query.zap();
|
||||||
|
const TDate da_datareg(1, 1, year());
|
||||||
|
const TDate a_datareg(31, 12, year());
|
||||||
|
|
||||||
|
// query << "USE IVADIFF KEY 2 SELECT BETWEEN(DATAREG,#DAL,#AL)";
|
||||||
|
query << "USE IVADIFF KEY 4";
|
||||||
|
if (!end_cassa)
|
||||||
|
query << "\nFROM DATAREG=" << da_datareg;
|
||||||
|
query << "\nTO DATAREG=" << a_datareg;
|
||||||
|
|
||||||
|
|
||||||
TISAM_recordset id(query);
|
TISAM_recordset id(query);
|
||||||
long cur_numreg = 0;
|
TString8 tipo_aliquota, codiva;
|
||||||
int cur_tipoiva = 0;
|
TImporto imp211, imp212;
|
||||||
int cur_tipodiff = 0;
|
|
||||||
|
|
||||||
id.set_var("#DAL", TDate(1, 1, year()));
|
|
||||||
id.set_var("#AL", TDate(31, 12, year()));
|
|
||||||
|
|
||||||
for (bool ok = id.move_first(); ok; ok = id.move_next())
|
for (bool ok = id.move_first(); ok; ok = id.move_next())
|
||||||
{
|
{
|
||||||
const long numreg = id.get(RMI_NUMREG).as_int();
|
const long numreg = id.get(RMI_NUMREG).as_int();
|
||||||
if (numreg != cur_numreg)
|
const int tipoiva = id.get(ID_TIPOIVA).as_int();
|
||||||
{
|
const int tipodiff = id.get(ID_TIPODIFF).as_int();
|
||||||
cur_numreg = numreg;
|
const TRectype & mov = cache().get(LF_MOV, numreg);
|
||||||
cur_tipoiva = id.get(ID_TIPOIVA).as_int();
|
|
||||||
cur_tipodiff = id.get(ID_TIPODIFF).as_int();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char sezione = id.get(ID_SEZIONE).as_string()[0];
|
const char sezione = id.get(ID_SEZIONE).as_string()[0];
|
||||||
const int tipomov = id.get(ID_TIPOMOV).as_int();
|
const int tipomov = id.get(ID_TIPOMOV).as_int();
|
||||||
const real imp = id.get(RMI_IMPONIBILE).as_real();
|
const TImporto imp(sezione, id.get(RMI_IMPONIBILE).as_real());
|
||||||
|
const int annoliq = id.get(ID_ANNOLIQ).as_int();
|
||||||
|
const TDate datapag = id.get(ID_DATAREGP).as_date();
|
||||||
|
|
||||||
if (!imp.is_zero() && cur_tipoiva == 2) // Acquisti
|
key.cut(0);
|
||||||
{
|
key.add(numreg);
|
||||||
switch (tipomov)
|
key.add(id.get(ID_NUMRIG).as_string());
|
||||||
{
|
codiva = cache().get(LF_RMOVIVA, key, RMI_CODIVA);
|
||||||
case 1:
|
key = codiva;
|
||||||
add_value("VF21.1", (sezione == 'A') ? imp : -imp); // VF21.1 iva sospensione da pagare
|
tipo_aliquota = cache().get("%IVA", key, "S1");
|
||||||
if (cur_tipodiff == 2)
|
|
||||||
add_value("VF21.2", (sezione == 'A') ? imp : -imp); // VF21.2 iva per cassa da pagare
|
if (tipo_aliquota.blank() && datapag <= a_datareg && tipoiva == 2) // Acquists
|
||||||
break;
|
{
|
||||||
case 2:
|
imp211 += imp;
|
||||||
add_value("VF21.1", (sezione == 'D') ? -imp : imp); // VF21.1 iva sospensione da pagare
|
if (tipodiff == 2)
|
||||||
if (cur_tipodiff == 2)
|
imp212 += imp;
|
||||||
add_value("VF21.2", (sezione == 'D') ? -imp : imp); // VF21.2 iva per cassa da pagare
|
}
|
||||||
break;
|
}
|
||||||
case 3:
|
imp211.normalize('A');
|
||||||
// add_value("VF21.1", (sezione == 'D') ? -imp : imp); // VF21.1 iva sospensione da pagare
|
add_value("VF21.1", imp211.valore()); // VE37.1 2 iva sospensione da pagare
|
||||||
add_value("VF22.1", (sezione == 'D') ? imp : -imp); // VF22.1 iva sospensione pagata
|
imp212.normalize('A');
|
||||||
// if (cur_tipodiff == 2)
|
add_value("VF21.2", imp212.valore()); // VE37.2 iva per cassa da pagare
|
||||||
// add_value("VF21.2", (sezione == 'D') ? -imp : imp); // VF21.2 iva per cassa da pagare
|
|
||||||
break;
|
query.zap();
|
||||||
default:
|
|
||||||
break;
|
query << "USE IVADIFF KEY 3";
|
||||||
}
|
query << "\nFROM DATAREGP=" << da_datareg;
|
||||||
}
|
query << "\nTO DATAREGP=" << a_datareg;
|
||||||
}
|
|
||||||
|
TISAM_recordset idp(query);
|
||||||
|
TImporto imp221;
|
||||||
|
|
||||||
|
for (bool ok = idp.move_first(); ok; ok = idp.move_next())
|
||||||
|
{
|
||||||
|
const long numreg = idp.get(RMI_NUMREG).as_int();
|
||||||
|
const int tipoiva = idp.get(ID_TIPOIVA).as_int();
|
||||||
|
const TRectype & mov = cache().get(LF_MOV, numreg);
|
||||||
|
const char sezione = idp.get(ID_SEZIONE).as_string()[0];
|
||||||
|
const int tipomov = idp.get(ID_TIPOMOV).as_int();
|
||||||
|
const TImporto imp(sezione, idp.get(RMI_IMPONIBILE).as_real());
|
||||||
|
const int annoliq = idp.get(ID_DATAREG).as_date().year();
|
||||||
|
const int annopag = idp.get(ID_DATAREGP).as_date().year();
|
||||||
|
|
||||||
|
key.cut(0);
|
||||||
|
key.add(numreg);
|
||||||
|
key.add(idp.get(ID_NUMRIG).as_string());
|
||||||
|
codiva = cache().get(LF_RMOVIVA, key, RMI_CODIVA);
|
||||||
|
key = codiva;
|
||||||
|
tipo_aliquota = cache().get("%IVA", key, "S1");
|
||||||
|
|
||||||
|
if (tipo_aliquota.blank() && tipoiva == 2) // Acquisti
|
||||||
|
{
|
||||||
|
if (annoliq < year() && tipomov == 3)
|
||||||
|
imp221 += imp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imp221.normalize('D');
|
||||||
|
add_value("VF22.1", imp221.valore()); // VE22.1 iva differita pagamenti di anni precedenti
|
||||||
|
|
||||||
// V24.2 Variazioni e arrotondamenti d’imposta (indicare con il segno +/–)
|
// V24.2 Variazioni e arrotondamenti d’imposta (indicare con il segno +/–)
|
||||||
// V50.2 Variazioni e arrotondamenti d’imposta (indicare con il segno +/–)
|
// V50.2 Variazioni e arrotondamenti d’imposta (indicare con il segno +/–)
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
<source>VJ15.1</source>
|
<source>VJ15.1</source>
|
||||||
</field>
|
</field>
|
||||||
<field x="65.5" y="31.75" type="Numero" align="right" width="11" id="1502" pattern="1" text="###.###.###">
|
<field x="65.5" y="31.75" type="Numero" align="right" width="11" id="1502" pattern="1" text="###.###.###">
|
||||||
<source>VJ16.2</source>
|
<source>VJ15.2</source>
|
||||||
</field>
|
</field>
|
||||||
<field x="51.5" y="32.75" type="Numero" align="right" width="11" id="1601" pattern="1" text="###.###.###">
|
<field x="51.5" y="32.75" type="Numero" align="right" width="11" id="1601" pattern="1" text="###.###.###">
|
||||||
<source>VJ16.1</source>
|
<source>VJ16.1</source>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// funzione per classificare i PIM e sommare tutto cio' che contengono
|
// funzione per classificare i PIM e sommare tutto cio' che contengono
|
||||||
#include "cgpim.h"
|
#include "cgpim.h"
|
||||||
|
|
||||||
bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool tipost, int & last_tiporec)
|
bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool tipost, int & last_tiporec, const bool dich)
|
||||||
{
|
{
|
||||||
// parse CODTAB of pim record
|
// parse CODTAB of pim record
|
||||||
const TString80 ctab = pimr.get("CODTAB");
|
const TString80 ctab = pimr.get("CODTAB");
|
||||||
@ -45,10 +45,15 @@ bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool t
|
|||||||
}
|
}
|
||||||
else //visualizza
|
else //visualizza
|
||||||
{
|
{
|
||||||
imp = pimr.get_real("R0");
|
imp = pimr.get_real("R0");
|
||||||
iva = pimr.get_real("R1");
|
iva = pimr.get_real("R1");
|
||||||
}
|
}
|
||||||
}
|
if (dich)
|
||||||
|
{
|
||||||
|
imp += pimr.get_real("R32");
|
||||||
|
iva += pimr.get_real("R33");
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case vend_norm:
|
case vend_norm:
|
||||||
//found = tipomov == 1 /* && corrisp == 1 */ && tipoiva != "NS";
|
//found = tipomov == 1 /* && corrisp == 1 */ && tipoiva != "NS";
|
||||||
@ -57,7 +62,13 @@ bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool t
|
|||||||
{
|
{
|
||||||
imp = pimr.get_real("R0");
|
imp = pimr.get_real("R0");
|
||||||
iva = pimr.get_real("R1");
|
iva = pimr.get_real("R1");
|
||||||
}
|
if (dich)
|
||||||
|
{
|
||||||
|
imp += pimr.get_real("R28");
|
||||||
|
imp -= pimr.get_real("R34");
|
||||||
|
iva += pimr.get_real("R29");
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case acq_simp:
|
case acq_simp:
|
||||||
if (tipomov == 2)
|
if (tipomov == 2)
|
||||||
|
@ -79,6 +79,6 @@ enum tiporec { acq_norm = 0, vend_norm = 1, // acquisti e vendite normali
|
|||||||
// CONTENTA? ciao, f. :)
|
// CONTENTA? ciao, f. :)
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
|
|
||||||
bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool ts, int & last_tiporec);
|
bool classify_pim(const TRectype& pimr, real& imp, real& iva, tiporec& t, bool ts, int & last_tiporec, const bool all = false);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -825,10 +825,10 @@ tipo_pagamento TRiga_partite::tipo_pag() const
|
|||||||
// Calcola il segno delle ritenute sociali in base alla causale
|
// Calcola il segno delle ritenute sociali in base alla causale
|
||||||
char TRiga_partite::sezione_ritsoc() const
|
char TRiga_partite::sezione_ritsoc() const
|
||||||
{
|
{
|
||||||
TString16 key; key << get(PART_CODCAUS) << '|' << RIGA_PAG_RITSOC; // Riga ritenute sociali
|
TString16 key; key << get(PART_CODCAUS) << '|' << RIGA_PAG_RITSOC; // Riga ritenute sociali
|
||||||
const char sez_cau = cache().get(LF_RCAUSALI, key, RCA_SEZIONE)[0];
|
const char sez_cau = cache().get(LF_RCAUSALI, key, RCA_SEZIONE)[0];
|
||||||
const char sez_rit = sez_cau > ' ' ? (sez_cau == 'D' ? 'A' : 'D') : sezione();
|
const char sez_rit = sez_cau > ' ' ? (sez_cau == 'D' ? 'A' : 'D') : sezione();
|
||||||
return sez_rit;
|
return sez_rit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legge le rate relative ad una riga di fattura
|
// Legge le rate relative ad una riga di fattura
|
||||||
|
@ -20,7 +20,8 @@ IMPORTO|4|18|3|Importo
|
|||||||
IMPONIBILE|4|18|3|Imponibile
|
IMPONIBILE|4|18|3|Imponibile
|
||||||
IMPOSTA|4|18|3|Imposta
|
IMPOSTA|4|18|3|Imposta
|
||||||
CHIUSA|8|1|0|Partita chiusa
|
CHIUSA|8|1|0|Partita chiusa
|
||||||
3
|
4
|
||||||
NUMREG+NUMRIG+NUMPRO|
|
NUMREG+NUMRIG+NUMPRO|
|
||||||
ANNOLIQ+MESELIQ+DATAREGP|X
|
ANNOLIQ+MESELIQ+DATAREGP|X
|
||||||
DATAREGP+ANNOLIQ+MESELIQ|X
|
DATAREGP+ANNOLIQ+MESELIQ|X
|
||||||
|
DATAREG+ANNOLIQ+MESELIQ|X
|
||||||
|
Loading…
x
Reference in New Issue
Block a user