Patch level : 10.0 0040
Files correlati : cg0 Ricompilazione Demo : [ ] Commento : Aggiunto pulsante di creazione percipiente git-svn-id: svn://10.65.10.50/trunk@16543 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2980a95395
commit
9f452e8acf
113
cg/cg0200.cpp
113
cg/cg0200.cpp
@ -11,6 +11,7 @@
|
||||
|
||||
#include <anagr.h>
|
||||
#include <anafis.h>
|
||||
#include <anagiu.h>
|
||||
#include <cfven.h>
|
||||
#include <clifo.h>
|
||||
#include <comuni.h>
|
||||
@ -65,6 +66,7 @@ protected:
|
||||
|
||||
static bool tipocf_handler(TMask_field& f, KEY key);
|
||||
static bool tipo_handler(TMask_field& f, KEY key);
|
||||
static bool crea_percipienti(TMask_field& f, KEY key);
|
||||
static bool percip_handler(TMask_field& f, KEY key);
|
||||
static bool email_handler(TMask_field& f, KEY k);
|
||||
static bool rsoc_handler(TMask_field& f, KEY k);
|
||||
@ -284,20 +286,104 @@ bool TClifo_application::tipo_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const bool fis = f.get() == "F";
|
||||
m.show(-5, app()._lbcn && fis);
|
||||
m.show(-5, fis);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TClifo_application::crea_percipienti(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_SPACE)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
TToken_string k;
|
||||
long percip = m.get_long(F_CODANAGPER);
|
||||
const char tipo = m.get(F_TIPOAPER)[0];
|
||||
|
||||
if (percip == 0)
|
||||
{
|
||||
percip = m.get_long(F_CODCF);
|
||||
k.add(tipo);
|
||||
k.add(percip);
|
||||
const TRectype & rec = cache().get(LF_ANAG, k);
|
||||
|
||||
if (!rec.empty())
|
||||
return error_box("Esiste gia' una anagrafica con codice uguale del fornitore");
|
||||
m.set(F_CODANAGPER, percip);
|
||||
}
|
||||
else
|
||||
{
|
||||
k.add(m.get(F_TIPOAPER));
|
||||
k.add(percip);
|
||||
const TRectype & rec = cache().get(LF_ANAG, k);
|
||||
if (!rec.empty())
|
||||
return true;
|
||||
}
|
||||
|
||||
anag.put(ANA_TIPOA, tipo);
|
||||
anag.put(ANA_CODANAGR, percip);
|
||||
anag.put(ANA_COFI, m.get(F_COFI));
|
||||
anag.put(ANA_PAIV, m.get(F_PAIV));
|
||||
anag.put(ANA_RAGSOC, m.get(F_RAGSOC));
|
||||
anag.put(ANA_STATORES, m.get(F_STATOCF));
|
||||
anag.put(ANA_COMRES, m.get(F_COMCF));
|
||||
anag.put(ANA_INDRES, m.get(F_INDCF));
|
||||
anag.put(ANA_CIVRES, m.get(F_CIVCF));
|
||||
anag.put(ANA_CAPRES, m.get(F_CAPCF));
|
||||
|
||||
int err = anag.write();
|
||||
|
||||
if (err == NOERR)
|
||||
{
|
||||
if (tipo == 'F')
|
||||
{
|
||||
TLocalisamfile anafis(LF_ANAGFIS);
|
||||
|
||||
anafis.put(ANF_CODANAGR, percip);
|
||||
anafis.put(ANF_DATANASC, m.get(F_DATANASC));
|
||||
anafis.put(ANF_SESSO, atoi(m.get(F_COFI).mid(9, 2)) > 31 ? 'F' : 'M');
|
||||
anafis.put(ANF_COMNASC, m.get(F_COMNASC));
|
||||
err = anafis.write();
|
||||
if (err != NOERR)
|
||||
return message_box("Scrittura anagrafica persona fisica Errore %d", err);
|
||||
}
|
||||
else
|
||||
{
|
||||
TLocalisamfile anagiu(LF_ANAGGIU);
|
||||
|
||||
anagiu.put(ANG_CODANAGR, percip);
|
||||
|
||||
err = anagiu.write();
|
||||
if (err != NOERR)
|
||||
return message_box("Scrittura anagrafica persona fisica Errore %d", err);
|
||||
}
|
||||
}
|
||||
else
|
||||
return message_box("Scrittura anagrafica Errore %d", err);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TClifo_application::percip_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
|
||||
if (f.to_check(key) && !m.field(F_CODANAGPER).empty())
|
||||
{
|
||||
const TRectype& anag = m.efield(F_CODANAGPER).browse()->cursor()->file().curr();
|
||||
long percip = m.get_long(F_CODANAGPER);
|
||||
const char tipo = m.get(F_TIPOAPER)[0];
|
||||
TToken_string k;
|
||||
|
||||
k.add(tipo);
|
||||
k.add(percip);
|
||||
const TRectype & anag = cache().get(LF_ANAG, k);
|
||||
const TString& c = m.get(F_COFI), p = m.get(F_PAIV);
|
||||
|
||||
if (key == K_TAB && anag.empty())
|
||||
return true;
|
||||
|
||||
if ((c.full() && c != anag.get(ANA_COFI)) ||
|
||||
(p.full() && p != anag.get(ANA_PAIV)))
|
||||
return error_box(TR("Percipiente non corretto: codice fiscale o partita IVA diversa"));
|
||||
@ -322,21 +408,17 @@ bool TClifo_application::percip_handler(TMask_field& f, KEY key)
|
||||
if (p.empty()) m.set(F_PAIV, anag.get(ANA_PAIV));
|
||||
if (m.get(F_TIPOAPER) == "F")
|
||||
{
|
||||
m.show(-5, app()._lbcn);
|
||||
if (app()._lbcn)
|
||||
const TRectype & fis = cache().get(LF_ANAGFIS, anag.get(ANA_CODANAGR));
|
||||
|
||||
if (!fis.empty())
|
||||
{
|
||||
const TRectype & fis = cache().get(LF_ANAGFIS, anag.get(ANA_CODANAGR));
|
||||
|
||||
if (!fis.empty())
|
||||
if (m.get(F_DATANASC).empty()) m.set(F_DATANASC, fis.get(ANF_DATANASC));
|
||||
if (m.get(F_COMNASC).empty())
|
||||
{
|
||||
if (m.get(F_DATANASC).empty()) m.set(F_DATANASC, fis.get(ANF_DATANASC));
|
||||
if (m.get(F_COMNASC).empty())
|
||||
{
|
||||
m.set(F_STATONASC, fis.get(ANF_STATONASC), true);
|
||||
m.set(F_COMNASC, fis.get(ANF_COMNASC), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
m.set(F_STATONASC, fis.get(ANF_STATONASC), true);
|
||||
m.set(F_COMNASC, fis.get(ANF_COMNASC), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -861,6 +943,7 @@ bool TClifo_application::user_create() // initvar e arrmask
|
||||
_msk->set_handler(F_PAIV, paiv_handler);
|
||||
_msk->set_handler(F_CODANAGPER, percip_handler);
|
||||
_msk->set_handler(F_TIPOPERS, tipo_handler);
|
||||
_msk->set_handler(DLG_ANAG, crea_percipienti);
|
||||
_msk->set_handler(F_ALLEG, alleg_handler);
|
||||
_msk->set_handler(F_CODALLEG, codalleg_handler);
|
||||
_msk->set_handler(DLG_EMAIL, email_handler);
|
||||
|
@ -166,6 +166,7 @@
|
||||
#define F_DIRTY 305
|
||||
#define F_BYMAIL 306
|
||||
#define F_DOCMAIL 307
|
||||
#define DLG_ANAG 308
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
|
@ -1,28 +1,25 @@
|
||||
#include "cg0200.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
||||
#include <relapbar.h>
|
||||
|
||||
ENDPAGE
|
||||
TOOLBAR "" 0 -2 0 2
|
||||
TOOLBAR "" 0 18 0 4
|
||||
|
||||
BUTTON DLG_EMAIL 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -11 "~Posta"
|
||||
PROMPT -56 -3 "~Posta"
|
||||
PICTURE BMP_EMAIL
|
||||
END
|
||||
|
||||
GOLEM DLG_OGGETTI 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -11 ""
|
||||
PROMPT -66 -3 ""
|
||||
FIELD OGGETTI
|
||||
FLAGS "M"
|
||||
END
|
||||
|
||||
#include <toolbar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Pag.1" 0 0 0 -4
|
||||
PAGE "Pag.1" -1 -1 78 19
|
||||
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
@ -523,6 +520,12 @@ BEGIN
|
||||
ITEM "G|Giuridica"
|
||||
END
|
||||
|
||||
BUTTON DLG_ANAG 10 1
|
||||
BEGIN
|
||||
PROMPT 45 15 "Crea percipiente"
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
NUMBER F_CODANAGPER 5
|
||||
BEGIN
|
||||
PROMPT 59 15 "Codice "
|
||||
@ -538,7 +541,7 @@ BEGIN
|
||||
OUTPUT F_CODANAGPER CODANAGR
|
||||
OUTPUT F_RAGSOC1 RAGSOC
|
||||
HELP "Codice anagrafico percepiente per la compilazione Mod. 770"
|
||||
CHECKTYPE NORMAL
|
||||
CHECKTYPE SEARCH
|
||||
WARNING "Percipiente assente"
|
||||
ADD RUN ba4 -1 #F_TIPOAPER
|
||||
END
|
||||
|
Loading…
x
Reference in New Issue
Block a user