cg2100.cpp Aggiunte funzioni per import/export per il Somalo

cg2100a.uml   Tolta data si competenza
cg2100b.uml   Tolto required dalla data di competenza
cg2100c.uml   Tolto required dalla data di competenza
cg2102.cpp    Corretto handler della data di competenza
cg2102.h      Aggiunti metodi per l'Eritreo
cg2104.cpp    Adattato pag_notify per gestire meglio l'Etiope


git-svn-id: svn://10.65.10.50/trunk@4241 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1997-03-28 12:03:29 +00:00
parent 871e5c3f66
commit 71bc283eb7
7 changed files with 207 additions and 28 deletions

View File

@ -12,6 +12,9 @@
// Nomi dei campi // Nomi dei campi
#include <mov.h> #include <mov.h>
#include <rmov.h>
#include <rmoviva.h>
#include <scadenze.h>
#include <clifo.h> #include <clifo.h>
#include <rcausali.h> #include <rcausali.h>
@ -58,8 +61,9 @@ TMask* TPrimanota_application::load_mask(int n)
{ {
m->set_handler(F_NUMREG, num_handler); m->set_handler(F_NUMREG, num_handler);
m->set_handler(F_CODCAUS, caus_query_handler); m->set_handler(F_CODCAUS, caus_query_handler);
m->set_handler(F_DATAREG, datareg_handler); m->set_handler(F_DATAREG, datareg_handler);
m->set_handler(F_DATACOMP, datacomp_handler); // DATACOM new way
// m->set_handler(F_DATACOMP, datacomp_handler);
TConfig c(CONFIG_STUDIO, "cg"); TConfig c(CONFIG_STUDIO, "cg");
@ -537,8 +541,9 @@ void TPrimanota_application::init_query_mode(TMask& m)
} }
else else
{ {
m.set(F_DATAREG, _last_dreg); m.set(F_DATAREG, _last_dreg);
m.set(F_DATACOMP, _last_dcom); // DATACOMP new way
// m.set(F_DATACOMP, _last_dcom);
} }
_incasso->_step = 0; // Azzera flag di incasso immediato _incasso->_step = 0; // Azzera flag di incasso immediato
@ -601,7 +606,10 @@ const char* TPrimanota_application::get_next_key()
_tmp.add(m.get(F_DATAREG)); _tmp.add(m.get(F_DATAREG));
_tmp.add(F_DATACOMP); // Ricopia data competenza _tmp.add(F_DATACOMP); // Ricopia data competenza
_tmp.add(m.get(F_DATACOMP)); if (m.field(F_DATACOMP).empty())
_tmp.add(m.get(F_DATAREG));
else
_tmp.add(m.get(F_DATACOMP));
if (iva() == iva_vendite) if (iva() == iva_vendite)
{ {
@ -1554,6 +1562,164 @@ bool TPrimanota_application::link_m770()
return tipo_coll > 0; return tipo_coll > 0;
} }
HIDDEN void ini2bill(TConfig& ini, TBill& bil, bool contro)
{
char tipo = ini.get_char(contro ? "TIPOC" : "TIPO");
int gruppo = ini.get_int(contro ? "GRUPPOC" : "GRUPPO");
int conto = ini.get_int(contro ? "CONTOC" : "CONTO");
long sottoconto = ini.get_long(contro ? "SOTTOCONTOC" : "SOTTOCONTO");
bil.set(gruppo, conto, sottoconto, tipo);
}
HIDDEN bool set_not_empty(TMask& msk, int id, TConfig& ini, const char* var)
{
const TString& val = ini.get(var);
bool ok = val.not_empty();
if (ok)
msk.set(id, val);
return ok;
}
HIDDEN bool add_not_empty(TToken_string& str, int pos, TConfig& ini, const char* var)
{
const TString& val = ini.get(var);
bool ok = val.not_empty();
if (ok)
str.add(val, pos);
return ok;
}
void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
{
TRelation_application::ini2mask(ini, msk, query);
if (query)
{
set_not_empty(msk, F_CODCAUS, ini, MOV_CODCAUS);
set_not_empty(msk, F_DATAREG, ini, MOV_DATAREG);
}
else
{
int i;
TSheet_field& is = ivas();
for (i = 0; ini.set_paragraph(format("25,%d", i+1)); i++)
{
TToken_string& riga = is.row(i);
iva_notify(is, i, K_SPACE);
add_not_empty(riga, 0, ini, RMI_IMPONIBILE); // Imponibile 101
add_not_empty(riga, 1, ini, RMI_CODIVA); // IVA 102
add_not_empty(riga, 2, ini, RMI_TIPODET); // Detrazione 103
add_not_empty(riga, 3, ini, RMI_IMPOSTA); // Imposta 104
TBill c; ini2bill(ini, c, FALSE);
if (c.gruppo() > 0)
c.add_to(riga, 4, 0x7); // Conto 105-110
iva_notify(is, i, K_ENTER);
}
TSheet_field& cg = cgs();
for (i = 0; ini.set_paragraph(format("24,%d", i+1)); i++)
{
TToken_string& riga = cg.row(-1);
TImporto import(ini.get_char(RMV_SEZIONE), real(ini.get(RMV_IMPORTO)));
if (!import.is_zero())
import.add_to(riga, 0); // Dare/Avere 101-102
TBill conto; ini2bill(ini, conto, FALSE);
if (conto.gruppo() > 0)
conto.add_to(riga, 2, 0x3); // Conto 103-107
riga.add("", 7); // Codice descrizione 108
riga.add(ini.get(RMV_DESCR), 8); // Descrizione riga 109
ini2bill(ini, conto, TRUE);
if (conto.gruppo() > 0)
conto.add_to(riga, 9, 0x3); // Contropartita 110-114
riga.add(ini.get(RMV_NUMGIO), 13);
const char tipo = ini.get_char(RMV_ROWTYPE);
riga.add(tipo, 14); // Tipo di riga 115
disable_cgs_cells(i, tipo);
}
calcola_imp(); // Calcola totale imponibile ed imposte
TSheet_field& pag = pags();
const int start_items = pag.items();
msk.reset(FS_RECALC); // Disabilita ricalcolo automatico
for (i = 0; ini.set_paragraph(format("29,%d", i+1)); i++)
{
TToken_string& row = pag.row(i);
if (i >= start_items)
pag_notify(pag, i, K_CTRL+K_INS);
pag_notify(pag, i, K_SPACE);
add_not_empty(row, 0, ini, SCAD_DATASCAD);
add_not_empty(row, 1, ini, SCAD_IMPORTO);
add_not_empty(row, 2, ini, SCAD_IMPORTOVAL);
pag_notify(pag, i, K_ENTER);
}
pagamento().set_sheet(pag);
}
}
void TPrimanota_application::mask2ini(TMask& msk, TConfig& ini)
{
TRelation_application::mask2ini(msk, ini);
int i, f;
for (i = 0; i < _rel->cg_items(); i++)
{
ini.set_paragraph(format("24,%d", i+1));
const TRectype& rec = _rel->cg(i);
for (f = rec.items()-1; f >= 0; f--)
{
const char* name = rec.fieldname(f);
ini.set(name, rec.get(name));
}
}
for (i = 0; i < _rel->iva_items(); i++)
{
ini.set_paragraph(format("25,%d", i+1));
const TRectype& rec = _rel->iva(f);
for (f = rec.items()-1; f >= 0; f--)
{
const char* name = rec.fieldname(i);
ini.set(name, rec.get(name));
}
}
if (is_fattura())
{
const long numreg = _rel->lfile().get_long(MOV_NUMREG);
TPartita* game = partite().first();
if (game)
{
const int rigafatt = game->prima_fattura(numreg);
if (rigafatt > 0)
{
const TRiga_partite& riga = game->riga(rigafatt);
for (int r = 1; r <= riga.rate(); r++)
{
ini.set_paragraph(format("29,%d", r));
const TRectype& rec = riga.rata(r);
for (f = rec.items()-1; f >= 0; f--)
{
const char* name = rec.fieldname(i);
ini.set(name, rec.get(name));
}
}
}
}
}
}
int cg2100 (int argc, char** argv) int cg2100 (int argc, char** argv)
{ {

View File

@ -65,6 +65,8 @@ BEGIN
FLAGS "D" FLAGS "D"
END END
/* DATACOMP new way
DATE F_DATACOMP DATE F_DATACOMP
BEGIN BEGIN
PROMPT 3 9 "Data di competenza " PROMPT 3 9 "Data di competenza "
@ -77,6 +79,7 @@ BEGIN
PROMPT 52 9 "Codice esercizio " PROMPT 52 9 "Codice esercizio "
FLAGS "DRZ" FLAGS "DRZ"
END END
*/
STRING F_CODCAUS 3 STRING F_CODCAUS 3
BEGIN BEGIN

View File

@ -54,8 +54,9 @@ BEGIN
PROMPT 1 4 "Data di competenza " PROMPT 1 4 "Data di competenza "
HELP "Data di competenza dell'operazione" HELP "Data di competenza dell'operazione"
FIELD DATACOMP FIELD DATACOMP
CHECKTYPE REQUIRED
MESSAGE COPY,K_DATACOMP MESSAGE COPY,K_DATACOMP
// DATACOMP NEW WAY
// CHECKTYPE REQUIRED
END END
NUMBER F_ANNOES 4 NUMBER F_ANNOES 4

View File

@ -67,7 +67,7 @@ END
NUMBER F_ANNOIVA 4 NUMBER F_ANNOIVA 4
BEGIN BEGIN
PROMPT 32 3 "Anno IVA " PROMPT 32 3 "Anno IVA "
FIELD ANNOIVA FIELD ANNOIVA
FLAGS "D" FLAGS "D"
END END
@ -76,7 +76,8 @@ DATE F_DATACOMP
BEGIN BEGIN
PROMPT 1 4 "Data competenza " PROMPT 1 4 "Data competenza "
FIELD DATACOMP FIELD DATACOMP
CHECKTYPE REQUIRED // DATACOMP NEW WAY
// CHECKTYPE REQUIRED
END END
NUMBER F_ANNOES 4 NUMBER F_ANNOES 4

View File

@ -1596,8 +1596,9 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
if (ok) // Riempie a mano i campi necessari nel caso non sia stato usata la ricerca F9 if (ok) // Riempie a mano i campi necessari nel caso non sia stato usata la ricerca F9
{ {
TMask& m = f.mask(); TMask& m = f.mask();
m.set(F_DATAREG, mov.get("DATAREG"), TRUE); m.set(F_DATAREG, mov.get("DATAREG"), TRUE);
m.set(F_DATACOMP, mov.get("DATACOMP"), TRUE); // DATACOMP new way
// m.set(F_DATACOMP, mov.get("DATACOMP"), TRUE);
m.set(F_CODCAUS, mov.get("CODCAUS")); m.set(F_CODCAUS, mov.get("CODCAUS"));
f.set_focusdirty(FALSE); f.set_focusdirty(FALSE);
return m.stop_run(K_AUTO_ENTER); return m.stop_run(K_AUTO_ENTER);
@ -1777,7 +1778,9 @@ bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
if (datacomp.empty()) if (datacomp.empty())
{ {
datacomp = dr.string(); datacomp = dr.string();
f.set(datacomp); // DATACOMP new way
if (key == K_ENTER)
f.set(datacomp);
} }
const TDate dc(datacomp); // Data di competenza const TDate dc(datacomp); // Data di competenza
TEsercizi_contabili& esc = app()._esercizi; TEsercizi_contabili& esc = app()._esercizi;
@ -1863,8 +1866,9 @@ bool TPrimanota_application::datadoc_handler(TMask_field& f, KEY key)
if (a.is_fattura()) if (a.is_fattura())
{ {
if (m.insert_mode()) if (m.insert_mode())
{ {
a.recalc_scadenze(dd); if (m.get_bool(FS_RECALC)) // Evita scancellamenti indesiderati
a.recalc_scadenze(dd);
} }
else else
{ {

View File

@ -146,6 +146,8 @@ protected: // TApplication
virtual void on_config_change(); virtual void on_config_change();
virtual void print(); virtual void print();
virtual bool menu(MENU_TAG m); virtual bool menu(MENU_TAG m);
virtual void ini2mask(TConfig& ini, TMask& msk, bool query);
virtual void mask2ini(TMask& msk, TConfig& ini);
protected: // TRelation_application protected: // TRelation_application
virtual bool user_create(); virtual bool user_create();

View File

@ -26,8 +26,10 @@ TPagamento& TPrimanota_application::pagamento() const
bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k) bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
{ {
TMask* msk = &(ps.mask()); TMask* msk = &(ps.mask());
if (!msk->is_running()) return TRUE; // Necessario per evitare il CHECK sul pagamento nullo
// if (!msk->is_running()) return TRUE; // Necessario per evitare il CHECK sul pagamento nullo
if (!app().is_fattura()) return TRUE; // Necessario per evitare il CHECK sul pagamento nullo
TPagamento& pag = app().pagamento(); TPagamento& pag = app().pagamento();
TString_array& rws = app().pag_rows(); TString_array& rws = app().pag_rows();
@ -67,7 +69,6 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
newp = ns.get(3); // Percentuale newp = ns.get(3); // Percentuale
newt = ns.get(4); // Tipo pagamento newt = ns.get(4); // Tipo pagamento
newu = ns.get(5); // Ulteriore classificazione newu = ns.get(5); // Ulteriore classificazione
// qui viene il bello, si fa per dire // qui viene il bello, si fa per dire
if (news != ts.get(0)) // modificata data scadenza if (news != ts.get(0)) // modificata data scadenza
@ -91,7 +92,8 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
if (newu != ts.get(5)) // modificata ulteriore classificazione if (newu != ts.get(5)) // modificata ulteriore classificazione
mod = m_ulc = TRUE; mod = m_ulc = TRUE;
else if (m_tipo) { else if (m_tipo)
{
// forza reset di ulc se si e' modificato il tipo rata // forza reset di ulc se si e' modificato il tipo rata
m_ulc = TRUE; m_ulc = TRUE;
newu = ""; newu = "";
@ -155,8 +157,9 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
ahiahi = P_OK; ahiahi = P_OK;
// put data as they are // put data as they are
TToken_string& trw = pag.rata(r); TToken_string& trw = pag.rata(r);
TToken_string srw = trw; TToken_string& trs = ps.row(r);
if (m_tipo) trw.add(newt,2); if (m_tipo)
trw.add(newt,2);
if (m_ulc) if (m_ulc)
trw.add(newu, 5); trw.add(newu, 5);
if (m_scad) if (m_scad)
@ -169,7 +172,8 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
if (pag.mese_commerciale() && (scd % 30) != 0) if (pag.mese_commerciale() && (scd % 30) != 0)
scd = 30 * ((scd/30)+1); scd = 30 * ((scd/30)+1);
trw.add(scd, 0); trw.add(scd, 0);
} }
trs.add(news, 0);
} }
if (m_impl) if (m_impl)
{ {
@ -179,22 +183,20 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
// si ricalcola la percentuale a modifica importo in lire solo // si ricalcola la percentuale a modifica importo in lire solo
// se non c'e' l'importo in valuta // se non c'e' l'importo in valuta
const real p = pag.recalc_percrata(r, FALSE); const real p = pag.recalc_percrata(r, FALSE);
ps.row(r).add(p.string(), 3); trs.add(p.string(), 3);
} }
ps.force_update(r);
} }
if (m_impv) if (m_impv)
{ {
trw.add(newv,4); trw.add(newv,4);
const real p = pag.recalc_percrata(r, TRUE); const real p = pag.recalc_percrata(r, TRUE);
ps.row(r).add(p.string(), 3); trs.add(p.string(), 3);
ps.force_update(r);
} }
else
if (m_tipo)
ps.force_update(r);
if (mod) if (mod)
rws.row(r) = ps.row(r); {
rws.row(r) = trs;
ps.force_update(r);
}
} }
if (ahiahi) // any error? Rimetti le righe com'erano prima if (ahiahi) // any error? Rimetti le righe com'erano prima