Modificati programmi iva
git-svn-id: svn://10.65.10.50/trunk@1782 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3f2dcd785c
commit
73af6258b3
2924
cg/cg1100.cpp
2924
cg/cg1100.cpp
File diff suppressed because it is too large
Load Diff
76
cg/cg4.cpp
76
cg/cg4.cpp
@ -1,36 +1,40 @@
|
|||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
#include <checks.h>
|
#include <checks.h>
|
||||||
|
|
||||||
#define __MAIN__
|
#define __MAIN__
|
||||||
#include "cg4.h"
|
#include "cg4.h"
|
||||||
|
|
||||||
const char* const usage = "Errore - uso : %s -{0|1|2|3|4|5}";
|
const char* const usage = "Errore - uso : %s -{0|1|2|3|4|5}";
|
||||||
|
|
||||||
int main(int argc,char** argv)
|
int main(int argc,char** argv)
|
||||||
{
|
{
|
||||||
const int n = argc > 1 ? atoi(argv[1]+1) : -1;
|
const int n = argc > 1 ? atoi(argv[1]+1) : -1;
|
||||||
|
|
||||||
switch (n)
|
switch (n)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
cg4100(argc,argv); break;
|
cg4100(argc,argv); break;
|
||||||
case 1:
|
case 1:
|
||||||
cg4200(argc,argv); break;
|
cg4200(argc,argv); break;
|
||||||
case 2:
|
case 2:
|
||||||
cg4300(argc,argv); break;
|
cg4300(argc,argv); break;
|
||||||
case 3:
|
case 3:
|
||||||
cg4400(argc,argv); break;
|
cg4400(argc,argv); break;
|
||||||
case 4:
|
case 4:
|
||||||
cg4500(argc,argv); break;
|
cg4500(argc,argv); break;
|
||||||
case 5:
|
case 5:
|
||||||
cg4600(argc,argv); break;
|
cg4600(argc,argv); break;
|
||||||
default:
|
case 6:
|
||||||
error_box(usage, argv[0]);
|
cg4700(argc,argv); break;
|
||||||
}
|
case 7:
|
||||||
|
cg4800(argc,argv); break;
|
||||||
return n < 0;
|
default:
|
||||||
}
|
error_box(usage, argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return n < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
54
cg/cg4.h
54
cg/cg4.h
@ -1,26 +1,28 @@
|
|||||||
#ifndef __CG4_H
|
#ifndef __CG4_H
|
||||||
#define __CG4_H
|
#define __CG4_H
|
||||||
|
|
||||||
#ifndef __STRINGS_H
|
#ifndef __STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int cg4100(int argc, char* argv[]);
|
int cg4100(int argc, char* argv[]);
|
||||||
int cg4200(int argc, char* argv[]);
|
int cg4200(int argc, char* argv[]);
|
||||||
int cg4300(int argc, char* argv[]);
|
int cg4300(int argc, char* argv[]);
|
||||||
int cg4400(int argc, char* argv[]);
|
int cg4400(int argc, char* argv[]);
|
||||||
int cg4500(int argc, char* argv[]);
|
int cg4500(int argc, char* argv[]);
|
||||||
int cg4600(int argc, char* argv[]);
|
int cg4600(int argc, char* argv[]);
|
||||||
|
int cg4700(int argc, char* argv[]);
|
||||||
#ifdef __MAIN__
|
int cg4800(int argc, char* argv[]);
|
||||||
#define extern
|
|
||||||
#endif
|
#ifdef __MAIN__
|
||||||
|
#define extern
|
||||||
extern TString256 TMP;
|
#endif
|
||||||
|
|
||||||
#ifdef __MAIN__
|
extern TString256 TMP;
|
||||||
#undef extern
|
|
||||||
#endif
|
#ifdef __MAIN__
|
||||||
|
#undef extern
|
||||||
#endif // __CG4_H
|
#endif
|
||||||
|
|
||||||
|
#endif // __CG4_H
|
||||||
|
|
||||||
|
112
cg/cg4.url
112
cg/cg4.url
@ -1,53 +1,59 @@
|
|||||||
#include <default.url>
|
#include <default.url>
|
||||||
|
|
||||||
/* cg4 -0 Calcolo movimenti e saldi */
|
/* cg4 -0 Calcolo movimenti e saldi */
|
||||||
|
|
||||||
MENU TASK_MENUBAR
|
MENU TASK_MENUBAR
|
||||||
SUBMENU MENU_FILE "~File"
|
SUBMENU MENU_FILE "~File"
|
||||||
|
|
||||||
/* cg4 -1 Copia archivi piano conti, causali, clienti/fornitori iv direttiva */
|
/* cg4 -1 Copia archivi piano conti, causali, clienti/fornitori iv direttiva */
|
||||||
MENUBAR MENU_BAR(1)
|
MENUBAR MENU_BAR(1)
|
||||||
|
|
||||||
MENU MENU_BAR(1)
|
MENU MENU_BAR(1)
|
||||||
SUBMENU MENU_FILE "~File"
|
SUBMENU MENU_FILE "~File"
|
||||||
|
|
||||||
/* cg4 -2 Calcolo liquidazione IVA */
|
/* cg4 -2 Calcolo liquidazione IVA */
|
||||||
|
|
||||||
MENUBAR MENU_BAR(2)
|
MENUBAR MENU_BAR(2)
|
||||||
|
|
||||||
MENU MENU_BAR(2)
|
MENU MENU_BAR(2)
|
||||||
SUBMENU MENU_FILE "~File"
|
SUBMENU MENU_FILE "~File"
|
||||||
/*
|
/*
|
||||||
ITEM BAR_ITEM(1) "~Liquidazione"
|
ITEM BAR_ITEM(1) "~Liquidazione"
|
||||||
ITEM BAR_ITEM(2) "~Deleghe"
|
ITEM BAR_ITEM(2) "~Deleghe"
|
||||||
ITEM BAR_ITEM(3) "~Acconto"
|
ITEM BAR_ITEM(3) "~Acconto"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* cg4 -3 Stampa registri IVA */
|
/* cg4 -3 Stampa registri IVA */
|
||||||
|
|
||||||
MENUBAR MENU_BAR(3)
|
MENUBAR MENU_BAR(3)
|
||||||
|
|
||||||
MENU MENU_BAR(3)
|
MENU MENU_BAR(3)
|
||||||
SUBMENU MENU_FILE "~File"
|
SUBMENU MENU_FILE "~File"
|
||||||
|
|
||||||
/* cg4 -4 Apertura nuovo esercizio/nuovo esercizio IVA */
|
/* cg4 -4 Apertura nuovo esercizio/nuovo esercizio IVA */
|
||||||
|
|
||||||
MENUBAR MENU_BAR(4)
|
MENUBAR MENU_BAR(4)
|
||||||
|
|
||||||
MENU MENU_BAR(4)
|
MENU MENU_BAR(4)
|
||||||
SUBMENU MENU_FILE "~File"
|
SUBMENU MENU_FILE "~File"
|
||||||
|
|
||||||
/* cg4 -5 Chiusura Apertura Conti */
|
/* cg4 -5 Chiusura Apertura Conti */
|
||||||
|
|
||||||
MENUBAR MENU_BAR(5)
|
MENUBAR MENU_BAR(5)
|
||||||
|
|
||||||
MENU MENU_BAR(5)
|
MENU MENU_BAR(5)
|
||||||
SUBMENU MENU_FILE "~File"
|
SUBMENU MENU_FILE "~File"
|
||||||
|
|
||||||
/* cg4 -6 Visualizzazione liquidazione */
|
/* cg4 -6 Gestione acconti */
|
||||||
|
|
||||||
MENUBAR MENU_BAR(6)
|
MENUBAR MENU_BAR(6)
|
||||||
|
|
||||||
MENU MENU_BAR(6)
|
MENU MENU_BAR(6)
|
||||||
SUBMENU MENU_FILE "~File"
|
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
3974
cg/cg4304.cpp
3974
cg/cg4304.cpp
File diff suppressed because it is too large
Load Diff
923
cg/cg4305.cpp
923
cg/cg4305.cpp
@ -1,453 +1,470 @@
|
|||||||
// cg4306: liquidazione IVA
|
// cg4306: liquidazione IVA
|
||||||
// funzionalita' accessorie (calcolo acconto, estrazione deleghe)
|
// funzionalita' accessorie (calcolo acconto, estrazione deleghe)
|
||||||
|
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "cg4300.h"
|
#include "cg4300.h"
|
||||||
#include "cg4300b.h"
|
#include "cg4300b.h"
|
||||||
#include "cg4300c.h"
|
#include "cg4300c.h"
|
||||||
|
|
||||||
// -------------------------------------------------- estrazione deleghe
|
// -------------------------------------------------- estrazione deleghe
|
||||||
bool TLiquidazione_app::set_deleghe()
|
bool TLiquidazione_app::set_deleghe()
|
||||||
{
|
{
|
||||||
TMask m("cg4300b.msk");
|
TMask m("cg4300b.msk");
|
||||||
|
|
||||||
m.field(FLD_CGB_YEAR).set(_year);
|
m.field(FLD_CGB_YEAR).set(_year);
|
||||||
m.field(FLD_CGB_YEAR).set_handler(ch_year_handler);
|
m.field(FLD_CGB_YEAR).set_handler(ch_year_handler);
|
||||||
m.field(CHK_CGB_PRINT).set(_isprint ? "X" : "");
|
m.field(CHK_CGB_PRINT).set(_isprint ? "X" : "");
|
||||||
|
|
||||||
int k = 0;
|
int k = 0;
|
||||||
long j;
|
long j;
|
||||||
_calcall = FALSE;
|
_calcall = FALSE;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (k == K_ESC || k == K_ENTER)
|
if (k == K_ESC || k == K_ENTER)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
k = m.run();
|
k = m.run();
|
||||||
|
|
||||||
_isprint = m.get_bool(CHK_CGB_PRINT);
|
_isprint = m.get_bool(CHK_CGB_PRINT);
|
||||||
|
|
||||||
switch (k)
|
switch (k)
|
||||||
{
|
{
|
||||||
case DLG_SELECT:
|
case DLG_SELECT:
|
||||||
|
|
||||||
_ditte->run();
|
_ditte->run();
|
||||||
for (j = 0l; j < _ditte->items(); j++)
|
for (j = 0l; j < _ditte->items(); j++)
|
||||||
if (_ditte->checked(j)) _selected.set(j);
|
if (_ditte->checked(j)) _selected.set(j);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUT_CGB_ALL:
|
case BUT_CGB_ALL:
|
||||||
|
|
||||||
_ditte->check(-1);
|
_ditte->check(-1);
|
||||||
for (j = 0l; j < _ditte->items(); j++)
|
for (j = 0l; j < _ditte->items(); j++)
|
||||||
if (_ditte->checked(j) && !_ditte->disabled(j))
|
if (_ditte->checked(j) && !_ditte->disabled(j))
|
||||||
_selected.set(j);
|
_selected.set(j);
|
||||||
_calcall = TRUE;
|
_calcall = TRUE;
|
||||||
k = K_ENTER;
|
k = K_ENTER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k == K_ENTER)
|
if (k == K_ENTER)
|
||||||
{
|
{
|
||||||
_year = m.get(FLD_CGB_YEAR);
|
_year = m.get(FLD_CGB_YEAR);
|
||||||
_month = atoi(m.get(FLD_CGB_MONTH));
|
_month = atoi(m.get(FLD_CGB_MONTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
return k == K_ENTER;
|
return k == K_ENTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TLiquidazione_app::extract_deleghe()
|
bool TLiquidazione_app::extract_deleghe()
|
||||||
{
|
{
|
||||||
char buf[256]; TArray desc;
|
char buf[256]; TArray desc;
|
||||||
_prind = new TProgind(_calcall ? _n_ditte : _selected.ones(),
|
_prind = new TProgind(_calcall ? _n_ditte : _selected.ones(),
|
||||||
" Estrazione deleghe \n"
|
" Estrazione deleghe \n"
|
||||||
" preparazione archivi \n "
|
" preparazione archivi \n "
|
||||||
" \n ",
|
" \n ",
|
||||||
TRUE,TRUE,40);
|
TRUE,TRUE,40);
|
||||||
|
|
||||||
for (int l = 0; l < _ditte->items(); l++)
|
for (int l = 0; l < _ditte->items(); l++)
|
||||||
{
|
{
|
||||||
if (_prind->iscancelled())
|
if (_prind->iscancelled())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!(_calcall || _selected[l]) || _ditte->disabled(l))
|
if (!(_calcall || _selected[l]) || _ditte->disabled(l))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TApplication::set_firm(atol(_ditte->row(l).get(1)));
|
TApplication::set_firm(atol(_ditte->row(l).get(1)));
|
||||||
|
|
||||||
_nditte->curr().zero();
|
_nditte->curr().zero();
|
||||||
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
||||||
_nditte->read();
|
_nditte->read();
|
||||||
|
|
||||||
// must succeed
|
// must succeed
|
||||||
look_lia();
|
look_lia();
|
||||||
_freqviva = _lia->get("S7");
|
_freqviva = _lia->get("S7");
|
||||||
|
|
||||||
sprintf (buf,"Estrazione deleghe (%d):\nditta %s\n ",
|
sprintf (buf,"Estrazione deleghe (%d):\nditta %s\n ",
|
||||||
_month,
|
_month,
|
||||||
(const char*)_nditte_r->get("RAGSOC"));
|
(const char*)_nditte_r->get("RAGSOC"));
|
||||||
_prind->set_text(buf);
|
_prind->set_text(buf);
|
||||||
|
|
||||||
|
|
||||||
if (is_month_ok_strict(_month) || _month == 13)
|
if (is_month_ok_strict(_month) || _month == 13)
|
||||||
{
|
{
|
||||||
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4");
|
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4");
|
||||||
bool mens = _freqviva == "M";
|
bool mens = _freqviva == "M";
|
||||||
_isannual = (_month == 12 && !mens && !_isbenzinaro) ||
|
_isannual = (_month == 12 && !mens && !_isbenzinaro) ||
|
||||||
(_month == 13 && (mens || _isbenzinaro));
|
(_month == 13 && (mens || _isbenzinaro));
|
||||||
_isriepilogo = _month == 13;
|
_isriepilogo = _month == 13;
|
||||||
_isendliq = _isannual || _isriepilogo;
|
_isendliq = _isannual || _isriepilogo;
|
||||||
|
|
||||||
extract_delega(_month, desc);
|
extract_delega(_month, desc);
|
||||||
}
|
}
|
||||||
_prind->addstatus(1);
|
_prind->addstatus(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TApplication::set_firm(__firm);
|
TApplication::set_firm(__firm);
|
||||||
delete _prind;
|
delete _prind;
|
||||||
|
|
||||||
if (_isprint)
|
if (_isprint)
|
||||||
{
|
{
|
||||||
_DescrItem* ddeb = NULL;
|
_DescrItem* ddeb = NULL;
|
||||||
_DescrItem* dcrd = NULL;
|
_DescrItem* dcrd = NULL;
|
||||||
|
|
||||||
// scorri desc e prepara descritems
|
// scorri desc e prepara descritems
|
||||||
for (int i = 0; i < desc.items(); i++)
|
for (int i = 0; i < desc.items(); i++)
|
||||||
{
|
{
|
||||||
TToken_string& tt = (TToken_string&)desc[i];
|
TToken_string& tt = (TToken_string&)desc[i];
|
||||||
|
|
||||||
real tp(tt.get(3));
|
real tp(tt.get(3));
|
||||||
if (tp.sign() > 0)
|
if (tp.sign() > 0)
|
||||||
{
|
{
|
||||||
if (ddeb == NULL)
|
if (ddeb == NULL)
|
||||||
{
|
{
|
||||||
ddeb = new _DescrItem(DELDEB);
|
ddeb = new _DescrItem(DELDEB);
|
||||||
ddeb->_f0 = _month;
|
ddeb->_f0 = _month;
|
||||||
}
|
}
|
||||||
ddeb->_arr.add(tt);
|
ddeb->_arr.add(tt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dcrd == NULL)
|
if (dcrd == NULL)
|
||||||
{
|
{
|
||||||
dcrd = new _DescrItem(DELCRED);
|
dcrd = new _DescrItem(DELCRED);
|
||||||
dcrd->_f0 = _month;
|
dcrd->_f0 = _month;
|
||||||
}
|
}
|
||||||
dcrd->_arr.add(tt);
|
dcrd->_arr.add(tt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dcrd != NULL) _descr_arr.add(dcrd);
|
if (dcrd != NULL) _descr_arr.add(dcrd);
|
||||||
if (ddeb != NULL) _descr_arr.add(ddeb);
|
if (ddeb != NULL) _descr_arr.add(ddeb);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TLiquidazione_app::extract_delega(int month, TArray& desc)
|
bool TLiquidazione_app::extract_delega(int month, TArray& desc)
|
||||||
{
|
{
|
||||||
TToken_string* tt = NULL;
|
TToken_string* tt = NULL;
|
||||||
|
|
||||||
if (look_lim(month))
|
if (look_lim(month))
|
||||||
{
|
{
|
||||||
real topay = result_liq(month); // TBC non si puo' fa' accussi'!!!!! pena il casino!
|
real topay = result_liq(month); // TBC non si puo' fa' accussi'!!!!! pena il casino!
|
||||||
real intr = _lim->get_real("R14");
|
real intr = _lim->get_real("R14");
|
||||||
topay += intr; // lo vogliono registrato con interessi
|
topay += intr; // lo vogliono registrato con interessi
|
||||||
real nrnd = topay;
|
real nrnd = topay;
|
||||||
topay.round(-3);
|
topay.round(-3);
|
||||||
|
|
||||||
if (!topay.is_zero())
|
if (!topay.is_zero())
|
||||||
{
|
{
|
||||||
tt = new TToken_string(80);
|
tt = new TToken_string(80);
|
||||||
tt->add(_nditte->curr().get("CODDITTA"));
|
tt->add(_nditte->curr().get("CODDITTA"));
|
||||||
tt->add(_nditte->curr().get("RAGSOC"));
|
tt->add(_nditte->curr().get("RAGSOC"));
|
||||||
tt->add(_freqviva);
|
tt->add(_freqviva);
|
||||||
tt->add(topay.string());
|
tt->add(topay.string());
|
||||||
tt->add("");
|
tt->add("");
|
||||||
// tt->add(intr.string());
|
// tt->add(intr.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topay.sign() > 0)
|
if (topay.sign() > 0)
|
||||||
{
|
{
|
||||||
look_del(month, _isannual ? 2 : 1, TRUE);
|
look_del(month, _isannual ? 2 : 1, TRUE);
|
||||||
_del->put("R0",topay);
|
_del->put("R0",topay);
|
||||||
_del->put("R1",intr);
|
_del->put("R1",intr);
|
||||||
_del->put("R2",nrnd); // non arrotondato, per calcolo risultato a debito/cr
|
_del->put("R2",nrnd); // non arrotondato, per calcolo risultato a debito/cr
|
||||||
_del->rewrite();
|
_del->rewrite();
|
||||||
|
|
||||||
tt->add(_del->get("S7"));
|
tt->add(_del->get("S7"));
|
||||||
tt->add(_del->get("S8"));
|
tt->add(_del->get("S8"));
|
||||||
tt->add(_del->get("S9"));
|
tt->add(_del->get("S9"));
|
||||||
tt->add(_nditte->curr().get("PTEL"));
|
tt->add(_nditte->curr().get("PTEL"));
|
||||||
tt->add(_nditte->curr().get("TEL"));
|
tt->add(_nditte->curr().get("TEL"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tt != NULL)
|
if (tt != NULL)
|
||||||
desc.add(tt);
|
desc.add(tt);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- calcolo acconto dicembre
|
// -------------------------------------------- calcolo acconto dicembre
|
||||||
bool TLiquidazione_app::set_acconto(real& inf, real& ina)
|
bool TLiquidazione_app::set_acconto(real& inf, real& ina)
|
||||||
{
|
{
|
||||||
TMask m("cg4300c.msk");
|
TMask m("cg4300c.msk");
|
||||||
m.set(CHK_CGC_PRINT,"X");
|
m.set(CHK_CGC_PRINT,"X");
|
||||||
m.field(FLD_CGC_YEAR).set_handler(ch_year_handler);
|
m.field(FLD_CGC_YEAR).set_handler(ch_year_handler);
|
||||||
int k = 0; long j;
|
int k = 0; long j;
|
||||||
|
|
||||||
_calcall = FALSE;
|
_calcall = FALSE;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (k == K_ESC || k == K_ENTER)
|
if (k == K_ESC || k == K_ENTER)
|
||||||
break;
|
break;
|
||||||
k = m.run();
|
k = m.run();
|
||||||
|
|
||||||
_year = m.get(FLD_CGC_YEAR);
|
_year = m.get(FLD_CGC_YEAR);
|
||||||
_isprint = m.get_bool(CHK_CGC_PRINT);
|
_isprint = m.get_bool(CHK_CGC_PRINT);
|
||||||
_isbase = m.get_bool(CHK_CGC_BASE);
|
_isbase = m.get_bool(CHK_CGC_BASE);
|
||||||
_basecalc = (tbc)m.get_long(RDB_CGC_BASE);
|
_basecalc = (tbc)m.get_long(RDB_CGC_BASE);
|
||||||
|
|
||||||
inf = real(m.get(FLD_CGC_INF));
|
//inf = real(m.get(FLD_CGC_INF));
|
||||||
ina = real(m.get(FLD_CGC_INA));
|
//ina = real(m.get(FLD_CGC_INA));
|
||||||
|
|
||||||
switch (k)
|
inf = ina = ZERO;
|
||||||
{
|
|
||||||
case DLG_SELECT:
|
switch (k)
|
||||||
|
{
|
||||||
// scegli ditte
|
case DLG_SELECT:
|
||||||
_ditte->run();
|
|
||||||
|
// scegli ditte
|
||||||
for (j = 0l; j < _ditte->items(); j++)
|
_ditte->run();
|
||||||
if (_ditte->checked(j)) _selected.set(j);
|
|
||||||
|
for (j = 0l; j < _ditte->items(); j++)
|
||||||
break;
|
if (_ditte->checked(j)) _selected.set(j);
|
||||||
case BUT_CGC_ALL:
|
|
||||||
_ditte->check(-1);
|
break;
|
||||||
for (j = 0l; j < _ditte->items(); j++)
|
case BUT_CGC_ALL:
|
||||||
if (_ditte->checked(j) && !_ditte->disabled(j))
|
_ditte->check(-1);
|
||||||
_selected.set(j);
|
for (j = 0l; j < _ditte->items(); j++)
|
||||||
_calcall = TRUE;
|
if (_ditte->checked(j) && !_ditte->disabled(j))
|
||||||
k = K_ENTER;
|
_selected.set(j);
|
||||||
break;
|
_calcall = TRUE;
|
||||||
}
|
k = K_ENTER;
|
||||||
}
|
break;
|
||||||
return k == K_ENTER;
|
}
|
||||||
}
|
}
|
||||||
|
return k == K_ENTER;
|
||||||
|
}
|
||||||
bool TLiquidazione_app::recalc_acconti(real& inf, real& ina)
|
|
||||||
{
|
|
||||||
char buf[256];
|
bool TLiquidazione_app::recalc_acconti(real& inf, real& ina)
|
||||||
|
{
|
||||||
bool onemade = FALSE;
|
char buf[256];
|
||||||
|
|
||||||
long firm = TApplication::get_firm();
|
bool onemade = FALSE;
|
||||||
_prind = new TProgind(_n_ditte,
|
|
||||||
" Calcolo acconto "
|
long firm = TApplication::get_firm();
|
||||||
"\n Preparazione archivi "
|
_prind = new TProgind(_n_ditte,
|
||||||
"\n ",
|
" Calcolo acconto "
|
||||||
TRUE,TRUE,40);
|
"\n Preparazione archivi "
|
||||||
|
"\n ",
|
||||||
for (int l = 0; l < _ditte->items(); l++)
|
TRUE,TRUE,40);
|
||||||
{
|
|
||||||
if (_prind->iscancelled())
|
for (int l = 0; l < _ditte->items(); l++)
|
||||||
break;
|
{
|
||||||
if ((_calcall || _selected[l]) && !_ditte->disabled(l))
|
if (_prind->iscancelled())
|
||||||
{
|
break;
|
||||||
if (onemade == FALSE && _isprint)
|
if ((_calcall || _selected[l]) && !_ditte->disabled(l))
|
||||||
{
|
{
|
||||||
_DescrItem* d = new _DescrItem(ACCHEAD);
|
if (onemade == FALSE && _isprint)
|
||||||
d->_f0 = _basecalc == incorso;
|
{
|
||||||
d->_f1 = _isbase;
|
_DescrItem* d = new _DescrItem(ACCHEAD);
|
||||||
_descr_arr.add(d);
|
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();
|
_nditte->curr().zero();
|
||||||
|
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
||||||
TApplication::set_firm(_nditte->curr().get_long("CODDITTA"));
|
_nditte->read();
|
||||||
sprintf (buf,"Calcolo acconto:\nditta %s",
|
|
||||||
(const char*)_nditte_r->get("RAGSOC"));
|
TApplication::set_firm(_nditte->curr().get_long("CODDITTA"));
|
||||||
_prind->set_text(buf);
|
sprintf (buf,"Calcolo acconto:\nditta %s",
|
||||||
recalc_acconto(inf, ina);
|
(const char*)_nditte_r->get("RAGSOC"));
|
||||||
onemade = TRUE;
|
_prind->set_text(buf);
|
||||||
}
|
recalc_acconto(inf, ina);
|
||||||
_prind->addstatus(1);
|
onemade = TRUE;
|
||||||
}
|
}
|
||||||
|
_prind->addstatus(1);
|
||||||
TApplication::set_firm(firm);
|
}
|
||||||
delete _prind;
|
|
||||||
return TRUE;
|
TApplication::set_firm(firm);
|
||||||
}
|
delete _prind;
|
||||||
|
return TRUE;
|
||||||
bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
|
}
|
||||||
{
|
|
||||||
real bc, acc;
|
bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
|
||||||
bool isdifferita = FALSE;
|
{
|
||||||
bool error = FALSE;
|
real bc, acc, cre, deb;
|
||||||
|
bool isdifferita = FALSE;
|
||||||
// TBI rewrite from scratch
|
bool error = FALSE;
|
||||||
// this is absolutely fundamental
|
|
||||||
if (_basecalc == precedente)
|
// TBI rewrite from scratch
|
||||||
{
|
// this is absolutely fundamental
|
||||||
// determina casistica
|
if (_basecalc == precedente)
|
||||||
enum { mm, tt, mt, tm, boh } history = boh;
|
{
|
||||||
char thh = *_freqviva;
|
// determina casistica
|
||||||
|
enum { mm, tt, mt, tm, boh } history = boh;
|
||||||
TString16 thyear = _year;
|
char thh = *_freqviva;
|
||||||
_year = format("%d", atoi(_year)-1);
|
|
||||||
|
TString16 thyear = _year;
|
||||||
if (!look_lia())
|
_year = format("%d", atoi(_year)-1);
|
||||||
error = 3;
|
|
||||||
else
|
if (!look_lia())
|
||||||
{
|
error = 3;
|
||||||
char ohh = _lia->get_char("S7");
|
else
|
||||||
|
{
|
||||||
if (ohh == 'M') history = thh == 'M' ? mm : mt;
|
char ohh = _lia->get_char("S7");
|
||||||
if (ohh == 'T') history = thh == 'M' ? tm : tt;
|
|
||||||
if (history == boh) return FALSE;
|
if (ohh == 'M') history = thh == 'M' ? mm : mt;
|
||||||
|
if (ohh == 'T') history = thh == 'M' ? tm : tt;
|
||||||
// casino benzinari
|
if (history == boh) return FALSE;
|
||||||
TString attprev = _nditte->curr().get("CODATTPREV");
|
|
||||||
long codd = _nditte->curr().get_long("CODDITTA");
|
// casino benzinari
|
||||||
TLocalisamfile& atts = _nditte->lfile(LF_ATTIV);
|
TString attprev = _nditte->curr().get("CODATTPREV");
|
||||||
atts.zero();
|
long codd = _nditte->curr().get_long("CODDITTA");
|
||||||
atts.put("CODDITTA", codd);
|
TLocalisamfile& atts = _nditte->lfile(LF_ATTIV);
|
||||||
atts.put("CODATT", attprev);
|
atts.zero();
|
||||||
if (atts.read() != NOERR) atts.zero();
|
atts.put("CODDITTA", codd);
|
||||||
if (atts.get_bool("ART74/4")) // e' proprio un gran benzinaro
|
atts.put("CODATT", attprev);
|
||||||
{
|
if (atts.read() != NOERR) atts.zero();
|
||||||
TConfig cnf(CONFIG_DITTA, "cg");
|
if (atts.get_bool("ART74/4")) // e' proprio un gran benzinaro
|
||||||
history = cnf.get_bool("GesT74") ? mm : tt;
|
{
|
||||||
}
|
TConfig cnf(CONFIG_DITTA, "cg");
|
||||||
|
history = cnf.get_bool("GesT74") ? mm : tt;
|
||||||
switch (history)
|
}
|
||||||
{
|
|
||||||
case mm:
|
switch (history)
|
||||||
// base calcolo: 12a anno preced, Rideterminare a seconda dell'acconto
|
{
|
||||||
// versato; ris = 88% del debito (0 se credito)
|
case mm:
|
||||||
if (!look_lim(12)) error = 2;
|
// base calcolo: 12a anno preced, Rideterminare a seconda dell'acconto
|
||||||
else
|
// versato; ris = 88% del debito (0 se credito)
|
||||||
{
|
if (!look_lim(12)) error = 2;
|
||||||
bc += _lim->get_real("R0");
|
else
|
||||||
real av = _lim->get_real("R11");
|
{
|
||||||
bc += av;
|
bc += _lim->get_real("R0");
|
||||||
}
|
real av = _lim->get_real("R11");
|
||||||
break;
|
bc += av;
|
||||||
case tt:
|
}
|
||||||
case tm:
|
break;
|
||||||
// base calcolo: 13a anno precedente. Rideterm. per eventuale acconto
|
case tt:
|
||||||
if (!look_lim(12)) error = 2; // TBC sara' 13a davvero? Secondo me e' 12
|
case tm:
|
||||||
else
|
// base calcolo: 13a anno precedente. Rideterm. per eventuale acconto
|
||||||
{
|
if (!look_lim(12)) error = 2; // TBC sara' 13a davvero? Secondo me e' 12
|
||||||
bc += _lim->get_real("R0");
|
else
|
||||||
real av = _lim->get_real("R11");
|
{
|
||||||
bc += av;
|
bc += _lim->get_real("R0");
|
||||||
}
|
real av = _lim->get_real("R11");
|
||||||
if (_basecalc == tm)
|
bc += av;
|
||||||
// tm come tt ma si divide per 3 la base di calcolo prima di calcolare l'88%
|
}
|
||||||
bc /= real(3.0);
|
if (_basecalc == tm)
|
||||||
break;
|
// tm come tt ma si divide per 3 la base di calcolo prima di calcolare l'88%
|
||||||
case mt:
|
bc /= real(3.0);
|
||||||
// basecalcolo: 10, 11, 12 anno prec., 10 e 11 se a debito, 12 vedi acconto;
|
break;
|
||||||
// sommare e prendi 88% se a debito
|
case mt:
|
||||||
if (!look_lim(10)) error = 2;
|
// basecalcolo: 10, 11, 12 anno prec., 10 e 11 se a debito, 12 vedi acconto;
|
||||||
else bc += _lim->get_real("R0");
|
// sommare e prendi 88% se a debito
|
||||||
if (!look_lim(11)) error = 2;
|
if (!look_lim(10)) error = 2;
|
||||||
else bc += _lim->get_real("R0");
|
else
|
||||||
if (!look_lim(12)) error = 2;
|
{
|
||||||
else
|
real app = _lim->get_real("R0");
|
||||||
{
|
if (app.sign() > 0) //a debito
|
||||||
bc += _lim->get_real("R0");
|
bc += app;
|
||||||
real av = _lim->get_real("R11");
|
}
|
||||||
bc += av;
|
if (!look_lim(11)) error = 2;
|
||||||
}
|
else
|
||||||
break;
|
{
|
||||||
}
|
real app = _lim->get_real("R0");
|
||||||
|
if (app.sign() > 0) //a debito
|
||||||
if (bc.sign() > 0)
|
bc += app;
|
||||||
{
|
}
|
||||||
acc = bc * ACCONTO_DICEMBRE;
|
if (!look_lim(12)) error = 2;
|
||||||
acc.round(ROUND_LIRA);
|
else
|
||||||
}
|
{
|
||||||
}
|
bc += _lim->get_real("R0");
|
||||||
_year = thyear;
|
real av = _lim->get_real("R11");
|
||||||
}
|
bc += av;
|
||||||
else if (_basecalc == incorso)
|
}
|
||||||
{
|
break;
|
||||||
// that's pazzesc but as it turns out there's no better way
|
}
|
||||||
_comp_acconto = TRUE;
|
|
||||||
// force recalc of current month
|
if (bc.sign() > 0) //debito
|
||||||
_recalc = one;
|
{
|
||||||
// insozza il water
|
acc = bc * ACCONTO_DICEMBRE;
|
||||||
update_firm(12);
|
acc.round(ROUND_LIRA);
|
||||||
|
}
|
||||||
// calcola l'acconto
|
}
|
||||||
if (look_lim(12))
|
_year = thyear;
|
||||||
{
|
}
|
||||||
// TBC trimestrali, differite
|
else if (_basecalc == incorso)
|
||||||
bc = result_liq(12);
|
{
|
||||||
// somma i non fatturati/non annotati
|
// that's pazzesc but as it turns out there's no better way
|
||||||
bc += inf + ina;
|
_comp_acconto = TRUE;
|
||||||
if (bc.sign() > 0) acc = bc;
|
// force recalc of current month
|
||||||
}
|
_recalc = one;
|
||||||
else error = 1;
|
// insozza il water
|
||||||
|
update_firm(12);
|
||||||
// pulisci il water
|
|
||||||
_comp_acconto = FALSE;
|
// calcola l'acconto
|
||||||
update_firm(12);
|
if (look_lim(12))
|
||||||
}
|
{
|
||||||
|
// TBC trimestrali, differite
|
||||||
// sbatti l'acconto in LIA
|
bc = result_liq(12);
|
||||||
if (look_lia())
|
// somma i non fatturati/non annotati
|
||||||
{
|
//bc += inf + ina;
|
||||||
_lia->put("R4",acc);
|
cre = _lim->get_real("R12");
|
||||||
isdifferita = _lia->get_bool("B1");
|
deb = _lim->get_real("R13");
|
||||||
_lia->rewrite();
|
if (bc.sign() > 0) acc = bc;
|
||||||
}
|
}
|
||||||
|
else error = 1;
|
||||||
bool wasdel = look_del(12,7);
|
|
||||||
|
// pulisci il water
|
||||||
if (acc.sign() > 0 && acc > ACCONTO_MINIMO_DA_VERSARE)
|
_comp_acconto = FALSE;
|
||||||
{
|
update_firm(12);
|
||||||
// crea o aggiorna delega
|
}
|
||||||
// TBC everything
|
|
||||||
look_del(12,7,TRUE);
|
// sbatti l'acconto in LIA
|
||||||
_del->put("R0", acc);
|
if (look_lia())
|
||||||
_del->rewrite();
|
{
|
||||||
}
|
isdifferita = _lia->get_bool("B1");
|
||||||
else if (wasdel)
|
if (isdifferita && _basecalc == incorso) acc *= real(double(2/3));
|
||||||
_del->remove();
|
_lia->put("R4",acc);
|
||||||
|
_lia->rewrite();
|
||||||
// per questa volta lasciamo perdere la describe_acconto
|
}
|
||||||
if (_isprint)
|
|
||||||
{
|
bool wasdel = look_del(12,7);
|
||||||
// segnalazioni di errore da gesticolare:
|
|
||||||
// error = 0: no error
|
if (acc.sign() > 0 && acc >= ACCONTO_MINIMO_DA_VERSARE)
|
||||||
// error = 1: manca tabella risultati liquidazione per l'anno indicato
|
{
|
||||||
// error = 2: manca tabella risultati liquidazione per l'anno precedente
|
// crea o aggiorna delega
|
||||||
// error = 3: manca tabella dichiarazione annuale per l'anno precedente
|
// TBC everything
|
||||||
_DescrItem* d = new _DescrItem(ACCONTO);
|
look_del(12,7,TRUE);
|
||||||
d->_r0 = bc;
|
_del->put("R0", acc);
|
||||||
d->_r1 = acc;
|
_del->rewrite();
|
||||||
d->_f0 = _basecalc == incorso;
|
}
|
||||||
d->_f1 = _isbase;
|
else if (wasdel)
|
||||||
d->_f2 = error;
|
_del->remove();
|
||||||
d->_f3 = isdifferita;
|
|
||||||
d->_s0 = _nditte->curr().get("CODDITTA");
|
// per questa volta lasciamo perdere la describe_acconto
|
||||||
d->_s1 = _nditte->curr().get("RAGSOC");
|
if (_isprint)
|
||||||
_descr_arr.add(d);
|
{
|
||||||
}
|
// segnalazioni di errore da gesticolare:
|
||||||
return TRUE;
|
// 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;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user