Corretti errori
git-svn-id: svn://10.65.10.50/trunk@1846 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1d1035ed0a
commit
b324468b47
@ -120,6 +120,7 @@ class CG0400_application : public TPrintapp
|
||||
TDate _data;
|
||||
int _sospmsk, _tipoprog, _livelloprog, _tipo_aliq, _tipo_attiv, _annoiva, _i;
|
||||
int _mese, _anno;
|
||||
long _codditta;
|
||||
bool _st_inizio_anno, _prima_pagina;
|
||||
TIva_array _iva_array,_iva1_array;
|
||||
TGen_array _gen_array,_gen1_array;
|
||||
@ -275,7 +276,7 @@ void CG0400_application::look_pim()
|
||||
|
||||
//Modifica del 12/07/1995
|
||||
if (tipoiva == "VE") continue; //i codici iva di tipo "VE"
|
||||
//Fine //non devono essere stampati
|
||||
//Fine //non devono essere stampati
|
||||
|
||||
while (classify_pim(pim.curr(), imponibile, imposta, tipo))
|
||||
{
|
||||
@ -512,6 +513,7 @@ bool CG0400_application::set_print(int m)
|
||||
case visualizza:
|
||||
{
|
||||
_sospmsk = _tipo_aliq = _tipo_attiv = 0;
|
||||
_codditta = msk.get_long(F_CODDITTA);
|
||||
_annoiva = msk.get_int(F_ANNO);
|
||||
_tipoprog = msk.get_int(F_TIPO); // 1 <=> vendite; 2 <=> acquisti
|
||||
_livelloprog = msk.get_int(F_LIVELLO); // 1 <=> aliquota; 2 <=> attivita'
|
||||
@ -531,6 +533,7 @@ bool CG0400_application::set_print(int m)
|
||||
break;
|
||||
case stampa:
|
||||
{
|
||||
_codditta = msk.get_long(F_CODDITTA);
|
||||
_anno = msk.get_int(F_ANNO);
|
||||
_datast = msk.get(F_DATASTAMPA);
|
||||
_mese = msk.get_int(F_MESE);
|
||||
@ -538,7 +541,7 @@ bool CG0400_application::set_print(int m)
|
||||
|
||||
TLocalisamfile attiv(LF_ATTIV);
|
||||
attiv.zero();
|
||||
attiv.put(ATT_CODDITTA, get_firm());
|
||||
attiv.put(ATT_CODDITTA, _codditta);
|
||||
TRectype r(attiv.curr());
|
||||
//prospetto per ogni codice attivita' della ditta
|
||||
for(attiv.read(_isgteq); !attiv.eof(); attiv.next())
|
||||
@ -814,7 +817,7 @@ void CG0400_application::get_dati_ditta()
|
||||
TString tipoa;
|
||||
|
||||
nditte.zero();
|
||||
nditte.put(NDT_CODDITTA, get_firm());
|
||||
nditte.put(NDT_CODDITTA, _codditta);
|
||||
nditte.read();
|
||||
|
||||
if (nditte.bad()) nditte.zero();
|
||||
@ -859,13 +862,11 @@ void CG0400_application::get_dati_ditta()
|
||||
int CG0400_application::stampa_intestazione_ditta()
|
||||
{
|
||||
int r = 1;
|
||||
TString codice_ditta;
|
||||
TString riga(132);
|
||||
|
||||
get_dati_ditta();
|
||||
codice_ditta << get_firm();
|
||||
|
||||
set_header (r, "Ditta %s %s %s %s %s %s", (const char*)codice_ditta,
|
||||
set_header (r, "Ditta %ld %s %s %s %s %s", _codditta,
|
||||
(const char*)_ragsoc, (const char*)_viafis,
|
||||
(const char*)_cap, (const char*)_comunefis,
|
||||
(const char*)_provfis);
|
||||
@ -972,7 +973,7 @@ void CG0400_application::preprocess_header()
|
||||
|
||||
TLocalisamfile nditte(LF_NDITTE);
|
||||
nditte.zero();
|
||||
nditte.put(NDT_CODDITTA, get_firm());
|
||||
nditte.put(NDT_CODDITTA, _codditta);
|
||||
if (nditte.read() == NOERR)
|
||||
{
|
||||
ragsoc = nditte.get(NDT_RAGSOC);
|
||||
@ -985,14 +986,14 @@ void CG0400_application::preprocess_header()
|
||||
|
||||
reset_header();
|
||||
|
||||
char f = look_lia();
|
||||
char f = look_lia(_codditta);
|
||||
if (f == 'T')
|
||||
descf = " TRIMESTRALE";
|
||||
else if (f == 'M')
|
||||
descf = " MENSILE";
|
||||
else descf = "";
|
||||
|
||||
sep << "Ditta " << get_firm();
|
||||
sep << "Ditta " << _codditta;
|
||||
sep << " " << ragsoc;
|
||||
sep << " " << descf;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "cg0400.h"
|
||||
|
||||
PAGE "Visualizzazione progressivi IVA" -1 -1 78 19
|
||||
PAGE "Riepilogo progressivi IVA" -1 -1 78 19
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
@ -9,26 +9,32 @@ END
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 3 1 "Ditta "
|
||||
FLAGS "FRD"
|
||||
USE LF_NDITTE KEY 1
|
||||
CHECKTYPE REQUIRED
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Codice" CODDITTA
|
||||
DISPLAY "Ragione sociale @50" RAGSOC
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
OUTPUT F_ATTIVITA CODATTPREV
|
||||
PROMPT 2 1 "Ditta "
|
||||
FLAGS "ZFR"
|
||||
USE LF_NDITTE KEY 1
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Ditta" CODDITTA
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
OUTPUT F_CODDITTA CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
OUTPUT F_ATTIVITA CODATTPREV
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Ditta assente"
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 17 1 "Ragione "
|
||||
FLAGS "D"
|
||||
PROMPT 17 1 "Rag.Soc."
|
||||
USE LF_NDITTE KEY 2
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Codice" CODDITTA
|
||||
COPY OUTPUT F_CODDITTA
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 3 3 "Anno liquidazione "
|
||||
PROMPT 2 3 "Anno liquidazione "
|
||||
HELP "Anno di cui si effettua la liquidazione"
|
||||
FLAGS "A"
|
||||
VALIDATE FIXLEN_FUNC 4
|
||||
@ -37,7 +43,7 @@ END
|
||||
|
||||
RADIOBUTTON F_TIPO 18
|
||||
BEGIN
|
||||
PROMPT 3 5 "Tipo progressivi "
|
||||
PROMPT 2 5 "Tipo progressivi "
|
||||
HELP "Tipo di riepilogo da effettuare"
|
||||
ITEM "1|Vendite"
|
||||
MESSAGE HIDE,F_TIPOTABE|HIDE,F_TIPOTABEL|SHOW,F_TIPOTAB
|
||||
@ -50,7 +56,7 @@ END
|
||||
|
||||
RADIOBUTTON F_TIPO1 18
|
||||
BEGIN
|
||||
PROMPT 3 5 "Tipo progressivi "
|
||||
PROMPT 2 5 "Tipo progressivi "
|
||||
HELP "Tipo di riepilogo da effettuare"
|
||||
ITEM "1|Vendite"
|
||||
MESSAGE HIDE,F_TIPOTABE|HIDE,F_TIPOTABEL|HIDE,F_TIPOTAB
|
||||
@ -63,7 +69,7 @@ END
|
||||
|
||||
RADIOBUTTON F_LIVELLO 21
|
||||
BEGIN
|
||||
PROMPT 38 5 "Livello progressivi "
|
||||
PROMPT 37 5 "Livello progressivi "
|
||||
HELP "Tipo di raggruppamento dei riepiloghi"
|
||||
ITEM "1|Per aliquota"
|
||||
MESSAGE HIDE,F_ATTIVITA|SHOW,F_CODIVA|SHOW,F_TIPOTAB
|
||||
@ -75,7 +81,7 @@ END
|
||||
|
||||
STRING F_CODIVA 4
|
||||
BEGIN
|
||||
PROMPT 3 10 "Codice IVA "
|
||||
PROMPT 2 10 "Codice IVA "
|
||||
HELP "Aliquota IVA da riepilogare"
|
||||
FLAGS "U"
|
||||
USE %IVA
|
||||
@ -92,7 +98,7 @@ END
|
||||
|
||||
RADIOBUTTON F_TIPOTAB 38
|
||||
BEGIN
|
||||
PROMPT 3 12 "Tipo tabella "
|
||||
PROMPT 2 12 "Tipo tabella "
|
||||
HELP "Tipo di tabella da visualizzare"
|
||||
ITEM "1|Vendite in genere"
|
||||
ITEM "2|Vendite in sospensione d'imposta"
|
||||
@ -100,7 +106,7 @@ END
|
||||
|
||||
STRING F_ATTIVITA 5
|
||||
BEGIN
|
||||
PROMPT 3 10 "Codice attivita' "
|
||||
PROMPT 2 10 "Codice attivita' "
|
||||
HELP "Codice dell'attivita' di cui si vuole il riepilogo"
|
||||
USE LF_ATTIV
|
||||
JOIN %AIS TO LF_ATTIV INTO CODTAB=CODATT
|
||||
@ -115,7 +121,7 @@ END
|
||||
|
||||
NUMBER F_TIPOTABEL 1
|
||||
BEGIN
|
||||
PROMPT 3 12 "Tipo tabella "
|
||||
PROMPT 2 12 "Tipo tabella "
|
||||
HELP "Tipo di tabella da visualizzare"
|
||||
SHEET "Tipo|Descrizione@50"
|
||||
ITEM "1|Acquisti beni per rivendita"
|
||||
@ -129,7 +135,7 @@ END
|
||||
|
||||
NUMBER F_TIPOTABE 1
|
||||
BEGIN
|
||||
PROMPT 3 12 "Tipo tabella "
|
||||
PROMPT 2 12 "Tipo tabella "
|
||||
HELP "Tipo di tabella da visualizzare"
|
||||
SHEET "Tipo|Descrizione@50"
|
||||
ITEM "1|Acquisti in genere"
|
||||
|
@ -9,32 +9,38 @@ END
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 3 1 "Ditta "
|
||||
FLAGS "FRD"
|
||||
PROMPT 2 1 "Ditta "
|
||||
FLAGS "ZFR"
|
||||
USE LF_NDITTE KEY 1
|
||||
CHECKTYPE REQUIRED
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Codice" CODDITTA
|
||||
DISPLAY "Ragione sociale @50" RAGSOC
|
||||
DISPLAY "Ditta" CODDITTA
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
OUTPUT F_CODDITTA CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Ditta assente"
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 17 1 "Ragione "
|
||||
FLAGS "D"
|
||||
PROMPT 17 1 "Rag.Soc."
|
||||
USE LF_NDITTE KEY 2
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Codice" CODDITTA
|
||||
COPY OUTPUT F_CODDITTA
|
||||
END
|
||||
|
||||
DATE F_DATASTAMPA
|
||||
BEGIN
|
||||
PROMPT 3 4 "Data stampa "
|
||||
PROMPT 2 4 "Data stampa "
|
||||
HELP "Data in cui viene effettuata la stampa"
|
||||
FLAGS "A"
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 3 6 "Anno riepilogo "
|
||||
PROMPT 2 6 "Anno riepilogo "
|
||||
FLAGS "A"
|
||||
VALIDATE FIXLEN_FUNC 4
|
||||
CHECKTYPE REQUIRED
|
||||
@ -42,13 +48,13 @@ END
|
||||
|
||||
LISTBOX F_MESE 9
|
||||
BEGIN
|
||||
PROMPT 3 7 "Mese riepilogo "
|
||||
PROMPT 2 7 "Mese riepilogo "
|
||||
FLAGS "AM"
|
||||
END
|
||||
|
||||
BOOLEAN F_STAMPA
|
||||
BEGIN
|
||||
PROMPT 3 9 "Stampa progressivi da inizio anno "
|
||||
PROMPT 2 9 "Stampa progressivi da inizio anno "
|
||||
END
|
||||
|
||||
/*
|
||||
|
80
cg/cg4.cpp
80
cg/cg4.cpp
@ -1,40 +1,40 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
|
||||
#define __MAIN__
|
||||
#include "cg4.h"
|
||||
|
||||
const char* const usage = "Errore - uso : %s -{0|1|2|3|4|5}";
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
const int n = argc > 1 ? atoi(argv[1]+1) : -1;
|
||||
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
cg4100(argc,argv); break;
|
||||
case 1:
|
||||
cg4200(argc,argv); break;
|
||||
case 2:
|
||||
cg4300(argc,argv); break;
|
||||
case 3:
|
||||
cg4400(argc,argv); break;
|
||||
case 4:
|
||||
cg4500(argc,argv); break;
|
||||
case 5:
|
||||
cg4600(argc,argv); break;
|
||||
case 6:
|
||||
cg4700(argc,argv); break;
|
||||
case 7:
|
||||
cg4800(argc,argv); break;
|
||||
default:
|
||||
error_box(usage, argv[0]);
|
||||
}
|
||||
|
||||
return n < 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
|
||||
#define __MAIN__
|
||||
#include "cg4.h"
|
||||
|
||||
const char* const usage = "Errore - uso : %s -{0|1|2|3|4|5}";
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
const int n = argc > 1 ? atoi(argv[1]+1) : -1;
|
||||
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
cg4100(argc,argv); break;
|
||||
case 1:
|
||||
cg4200(argc,argv); break;
|
||||
case 2:
|
||||
cg4300(argc,argv); break;
|
||||
case 3:
|
||||
cg4400(argc,argv); break;
|
||||
case 4:
|
||||
cg4500(argc,argv); break;
|
||||
case 5:
|
||||
cg4600(argc,argv); break;
|
||||
case 6:
|
||||
cg4700(argc,argv); break;
|
||||
case 7:
|
||||
cg4800(argc,argv); break;
|
||||
default:
|
||||
error_box(usage, argv[0]);
|
||||
}
|
||||
|
||||
return n < 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
56
cg/cg4.h
56
cg/cg4.h
@ -1,28 +1,28 @@
|
||||
#ifndef __CG4_H
|
||||
#define __CG4_H
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
int cg4100(int argc, char* argv[]);
|
||||
int cg4200(int argc, char* argv[]);
|
||||
int cg4300(int argc, char* argv[]);
|
||||
int cg4400(int argc, char* argv[]);
|
||||
int cg4500(int argc, char* argv[]);
|
||||
int cg4600(int argc, char* argv[]);
|
||||
int cg4700(int argc, char* argv[]);
|
||||
int cg4800(int argc, char* argv[]);
|
||||
|
||||
#ifdef __MAIN__
|
||||
#define extern
|
||||
#endif
|
||||
|
||||
extern TString256 TMP;
|
||||
|
||||
#ifdef __MAIN__
|
||||
#undef extern
|
||||
#endif
|
||||
|
||||
#endif // __CG4_H
|
||||
|
||||
#ifndef __CG4_H
|
||||
#define __CG4_H
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
int cg4100(int argc, char* argv[]);
|
||||
int cg4200(int argc, char* argv[]);
|
||||
int cg4300(int argc, char* argv[]);
|
||||
int cg4400(int argc, char* argv[]);
|
||||
int cg4500(int argc, char* argv[]);
|
||||
int cg4600(int argc, char* argv[]);
|
||||
int cg4700(int argc, char* argv[]);
|
||||
int cg4800(int argc, char* argv[]);
|
||||
|
||||
#ifdef __MAIN__
|
||||
#define extern
|
||||
#endif
|
||||
|
||||
extern TString256 TMP;
|
||||
|
||||
#ifdef __MAIN__
|
||||
#undef extern
|
||||
#endif
|
||||
|
||||
#endif // __CG4_H
|
||||
|
||||
|
116
cg/cg4.url
116
cg/cg4.url
@ -1,59 +1,59 @@
|
||||
#include <default.url>
|
||||
|
||||
/* cg4 -0 Calcolo movimenti e saldi */
|
||||
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -1 Copia archivi piano conti, causali, clienti/fornitori iv direttiva */
|
||||
MENUBAR MENU_BAR(1)
|
||||
|
||||
MENU MENU_BAR(1)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -2 Calcolo liquidazione IVA */
|
||||
|
||||
MENUBAR MENU_BAR(2)
|
||||
|
||||
MENU MENU_BAR(2)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
/*
|
||||
ITEM BAR_ITEM(1) "~Liquidazione"
|
||||
ITEM BAR_ITEM(2) "~Deleghe"
|
||||
ITEM BAR_ITEM(3) "~Acconto"
|
||||
*/
|
||||
|
||||
/* cg4 -3 Stampa registri IVA */
|
||||
|
||||
MENUBAR MENU_BAR(3)
|
||||
|
||||
MENU MENU_BAR(3)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -4 Apertura nuovo esercizio/nuovo esercizio IVA */
|
||||
|
||||
MENUBAR MENU_BAR(4)
|
||||
|
||||
MENU MENU_BAR(4)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -5 Chiusura Apertura Conti */
|
||||
|
||||
MENUBAR MENU_BAR(5)
|
||||
|
||||
MENU MENU_BAR(5)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -6 Gestione acconti */
|
||||
|
||||
MENUBAR MENU_BAR(6)
|
||||
|
||||
MENU MENU_BAR(6)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -7 Creazione versam. acconti dicembre */
|
||||
|
||||
MENUBAR MENU_BAR(7)
|
||||
|
||||
MENU MENU_BAR(7)
|
||||
#include <default.url>
|
||||
|
||||
/* cg4 -0 Calcolo movimenti e saldi */
|
||||
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -1 Copia archivi piano conti, causali, clienti/fornitori iv direttiva */
|
||||
MENUBAR MENU_BAR(1)
|
||||
|
||||
MENU MENU_BAR(1)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -2 Calcolo liquidazione IVA */
|
||||
|
||||
MENUBAR MENU_BAR(2)
|
||||
|
||||
MENU MENU_BAR(2)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
/*
|
||||
ITEM BAR_ITEM(1) "~Liquidazione"
|
||||
ITEM BAR_ITEM(2) "~Deleghe"
|
||||
ITEM BAR_ITEM(3) "~Acconto"
|
||||
*/
|
||||
|
||||
/* cg4 -3 Stampa registri IVA */
|
||||
|
||||
MENUBAR MENU_BAR(3)
|
||||
|
||||
MENU MENU_BAR(3)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -4 Apertura nuovo esercizio/nuovo esercizio IVA */
|
||||
|
||||
MENUBAR MENU_BAR(4)
|
||||
|
||||
MENU MENU_BAR(4)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -5 Chiusura Apertura Conti */
|
||||
|
||||
MENUBAR MENU_BAR(5)
|
||||
|
||||
MENU MENU_BAR(5)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -6 Gestione acconti */
|
||||
|
||||
MENUBAR MENU_BAR(6)
|
||||
|
||||
MENU MENU_BAR(6)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
/* cg4 -7 Creazione versam. acconti dicembre */
|
||||
|
||||
MENUBAR MENU_BAR(7)
|
||||
|
||||
MENU MENU_BAR(7)
|
||||
SUBMENU MENU_FILE "~File"
|
1402
cg/cg4302.cpp
1402
cg/cg4302.cpp
File diff suppressed because it is too large
Load Diff
3976
cg/cg4304.cpp
3976
cg/cg4304.cpp
File diff suppressed because it is too large
Load Diff
940
cg/cg4305.cpp
940
cg/cg4305.cpp
@ -1,470 +1,470 @@
|
||||
// cg4306: liquidazione IVA
|
||||
// funzionalita' accessorie (calcolo acconto, estrazione deleghe)
|
||||
|
||||
#include <defmask.h>
|
||||
#include <progind.h>
|
||||
#include <prefix.h>
|
||||
#include <sheet.h>
|
||||
#include <utility.h>
|
||||
#include <config.h>
|
||||
|
||||
#include "cg4300.h"
|
||||
#include "cg4300b.h"
|
||||
#include "cg4300c.h"
|
||||
|
||||
// -------------------------------------------------- estrazione deleghe
|
||||
bool TLiquidazione_app::set_deleghe()
|
||||
{
|
||||
TMask m("cg4300b.msk");
|
||||
|
||||
m.field(FLD_CGB_YEAR).set(_year);
|
||||
m.field(FLD_CGB_YEAR).set_handler(ch_year_handler);
|
||||
m.field(CHK_CGB_PRINT).set(_isprint ? "X" : "");
|
||||
|
||||
int k = 0;
|
||||
long j;
|
||||
_calcall = FALSE;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (k == K_ESC || k == K_ENTER)
|
||||
break;
|
||||
|
||||
k = m.run();
|
||||
|
||||
_isprint = m.get_bool(CHK_CGB_PRINT);
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case DLG_SELECT:
|
||||
|
||||
_ditte->run();
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j)) _selected.set(j);
|
||||
break;
|
||||
|
||||
case BUT_CGB_ALL:
|
||||
|
||||
_ditte->check(-1);
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j) && !_ditte->disabled(j))
|
||||
_selected.set(j);
|
||||
_calcall = TRUE;
|
||||
k = K_ENTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
_year = m.get(FLD_CGB_YEAR);
|
||||
_month = atoi(m.get(FLD_CGB_MONTH));
|
||||
}
|
||||
|
||||
return k == K_ENTER;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::extract_deleghe()
|
||||
{
|
||||
char buf[256]; TArray desc;
|
||||
_prind = new TProgind(_calcall ? _n_ditte : _selected.ones(),
|
||||
" Estrazione deleghe \n"
|
||||
" preparazione archivi \n "
|
||||
" \n ",
|
||||
TRUE,TRUE,40);
|
||||
|
||||
for (int l = 0; l < _ditte->items(); l++)
|
||||
{
|
||||
if (_prind->iscancelled())
|
||||
break;
|
||||
|
||||
if (!(_calcall || _selected[l]) || _ditte->disabled(l))
|
||||
continue;
|
||||
|
||||
TApplication::set_firm(atol(_ditte->row(l).get(1)));
|
||||
|
||||
_nditte->curr().zero();
|
||||
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
||||
_nditte->read();
|
||||
|
||||
// must succeed
|
||||
look_lia();
|
||||
_freqviva = _lia->get("S7");
|
||||
|
||||
sprintf (buf,"Estrazione deleghe (%d):\nditta %s\n ",
|
||||
_month,
|
||||
(const char*)_nditte_r->get("RAGSOC"));
|
||||
_prind->set_text(buf);
|
||||
|
||||
|
||||
if (is_month_ok_strict(_month) || _month == 13)
|
||||
{
|
||||
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4");
|
||||
bool mens = _freqviva == "M";
|
||||
_isannual = (_month == 12 && !mens && !_isbenzinaro) ||
|
||||
(_month == 13 && (mens || _isbenzinaro));
|
||||
_isriepilogo = _month == 13;
|
||||
_isendliq = _isannual || _isriepilogo;
|
||||
|
||||
extract_delega(_month, desc);
|
||||
}
|
||||
_prind->addstatus(1);
|
||||
}
|
||||
|
||||
TApplication::set_firm(__firm);
|
||||
delete _prind;
|
||||
|
||||
if (_isprint)
|
||||
{
|
||||
_DescrItem* ddeb = NULL;
|
||||
_DescrItem* dcrd = NULL;
|
||||
|
||||
// scorri desc e prepara descritems
|
||||
for (int i = 0; i < desc.items(); i++)
|
||||
{
|
||||
TToken_string& tt = (TToken_string&)desc[i];
|
||||
|
||||
real tp(tt.get(3));
|
||||
if (tp.sign() > 0)
|
||||
{
|
||||
if (ddeb == NULL)
|
||||
{
|
||||
ddeb = new _DescrItem(DELDEB);
|
||||
ddeb->_f0 = _month;
|
||||
}
|
||||
ddeb->_arr.add(tt);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dcrd == NULL)
|
||||
{
|
||||
dcrd = new _DescrItem(DELCRED);
|
||||
dcrd->_f0 = _month;
|
||||
}
|
||||
dcrd->_arr.add(tt);
|
||||
}
|
||||
}
|
||||
if (dcrd != NULL) _descr_arr.add(dcrd);
|
||||
if (ddeb != NULL) _descr_arr.add(ddeb);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::extract_delega(int month, TArray& desc)
|
||||
{
|
||||
TToken_string* tt = NULL;
|
||||
|
||||
if (look_lim(month))
|
||||
{
|
||||
real topay = result_liq(month); // TBC non si puo' fa' accussi'!!!!! pena il casino!
|
||||
real intr = _lim->get_real("R14");
|
||||
topay += intr; // lo vogliono registrato con interessi
|
||||
real nrnd = topay;
|
||||
topay.round(-3);
|
||||
|
||||
if (!topay.is_zero())
|
||||
{
|
||||
tt = new TToken_string(80);
|
||||
tt->add(_nditte->curr().get("CODDITTA"));
|
||||
tt->add(_nditte->curr().get("RAGSOC"));
|
||||
tt->add(_freqviva);
|
||||
tt->add(topay.string());
|
||||
tt->add("");
|
||||
// tt->add(intr.string());
|
||||
}
|
||||
|
||||
if (topay.sign() > 0)
|
||||
{
|
||||
look_del(month, _isannual ? 2 : 1, TRUE);
|
||||
_del->put("R0",topay);
|
||||
_del->put("R1",intr);
|
||||
_del->put("R2",nrnd); // non arrotondato, per calcolo risultato a debito/cr
|
||||
_del->rewrite();
|
||||
|
||||
tt->add(_del->get("S7"));
|
||||
tt->add(_del->get("S8"));
|
||||
tt->add(_del->get("S9"));
|
||||
tt->add(_nditte->curr().get("PTEL"));
|
||||
tt->add(_nditte->curr().get("TEL"));
|
||||
}
|
||||
}
|
||||
|
||||
if (tt != NULL)
|
||||
desc.add(tt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// -------------------------------------------- calcolo acconto dicembre
|
||||
bool TLiquidazione_app::set_acconto(real& inf, real& ina)
|
||||
{
|
||||
TMask m("cg4300c.msk");
|
||||
m.set(CHK_CGC_PRINT,"X");
|
||||
m.field(FLD_CGC_YEAR).set_handler(ch_year_handler);
|
||||
int k = 0; long j;
|
||||
|
||||
_calcall = FALSE;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (k == K_ESC || k == K_ENTER)
|
||||
break;
|
||||
k = m.run();
|
||||
|
||||
_year = m.get(FLD_CGC_YEAR);
|
||||
_isprint = m.get_bool(CHK_CGC_PRINT);
|
||||
_isbase = m.get_bool(CHK_CGC_BASE);
|
||||
_basecalc = (tbc)m.get_long(RDB_CGC_BASE);
|
||||
|
||||
//inf = real(m.get(FLD_CGC_INF));
|
||||
//ina = real(m.get(FLD_CGC_INA));
|
||||
|
||||
inf = ina = ZERO;
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case DLG_SELECT:
|
||||
|
||||
// scegli ditte
|
||||
_ditte->run();
|
||||
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j)) _selected.set(j);
|
||||
|
||||
break;
|
||||
case BUT_CGC_ALL:
|
||||
_ditte->check(-1);
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j) && !_ditte->disabled(j))
|
||||
_selected.set(j);
|
||||
_calcall = TRUE;
|
||||
k = K_ENTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return k == K_ENTER;
|
||||
}
|
||||
|
||||
|
||||
bool TLiquidazione_app::recalc_acconti(real& inf, real& ina)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
bool onemade = FALSE;
|
||||
|
||||
long firm = TApplication::get_firm();
|
||||
_prind = new TProgind(_n_ditte,
|
||||
" Calcolo acconto "
|
||||
"\n Preparazione archivi "
|
||||
"\n ",
|
||||
TRUE,TRUE,40);
|
||||
|
||||
for (int l = 0; l < _ditte->items(); l++)
|
||||
{
|
||||
if (_prind->iscancelled())
|
||||
break;
|
||||
if ((_calcall || _selected[l]) && !_ditte->disabled(l))
|
||||
{
|
||||
if (onemade == FALSE && _isprint)
|
||||
{
|
||||
_DescrItem* d = new _DescrItem(ACCHEAD);
|
||||
d->_f0 = _basecalc == incorso;
|
||||
d->_f1 = _isbase;
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
|
||||
_nditte->curr().zero();
|
||||
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
||||
_nditte->read();
|
||||
|
||||
TApplication::set_firm(_nditte->curr().get_long("CODDITTA"));
|
||||
sprintf (buf,"Calcolo acconto:\nditta %s",
|
||||
(const char*)_nditte_r->get("RAGSOC"));
|
||||
_prind->set_text(buf);
|
||||
recalc_acconto(inf, ina);
|
||||
onemade = TRUE;
|
||||
}
|
||||
_prind->addstatus(1);
|
||||
}
|
||||
|
||||
TApplication::set_firm(firm);
|
||||
delete _prind;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
|
||||
{
|
||||
real bc, acc, cre, deb;
|
||||
bool isdifferita = FALSE;
|
||||
bool error = FALSE;
|
||||
|
||||
// TBI rewrite from scratch
|
||||
// this is absolutely fundamental
|
||||
if (_basecalc == precedente)
|
||||
{
|
||||
// determina casistica
|
||||
enum { mm, tt, mt, tm, boh } history = boh;
|
||||
char thh = *_freqviva;
|
||||
|
||||
TString16 thyear = _year;
|
||||
_year = format("%d", atoi(_year)-1);
|
||||
|
||||
if (!look_lia())
|
||||
error = 3;
|
||||
else
|
||||
{
|
||||
char ohh = _lia->get_char("S7");
|
||||
|
||||
if (ohh == 'M') history = thh == 'M' ? mm : mt;
|
||||
if (ohh == 'T') history = thh == 'M' ? tm : tt;
|
||||
if (history == boh) return FALSE;
|
||||
|
||||
// casino benzinari
|
||||
TString attprev = _nditte->curr().get("CODATTPREV");
|
||||
long codd = _nditte->curr().get_long("CODDITTA");
|
||||
TLocalisamfile& atts = _nditte->lfile(LF_ATTIV);
|
||||
atts.zero();
|
||||
atts.put("CODDITTA", codd);
|
||||
atts.put("CODATT", attprev);
|
||||
if (atts.read() != NOERR) atts.zero();
|
||||
if (atts.get_bool("ART74/4")) // e' proprio un gran benzinaro
|
||||
{
|
||||
TConfig cnf(CONFIG_DITTA, "cg");
|
||||
history = cnf.get_bool("GesT74") ? mm : tt;
|
||||
}
|
||||
|
||||
switch (history)
|
||||
{
|
||||
case mm:
|
||||
// base calcolo: 12a anno preced, Rideterminare a seconda dell'acconto
|
||||
// versato; ris = 88% del debito (0 se credito)
|
||||
if (!look_lim(12)) error = 2;
|
||||
else
|
||||
{
|
||||
bc += _lim->get_real("R0");
|
||||
real av = _lim->get_real("R11");
|
||||
bc += av;
|
||||
}
|
||||
break;
|
||||
case tt:
|
||||
case tm:
|
||||
// base calcolo: 13a anno precedente. Rideterm. per eventuale acconto
|
||||
if (!look_lim(12)) error = 2; // TBC sara' 13a davvero? Secondo me e' 12
|
||||
else
|
||||
{
|
||||
bc += _lim->get_real("R0");
|
||||
real av = _lim->get_real("R11");
|
||||
bc += av;
|
||||
}
|
||||
if (_basecalc == tm)
|
||||
// tm come tt ma si divide per 3 la base di calcolo prima di calcolare l'88%
|
||||
bc /= real(3.0);
|
||||
break;
|
||||
case mt:
|
||||
// basecalcolo: 10, 11, 12 anno prec., 10 e 11 se a debito, 12 vedi acconto;
|
||||
// sommare e prendi 88% se a debito
|
||||
if (!look_lim(10)) error = 2;
|
||||
else
|
||||
{
|
||||
real app = _lim->get_real("R0");
|
||||
if (app.sign() > 0) //a debito
|
||||
bc += app;
|
||||
}
|
||||
if (!look_lim(11)) error = 2;
|
||||
else
|
||||
{
|
||||
real app = _lim->get_real("R0");
|
||||
if (app.sign() > 0) //a debito
|
||||
bc += app;
|
||||
}
|
||||
if (!look_lim(12)) error = 2;
|
||||
else
|
||||
{
|
||||
bc += _lim->get_real("R0");
|
||||
real av = _lim->get_real("R11");
|
||||
bc += av;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (bc.sign() > 0) //debito
|
||||
{
|
||||
acc = bc * ACCONTO_DICEMBRE;
|
||||
acc.round(ROUND_LIRA);
|
||||
}
|
||||
}
|
||||
_year = thyear;
|
||||
}
|
||||
else if (_basecalc == incorso)
|
||||
{
|
||||
// that's pazzesc but as it turns out there's no better way
|
||||
_comp_acconto = TRUE;
|
||||
// force recalc of current month
|
||||
_recalc = one;
|
||||
// insozza il water
|
||||
update_firm(12);
|
||||
|
||||
// calcola l'acconto
|
||||
if (look_lim(12))
|
||||
{
|
||||
// TBC trimestrali, differite
|
||||
bc = result_liq(12);
|
||||
// somma i non fatturati/non annotati
|
||||
//bc += inf + ina;
|
||||
cre = _lim->get_real("R12");
|
||||
deb = _lim->get_real("R13");
|
||||
if (bc.sign() > 0) acc = bc;
|
||||
}
|
||||
else error = 1;
|
||||
|
||||
// pulisci il water
|
||||
_comp_acconto = FALSE;
|
||||
update_firm(12);
|
||||
}
|
||||
|
||||
// sbatti l'acconto in LIA
|
||||
if (look_lia())
|
||||
{
|
||||
isdifferita = _lia->get_bool("B1");
|
||||
if (isdifferita && _basecalc == incorso) acc *= real(double(2/3));
|
||||
_lia->put("R4",acc);
|
||||
_lia->rewrite();
|
||||
}
|
||||
|
||||
bool wasdel = look_del(12,7);
|
||||
|
||||
if (acc.sign() > 0 && acc >= ACCONTO_MINIMO_DA_VERSARE)
|
||||
{
|
||||
// crea o aggiorna delega
|
||||
// TBC everything
|
||||
look_del(12,7,TRUE);
|
||||
_del->put("R0", acc);
|
||||
_del->rewrite();
|
||||
}
|
||||
else if (wasdel)
|
||||
_del->remove();
|
||||
|
||||
// per questa volta lasciamo perdere la describe_acconto
|
||||
if (_isprint)
|
||||
{
|
||||
// segnalazioni di errore da gesticolare:
|
||||
// error = 0: no error
|
||||
// error = 1: manca tabella risultati liquidazione per l'anno indicato
|
||||
// error = 2: manca tabella risultati liquidazione per l'anno precedente
|
||||
// error = 3: manca tabella dichiarazione annuale per l'anno precedente
|
||||
_DescrItem* d = new _DescrItem(ACCONTO);
|
||||
d->_r0 = bc;
|
||||
d->_r1 = acc;
|
||||
d->_r2 = cre;
|
||||
d->_r3 = deb;
|
||||
d->_f0 = _basecalc == incorso;
|
||||
d->_f1 = _isbase;
|
||||
d->_f2 = error;
|
||||
d->_f3 = isdifferita;
|
||||
d->_s0 = _nditte->curr().get("CODDITTA");
|
||||
d->_s1 = _nditte->curr().get("RAGSOC");
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
// cg4306: liquidazione IVA
|
||||
// funzionalita' accessorie (calcolo acconto, estrazione deleghe)
|
||||
|
||||
#include <defmask.h>
|
||||
#include <progind.h>
|
||||
#include <prefix.h>
|
||||
#include <sheet.h>
|
||||
#include <utility.h>
|
||||
#include <config.h>
|
||||
|
||||
#include "cg4300.h"
|
||||
#include "cg4300b.h"
|
||||
#include "cg4300c.h"
|
||||
|
||||
// -------------------------------------------------- estrazione deleghe
|
||||
bool TLiquidazione_app::set_deleghe()
|
||||
{
|
||||
TMask m("cg4300b.msk");
|
||||
|
||||
m.field(FLD_CGB_YEAR).set(_year);
|
||||
m.field(FLD_CGB_YEAR).set_handler(ch_year_handler);
|
||||
m.field(CHK_CGB_PRINT).set(_isprint ? "X" : "");
|
||||
|
||||
int k = 0;
|
||||
long j;
|
||||
_calcall = FALSE;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (k == K_ESC || k == K_ENTER)
|
||||
break;
|
||||
|
||||
k = m.run();
|
||||
|
||||
_isprint = m.get_bool(CHK_CGB_PRINT);
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case DLG_SELECT:
|
||||
|
||||
_ditte->run();
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j)) _selected.set(j);
|
||||
break;
|
||||
|
||||
case BUT_CGB_ALL:
|
||||
|
||||
_ditte->check(-1);
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j) && !_ditte->disabled(j))
|
||||
_selected.set(j);
|
||||
_calcall = TRUE;
|
||||
k = K_ENTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
_year = m.get(FLD_CGB_YEAR);
|
||||
_month = atoi(m.get(FLD_CGB_MONTH));
|
||||
}
|
||||
|
||||
return k == K_ENTER;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::extract_deleghe()
|
||||
{
|
||||
char buf[256]; TArray desc;
|
||||
_prind = new TProgind(_calcall ? _n_ditte : _selected.ones(),
|
||||
" Estrazione deleghe \n"
|
||||
" preparazione archivi \n "
|
||||
" \n ",
|
||||
TRUE,TRUE,40);
|
||||
|
||||
for (int l = 0; l < _ditte->items(); l++)
|
||||
{
|
||||
if (_prind->iscancelled())
|
||||
break;
|
||||
|
||||
if (!(_calcall || _selected[l]) || _ditte->disabled(l))
|
||||
continue;
|
||||
|
||||
TApplication::set_firm(atol(_ditte->row(l).get(1)));
|
||||
|
||||
_nditte->curr().zero();
|
||||
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
||||
_nditte->read();
|
||||
|
||||
// must succeed
|
||||
look_lia();
|
||||
_freqviva = _lia->get("S7");
|
||||
|
||||
sprintf (buf,"Estrazione deleghe (%d):\nditta %s\n ",
|
||||
_month,
|
||||
(const char*)_nditte_r->get("RAGSOC"));
|
||||
_prind->set_text(buf);
|
||||
|
||||
|
||||
if (is_month_ok_strict(_month) || _month == 13)
|
||||
{
|
||||
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4");
|
||||
bool mens = _freqviva == "M";
|
||||
_isannual = (_month == 12 && !mens && !_isbenzinaro) ||
|
||||
(_month == 13 && (mens || _isbenzinaro));
|
||||
_isriepilogo = _month == 13;
|
||||
_isendliq = _isannual || _isriepilogo;
|
||||
|
||||
extract_delega(_month, desc);
|
||||
}
|
||||
_prind->addstatus(1);
|
||||
}
|
||||
|
||||
TApplication::set_firm(__firm);
|
||||
delete _prind;
|
||||
|
||||
if (_isprint)
|
||||
{
|
||||
_DescrItem* ddeb = NULL;
|
||||
_DescrItem* dcrd = NULL;
|
||||
|
||||
// scorri desc e prepara descritems
|
||||
for (int i = 0; i < desc.items(); i++)
|
||||
{
|
||||
TToken_string& tt = (TToken_string&)desc[i];
|
||||
|
||||
real tp(tt.get(3));
|
||||
if (tp.sign() > 0)
|
||||
{
|
||||
if (ddeb == NULL)
|
||||
{
|
||||
ddeb = new _DescrItem(DELDEB);
|
||||
ddeb->_f0 = _month;
|
||||
}
|
||||
ddeb->_arr.add(tt);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dcrd == NULL)
|
||||
{
|
||||
dcrd = new _DescrItem(DELCRED);
|
||||
dcrd->_f0 = _month;
|
||||
}
|
||||
dcrd->_arr.add(tt);
|
||||
}
|
||||
}
|
||||
if (dcrd != NULL) _descr_arr.add(dcrd);
|
||||
if (ddeb != NULL) _descr_arr.add(ddeb);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::extract_delega(int month, TArray& desc)
|
||||
{
|
||||
TToken_string* tt = NULL;
|
||||
|
||||
if (look_lim(month))
|
||||
{
|
||||
real topay = result_liq(month); // TBC non si puo' fa' accussi'!!!!! pena il casino!
|
||||
real intr = _lim->get_real("R14");
|
||||
topay += intr; // lo vogliono registrato con interessi
|
||||
real nrnd = topay;
|
||||
topay.round(-3);
|
||||
|
||||
if (!topay.is_zero())
|
||||
{
|
||||
tt = new TToken_string(80);
|
||||
tt->add(_nditte->curr().get("CODDITTA"));
|
||||
tt->add(_nditte->curr().get("RAGSOC"));
|
||||
tt->add(_freqviva);
|
||||
tt->add(topay.string());
|
||||
tt->add("");
|
||||
// tt->add(intr.string());
|
||||
}
|
||||
|
||||
if (topay.sign() > 0)
|
||||
{
|
||||
look_del(month, _isannual ? 2 : 1, TRUE);
|
||||
_del->put("R0",topay);
|
||||
_del->put("R1",intr);
|
||||
_del->put("R2",nrnd); // non arrotondato, per calcolo risultato a debito/cr
|
||||
_del->rewrite();
|
||||
|
||||
tt->add(_del->get("S7"));
|
||||
tt->add(_del->get("S8"));
|
||||
tt->add(_del->get("S9"));
|
||||
tt->add(_nditte->curr().get("PTEL"));
|
||||
tt->add(_nditte->curr().get("TEL"));
|
||||
}
|
||||
}
|
||||
|
||||
if (tt != NULL)
|
||||
desc.add(tt);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// -------------------------------------------- calcolo acconto dicembre
|
||||
bool TLiquidazione_app::set_acconto(real& inf, real& ina)
|
||||
{
|
||||
TMask m("cg4300c.msk");
|
||||
m.set(CHK_CGC_PRINT,"X");
|
||||
m.field(FLD_CGC_YEAR).set_handler(ch_year_handler);
|
||||
int k = 0; long j;
|
||||
|
||||
_calcall = FALSE;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (k == K_ESC || k == K_ENTER)
|
||||
break;
|
||||
k = m.run();
|
||||
|
||||
_year = m.get(FLD_CGC_YEAR);
|
||||
_isprint = m.get_bool(CHK_CGC_PRINT);
|
||||
_isbase = m.get_bool(CHK_CGC_BASE);
|
||||
_basecalc = (tbc)m.get_long(RDB_CGC_BASE);
|
||||
|
||||
//inf = real(m.get(FLD_CGC_INF));
|
||||
//ina = real(m.get(FLD_CGC_INA));
|
||||
|
||||
inf = ina = ZERO;
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case DLG_SELECT:
|
||||
|
||||
// scegli ditte
|
||||
_ditte->run();
|
||||
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j)) _selected.set(j);
|
||||
|
||||
break;
|
||||
case BUT_CGC_ALL:
|
||||
_ditte->check(-1);
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j) && !_ditte->disabled(j))
|
||||
_selected.set(j);
|
||||
_calcall = TRUE;
|
||||
k = K_ENTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return k == K_ENTER;
|
||||
}
|
||||
|
||||
|
||||
bool TLiquidazione_app::recalc_acconti(real& inf, real& ina)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
bool onemade = FALSE;
|
||||
|
||||
long firm = TApplication::get_firm();
|
||||
_prind = new TProgind(_n_ditte,
|
||||
" Calcolo acconto "
|
||||
"\n Preparazione archivi "
|
||||
"\n ",
|
||||
TRUE,TRUE,40);
|
||||
|
||||
for (int l = 0; l < _ditte->items(); l++)
|
||||
{
|
||||
if (_prind->iscancelled())
|
||||
break;
|
||||
if ((_calcall || _selected[l]) && !_ditte->disabled(l))
|
||||
{
|
||||
if (onemade == FALSE && _isprint)
|
||||
{
|
||||
_DescrItem* d = new _DescrItem(ACCHEAD);
|
||||
d->_f0 = _basecalc == incorso;
|
||||
d->_f1 = _isbase;
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
|
||||
_nditte->curr().zero();
|
||||
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
||||
_nditte->read();
|
||||
|
||||
TApplication::set_firm(_nditte->curr().get_long("CODDITTA"));
|
||||
sprintf (buf,"Calcolo acconto:\nditta %s",
|
||||
(const char*)_nditte_r->get("RAGSOC"));
|
||||
_prind->set_text(buf);
|
||||
recalc_acconto(inf, ina);
|
||||
onemade = TRUE;
|
||||
}
|
||||
_prind->addstatus(1);
|
||||
}
|
||||
|
||||
TApplication::set_firm(firm);
|
||||
delete _prind;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
|
||||
{
|
||||
real bc, acc, cre, deb;
|
||||
bool isdifferita = FALSE;
|
||||
bool error = FALSE;
|
||||
|
||||
// TBI rewrite from scratch
|
||||
// this is absolutely fundamental
|
||||
if (_basecalc == precedente)
|
||||
{
|
||||
// determina casistica
|
||||
enum { mm, tt, mt, tm, boh } history = boh;
|
||||
char thh = *_freqviva;
|
||||
|
||||
TString16 thyear = _year;
|
||||
_year = format("%d", atoi(_year)-1);
|
||||
|
||||
if (!look_lia())
|
||||
error = 3;
|
||||
else
|
||||
{
|
||||
char ohh = _lia->get_char("S7");
|
||||
|
||||
if (ohh == 'M') history = thh == 'M' ? mm : mt;
|
||||
if (ohh == 'T') history = thh == 'M' ? tm : tt;
|
||||
if (history == boh) return FALSE;
|
||||
|
||||
// casino benzinari
|
||||
TString attprev = _nditte->curr().get("CODATTPREV");
|
||||
long codd = _nditte->curr().get_long("CODDITTA");
|
||||
TLocalisamfile& atts = _nditte->lfile(LF_ATTIV);
|
||||
atts.zero();
|
||||
atts.put("CODDITTA", codd);
|
||||
atts.put("CODATT", attprev);
|
||||
if (atts.read() != NOERR) atts.zero();
|
||||
if (atts.get_bool("ART74/4")) // e' proprio un gran benzinaro
|
||||
{
|
||||
TConfig cnf(CONFIG_DITTA, "cg");
|
||||
history = cnf.get_bool("GesT74") ? mm : tt;
|
||||
}
|
||||
|
||||
switch (history)
|
||||
{
|
||||
case mm:
|
||||
// base calcolo: 12a anno preced, Rideterminare a seconda dell'acconto
|
||||
// versato; ris = 88% del debito (0 se credito)
|
||||
if (!look_lim(12)) error = 2;
|
||||
else
|
||||
{
|
||||
bc += _lim->get_real("R0");
|
||||
real av = _lim->get_real("R11");
|
||||
bc += av;
|
||||
}
|
||||
break;
|
||||
case tt:
|
||||
case tm:
|
||||
// base calcolo: 13a anno precedente. Rideterm. per eventuale acconto
|
||||
if (!look_lim(12)) error = 2; // TBC sara' 13a davvero? Secondo me e' 12
|
||||
else
|
||||
{
|
||||
bc += _lim->get_real("R0");
|
||||
real av = _lim->get_real("R11");
|
||||
bc += av;
|
||||
}
|
||||
if (_basecalc == tm)
|
||||
// tm come tt ma si divide per 3 la base di calcolo prima di calcolare l'88%
|
||||
bc /= real(3.0);
|
||||
break;
|
||||
case mt:
|
||||
// basecalcolo: 10, 11, 12 anno prec., 10 e 11 se a debito, 12 vedi acconto;
|
||||
// sommare e prendi 88% se a debito
|
||||
if (!look_lim(10)) error = 2;
|
||||
else
|
||||
{
|
||||
real app = _lim->get_real("R0");
|
||||
if (app.sign() > 0) //a debito
|
||||
bc += app;
|
||||
}
|
||||
if (!look_lim(11)) error = 2;
|
||||
else
|
||||
{
|
||||
real app = _lim->get_real("R0");
|
||||
if (app.sign() > 0) //a debito
|
||||
bc += app;
|
||||
}
|
||||
if (!look_lim(12)) error = 2;
|
||||
else
|
||||
{
|
||||
bc += _lim->get_real("R0");
|
||||
real av = _lim->get_real("R11");
|
||||
bc += av;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (bc.sign() > 0) //debito
|
||||
{
|
||||
acc = bc * ACCONTO_DICEMBRE;
|
||||
acc.round(ROUND_LIRA);
|
||||
}
|
||||
}
|
||||
_year = thyear;
|
||||
}
|
||||
else if (_basecalc == incorso)
|
||||
{
|
||||
// that's pazzesc but as it turns out there's no better way
|
||||
_comp_acconto = TRUE;
|
||||
// force recalc of current month
|
||||
_recalc = one;
|
||||
// insozza il water
|
||||
update_firm(12);
|
||||
|
||||
// calcola l'acconto
|
||||
if (look_lim(12))
|
||||
{
|
||||
// TBC trimestrali, differite
|
||||
bc = result_liq(12);
|
||||
// somma i non fatturati/non annotati
|
||||
//bc += inf + ina;
|
||||
cre = _lim->get_real("R12");
|
||||
deb = _lim->get_real("R13");
|
||||
if (bc.sign() > 0) acc = bc;
|
||||
}
|
||||
else error = 1;
|
||||
|
||||
// pulisci il water
|
||||
_comp_acconto = FALSE;
|
||||
update_firm(12);
|
||||
}
|
||||
|
||||
// sbatti l'acconto in LIA
|
||||
if (look_lia())
|
||||
{
|
||||
isdifferita = _lia->get_bool("B1");
|
||||
if (isdifferita && _basecalc == incorso) acc *= real(double(2/3));
|
||||
_lia->put("R4",acc);
|
||||
_lia->rewrite();
|
||||
}
|
||||
|
||||
bool wasdel = look_del(12,7);
|
||||
|
||||
if (acc.sign() > 0 && acc >= ACCONTO_MINIMO_DA_VERSARE)
|
||||
{
|
||||
// crea o aggiorna delega
|
||||
// TBC everything
|
||||
look_del(12,7,TRUE);
|
||||
_del->put("R0", acc);
|
||||
_del->rewrite();
|
||||
}
|
||||
else if (wasdel)
|
||||
_del->remove();
|
||||
|
||||
// per questa volta lasciamo perdere la describe_acconto
|
||||
if (_isprint)
|
||||
{
|
||||
// segnalazioni di errore da gesticolare:
|
||||
// error = 0: no error
|
||||
// error = 1: manca tabella risultati liquidazione per l'anno indicato
|
||||
// error = 2: manca tabella risultati liquidazione per l'anno precedente
|
||||
// error = 3: manca tabella dichiarazione annuale per l'anno precedente
|
||||
_DescrItem* d = new _DescrItem(ACCONTO);
|
||||
d->_r0 = bc;
|
||||
d->_r1 = acc;
|
||||
d->_r2 = cre;
|
||||
d->_r3 = deb;
|
||||
d->_f0 = _basecalc == incorso;
|
||||
d->_f1 = _isbase;
|
||||
d->_f2 = error;
|
||||
d->_f3 = isdifferita;
|
||||
d->_s0 = _nditte->curr().get("CODDITTA");
|
||||
d->_s1 = _nditte->curr().get("RAGSOC");
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class GesAcc_app : public TRelation_application
|
||||
virtual TRelation* get_relation() const { return _rel; }
|
||||
virtual TMask* get_mask(int mode);
|
||||
virtual bool changing_mask(int mode) {return FALSE; }
|
||||
virtual int rewrite(const TMask&);
|
||||
//virtual int rewrite(const TMask&);
|
||||
//virtual void init_query_mode (TMask&);
|
||||
//virtual void init_query_insert_mode (TMask&);
|
||||
};
|
||||
@ -85,7 +85,7 @@ bool GesAcc_app::msk_acconto(TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*** Deve farlo il programma di stampa versamenti!
|
||||
int GesAcc_app::rewrite(const TMask& m)
|
||||
{
|
||||
TString16 chiave;
|
||||
@ -108,6 +108,7 @@ int GesAcc_app::rewrite(const TMask& m)
|
||||
m.autosave(_rel);
|
||||
return _rel->rewrite();
|
||||
}
|
||||
***/
|
||||
|
||||
TMask* GesAcc_app::get_mask(int mode)
|
||||
{
|
||||
|
@ -25,15 +25,16 @@ BEGIN
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
BEGIN
|
||||
PROMPT 16 1 "Rag.Soc "
|
||||
KEY 1
|
||||
USE LF_NDITTE KEY 2
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Ditta" CODDITTA
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
OUTPUT F_CODDITTA CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
DISPLAY "Ditta" CODDITTA
|
||||
COPY OUTPUT F_CODDITTA
|
||||
WARNING "Ditta assente"
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user