Aggiunti file gestione acconti
git-svn-id: svn://10.65.10.50/trunk@1783 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
73af6258b3
commit
50ef61047d
122
cg/cg4700.cpp
Executable file
122
cg/cg4700.cpp
Executable file
@ -0,0 +1,122 @@
|
|||||||
|
#include <relapp.h>
|
||||||
|
#include <config.h>
|
||||||
|
#include <msksheet.h>
|
||||||
|
#include <tabutil.h>
|
||||||
|
#include "cg4700.h"
|
||||||
|
|
||||||
|
#define ACCONTO_MENO_CREDITO real(200000.0)
|
||||||
|
|
||||||
|
class GesAcc_app : public TRelation_application
|
||||||
|
{
|
||||||
|
TRelation* _rel;
|
||||||
|
TMask* _mask;
|
||||||
|
TTable* _lim;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool msk_credito(TMask_field&, KEY);
|
||||||
|
static bool msk_acconto(TMask_field&, KEY);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool user_create();
|
||||||
|
virtual bool user_destroy();
|
||||||
|
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 void init_query_mode (TMask&);
|
||||||
|
//virtual void init_query_insert_mode (TMask&);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline GesAcc_app& app()
|
||||||
|
{
|
||||||
|
return (GesAcc_app&) main_app();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GesAcc_app::user_create()
|
||||||
|
{
|
||||||
|
_lim = new TTable("LIM");
|
||||||
|
_rel = new TRelation("%LIA");
|
||||||
|
|
||||||
|
_mask = new TMask("cg4700a");
|
||||||
|
_mask->set_handler(F_CREDITO, msk_acconto);
|
||||||
|
_mask->set_handler(F_CREDITO, msk_credito);
|
||||||
|
|
||||||
|
set_search_field(F_CODDITTA);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GesAcc_app::user_destroy()
|
||||||
|
{
|
||||||
|
delete _mask;
|
||||||
|
delete _lim;
|
||||||
|
delete _rel;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GesAcc_app::msk_credito(TMask_field& f, KEY k)
|
||||||
|
{
|
||||||
|
if (k == K_ENTER)
|
||||||
|
{
|
||||||
|
real credito (f.get());
|
||||||
|
real acconto (f.mask().get(F_ACCONTO));
|
||||||
|
if (credito > acconto)
|
||||||
|
return f.error_box("Il credito non puo' essere superiore all'acconto");
|
||||||
|
if (acconto.is_zero())
|
||||||
|
if (!credito.is_zero())
|
||||||
|
return f.error_box("Non e' possibile indicare il credito se l'acconto e' nullo");
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GesAcc_app::msk_acconto(TMask_field& f, KEY k)
|
||||||
|
{
|
||||||
|
if (k == K_ENTER)
|
||||||
|
{
|
||||||
|
real credito (f.mask().get(F_CREDITO));
|
||||||
|
real acconto (f.get());
|
||||||
|
if (!acconto.is_zero())
|
||||||
|
{
|
||||||
|
if (acconto - credito < ACCONTO_MENO_CREDITO)
|
||||||
|
return f.error_box("La differenza tra acconto e credito deve essere superiore a lire %s", ACCONTO_MENO_CREDITO.string("."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GesAcc_app::rewrite(const TMask& m)
|
||||||
|
{
|
||||||
|
TString16 chiave;
|
||||||
|
int anno = m.get_int(F_ANNO);
|
||||||
|
|
||||||
|
chiave << anno << 12;
|
||||||
|
|
||||||
|
TTable lim ("LIM");
|
||||||
|
lim.put("CODTAB", chiave);
|
||||||
|
if (lim.read() == NOERR)
|
||||||
|
{
|
||||||
|
real new_acc (m.get(F_ACCONTO));
|
||||||
|
real new_cred = lim.get_real("R12") - lim.get_real("R11") + new_acc;
|
||||||
|
lim.put("R11", new_acc);
|
||||||
|
lim.put("R12", new_cred);
|
||||||
|
lim.put("R0", lim.get_real("R13")- new_cred);
|
||||||
|
lim.rewrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
m.autosave(_rel);
|
||||||
|
return _rel->rewrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
TMask* GesAcc_app::get_mask(int mode)
|
||||||
|
{
|
||||||
|
return _mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cg4700(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
GesAcc_app app;
|
||||||
|
app.run(argc, argv, "Gestione acconti");
|
||||||
|
return 0;
|
||||||
|
}
|
5
cg/cg4700.h
Executable file
5
cg/cg4700.h
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#define F_CODDITTA 101
|
||||||
|
#define F_RAGSOC 102
|
||||||
|
#define F_ANNO 103
|
||||||
|
#define F_ACCONTO 104
|
||||||
|
#define F_CREDITO 105
|
84
cg/cg4700a.uml
Executable file
84
cg/cg4700a.uml
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#include "cg4700.h"
|
||||||
|
|
||||||
|
TOOLBAR "" 0 20 0 2
|
||||||
|
|
||||||
|
#include <toolbar.h>
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
PAGE "Gestione acconti di Dicembre" -1 -1 78 15
|
||||||
|
|
||||||
|
NUMBER F_CODDITTA 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "Ditta "
|
||||||
|
FIELD CODTAB[1,5]
|
||||||
|
FLAGS "ZFR"
|
||||||
|
KEY 1
|
||||||
|
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
|
||||||
|
CHECKTYPE FORCED
|
||||||
|
WARNING "Ditta assente"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_RAGSOC 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 16 1 "Rag.Soc "
|
||||||
|
KEY 1
|
||||||
|
USE LF_NDITTE KEY 2
|
||||||
|
INPUT CODDITTA F_CODDITTA
|
||||||
|
DISPLAY "Ditta" CODDITTA
|
||||||
|
DISPLAY "Ragione sociale@50" RAGSOC
|
||||||
|
OUTPUT F_CODDITTA CODDITTA
|
||||||
|
OUTPUT F_RAGSOC RAGSOC
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_ANNO 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 3 "Anno liquidazione "
|
||||||
|
HELP "Introdurre l'anno liquidazione"
|
||||||
|
FIELD CODTAB[6,9]
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
KEY 1
|
||||||
|
USE %LIA
|
||||||
|
JOIN LF_NDITTE TO %LIA INTO CODDITTA=CODTAB[1,5]
|
||||||
|
INPUT CODTAB[1,5] F_CODDITTA
|
||||||
|
INPUT CODTAB[6,9] F_ANNO
|
||||||
|
DISPLAY "Ditta" CODTAB[1,5]
|
||||||
|
DISPLAY "Ragione sociale@50" LF_NDITTE->RAGSOC
|
||||||
|
DISPLAY "Anno" CODTAB[6,9]
|
||||||
|
OUTPUT F_CODDITTA CODTAB[1,5]
|
||||||
|
OUTPUT F_ANNO CODTAB[6,9]
|
||||||
|
VALIDATE FIXLEN_FUNC 4
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_ACCONTO 15
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 7 "Acconto dovuto "
|
||||||
|
HELP "Introdurre l'acconto dovuto"
|
||||||
|
PICTURE "."
|
||||||
|
FLAGS "R"
|
||||||
|
FIELD R4
|
||||||
|
NUM_CALC ROUND(#THIS_FIELD,-3)
|
||||||
|
//NUM_EXPR (#THIS_FIELD>=0.0)
|
||||||
|
//WARNING "Valore non valido (>=0.0)"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_CREDITO 15
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 9 "Credito utilizzato "
|
||||||
|
HELP "Introdurre il credito utilizzato"
|
||||||
|
PICTURE "."
|
||||||
|
FLAGS "R"
|
||||||
|
FIELD R6
|
||||||
|
NUM_CALC ROUND(#THIS_FIELD,-3)
|
||||||
|
//NUM_EXPR (#THIS_FIELD>=0.0)
|
||||||
|
//WARNING "Valore non valido (>=0.0)"
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
576
cg/cg4800.cpp
Executable file
576
cg/cg4800.cpp
Executable file
@ -0,0 +1,576 @@
|
|||||||
|
#include <applicat.h>
|
||||||
|
#include <mask.h>
|
||||||
|
#include <tabutil.h>
|
||||||
|
#include <relation.h>
|
||||||
|
#include <sheet.h>
|
||||||
|
#include <urldefid.h>
|
||||||
|
#include <prefix.h>
|
||||||
|
#include <printer.h>
|
||||||
|
#include <progind.h>
|
||||||
|
#include <utility.h>
|
||||||
|
#include <config.h>
|
||||||
|
#include "cg4800a.h"
|
||||||
|
#include "cg4800b.h"
|
||||||
|
|
||||||
|
#define ACCONTO_SENZA_CREDITO real(200000)
|
||||||
|
#define ROUND_MILLELIRE (-3)
|
||||||
|
|
||||||
|
class VersAcc_app : public TApplication
|
||||||
|
{
|
||||||
|
TRelation* _nditte;
|
||||||
|
TArray_sheet* _ditte;
|
||||||
|
TArray _nomiditte, _desc;
|
||||||
|
TBit_array _selected;
|
||||||
|
|
||||||
|
TTable* _lim;
|
||||||
|
TTable* _lia;
|
||||||
|
TTable* _del;
|
||||||
|
TTable* _ban;
|
||||||
|
TTable* _ucc;
|
||||||
|
|
||||||
|
TProgind* _prind;
|
||||||
|
|
||||||
|
int _year;
|
||||||
|
real _acconto, _credito, _diff, _impver;
|
||||||
|
bool _calcall, _da_stampare, _print;
|
||||||
|
TDate _dataver;
|
||||||
|
TString16 _abi, _cab, _con;
|
||||||
|
TString16 _abips, _cabps; //dai parametri di studio
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool create();
|
||||||
|
virtual bool destroy();
|
||||||
|
virtual bool menu(MENU_TAG);
|
||||||
|
virtual void print();
|
||||||
|
|
||||||
|
// handlers
|
||||||
|
static bool ch_year_handler(TMask_field& f, KEY key);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
static VersAcc_app& app() { return (VersAcc_app&)main_app(); }
|
||||||
|
void build_ditte_sheet();
|
||||||
|
void build_nomiditte();
|
||||||
|
|
||||||
|
void lettura_delega();
|
||||||
|
void lettura_anagrafica(bool*);
|
||||||
|
void crea_riga_stampa(bool);
|
||||||
|
void aggiorna_delega();
|
||||||
|
void crea_delega();
|
||||||
|
void vers_acc();
|
||||||
|
|
||||||
|
bool look_lia();
|
||||||
|
bool video_conferma();
|
||||||
|
bool check_acc();
|
||||||
|
|
||||||
|
VersAcc_app() : _ditte(NULL), _selected(10000), _nomiditte(100), _desc(100) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
bool VersAcc_app::look_lia()
|
||||||
|
{
|
||||||
|
TTable lia ("%LIA");
|
||||||
|
|
||||||
|
TString16 y; y.format("%05ld%04d", _nditte->lfile().get_long("CODDITTA"), _year);
|
||||||
|
|
||||||
|
lia.zero();
|
||||||
|
lia.put("CODTAB", y);
|
||||||
|
lia.read();
|
||||||
|
const bool ok = lia.good();
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
_acconto = lia.get_real("R4");
|
||||||
|
_credito = lia.get_real("R6");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_acconto = ZERO;
|
||||||
|
_credito = ZERO;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VersAcc_app::create()
|
||||||
|
{
|
||||||
|
TApplication::create();
|
||||||
|
|
||||||
|
TDate oggi(TODAY);
|
||||||
|
_year = oggi.year();
|
||||||
|
_nditte = new TRelation(LF_NDITTE);
|
||||||
|
_nditte->add(LF_ANAG, "TIPOA=TIPOA|CODANAGR=CODANAGR");
|
||||||
|
_nditte->add(LF_COMUNI, "COM=COMRF(COMRES)", 1, LF_ANAG);
|
||||||
|
|
||||||
|
_ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Ditte",
|
||||||
|
"@1|Cod.@5R|Ragione Sociale@50|Vers.");
|
||||||
|
|
||||||
|
_del = new TTable("%DEL");
|
||||||
|
_lia = new TTable("%LIA");
|
||||||
|
_ban = new TTable("%BAN");
|
||||||
|
_ucc = new TTable("%UCC");
|
||||||
|
_lim = new TTable("LIM");
|
||||||
|
|
||||||
|
TConfig c (CONFIG_STUDIO, "cg");
|
||||||
|
_abips = c.get("CodABI");
|
||||||
|
_cabps = c.get("CodCAB");
|
||||||
|
|
||||||
|
begin_wait();
|
||||||
|
build_nomiditte();
|
||||||
|
build_ditte_sheet();
|
||||||
|
end_wait();
|
||||||
|
|
||||||
|
dispatch_e_menu(BAR_ITEM(1));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VersAcc_app::destroy()
|
||||||
|
{
|
||||||
|
delete _lim;
|
||||||
|
delete _lia;
|
||||||
|
delete _del;
|
||||||
|
delete _ban;
|
||||||
|
delete _ucc;
|
||||||
|
delete _ditte;
|
||||||
|
delete _nditte;
|
||||||
|
|
||||||
|
return TApplication::destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VersAcc_app::ch_year_handler(TMask_field& f, KEY key)
|
||||||
|
{
|
||||||
|
if (key == K_TAB && f.focusdirty())
|
||||||
|
{
|
||||||
|
app().begin_wait();
|
||||||
|
app().build_nomiditte();
|
||||||
|
app().build_ditte_sheet();
|
||||||
|
app().end_wait();
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VersAcc_app::build_ditte_sheet()
|
||||||
|
{
|
||||||
|
// build sheet
|
||||||
|
_ditte->destroy();
|
||||||
|
for (int i = 0; i < _nomiditte.items(); i++)
|
||||||
|
{
|
||||||
|
TToken_string* d = new TToken_string(64);
|
||||||
|
*d = (TToken_string&)_nomiditte[i];
|
||||||
|
const char vers = d->get_char(2);
|
||||||
|
d->insert(" |", 0);
|
||||||
|
bool selectable = vers == '?';
|
||||||
|
const long pos = _ditte->add(d);
|
||||||
|
if (selectable) _ditte->disable(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersAcc_app::build_nomiditte()
|
||||||
|
{
|
||||||
|
_nomiditte.destroy();
|
||||||
|
// ricostruire _nomiditte e rifare build_ditte_sheet
|
||||||
|
TLocalisamfile& dt = _nditte->lfile();
|
||||||
|
TString fr(2);
|
||||||
|
TTable lia("%LIA");
|
||||||
|
|
||||||
|
for (dt.first(); !dt.eof(); dt.next())
|
||||||
|
{
|
||||||
|
// check no archivi
|
||||||
|
fr = "??";
|
||||||
|
bool good = prefix().exist(dt.get_long("CODDITTA"));
|
||||||
|
|
||||||
|
if (good)
|
||||||
|
{
|
||||||
|
// check no parametri liquidazione
|
||||||
|
lia.put("CODTAB", format("%05ld%d",dt.get_long("CODDITTA"),_year));
|
||||||
|
if (lia.read() != NOERR) good = FALSE;
|
||||||
|
else fr = lia.get("S7");
|
||||||
|
}
|
||||||
|
else continue;
|
||||||
|
|
||||||
|
TToken_string* d = new TToken_string(64);
|
||||||
|
|
||||||
|
// add record
|
||||||
|
d->add(dt.get_long("CODDITTA"));
|
||||||
|
d->add(dt.get("RAGSOC"));
|
||||||
|
d->add(fr);
|
||||||
|
|
||||||
|
_nomiditte.add(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VersAcc_app::menu(MENU_TAG)
|
||||||
|
{
|
||||||
|
if (check_acc())
|
||||||
|
{
|
||||||
|
if (_calcall || _selected.ones() > 0l)
|
||||||
|
{
|
||||||
|
vers_acc();
|
||||||
|
if (_print)
|
||||||
|
{
|
||||||
|
enable_menu_item(M_FILE_PRINT);
|
||||||
|
print();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else warning_box("Nessuna ditta selezionata!");
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VersAcc_app::check_acc()
|
||||||
|
{
|
||||||
|
KEY k;
|
||||||
|
|
||||||
|
TMask m("cg4800a");
|
||||||
|
|
||||||
|
m.set_handler(FLD_CGB_YEAR, ch_year_handler);
|
||||||
|
|
||||||
|
long j;
|
||||||
|
_calcall = FALSE;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (k == K_ESC || k == K_ENTER)
|
||||||
|
break;
|
||||||
|
|
||||||
|
k = m.run();
|
||||||
|
|
||||||
|
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_int(FLD_CGB_YEAR);
|
||||||
|
|
||||||
|
return k == K_ENTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersAcc_app::vers_acc()
|
||||||
|
{
|
||||||
|
char buf[256]; bool tipo;
|
||||||
|
|
||||||
|
_desc.destroy();
|
||||||
|
_da_stampare = _print = FALSE;
|
||||||
|
|
||||||
|
_prind = new TProgind(_calcall ? 0l : _selected.ones(),
|
||||||
|
" Creazione versam. acconti \n"
|
||||||
|
" preparazione archivi \n"
|
||||||
|
" \n",
|
||||||
|
TRUE,TRUE,30);
|
||||||
|
|
||||||
|
for (int l = 0; l < _ditte->items(); l++)
|
||||||
|
{
|
||||||
|
if (_prind->iscancelled())
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (!(_calcall || _selected[l]) || _ditte->disabled(l))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
_abi = _abips;
|
||||||
|
_cab = _cabps;
|
||||||
|
_da_stampare = FALSE; //relativo a ciascuna ditta
|
||||||
|
|
||||||
|
TApplication::set_firm(_ditte->row(l).get_long(1));
|
||||||
|
|
||||||
|
_nditte->curr().zero();
|
||||||
|
_nditte->curr().put("CODDITTA",_ditte->row(l).get(1));
|
||||||
|
_nditte->read();
|
||||||
|
|
||||||
|
if (!look_lia()) continue;
|
||||||
|
|
||||||
|
sprintf (buf,"Creazione vers. acconti:\nditta %s\n ",
|
||||||
|
(const char*)_nditte->lfile().get("RAGSOC"));
|
||||||
|
_prind->set_text(buf);
|
||||||
|
|
||||||
|
lettura_anagrafica(&tipo);
|
||||||
|
|
||||||
|
lettura_delega();
|
||||||
|
|
||||||
|
if (_da_stampare)
|
||||||
|
{
|
||||||
|
crea_riga_stampa(tipo);
|
||||||
|
_print = TRUE; //relativo alla stampa finale
|
||||||
|
}
|
||||||
|
|
||||||
|
_prind->addstatus(1);
|
||||||
|
}
|
||||||
|
delete _prind;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersAcc_app::print()
|
||||||
|
{
|
||||||
|
printer().open();
|
||||||
|
|
||||||
|
TPrintrow row;
|
||||||
|
|
||||||
|
row.put("Gestione iva", 0);
|
||||||
|
row.put("Data @>", 106);
|
||||||
|
row.put("Pag.@#", 124);
|
||||||
|
printer().setheaderline(0,row);
|
||||||
|
|
||||||
|
row.reset();
|
||||||
|
TString256 t("@bCREAZIONE VERSAMENTI PER ACCONTI DICEMBRE");
|
||||||
|
t <<' '<<_year;
|
||||||
|
row.put(t,34);
|
||||||
|
printer().setheaderline(1,row);
|
||||||
|
|
||||||
|
t = "";
|
||||||
|
t.fill('-',132);
|
||||||
|
row.reset();
|
||||||
|
row.put(t,0);
|
||||||
|
printer().setheaderline(2,row);
|
||||||
|
printer().setheaderline(4,row);
|
||||||
|
|
||||||
|
row.reset();
|
||||||
|
row.put("Ditta",0);
|
||||||
|
row.put("Denominazione",7);
|
||||||
|
row.put("Importo",46);
|
||||||
|
row.put("Banca",55);
|
||||||
|
row.put("Dipendenza",62);
|
||||||
|
row.put("Concessione",74);
|
||||||
|
printer().setheaderline(3,row);
|
||||||
|
|
||||||
|
for (int i = 0; i < _desc.items(); i++)
|
||||||
|
{
|
||||||
|
TToken_string& tt = (TToken_string&)_desc[i];
|
||||||
|
|
||||||
|
TParagraph_string rs (tt.get(1),30);
|
||||||
|
|
||||||
|
row.reset();
|
||||||
|
row.put(tt.get(0),0);
|
||||||
|
const real imp(real::ita2eng(tt.get(2)));
|
||||||
|
row.put(imp.string("###.###.###.###"),38);
|
||||||
|
if (tt.get_int(7) == 0)
|
||||||
|
{
|
||||||
|
row.put(tt.get(3),55);
|
||||||
|
row.put(tt.get(4),63);
|
||||||
|
}
|
||||||
|
else row.put(tt.get(5),77);
|
||||||
|
|
||||||
|
const TString80 descr(tt.get(6));
|
||||||
|
row.put(descr.left(45),86);
|
||||||
|
const char* r;
|
||||||
|
while ((r = rs.get()) != NULL)
|
||||||
|
{
|
||||||
|
row.put(r,7);
|
||||||
|
printer().print(row);
|
||||||
|
row.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printer().close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersAcc_app::lettura_delega()
|
||||||
|
{
|
||||||
|
TString16 cod;
|
||||||
|
TString16 y (format("%05ld", _nditte->lfile().get_long("CODDITTA")));
|
||||||
|
|
||||||
|
_diff = _acconto - _credito;
|
||||||
|
_diff.round(ROUND_MILLELIRE);
|
||||||
|
|
||||||
|
cod << y << _year << 12 << 7;
|
||||||
|
|
||||||
|
_del->zero();
|
||||||
|
_del->put("CODTAB", cod);
|
||||||
|
|
||||||
|
if (_del->read() == NOERR)
|
||||||
|
{
|
||||||
|
if (_diff < ACCONTO_SENZA_CREDITO) //l'importo non e' dovuto
|
||||||
|
{
|
||||||
|
//cancello la delega
|
||||||
|
_del->remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// se sono qui e' perche' l'importo e' dovuto (_diff >= ACCONTO_SENZA_CREDITO)
|
||||||
|
bool stampata = _del->get_bool("B0");
|
||||||
|
|
||||||
|
_impver = _del->get_real("R0");
|
||||||
|
_dataver = _del->get_date("D0");
|
||||||
|
|
||||||
|
if (stampata)
|
||||||
|
{
|
||||||
|
_abi = _del->get("S7");
|
||||||
|
_cab = _del->get("S8");
|
||||||
|
_con = _del->get("S9");
|
||||||
|
if (_diff != _impver)
|
||||||
|
video_conferma();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aggiorna_delega();
|
||||||
|
_da_stampare = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //non esiste la delega
|
||||||
|
{
|
||||||
|
if (_diff >= ACCONTO_SENZA_CREDITO)
|
||||||
|
//creo record delega
|
||||||
|
{
|
||||||
|
crea_delega();
|
||||||
|
_da_stampare = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersAcc_app::crea_delega()
|
||||||
|
{
|
||||||
|
TString16 y (format("%05ld", _nditte->lfile().get_long("CODDITTA")));
|
||||||
|
TString16 cod;
|
||||||
|
|
||||||
|
cod << y << _year << 12 << 7;
|
||||||
|
|
||||||
|
_del->zero();
|
||||||
|
_del->put("CODTAB", cod);
|
||||||
|
_del->put("S7", _abi);
|
||||||
|
_del->put("S8", _cab);
|
||||||
|
_del->put("S9", _con);
|
||||||
|
_del->put("R0", _diff);
|
||||||
|
|
||||||
|
_del->write();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersAcc_app::aggiorna_delega()
|
||||||
|
{
|
||||||
|
_del->put("S7", _abi);
|
||||||
|
_del->put("S8", _cab);
|
||||||
|
_del->put("S9", _con);
|
||||||
|
_del->put("R0", _diff);
|
||||||
|
|
||||||
|
_del->rewrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersAcc_app::lettura_anagrafica(bool* tipo)
|
||||||
|
{
|
||||||
|
TLocalisamfile& anag = _nditte->lfile(LF_ANAG);
|
||||||
|
TLocalisamfile& com = _nditte->lfile(LF_COMUNI); // Comune residenza fiscale
|
||||||
|
|
||||||
|
const bool cf = anag.get_bool("TITCF");
|
||||||
|
const int isdel = anag.get_int("TIPOSTDEL");
|
||||||
|
|
||||||
|
if (cf && (isdel == 1 || isdel == 2))
|
||||||
|
{
|
||||||
|
*tipo = TRUE;
|
||||||
|
const int con = com.get_int("UFFCONC");
|
||||||
|
_abi = "";
|
||||||
|
_cab = "";
|
||||||
|
_con = format("%03d",con);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*tipo = FALSE;
|
||||||
|
_con = "";
|
||||||
|
const long codabi = anag.get_long("CODABI");
|
||||||
|
const long codcab = anag.get_long("CODCAB");
|
||||||
|
if (codabi != 0 || codcab != 0)
|
||||||
|
{
|
||||||
|
_abi = format("%05ld", codabi);
|
||||||
|
_cab = format("%05ld", codcab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VersAcc_app::video_conferma()
|
||||||
|
{
|
||||||
|
TMask m("cg4800b");
|
||||||
|
|
||||||
|
m.field(F_CODDITTA).set(_nditte->lfile().get("CODDITTA"));
|
||||||
|
m.field(F_RAGSOC).set(_nditte->lfile().get("RAGSOC"));
|
||||||
|
m.field(F_DATAVER).set(_dataver);
|
||||||
|
m.field(F_ABI).set(_abi);
|
||||||
|
m.field(F_CAB).set(_cab);
|
||||||
|
m.field(F_CON).set(_con);
|
||||||
|
m.field(F_IMPVER).set(_impver.string());
|
||||||
|
m.field(F_NEWIMP).set(_diff.string());
|
||||||
|
|
||||||
|
for (bool stop = FALSE; !stop;)
|
||||||
|
{
|
||||||
|
KEY k = m.run();
|
||||||
|
|
||||||
|
switch(k)
|
||||||
|
{
|
||||||
|
case K_SAVE:
|
||||||
|
{
|
||||||
|
KEY k = yesnocancel_box("Delega gia' stampata. Si desidera ugualmente confermare l'aggiornamento?");
|
||||||
|
if (k == K_YES)
|
||||||
|
{
|
||||||
|
_da_stampare = TRUE;
|
||||||
|
_del->put("R0",_diff);
|
||||||
|
_del->put("B0", "");
|
||||||
|
_del->rewrite();
|
||||||
|
}
|
||||||
|
if (k == K_YES || k == K_NO)
|
||||||
|
stop = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case K_ESC:
|
||||||
|
stop = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VersAcc_app::crea_riga_stampa(bool tipost)
|
||||||
|
{
|
||||||
|
TToken_string* tt = new TToken_string(150);
|
||||||
|
TString80 desc;
|
||||||
|
|
||||||
|
if (tipost) //prendo la descrizione dell'ufficio concessione
|
||||||
|
{
|
||||||
|
if (_con.not_empty())
|
||||||
|
{
|
||||||
|
TTable ucc("%UCC");
|
||||||
|
ucc.zero();
|
||||||
|
ucc.put("CODTAB", _con);
|
||||||
|
if (ucc.read() == NOERR)
|
||||||
|
desc = ucc.get("S0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //prendo la descrizione della banca
|
||||||
|
{
|
||||||
|
if (_abi.not_empty())
|
||||||
|
{
|
||||||
|
TTable ban("%BAN");
|
||||||
|
TString16 cod;
|
||||||
|
cod = _abi; cod << _cab;
|
||||||
|
ban.zero();
|
||||||
|
ban.put("CODTAB", cod);
|
||||||
|
if (ban.read() == NOERR)
|
||||||
|
desc = ban.get("S0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tt->add(_nditte->lfile().get("CODDITTA"));
|
||||||
|
tt->add(_nditte->lfile().get("RAGSOC"));
|
||||||
|
tt->add(_diff.string());
|
||||||
|
tt->add(_abi);
|
||||||
|
tt->add(_cab);
|
||||||
|
tt->add(_con);
|
||||||
|
tt->add(desc);
|
||||||
|
tt->add(tipost);
|
||||||
|
|
||||||
|
if (tt != NULL) _desc.add(tt);
|
||||||
|
}
|
||||||
|
|
||||||
|
int cg4800(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
VersAcc_app app;
|
||||||
|
app.run(argc, argv, "Creazione versam. acconti dicembre");
|
||||||
|
return 0;
|
||||||
|
}
|
2
cg/cg4800a.h
Executable file
2
cg/cg4800a.h
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#define FLD_CGB_YEAR 101
|
||||||
|
#define BUT_CGB_ALL 102
|
41
cg/cg4800a.uml
Executable file
41
cg/cg4800a.uml
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#include "cg4800a.h"
|
||||||
|
|
||||||
|
PAGE "Creazione versamenti acconti dicembre" -1 -1 45 10
|
||||||
|
|
||||||
|
NUMBER FLD_CGB_YEAR 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 1 "Anno iva da elaborare "
|
||||||
|
FLAGS "A"
|
||||||
|
VALIDATE FIXLEN_FUNC 4
|
||||||
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 41 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 3 "Scelta ditte"
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_SELECT 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -12 4 "Scegli"
|
||||||
|
MESSAGE EXIT,DLG_SELECT
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON BUT_CGB_ALL 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -22 4 "Tutte"
|
||||||
|
MESSAGE EXIT,BUT_CGB_ALL
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_OK 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -12 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_CANCEL 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -22 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
9
cg/cg4800b.h
Executable file
9
cg/cg4800b.h
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#define F_CODDITTA 101
|
||||||
|
#define F_RAGSOC 102
|
||||||
|
#define F_DATAVER 103
|
||||||
|
#define F_ABI 104
|
||||||
|
#define F_CAB 105
|
||||||
|
#define F_CON 106
|
||||||
|
#define F_IMPVER 107
|
||||||
|
#define F_NEWIMP 108
|
||||||
|
|
87
cg/cg4800b.uml
Executable file
87
cg/cg4800b.uml
Executable file
@ -0,0 +1,87 @@
|
|||||||
|
#include "cg4800b.h"
|
||||||
|
|
||||||
|
TOOLBAR "" 0 20 0 2
|
||||||
|
|
||||||
|
BUTTON DLG_SAVEREC 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -12 -1 "~Registra"
|
||||||
|
MESSAGE EXIT,K_SAVE
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_CANCEL 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -34 -1 ""
|
||||||
|
MESSAGE EXIT,K_ESC
|
||||||
|
END
|
||||||
|
|
||||||
|
/*
|
||||||
|
BUTTON DLG_QUIT 8 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -33 -1 ""
|
||||||
|
MESSAGE EXIT,K_QUIT
|
||||||
|
END
|
||||||
|
*/
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
PAGE "Creazione versam. acconti dicembre" -1 -1 77 20
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 79 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 0 1 "@bDitta corrente"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_CODDITTA 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 2 "Codice "
|
||||||
|
FLAGS "DFR"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_RAGSOC 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 16 2 "Rag. Soc. "
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
DATE F_DATAVER
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 5 "Data versamento "
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_ABI 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 6 "Codice banca "
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_CAB 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 7 "Codice dipendenza "
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_CON 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 8 "Codice concessione "
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_IMPVER 15
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 9 "Importo versato "
|
||||||
|
FLAGS "D"
|
||||||
|
PICTURE "."
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_NEWIMP 15
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 10 "Nuovo importo "
|
||||||
|
FLAGS "D"
|
||||||
|
PICTURE "."
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user