Gestione saldaconto

git-svn-id: svn://10.65.10.50/trunk@1726 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-08-23 09:16:17 +00:00
parent d1bd75399e
commit cdea07e1d9
9 changed files with 6658 additions and 6611 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,128 +1,129 @@
#ifndef __CG2100_H
#define __CG2100_H
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_DATAREG 103
#define F_NUMREG 104
#define F_CODCAUS 105
#define F_DESCRCAUS 106
#define F_DOCUMENTO 107
#define F_TIPODOC 108
#define F_CODREG 109
#define F_PROTIVA 110
#define F_RIEPILOGO 111
#define F_DESCR 112
#define F_DATADOC 113
#define F_NUMDOC 114
#define F_ANNOES 115
#define F_DATACOMP 116
#define F_ANNOIVA 117
#define F_CLIFO 150
#define F_CLIENTE 151
#define F_RAGSOCCLIENTE 152
#define F_STATOPAIV 153
#define F_PIVACLIENTE 154
#define F_COFICLIENTE 155
#define F_FORNITORE 161
#define F_RAGSOCFORNITORE 162
#define F_PIVAFORNITORE 164
#define F_COFIFORNITORE 165
#define F_GRUPPOCLIFO 170
#define F_CONTOCLIFO 171
#define F_TOTALE 118
#define F_CODIVA 119
#define F_RITFIS 120
#define F_RITSOC 121
#define F_CODPAG 122
#define F_ANNORIF 123
#define F_NUMRIF 124
#define F_PROVVISORIO 129
#define F_TIPOMOV 130
#define F_OCCASEDIT 131
#define F_SOLAIVA 132
#define F_CORRLIRE 133
#define F_CORRVALUTA 134
#define F_DATA74TER 135
#define F_DESCAGG 136
#define F_DARE 137
#define F_AVERE 138
#define F_IMPONIBILI 139
#define F_IMPOSTE 140
#define F_VALUTAINTRA 141
#define F_CAMBIOINTRA 142
#define F_STAMPATO 143
#define F_REGST 144
#define F_SHEETCG 300
#define F_SHEETIVA 301
// Campi ripetuti sulla seconda pagina
#define H_DATAREG 201
#define H_NUMREG 202
#define H_CODCAUS 203
#define H_DESCRCAUS 204
#define H_ANNOES 205
// Maschera clienti/fornitori occasionali
#define O_CODICE 100
#define O_RAGSOC 101
#define O_STATO 102
#define O_COMUNE 103
#define O_DENCOM 104
#define O_CAP 105
#define O_INDIRIZZO 106
#define O_NUMERO 107
#define O_SESSO 110
#define O_DATANAS 111
#define O_STATONAS 112
#define O_COMUNENAS 113
#define O_DENCOMNAS 114
// Maschera incasso/pagamento immediato
#define I_SEZIONE1 201
#define I_IMPORTO1 202
#define I_SOTTOCONTO 203
#define I_SEZIONE2 210
#define I_IMPORTO2 211
#define I_GRUPPO2 212
#define I_CONTO2 213
#define I_SOTTOCONTO2 214
#define I_SEZIONE3 220
#define I_IMPORTO3 221
#define I_GRUPPO3 222
#define I_CONTO3 223
#define I_SOTTOCONTO3 224
#define I_SEZIONE4 230
#define I_IMPORTO4 231
#define I_GRUPPO4 232
#define I_CONTO4 233
#define I_SOTTOCONTO4 234
// Saldaconto
#define S_TOTDOC 401
#define S_TOTDOCVAL 402
#define S_VALUTA 403
#define S_DATACAMBIO 404
#define S_CAMBIO 405
// copie 2a pag.
#define K_CODDITTA 501
#define K_RAGSOC 502
#define K_DATAREG 503
#define K_NUMREG 504
#define K_CODCAUS 505
#define K_DESCRCAUS 506
#define K_DOCUMENTO 507
#define K_TIPODOC 508
#define K_PROTIVA 509
#define K_PROVVISORIO 510
#define K_DESCR 511
#define K_DATADOC 512
#define K_NUMDOC 513
#define K_ANNOES 514
#define K_DATACOMP 515
#endif
#ifndef __CG2100_H
#define __CG2100_H
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_DATAREG 103
#define F_NUMREG 104
#define F_CODCAUS 105
#define F_DESCRCAUS 106
#define F_DOCUMENTO 107
#define F_TIPODOC 108
#define F_CODREG 109
#define F_PROTIVA 110
#define F_RIEPILOGO 111
#define F_DESCR 112
#define F_DATADOC 113
#define F_NUMDOC 114
#define F_ANNOES 115
#define F_DATACOMP 116
#define F_ANNOIVA 117
#define F_CLIFO 150
#define F_CLIENTE 151
#define F_RAGSOCCLIENTE 152
#define F_STATOPAIV 153
#define F_PIVACLIENTE 154
#define F_COFICLIENTE 155
#define F_FORNITORE 161
#define F_RAGSOCFORNITORE 162
#define F_PIVAFORNITORE 164
#define F_COFIFORNITORE 165
#define F_GRUPPOCLIFO 170
#define F_CONTOCLIFO 171
#define F_TOTALE 118
#define F_CODIVA 119
#define F_RITFIS 120
#define F_RITSOC 121
#define F_CODPAG 122
#define F_ANNORIF 123
#define F_NUMRIF 124
#define F_PROVVISORIO 129
#define F_TIPOMOV 130
#define F_OCCASEDIT 131
#define F_SOLAIVA 132
#define F_CORRLIRE 133
#define F_CORRVALUTA 134
#define F_DATA74TER 135
#define F_DESCAGG 136
#define F_DARE 137
#define F_AVERE 138
#define F_IMPONIBILI 139
#define F_IMPOSTE 140
#define F_VALUTAINTRA 141
#define F_CAMBIOINTRA 142
#define F_STAMPATO 143
#define F_REGST 144
#define F_SHEETCG 190
#define F_SHEETIVA 191
// Campi ripetuti sulla seconda pagina
#define H_DATAREG 201
#define H_NUMREG 202
#define H_CODCAUS 203
#define H_DESCRCAUS 204
#define H_ANNOES 205
// Maschera clienti/fornitori occasionali
#define O_CODICE 100
#define O_RAGSOC 101
#define O_STATO 102
#define O_COMUNE 103
#define O_DENCOM 104
#define O_CAP 105
#define O_INDIRIZZO 106
#define O_NUMERO 107
#define O_SESSO 110
#define O_DATANAS 111
#define O_STATONAS 112
#define O_COMUNENAS 113
#define O_DENCOMNAS 114
// Maschera incasso/pagamento immediato
#define I_SEZIONE1 201
#define I_IMPORTO1 202
#define I_SOTTOCONTO 203
#define I_SEZIONE2 210
#define I_IMPORTO2 211
#define I_GRUPPO2 212
#define I_CONTO2 213
#define I_SOTTOCONTO2 214
#define I_SEZIONE3 220
#define I_IMPORTO3 221
#define I_GRUPPO3 222
#define I_CONTO3 223
#define I_SOTTOCONTO3 224
#define I_SEZIONE4 230
#define I_IMPORTO4 231
#define I_GRUPPO4 232
#define I_CONTO4 233
#define I_SOTTOCONTO4 234
// Saldaconto
#define S_TOTDOC 301
#define S_TOTDOCVAL 302
#define S_VALUTA 303
#define S_DATACAMBIO 304
#define S_CAMBIO 305
#define S_TIPORIGA 306
// copie 2a pag.
#define K_CODDITTA 401
#define K_RAGSOC 402
#define K_DATAREG 403
#define K_NUMREG 404
#define K_CODCAUS 405
#define K_DESCRCAUS 406
#define K_DOCUMENTO 407
#define K_TIPODOC 408
#define K_PROTIVA 409
#define K_PROVVISORIO 410
#define K_DESCR 411
#define K_DATADOC 412
#define K_NUMDOC 413
#define K_ANNOES 414
#define K_DATACOMP 415
#endif

View File

@ -1,368 +1,375 @@
#include "cg2100.h"
TOOLBAR "" 0 20 0 2
#include <toolbar.h>
ENDPAGE
PAGE "OPERAZIONE DI PRIMA NOTA" -1 -1 77 20
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 0 "@BMovimento di sola contabilita'"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 3 1 "Ditta "
FLAGS "DFR"
USE LF_NDITTE KEY 1
INPUT CODDITTA F_CODDITTA
OUTPUT K_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
END
STRING F_RAGSOC 50
BEGIN
PROMPT 17 1 "Ragione "
FLAGS "D"
MESSAGE COPY,K_RAGSOC
END
NUMBER F_NUMREG 7
BEGIN
PROMPT 56 3 "Operazione n. "
FIELD NUMREG
FLAGS "DGR"
MESSAGE COPY,K_NUMREG
END
DATE F_DATAREG
BEGIN
PROMPT 1 3 "Data operazione "
HELP "Data in cui viene effettuata l'operazione"
FIELD DATAREG
CHECKTYPE REQUIRED
MESSAGE COPY,K_DATAREG
END
DATE F_DATACOMP
BEGIN
PROMPT 1 4 "Data di competenza "
HELP "Data di competenza dell'operazione"
FIELD DATACOMP
CHECKTYPE REQUIRED
MESSAGE COPY,K_DATACOMP
END
NUMBER F_ANNOES 4
BEGIN
PROMPT 56 4 "Esercizio "
FIELD ANNOES
MESSAGE COPY,K_ANNOES
FLAGS "DGZ"
END
STRING F_CODCAUS 3
BEGIN
PROMPT 1 5 "Causale "
HELP "Codice della causale generante l'operazione"
FLAGS "UZ"
FIELD CODCAUS
USE LF_CAUSALI
INPUT CODCAUS F_CODCAUS
DISPLAY "Codice" CODCAUS
DISPLAY "Descrizione@50" DESCR
DISPLAY "Tipo" TIPODOC
DISPLAY "Registro" REG
OUTPUT F_CODCAUS CODCAUS
OUTPUT F_DESCRCAUS DESCR
OUTPUT F_TIPODOC TIPODOC
OUTPUT F_TIPOMOV TIPOMOV
CHECKTYPE NORMAL
ADD RUN cg0 -4
MESSAGE COPY,K_CODCAUS
END
STRING F_DESCRCAUS 50
BEGIN
PROMPT 25 5 ""
HELP "Descrizione della causale generante l'operazione"
USE LF_CAUSALI KEY 2
INPUT DESCR F_DESCRCAUS
DISPLAY "Descrizione@50" DESCR
DISPLAY "Codice" CODCAUS
COPY OUTPUT F_CODCAUS
MESSAGE COPY,K_DESCRCAUS
END
LIST F_PROVVISORIO 1 25
BEGIN
PROMPT 1 6 "Movimento provvisorio "
HELP "Indicare se si tratta di movimento provvisorio"
FIELD PROVVIS
ITEM " |No (movimento normale)"
ITEM "P|Si (cancellabile)"
MESSAGE COPY,K_PROVVISORIO
END
STRING F_TIPODOC 2
BEGIN
PROMPT 60 6 "Tipo documento "
FIELD TIPODOC
FLAGS "DG"
MESSAGE COPY,K_TIPODOC
END
NUMBER F_TIPOMOV 1
BEGIN
PROMPT 32 6 "Tipo movimento "
FIELD LF_MOV->TIPOMOV
FLAGS "H"
END
DATE F_DATADOC
BEGIN
PROMPT 1 7 "Data del documento "
HELP "Data del documento generante il movimento"
FIELD DATADOC
WARNING "Specificare una data del documento non superiore a quella dell'operazione"
VALIDATE DATE_CMP_FUNC <= F_DATAREG
MESSAGE COPY,K_DATADOC
END
STRING F_NUMDOC 7
BEGIN
PROMPT 56 7 "Documento n. "
HELP "Numero del documento generante il movimento"
FIELD NUMDOC
WARNING "La causale impone di specificare il numero documento"
MESSAGE COPY,K_NUMDOC
END
NUMBER F_ANNOIVA 4
BEGIN
FLAGS "H"
END
STRING F_DESCAGG 5
BEGIN
PROMPT 1 8 "Descrizione "
HELP "Codice descrizione del movimento di contabilita'"
FLAGS "UZ"
USE %DPN
INPUT CODTAB F_DESCAGG
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_DESCAGG CODTAB
OUTPUT F_DESCR S0
CHECKTYPE NORMAL
END
STRING F_DESCR 50
BEGIN
PROMPT 25 8 ""
HELP "Descrizione del movimento di contabilita'"
FIELD DESCR
USE %DPN KEY 2
INPUT S0 F_DESCR
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT F_DESCAGG
END
GROUPBOX DLG_NULL 78 8
BEGIN
PROMPT 1 10 "Voci per saldaconto"
END
NUMBER S_TOTDOC 15 0
BEGIN
PROMPT 2 11 "Totale documento "
FLAGS "R"
PICTURE "."
GROUP 5
END
NUMBER S_TOTDOCVAL 15 2
BEGIN
PROMPT 44 11 "Totale in valuta "
HELP ""
FLAGS "R"
PICTURE ".2"
GROUP 3
END
STRING S_VALUTA 3
BEGIN
PROMPT 2 13 "Valuta "
HELP "Codice della valuta per movimento"
FIELD LF_MOV->CODVAL
FLAGS "U"
GROUP 3
USE %VAL
INPUT CODTAB S_VALUTA
DISPLAY "Codice" CODTAB
DISPLAY "Nome@50" S0
DISPLAY "Ultimo cambio@15" R10
DISPLAY "Ultimo aggiornamento" D0
OUTPUT S_VALUTA CODTAB
OUTPUT S_CAMBIO R10
CHECKTYPE NORMAL
END
DATE S_DATACAMBIO
BEGIN
PROMPT 22 13 "Data cambio "
FLAGS "R"
USE CAM
INPUT CODTAB[1,3] S_VALUTA
INPUT CODTAB[4,11] S_DATACAMBIO
DISPLAY "Valuta" CODTAB[1,3]
DISPLAY "Data@10" D0
DISPLAY "Cambio@18" R10
OUTPUT S_VALUTA CODTAB[1,3]
OUTPUT S_DATACAMBIO D0
OUTPUT S_CAMBIO R10
GROUP 3
END
NUMBER S_CAMBIO 15 5
BEGIN
PROMPT 54 13 "Cambio "
HELP "Cambio della valuta"
FIELD LF_MOV->CAMBIO
FLAGS "RU"
GROUP 3
PICTURE ".5"
END
ENDPAGE
PAGE "OPERAZIONE DI PRIMA NOTA" -1 -1 77 20
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 0 "@BMovimento di sola contabilita'"
END
NUMBER K_CODDITTA 5
BEGIN
PROMPT 3 1 "Ditta "
FLAGS "D"
END
STRING K_RAGSOC 50
BEGIN
PROMPT 17 1 "Ragione "
FLAGS "D"
END
NUMBER K_NUMREG 7
BEGIN
PROMPT 56 3 "Operazione n. "
FLAGS "RD"
END
DATE K_DATAREG
BEGIN
PROMPT 1 3 "Data operazione "
FLAGS "D"
END
DATE K_DATACOMP
BEGIN
PROMPT 1 4 "Data di competenza "
FLAGS "D"
END
NUMBER K_ANNOES 4
BEGIN
PROMPT 56 4 "Esercizio "
FLAGS "DZ"
END
STRING K_CODCAUS 3
BEGIN
PROMPT 1 5 "Causale "
FLAGS "D"
END
STRING K_DESCRCAUS 50
BEGIN
PROMPT 25 5 ""
FLAGS "D"
END
LIST K_PROVVISORIO 1 25
BEGIN
PROMPT 1 6 "Movimento provvisorio "
ITEM " |No (movimento normale)"
ITEM "P|Si (cancellabile)"
FLAGS "D"
END
STRING K_TIPODOC 2
BEGIN
PROMPT 60 6 "Tipo documento "
FLAGS "D"
END
DATE K_DATADOC
BEGIN
PROMPT 1 7 "Data del documento "
FLAGS "D"
END
STRING K_NUMDOC 7
BEGIN
PROMPT 56 7 "Documento n. "
FLAGS "D"
END
SPREADSHEET F_SHEETCG
BEGIN
PROMPT 0 8 ""
ITEM "Dare@15"
ITEM "Avere@15"
ITEM "CF@1"
ITEM "Gr."
ITEM "Co."
ITEM "Sottoc.@6"
ITEM "Descrizione conto@50"
ITEM "Codice"
ITEM "Descrizione riga@50"
ITEM "CF@1"
ITEM "Gr./c@3"
ITEM "Co./c@3"
ITEM "Sottoc./c@6"
ITEM "Descrizione contropartita@50"
ITEM "Giornale"
ITEM " @1"
END
NUMBER F_DARE 15
BEGIN
PROMPT 1 -1 "Sbilancio Dare "
FLAGS "DRV"
PICTURE "."
END
NUMBER F_AVERE 15
BEGIN
PROMPT 41 -1 "Sbilancio Avere "
FLAGS "DRV"
PICTURE "."
END
ENDPAGE
ENDMASK
#include "cg21cg.uml"
z
#include "cg2100.h"
TOOLBAR "" 0 20 0 2
#include <toolbar.h>
ENDPAGE
PAGE "OPERAZIONE DI PRIMA NOTA" -1 -1 77 20
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 0 "@BMovimento di sola contabilita'"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 3 1 "Ditta "
FLAGS "DFR"
USE LF_NDITTE KEY 1
INPUT CODDITTA F_CODDITTA
OUTPUT K_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
END
STRING F_RAGSOC 50
BEGIN
PROMPT 17 1 "Ragione "
FLAGS "D"
MESSAGE COPY,K_RAGSOC
END
NUMBER F_NUMREG 7
BEGIN
PROMPT 56 3 "Operazione n. "
FIELD NUMREG
FLAGS "DGR"
MESSAGE COPY,K_NUMREG
END
DATE F_DATAREG
BEGIN
PROMPT 1 3 "Data operazione "
HELP "Data in cui viene effettuata l'operazione"
FIELD DATAREG
CHECKTYPE REQUIRED
MESSAGE COPY,K_DATAREG
END
DATE F_DATACOMP
BEGIN
PROMPT 1 4 "Data di competenza "
HELP "Data di competenza dell'operazione"
FIELD DATACOMP
CHECKTYPE REQUIRED
MESSAGE COPY,K_DATACOMP
END
NUMBER F_ANNOES 4
BEGIN
PROMPT 56 4 "Esercizio "
FIELD ANNOES
MESSAGE COPY,K_ANNOES
FLAGS "DGZ"
END
STRING F_CODCAUS 3
BEGIN
PROMPT 1 5 "Causale "
HELP "Codice della causale generante l'operazione"
FLAGS "UZ"
FIELD CODCAUS
USE LF_CAUSALI
INPUT CODCAUS F_CODCAUS
DISPLAY "Codice" CODCAUS
DISPLAY "Descrizione@50" DESCR
DISPLAY "Tipo" TIPODOC
DISPLAY "Registro" REG
OUTPUT F_CODCAUS CODCAUS
OUTPUT F_DESCRCAUS DESCR
OUTPUT F_TIPODOC TIPODOC
OUTPUT F_TIPOMOV TIPOMOV
CHECKTYPE NORMAL
ADD RUN cg0 -4
MESSAGE COPY,K_CODCAUS
END
STRING F_DESCRCAUS 50
BEGIN
PROMPT 25 5 ""
HELP "Descrizione della causale generante l'operazione"
USE LF_CAUSALI KEY 2
INPUT DESCR F_DESCRCAUS
DISPLAY "Descrizione@50" DESCR
DISPLAY "Codice" CODCAUS
COPY OUTPUT F_CODCAUS
MESSAGE COPY,K_DESCRCAUS
END
LIST F_PROVVISORIO 1 25
BEGIN
PROMPT 1 6 "Movimento provvisorio "
HELP "Indicare se si tratta di movimento provvisorio"
FIELD PROVVIS
ITEM " |No (movimento normale)"
ITEM "P|Si (cancellabile)"
MESSAGE COPY,K_PROVVISORIO
END
STRING F_TIPODOC 2
BEGIN
PROMPT 60 6 "Tipo documento "
FIELD TIPODOC
FLAGS "DG"
MESSAGE COPY,K_TIPODOC
END
NUMBER F_TIPOMOV 1
BEGIN
PROMPT 32 6 "Tipo movimento "
FIELD LF_MOV->TIPOMOV
FLAGS "H"
END
DATE F_DATADOC
BEGIN
PROMPT 1 7 "Data del documento "
HELP "Data del documento generante il movimento"
FIELD DATADOC
WARNING "Specificare una data del documento non superiore a quella dell'operazione"
VALIDATE DATE_CMP_FUNC <= F_DATAREG
MESSAGE COPY,K_DATADOC
END
STRING F_NUMDOC 7
BEGIN
PROMPT 56 7 "Documento n. "
HELP "Numero del documento generante il movimento"
FIELD NUMDOC
WARNING "La causale impone di specificare il numero documento"
MESSAGE COPY,K_NUMDOC
END
NUMBER F_ANNOIVA 4
BEGIN
FLAGS "H"
END
STRING F_DESCAGG 5
BEGIN
PROMPT 1 8 "Descrizione "
HELP "Codice descrizione del movimento di contabilita'"
FLAGS "UZ"
USE %DPN
INPUT CODTAB F_DESCAGG
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_DESCAGG CODTAB
OUTPUT F_DESCR S0
CHECKTYPE NORMAL
END
STRING F_DESCR 50
BEGIN
PROMPT 25 8 ""
HELP "Descrizione del movimento di contabilita'"
FIELD DESCR
USE %DPN KEY 2
INPUT S0 F_DESCR
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT F_DESCAGG
END
GROUPBOX DLG_NULL 78 8
BEGIN
PROMPT 1 10 "Voci per saldaconto"
END
NUMBER S_TOTDOC 15 0
BEGIN
PROMPT 2 11 "Totale documento "
FLAGS "R"
PICTURE "."
GROUP 5
END
NUMBER S_TOTDOCVAL 15 2
BEGIN
PROMPT 44 11 "Totale in valuta "
HELP ""
FLAGS "R"
PICTURE ".2"
GROUP 3
END
STRING S_VALUTA 3
BEGIN
PROMPT 2 13 "Valuta "
HELP "Codice della valuta per movimento"
FIELD LF_MOV->CODVAL
FLAGS "U"
GROUP 3
USE %VAL
INPUT CODTAB S_VALUTA
DISPLAY "Codice" CODTAB
DISPLAY "Nome@50" S0
DISPLAY "Ultimo cambio@15" R10
DISPLAY "Ultimo aggiornamento" D0
OUTPUT S_VALUTA CODTAB
OUTPUT S_CAMBIO R10
CHECKTYPE NORMAL
END
DATE S_DATACAMBIO
BEGIN
PROMPT 22 13 "Data cambio "
FLAGS "R"
USE CAM
INPUT CODTAB[1,3] S_VALUTA
INPUT CODTAB[4,11] S_DATACAMBIO
DISPLAY "Valuta" CODTAB[1,3]
DISPLAY "Data@10" D0
DISPLAY "Cambio@18" R10
OUTPUT S_VALUTA CODTAB[1,3]
OUTPUT S_DATACAMBIO D0
OUTPUT S_CAMBIO R10
GROUP 3
END
NUMBER S_CAMBIO 15 5
BEGIN
PROMPT 54 13 "Cambio "
HELP "Cambio della valuta"
FIELD LF_MOV->CAMBIO
FLAGS "RU"
GROUP 3
PICTURE ".5"
END
ENDPAGE
PAGE "OPERAZIONE DI PRIMA NOTA" -1 -1 77 20
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 0 "@BMovimento di sola contabilita'"
END
NUMBER K_CODDITTA 5
BEGIN
PROMPT 3 1 "Ditta "
FLAGS "D"
END
STRING K_RAGSOC 50
BEGIN
PROMPT 17 1 "Ragione "
FLAGS "D"
END
NUMBER K_NUMREG 7
BEGIN
PROMPT 56 3 "Operazione n. "
FLAGS "RD"
END
DATE K_DATAREG
BEGIN
PROMPT 1 3 "Data operazione "
FLAGS "D"
END
DATE K_DATACOMP
BEGIN
PROMPT 1 4 "Data di competenza "
FLAGS "D"
END
NUMBER K_ANNOES 4
BEGIN
PROMPT 56 4 "Esercizio "
FLAGS "DZ"
END
STRING K_CODCAUS 3
BEGIN
PROMPT 1 5 "Causale "
FLAGS "D"
END
STRING K_DESCRCAUS 50
BEGIN
PROMPT 25 5 ""
FLAGS "D"
END
LIST K_PROVVISORIO 1 25
BEGIN
PROMPT 1 6 "Movimento provvisorio "
ITEM " |No (movimento normale)"
ITEM "P|Si (cancellabile)"
FLAGS "D"
END
STRING K_TIPODOC 2
BEGIN
PROMPT 60 6 "Tipo documento "
FLAGS "D"
END
DATE K_DATADOC
BEGIN
PROMPT 1 7 "Data del documento "
FLAGS "D"
END
STRING K_NUMDOC 7
BEGIN
PROMPT 38 7 "Num. "
FLAGS "D"
END
LIST S_TIPORIGA 1 13
BEGIN
PROMPT 60 7 "Riga "
ITEM "K|Saldaconto"
ITEM "S|Spese"
END
SPREADSHEET F_SHEETCG
BEGIN
PROMPT 0 8 ""
ITEM "Dare@15"
ITEM "Avere@15"
ITEM "CF@1"
ITEM "Gr."
ITEM "Co."
ITEM "Sottoc.@6"
ITEM "Descrizione conto@50"
ITEM "Codice"
ITEM "Descrizione riga@50"
ITEM "CF@1"
ITEM "Gr./c@3"
ITEM "Co./c@3"
ITEM "Sottoc./c@6"
ITEM "Descrizione contropartita@50"
ITEM "Giornale"
ITEM " @1"
END
NUMBER F_DARE 15
BEGIN
PROMPT 1 -1 "Sbilancio Dare "
FLAGS "DRV"
PICTURE "."
END
NUMBER F_AVERE 15
BEGIN
PROMPT 41 -1 "Sbilancio Avere "
FLAGS "DRV"
PICTURE "."
END
ENDPAGE
ENDMASK
#include "cg21cg.uml"
z

File diff suppressed because it is too large Load Diff

View File

@ -1,230 +1,232 @@
#ifndef __CG2102_H
#define __CG2102_H
#ifndef __RELAPP_H
#include <relapp.h>
#endif
#ifndef __PAGAMENT_H
#include "pagament.h"
#endif
#ifndef __CGLIB_H
#include "cglib.h"
#endif
#ifndef __CG2101_H
#include "cg2101.h"
#endif
#ifndef __CG2103_H
#include "cg2103.h"
#endif
class TPrimanota_application : public TRelation_application
{
TMovimentoPN* _rel;
TLocalisamfile* _tabcom;
TLocalisamfile* _tab;
TLocalisamfile* _caus;
TLocalisamfile* _rcaus;
TLocalisamfile* _clifo;
TLocalisamfile* _pcon;
TLocalisamfile* _attiv;
TLocalisamfile* _saldo;
TLocalisamfile* _comuni;
TLocalisamfile* _occas;
TLocalisamfile* _nditte;
TLocalisamfile* _scadenze;
TLocalisamfile* _pagamenti;
TPagamento* _pag;
TCausale* _causale; // Causale corrente
TLibro_giornale* _giornale; // Libro giornale corrente
TipoIVA _iva; // Tipo di IVA corrente
bool _ges_val, _ges_sal; // Gestione valuta e saldaconto
bool _num_cli, _num_for; // Riferimento partita allineato a destra
bool _skip_giornale_check; // Ignora controllo data stampa libro giornale
bool _skip_bollato_check; // Ignora controllo data stampa bollato
bool _savenew; // Registra e nuovo
short _firstfocus; // Primo campo della maschera a prendere il focus
bool _iva_showed; // Lo sheet IVA e' gia' stato visualizzato una volta?
bool _is_saldaconto; // saldaconto si/no (vede parametri e causale)
TSaldo_agg _saldi; // Saldi da aggiornare
TPartite_array _partite; // Partite coinvolte
TMask* _msk[4]; // Maschere di query, cg, iva
long _lastreg; // Numero ultima registrazione
int _mode; // Modo maschera corrente
TBill _conto_ricavo; // Conto di ricavo del clifo
TString_array _pag_rows;
static bool showpartite_handler(TMask_field& f, KEY k);
static bool speserimb_handler(TMask_field& f, KEY k);
static bool altrespese_handler(TMask_field& f, KEY k);
static bool abbatt_handler(TMask_field& f, KEY k);
static bool abbpass_handler(TMask_field& f, KEY k);
static bool ritprof_handler(TMask_field& f, KEY k);
static bool diffcamb_handler(TMask_field& f, KEY k);
static bool suspended_handler(TMask_field& f, KEY k);
static bool num_handler(TMask_field& f, KEY key);
static bool caus_query_handler(TMask_field& f, KEY key);
static bool caus_modify_handler(TMask_field& f, KEY key);
static bool datareg_handler(TMask_field& f, KEY key);
static bool datacomp_handler(TMask_field& f, KEY key);
static bool data74ter_handler(TMask_field& f, KEY key);
static bool doc_handler(TMask_field& f, KEY key);
static bool protiva_handler(TMask_field& f, KEY key);
static bool clifo_handler(TMask_field& f, KEY key);
static bool totale_handler(TMask_field& f, KEY key);
static bool totdoc_handler(TMask_field& f, KEY key);
static bool ritfis_handler(TMask_field& f, KEY key);
static bool ritsoc_handler(TMask_field& f, KEY key);
static bool main_codiva_handler(TMask_field& f, KEY key);
static bool corrlire_handler(TMask_field& f, KEY key);
static bool corrvaluta_handler(TMask_field& f, KEY key);
static bool occas_code_handler(TMask_field& f, KEY key);
static bool occas_handler(TMask_field& f, KEY key);
static bool solaiva_handler(TMask_field& f, KEY key);
static bool descr_handler(TMask_field& f, KEY k);
static bool sheet_clifo_handler(TMask_field& f, KEY k);
static bool iva_sottoconto_handler(TMask_field& f, KEY k);
static bool imponibile_handler(TMask_field& f, KEY key);
static bool detrazione_handler(TMask_field& f, KEY key);
static bool codiva_handler(TMask_field& f, KEY key);
static bool imposta_handler(TMask_field& f, KEY key);
static bool dareavere_handler(TMask_field& f, KEY k);
static bool cg_conto_handler(TMask_field& f, KEY key);
static bool codpag_handler(TMask_field& f, KEY key);
static bool iva_notify(TSheet_field& s, int r, KEY key);
static bool iva_handler(TMask_field& f, KEY key);
static bool cg_notify(TSheet_field& s, int r, KEY key);
static bool cg_handler(TMask_field& f, KEY key);
static bool pag_notify(TSheet_field& s, int r, KEY key);
void reset_sheet_row(TSheet_field& s, int n);
protected: // TApplication
virtual void on_firm_change();
virtual void on_config_change();
virtual void print();
protected: // TRelation_application
virtual bool user_create();
virtual bool user_destroy();
virtual bool changing_mask(int mode);
virtual TMask* get_mask(int mode);
virtual TRelation* get_relation() const { return _rel; }
virtual void init_query_mode(TMask& m);
virtual void init_insert_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
virtual bool save_and_new() const;
virtual const char* get_next_key();
virtual int read(TMask& m);
virtual int write(const TMask& m);
virtual int rewrite(const TMask& m);
virtual bool remove();
virtual void write_enable(bool) {}
protected:
void check_saldi();
void genera_incasso(const char* causimm);
TMask* load_mask(int n);
TMask& occas_mask() { return *load_mask(3); }
void mask2rel(const TMask& m);
TipoIVA iva() const { return _iva; }
char clifo() const { return iva() == iva_vendite ? 'C' : 'F'; }
bool gestione_valuta() const { return _ges_val; }
bool gestione_saldaconto() const { return _ges_sal; }
bool is_saldaconto() const { return _is_saldaconto; }
void set_saldaconto(bool b) { _is_saldaconto = b; }
void fill_sheet(TMask& m) const;
void init_mask(TMask& m);
static TipoIVA reg2IVA(const char* registro, int anno);
static TipoIVA cau2IVA(const char* causale, int anno);
static int type2pos(char tipo);
static const real& cod2IVA(const TMask& m);
static real scorpora(real& imponibile, const real& percentuale);
static bool detraibile(TToken_string& row);
static int bill2pos(const TBill& conto, char tipo);
bool IVA2bill(const TCodiceIVA& iva, TBill& bill);
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; }
TLibro_giornale& giornale() { return *_giornale; }
bool test_swap(bool ritsoc);
TImporto real2imp(const real& r, char tipo);
real totale_documento();
void ivas_pack();
void cgs_pack();
bool ci_sono_importi() const;
real calcola_saldo() const;
real calcola_imp() const;
void add_cgs_tot(TMask& m);
int set_cgs_row(int n, const TImporto& importo, TBill& conto, const char* desc, char tipo);
void set_cgs_imp(int n, const TImporto& importo);
TImporto get_cgs_imp(int n);
bool add_cgs_imp(int n, const TImporto& importo);
bool sub_cgs_imp(int n, const TImporto& importo);
void disable_cgs_cells(int n, char tipo);
void add_cgs_rit(bool fisc);
void generazione_righe_cg(int r);
void reset_cgs_row(int n) { reset_sheet_row(cgs(), n); }
void reset_ivas_row(int n) { reset_sheet_row(ivas(), n); }
TPagamento& pagamento() { CHECK(_pag, "Pagamento nullo"); return *_pag; }
void set_pagamento(const char* c, const char* d);
void reset_pagamento();
void set_scadenze(TMask& m);
bool read_scadenze(TMask& m);
void write_scadenze(const TMask& m);
bool edit_partite(int riga);
bool notify_cgline_deletion(TPartita& partita, long nreg, int numrig);
bool notify_cgline_deletion(int numrig);
long calcola_m770(int tipo_coll, real& spese, real& compenso, real& iva, real& ritfis);
bool link_m770();
public:
TPartite_array& partite() { return _partite; } // Partite editate
int nuovo_pagamento(TPartita& p, int nriga, int rata, int rmov);
bool edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp);
TSheet_field& cgs() const;
TSheet_field& ivas() const;
TSheet_field& pags() const;
TString_array& pag_rows() { return _pag_rows; }
TPrimanota_application();
};
inline TPrimanota_application& app()
{ return (TPrimanota_application&)main_app(); }
#endif
#ifndef __CG2102_H
#define __CG2102_H
#ifndef __RELAPP_H
#include <relapp.h>
#endif
#ifndef __PAGAMENT_H
#include "pagament.h"
#endif
#ifndef __CGLIB_H
#include "cglib.h"
#endif
#ifndef __CG2101_H
#include "cg2101.h"
#endif
#ifndef __CG2103_H
#include "cg2103.h"
#endif
class TPrimanota_application : public TRelation_application
{
TMovimentoPN* _rel;
TLocalisamfile* _tabcom;
TLocalisamfile* _tab;
TLocalisamfile* _caus;
TLocalisamfile* _rcaus;
TLocalisamfile* _clifo;
TLocalisamfile* _pcon;
TLocalisamfile* _attiv;
TLocalisamfile* _saldo;
TLocalisamfile* _comuni;
TLocalisamfile* _occas;
TLocalisamfile* _nditte;
TLocalisamfile* _scadenze;
TLocalisamfile* _pagamenti;
TPagamento* _pag;
TCausale* _causale; // Causale corrente
TLibro_giornale* _giornale; // Libro giornale corrente
TipoIVA _iva; // Tipo di IVA corrente
bool _ges_val, _ges_sal; // Gestione valuta e saldaconto
bool _num_cli, _num_for; // Riferimento partita allineato a destra
bool _skip_giornale_check; // Ignora controllo data stampa libro giornale
bool _skip_bollato_check; // Ignora controllo data stampa bollato
bool _savenew; // Registra e nuovo
short _firstfocus; // Primo campo della maschera a prendere il focus
bool _iva_showed; // Lo sheet IVA e' gia' stato visualizzato una volta?
bool _is_saldaconto; // saldaconto si/no (vede parametri e causale)
TSaldo_agg _saldi; // Saldi da aggiornare
TPartite_array _partite; // Partite coinvolte
TMask* _msk[4]; // Maschere di query, cg, iva
long _lastreg; // Numero ultima registrazione
int _mode; // Modo maschera corrente
TBill _conto_ricavo; // Conto di ricavo del clifo
TString_array _pag_rows;
static bool showpartite_handler(TMask_field& f, KEY k);
static bool speserimb_handler(TMask_field& f, KEY k);
static bool altrespese_handler(TMask_field& f, KEY k);
static bool abbatt_handler(TMask_field& f, KEY k);
static bool abbpass_handler(TMask_field& f, KEY k);
static bool ritprof_handler(TMask_field& f, KEY k);
static bool diffcamb_handler(TMask_field& f, KEY k);
static bool suspended_handler(TMask_field& f, KEY k);
static bool num_handler(TMask_field& f, KEY key);
static bool caus_query_handler(TMask_field& f, KEY key);
static bool caus_modify_handler(TMask_field& f, KEY key);
static bool datareg_handler(TMask_field& f, KEY key);
static bool datacomp_handler(TMask_field& f, KEY key);
static bool data74ter_handler(TMask_field& f, KEY key);
static bool doc_handler(TMask_field& f, KEY key);
static bool protiva_handler(TMask_field& f, KEY key);
static bool clifo_handler(TMask_field& f, KEY key);
static bool totale_handler(TMask_field& f, KEY key);
static bool totdoc_handler(TMask_field& f, KEY key);
static bool ritfis_handler(TMask_field& f, KEY key);
static bool ritsoc_handler(TMask_field& f, KEY key);
static bool main_codiva_handler(TMask_field& f, KEY key);
static bool corrlire_handler(TMask_field& f, KEY key);
static bool corrvaluta_handler(TMask_field& f, KEY key);
static bool occas_code_handler(TMask_field& f, KEY key);
static bool occas_handler(TMask_field& f, KEY key);
static bool solaiva_handler(TMask_field& f, KEY key);
static bool descr_handler(TMask_field& f, KEY k);
static bool sheet_clifo_handler(TMask_field& f, KEY k);
static bool iva_sottoconto_handler(TMask_field& f, KEY k);
static bool imponibile_handler(TMask_field& f, KEY key);
static bool detrazione_handler(TMask_field& f, KEY key);
static bool codiva_handler(TMask_field& f, KEY key);
static bool imposta_handler(TMask_field& f, KEY key);
static bool dareavere_handler(TMask_field& f, KEY k);
static bool cg_conto_handler(TMask_field& f, KEY key);
static bool codpag_handler(TMask_field& f, KEY key);
static bool iva_notify(TSheet_field& s, int r, KEY key);
static bool iva_handler(TMask_field& f, KEY key);
static bool cg_notify(TSheet_field& s, int r, KEY key);
static bool cg_handler(TMask_field& f, KEY key);
static bool pag_notify(TSheet_field& s, int r, KEY key);
void reset_sheet_row(TSheet_field& s, int n);
protected: // TApplication
virtual void on_firm_change();
virtual void on_config_change();
virtual void print();
protected: // TRelation_application
virtual bool user_create();
virtual bool user_destroy();
virtual bool changing_mask(int mode);
virtual TMask* get_mask(int mode);
virtual TRelation* get_relation() const { return _rel; }
virtual void init_query_mode(TMask& m);
virtual void init_insert_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
virtual bool save_and_new() const;
virtual const char* get_next_key();
virtual int read(TMask& m);
virtual int write(const TMask& m);
virtual int rewrite(const TMask& m);
virtual bool remove();
virtual void write_enable(bool) {}
protected:
void check_saldi();
void genera_incasso(const char* causimm);
TMask* load_mask(int n);
TMask& occas_mask() { return *load_mask(3); }
void mask2rel(const TMask& m);
TipoIVA iva() const { return _iva; }
char clifo() const { return iva() == iva_vendite ? 'C' : 'F'; }
bool gestione_valuta() const { return _ges_val; }
bool gestione_saldaconto() const { return _ges_sal; }
bool is_saldaconto() const { return _is_saldaconto; }
void set_saldaconto(bool b) { _is_saldaconto = b; }
void fill_sheet(TMask& m) const;
void init_mask(TMask& m);
static TipoIVA reg2IVA(const char* registro, int anno);
static TipoIVA cau2IVA(const char* causale, int anno);
static int type2pos(char tipo);
static const real& cod2IVA(const TMask& m);
static real scorpora(real& imponibile, const real& percentuale);
static bool detraibile(TToken_string& row);
static int bill2pos(const TBill& conto, char tipo);
bool IVA2bill(const TCodiceIVA& iva, TBill& bill);
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; }
TLibro_giornale& giornale() { return *_giornale; }
bool test_swap(bool ritsoc);
TImporto real2imp(const real& r, char tipo);
real totale_documento();
void ivas_pack();
void cgs_pack();
bool ci_sono_importi() const;
real calcola_saldo() const;
real calcola_imp() const;
void add_cgs_tot(TMask& m);
int set_cgs_row(int n, const TImporto& importo, TBill& conto, const char* desc, char tipo);
void set_cgs_imp(int n, const TImporto& importo);
TImporto get_cgs_imp(int n);
bool add_cgs_imp(int n, const TImporto& importo);
bool sub_cgs_imp(int n, const TImporto& importo);
void disable_cgs_cells(int n, char tipo);
void add_cgs_rit(bool fisc);
void generazione_righe_cg(int r);
void reset_cgs_row(int n) { reset_sheet_row(cgs(), n); }
void reset_ivas_row(int n) { reset_sheet_row(ivas(), n); }
TPagamento& pagamento() { CHECK(_pag, "Pagamento nullo"); return *_pag; }
void set_pagamento(const char* c, const char* d);
void reset_pagamento();
void set_scadenze(TMask& m);
bool read_scadenze(TMask& m);
void write_scadenze(const TMask& m);
bool edit_partite(int riga);
bool notify_cgline_deletion(TPartita& partita, long nreg, int numrig);
bool notify_cgline_deletion(int numrig);
bool notify_edit_pagamento(TPartita& partita, TRectype& new_pag);
long calcola_m770(int tipo_coll, real& spese, real& compenso, real& iva, real& ritfis);
bool link_m770();
public:
TPartite_array& partite() { return _partite; } // Partite editate
int nuovo_pagamento(TPartita& p, int nriga, int rata, int rmov);
bool edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp);
TSheet_field& cgs() const;
TSheet_field& ivas() const;
TSheet_field& pags() const;
TString_array& pag_rows() { return _pag_rows; }
TPrimanota_application();
};
inline TPrimanota_application& app()
{ return (TPrimanota_application&)main_app(); }
#endif

View File

@ -15,6 +15,7 @@
class TGame_mask : public TMask
{
const TBill _conto; // Conto fisso
int _riga_partite;
protected:
static bool annopart_handler(TMask_field& f, KEY k);
@ -61,7 +62,7 @@ bool TGame_mask::annopart_handler(TMask_field& f, KEY k)
{
TMask_field& n = f.mask().field(P_NUMERO);
n.set_dirty();
numpart_handler(f, k);
numpart_handler(n, k);
}
return TRUE;
}
@ -123,6 +124,8 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (k == K_TAB)
{
TGame_mask& gm = (TGame_mask&)partite.mask();
gm._riga_partite = r;
TSheet_field& scadenze = gm.scadenze();
scadenze.destroy();
@ -160,7 +163,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
const TRecord_array& ap = scad.rows_array();
const int lastp = ap.last_row();
for (int pa = ap.first_row(); pa < lastp; pa++) if (ap.exist(pa))
for (int pa = ap.first_row(); pa <= lastp; pa = ap.succ_row(pa))
{
const TRiga_partite& rigp = game->riga(pa);
const TRectype& pag = ap.row(pa);
@ -176,7 +179,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
row.add(pag.get_real(SCAD_IMPORTOVAL).string(0, 2));
row.add(rigp.get(PART_DESCR));
row.add(rigp.get(PART_NUMDOC));
row.add(rigp.get(PART_PROTIVA));
row.add("");
row.add(pa);
}
}
@ -224,7 +227,10 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
}
TPartita& game = app().partite().partita(bill, anno, numero);
app().edit_pagamento(game, nriga, nrata, nrigp);
const bool dirty = app().edit_pagamento(game, nriga, nrata, nrigp);
if (dirty)
partite_notify(gm.partite(), gm._riga_partite, K_TAB);
}
return TRUE;
}
@ -259,59 +265,52 @@ void TGame_mask::fill_partite(bool all) const
const TRectype filter(partita.curr()); // Record campione
int ultimo_anno = 0, anno; // Anno ultima partita
TString16 ultimo_num, num; // Ultimo numero partita
TToken_string r(80);
for (int err = partita.read(_isgteq); err == NOERR && partita.curr() == filter; err = partita.next())
for (int err = partita.read(_isgteq);
err == NOERR && partita.curr() == filter;
err = partita.read(_isgreat))
{
anno = partita.get_int(PART_ANNO);
num = partita.get(PART_NUMPART);
if (ultimo_anno != anno && ultimo_num != num)
const int anno = partita.get_int(PART_ANNO);
const TString16 num(partita.get(PART_NUMPART));
TPartita* game = NULL;
bool should_delete_game = FALSE;
if (app().partite().exist(conto(), anno, num))
game = &app().partite().partita(conto(), anno, num);
else
{
TPartita* game = NULL;
bool should_delete_game = FALSE;
if (app().partite().exist(conto(), anno, num))
game = &app().partite().partita(conto(), anno, num);
else
{
game = new TPartita(conto(), anno, num);
should_delete_game = TRUE;
}
game = new TPartita(conto(), anno, num);
should_delete_game = TRUE;
}
TImporto saldo, doc, pag, imp;
game->calcola_saldo(saldo, doc, pag, imp);
TImporto saldo, doc, pag, imp;
game->calcola_saldo(saldo, doc, pag, imp);
if (all || !saldo.is_zero())
{
int riga_fatt = game->prima_fattura();
if (riga_fatt < 1) riga_fatt = 1; // E' un anticipo
if (all || !saldo.is_zero())
{
int riga_fatt = game->prima_fattura();
if (riga_fatt < 1) riga_fatt = game->first(); // E' un anticipo
const TRiga_partite& riga = game->riga(riga_fatt);
const TString16 data_doc = riga.get(PART_DATADOC);
const TString16 num_doc = riga.get(PART_NUMDOC);
const char*descr = riga.get(PART_DESCR);
const TRiga_partite& riga = game->riga(riga_fatt);
const TString16 data_doc = riga.get(PART_DATADOC);
const TString16 num_doc = riga.get(PART_NUMDOC);
const char*descr = riga.get(PART_DESCR);
r.cut(0);
r.add(anno);
r.add(num);
r.add(data_doc);
r.add(num_doc);
add_importo(r, saldo);
add_importo(r, doc);
add_importo(r, pag);
add_importo(r, imp);
r.add(descr);
a.add(r); // Aggiunge partita alla lista
}
if (should_delete_game)
delete game;
ultimo_anno = anno;
ultimo_num = num;
TToken_string &r = partite().row(-1); // Stringa di lavoro per lo sheet
r.add(anno);
r.add(num);
r.add(data_doc);
r.add(num_doc);
add_importo(r, saldo);
add_importo(r, doc);
add_importo(r, pag);
add_importo(r, imp);
r.add(descr);
}
if (should_delete_game)
delete game;
partita.put(PART_NRIGA, 9999); // Forza lettura partita successiva nella prossima read
}
partite().force_update();
@ -449,42 +448,150 @@ int TPrimanota_application::nuovo_pagamento(TPartita& partita, int nriga, int ra
HIDDEN bool importo_handler(TMask_field& f, KEY k)
{
TMask& m = f.mask();
if (k == K_F8)
{
TMask& m = f.mask();
f.set(m.get(S_IMPORTO));
f.set(m.get(S_RESIDUO));
k = K_TAB;
}
if (f.to_check(k))
{
TMask& m = f.mask();
real i(f.get());
const real tot(m.get(S_IMPORTO));
if (i > tot)
{
warning_box("Non e' possibile inserire un importo superiore a ", tot.string("."));
i = tot;
f.set(i.string());
}
if (i == tot)
const real i(f.get());
const real tot(m.get(S_RESIDUO));
if (i >= tot)
m.set(S_SALDOACC, "S");
}
return TRUE;
}
bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pag)
{
const int nriga = new_pag.get_int(PAGSCA_NRIGA); // Riga fattura
const TRiga_partite& parbas = p.riga(nriga);
const int nrata = new_pag.get_int(PAGSCA_NRATA); // Numero rata
TRiga_scadenze& scaden = parbas.rata(nrata);
const int nrigp = new_pag.get_int(PAGSCA_NRIGP); // Riga pagamento
const TRectype& old_pag = scaden.row(nrigp);
const TRiga_partite& somma = p.riga(nrigp);
const char sez = somma.sezione(); // Sezione importo e ritenute
const char controsez = sez == 'A' ? 'D' : 'A'; // Sezione contropartita
// Aggiornamento contopartita
const TImporto old_importo(controsez, old_pag.get_real(PAGSCA_IMPORTO));
TBill old_conto; old_conto.get(old_pag, TRUE);
const TImporto new_importo(controsez, new_pag.get_real(PAGSCA_IMPORTO));
TBill new_conto; new_conto.get(new_pag, TRUE);
if (old_importo != new_importo || old_conto != new_conto)
{
const int old_riga = bill2pos(old_conto, 'I');
if (old_riga >= 0)
sub_cgs_imp(old_riga, old_importo);
// Importo della contropartita
if (!new_importo.is_zero())
{
const int new_riga = bill2pos(new_conto, 'I');
if (new_riga < 0)
set_cgs_row(new_riga, new_importo, new_conto, "", 'I');
else
add_cgs_imp(new_riga, new_importo);
}
}
// Aggiornamento ritenute
const real old_ritenute(old_pag.get(PAGSCA_RITENUTE));
const real new_ritenute(new_pag.get(PAGSCA_RITENUTE));
const TImporto grow_ritenute(controsez, new_ritenute-old_ritenute);
if (!grow_ritenute.is_zero())
{
const riga = type2pos('F');
if (riga < 0)
{
TBill conto_rit; causale().bill(11, conto_rit);
set_cgs_row(riga, grow_ritenute, conto_rit, "", 'F');
}
else
add_cgs_imp(riga, grow_ritenute);
}
char old_ap, new_ap;
TImporto old_abbuono, new_abbuono, old_diffcam, new_diffcam;
const bool empty = p.modifica_pagamento(new_pag,
old_ap, old_abbuono, new_abbuono,
new_ap, new_abbuono, new_diffcam);
// Se c'e' differenza negli abbuoni
if (old_abbuono != new_abbuono || old_ap != new_ap)
{
const int riga_contabile = app().cgs().selected();
if (old_ap != ' ') // Se c'era un abbuono ...
{
const int riga_abb = type2pos(old_ap);
CHECK(riga_abb >= 0, "Chiss'e' fregato gli abbuoni?");
sub_cgs_imp(riga_abb, old_abbuono);
// Sottrae l'abbuono con la sezione invertita dalla riga contabile
add_cgs_imp(riga_contabile, old_abbuono);
}
if (new_ap != ' ') // Se ci sono abbuoni
{
const riga_abb = type2pos(new_ap);
if (riga_abb < 0)
{
TBill conto_abb; causale().bill(new_ap == 'A' ? 9 : 8, conto_abb);
app().set_cgs_row(riga_abb, new_abbuono, conto_abb, "", new_ap);
}
else
add_cgs_imp(riga_abb, new_abbuono);
sub_cgs_imp(riga_contabile, new_abbuono); // Aggiunge l'abbuono con la sezione invertita
}
}
// Se c'e' variazione nella differenza cambi
if (old_diffcam != new_diffcam)
{
const int riga_diffcam = type2pos('C');
if (!old_diffcam.is_zero()) // Se c'era una differenza cambi
{
CHECK(riga_diffcam >= 0, "Chiss'e' fregato la differenza cambi?");
sub_cgs_imp(riga_diffcam, old_diffcam);
}
if (!new_diffcam.is_zero())
{
if (riga_diffcam < 0)
{
TBill conto_diffcam; causale().bill(12, conto_diffcam);
set_cgs_row(riga_diffcam, new_diffcam, conto_diffcam, "", 'C');
}
else
add_cgs_imp(riga_diffcam, new_diffcam);
}
}
return empty;
}
bool TPrimanota_application::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp)
{
TMask m("cg2100s");
m.set_handler(S_IMPORTO, importo_handler);
const TRiga_partite& parbas = p.riga(nriga);
TRiga_scadenze& scaden = parbas.rata(nrata);
const TRectype& oldpag = scaden.row(nrigp);
TRiga_partite& somma = p.riga(nrigp);
const TRiga_partite& parbas = p.riga(nriga);
const TRiga_scadenze& scaden = parbas.rata(nrata);
const TRectype& oldpag = scaden.row(nrigp);
TRiga_partite& somma = p.riga(nrigp);
const bool in_valuta = scaden.get(SCAD_CODVAL).not_empty();
const bool in_valuta = scaden.in_valuta();
m.show(S_IMPORTOVAL_SCAD, in_valuta);
m.show(S_IMPORTOVAL, in_valuta);
@ -510,16 +617,6 @@ bool TPrimanota_application::edit_pagamento(TPartita& p, int nriga, int nrata, i
m.set(S_IMPORTO_SCAD, scaden.get(SCAD_IMPORTO)); // Importo della rata
m.set(S_IMPORTOVAL_SCAD, scaden.get(SCAD_IMPORTOVAL)); // Importo in valuta
const char sez = parbas.get_char(PART_SEZ); // Sezione importo e rituenute
const char controsez = sez == 'D' ? 'A' : 'D'; // Sezione opposta (contropartita)
// Memorizza importi prima di eventuali variazioni
const TImporto old_importo(controsez, real(m.get(S_IMPORTO)));
const TImporto old_ritenute(controsez, real(m.get(S_RITENUTE)));
const TBill old_conto(m.get_int(S_GRUPPO), m.get_int(S_CONTO), m.get_long(S_SOTTOCONTO));
const int old_riga = old_conto.ok() ? bill2pos(old_conto, 'I') : -1;
const KEY key = m.run();
if (key == K_ENTER || key == K_DEL)
{
@ -535,102 +632,16 @@ bool TPrimanota_application::edit_pagamento(TPartita& p, int nriga, int nrata, i
}
m.autosave(&rel);
const TRectype& paga = rel.lfile().curr();
const TImporto new_importo(controsez, paga.get_real(PART_IMPORTO));
if (old_importo != new_importo)
{
if (old_riga >= 0)
sub_cgs_imp(old_riga, old_importo);
// Importo della contropartita
if (!new_importo.is_zero())
{
TBill new_conto; new_conto.get(paga, TRUE);
const int riga = bill2pos(new_conto, 'I');
if (riga < 0)
set_cgs_row(riga, new_importo, new_conto, m.get(S_DESCAGG), 'I');
else
add_cgs_imp(riga, new_importo);
}
}
const real rit(m.get(S_RITENUTE)); // Valore ritenute fiscali
const TImporto grow_ritenute(controsez, rit-old_ritenute.valore());
if (!grow_ritenute.is_zero())
{
const riga = type2pos('F');
if (riga < 0)
{
TBill conto_rit; causale().bill(11, conto_rit);
set_cgs_row(riga, grow_ritenute, conto_rit, "", 'F');
}
else
add_cgs_imp(riga, grow_ritenute);
}
char old_ap, new_ap;
TImporto old_abbuono, new_abbuono, old_diffcam, new_diffcam;
const bool empty = p.modifica_pagamento(paga,
old_ap, old_abbuono, new_abbuono,
new_ap, new_abbuono, new_diffcam);
// Se c'e' differenza negli abbuoni
if (old_abbuono != new_abbuono || old_ap != new_ap)
{
const int riga_contabile = app().cgs().selected();
if (old_ap != ' ') // Se c'era un abbuono ...
{
const int riga_abb = type2pos(old_ap);
CHECK(riga_abb >= 0, "Chiss'e' fregato gli abbuoni?");
sub_cgs_imp(riga_abb, old_abbuono);
// Sottrae l'abbuono con la sezione invertita dalla riga contabile
add_cgs_imp(riga_contabile, old_abbuono);
}
if (new_ap != ' ') // Se ci sono abbuoni
{
const riga_abb = type2pos(new_ap);
if (riga_abb < 0)
{
TBill conto_abb; causale().bill(new_ap == 'A' ? 9 : 8, conto_abb);
app().set_cgs_row(riga_abb, new_abbuono, conto_abb, "", new_ap);
}
else
add_cgs_imp(riga_abb, new_abbuono);
sub_cgs_imp(riga_contabile, new_abbuono); // Aggiunge l'abbuono con la sezione invertita
}
}
// Se c'e' variazione nella differenza cambi
if (old_diffcam != new_diffcam)
{
const int riga_diffcam = type2pos('C');
if (!old_diffcam.is_zero()) // Se c'era una differenza cambi
{
CHECK(riga_diffcam >= 0, "Chiss'e' fregato la differenza cambi?");
sub_cgs_imp(riga_diffcam, old_diffcam);
}
if (!new_diffcam.is_zero())
{
if (riga_diffcam < 0)
{
TBill conto_diffcam; causale().bill(12, conto_diffcam);
set_cgs_row(riga_diffcam, new_diffcam, conto_diffcam, "", 'C');
}
else
add_cgs_imp(riga_diffcam, new_diffcam);
}
}
TRectype& new_pag = rel.lfile().curr();
notify_edit_pagamento(p, new_pag);
}
return key != K_ESC;
}
bool TPrimanota_application::notify_cgline_deletion(TPartita& partita, long nreg, int numrig)
{
bool found = FALSE;
const int riga_ritenute = type2pos('F');
for (int r = partita.last(); r > 0; r = partita.pred(r))
{
@ -641,6 +652,7 @@ bool TPrimanota_application::notify_cgline_deletion(TPartita& partita, long nreg
const int num = part.get_int(PART_NUMRIG);
if (numrig > 0)
{
}
else // numrig == 0
{

View File

@ -1,386 +1,387 @@
PAGE "RIGA PRIMA NOTA" -1 -1 67 16
GROUPBOX DLG_NULL 66 3
BEGIN
PROMPT 1 1 "Descrizione"
END
STRING 108 5
BEGIN
PROMPT 2 2 ""
HELP "Codice della descrizione aggiuntiva della riga"
FLAGS "UZ"
USE %DPN
INPUT CODTAB 108
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
INPUT CODTAB 108
OUTPUT 108 CODTAB
OUTPUT 109 S0
CHECKTYPE NORMAL
END
STRING 109 50
BEGIN
PROMPT 12 2 ""
USE %DPN KEY 2
INPUT S0 109
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT 108
HELP "Descrizione aggiuntiva della riga"
FIELD DESCR
END
GROUPBOX DLG_NULL 66 5
BEGIN
PROMPT 1 4 "Conto principale"
END
NUMBER 101 15
BEGIN
PROMPT 2 5 "Dare "
HELP "Importo 'dare' del conto della riga"
FLAGS "RV"
PICTURE "."
END
NUMBER 102 15
BEGIN
PROMPT 42 5 "Avere "
HELP "Importo 'avere' del conto della riga"
FLAGS "RV"
PICTURE "."
END
LIST 103 1 12
BEGIN
PROMPT 2 6 "Tipo "
HELP "Tipo del conto principale della riga"
FLAGS "U"
ITEM " |Conto" MESSAGE SHOW,106|HIDE,206|HIDE,306|SHOW,107|HIDE,207|HIDE,307
ITEM "C|Cliente" MESSAGE SHOW,206|HIDE,106|HIDE,306|SHOW,207|HIDE,107|HIDE,307
ITEM "F|Fornitore" MESSAGE SHOW,306|HIDE,106|HIDE,206|SHOW,307|HIDE,107|HIDE,207
END
NUMBER 104 3
BEGIN
PROMPT 20 6 "Gruppo "
HELP "Codice del conto delle riga"
END
NUMBER 105 3
BEGIN
PROMPT 32 6 "Conto "
HELP "Codice del conto delle riga"
FIELD LF_PCON->CONTO
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="")
INPUT GRUPPO 104
INPUT CONTO 105
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
DISPLAY "Tipo" TMCF
OUTPUT 103 TMCF
OUTPUT 104 GRUPPO
OUTPUT 105 CONTO
OUTPUT 107 DESCR
CHECKTYPE NORMAL
MESSAGE DIRTY,106|DIRTY,206|DIRTY,306
WARNING "Conto inesistente o mancante sulla riga contabile"
END
NUMBER 106 6
BEGIN
PROMPT 45 6 "Sottoconto "
HELP "Codice del conto delle riga"
FIELD LF_PCON->SOTTOCONTO
USE LF_PCON SELECT SOTTOCONTO!=""
INPUT GRUPPO 104
INPUT CONTO 105
INPUT SOTTOCONTO 106
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT 106 SOTTOCONTO
OUTPUT 104 GRUPPO
OUTPUT 105 CONTO
OUTPUT 107 DESCR
ADD RUN cg0 -0
CHECKTYPE NORMAL
WARNING "Sottoconto inesistente sulla riga contabile"
END
NUMBER 206 6
BEGIN
PROMPT 45 6 "Cliente "
HELP "Codice del cliente delle riga"
FIELD LF_PCON->SOTTOCONTO
USE LF_CLIFO
INPUT TIPOCF "C"
INPUT CODCF 206
DISPLAY "Codice" CODCF
DISPLAY "Ragione Sociale Cliente@50" RAGSOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
OUTPUT 206 CODCF
OUTPUT 207 RAGSOC
MESSAGE COPY,106
ADD RUN cg0 -1 C
CHECKTYPE NORMAL
WARNING "Cliente inesistente sulla riga contabile"
END
NUMBER 306 6
BEGIN
PROMPT 45 6 "Fornitore "
HELP "Codice del fornitore delle riga"
FIELD LF_PCON->SOTTOCONTO
USE LF_CLIFO
INPUT TIPOCF "F"
INPUT CODCF 306
DISPLAY "Codice" CODCF
DISPLAY "Ragione Sociale Fornitore@50" RAGSOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
OUTPUT 306 CODCF
OUTPUT 307 RAGSOC
MESSAGE COPY,106
ADD RUN cg0 -1 F
MESSAGE COPY,106
CHECKTYPE NORMAL
WARNING "Fornitore inesistente sulla riga contabile"
END
STRING 107 50
BEGIN
PROMPT 2 7 "Descriz. "
HELP "Descrizione del conto delle riga"
FIELD LF_PCON->DESCR
USE LF_PCON KEY 2
INPUT DESCR 107
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT 106
CHECKTYPE NORMAL
WARNING "Sottoconto inesistente o mancante sulla riga contabile"
ADD RUN cg0 -0
END
STRING 207 50
BEGIN
PROMPT 2 7 "Cliente "
HELP "Ragione sociale del cliente delle riga"
FIELD LF_CLIFO->RAGSOC
USE LF_CLIFO KEY 2
INPUT TIPOCF "C"
INPUT RAGSOC 207
DISPLAY "Ragione Sociale Cliente@50" RAGSOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Codice" CODCF
COPY OUTPUT 206
MESSAGE COPY,107
ADD RUN cg0 -1 C
CHECKTYPE NORMAL
WARNING "Cliente inesistente sulla riga contabile"
END
STRING 307 50
BEGIN
PROMPT 2 7 "Fornitore "
HELP "Ragione sociale del fonitore delle riga"
FIELD LF_PCON->SOTTOCONTO
USE LF_CLIFO KEY 2
INPUT TIPOCF "F"
INPUT RAGSOC 307
DISPLAY "Ragione Sociale Fornitore@50" RAGSOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Codice" CODCF
COPY OUTPUT 306
MESSAGE COPY,107
ADD RUN cg0 -1 F
CHECKTYPE NORMAL
WARNING "Fornitore inesistente sulla riga contabile"
END
GROUPBOX DLG_NULL 66 4
BEGIN
PROMPT 1 9 "Contropartita"
END
LIST 110 1 12
BEGIN
PROMPT 2 10 "Tipo "
HELP "Tipo del conto di contropartita della riga"
FLAGS "U"
ITEM " |Conto" MESSAGE SHOW,113|HIDE,213|HIDE,313|SHOW,114|HIDE,214|HIDE,314
ITEM "C|Cliente" MESSAGE SHOW,213|HIDE,113|HIDE,313|SHOW,214|HIDE,114|HIDE,314
ITEM "F|Fornitore" MESSAGE SHOW,313|HIDE,113|HIDE,213|SHOW,314|HIDE,114|HIDE,214
END
NUMBER 111 3
BEGIN
PROMPT 20 10 "Gruppo "
HELP "Codice del conto di contropartita delle riga"
END
NUMBER 112 3
BEGIN
PROMPT 32 10 "Conto "
HELP "Codice del conto di contropartita delle riga"
FIELD LF_PCON->CONTO
COPY USE 105
INPUT GRUPPO 111
INPUT CONTO 112
COPY DISPLAY 105
OUTPUT 110 TMCF
OUTPUT 111 GRUPPO
OUTPUT 112 CONTO
OUTPUT 114 DESCR
ADD RUN CG0 -0
MESSAGE DIRTY,113|DIRTY,213|DIRTY,313
CHECKTYPE NORMAL
VALIDATE REQIF_FUNC 3 113 213 313
END
NUMBER 113 6
BEGIN
PROMPT 45 10 "Sottoconto "
HELP "Codice del conto di contropartita delle riga"
FIELD LF_PCON->SOTTOCONTO
COPY USE 106
COPY INPUT 112
INPUT SOTTOCONTO 113
COPY DISPLAY 106
OUTPUT 113 SOTTOCONTO
OUTPUT 111 GRUPPO
OUTPUT 112 CONTO
OUTPUT 114 DESCR
CHECKTYPE NORMAL
END
NUMBER 213 6
BEGIN
PROMPT 45 10 "Cliente "
HELP "Codice del cliente di contropartita delle riga"
FIELD LF_CLIFO->CODCF
COPY USE 206
INPUT TIPOCF "C"
INPUT CODCF 213
COPY DISPLAY 206
OUTPUT 213 CODCF
OUTPUT 214 RAGSOC
MESSAGE COPY,113
CHECKTYPE NORMAL
END
NUMBER 313 6
BEGIN
PROMPT 45 10 "Fornitore "
HELP "Codice del fornitore di contropartita delle riga"
FIELD LF_CLIFO->CODCF
COPY USE 306
INPUT TIPOCF "F"
INPUT CODCF 313
COPY DISPLAY 306
OUTPUT 313 CODCF
OUTPUT 314 RAGSOC
MESSAGE COPY,113
CHECKTYPE NORMAL
END
STRING 114 50
BEGIN
PROMPT 2 11 "Descriz. "
HELP "Descrizione del conto di contropartita delle riga"
FIELD LF_PCON->DESCR
COPY USE 107
INPUT DESCR 114
COPY DISPLAY 107
COPY OUTPUT 113
ADD RUN cg0 -0
WARNING "Conto inesistente sulla riga contabile"
END
STRING 214 50
BEGIN
PROMPT 2 11 "Cliente "
HELP "Ragione sociale del cliente di contropartita delle riga"
FIELD LF_CLIFO->RAGSOC
COPY USE 207
INPUT TIPOCF "C"
INPUT RAGSOC 214
COPY DISPLAY 207
COPY OUTPUT 213
ADD RUN cg0 -1 C
CHECKTYPE NORMAL
WARNING "Cliente inesistente sulla riga contabile"
END
STRING 314 50
BEGIN
PROMPT 2 11 "Fornitore "
HELP "Ragione sociale del fornitore di contropartita delle riga"
FIELD LF_CLIFO->RAGSOC
COPY USE 307
INPUT TIPOCF "F"
INPUT RAGSOC 314
COPY DISPLAY 307
COPY OUTPUT 313
ADD RUN cg0 -1 F
CHECKTYPE NORMAL
WARNING "Fornitore inesistente sulla riga contabile"
END
NUMBER 115 7
BEGIN
PROMPT 2 13 "Riga giornale "
FLAGS "D"
END
LIST 116 20
BEGIN
PROMPT 30 13 "Tipo riga "
ITEM " |Sola contabilita'"
ITEM "C|Gestione saldaconto"
ITEM "D|IVA detraibile"
ITEM "F|Ritenute fiscali"
ITEM "I|Riga di IVA"
ITEM "N|IVA non detraibile"
ITEM "S|Ritenute sociali"
ITEM "T|Totale documento"
FLAGS "D"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -14 -1 ""
END
BUTTON DLG_CANCEL 9 2
BEGIN
PROMPT -24 -1 ""
END
BUTTON DLG_DELREC 9 2
BEGIN
PROMPT -34 -1 "Elimina"
MESSAGE EXIT,K_DEL
END
BUTTON 100 9 2
BEGIN
PROMPT -44 -1 "Partite"
MESSAGE EXIT,K_DEL
END
ENDPAGE
ENDMASK
PAGE "RIGA PRIMA NOTA" -1 -1 67 16
GROUPBOX DLG_NULL 66 3
BEGIN
PROMPT 1 1 "Descrizione"
END
STRING 108 5
BEGIN
PROMPT 2 2 ""
HELP "Codice della descrizione aggiuntiva della riga"
FLAGS "UZ"
USE %DPN
INPUT CODTAB 108
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
INPUT CODTAB 108
OUTPUT 108 CODTAB
OUTPUT 109 S0
CHECKTYPE NORMAL
END
STRING 109 50
BEGIN
PROMPT 12 2 ""
USE %DPN KEY 2
INPUT S0 109
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT 108
HELP "Descrizione aggiuntiva della riga"
FIELD DESCR
END
GROUPBOX DLG_NULL 66 5
BEGIN
PROMPT 1 4 "Conto principale"
END
NUMBER 101 15
BEGIN
PROMPT 2 5 "Dare "
HELP "Importo 'dare' del conto della riga"
FLAGS "RV"
PICTURE "."
END
NUMBER 102 15
BEGIN
PROMPT 42 5 "Avere "
HELP "Importo 'avere' del conto della riga"
FLAGS "RV"
PICTURE "."
END
LIST 103 1 12
BEGIN
PROMPT 2 6 "Tipo "
HELP "Tipo del conto principale della riga"
FLAGS "U"
ITEM " |Conto" MESSAGE SHOW,106|HIDE,206|HIDE,306|SHOW,107|HIDE,207|HIDE,307
ITEM "C|Cliente" MESSAGE SHOW,206|HIDE,106|HIDE,306|SHOW,207|HIDE,107|HIDE,307
ITEM "F|Fornitore" MESSAGE SHOW,306|HIDE,106|HIDE,206|SHOW,307|HIDE,107|HIDE,207
END
NUMBER 104 3
BEGIN
PROMPT 20 6 "Gruppo "
HELP "Codice del conto delle riga"
END
NUMBER 105 3
BEGIN
PROMPT 32 6 "Conto "
HELP "Codice del conto delle riga"
FIELD LF_PCON->CONTO
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="")
INPUT GRUPPO 104
INPUT CONTO 105
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
DISPLAY "Tipo" TMCF
OUTPUT 103 TMCF
OUTPUT 104 GRUPPO
OUTPUT 105 CONTO
OUTPUT 107 DESCR
CHECKTYPE NORMAL
MESSAGE DIRTY,106|DIRTY,206|DIRTY,306
WARNING "Conto inesistente o mancante sulla riga contabile"
END
NUMBER 106 6
BEGIN
PROMPT 45 6 "Sottoconto "
HELP "Codice del conto delle riga"
FIELD LF_PCON->SOTTOCONTO
USE LF_PCON SELECT SOTTOCONTO!=""
INPUT GRUPPO 104
INPUT CONTO 105
INPUT SOTTOCONTO 106
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT 106 SOTTOCONTO
OUTPUT 104 GRUPPO
OUTPUT 105 CONTO
OUTPUT 107 DESCR
ADD RUN cg0 -0
CHECKTYPE NORMAL
WARNING "Sottoconto inesistente sulla riga contabile"
END
NUMBER 206 6
BEGIN
PROMPT 45 6 "Cliente "
HELP "Codice del cliente delle riga"
FIELD LF_PCON->SOTTOCONTO
USE LF_CLIFO
INPUT TIPOCF "C"
INPUT CODCF 206
DISPLAY "Codice" CODCF
DISPLAY "Ragione Sociale Cliente@50" RAGSOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
OUTPUT 206 CODCF
OUTPUT 207 RAGSOC
MESSAGE COPY,106
ADD RUN cg0 -1 C
CHECKTYPE NORMAL
WARNING "Cliente inesistente sulla riga contabile"
END
NUMBER 306 6
BEGIN
PROMPT 45 6 "Fornitore "
HELP "Codice del fornitore delle riga"
FIELD LF_PCON->SOTTOCONTO
USE LF_CLIFO
INPUT TIPOCF "F"
INPUT CODCF 306
DISPLAY "Codice" CODCF
DISPLAY "Ragione Sociale Fornitore@50" RAGSOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
OUTPUT 306 CODCF
OUTPUT 307 RAGSOC
MESSAGE COPY,106
ADD RUN cg0 -1 F
MESSAGE COPY,106
CHECKTYPE NORMAL
WARNING "Fornitore inesistente sulla riga contabile"
END
STRING 107 50
BEGIN
PROMPT 2 7 "Descriz. "
HELP "Descrizione del conto delle riga"
FIELD LF_PCON->DESCR
USE LF_PCON KEY 2
INPUT DESCR 107
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT 106
CHECKTYPE NORMAL
WARNING "Sottoconto inesistente o mancante sulla riga contabile"
ADD RUN cg0 -0
END
STRING 207 50
BEGIN
PROMPT 2 7 "Cliente "
HELP "Ragione sociale del cliente delle riga"
FIELD LF_CLIFO->RAGSOC
USE LF_CLIFO KEY 2
INPUT TIPOCF "C"
INPUT RAGSOC 207
DISPLAY "Ragione Sociale Cliente@50" RAGSOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Codice" CODCF
COPY OUTPUT 206
MESSAGE COPY,107
ADD RUN cg0 -1 C
CHECKTYPE NORMAL
WARNING "Cliente inesistente sulla riga contabile"
END
STRING 307 50
BEGIN
PROMPT 2 7 "Fornitore "
HELP "Ragione sociale del fonitore delle riga"
FIELD LF_PCON->SOTTOCONTO
USE LF_CLIFO KEY 2
INPUT TIPOCF "F"
INPUT RAGSOC 307
DISPLAY "Ragione Sociale Fornitore@50" RAGSOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Codice" CODCF
COPY OUTPUT 306
MESSAGE COPY,107
ADD RUN cg0 -1 F
CHECKTYPE NORMAL
WARNING "Fornitore inesistente sulla riga contabile"
END
GROUPBOX DLG_NULL 66 4
BEGIN
PROMPT 1 9 "Contropartita"
END
LIST 110 1 12
BEGIN
PROMPT 2 10 "Tipo "
HELP "Tipo del conto di contropartita della riga"
FLAGS "U"
ITEM " |Conto" MESSAGE SHOW,113|HIDE,213|HIDE,313|SHOW,114|HIDE,214|HIDE,314
ITEM "C|Cliente" MESSAGE SHOW,213|HIDE,113|HIDE,313|SHOW,214|HIDE,114|HIDE,314
ITEM "F|Fornitore" MESSAGE SHOW,313|HIDE,113|HIDE,213|SHOW,314|HIDE,114|HIDE,214
END
NUMBER 111 3
BEGIN
PROMPT 20 10 "Gruppo "
HELP "Codice del conto di contropartita delle riga"
END
NUMBER 112 3
BEGIN
PROMPT 32 10 "Conto "
HELP "Codice del conto di contropartita delle riga"
FIELD LF_PCON->CONTO
COPY USE 105
INPUT GRUPPO 111
INPUT CONTO 112
COPY DISPLAY 105
OUTPUT 110 TMCF
OUTPUT 111 GRUPPO
OUTPUT 112 CONTO
OUTPUT 114 DESCR
ADD RUN CG0 -0
MESSAGE DIRTY,113|DIRTY,213|DIRTY,313
CHECKTYPE NORMAL
VALIDATE REQIF_FUNC 3 113 213 313
END
NUMBER 113 6
BEGIN
PROMPT 45 10 "Sottoconto "
HELP "Codice del conto di contropartita delle riga"
FIELD LF_PCON->SOTTOCONTO
COPY USE 106
COPY INPUT 112
INPUT SOTTOCONTO 113
COPY DISPLAY 106
OUTPUT 113 SOTTOCONTO
OUTPUT 111 GRUPPO
OUTPUT 112 CONTO
OUTPUT 114 DESCR
CHECKTYPE NORMAL
END
NUMBER 213 6
BEGIN
PROMPT 45 10 "Cliente "
HELP "Codice del cliente di contropartita delle riga"
FIELD LF_CLIFO->CODCF
COPY USE 206
INPUT TIPOCF "C"
INPUT CODCF 213
COPY DISPLAY 206
OUTPUT 213 CODCF
OUTPUT 214 RAGSOC
MESSAGE COPY,113
CHECKTYPE NORMAL
END
NUMBER 313 6
BEGIN
PROMPT 45 10 "Fornitore "
HELP "Codice del fornitore di contropartita delle riga"
FIELD LF_CLIFO->CODCF
COPY USE 306
INPUT TIPOCF "F"
INPUT CODCF 313
COPY DISPLAY 306
OUTPUT 313 CODCF
OUTPUT 314 RAGSOC
MESSAGE COPY,113
CHECKTYPE NORMAL
END
STRING 114 50
BEGIN
PROMPT 2 11 "Descriz. "
HELP "Descrizione del conto di contropartita delle riga"
FIELD LF_PCON->DESCR
COPY USE 107
INPUT DESCR 114
COPY DISPLAY 107
COPY OUTPUT 113
ADD RUN cg0 -0
WARNING "Conto inesistente sulla riga contabile"
END
STRING 214 50
BEGIN
PROMPT 2 11 "Cliente "
HELP "Ragione sociale del cliente di contropartita delle riga"
FIELD LF_CLIFO->RAGSOC
COPY USE 207
INPUT TIPOCF "C"
INPUT RAGSOC 214
COPY DISPLAY 207
COPY OUTPUT 213
ADD RUN cg0 -1 C
CHECKTYPE NORMAL
WARNING "Cliente inesistente sulla riga contabile"
END
STRING 314 50
BEGIN
PROMPT 2 11 "Fornitore "
HELP "Ragione sociale del fornitore di contropartita delle riga"
FIELD LF_CLIFO->RAGSOC
COPY USE 307
INPUT TIPOCF "F"
INPUT RAGSOC 314
COPY DISPLAY 307
COPY OUTPUT 313
ADD RUN cg0 -1 F
CHECKTYPE NORMAL
WARNING "Fornitore inesistente sulla riga contabile"
END
NUMBER 115 7
BEGIN
PROMPT 2 13 "Riga giornale "
FLAGS "D"
END
LIST 116 20
BEGIN
PROMPT 30 13 "Tipo riga "
ITEM " |Sola contabilita'"
ITEM "C|Gestione saldaconto"
ITEM "D|IVA detraibile"
ITEM "F|Ritenute fiscali"
ITEM "I|Riga di IVA"
ITEM "K|Riga Cliente/Fornitore"
ITEM "N|IVA non detraibile"
ITEM "S|Ritenute sociali"
ITEM "T|Totale documento"
FLAGS "D"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -14 -1 ""
END
BUTTON DLG_CANCEL 9 2
BEGIN
PROMPT -24 -1 ""
END
BUTTON DLG_DELREC 9 2
BEGIN
PROMPT -34 -1 "Elimina"
MESSAGE EXIT,K_DEL
END
BUTTON 100 9 2
BEGIN
PROMPT -44 -1 "Partite"
MESSAGE EXIT,K_DEL
END
ENDPAGE
ENDMASK

File diff suppressed because it is too large Load Diff

View File

@ -1,347 +1,347 @@
#ifndef __PAGAMENT_H
#define __PAGAMENT_H
#ifndef __ASSOC_H
#include <assoc.h>
#endif
#ifndef __MSKSHEET_H
#include <msksheet.h>
#endif
#ifndef __RELATION_H
#include <relation.h>
#endif
#ifndef __TABUTIL_H
#include <tabutil.h>
#endif
#ifndef __CONTO_H
#include "conto.h"
#endif
// Error codes for pagation
const word P_OK = 0x0000; // ok
const word P_RSUM = 0x0001; // percentages do not sum up to 100
const word P_IMPNC = 0x0002; // inconsistenza percentuali / importi
const word P_SCAD = 0x0004; // scadenze non consecutive
const word P_INIZIO = 0x0008; // data 1a rata < data inizio pagamenti
class TPagamento : public TObject
{
TString _code; // codice
TString _name; // descrizione
real _imponibile; // imponibile da affettare
real _imposta; // imposta da affettare
real _spese; // spese da affettare
TDistrib _slicer; // affettatrice
bool _new; // non letto da database
TArray _rate; // rate medesime
char _inscad; // inizio scadenze: S1
bool _mcomm; // mese commerciale: B0
bool _rdiff; // rate differenziate: B1
int _tpr; // tipo prima rata: S3
bool _dirty; // modificato (strutturalmente!)
TDate _inizio; // data inizio pagamenti
bool _inited; // vero se c'e' un movimento di riferimento
real _firstr; // importo da pagare in prima rata (o distribuire se tpr == 0)
real _secndr; // importo da distribuire
int _fixd[3]; // giorni scadenza fissa, se desiderati
int _round; // decimali arrotondamento importo
int _int_rate;
int _rata_ifield(int n, int f) const;
real _rata_rfield(int n, int f) const;
TDate _rata_dfield(int n, int f) const;
const char* _rata_sfield(int n, int f) const;
int _def_tpr; // tipo rata default
TString16 _def_ulc; // ulteriore classificazione default
public:
// pregasi notare la straordinaria dovizia di const
int n_rate() const { return _rate.items(); }
bool is_new() const { return _new; }
bool dirty() const { return _dirty; }
real imponibile() const { return _imponibile; }
real imposta() const { return _imposta; }
real spese() const { return _spese; }
int tipo_rata(int n) const { return _rata_ifield(n,2);}
real perc_rata(int n) const { return _rata_rfield(n,1);}
int scad_rata(int n) const { return _rata_ifield(n,0);}
TDate data_rata(int n) const { return _rata_dfield(n,3);}
real tpay_rata(int n) const { return _rata_rfield(n,4);}
const char* ulc_rata(int n) const { return _rata_sfield(n,5);}
char inizio_scadenza() const { return _inscad; }
bool mese_commerciale() const { return _mcomm; }
bool rate_differenziate() const { return _rdiff; }
int tipo_prima_rata() const { return _tpr; }
int decs() const { return _round; }
// mi scuso per la mancanza di underscore, ma mi piaceva cosi'
bool ratapagata(int n);
const TString& name() const { return _name; }
const TString& code() const { return _code; }
const char* desc_tpr() const;
const char* desc_tipo(int) const;
// giorni scadenza fissi, aggiunti poi
void set_fixed_scad(int a, int ind) { _fixd[ind] = a; }
// queste vengono usate solo per movimenti editabili nella struttura
// (da tabella pagamenti) e riaggiustano tutte le rate in accordo
// con il parametro modificato
void set_intervallo_rate(int i);
void set_mese_commerciale(bool v, int& sscad);
void set_rate_differenziate(int v);
void set_tipo_prima_rata(int v, int sscad = -1);
void set_numero_rate(int n, int sscad = -1);
void set_inizio_scadenza(char v) { _inscad = v; }
void set_code(const char* c) { _code = c; }
void set_round(int n) { _round = n; }
// check consistency: returns word with errors flagged, 0 if ok
word validate() const;
void strerr(word err, TString& s);
// read/write from database
// relapp passa i files, se no vengono aperti
bool read(TTable* cpg = NULL, TTable* rpg = NULL);
// chiamabili solo da relapp, agiscono solo su %RPG
int write(TTable& rpg);
int rewrite(TTable& rpg);
int remove(TTable& rpg);
// modifica rate manualmente o non
TToken_string& rata(int r) { return (TToken_string&)_rate[r]; }
TToken_string& add_rata (real perc, int day, int type, const char* ulc = "");
TToken_string& set_rata (int index, real perc, int day, int type,
const char* ulc = NULL, const char* imp = NULL,
const char* data = NULL);
// questa calcola percentuali e scadenze a partire dagli importi
TToken_string& set_rata (int index, const real& howmuch, const TDate& date, int type,
const char* ulc, bool pagato);
// settano tipo rata e ult. class default per le rate; se bool = TRUE
// modificano anche le eventuali rate esistenti
void set_default_type(int type, bool change_existing = TRUE);
void set_default_ulc(const char* ulc, bool change_existing = TRUE);
void remove_rata(int r);
void zap_rate () { _rate.destroy(); }
// calcola le rate automaticamente secondo quanto specificato
void set_rate_auto();
// data una rata esistente, riaggiusta gli importi usando lo slicer e
// le scadenze usando la data di inizio
void set_imprata(int i, real r);
// slicer interface
void set_total(const real& ib, const real& im, const real& sp);
// istanzia uno sheet field come diobue comanda
void set_sheet(TSheet_field& sf, int sscad = -1);
// ricalcola automaticamente tutto il ricalcolabile
// alla modifica di una percentuale (o di un importo)
// ritorna TRUE se non si poteva; non occorre che sia inizializzato
// con un importo
word recalc_rate(int row, bool is_perc_modified, const char* new_value,
const char* scad, const char* typ, int rdiff,
bool mcomm, bool& need_recalc);
// determina la prossima scadenza
void next_scad(TDate& d, int scad, bool mcomm, int rata);
// se codtab non e' NULL legge da file (e da' errore se non c'e')
// se si vuole fare un pagamento nuovo si da' il codice con set_code
TPagamento(const char* codtab = NULL, const char* data = NULL);
virtual ~TPagamento() {}
};
#ifndef __PARTITE_H
#include <partite.h>
#endif
class TTree_rectype : public TRectype
{
protected:
TRecord_array _recarr;
void copy_key_to_row(TRectype& row) const;
int fill_array();
protected: // TRectype
virtual TObject* dup() const;
virtual int read(TBaseisamfile& f, word op = _isequal);
virtual int next(TBaseisamfile& f);
virtual int write(TBaseisamfile& f) const;
virtual int rewrite(TBaseisamfile& f) const;
virtual int remove(TBaseisamfile& f);
public:
const TRecord_array& rows_array() const { return _recarr; }
TRecord_array& rows_array() { return _recarr; }
const TRectype& row(int r) const { return ((TRecord_array&)_recarr).row(r, FALSE); }
TRectype& row(int r, bool create) { return _recarr.row(r, create); }
TTree_rectype(const TRectype& testata, const TRectype& riga, const char* num);
TTree_rectype(int testata, int riga, const char* num);
TTree_rectype(const TTree_rectype& t);
virtual ~TTree_rectype() {}
};
class TRiga_scadenze : public TTree_rectype
{
friend class TPartita;
friend class TRiga_partite;
TRiga_partite* _riga;
protected:
char calcola_abbuono(TImporto& abbuono, bool val) const;
TImporto calcola_differenza_cambio(bool update);
bool modifica_pagamento(const TRectype& new_pag,
char& old_ap, TImporto& old_abb, TImporto& old_diffcam,
char& new_ap, TImporto& new_abb, TImporto& new_diffcam);
protected: // TRecord_tree
virtual TObject* dup() const { return new TRiga_scadenze(*this); }
public:
int pagata() const; // Riga che chiude la rata o 0 se non pagata completamente
real residuo() const;
bool in_valuta() const;
TPartita& partita() const;
TRiga_partite& riga() const { return *_riga; } // Riga partite generante (fattura)
TImporto importo_pagato(bool val) const;
TImporto importo_da_pagare(bool val) const;
TRiga_scadenze(TRiga_partite* riga);
TRiga_scadenze(const TRiga_scadenze& s);
virtual ~TRiga_scadenze() {}
};
class TRiga_partite : public TTree_rectype
{
friend class TPartita;
friend class TRiga_scadenze;
TPartita* _partita;
protected:
bool update(const TRectype& vec, const TRectype& nuo, const char* field);
public: // TTree_rectype
virtual TObject* dup() const { return new TRiga_partite(*this); }
virtual int read(TBaseisamfile& f, word op);
public:
int rate() const { return _recarr.rows(); }
TRiga_scadenze& rata(int r) const { return (TRiga_scadenze&)_recarr.row(r); }
int ultimo_pagamento(int rata) const;
char sezione() const { return get_char("SEZ"); }
TPartita& partita() const { return *_partita; } // Partita di appartenenza
TRiga_partite(TPartita* game);
TRiga_partite(const TRiga_partite& r);
virtual ~TRiga_partite() {}
};
class TPartita : public TObject
{
TRecord_array _part;
TRecord_array _unassigned;
public: // TObject
virtual bool ok() const { return _part.rows() > 0; }
public:
TRiga_partite& riga(int r) const { return (TRiga_partite&)_part.row(r); }
TRiga_partite& nuova_riga() { return (TRiga_partite&)_part.row(last()+1, TRUE); }
int succ(int r) const { return _part.succ_row(r); }
int pred(int r) const { return _part.pred_row(r); }
int first() const { return _part.first_row(); }
int last() const { return _part.last_row(); }
bool reread();
bool read(const TBill& clifo, int anno, const char* num);
bool write(bool re = FALSE);
bool rewrite() { return write(TRUE); }
int mov2rig(long nreg, int rmov) const;
int rig2mov(int rmov) const;
int prima_fattura() const;
bool utilizzata(int r) const; // Controlla se esistono pagamenti sommati alla riga r
void conto(TBill& c) const { c.get(_part.key()); }
int anno() const { return _part.key().get_int(PART_ANNO); }
const TString& numero() const { return _part.key().get(PART_NUMPART); }
const TString& descrizione() const { return _part.key().get(PART_DESCR); }
TImporto importo_speso(long numreg, int numrig) const;
void update_reg_num(long nreg, const TRectype& mov);
void calcola_saldo(TImporto& saldo, TImporto& doc, TImporto& pag, TImporto& imp) const;
bool modifica_pagamento(const TRectype& new_pag,
char& old_ap, TImporto& old_abb, TImporto& old_diffcam,
char& new_ap, TImporto& new_abb, TImporto& new_diffcam);
TPartita(const TBill& clifo, int anno, const char* num);
TPartita();
};
class TPartite_array : private TAssoc_array
{
TString80 _key; // Work string
protected:
const TString& key(const TBill& clifo, int anno, const char* num); // Build key for TAssoc_array
TPartita* find(const TBill& clifo, int anno, const char* numero, bool create);
TPartita* find(const TRectype& part, bool create);
public: // TAssoc_array
virtual void destroy() { TAssoc_array::destroy(); }
public:
TPartita& partita(const TBill& clifo, int anno, const char* numero);
TPartita& partita(const TRectype& r);
TPartita* exist(const TBill& clifo, int anno, const char* numero) const
{ return ((TPartite_array*)this)->find(clifo, anno, numero, FALSE); }
TPartita* exist(const TRectype& part) const
{ return ((TPartite_array*)this)->find(part, FALSE); }
bool write(bool re = FALSE);
bool rewrite() { return write(TRUE); }
int add_reg_num(long numreg, int numrig);
TImporto importo_speso(long numreg, int numrig);
void update_reg_num(long nreg, const TRectype& mov);
TPartita* first() { restart(); return next(); }
TPartita* next() { return (TPartita*)get(); }
TPartite_array() {}
virtual ~TPartite_array() {}
};
#endif
#ifndef __PAGAMENT_H
#define __PAGAMENT_H
#ifndef __ASSOC_H
#include <assoc.h>
#endif
#ifndef __MSKSHEET_H
#include <msksheet.h>
#endif
#ifndef __RELATION_H
#include <relation.h>
#endif
#ifndef __TABUTIL_H
#include <tabutil.h>
#endif
#ifndef __CONTO_H
#include "conto.h"
#endif
// Error codes for pagation
const word P_OK = 0x0000; // ok
const word P_RSUM = 0x0001; // percentages do not sum up to 100
const word P_IMPNC = 0x0002; // inconsistenza percentuali / importi
const word P_SCAD = 0x0004; // scadenze non consecutive
const word P_INIZIO = 0x0008; // data 1a rata < data inizio pagamenti
class TPagamento : public TObject
{
TString _code; // codice
TString _name; // descrizione
real _imponibile; // imponibile da affettare
real _imposta; // imposta da affettare
real _spese; // spese da affettare
TDistrib _slicer; // affettatrice
bool _new; // non letto da database
TArray _rate; // rate medesime
char _inscad; // inizio scadenze: S1
bool _mcomm; // mese commerciale: B0
bool _rdiff; // rate differenziate: B1
int _tpr; // tipo prima rata: S3
bool _dirty; // modificato (strutturalmente!)
TDate _inizio; // data inizio pagamenti
bool _inited; // vero se c'e' un movimento di riferimento
real _firstr; // importo da pagare in prima rata (o distribuire se tpr == 0)
real _secndr; // importo da distribuire
int _fixd[3]; // giorni scadenza fissa, se desiderati
int _round; // decimali arrotondamento importo
int _int_rate;
int _rata_ifield(int n, int f) const;
real _rata_rfield(int n, int f) const;
TDate _rata_dfield(int n, int f) const;
const char* _rata_sfield(int n, int f) const;
int _def_tpr; // tipo rata default
TString16 _def_ulc; // ulteriore classificazione default
public:
// pregasi notare la straordinaria dovizia di const
int n_rate() const { return _rate.items(); }
bool is_new() const { return _new; }
bool dirty() const { return _dirty; }
real imponibile() const { return _imponibile; }
real imposta() const { return _imposta; }
real spese() const { return _spese; }
int tipo_rata(int n) const { return _rata_ifield(n,2);}
real perc_rata(int n) const { return _rata_rfield(n,1);}
int scad_rata(int n) const { return _rata_ifield(n,0);}
TDate data_rata(int n) const { return _rata_dfield(n,3);}
real tpay_rata(int n) const { return _rata_rfield(n,4);}
const char* ulc_rata(int n) const { return _rata_sfield(n,5);}
char inizio_scadenza() const { return _inscad; }
bool mese_commerciale() const { return _mcomm; }
bool rate_differenziate() const { return _rdiff; }
int tipo_prima_rata() const { return _tpr; }
int decs() const { return _round; }
// mi scuso per la mancanza di underscore, ma mi piaceva cosi'
bool ratapagata(int n);
const TString& name() const { return _name; }
const TString& code() const { return _code; }
const char* desc_tpr() const;
const char* desc_tipo(int) const;
// giorni scadenza fissi, aggiunti poi
void set_fixed_scad(int a, int ind) { _fixd[ind] = a; }
// queste vengono usate solo per movimenti editabili nella struttura
// (da tabella pagamenti) e riaggiustano tutte le rate in accordo
// con il parametro modificato
void set_intervallo_rate(int i);
void set_mese_commerciale(bool v, int& sscad);
void set_rate_differenziate(int v);
void set_tipo_prima_rata(int v, int sscad = -1);
void set_numero_rate(int n, int sscad = -1);
void set_inizio_scadenza(char v) { _inscad = v; }
void set_code(const char* c) { _code = c; }
void set_round(int n) { _round = n; }
// check consistency: returns word with errors flagged, 0 if ok
word validate() const;
void strerr(word err, TString& s);
// read/write from database
// relapp passa i files, se no vengono aperti
bool read(TTable* cpg = NULL, TTable* rpg = NULL);
// chiamabili solo da relapp, agiscono solo su %RPG
int write(TTable& rpg);
int rewrite(TTable& rpg);
int remove(TTable& rpg);
// modifica rate manualmente o non
TToken_string& rata(int r) { return (TToken_string&)_rate[r]; }
TToken_string& add_rata (real perc, int day, int type, const char* ulc = "");
TToken_string& set_rata (int index, real perc, int day, int type,
const char* ulc = NULL, const char* imp = NULL,
const char* data = NULL);
// questa calcola percentuali e scadenze a partire dagli importi
TToken_string& set_rata (int index, const real& howmuch, const TDate& date, int type,
const char* ulc, bool pagato);
// settano tipo rata e ult. class default per le rate; se bool = TRUE
// modificano anche le eventuali rate esistenti
void set_default_type(int type, bool change_existing = TRUE);
void set_default_ulc(const char* ulc, bool change_existing = TRUE);
void remove_rata(int r);
void zap_rate () { _rate.destroy(); }
// calcola le rate automaticamente secondo quanto specificato
void set_rate_auto();
// data una rata esistente, riaggiusta gli importi usando lo slicer e
// le scadenze usando la data di inizio
void set_imprata(int i, real r);
// slicer interface
void set_total(const real& ib, const real& im, const real& sp);
// istanzia uno sheet field come diobue comanda
void set_sheet(TSheet_field& sf, int sscad = -1);
// ricalcola automaticamente tutto il ricalcolabile
// alla modifica di una percentuale (o di un importo)
// ritorna TRUE se non si poteva; non occorre che sia inizializzato
// con un importo
word recalc_rate(int row, bool is_perc_modified, const char* new_value,
const char* scad, const char* typ, int rdiff,
bool mcomm, bool& need_recalc);
// determina la prossima scadenza
void next_scad(TDate& d, int scad, bool mcomm, int rata);
// se codtab non e' NULL legge da file (e da' errore se non c'e')
// se si vuole fare un pagamento nuovo si da' il codice con set_code
TPagamento(const char* codtab = NULL, const char* data = NULL);
virtual ~TPagamento() {}
};
#ifndef __PARTITE_H
#include <partite.h>
#endif
class TTree_rectype : public TRectype
{
protected:
TRecord_array _recarr;
void copy_key_to_row(TRectype& row) const;
int fill_array();
protected: // TRectype
virtual TObject* dup() const;
virtual int read(TBaseisamfile& f, word op = _isequal);
virtual int next(TBaseisamfile& f);
virtual int write(TBaseisamfile& f) const;
virtual int rewrite(TBaseisamfile& f) const;
virtual int remove(TBaseisamfile& f);
public:
const TRecord_array& rows_array() const { return _recarr; }
TRecord_array& rows_array() { return _recarr; }
const TRectype& row(int r) const { return ((TRecord_array&)_recarr).row(r, FALSE); }
TRectype& row(int r, bool create) { return _recarr.row(r, create); }
TTree_rectype(const TRectype& testata, const TRectype& riga, const char* num);
TTree_rectype(int testata, int riga, const char* num);
TTree_rectype(const TTree_rectype& t);
virtual ~TTree_rectype() {}
};
class TRiga_scadenze : public TTree_rectype
{
friend class TPartita;
friend class TRiga_partite;
TRiga_partite* _riga;
protected:
char calcola_abbuono(TImporto& abbuono, bool val) const;
TImporto calcola_differenza_cambio(bool update);
bool modifica_pagamento(const TRectype& new_pag,
char& old_ap, TImporto& old_abb, TImporto& old_diffcam,
char& new_ap, TImporto& new_abb, TImporto& new_diffcam);
protected: // TRecord_tree
virtual TObject* dup() const { return new TRiga_scadenze(*this); }
public:
int pagata() const; // Riga che chiude la rata o 0 se non pagata completamente
real residuo() const;
bool in_valuta() const;
TPartita& partita() const;
TRiga_partite& riga() const { CHECK(_riga, "Riga nulla"); return *_riga; } // Riga partite
TImporto importo_pagato(bool val) const;
TImporto importo_da_pagare(bool val) const;
TRiga_scadenze(TRiga_partite* riga);
TRiga_scadenze(const TRiga_scadenze& s);
virtual ~TRiga_scadenze() {}
};
class TRiga_partite : public TTree_rectype
{
friend class TPartita;
friend class TRiga_scadenze;
TPartita* _partita;
protected:
bool update(const TRectype& vec, const TRectype& nuo, const char* field);
public: // TTree_rectype
virtual TObject* dup() const { return new TRiga_partite(*this); }
virtual int read(TBaseisamfile& f, word op);
public:
int rate() const { return _recarr.rows(); }
TRiga_scadenze& rata(int r) const { return (TRiga_scadenze&)_recarr.row(r); }
int ultimo_pagamento(int rata) const;
char sezione() const { return get_char("SEZ"); }
TPartita& partita() const { CHECK(_partita, "Partita nulla"); return *_partita; }
TRiga_partite(TPartita* game);
TRiga_partite(const TRiga_partite& r);
virtual ~TRiga_partite() {}
};
class TPartita : public TObject
{
TRecord_array _part;
TRecord_array _unassigned;
public: // TObject
virtual bool ok() const { return _part.rows() > 0; }
public:
TRiga_partite& riga(int r) const { return (TRiga_partite&)_part.row(r); }
TRiga_partite& nuova_riga() { return (TRiga_partite&)_part.row(last()+1, TRUE); }
int succ(int r) const { return _part.succ_row(r); }
int pred(int r) const { return _part.pred_row(r); }
int first() const { return _part.first_row(); }
int last() const { return _part.last_row(); }
bool reread();
bool read(const TBill& clifo, int anno, const char* num);
bool write(bool re = FALSE);
bool rewrite() { return write(TRUE); }
int mov2rig(long nreg, int rmov) const;
int rig2mov(int rmov) const;
int prima_fattura() const;
bool utilizzata(int r) const; // Controlla se esistono pagamenti sommati alla riga r
void conto(TBill& c) const { c.get(_part.key()); }
int anno() const { return _part.key().get_int(PART_ANNO); }
const TString& numero() const { return _part.key().get(PART_NUMPART); }
const TString& descrizione() const { return _part.key().get(PART_DESCR); }
TImporto importo_speso(long numreg, int numrig) const;
void update_reg_num(long nreg, const TRectype& mov);
void calcola_saldo(TImporto& saldo, TImporto& doc, TImporto& pag, TImporto& imp) const;
bool modifica_pagamento(const TRectype& new_pag,
char& old_ap, TImporto& old_abb, TImporto& old_diffcam,
char& new_ap, TImporto& new_abb, TImporto& new_diffcam);
TPartita(const TBill& clifo, int anno, const char* num);
TPartita();
};
class TPartite_array : private TAssoc_array
{
TString80 _key; // Work string
protected:
const TString& key(const TBill& clifo, int anno, const char* num); // Build key for TAssoc_array
TPartita* find(const TBill& clifo, int anno, const char* numero, bool create);
TPartita* find(const TRectype& part, bool create);
public: // TAssoc_array
virtual void destroy() { TAssoc_array::destroy(); }
public:
TPartita& partita(const TBill& clifo, int anno, const char* numero);
TPartita& partita(const TRectype& r);
TPartita* exist(const TBill& clifo, int anno, const char* numero) const
{ return ((TPartite_array*)this)->find(clifo, anno, numero, FALSE); }
TPartita* exist(const TRectype& part) const
{ return ((TPartite_array*)this)->find(part, FALSE); }
bool write(bool re = FALSE);
bool rewrite() { return write(TRUE); }
int add_reg_num(long numreg, int numrig);
TImporto importo_speso(long numreg, int numrig);
void update_reg_num(long nreg, const TRectype& mov);
TPartita* first() { restart(); return next(); }
TPartita* next() { return (TPartita*)get(); }
TPartite_array() {}
virtual ~TPartite_array() {}
};
#endif