Leggere modifiche al programma clienti (eliminazione di variabili static)
Correzione errori cancellazione movimenti provvisori (che pero' non funzionano ancora) Aggiunta classe TBill da cui deriva TConto git-svn-id: svn://10.65.10.50/trunk@278 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d16636c484
commit
5f655ece6d
@ -35,6 +35,9 @@ class CG0200_application : public TRelation_application
|
||||
TLocalisamfile* _comuni;
|
||||
TLocalisamfile* _pcon;
|
||||
|
||||
bool _lbcn;
|
||||
|
||||
protected:
|
||||
bool user_create();
|
||||
bool user_destroy();
|
||||
virtual TMask* get_mask(int mode) {return _msk;}
|
||||
@ -60,13 +63,15 @@ class CG0200_application : public TRelation_application
|
||||
void common_f(const TMask& m);
|
||||
///////////
|
||||
|
||||
public:
|
||||
static bool tipo_handler(TMask_field& f, KEY key);
|
||||
static bool percip_handler(TMask_field& f, KEY key);
|
||||
|
||||
public:
|
||||
virtual TRelation* get_relation() const {return (TRelation*)_rel;}
|
||||
CG0200_application() {}
|
||||
};
|
||||
|
||||
inline CG0200_application& app()
|
||||
{return (CG0200_application&)*MainApp();}
|
||||
inline CG0200_application& app() { return (CG0200_application&)main_app(); }
|
||||
|
||||
bool CG0200_application::protected_record(TRectype &rec)
|
||||
|
||||
@ -123,8 +128,7 @@ HIDDEN bool no_dup_fis(TMask_field& f, KEY key)
|
||||
TMask& msk = f.mask() ;
|
||||
|
||||
if (msk.query_mode() || !f.to_check(key)) return TRUE;
|
||||
CG0200_application* app = (CG0200_application*) MainApp();
|
||||
TLocalisamfile& clifo = app->get_relation()->lfile(LF_CLIFO) ;
|
||||
TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ;
|
||||
|
||||
if ( f.get().not_empty() && !clifo.empty() )
|
||||
{
|
||||
@ -156,8 +160,7 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
|
||||
|
||||
if (msk.query_mode() || !f.to_check(key)) return TRUE;
|
||||
|
||||
CG0200_application* app = (CG0200_application*) MainApp();
|
||||
TLocalisamfile& clifo = app->get_relation()->lfile(LF_CLIFO) ;
|
||||
TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ;
|
||||
|
||||
if ( f.get().not_empty() && !clifo.empty() )
|
||||
{
|
||||
@ -205,16 +208,14 @@ HIDDEN bool autoexit_handler(TMask_field& f, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HIDDEN bool lbcn = FALSE;
|
||||
|
||||
HIDDEN bool tipo_handler(TMask_field& f, KEY key)
|
||||
bool CG0200_application::tipo_handler(TMask_field& f, KEY key)
|
||||
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
|
||||
const bool fis = f.get() == "F";
|
||||
|
||||
m.send_key(K_SHIFT + K_CTRL + (lbcn && fis ? 's' : 'h'), -5);
|
||||
m.send_key(K_SHIFT + K_CTRL + (app()._lbcn && fis ? 's' : 'h'), -5);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -237,20 +238,19 @@ else // If it's a CUSTOMER enable pages
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HIDDEN bool percip_handler(TMask_field& f, KEY key)
|
||||
|
||||
bool CG0200_application::percip_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
|
||||
|
||||
if (f.to_check(key) && m.get(F_CODANAGPER).not_empty())
|
||||
{
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
TString c(m.get(F_COFI)), p(m.get(F_PAIV));
|
||||
TString80 c(m.get(F_COFI)), p(m.get(F_PAIV));
|
||||
|
||||
if ((c.not_empty() && c != anag.get(ANA_COFI)) ||
|
||||
(p.not_empty() && p != anag.get(ANA_PAIV))) return error_box("Percipiente non corretto");
|
||||
TString r(anag.get(ANA_RAGSOC));
|
||||
TString80 r(anag.get(ANA_RAGSOC));
|
||||
if (m.get(F_RAGSOC).empty() ||
|
||||
(key == K_TAB && yesno_box("Ragione sociale differente correggo in %s", (const char*) r)))
|
||||
m.set(F_RAGSOC, r, TRUE);
|
||||
@ -266,8 +266,8 @@ HIDDEN bool 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.send_key(K_SHIFT + K_CTRL + (lbcn ? 's' : 'h'), -5);
|
||||
if (lbcn)
|
||||
m.send_key(K_SHIFT + K_CTRL + (app()._lbcn ? 's' : 'h'), -5);
|
||||
if (app()._lbcn)
|
||||
{
|
||||
TLocalisamfile fis(LF_ANAGFIS);
|
||||
|
||||
@ -363,8 +363,8 @@ void CG0200_application::init_pages(TMask& m)
|
||||
TConfig conf(CONFIG_DITTA, "cg");
|
||||
const bool tipocf=(m.get(F_TIPOCF) == "F");
|
||||
|
||||
lbcn = (conf.get("GsLbCn") == "X");
|
||||
m.send_key(K_SHIFT + K_CTRL + (lbcn ? 's' : 'h'), -5);
|
||||
_lbcn = (conf.get("GsLbCn") == "X");
|
||||
m.send_key(K_SHIFT + K_CTRL + (_lbcn ? 's' : 'h'), -5);
|
||||
// Se non e' abilitata la gestione delle vendite disabilita le
|
||||
// maschere dalla 4 in poi
|
||||
if (!gest_vend() || tipocf)
|
||||
|
@ -837,11 +837,12 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
const TLibro_giornale& gio = app().giornale();
|
||||
if (dr <= gio.last_print())
|
||||
return f.error_box("La data dell'operazione e' antecedente al %s, ultima stampa\n"
|
||||
"del libro giornale dell'esercizio %d", gio.last_reg().string(), ae);
|
||||
return f.error_box("La data dell'operazione e' antecedente al %s,\n"
|
||||
"ultima stampa del libro giornale dell'esercizio %d",
|
||||
gio.last_reg().string(), ae);
|
||||
if (dr < gio.last_reg())
|
||||
warning_box("La data dell'operazione e' antecedente al %s, ultima registrazione\n"
|
||||
"sul libro giornale dell'esercizio %d",
|
||||
warning_box("La data dell'operazione e' antecedente al %s,\n"
|
||||
"ultima registrazione sul libro giornale dell'esercizio %d",
|
||||
gio.last_reg().string(), ae);
|
||||
|
||||
if (m.query_mode())
|
||||
@ -858,13 +859,13 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
|
||||
if (!ok) return FALSE;
|
||||
}
|
||||
|
||||
if (dr <= reg.last_print())
|
||||
return error_box("La data dell'operazione e' antecedente al %s, ultima\n"
|
||||
"data di stampa del registro '%s' dell'anno %d",
|
||||
if (dr < reg.last_print())
|
||||
return error_box("La data dell'operazione e' antecedente al %s,\n"
|
||||
"ultima stampa del registro '%s' dell'anno %d",
|
||||
reg.last_print().string(), (const char*)codreg, dr.year());
|
||||
if (dr < reg.last_reg())
|
||||
warning_box("La data dell'operazione e' antecedente al %s, ultima registrazione\n"
|
||||
"sul registro '%s' dell'anno %d",
|
||||
warning_box("La data dell'operazione e' antecedente al %s,\n"
|
||||
"ultima registrazione sul registro '%s' dell'anno %d",
|
||||
reg.last_reg().string(), (const char*)codreg, dr.year());
|
||||
}
|
||||
}
|
||||
@ -876,15 +877,12 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
|
||||
// Certified 90%
|
||||
bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (!f.to_check(key, TRUE))
|
||||
return TRUE;
|
||||
|
||||
const TDate dc(f.get()); // Data di competenza
|
||||
const int ae = date2esc(dc); // Esercizio corrispondente
|
||||
TMask& m = f.mask();
|
||||
|
||||
if (ae)
|
||||
if ((key == K_TAB && f.focusdirty()) || key == K_ENTER)
|
||||
{
|
||||
const TDate dc(f.get()); // Data di competenza
|
||||
const int ae = date2esc(dc); // Esercizio corrispondente
|
||||
TMask& m = f.mask();
|
||||
|
||||
const char* data = "";
|
||||
if (f.dlg() == F_DATACOMP)
|
||||
{
|
||||
@ -894,19 +892,22 @@ bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
|
||||
else
|
||||
data = "del 74/ter";
|
||||
|
||||
const TDate dr(m.get(F_DATAREG)); // Data operazione
|
||||
int pr; // Esercizio precedente
|
||||
const int ar = date2esc(dr, &pr); // Esercizio in corso
|
||||
if (ae != ar && ae != pr)
|
||||
if (ae)
|
||||
{
|
||||
TString80 e;
|
||||
e << "La data " << data << " deve appartenere all'esercizio " << ar;
|
||||
if (pr > 0) e << " o al " << pr;
|
||||
return f.error_box(e);
|
||||
const TDate dr(m.get(F_DATAREG)); // Data operazione
|
||||
int pr; // Esercizio precedente
|
||||
const int ar = date2esc(dr, &pr); // Esercizio in corso
|
||||
if (ae != ar && ae != pr)
|
||||
{
|
||||
TString80 e;
|
||||
e << "La data " << data << " deve appartenere all'esercizio " << ar;
|
||||
if (pr > 0) e << " o al " << pr;
|
||||
return f.error_box(e);
|
||||
}
|
||||
}
|
||||
else
|
||||
return f.error_box("La data %s non appartiene a nessun esercizio", data);
|
||||
}
|
||||
else
|
||||
return f.error_box("La data non appartiene a nessun esercizio");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -240,22 +240,22 @@ TCausale::TCausale(const char* cod, int year)
|
||||
// Legge le righe della causale attualmente selezionata sulla maschera
|
||||
bool TCausale::read(const char* cod, int year)
|
||||
{
|
||||
destroy(); // Delete all rows
|
||||
TLocalisamfile caus(LF_CAUSALI);
|
||||
|
||||
_iva = iva_errata;
|
||||
_rec = caus.curr(); _rec.zero(); // Delete header
|
||||
destroy(); // Delete all rows
|
||||
_iva = iva_errata; // Delete misc info
|
||||
_sezione_clifo = _sezione_ritsoc = ' ';
|
||||
|
||||
if (*cod > ' ')
|
||||
{
|
||||
|
||||
TLocalisamfile caus(LF_CAUSALI);
|
||||
caus.setkey(1);
|
||||
caus.zero();
|
||||
caus.put(CAU_CODCAUS, cod);
|
||||
|
||||
int err = caus.read();
|
||||
_rec = caus.curr();
|
||||
if (err != NOERR) return FALSE;
|
||||
_rec = caus.curr();
|
||||
|
||||
TLocalisamfile rcaus(LF_RCAUSALI);
|
||||
rcaus.setkey(1);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <progind.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
#include "cg2200.h"
|
||||
@ -9,6 +10,28 @@
|
||||
#include <rmov.h>
|
||||
#include <rmoviva.h>
|
||||
|
||||
TString& add_plural(TString& s, long num, const char* name)
|
||||
{
|
||||
const TFixed_string n(name);
|
||||
const char last = *n.right(1);
|
||||
|
||||
if (num < 1)
|
||||
{
|
||||
s << "nessun";
|
||||
if (strchr("aeiou", n[0]) == NULL)
|
||||
s << last;
|
||||
s << ' ' << name;
|
||||
}
|
||||
else
|
||||
{
|
||||
s << num << ' ' << name;
|
||||
if (num > 1)
|
||||
s[s.len()-1] = (last == 'a') ? 'e' : 'i';
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
class TDeleteprovv_app : public TApplication
|
||||
{
|
||||
protected:
|
||||
@ -33,42 +56,75 @@ bool TDeleteprovv_app::destroy()
|
||||
|
||||
bool TDeleteprovv_app::menu(MENU_TAG)
|
||||
{
|
||||
TLocalisamfile mov(LF_MOV), rmov(LF_RMOV), rmoviva(LF_RMOVIVA);
|
||||
TMask m("cg2200a");
|
||||
TCursor& cur = *m.efield(F_FROMDATE).browse()->cursor();
|
||||
TLocalisamfile& mov = cur.file(LF_MOV);
|
||||
TLocalisamfile rmov(LF_RMOV);
|
||||
TLocalisamfile rmoviva(LF_RMOVIVA);
|
||||
|
||||
while (m.run() != K_QUIT)
|
||||
{
|
||||
mov.setkey(2);
|
||||
rmov.setkey(1);
|
||||
rmoviva.setkey(1);
|
||||
|
||||
TRectype to(mov.curr());
|
||||
to.zero();
|
||||
to.put(MOV_DATAREG, m.get(F_TODATE));
|
||||
to.put(MOV_NUMREG, m.get(F_TOREG));
|
||||
TRecnotype last = cur.items()-1;
|
||||
mov.zero();
|
||||
const char* s = m.get(F_TODATE);
|
||||
if (*s)
|
||||
{
|
||||
mov.put(MOV_DATAREG, s);
|
||||
mov.put(MOV_NUMREG, m.get(F_TOREG));
|
||||
last = cur.read();
|
||||
}
|
||||
|
||||
mov.zero();
|
||||
mov.put(MOV_DATAREG, m.get(F_FROMDATE));
|
||||
mov.put(MOV_NUMREG, m.get(F_FROMREG));
|
||||
for (mov.read(_isequal, _lock); mov.good(); mov.next())
|
||||
const TRecnotype first = cur.read();
|
||||
|
||||
const TRecnotype total = last-first+1;
|
||||
TString80 caption("Cancellazione di ");
|
||||
add_plural(caption, total, "movimento");
|
||||
|
||||
if (!yesno_box(caption))
|
||||
continue;
|
||||
|
||||
TProgind pi(total, caption, FALSE, TRUE, 24);
|
||||
|
||||
for (cur = first; cur.pos() <= last; ++cur)
|
||||
{
|
||||
if (mov.curr() > to) break;
|
||||
const long numreg = mov.get_long(MOV_NUMREG);
|
||||
for (int rig = 1; ; rig++)
|
||||
|
||||
int err = cur.lock();
|
||||
for (int rig = 1; err == NOERR; rig++)
|
||||
{
|
||||
rmov.put(RMV_NUMREG, numreg);
|
||||
rmov.put(RMV_NUMRIG, rig);
|
||||
if (rmov.read(_isequal, _lock) != NOERR) break;
|
||||
rmov.remove();
|
||||
err = rmov.remove();
|
||||
if (err != NOERR)
|
||||
caption.format("riga contabile %d", rig);
|
||||
}
|
||||
for (rig = 1; ; rig++)
|
||||
for (rig = 1; err == NOERR; rig++)
|
||||
{
|
||||
rmov.put(RMI_NUMREG, numreg);
|
||||
rmoviva.put(RMI_NUMREG, numreg);
|
||||
rmoviva.put(RMI_NUMRIG, rig);
|
||||
if (rmoviva.read(_isequal, _lock) != NOERR) break;
|
||||
rmov.remove();
|
||||
err = rmov.remove();
|
||||
if (err != NOERR)
|
||||
caption.format("riga IVA %d", rig);
|
||||
}
|
||||
|
||||
if (err == NOERR)
|
||||
err = mov.remove();
|
||||
else
|
||||
caption = "testata";
|
||||
|
||||
if (err == NOERR)
|
||||
pi.addstatus(1);
|
||||
else
|
||||
{
|
||||
error_box("Errore %d nella cancellazione della %s del movimento %ld",
|
||||
err, (const char*)caption, numreg);
|
||||
break;
|
||||
}
|
||||
mov.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,6 +135,6 @@ bool TDeleteprovv_app::menu(MENU_TAG)
|
||||
int cg2200(int argc, char** argv)
|
||||
{
|
||||
TDeleteprovv_app a;
|
||||
a.run(argc, argv, "Cancellazione movimenti provvisori");
|
||||
a.run(argc, argv, "Eliminazione movimenti provvisori");
|
||||
return 0;
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
#include "cg2200.h"
|
||||
|
||||
PAGE "Eliminazione Movimenti Provvisori" -1 -1 44 9
|
||||
PAGE "Eliminazione Movimenti Provvisori" -1 -1 42 9
|
||||
|
||||
GROUPBOX DLG_NULL 42 3
|
||||
GROUPBOX DLG_NULL 40 3
|
||||
BEGIN
|
||||
PROMPT 1 1 "Dal movimento"
|
||||
END
|
||||
@ -13,11 +13,11 @@ BEGIN
|
||||
USE LF_MOV KEY 2 SELECT PROVVIS="P"
|
||||
INPUT DATAREG F_FROMDATE
|
||||
INPUT NUMREG F_FROMREG
|
||||
DISPLAY "Data@10" DATAREG
|
||||
DISPLAY "Numero@6" NUMREG
|
||||
DISPLAY "Causale" CODCAUS
|
||||
DISPLAY "Documento" NUMDOC
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Data@10" DATAREG
|
||||
DISPLAY "Numero@6" NUMREG
|
||||
DISPLAY "Causale" CODCAUS
|
||||
DISPLAY "Documento" NUMDOC
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_FROMDATE DATAREG
|
||||
OUTPUT F_FROMREG NUMREG
|
||||
CHECKTYPE NORMAL
|
||||
@ -26,10 +26,10 @@ END
|
||||
NUMBER F_FROMREG 5
|
||||
BEGIN
|
||||
PROMPT 22 2 "Operazione "
|
||||
FLAGS "D"
|
||||
FLAGS "DR"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 42 3
|
||||
GROUPBOX DLG_NULL 40 3
|
||||
BEGIN
|
||||
PROMPT 1 4 "Al movimento"
|
||||
END
|
||||
@ -37,17 +37,22 @@ END
|
||||
DATE F_TODATE
|
||||
BEGIN
|
||||
PROMPT 2 5 "Data "
|
||||
COPY ALL F_FROMDATE
|
||||
COPY USE F_FROMDATE
|
||||
INPUT DATAREG F_TODATE
|
||||
INPUT NUMREG F_TOREG
|
||||
COPY DISPLAY F_FROMDATE
|
||||
OUTPUT F_TODATE DATAREG
|
||||
OUTPUT F_TOREG NUMREG
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
NUMBER F_TOREG 5
|
||||
BEGIN
|
||||
PROMPT 22 5 "Operazione "
|
||||
FLAGS "D"
|
||||
FLAGS "DR"
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
@ -175,6 +175,7 @@ BEGIN
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT FLD_COCACH CODCAUS
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN cg0 -4
|
||||
FIELD CoCaCh
|
||||
END
|
||||
|
||||
@ -186,6 +187,7 @@ BEGIN
|
||||
INPUT CODCAUS FLD_COCAAP
|
||||
COPY DISPLAY FLD_COCACH
|
||||
OUTPUT FLD_COCAAP CODCAUS
|
||||
ADD RUN cg0 -4
|
||||
CHECKTYPE NORMAL
|
||||
FIELD CoCaAp
|
||||
END
|
||||
@ -464,6 +466,7 @@ BEGIN
|
||||
INPUT CODCAUS FLD_RRCCRA
|
||||
COPY DISPLAY FLD_COCACH
|
||||
OUTPUT FLD_RRCCRA CODCAUS
|
||||
ADD RUN cg0 -4
|
||||
FIELD RrCcRa
|
||||
END
|
||||
|
||||
@ -475,6 +478,7 @@ BEGIN
|
||||
INPUT CODCAUS FLD_RRCCRI
|
||||
COPY DISPLAY FLD_COCACH
|
||||
OUTPUT FLD_RRCCRI CODCAUS
|
||||
ADD RUN cg0 -4
|
||||
FIELD RrCcRi
|
||||
END
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user