Patch level : XX.250

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Riportata la versione aga 07 patch 250 sul main trunk


git-svn-id: svn://10.65.10.50/trunk@10209 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2002-05-08 16:25:49 +00:00
parent c8d8836b4f
commit f9212a2435
122 changed files with 4050 additions and 2512 deletions

View File

@ -353,7 +353,18 @@ bool TInstaller_mask::autoload()
if (module[0] == '_')
add_header(ini, module, FALSE);
else
add_module(ini, module, FALSE);
{
TFilename mod_ini = ininame.path();
mod_ini.add(module);
mod_ini << "inst.ini";
if (mod_ini.exist())
{
TInstall_ini moduleini(mod_ini);
add_module(moduleini, module, FALSE);
}
else
add_module(ini, module, FALSE);
}
}
}
}
@ -1134,7 +1145,7 @@ bool TInstaller_mask::install_handler(TMask_field& fld, KEY key)
if (some)
_curr_mask->install_selection();
else
error_box("Selezionare uno piu' moduli da installare.");
error_box("Selezionare uno o piu' moduli da installare.");
}
return TRUE;
}

View File

@ -37,7 +37,7 @@ protected:
virtual TMask* get_mask(int mode) ;
virtual void write_enable(bool on = TRUE);
static bool fax_handler(TMask_field& f, KEY k);
// static bool fax_handler(TMask_field& f, KEY k);
static bool email_handler(TMask_field& f, KEY k);
static bool ba4200_handler(TMask& m, KEY k);
static bool ind_handler(TMask_field& f, KEY k);
@ -94,7 +94,7 @@ bool TPersone_app::ba4200_handler(TMask& m, KEY k)
return FALSE;
}
bool TPersone_app::fax_handler(TMask_field& f, KEY k)
/*bool TPersone_app::fax_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (k == K_SPACE)
@ -117,7 +117,7 @@ bool TPersone_app::fax_handler(TMask_field& f, KEY k)
}
}
return ok;
}
} */
bool TPersone_app::email_handler(TMask_field& f, KEY k)
{
@ -550,7 +550,7 @@ TMask* TPersone_app::get_mask(int mode)
_msk[MSKF]->set_handler(F_UFFCONC, uff_conc);
_msk[MSKF]->set_handler(F_CODREG96, cod_reg);
_msk[MSKF]->set_handler(F_TITCF, tit_cf);
_msk[MSKF]->set_handler(DLG_FAX, fax_handler);
// _msk[MSKF]->set_handler(DLG_FAX, fax_handler);
_msk[MSKF]->set_handler(DLG_EMAIL, email_handler);
_msk[MSKF]->set_handler(ba4200_handler);
@ -567,7 +567,7 @@ TMask* TPersone_app::get_mask(int mode)
_msk[MSKG]->set_handler(FLD_AG1_PAIV, no_dup_iva_g);
_msk[MSKG]->set_handler(F_UFFCONC, uff_conc);
_msk[MSKG]->set_handler(F_TITCF, tit_cf);
_msk[MSKG]->set_handler(DLG_FAX, fax_handler);
// _msk[MSKG]->set_handler(DLG_FAX, fax_handler);
_msk[MSKG]->set_handler(DLG_EMAIL, email_handler);
_msk[MSKG]->set_handler(ba4200_handler);

View File

@ -15,12 +15,6 @@ PROMPT -36 -3 "~Ditte"
MESSAGE K_F5
END
BUTTON DLG_FAX 10 2
BEGIN
PROMPT -46 -3 "Fa~x"
PICTURE BMP_FAX
END
BUTTON DLG_EMAIL 10 2
BEGIN
PROMPT -56 -3 "~Posta"

View File

@ -14,12 +14,6 @@ BEGIN
MESSAGE K_F5
END
BUTTON DLG_FAX 10 2
BEGIN
PROMPT -46 -3 "Fa~x"
PICTURE BMP_FAX
END
BUTTON DLG_EMAIL 10 2
BEGIN
PROMPT -56 -3 "~Posta"

View File

@ -74,7 +74,8 @@ protected:
virtual bool protected_record(TRectype& rec) { return prefix().exist(rec.get_long("CODDITTA")); }
void set_att_prev(const TMask& m);
static bool fax_handler(TMask_field& f, KEY k);
// static bool fax_handler(TMask_field& f, KEY k);
static bool email_handler(TMask_field& f, KEY k);
public:
TDitte_application();
@ -172,7 +173,7 @@ bool ba4300_handler(TMask& m, KEY k)
TDitte_application::TDitte_application() : _cespiti(FALSE)
{}
bool TDitte_application::fax_handler(TMask_field& f, KEY k)
/*bool TDitte_application::fax_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (k == K_SPACE)
@ -195,10 +196,21 @@ bool TDitte_application::fax_handler(TMask_field& f, KEY k)
}
}
return ok;
} */
bool TDitte_application::email_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMail_message msg(f.mask().get(F_MAIL));
msg.send();
}
return TRUE;
}
bool TDitte_application::user_create() // initvar e arrmask
{
_rel = new TRelation(LF_NDITTE);
_anag = new TLocalisamfile(LF_ANAG);
_unloc = new TLocalisamfile(LF_UNLOC);
@ -207,20 +219,9 @@ bool TDitte_application::user_create() // initvar e arrmask
_cespiti = has_module(CEAUT);
_msk = new TMask("ba4300a") ;
_msk->set_handler(DLG_FAX, fax_handler);
_msk->set_handler(ba4300_handler);
set_search_field(FLD_GD1_CODDITTA);
/*
if (argc() > 2)
{
get_mask(MODE_QUERY);
TString16 s("1|");
s << argv(2) << "|" << argv(2);
set_link(*_msk, s);
}
*/
return TRUE;
}
@ -435,4 +436,3 @@ int ba4300(int argc, char* argv[])
a.run(argc, argv, "Anagrafica Ditte");
return 0;
}

View File

@ -137,4 +137,6 @@
#define FLD_IN_DESSOGDEL 201
#define CHK_IN_NONOBBSTAT 202
#define F_MAIL 203
#endif // __BA4300_H

View File

@ -28,14 +28,14 @@ END
BUTTON DLG_REG1 10 2
BEGIN
PROMPT -56 -3 "Reg.Ces~p."
PROMPT -56 -3 "Reg.~Cesp."
MESSAGE K_F3
END
BUTTON DLG_FAX 10 2
BUTTON DLG_EMAIL 10 2
BEGIN
PROMPT -66 -3 "Fa~x"
PICTURE BMP_FAX
PROMPT -66 -3 "~Posta"
PICTURE BMP_EMAIL
END
#include <toolbar.h>

View File

@ -16,8 +16,8 @@ BEGIN
KEY 1
USE %IND
INPUT CODTAB[1,5] F_DITTAINV
DISPLAY "Ditta" CODTAB
DISPLAY "Num.inv." I0
DISPLAY "Codice Ditta" CODTAB
DISPLAY "Numero inv." I0
DISPLAY "Data invio" D0
DISPLAY "Stato" S6
OUTPUT F_DITTAINV CODTAB

View File

@ -80,16 +80,20 @@ LIST NOC_UMS_OBB 1 50
BEGIN
PROMPT 2 10 "Obbligatorieta' "
ITEM " |Non obbligatoria"
MESSAGE NORMAL,NOC_UMS_CODICE
ITEM "A|Obbligatoria per acquisti"
MESSAGE REQUIRED,NOC_UMS_CODICE
ITEM "C|Obbligatoria per cessioni"
MESSAGE REQUIRED,NOC_UMS_CODICE
ITEM "E|Obbligatoria per acquisti e cessioni"
MESSAGE REQUIRED,NOC_UMS_CODICE
FIELD S4
GROUP 1
END
STRING NOC_UMS_CODICE 2
BEGIN
PROMPT 2 12 "Descrizione "
PROMPT 2 12 "Unita' "
USE %UMS
FLAGS "U"
INPUT CODTAB NOC_UMS_CODICE
@ -98,6 +102,7 @@ BEGIN
OUTPUT NOC_UMS_CODICE CODTAB
OUTPUT NOC_UMS_DESCR S0
CHECKTYPE NORMAL
WARNING "Inserire l'unita` di misura obbligatoria"
FIELD S5
GROUP 1
END

View File

@ -46,41 +46,31 @@ OUTPUT F_DESCR S0
CHECKTYPE REQUIRED
END
LIST F_TRASPORTO 1 20
NUMBER F_TRASPORTO 1
BEGIN
PROMPT 4 7 "Modo di trasporto "
ITEM "1|Marittimo"
ITEM "2|Ferroviario"
ITEM "3|Stradale"
ITEM "4|Aereo"
ITEM "5|Spedizione postale"
ITEM "7|Installazioni fisse"
ITEM "8|Via acqua"
ITEM "9|Propulsione propria"
USE %IMT
INPUT CODTAB F_TRASPORTO
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TRASPORTO CODTAB
CHECKTYPE NORMAL
FIELD I0
END
STRING F_CONSEGNA 3
BEGIN
PROMPT 4 9 "Condizioni consegna "
SHEET "Codice|Descrizione@45"
INPUT F_CONSEGNA
ITEM "EXW|Franco fabbrica"
ITEM "FCA|Franco vettore"
ITEM "FAS|Franco sotto bordo"
ITEM "FOB|Franco a bordo"
ITEM "CFR|Costo e nolo"
ITEM "CIF|Costo, assicurazione, nolo"
ITEM "CPT|Nolo/porto pagato fino a ..."
ITEM "CIP|Nolo/porto e assicurazione pagati fino a ..."
ITEM "DAF|Reso frontiera"
ITEM "DES|Reso franco bordo nave a destino"
ITEM "DEQ|Reso franco banchina"
ITEM "DDU|Reso non sdoganato"
ITEM "DDP|Reso sdoganato"
OUTPUT F_CONSEGNA
USE %ICC
FLAGS "U"
INPUT CODTAB F_CONSEGNA
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CONSEGNA CODTAB
CHECKTYPE NORMAL
FIELD S3
END
ENDPAGE
ENDMASK

View File

@ -22,6 +22,7 @@ BEGIN
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODICE CODTAB
OUTPUT F_DESCR S0
CHECKTYPE REQUIRED
FIELD CODTAB
KEY 1

View File

@ -610,7 +610,8 @@ bool TMov_emask::calc_amm(int tipo)
}
void TMov_emask::set_fondi_inputability()
{
{
/*
if (cespite_nuovo())
{
// Disabilito tutti i campi della pagina per i nuovi cespiti
@ -620,6 +621,7 @@ void TMov_emask::set_fondi_inputability()
set_inputability(prv_ids, ' ');
}
else
*/
{
set_inputability(fis_ids, _s5[10]);
set_inputability(civ_ids, _s5[11]);

View File

@ -35,7 +35,9 @@ SECTION HEADER FIRST 9
MESSAGE RESET,F0->FR_TG_VNONAMM
MESSAGE RESET,F0->FR_TG_TOTRIV
MESSAGE RESET,F0->FR_TG_VALAMM
MESSAGE RESET,F0->FR_TG_RESAMM
MESSAGE RESET,F0->FR_TG_RESAMM
MESSAGE RESET,F0->FR_TG_MINUSVALENZA
MESSAGE RESET,F0->FR_TG_PLUSVALENZA
MESSAGE RESET,F0->FR_TG_PLUSREIN
MESSAGE RESET,F0->FR_TG_FONDOAMM
MESSAGE RESET,F0->FR_TG_QNONAMM
@ -258,7 +260,9 @@ SECTION HEADER EVEN 2
MESSAGE RESET,F1->FR_TC_VNONAMM
MESSAGE RESET,F1->FR_TC_TOTRIV
MESSAGE RESET,F1->FR_TC_VALAMM
MESSAGE RESET,F1->FR_TC_RESAMM
MESSAGE RESET,F1->FR_TC_RESAMM
MESSAGE RESET,F1->FR_TC_MINUSVALENZA
MESSAGE RESET,F1->FR_TC_PLUSVALENZA
MESSAGE RESET,F1->FR_TC_PLUSREIN
MESSAGE RESET,F1->FR_TC_FONDOAMM
MESSAGE RESET,F1->FR_TC_QNONAMM
@ -1527,7 +1531,7 @@ SECTION FOOTER EVEN 6
BEGIN
KEY "Minusvalenza"
PROMPT 8 4 ""
MESSAGE ADD,FO->FR_TG_MINUSVALENZA
MESSAGE ADD,FO->FR_TG_MINUSVALENZA
PICTURE "##.###.###.###.@@@"
END

View File

@ -118,7 +118,7 @@ void TDitta_cespiti::init_mask(TMask& m)
TBit_array found;
bool started = FALSE;
bool finished = FALSE;
for (int i = 0; !finished && i < 18; i++)
for (int i = 0; !finished && i < 18 && i < m.fields(); i++)
{
TMask_field& f = m.fld(i);
if (started)

View File

@ -1,8 +1,8 @@
140
30
CODGRUPPO|2|2|0|Codice gruppo (CGCDGR)
CODSPECIE|2|4|0|Codice specie (CGCDSP)
TIPO|2|1|0|Tipo collegamento ("X" per categoria, " " per cespite) (CGTIPO)
CODSPECIE|1|4|0|Codice specie (CGCDSP)
TIPO|2|1|0|Tipo collegamento ("1" per categoria, "2" per cespite) (CGTIPO)
IDCESPITE|1|10|0|Codice cespite (CGCESP)
CODCAT|2|2|0|Codice categoria (CGCDCT)
COMPL|8|1|0|Riferimenti completati per collegamento (CGCOMP)

View File

@ -75,7 +75,7 @@ protected:
static bool tipo_handler(TMask_field& f, KEY key);
static bool percip_handler(TMask_field& f, KEY key);
static bool fax_handler(TMask_field& f, KEY k);
// static bool fax_handler(TMask_field& f, KEY k);
static bool email_handler(TMask_field& f, KEY k);
static bool rsoc_handler(TMask_field& f, KEY k);
@ -307,7 +307,7 @@ bool TClifo_application::percip_handler(TMask_field& f, KEY key)
return TRUE;
}
bool TClifo_application::fax_handler(TMask_field& f, KEY k)
/*bool TClifo_application::fax_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (k == K_SPACE)
@ -329,7 +329,7 @@ bool TClifo_application::fax_handler(TMask_field& f, KEY k)
}
}
return ok;
}
} */
bool TClifo_application::email_handler(TMask_field& f, KEY k)
{
@ -515,7 +515,7 @@ int TClifo_application::read(TMask& m)
TString16 key(rec.get(IND_STATO)); key << "|" << rec.get(IND_COM);
const TRectype & com = cache().get(LF_COMUNI, key);
riga.add(com.get(COM_DENCOM));
// riga.add(rec.get(IND_CODIND));
riga.add(rec.get(IND_CODIND));
indsp_sheet().row(i)=riga;
@ -843,7 +843,7 @@ bool TClifo_application::user_create() // initvar e arrmask
_msk->set_handler(F_TIPOPERS, tipo_handler);
_msk->set_handler(F_ALLEG, alleg_handler);
_msk->set_handler(F_CODALLEG, codalleg_handler);
_msk->set_handler(DLG_FAX, fax_handler);
// _msk->set_handler(DLG_FAX, fax_handler);
_msk->set_handler(DLG_EMAIL, email_handler);
_msk->set_handler(F_RAGSOC, rsoc_handler);

View File

@ -2,12 +2,6 @@
TOOLBAR "" 0 18 0 4
BUTTON DLG_FAX 10 2
BEGIN
PROMPT -46 -3 "Fa~x"
PICTURE BMP_FAX
END
BUTTON DLG_EMAIL 10 2
BEGIN
PROMPT -56 -3 "~Posta"

View File

@ -70,6 +70,8 @@ BEGIN
CHECKTYPE NORMAL
FLAGS "U"
ADD NONE
MESSAGE EMPTY CLEAR,F_SOLAIVA
MESSAGE ENABLE,F_SOLAIVA
END
STRING F_DES_DOC 50
@ -145,9 +147,9 @@ LISTBOX F_TIPO_MOV_1 1 20
BEGIN
PROMPT 2 5 "Tipo movimento "
FIELD TIPOMOV
ITEM " |Nessuno" MESSAGE COPY,F_TIPO_MOV
ITEM "1|Fattura" MESSAGE COPY,F_TIPO_MOV
ITEM "2|Nota credito" MESSAGE COPY,F_TIPO_MOV
ITEM " |Nessuno" MESSAGE COPY,F_TIPO_MOV
ITEM "1|Fattura" MESSAGE COPY,F_TIPO_MOV
ITEM "2|Nota credito" MESSAGE COPY,F_TIPO_MOV
// GROUP 2
END
@ -156,10 +158,10 @@ LISTBOX F_TIPO_MOV_2 1 20
BEGIN
PROMPT 2 5 "Tipo movimento "
FIELD TIPOMOV
ITEM " |Nessuno" MESSAGE COPY,F_TIPO_MOV
ITEM "3|Incasso/pagamento " MESSAGE COPY,F_TIPO_MOV
ITEM "5|Insoluto" MESSAGE COPY,F_TIPO_MOV
ITEM "6|Pagamento insoluto" MESSAGE COPY,F_TIPO_MOV
ITEM " |Nessuno" MESSAGE COPY,F_TIPO_MOV
ITEM "3|Incasso/pagamento " MESSAGE COPY,F_TIPO_MOV
ITEM "5|Insoluto" MESSAGE COPY,F_TIPO_MOV
ITEM "6|Pagamento insoluto" MESSAGE COPY,F_TIPO_MOV
FLAGS "H"
END
@ -291,6 +293,12 @@ BEGIN
GROUP 2
END
BOOLEAN F_SOLAIVA
BEGIN
PROMPT 34 12 "Movimento di sola IVA"
FIELD SOLOIVA
END
BOOLEAN F_MOV_SEZ
BEGIN
PROMPT 34 12 "Movimento solo sezionale"
@ -333,12 +341,6 @@ BEGIN
FIELD MOVIND
END
BOOLEAN F_SOLAIVA
BEGIN
PROMPT 2 18 "Movimento di sola IVA"
FIELD SOLOIVA
END
ENDPAGE
ENDMASK

View File

@ -21,6 +21,7 @@
#include <currency.h>
#include <mask.h>
#include <modaut.h>
#include <progind.h>
#include <printapp.h>
#include <sort.h>
@ -44,6 +45,23 @@
#include "cglib01.h"
#include "cglib02.h"
class TSaldo_cdc : public TSaldo
{
public:
bool data_limite_commessa(int bilancio, int g, int c, long s, const char* commessa, const TDate& data_inf,
const TDate& data_sup, int indbil, int stp_prov);
};
//per bilancio scalare (ovvero a sezioni contrapposte) per data limite
bool TSaldo_cdc::data_limite_commessa(int bilancio, int g, int c, long s, const char* commessa, const TDate& data_inf,
const TDate& data_sup, int indbil, int stp_prov)
{
TString filter;
filter << RMV_CODCMS << "==\"" << commessa << '"';
return data_limite_bilancio(bilancio, g, c, s, data_inf, data_sup, indbil, stp_prov, filter);
}
class TStampa_bilanci : public TPrintapp
{
static bool mask_anno (TMask_field& f, KEY k);
@ -116,6 +134,8 @@ class TStampa_bilanci : public TPrintapp
bool _mov_ap,_quadratura;
bool _print_exercise;
int _stampa_mov_prov;
TString _cdc;
TArray _clienti, _fornitori;
@ -129,7 +149,10 @@ public:
virtual bool user_destroy();
bool set_print(int);
void next_c();
void next_c();
void header_cdc(int& r);
virtual bool preprocess_print(int,int);
virtual void preprocess_header();
virtual bool preprocess_page(int,int);
@ -162,7 +185,7 @@ public:
int cerca_indbil(int,int);
void scrivig_file_temp();
void scrivic_file_temp();
void scrivis_file_temp(int,int,long,real);
void scrivis_file_temp(int,int,long,const real&);
void leggi_files_dare (TIsamtempfile*);
void leggi_files_avere(TIsamtempfile*);
void leggi_file_tmp();
@ -174,6 +197,7 @@ public:
void controlla_conto(int,int);
const char* DescrizioneConto(int,int,long,char); //chiama quella di TConto
TDate UltimaData(int,int,long,int);
void stampa_un_bilancio(const TMask& m);
TStampa_bilanci() {}
};
@ -678,7 +702,7 @@ void TStampa_bilanci::scrivic_file_temp()
}
}
void TStampa_bilanci::scrivis_file_temp(int g, int c, long s, real saldo)
void TStampa_bilanci::scrivis_file_temp(int g, int c, long s, const real& saldo)
{
TIsamtempfile* tmp = NULL;
TString16 nome_campo;
@ -799,7 +823,7 @@ void TStampa_bilanci::next_c()
bool TStampa_bilanci::bil_sez_contr()
{
TSaldo sld;
TSaldo_cdc sld;
int indbil_conto=0;
int g, c;
long s;
@ -928,7 +952,12 @@ bool TStampa_bilanci::bil_sez_contr()
}
if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite
movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
{
if (_cdc.not_empty())
movimentato = sld.data_limite_commessa(_bilancio,g,c,s,_cdc,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
else
movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
}
else
if (_tipo_stampa == 2) //bil. a sez. contrapposte all'ultima immissione es. in corso
movimentato = sld.ultima_immissione_bilancio(_annoes,g,c,s,indbil_conto,_stampa_mov_prov);
@ -1072,7 +1101,7 @@ bool TStampa_bilanci::bil_sez_contr()
bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbil_conto,real& saldo)
{
TSaldo sld;
TSaldo_cdc sld;
int aep=0;
long s, items;
bool esiste_sc = FALSE;
@ -1097,7 +1126,12 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi
s = r->get_long(SLD_SOTTOCONTO);
if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite
movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
{
if (_cdc.not_empty())
movimentato = sld.data_limite_commessa(_bilancio,g,c,s,_cdc,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
else
movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
}
else if (_tipo_stampa == 2) //bil. a sez. contrapposte all'ultima immissione es. in corso
movimentato = sld.ultima_immissione_bilancio(_annoes,g,c,s,indbil_conto,_stampa_mov_prov);
@ -1285,7 +1319,7 @@ bool TStampa_bilanci::bil_verifica()
}
//scrivo il record del conto;
if ( (_verifica == 1)||( (_verifica == 2)&&
(!((_stampav == 2)&&(saldo_conto == 0))) ) )
(!((_stampav == 2)&&(saldo_conto == 0))) ) )
{
scrivi_record_conto(prg_conto_dare,prg_conto_avere,mov_conto_dare,
mov_conto_avere,saldo_conto);
@ -1678,16 +1712,18 @@ return TRUE;
//bilancio di verifica per data limite
bool TStampa_bilanci::calcola(int g, int c, long s)
{
char sezione, provvis;
real importo;
int annoe;
long num_reg;
TDate data_reg, data, datacomp, data_start;
TDate data_reg, data;
bool conto_mov = FALSE;
TLocalisamfile rmov(LF_RMOV);
TLocalisamfile mov(LF_MOV);
TDecoder causali(LF_CAUSALI, CAU_MOVAP);
TRelation rel(LF_RMOV);
rel.add(LF_MOV, "NUMREG==NUMREG");
TRectype& rmov = rel.curr();
const TRectype& mov = rel.curr(LF_MOV);
_mov_periodo_dare = ZERO;
_mov_periodo_avere = ZERO;
@ -1697,8 +1733,7 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
_saldo_ini_avere = ZERO;
_u_max = 0l;
data_start = _dataini;
TDate data_start = _dataini;
// Calcolo progressivi precedenti:
// e non è indicato l'anno esercizio, prende il primo giorno dell'anno indicato da _datada
if (_annoes == 0)
@ -1708,31 +1743,29 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
data_start.set_month(1);
}
rmov.setkey(2);
rmov.zero();
rmov.put(RMV_GRUPPO,g);
if (c != 0)
rmov.put(RMV_CONTO,c);
if (s != 0)
rmov.put(RMV_SOTTOCONTO,s);
const TRectype rec(rmov.curr());
for (int err = rmov.read(_isgteq); err == NOERR; err = rmov.next())
TString filter;
if (_cdc.not_empty())
filter << '(' << RMV_CODCMS << "=='" << _cdc << "')";
TCursor cur(&rel, filter, 2, &rmov, &rmov);
const long items = cur.items();
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
{
if (rmov.curr() != rec)
break;
annoe = rmov.get_int(RMV_ANNOES);
data = rmov.get_date(RMV_DATAREG);
num_reg = rmov.get_long(RMV_NUMREG);
mov.setkey(1);
mov.put(MOV_NUMREG, num_reg);
if (mov.read() != NOERR)
mov.zero();
provvis = mov.get_char(MOV_PROVVIS);
datacomp = mov.get_date(MOV_DATACOMP);
const char provvis = mov.get_char(MOV_PROVVIS);
const TDate datacomp = mov.get_date(MOV_DATACOMP);
if (_stampa_mov_prov == 1 && provvis != '\0') //bilancio normale (non comprende i provvisori)
continue;
@ -1751,8 +1784,8 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
continue;
}
sezione = rmov.get_char(RMV_SEZIONE);
importo = rmov.get_real(RMV_IMPORTO);
const char sezione = rmov.get_char(RMV_SEZIONE);
const real importo = rmov.get_real(RMV_IMPORTO);
if (_annoes == 0)
data_reg = data;
@ -1805,7 +1838,7 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
_mov_ap = TRUE;
}
}
return conto_mov;
return conto_mov;
}
bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_finale,real& saldo_iniziale,
@ -1813,33 +1846,22 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
{
TSaldo sld;
bool esiste_sc = FALSE;
long s;
int anno;
if (_tipo_stampa1 == 1)
anno = _annoapp;
else
anno = _annoes;
const int anno = _tipo_stampa1 == 1 ? _annoapp : _annoes;
_lista = new TSaldi_list(g, c, anno);
TRecnotype items = _lista->items();
const TRecnotype items = _lista->items();
for (int i = 0; i < items; i++)
for (TRecnotype i = 0; i < items; i++)
{
const TRectype* r = _lista->saldi();
if (r == NULL) break;
s = r->get_long(SLD_SOTTOCONTO);
const long s = r->get_long(SLD_SOTTOCONTO);
saldo_finale = saldo_iniziale = ZERO; //saldi relativi a ciascun sottoconto
if (_tipo_stampa1 == 1) //bil. di verifica per data limite
{
/*
if ( !calcola(g,c,s) ) //il conto non e' movimentato
if (_stampav == 1 || _stampav == 3) //per i C/F anche se seleziono -tutti i conti, voglio solo quelli movimentati
continue;
*/
//modifica del 21/11/1995
_mov_ap = FALSE;
//modifica del 19/06. Vedi appunti per capire
@ -2259,11 +2281,7 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf)
prg_conto_avere = ZERO;
_u_max = 0l;
int anno;
if (_tipo_stampa1 == 1)
anno = _annoapp;
else anno = _annoes;
const int anno = _tipo_stampa1 == 1 ? _annoapp : _annoes;
for (int i=0; i < gccf.items(); i++)
{
int g = ((TToken_string&)gccf[i]).get_int(0);
@ -3692,28 +3710,30 @@ bool TStampa_bilanci::user_destroy()
}
void TStampa_bilanci::leggi_pcon()
{
TLocalisamfile pconti(LF_PCON);
TToken_string gc(10);
{
TRelation rel(LF_PCON);
TCursor cur(&rel);
const TRectype& pconti = rel.curr();
const long items = cur.items();
cur.freeze();
for (pconti.first(); !pconti.eof(); pconti.next())
TToken_string gc(10);
for (cur = 0L; cur.pos() < items; ++cur)
{
gc.restart();
int gruppo = pconti.get_int(PCN_GRUPPO);
int conto = pconti.get_int(PCN_CONTO);
long sottoconto = pconti.get_long(PCN_SOTTOCONTO);
const int gruppo = pconti.get_int(PCN_GRUPPO);
const int conto = pconti.get_int(PCN_CONTO);
const long sottoconto = pconti.get_long(PCN_SOTTOCONTO);
if ( (sottoconto == 0l) && (conto != 0) ) //si tratta di un conto
{
char tipocf = pconti.get_char(PCN_TMCF);
if ( tipocf == 'C' &&
(_situazione.empty() || _situazione == "C") )
const char tipocf = pconti.get_char(PCN_TMCF);
if ( tipocf == 'C' && (_situazione.empty() || _situazione == "C"))
{
gc.add(gruppo,0);
gc.add(conto,1);
_clienti.add(gc);
}
else if ( tipocf == 'F' &&
(_situazione.empty() || _situazione == "F") )
else if ( tipocf == 'F' && (_situazione.empty() || _situazione == "F"))
{
gc.add(gruppo,0);
gc.add(conto,1);
@ -3723,10 +3743,86 @@ void TStampa_bilanci::leggi_pcon()
}
}
void TStampa_bilanci::stampa_un_bilancio(const TMask& m)
{
if (_bilancio == 1)
{
printer().footerlen(3);
_prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE);
_totali = m.get_bool(F_TOTALI);
_codici = m.get_bool(F_CODICI);
_saldo = m.get_bool(F_SALDO);
_tipo_stampa = m.get_int(F_STAMPA);
if (_tipo_stampa == 1)
{
_datalim = m.get(F_DATALIM);
_print_exercise = TRUE;
if (_annoes == 0)
{
_print_exercise = FALSE;
_annoes = date2esc(_datalim);
}
if (_annoes != 0)
_dataini = InizioEsercizio(_annoes);
else
_dataini = _inizioEs;
//_stampa_mov_prov = (bool)(m.get(F_STAMPAMPROV) == "X");
}
bil_sez_contr();
}
else
{
printer().footerlen(5);
_stampa_width = m.get_int(F_MODULO);
if (_stampa_width == 1)
_stampa_width = 132;
else _stampa_width = 148; //perche' questo e' in realta' il margine dx (vedi es. di stampa AS/400)
_verifica = m.get_int(F_VERIFICA);
if ( (_verifica == 1)||(_verifica == 2) )
_prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE);
_tipo_stampa1 = m.get_int(F_STAMPA1);
if (_tipo_stampa1 == 1)
{
if (_annoes != 0)
_dataini = InizioEsercizio(_annoes);
else
_dataini = _inizioEs;
_datada = m.get(F_DATADA);
_dataa = m.get(F_DATAA);
}
if ((_verifica == 1)||(_verifica == 2))
{
_stampav = atoi(m.get(F_STAMPAV));
bil_verifica();
}
else
{
_situazione = m.get(F_SITUAZIONE);
_stampac = atoi(m.get(F_STAMPAC));
_ordinamento = atoi(m.get(F_ORDINAMENTO));
if (_situazione.not_empty())
_cur->setfilter(format("TIPOCF=\"%s\"",(const char*)_situazione));
else
_cur->setfilter("");
_clienti.destroy();
_fornitori.destroy();
leggi_pcon();
crea_sort_clifo();
_sort->endsort();
delete _cf;
}
}
delete _prog;
print();
}
bool TStampa_bilanci::set_print(int)
{
TMask m ("cg1500a");
KEY tasto;
m.set_handler (F_VERIFICA, my_handler);
m.set_handler (F_BILANCIO, mask_bilancio);
m.set_handler (F_STAMPA1, mask_bilancio);
@ -3735,9 +3831,11 @@ bool TStampa_bilanci::set_print(int)
m.set_handler (F_DATADA, mask_date);
m.set_handler (F_DATAA, mask_date);
m.set_handler (F_ANNO, mask_anno);
if (!has_module(CMAUT))
m.hide(-4); // Spegne campi commesse in assenza del modulo relativo
tasto = m.run();
if (tasto == K_ENTER)
while (m.run() == K_ENTER)
{
_annoes = m.get_int(F_ANNO);
_bilancio = m.get_int(F_BILANCIO);
@ -3746,79 +3844,26 @@ bool TStampa_bilanci::set_print(int)
_quadratura = m.get_bool(F_QUADRATURA);
_noseparator = m.get_bool(F_SEPARATOR);
if (_bilancio == 1)
if (m.get(F_DACDC).not_empty() || m.get(F_ACDC).not_empty())
{
printer().footerlen(3);
_prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE);
_totali = m.get_bool(F_TOTALI);
_codici = m.get_bool(F_CODICI);
_saldo = m.get_bool(F_SALDO);
_tipo_stampa = m.get_int(F_STAMPA);
if (_tipo_stampa == 1)
{
_datalim = m.get(F_DATALIM);
_print_exercise = TRUE;
if (_annoes == 0)
{
_print_exercise = FALSE;
_annoes = date2esc(_datalim);
}
if (_annoes != 0)
_dataini = InizioEsercizio(_annoes);
else
_dataini = _inizioEs;
//_stampa_mov_prov = (bool)(m.get(F_STAMPAMPROV) == "X");
TRelation rel("CMS");
TRectype da_cdc(rel.curr()), a_cdc(rel.curr());
da_cdc.put("CODTAB", m.get(F_DACDC));
a_cdc.put("CODTAB", m.get(F_ACDC));
TCursor cur(&rel, "", 1, &da_cdc, &a_cdc);
const TRecnotype items = cur.items();
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
{
_cdc = cur.curr().get("CODTAB");
stampa_un_bilancio(m);
}
bil_sez_contr();
}
else
{
printer().footerlen(5);
_stampa_width = m.get_int(F_MODULO);
if (_stampa_width == 1)
_stampa_width = 132;
else _stampa_width = 148; //perche' questo e' in realta' il margine dx (vedi es. di stampa AS/400)
_verifica = m.get_int(F_VERIFICA);
if ( (_verifica == 1)||(_verifica == 2) )
_prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE);
_tipo_stampa1 = m.get_int(F_STAMPA1);
if (_tipo_stampa1 == 1)
{
if (_annoes != 0)
_dataini = InizioEsercizio(_annoes);
else
_dataini = _inizioEs;
_datada = m.get(F_DATADA);
_dataa = m.get(F_DATAA);
}
if ((_verifica == 1)||(_verifica == 2))
{
_stampav = atoi(m.get(F_STAMPAV));
bil_verifica();
}
else
{
_situazione = m.get(F_SITUAZIONE);
_stampac = atoi(m.get(F_STAMPAC));
_ordinamento = atoi(m.get(F_ORDINAMENTO));
if (_situazione.not_empty())
_cur->setfilter(format("TIPOCF = \"%s\"",(const char*)_situazione));
else
_cur->setfilter("");
_clienti.destroy();
_fornitori.destroy();
leggi_pcon();
crea_sort_clifo();
_sort->endsort();
delete _cf;
}
_cdc.cut(0);
stampa_un_bilancio(m);
}
delete _prog;
return TRUE;
}
return FALSE;
}
@ -3893,22 +3938,29 @@ int TStampa_bilanci::stampa_intestazione_ditta()
get_dati_ditta();
codice_ditta << get_firm();
set_header (r, "Ditta %s %s %s %s %s %s", (const char*)codice_ditta,
set_header (r++, "Ditta %s %s %s %s %s %s", (const char*)codice_ditta,
(const char*)_ragsoc, (const char*)_viafis,
(const char*)_cap, (const char*)_comunefis,
(const char*)_provfis);
r++;
printer().setdate(_data);
riga = "Data @> Pag. @#";
riga.right_just(_stampa_width-10);
riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi));
set_header (r, "%s", (const char*) riga);
r++;
set_header (r++, "%s", (const char*) riga);
return r;
}
void TStampa_bilanci::header_cdc(int& r)
{
if (_cdc.not_empty())
{
const TString& desc = cache().get("CMS", _cdc, "S0");
set_header(r++, "@bCommessa %s - %s", (const char*)_cdc, (const char*)desc);
}
}
void TStampa_bilanci::preprocess_header()
{
int r;
@ -3943,7 +3995,8 @@ void TStampa_bilanci::preprocess_header()
set_header(r,"@84gEsercizio %s %s", (const char*)d1, (const char*)d2); /**/
}
r++;
riga.fill('-');
header_cdc(r);
riga.fill('_');
set_header(r, (const char*)riga);
r++;
riga = "";
@ -4005,8 +4058,8 @@ void TStampa_bilanci::preprocess_header()
set_header(r,"@107gConti con saldo <> 0");
}
r++;
riga.fill('-');
header_cdc(r);
riga.fill('_');
set_header(r, (const char*)riga);
r++;

View File

@ -24,6 +24,10 @@
#define F_QUADRATURA 123
#define F_SEPARATOR 124
#define F_PICTURE 125
#define F_DACDC 126
#define F_DACDC_DES 127
#define F_ACDC 128
#define F_ACDC_DES 129
#endif // __CG1500_H

View File

@ -1,6 +1,6 @@
#include "cg1500.h"
TOOLBAR "" 0 20 0 2
TOOLBAR "" 0 -2 0 2
BUTTON DLG_OK 10 2
BEGIN
@ -60,7 +60,7 @@ END
RADIOBUTTON F_BILANCIO 37
BEGIN
PROMPT 2 5 "Tipo bilancio "
PROMPT 2 5 "@bTipo bilancio"
HELP "Indicare il tipo di bilancio da stampare"
ITEM "1|Bilancio a sezioni contrapposte"
MESSAGE HIDE,F_STAMPA1|RESET,F_STAMPA1|HIDE,F_VERIFICA|RESET,F_VERIFICA
@ -82,24 +82,24 @@ END
RADIOBUTTON F_STAMPA 28
BEGIN
PROMPT 41 5 "Tipo stampa "
PROMPT 41 5 "@bTipo stampa"
HELP "Indicare il tipo di stampa"
ITEM "1|Per date limite"
MESSAGE SHOW,F_DATALIM|SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO
MESSAGE SHOW,F_DATALIM|SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO|ENABLE,4@
ITEM "2|All'ultima immissione"
MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM
MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM|CLEAR,4@
MESSAGE SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO
END
RADIOBUTTON F_STAMPA1 28
BEGIN
PROMPT 40 5 "Tipo stampa "
PROMPT 40 5 "@bTipo stampa"
//FLAGS "G"
HELP "Indicare il tipo di stampa"
ITEM "1|Per date limite"
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV|ENABLE,4@
ITEM "2|All'ultima immissione"
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV|CLEAR,4@
MESSAGE COPY,F_STAMPA
END
@ -187,13 +187,69 @@ BEGIN
PROMPT 2 13 "Quadratura con Libro Giornale"
END
GROUPBOX DLG_NULL 73 4
BEGIN
PROMPT 2 14 "@bCentri di costo"
GROUP 4
END
STRING F_DACDC 20
BEGIN
PROMPT 3 15 "Da "
FLAGS "UZ"
USE CMS
INPUT CODTAB F_DACDC
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@70" S0
OUTPUT F_DACDC CODTAB
OUTPUT F_DACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_DACDC_DES 70 41
BEGIN
PROMPT 30 15 ""
USE CMS KEY 2
INPUT S0 F_DACDC_DES
DISPLAY "Descrizione@70" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_DACDC
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC 20
BEGIN
PROMPT 3 16 "A "
FLAGS "UZ"
COPY USE F_DACDC
INPUT CODTAB F_ACDC
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
OUTPUT F_ACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC_DES 70 41
BEGIN
PROMPT 30 16 ""
COPY USE F_DACDC_DES
INPUT S0 F_ACDC_DES
COPY DISPLAY F_DACDC_DES
COPY OUTPUT F_ACDC
CHECKTYPE SEARCH
GROUP 4
END
ENDPAGE
PAGE "Parametri bilancio di verifica" -1 -1 74 20
RADIOBUTTON F_VERIFICA 27
BEGIN
PROMPT 2 1 "Stampa bilancio di verifica "
PROMPT 2 1 "@bStampa bilancio di verifica "
HELP "Tipo di bilancio di verifica"
ITEM "1|Bilancio"
ITEM "2|Saldi di mastro"
@ -202,14 +258,14 @@ END
RADIOBUTTON F_STAMPAC 36
BEGIN
PROMPT 34 1 "Tipo stampa "
PROMPT 34 1 "@bTipo stampa"
ITEM "1|Conti movimentati"
ITEM "2|Conti con saldo diverso da zero"
END
RADIOBUTTON F_STAMPAV 36
BEGIN
PROMPT 34 1 "Tipo stampa "
PROMPT 34 1 "@bTipo stampa "
ITEM "1|Conti movimentati"
ITEM "2|Conti con saldo diverso da zero"
ITEM "3|Tutti i conti"

View File

@ -16,8 +16,6 @@
#include <clifo.h>
#include <rcausali.h>
#define NEW_CESP 1
///////////////////////////////////////////////////////////
// Dati incasso immediato
///////////////////////////////////////////////////////////
@ -86,7 +84,7 @@ TMask* TPrimanota_application::load_mask(int n)
m->set_handler(F_FORNITORE, clifo_handler);
m->set_handler(F_RITFIS, ritfis_handler);
m->set_handler(F_RITSOC, ritsoc_handler);
m->set_handler(F_CORRLIRE, corrlire_handler);
m->set_handler(F_CORRISPETTIVO, corrlire_handler);
m->set_handler(F_CORRVALUTA, corrvaluta_handler);
m->set_handler(F_CODIVA, main_codiva_handler);
m->set_handler(F_OCCASEDIT, occas_handler);
@ -107,6 +105,15 @@ TMask* TPrimanota_application::load_mask(int n)
ism.set_handler(209, sheet_clifo_handler);
ism.set_handler(309, sheet_clifo_handler);
// Controlla gestione commesse ed eventualmente elimina colonne relative
if (has_module(CMAUT, CHK_DONGLE))
ism.set_handler(112, fase_handler);
else
{
ism.hide(111); ism.hide(112);
is.delete_column(112); is.delete_column(111);
}
// Se esiste lo sheet delle rate
if (is_fattura())
{
@ -165,10 +172,13 @@ TMask* TPrimanota_application::load_mask(int n)
cgm.set_handler(213, sheet_clifo_handler);
cgm.set_handler(313, sheet_clifo_handler);
if (!fexist("batbcdc.msk"))
// Controlla gestione commesse ed eventualmente elimina colonne relative
if (has_module(CMAUT, CHK_DONGLE))
cgm.set_handler(CG_FASE, fase_handler);
else
{
cgm.hide(CG_CDC);
cg.delete_column(CG_CDC);
cgm.hide(CG_COMMESSA); cgm.hide(CG_FASE);
cg.delete_column(CG_FASE); cg.delete_column(CG_COMMESSA);
}
}
break;
@ -484,9 +494,10 @@ void TPrimanota_application::init_mask(TMask& m)
}
m.show(-1, clig);
m.show(-2, forg);
if (corrisp) m.hide(F_STATOPAIV);
if (corrisp)
m.hide(F_STATOPAIV);
// Show/Hide campi valuta: F_VALUTAINTRA, F_CAMBIOINTRA, F_CORRLIRE, F_CORRVAL (GROUP 4)
// Show/Hide campi valuta: F_VALUTAINTRA, F_CAMBIOINTRA, F_CORRISPETTIVO, F_CORRVAL (GROUP 4)
m.show(-4, causale().valintra());
if (causale().soloiva())
m.set(F_SOLAIVA, "X", TRUE); // Propone movimento di sola iva
@ -757,7 +768,7 @@ int TPrimanota_application::read(TMask& m)
const TRectype& r = _rel->cg(i);
TToken_string& riga = cgs().row(i); // Vuota la riga
TImporto import(r.get_char("SEZIONE"), r.get_real("IMPORTO"));
TImporto import(r.get_char(RMV_SEZIONE), r.get_real(RMV_IMPORTO));
import.add_to(riga, 0); // Dare/Avere 101-102
TBill conto; conto.get(r);
@ -766,13 +777,15 @@ int TPrimanota_application::read(TMask& m)
_saldi.aggiorna(conto, import, FALSE);
riga.add(""); // Codice descrizione 108
riga.add(r.get("DESCR")); // Descrizione riga 109
riga.add(r.get(RMV_DESCR)); // Descrizione riga 109
conto.get(r, TRUE);
riga.add(conto.string(0x3)); // Contropartita 110-114
riga.add(r.get("NUMGIO")); // Centro di costo 115
const char tipo = r.get_char("ROWTYPE");
riga.add(tipo); // Tipo di riga 116
riga.add(r.get(RMV_CODCMS)); // Commessa 115
riga.add(r.get(RMV_FASCMS)); // Fase 116
const char tipo = r.get_char(RMV_ROWTYPE);
riga.add(tipo, CG_ROWTYPE-FIRST_FIELD); // Tipo di riga 117
disable_cgs_cells(i, tipo);
}
@ -805,14 +818,14 @@ int TPrimanota_application::read(TMask& m)
TRectype& r = _rel->iva(i);
TToken_string& riga = ivas().row(i);
real imponibile(r.get("IMPONIBILE"));
real imponibile(r.get(RMI_IMPONIBILE));
if (to_swap) imponibile = -imponibile;
riga.add(imponibile.string()); // Imponibile 101
riga.add(r.get("CODIVA")); // IVA 102
riga.add(r.get("TIPODET")); // Detrazione 103
riga.add(r.get(RMI_CODIVA)); // IVA 102
riga.add(r.get(RMI_TIPODET)); // Detrazione 103
real imposta(r.get("IMPOSTA"));
real imposta(r.get(RMI_IMPOSTA));
if (to_swap) imposta = -imposta;
if (imponibile.sign() * imposta.sign() < 0)
{
@ -820,10 +833,12 @@ int TPrimanota_application::read(TMask& m)
"assegnato il segno dell'imponibile");
imposta = -imposta;
}
riga.add(imposta.string()); // Imposta 104
riga.add(imposta.string()); // Imposta 104
TBill c; c.get(r);
c.add_to(riga, 4, 0x7); // Conto 105-110
riga.add(r.get(RMI_CODCMS)); // Commessa 111
riga.add(r.get(RMI_FASCMS)); // Fase 112
}
calcola_imp(); // Calcola totale imponibile ed imposte
@ -892,27 +907,28 @@ void TPrimanota_application::mask2rel(const TMask& m)
TRectype &r = _rel->cg(i);
r.zero();
r.put("NUMREG", numreg); // Numero registrazione
r.put("ANNOES", annoes); // Anno esercizio
r.put("DATAREG", datareg); // Data di registrazione
r.put("NUMRIG", i+1); // Numero riga
r.put(RMV_NUMREG, numreg); // Numero registrazione
r.put(RMV_ANNOES, annoes); // Anno esercizio
r.put(RMV_DATAREG, datareg); // Data di registrazione
r.put(RMV_NUMRIG, i+1); // Numero riga
r.put("SEZIONE", n.sezione()); // Sezione
r.put("IMPORTO", n.valore()); // Importo
conto.put(r); // Conto
r.put(RMV_SEZIONE, n.sezione()); // Sezione
r.put(RMV_IMPORTO, n.valore()); // Importo
conto.put(r); // Conto
row.get(); // Codice descrizione (ignorato)
const char* descr = row.get(); // Descrizione aggiuntiva
if (i > 0 || m.get(F_DESCR) != descr) // Salva la prima descrizione se diversa da testata
r.put("DESCR", descr); // Descrizione riga
row.get(); // Codice descrizione (ignorato)
const char* descr = row.get(); // Descrizione aggiuntiva
if (i > 0 || m.get(F_DESCR) != descr) // Salva la prima descrizione se diversa da testata
r.put(RMV_DESCR, descr); // Descrizione riga
r.put("TIPOCC", row.get()); // Contropartita
r.put("GRUPPOC", row.get());
r.put("CONTOC", row.get());
r.put("SOTTOCONTC", row.get());
row.get(); // Descrizione contropartita
r.put("NUMGIO", row.get()); // Numero riga giornale
r.put("ROWTYPE", row.get()); // Tipo riga
r.put(RMV_TIPOCC, row.get()); // Contropartita
r.put(RMV_GRUPPOC, row.get());
r.put(RMV_CONTOC, row.get());
r.put(RMV_SOTTOCONTOC, row.get());
row.get(); // Descrizione contropartita
r.put(RMV_CODCMS, row.get()); // Commessa
r.put(RMV_FASCMS, row.get()); // Fase
r.put(RMV_ROWTYPE, row.get()); // Tipo riga
}
}
@ -983,33 +999,36 @@ void TPrimanota_application::mask2rel(const TMask& m)
TRectype &r = _rel->iva(i);
r.zero();
r.put("NUMREG", numreg);
r.put("NUMRIG", i+1);
r.put(RMI_NUMREG, numreg);
r.put(RMI_NUMRIG, i+1);
r.put("ANNOES", annoes); // Anno d'esercizio della testata (che ca$$ata!)
r.put("INTRA", intra); // Causale intra (che ca$$ata!)
r.put(RMI_ANNOES, annoes); // Anno d'esercizio della testata (che ca$$ata!)
r.put(RMI_INTRA, intra); // Causale intra (che ca$$ata!)
real imponibile(row.get(0));
if (to_swap) imponibile = -imponibile;
r.put("IMPONIBILE", imponibile);
r.put(RMI_IMPONIBILE, imponibile);
r.put("CODIVA", row.get());
r.put("TIPODET", row.get());
r.put(RMI_CODIVA, row.get());
r.put(RMI_TIPODET, row.get());
real imposta(row.get());
if (to_swap) imposta = -imposta;
r.put("IMPOSTA", imposta);
r.put(RMI_IMPOSTA, imposta);
r.put("TIPOCR", row.get());
const TBill c(row, -1, 0x1);
const int rimp = bill2pos(c, 'I')+1;
r.put("RIGAIMP", rimp);
r.put(RMI_TIPOCR, row.get());
r.put(RMI_CODCMS, row.get(10));
r.put(RMI_FASCMS, row.get(11));
// Roba obsoleta allo stato brado
const TClinton c(row, TRUE);
const int rimp = clint2pos(c, 'I')+1;
r.put(RMI_RIGAIMP, rimp);
c.put(r);
}
}
void TPrimanota_application::check_saldi()
{
TString_array& rows = cgs().rows_array();
@ -1438,6 +1457,13 @@ HIDDEN void ini2bill(TConfig& ini, TBill& bil, bool contro)
bil.set(gruppo, conto, sottoconto, tipo);
}
HIDDEN void ini2clinton(TConfig& ini, TClinton& bil)
{
ini2bill(ini, bil, FALSE);
bil.set_commessa(ini.get("CODCMS"));
bil.set_fase(ini.get("FASCMS"));
}
HIDDEN bool set_not_empty(TMask& msk, int id, TConfig& ini, const char* var)
{
const TString& val = ini.get(var);
@ -1501,7 +1527,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
char tipo = ini.get_char(RMV_ROWTYPE);
if (tipo == '\0') tipo = ' ';
TBill conto; ini2bill(ini, conto, FALSE);
TClinton conto; ini2clinton(ini, conto);
int numrig = -1; // Normalmente aggiungi la riga in fondo
@ -1509,7 +1535,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
if (strchr(" DINT", tipo) != NULL)
{
if (tipo == 'I' || tipo == ' ')
numrig = bill2pos(conto, tipo);
numrig = clint2pos(conto, tipo);
else
numrig = type2pos(tipo);
if (numrig < 0)
@ -1538,8 +1564,10 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
if (conto.gruppo() > 0)
conto.add_to(riga, 9, 0x3); // Contropartita 110-114
riga.add(ini.get(RMV_NUMGIO), 14); // Centro di costo 115
riga.add(tipo, 15); // Tipo di riga 116
riga.add(ini.get(RMV_CODCMS), 14); // Commessa 115
riga.add(ini.get(RMV_FASCMS), 15); // Fase 116
riga.add(tipo, 16); // Tipo di riga 116
}
if (is_fattura())
@ -1569,20 +1597,6 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
{
TRelation_application::mask2ini(msk, ini);
#ifndef NEW_CESP
const char mov_cesp = causale().link_cespiti();
if (mov_cesp > ' ')
{
const char str_cesp[2] = { mov_cesp, '\0' };
ini.set_paragraph(format("%d", LF_MOV));
ini.set("MOVCESP", str_cesp);
ini.set("DESCRCAUS", msk.get(F_DESCRCAUS));
const TEsercizio& annoes = _esercizi[msk.get_int(F_ANNOES)];
ini.set("INIZIOES", annoes.inizio());
ini.set("FINEES", annoes.fine());
}
#endif
int i, f;
for (i = 0; i < _rel->cg_items(); i++)
{
@ -1592,19 +1606,9 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
for (f = rec.items()-1; f >= 0; f--)
{
const char* name = rec.fieldname(f);
if (strcmp(name,RMV_NUMGIO) == 0)
continue; // Non scrive il codice del centro di costo
ini.set(name, rec.get(name));
}
#ifndef NEW_CESP
const TBill zio(rec);
ini.set("DESCRCONTO", zio.descrizione());
ini.set("TIPOCR", zio.tipo_cr());
const TBill french(rec, TRUE);
ini.set("DESCRCONTOC", french.descrizione());
#endif
}
for ( ; ; i++)
{
@ -1676,13 +1680,8 @@ bool TPrimanota_application::link_cesp(const TMask& msk, const char* action)
return FALSE;
// Controlla l'esistenza del programma cespiti
#ifdef NEW_CESP
if (!fexist("ce1.exe"))
return FALSE;
#else
if (!fexist("cespcg.exe"))
return FALSE;
#endif
// Cerca una riga con tipo costo/ricavo 2,3,4,8
for (int i = _rel->cg_items()-1; i >= 0; i--)
@ -1708,15 +1707,10 @@ bool TPrimanota_application::link_cesp(const TMask& msk, const char* action)
}
TString appname;
#ifdef NEW_CESP
appname << "ce1 -4 /c" << cespini;
TExternal_app app(appname);
bool ok = app.run();
#else
appname << "cespcg -t /i" << cespini;
TExternal_app app(appname);
bool ok = app.run(FALSE, 0x3) == 0; // Force user name!
#endif
return ok;
}
@ -1752,10 +1746,10 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
intro.set("Action", action);
TString str; // Stringa jolly di lavoro
str.format("%d", LF_INTRA);
intro.set_paragraph(str);
intro.set("NUMREG", m.get(F_NUMREG));
if (m.field(F_CLIENTE).shown())
{
intro.set("TIPOMOV", "C");
@ -1768,13 +1762,22 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
intro.set("TIPOCF", "F");
intro.set("CODCF", m.get(F_FORNITORE));
}
intro.set("TOTDOC", m.get(F_TOTALE));
intro.set("CODVAL", m.get(F_VALUTAINTRA));
const TString& codval = m.get(F_VALUTAINTRA);
intro.set("CODVAL", codval);
intro.set("CAMBIO", m.get(F_CAMBIOINTRA));
intro.set("DATAREG", m.get(F_DATAREG));
intro.set("NUMDOC", m.get(F_NUMDOC));
// Inserisci il totale documento solo in inserimento!
if (action == "Insert")
{
real totdoc = m.get(codval.empty() ? F_IMPONIBILI : F_CORRISPETTIVO);
if (test_swap(FALSE))
totdoc = -totdoc;
intro.set("TOTDOC", totdoc.string());
}
else
intro.remove("TOTDOC"); // Evita di cambiare il valore preesistente
intro.set_paragraph(""); // Flush

View File

@ -41,7 +41,7 @@
#define F_PROVVISORIO 129
#define F_OCCASEDIT 131
#define F_SOLAIVA 132
#define F_CORRLIRE 133
#define F_CORRISPETTIVO 133
#define F_CORRVALUTA 134
#define F_DATA74TER 135
#define F_DESCAGG 136
@ -68,8 +68,9 @@
#define CG_CONTO 105
#define CG_SOTTOCONTO 106
#define CG_DESCR 109
#define CG_CDC 115
#define CG_ROWTYPE 116
#define CG_COMMESSA 115
#define CG_FASE 116
#define CG_ROWTYPE 117
// Campi ripetuti sulla seconda pagina

View File

@ -354,7 +354,8 @@ BEGIN
ITEM "Co./c@3"
ITEM "Sott./c@6"
ITEM "Descrizione contropartita@30"
ITEM "*******"
ITEM "Commessa@20"
ITEM "Fase@10"
ITEM "Tipo@4"
END
@ -376,4 +377,4 @@ ENDMASK
#include "cg21cg.uml"
z

View File

@ -550,7 +550,7 @@ BEGIN
PICTURE ".6"
END
CURRENCY F_CORRLIRE 18
CURRENCY F_CORRISPETTIVO 18
BEGIN
PROMPT 1 18 "Corrispettivo "
FIELD CORRLIRE
@ -617,7 +617,9 @@ BEGIN
ITEM "Gr."
ITEM "Co."
ITEM "Sottoc.@6"
ITEM "Descrizione Conto@50"
ITEM "Descrizione Conto@30"
ITEM "Commessa@20"
ITEM "Fase@10"
END
CURRENCY F_IMPONIBILI 18
@ -649,7 +651,8 @@ BEGIN
ITEM "Co./c@3"
ITEM "Sott./c@6"
ITEM "Descrizione contropartita@30"
ITEM "*******"
ITEM "Commessa@20"
ITEM "Fase@10"
ITEM "Tipo@4"
END

View File

@ -13,10 +13,32 @@
#include <clifo.h>
#include <cfven.h>
int TClinton::compare(const TSortable& obj) const
{
int cmp = TBill::compare(obj);
if (cmp == 0)
{
const TClinton& bill = (const TClinton&)obj;
cmp = _cms.compare(bill.commessa());
if (cmp == 0)
cmp = _fas.compare(bill.fase());
}
return cmp;
}
TClinton::TClinton(TToken_string& row, bool iva)
: TBill(row, iva ? 6 : 3, 0x0)
{
set_commessa(row.get((iva ? 111 : CG_COMMESSA) - FIRST_FIELD));
set_fase(row.get((iva ? 112 : CG_FASE) - FIRST_FIELD));
}
///////////////////////////////////////////////////////////
// Funzioni di decodifica/calcolo
///////////////////////////////////////////////////////////
// Determina il tipo di una riga contabile in formato TToken_string
char TPrimanota_application::row_type(const TToken_string& s)
{
const int l = s.len()-1;
@ -155,7 +177,6 @@ int TPrimanota_application::type2pos(char tipo)
return -1;
}
// Trova nelle righe contabili un conto nelle righe di tipo prescelto
int TPrimanota_application::bill2pos(const TBill& conto, char tipo)
{
@ -175,6 +196,29 @@ int TPrimanota_application::bill2pos(const TBill& conto, char tipo)
return -1;
}
int TPrimanota_application::clint2pos(const TClinton& conto, char tipo)
{
int r = bill2pos(conto, tipo);
if (r >= 0 && conto.commessa().not_empty())
{
TString_array& cg = app().cgs().rows_array();
const int num_rows = cg.items();
for (int i = r ; i < num_rows; i++)
{
TToken_string& s = cg.row(i);
const char t = row_type(s);
if (t == tipo)
{
const TClinton c(s, FALSE);
if (c == conto)
return i;
}
}
r = -1;
}
return r;
}
// Trova nelle righe contabili un conto di contropartita per il conto dato
int TPrimanota_application::bill2contr(const TBill& conto, char sezione) const
@ -196,7 +240,6 @@ int TPrimanota_application::bill2contr(const TBill& conto, char sezione) const
return -1;
}
// Controlla se un conto e' usato nelle righe IVA
int TPrimanota_application::bill_used(const TBill& conto) const
{
@ -350,6 +393,12 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
cg.disable_cell(n, i);
needs_update = TRUE;
}
if (cg.cell_disabled(n, 5)) // Se disabilito il sottoconto alloro spengo anche le commesse
{
cg.disable_cell(n, CG_COMMESSA); // Commessa
cg.disable_cell(n, CG_FASE); // Fase
}
COLOR back_color, fore_color;
type2colors(tipo, back_color, fore_color);
@ -371,7 +420,7 @@ void TPrimanota_application::reset_sheet_row(TSheet_field& s, int n)
int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
TBill& conto, const char* desc,
char tipo)
char tipo, const char* cms, const char* fas)
{
TSheet_field& cg = cgs();
if (n < 0) n = cg.first_empty();
@ -404,7 +453,9 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
row.add(" | | | | ");
}
row << "| |" << tipo;
row.add(cms, CG_COMMESSA-FIRST_FIELD);
row.add(fas, CG_FASE-FIRST_FIELD);
row.add(tipo, CG_ROWTYPE-FIRST_FIELD);
disable_cgs_cells(n, tipo);
@ -1033,7 +1084,6 @@ bool TPrimanota_application::descr_handler(TMask_field& f, KEY k)
return TRUE;
}
// Handler per le colonne 'Dare' e 'Avere' dello sheet contabile.
// Scrivendo qualcosa in dare (101) cancella l'importo in avere (102) e viceversa
bool TPrimanota_application::dareavere_handler(TMask_field& f, KEY k)
@ -1081,6 +1131,19 @@ bool TPrimanota_application::dareavere_handler(TMask_field& f, KEY k)
return TRUE;
}
// La fase puo' esistere solo con la commessa
bool TPrimanota_application::fase_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (f.to_check(k) && !f.empty())
{
const TEdit_field& cms_fld = f.mask().efield(f.dlg()-1);
if (cms_fld.empty())
ok = f.error_box("E' necessario specificare anche la commessa");
}
return ok;
}
TSheet_field& TPrimanota_application::pags() const
{
CHECK(is_fattura(), "Can't use rate sheet without a fattura");
@ -1209,10 +1272,11 @@ bool TPrimanota_application::detrazione_handler(TMask_field& f, KEY key)
// Certified 90%
bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
if ((key == K_ENTER || key == K_TAB) && f.dirty())
{
const real imponibile(f.mask().get(101));
const real percent = app().causale().corrispettivi() ? ZERO : cod2IVA(f.mask());
const real imponibile(m.get(101));
const real percent = app().causale().corrispettivi() ? ZERO : cod2IVA(m);
const int dec = TCurrency::get_firm_dec();
real imposta;
if (dec == 0)
@ -1239,9 +1303,8 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key)
real imposta(f.get());
if (imposta.is_zero())
{
TMask& m = f.mask();
real imponibile(m.get(101));
const real& percent = cod2IVA(f.mask());
const real& percent = cod2IVA(m);
imposta = scorpora(imponibile, percent);
m.set(101, imponibile);
f.set(imposta.string());
@ -1364,14 +1427,14 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
}
}
TBill oldconto(row, 6, 0x0); // g/c/s 6 7 8
TClinton oldconto(row, TRUE);
if (oldconto.ok())
{
oldpos = bill2pos(oldconto, 'I');
oldpos = clint2pos(oldconto, 'I');
if (oldpos < 0)
{
const TString d(cau.desc_agg(2));
oldpos = a.set_cgs_row(-1, a.real2imp(ZERO, 'I'), oldconto, d, 'I');
oldpos = a.set_cgs_row(-1, a.real2imp(ZERO, 'I'), oldconto, d, 'I', oldconto.commessa(), oldconto.fase());
}
}
else
@ -1392,7 +1455,8 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
i -= oldimp;
i.normalize();
a.set_cgs_imp(oldpos, i);
if (i.is_zero()) delimp = oldpos;
if (i.is_zero())
delimp = oldpos;
}
if (oldposiva >= 0) // Se conto IVA esisteva anche prima ...
{ // sottrai la vecchia imposta
@ -1400,7 +1464,8 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
i -= oldiva;
i.normalize();
a.set_cgs_imp(oldposiva, i);
if (i.is_zero()) deliva = oldposiva;
if (i.is_zero())
deliva = oldposiva;
}
real imponibile(row.get(0)); // Nuovo imponibile
@ -1413,14 +1478,14 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
imposta = i.scorpora(imponibile); // ... scorpora imposta dall'imponibile
}
TBill conto(row, 5, 0x3);
int newpos = bill2pos(conto, 'I'); // Riga in cui andra' l'imponibile
TClinton conto(row, TRUE);
int newpos = clint2pos(conto, 'I'); // Riga in cui andra' l'imponibile
const bool detrarre = detraibile(row); // Determina se IVA detraibile
// Calcola riga causale col conto opportuno
const int ri = detrarre ? RIGA_IVA_DETRAIBILE : RIGA_IVA_NON_DETRAIBILE;
TBill contoiva; cau.bill(ri, contoiva);
TBill contoiva; cau.bill(ri, contoiva);
if (!detrarre && !contoiva.ok()) // Se non c'e' il conto IVA indetraibile ...
{ // ... somma imponibile e imposta
@ -1434,16 +1499,19 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
// Aggiorna conto sulla riga contabile
if (newpos < 0)
{
TString descr;
if (delimp >= 0)
{
TSheet_field& s = a.cgs();
descr = s.row(delimp).get(8); // Memorizza vecchia descrizione
a.reset_cgs_row(delimp); // Cancella vecchia riga
if (deliva > delimp) deliva--;
}
if (conto.ok() && !newimp.is_zero()) // Se c'e' imponibile ...
if (conto.ok() && !newimp.is_zero()) // Se c'e' imponibile ...
{ // crea una nuova riga contabile
const TString d(cau.desc_agg(2));
a.set_cgs_row(-1, newimp, conto, d, 'I');
if (descr.blank())
descr = cau.desc_agg(2);
newpos = a.set_cgs_row(-1, newimp, conto, descr, 'I', conto.commessa(), conto.fase());
}
}
else
@ -2132,7 +2200,12 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
{
// Creazione/Aggiornamento riga totale
const real tot(m.get(F_TOTALE));
set_cgs_row(riga_totale, real2imp(tot, 'T'), nuovo, m.get(F_DESCR), 'T');
TString descr;
if (riga_totale >= 0)
descr = cgs().row(riga_totale).get(8);
if (descr.blank())
descr = m.get(F_DESCR);
set_cgs_row(riga_totale, real2imp(tot, 'T'), nuovo, descr, 'T');
}
calcola_imp(); // Ricalcola totale IVA
@ -2268,6 +2341,8 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
const bool occas = clifo.get_bool(CLI_OCCAS);
m.show(F_OCCASEDIT, occas); // Bottone Dati anagrafici
m.show(F_STATOPAIV, !occas); // Stato partita IVA
if (!occas)
m.set(F_STATOPAIV, clifo.get(CLI_STATOPAIV));
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE, !occas); // Partita IVA
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE, !occas); // Codice Fiscale
@ -2620,7 +2695,7 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)
bool TPrimanota_application::corrvaluta_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
TMask_field& cl = m.field(F_CORRLIRE);
TMask_field& cl = m.field(F_CORRISPETTIVO);
if (key == K_TAB && f.focusdirty())
{

View File

@ -27,6 +27,23 @@
class TDati_incasso;
class TClinton : public TBill
{
TString _cms, _fas;
public:
virtual int compare(const TSortable& obj) const;
public:
void set_commessa(const char* cms) { _cms = cms; _cms.rtrim(); }
void set_fase(const char* fas) { _fas = fas; _fas.rtrim(); }
const TString& commessa() const { return _cms; }
const TString& fase() const { return _fas; }
TClinton() { }
TClinton(TToken_string& row, bool iva = FALSE);
};
class TPrimanota_application : public TRelation_application
{
TMovimentoPN* _rel; // Relazione principale
@ -114,6 +131,7 @@ class TPrimanota_application : public TRelation_application
static bool codiva_handler(TMask_field& f, KEY key);
static bool imposta_handler(TMask_field& f, KEY key);
static bool dareavere_handler(TMask_field& f, KEY k);
static bool fase_handler(TMask_field& f, KEY key);
static bool cg_gruppo_handler(TMask_field& f, KEY key);
static bool cg_conto_handler(TMask_field& f, KEY key);
@ -200,6 +218,7 @@ protected:
static real scorpora(real& imponibile, const real& percentuale);
static bool detraibile(TToken_string& row);
static int bill2pos(const TBill& conto, char tipo);
static int clint2pos(const TClinton& conto, char tipo);
TipoIVA cau2IVA(const char* causale, int anno);
bool IVA2bill(const TCodiceIVA& iva, TBill& bill);
@ -227,7 +246,8 @@ protected:
real calcola_imp() const;
void add_cgs_tot(TMask& m);
int set_cgs_row(int n, const TImporto& importo, TBill& conto, const char* desc, char tipo);
int set_cgs_row(int n, const TImporto& importo, TBill& conto, const char* desc, char tipo,
const char* cms = NULL, const char* fas = NULL);
void set_cgs_imp(int n, const TImporto& importo);
bool add_cgs_imp(int n, const TImporto& importo);
bool sub_cgs_imp(int n, const TImporto& importo);

View File

@ -1149,6 +1149,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
}
// Importo della contropartita
if (!new_importo.is_zero() && new_conto.ok())
{
@ -1373,4 +1374,4 @@ bool TPrimanota_application::notify_cgline_deletion(int numrig)
found |= notify_cgline_deletion(*game, nreg, numrig);
return found;
}
}

View File

@ -313,21 +313,33 @@ BEGIN
WARNING "Fornitore inesistente sulla riga contabile"
END
NUMBER 115 7
STRING CG_COMMESSA 20
BEGIN
PROMPT 2 13 "******* "
PROMPT 2 13 "Commessa "
FLAGS "UZ"
USE CDC
INPUT CODTAB 115
DISPLAY "Codice@7" CODTAB
USE CMS
INPUT CODTAB CG_COMMESSA
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT 115 CODTAB
OUTPUT CG_COMMESSA CODTAB
CHECKTYPE NORMAL
END
STRING CG_FASE 10
BEGIN
PROMPT 36 13 "Fase "
FLAGS "UZ"
USE FSC
INPUT CODTAB CG_FASE
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT CG_FASE CODTAB
CHECKTYPE NORMAL
END
LIST CG_ROWTYPE 24
BEGIN
PROMPT 26 13 "Tipo riga "
PROMPT 26 14 "Tipo riga "
ITEM " |Sola contabilita'"
ITEM "A|Abbuoni attivi"
ITEM "C|Differenza cambi"
@ -347,17 +359,17 @@ BEGIN
END
BUTTON DLG_OK 9 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -14 -1 ""
END
BUTTON DLG_CANCEL 9 2
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -24 -1 ""
END
BUTTON DLG_DELREC 9 2
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -34 -1 "Elimina"
PICTURE BMP_DELREC
@ -370,7 +382,6 @@ BEGIN
PROMPT -44 -1 "~Partite"
END
ENDPAGE
ENDMASK

View File

@ -235,17 +235,39 @@ BEGIN
HELP "Tipo Costo/Ricavo del conto"
END
BUTTON DLG_OK 9 2
STRING 111 20
BEGIN
PROMPT 2 11 "Commessa "
FLAGS "UZ"
USE CMS
INPUT CODTAB 111
DISPLAY "Codice@20" CODTAB
DISPLAY "Decrizione@50" S0
OUTPUT 111 CODTAB
END
STRING 112 10
BEGIN
PROMPT 36 11 "Fase "
FLAGS "UZ"
USE FSC
INPUT CODTAB 112
DISPLAY "Codice@10" CODTAB
DISPLAY "Decrizione@50" S0
OUTPUT 112 CODTAB
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_CANCEL 9 2
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_DELREC 9 2
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -33 -1 "Elimina"
PICTURE BMP_DELREC

View File

@ -105,7 +105,8 @@ class TListaMov_application : public TPrintapp
liste _tipo_lista;
word _flags;
char _tipoc;
TString _cdc;
bool _cdc_only;
TDecoder _simbval, _descdoc;
protected:
@ -118,7 +119,10 @@ protected:
void init_print(const TMask& m);
void print_intra(int& rr);
void imposta_parametri_stampa(const TMask& msk);
void set_cdc_header(int& soh);
public:
bool user_create();
@ -140,6 +144,8 @@ public:
const TString& SimboloValuta (const char* cod);
const TString& DescrDoc(const char* cod);
const TString& cdc() const { return _cdc; }
TListaMov_application(char tipost);
virtual ~TListaMov_application() {}
};
@ -407,21 +413,6 @@ const TString& TListaMov_application::SimboloValuta(const char* cod)
const TString& TListaMov_application::DescrDoc(const char* tipo)
{
/*
TTable tab_tpd(TAB_TPD);
TString16 codtab; codtab.format ("%-2s", tipo);
tab_tpd.zero();
tab_tpd.put("CODTAB", codtab);
tab_tpd.read();
if (tab_tpd.good())
TMP = tab_tpd.get("S0");
else
TMP = "";
return TMP;
*/
return _descdoc.decode(tipo);
}
@ -445,40 +436,48 @@ const char * AttivitaRegistro (const char * cod, int anno)
int CodiceRegistro (const char* cod, int anno)
{
/*
TTable tab_reg("REG");
TString16 codtab;
codtab.format("%4d%-3s", anno, cod);
int tipo_reg;
tab_reg.zero();
tab_reg.put("CODTAB", codtab);
tab_reg.read();
if (tab_reg.good())
tipo_reg = tab_reg.get_int("I0");
else
tipo_reg = 0;
return tipo_reg;
*/
static TDecoder tab_reg("REG", "I0");
TString16 codtab; codtab.format("%4d%-3s", anno, cod);
int tipo_reg = atoi(tab_reg.decode(codtab));
return tipo_reg;
const TString& tipo_reg = cache().get("REG", codtab, "I0");
return atoi(tipo_reg);
}
// Controlla che il movimento abbia almeno una riga con la commessa voluta
bool cdc_filter(const TRelation* rel)
{
bool ok = FALSE;
TLocalisamfile& rmov = rel->lfile(LF_RMOV);
const TRecnotype oldpos = rmov.recno();
const long numreg = rel->curr(LF_MOV).get_long(MOV_NUMREG);
const TString& cdc = app().cdc();
rmov.zero();
rmov.put(RMV_NUMREG, numreg);
rmov.put(RMV_NUMRIG, 1);
for (int err = rmov.read(_isgteq); err == NOERR; err = rmov.next())
{
if (rmov.get_long(RMV_NUMREG) != numreg)
break;
if (rmov.get(RMV_CODCMS) == cdc)
{
ok = TRUE;
break;
}
}
rmov.readat(oldpos);
return ok;
}
bool filter_func_fatture (const TRelation* rel)
{
const TRectype& mov = rel->curr(LF_MOV);
const TRectype& mov = rel->curr(LF_MOV);
// Altrimenti stampa anche i corrispettivi! Pseudo errore MI2396
long codcf = mov.get_long(MOV_CODCF);
if (codcf <= 0)
return FALSE;
int ann_reg = mov.get_int (MOV_ANNOIVA);
TString16 cod_reg = mov.get (MOV_REG);
int tipo_reg = CodiceRegistro (cod_reg, ann_reg);
const int ann_reg = mov.get_int(MOV_ANNOIVA);
const TString16 cod_reg = mov.get(MOV_REG);
const int tipo_reg = CodiceRegistro (cod_reg, ann_reg);
// Considera solo iva acquisti o vendite
if (tipo_reg != 1 && tipo_reg != 2)
@ -501,14 +500,16 @@ bool filter_func_fatture (const TRelation* rel)
if (app()._codice_fin != 0)
to.put(MOV_CODCF, app()._codice_fin);
if (mov >= from && mov <= to)
return TRUE;
bool ok = mov >= from && mov <= to;
if (ok && app().cdc().not_empty())
ok = cdc_filter(rel);
return FALSE;
return ok;
}
bool filter_func (const TRelation * rel)
{
{
bool ok = FALSE;
int tipo_reg, ann_reg;
TString cod_reg, causale;
TLocalisamfile* mov = &(rel->lfile(LF_MOV));
@ -530,8 +531,7 @@ bool filter_func (const TRelation * rel)
to.put(MOV_CODCAUS, app()._causale_fin);
from.put(MOV_REG, app()._registro_ini);
to.put(MOV_REG, app()._registro_fin);
if ((mov->curr() >= from) && (mov->curr() <= to))
return TRUE;
ok = (mov->curr() >= from) && (mov->curr() <= to);
break;
case 1:
cod_reg = mov->get (MOV_REG);
@ -548,16 +548,17 @@ bool filter_func (const TRelation * rel)
from.put(MOV_CODCAUS, app()._causale_ini);
to.put(MOV_CODCAUS, app()._causale_fin);
if (((mov->curr() >= from) && (mov->curr() <= to)) &&
((tipo_reg != 1) && (tipo_reg != 2)))
return TRUE;
ok = ((mov->curr() >= from) && (mov->curr() <= to)) &&
((tipo_reg != 1) && (tipo_reg != 2));
break;
default:
break;
}
return FALSE;
if (ok && app().cdc().not_empty())
ok = cdc_filter(rel);
return ok;
}
void TListaMov_application::stampa_errori_rmov()
@ -755,6 +756,20 @@ void TListaMov_application::set_page(int file, int count)
if (file == LF_RMOV)
{
_nr = 1;
if (_cdc.not_empty())
{
const TRectype& rec = current_cursor()->curr(LF_RMOV);
if (rec.get(RMV_CODCMS) == _cdc)
{
if (!_cdc_only)
set_row(_nr,"@0g@b"); // Grassettiamo le righe interessate
}
else
{
if (_cdc_only)
return;
}
}
set_row(_nr,"@3n",FLD(LF_RMOV,RMV_NUMRIG));
set_row(_nr,"@30g@22s",FLD(LF_RMOV,RMV_DESCR));
set_row(_nr,"@54g@3,rn",FLD(LF_RMOV,RMV_GRUPPO));
@ -1217,7 +1232,7 @@ void TListaMov_application::print_intra(int& rr)
const TCurrency cl(mov.get_real(MOV_CORRLIRE));
str = cl.string(TRUE); str.right_just(19);
set_row(rr,"Corr.in lire@14g%s", (const char*)str);
set_row(rr,"Corrispettivo@14g%s", (const char*)str);
const TCurrency cv(corrval, codval);
str = cv.string(TRUE); str.right_just(19);
@ -1894,58 +1909,36 @@ void TListaMov_application::incrementa_totali()
_tabiva->zero();
if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
{
TString colonna = _tabiva->get("S7");
if ((colonna == "1")||(colonna == "3"))
const int colonna = _tabiva->get_int("S7");
if ((colonna == 1)||(colonna == 3))
_totimposta += imposta;
if (colonna == "1")
if (colonna == 1)
_totimponibile += imponibile;
else
if (colonna == "3")
if (colonna == 3)
_op_esenti += imponibile;
}
else
{
TString colonna = _tabiva->get("S8");
if ((colonna == "1")||(colonna == "3")||(colonna == "4"))
const int colonna = _tabiva->get_int("S8");
if ((colonna == 1)||(colonna == 3)||(colonna == 4))
_totimposta += imposta;
if (colonna == "1")
if (colonna == 1)
_totimponibile += imponibile;
else
if (colonna == "3")
if (colonna == 3)
_op_esenti += imponibile;
else
if (colonna == "4")
if (colonna == 4)
_op_non_imp += imponibile;
}
}
bool TListaMov_application::set_print(int m)
void TListaMov_application::imposta_parametri_stampa(const TMask& msk)
{
TString16 masc;
switch(toupper(_tipoc))
{
case 'C':
masc = "cg3100b";
_tipo_lista = fatture;
break;
case 'M':
default :
masc = "cg3100a";
_tipo_lista = movimenti;
break;
}
TMask msk(masc);
msk.set_handler(F_ANNO, annoes_handler);
msk.set_handler(F_DATAINI, data_inizio);
msk.set_handler(F_DATAFIN, data_fine);
if (msk.run() != K_ENTER)
return FALSE;
set_magic_currency(TRUE);
reset_files();
// TLocalisamfile* fl;
_curr1->set_filterfunction (filter_func);
_curr2->set_filterfunction (filter_func);
_curr3->set_filterfunction (filter_func_fatture);
@ -1976,12 +1969,12 @@ bool TListaMov_application::set_print(int m)
else if (_provvis == 2) //globale
_curr1->setfilter("");
else _curr1->setfilter("(PROVVIS!=\"\")"); //solo provvisori
TRectype da(LF_MOV), a(LF_MOV);
da.put(MOV_NUMREG, _numreg_ini);
a.put(MOV_NUMREG, _numreg_fin);
current_cursor()->setregion(da,a);
add_file(LF_MOV);
add_file(LF_RMOV,LF_MOV);
add_file(LF_RMOVIVA,LF_MOV);
@ -2007,7 +2000,7 @@ bool TListaMov_application::set_print(int m)
}
}
break;
case fatture:
{
_noseparator = msk.get_bool(F_SEPARATOR);
@ -2026,7 +2019,7 @@ bool TListaMov_application::set_print(int m)
_codice_ini = atol(msk.get(F_CODICEINI1));
_codice_fin = atol(msk.get(F_CODICEFIN1));
}
// _relmov->add(LF_MOV, "NUMREG=NUMREG",1, LF_RMOVIVA,100); //creo un alias per il file LF_MOV
if (tipo == "E")
{
@ -2052,14 +2045,61 @@ bool TListaMov_application::set_print(int m)
add_file(LF_RMOVIVA,LF_MOV);
}
break;
default:
break;
}
init_print(msk);
}
return TRUE;
bool TListaMov_application::set_print(int)
{
const char* masc;
switch(toupper(_tipoc))
{
case 'C':
masc = "cg3100b";
_tipo_lista = fatture;
break;
case 'M':
default :
masc = "cg3100a";
_tipo_lista = movimenti;
break;
}
TMask msk(masc);
msk.set_handler(F_ANNO, annoes_handler);
msk.set_handler(F_DATAINI, data_inizio);
msk.set_handler(F_DATAFIN, data_fine);
while (msk.run() == K_ENTER)
{
if (msk.get(F_DACDC).not_empty() || msk.get(F_ACDC).not_empty())
{
_cdc_only = msk.get_bool(F_CDC_ONLY);
TRelation rel("CMS");
TRectype darec(rel.curr()), arec(rel.curr());
darec.put("CODTAB", msk.get(F_DACDC));
arec.put("CODTAB", msk.get(F_ACDC));
TCursor cur(&rel, "", 1, &darec, &arec);
const long items = cur.items();
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
{
_cdc = rel.curr().get("CODTAB");
imposta_parametri_stampa(msk);
print();
}
}
else
{
_cdc_only = FALSE;
_cdc.cut(0);
imposta_parametri_stampa(msk);
print();
}
}
return FALSE;
}
@ -2127,7 +2167,6 @@ void TListaMov_application::init_print(const TMask& msk)
printer().footerlen(5);
set_magic_currency(TRUE);
// set_curr_codval(msk.get(F_CODVAL)); // Commentato in maschera
switch (_tipo_lista)
{
@ -2231,13 +2270,13 @@ void TListaMov_application::init_print(const TMask& msk)
TString tipo = msk.get(F_TIPOELENCO);
if ((tipo=="C")||(tipo=="F"))
{
_codice_ini = atol(msk.get(F_CODICEINI));
_codice_fin = atol(msk.get(F_CODICEFIN));
_codice_ini = msk.get_long(F_CODICEINI);
_codice_fin = msk.get_long(F_CODICEFIN);
}
else
{
_codice_ini = atol(msk.get(F_CODICEINI1));
_codice_fin = atol(msk.get(F_CODICEFIN1));
_codice_ini = msk.get_long(F_CODICEINI1);
_codice_fin = msk.get_long(F_CODICEFIN1);
}
if (_codice_ini != 0)
_flags |= ST_CODICE;
@ -2260,6 +2299,16 @@ void TListaMov_application::init_print(const TMask& msk)
}
}
void TListaMov_application::set_cdc_header(int& soh)
{
if (_cdc.not_empty())
{
TString str;
str.cut(0) << "@bCommessa " << _cdc << " - " << cache().get("CMS", _cdc, "S0");
set_header(++soh, str);
}
}
void TListaMov_application::preprocess_header()
{
int soh; // riga d'inizio dell'intestazione
@ -2355,7 +2404,8 @@ void TListaMov_application::preprocess_header()
else
set_header (soh, "@78gcon messaggio: data competenza");
}
sep.fill('-');
set_cdc_header(soh);
sep.fill('_');
set_header (++soh, (const char *) sep);
set_header (++soh, "Rg Cod Causale@30gDescrizione@56gCodice conto@71gDescrizione conto@103gDare@120gAvere@130gSB");
}
@ -2398,7 +2448,8 @@ void TListaMov_application::preprocess_header()
}
else
set_header (soh++, "@86gtutte le causali");
sep.fill('-');
set_cdc_header(soh);
sep.fill('_');
set_header (soh++, (const char *) sep);
set_header (soh, "Rg Cod Causale@30gDescrizione@56gCodice conto@71gDescrizione conto@103gDare@120gAvere@130gSB");
}
@ -2429,7 +2480,8 @@ void TListaMov_application::preprocess_header()
set_header (soh, "@74gdal codice %ld", _codice_ini);
set_header (soh, "@92gal codice %ld", _codice_fin);
}
sep.fill('-');
set_cdc_header(soh);
sep.fill('_');
set_header (++soh, (const char *) sep);
set_header (++soh, "Numero Data Cod Prot. M Documento@48gCod Tp @75gTotale@101gCd Tp T O@129gNo");
set_header (++soh, "Regis. Operaz. Reg Num. L Data@41gNumero@48gCau Dc @55gDescrizione@75gDocumento@90gImponibile@101gIv Det A I@121gImposta@129gAll");
@ -2437,7 +2489,8 @@ void TListaMov_application::preprocess_header()
default:
break;
}
}
set_header (++soh,(const char*)sep);
}

View File

@ -17,24 +17,27 @@
#define F_CAUSALEFIN 113
#define F_REGISTROINI 114
#define F_REGISTROFIN 115
#define F_STAMPA 116
#define F_TIPOELENCO 117
#define F_CODICEINI 118
#define F_CODICEFIN 119
#define F_CAMBIO 120
#define F_DECIDI 121
#define F_ANNOC 122
#define F_CODICEINI1 123
#define F_CODICEFIN1 124
#define F_MOVIMENTI 125
#define F_STAMPAMOVP 126
#define F_RAGSOCINI 127
#define F_RAGSOCFIN 128
#define F_RAGSOCINI1 129
#define F_RAGSOCFIN1 130
#define F_SEPARATOR 131
#define F_CODVAL 132
#define F_DESVAL 133
#define F_STAMPA 116
#define F_TIPOELENCO 117
#define F_CODICEINI 118
#define F_CODICEFIN 119
#define F_CAMBIO 120
#define F_DECIDI 121
#define F_ANNOC 122
#define F_CODICEINI1 123
#define F_CODICEFIN1 124
#define F_MOVIMENTI 125
#define F_STAMPAMOVP 126
#define F_RAGSOCINI 127
#define F_RAGSOCFIN 128
#define F_RAGSOCINI1 129
#define F_RAGSOCFIN1 130
#define F_SEPARATOR 131
#define F_DACDC 132
#define F_DACDC_DES 133
#define F_ACDC 134
#define F_ACDC_DES 135
#define F_CDC_ONLY 136
#define ST_DATA 0x0001
#define ST_NUMERO 0x0002

View File

@ -1,6 +1,6 @@
#include "cg3100.h"
TOOLBAR "" 0 20 0 2
TOOLBAR "" 0 -2 0 2
BUTTON DLG_PRINT 10 2
BEGIN
@ -225,31 +225,66 @@ BEGIN
ITEM "3|Solo provvisori"
END
/*
STRING F_CODVAL 3
GROUPBOX DLG_NULL 71 4
BEGIN
PROMPT 2 18 "Valuta "
USE %VAL
INPUT CODTAB F_CODVAL
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODVAL CODTAB
OUTPUT F_DESVAL S0
CHECKTYPE NORMAL
FLAGS "U"
PROMPT 2 18 "@bCentri di costo"
GROUP 4
END
STRING F_DESVAL 50
BOOLEAN F_CDC_ONLY
BEGIN
PROMPT 20 18 ""
USE %VAL KEY 2
INPUT S0 F_DESVAL
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT F_CODVAL
CHECKTYPE NORMAL
PROMPT 22 18 "Stampa solo le righe relative ai centri di costo"
END
STRING F_DACDC 20
BEGIN
PROMPT 3 19 "Da "
FLAGS "UZ"
USE CMS
INPUT CODTAB F_DACDC
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@70" S0
OUTPUT F_DACDC CODTAB
OUTPUT F_DACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_DACDC_DES 70 39
BEGIN
PROMPT 30 19 ""
USE CMS KEY 2
INPUT S0 F_DACDC_DES
DISPLAY "Descrizione@70" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_DACDC
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC 20
BEGIN
PROMPT 3 20 "A "
FLAGS "UZ"
COPY USE F_DACDC
INPUT CODTAB F_ACDC
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
OUTPUT F_ACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC_DES 70 39
BEGIN
PROMPT 30 20 ""
COPY USE F_DACDC_DES
INPUT S0 F_ACDC_DES
COPY DISPLAY F_DACDC_DES
COPY OUTPUT F_ACDC
CHECKTYPE SEARCH
GROUP 4
END
*/
ENDPAGE

View File

@ -1,5 +1,20 @@
#include "cg3100.h"
TOOLBAR "" 0 -2 0 2
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -11 ""
END
ENDPAGE
PAGE "Lista Fatture" -1 -1 73 17
NUMBER F_CODDITTA 5
@ -218,29 +233,65 @@ BEGIN
PROMPT 2 13 "Non stampare i separatori delle migliaia"
END
/*
STRING F_CODVAL 3
GROUPBOX DLG_NULL 71 4
BEGIN
PROMPT 2 14 "Valuta "
USE %VAL
INPUT CODTAB F_CODVAL
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODVAL CODTAB
CHECKTYPE NORMAL
FLAGS "U"
END
*/
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -1 "~Stampa"
MESSAGE EXIT,K_ENTER
PROMPT 2 18 "@bCentri di costo"
GROUP 4
END
BUTTON DLG_QUIT 10 2
BOOLEAN F_CDC_ONLY
BEGIN
PROMPT -22 -1 ""
PROMPT 22 18 "Stampa solo le righe relative ai centri di costo"
END
STRING F_DACDC 20
BEGIN
PROMPT 3 19 "Da "
FLAGS "UZ"
USE CMS
INPUT CODTAB F_DACDC
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@70" S0
OUTPUT F_DACDC CODTAB
OUTPUT F_DACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_DACDC_DES 70 39
BEGIN
PROMPT 30 19 ""
USE CMS KEY 2
INPUT S0 F_DACDC_DES
DISPLAY "Descrizione@70" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_DACDC
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC 20
BEGIN
PROMPT 3 20 "A "
FLAGS "UZ"
COPY USE F_DACDC
INPUT CODTAB F_ACDC
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
OUTPUT F_ACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC_DES 70 39
BEGIN
PROMPT 30 20 ""
COPY USE F_DACDC_DES
INPUT S0 F_ACDC_DES
COPY DISPLAY F_DACDC_DES
COPY OUTPUT F_ACDC
CHECKTYPE SEARCH
GROUP 4
END
ENDPAGE

View File

@ -1,6 +1,7 @@
#include <currency.h>
#include <execp.h>
#include <mailbox.h>
#include <modaut.h>
#include <msksheet.h>
#include <printapp.h>
#include <tabutil.h>
@ -131,6 +132,9 @@ class TMastrini_application : public TPrintapp
bool _noseparator;
TString _real_picture;
TString _cdc;
real _totale_commessa_dare, _totale_commessa_avere, _saldo_commessa;
TConfig* _collins;
@ -184,6 +188,7 @@ public:
void carica_array_totali132();
void carica_array_totali198();
void stampa_totaliiva();
void stampa_totali_commessa();
void ricerca_classe_IV(bool scelta);
void data_fine_esercizio(int);
const char* descrizione_gruppo();
@ -648,50 +653,49 @@ int TMastrini_application::date2esc(const TDate& d)
bool TMastrini_application::almeno_un_record()
{
bool trovato=FALSE;
long record,sottoc;
int gruppo,conto;
TDate datareg, datacomp;
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
if (current_cursor()->is_first_match(LF_RMOV))
{
record = rmov.recno();
TLocalisamfile& rmov_file = current_cursor()->file(LF_RMOV);
const TRecnotype record = rmov_file.recno();
TRelation rel(LF_RMOV);
rel.add(LF_MOV, "NUMREG==NUMREG");
TRectype& rmov = rel.curr();
TRectype& mov = rel.curr(LF_MOV);
TString filter;
if (_cdc.not_empty())
filter << RMV_CODCMS << "==\"" << _cdc << '"';
rmov.zero();
rmov.put(RMV_GRUPPO, _gruppo);
rmov.put(RMV_CONTO, _conto);
rmov.put(RMV_SOTTOCONTO, _sottoc);
for (rmov.read(); !rmov.eof() ;rmov.next())
{
int annoes = rmov.get_int (RMV_ANNOES);
long numreg = rmov.get_long(RMV_NUMREG);
TCursor cur(&rel, filter, 2, &rmov, &rmov);
const long items = cur.items();
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
{
const int annoes = rmov.get_int (RMV_ANNOES);
const long numreg = rmov.get_long(RMV_NUMREG);
_mov->setkey(1);
_mov->curr().zero();
_mov->curr().put(MOV_NUMREG,numreg);
_mov->read();
if (_mov->bad())
_mov->zero();
datacomp = (_mov->curr().get(MOV_DATACOMP));
const TString16 provvis (_mov->curr().get(MOV_PROVVIS));
const TDate datacomp = mov.get(MOV_DATACOMP);
const TString16 provvis = mov.get(MOV_PROVVIS);
TDate datareg;
if (_annomsk == 0)
datareg = rmov.get_date(RMV_DATAREG);
else
datareg = datacomp;
gruppo = rmov.get_int(RMV_GRUPPO);
conto = rmov.get_int(RMV_CONTO);
sottoc = rmov.get_long(RMV_SOTTOCONTO);
if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc))
if ( ((annoes==_annomsk) || (_annomsk==0)) && ((datareg>=_data_ini) && (datareg<=_data_fine)) && (_stampa_mov_prov || provvis.blank()))
{
trovato = TRUE;
break;
else
if ( ((annoes==_annomsk) || (_annomsk==0)) && ((datareg>=_data_ini) && (datareg<=_data_fine)) && (_stampa_mov_prov || provvis.blank()))
{
trovato = TRUE;
break;
}
}
}
rmov.readat(record);
rmov_file.readat(record);
}
return trovato;
}
@ -1017,6 +1021,33 @@ void TMastrini_application::fai_stampa198()
}
}
void TMastrini_application::stampa_totali_commessa()
{
if (_cdc.not_empty())
{
_rw = 1;
{
_saldo_commessa = _totale_commessa_dare - _totale_commessa_avere;
set_row (++_rw,"@32g@b%s", trans("TOTALI COMMESSA"));
if (_numcarat == 1)
{
set_row (_rw,"@66g%r", &_saldo_commessa);
set_row (_rw,"@83g%r", &_totale_commessa_dare);
set_row (_rw,"@100g%r", &_totale_commessa_avere);
}
else
{
set_row (_rw,"@100g%r", &_totale_commessa_dare);
set_row (_rw,"@117g%r", &_totale_commessa_avere);
if (!_stampa_des_contro)
set_row (_rw,"@135g%r", &_saldo_commessa);
}
}
}
}
void TMastrini_application::stampa_totali132()
{
TString sep(132);
@ -1041,6 +1072,7 @@ void TMastrini_application::stampa_totali132()
set_row (_rw,"@66g%r", &_saldo_progre);
set_row (_rw,"@83g%r", &_totprogre_dare);
set_row (_rw++,"@100g%r", &_totprogre_avere);
if (_stampaprogre) //Progressivi attuali
{
set_row (_rw,"@32g%s %s", trans("TOTALI PROGRESSIVI AL"), _ultima_data_reg.string());
@ -1215,27 +1247,24 @@ void TMastrini_application::stampa_totali198()
if (_nummast == 1 || _nummast == 3)
_rw = 1;
TString sep(198);
sep.fill('_'); //Stampa 198 - (sep(198))
set_row(_rw++,"@0g%s", (const char*)sep);
TString sep(198); sep.fill('_'); //Stampa 198 - (sep(198))
set_row(_rw,"@0g%s", (const char*)sep);
_totprogre_dare=_progredare+_totale_periodo_dare;
_totprogre_avere=_progreavere+_totale_periodo_avere;
set_row (_rw,"@32g%s@100g%r", trans("TOTALI PERIODO"), &_totale_periodo_dare);
set_row (++_rw,"@32g%s@100g%r", trans("TOTALI PERIODO"), &_totale_periodo_dare);
set_row (_rw,"@117g%r", &_totale_periodo_avere);
set_row (_rw,"@32g%s@100g%r", trans("TOTALI PROGRESSIVI"), &_totprogre_dare);
set_row (++_rw,"@32g%s@100g%r", trans("TOTALI PROGRESSIVI"), &_totprogre_dare);
set_row (_rw,"@117g%r", &_totprogre_avere);
set_row (_rw++,"@135g%r", &_saldo_progressivi);
set_row (_rw,"@135g%r", &_saldo_progressivi);
if (!_stampa_des_contro)
set_row (_rw++,"@151g%r", &_saldo_movimenti);
set_row (_rw,"@151g%r", &_saldo_movimenti);
if (_stampaprogre) //Progressivi attuali
{
_saldo_progre_al = _totprogre_dare_al - _totprogre_avere_al;
set_row(_rw,"@32g%s@55g%s", trans("TOTALI PROGRESSIVI AL"), _ultima_data_reg.string());
set_row(++_rw,"@32g%s@55g%s", trans("TOTALI PROGRESSIVI AL"), _ultima_data_reg.string());
set_row (_rw,"@100g%r", &_totprogre_dare_al);
set_row (_rw,"@117g%r", &_totprogre_avere_al);
if (!_stampa_des_contro)
@ -1398,7 +1427,7 @@ void TMastrini_application::stampa_totali198_II()
if (_item_lista <= diff)
_lista.destroy();
_devi_stampare_footer = FALSE;
}
@ -1540,7 +1569,11 @@ bool TMastrini_application::preprocess_page(int file, int counter)
break;
case LF_RMOV:
{
{
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
if (_cdc.not_empty() && rmov.get(RMV_CODCMS) != _cdc)
return FALSE;
//Il flag _gia_stampata_intestazione serve nella stampa in continuo, xche'
//sono costretto a richiamare l'intestazione sia nella preprocess_page (per
//i mastrini con intestazione a meta' pagina), sia nella preprocess_header
@ -1555,10 +1588,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
// Ricerca la contropartita di quel movimento
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
_numreg = atol (current_cursor()->curr(LF_RMOV).get(RMV_NUMREG));
_numrig = atoi (current_cursor()->curr(LF_RMOV).get(RMV_NUMRIG));
_numreg = rmov.get_long(RMV_NUMREG);
_numrig = rmov.get_int(RMV_NUMRIG);
_gruppocontr = rmov.get_int (RMV_GRUPPOC);
_contocontr = rmov.get_int (RMV_CONTOC);
@ -1570,7 +1601,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
// Stampa solo quelli che hanno anno esercizio uguale a quello specificato
// nella maschera. Se non viene specificato li stampa tutti
_importo = current_cursor()->curr(LF_RMOV).get_real(RMV_IMPORTO);
_importo = rmov.get_real(RMV_IMPORTO);
_importo_str = real2str(_importo);
_mov->setkey(1);
_mov->curr().zero();
@ -1586,11 +1617,11 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (((_annoes == _annomsk) || (_annomsk == 0)) && (_totale_saldo != 0.0))
{
_sezione = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
_sezione = rmov.get(RMV_SEZIONE);
if (_annomsk == 0)
{
_datareg = (_mov->curr().get(MOV_DATAREG));
_datareg = _mov->curr().get(MOV_DATAREG);
_datareg_stampa = _datareg;
}
else
@ -1995,6 +2026,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
{
_totale_periodo_dare += _importo;
_riporto_parziale_dare += _importo;
_totale_commessa_dare += _importo;
if (_numcarat == 1) // Stampa 132 caratteri
set_row (_rw,"@83g%s", (const char*) _importo_str);
@ -2010,7 +2042,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
{
_totale_periodo_avere += _importo;
_riporto_parziale_avere += _importo;
_totale_commessa_avere += _importo;
if (_numcarat == 1) // Stampa 132 caratteri
set_row (_rw,"@100g%s", (const char*) _importo_str);
else
@ -2105,8 +2138,8 @@ void TMastrini_application::set_page(int file, int counter)
reset_print();
if (_numcarat == 1)
fai_stampa132();
else if (_numcarat == 2)
fai_stampa198();
else
fai_stampa198();
break;
default:
break;
@ -2169,9 +2202,8 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
reset_print();
if (_numcarat == 1)
stampa_totali132();
else if (_numcarat == 2)
stampa_totali198();
else
stampa_totali198();
if (_stampatotiva)
stampa_totaliiva();
}
@ -2179,10 +2211,12 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
{
reset_print();
if ((_totale_saldo != 0.0) && (_puoi_stampare))
{
if (_numcarat == 1)
stampa_totali132();
else if (_numcarat == 2)
stampa_totali198();
else
stampa_totali198();
}
if (_stampatotiva)
stampa_totaliiva();
}
@ -2190,10 +2224,12 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
{
reset_print();
if (_puoi_stampare)
{
if (_numcarat == 1)
stampa_totali132();
else if (_numcarat == 2)
stampa_totali198();
else
stampa_totali198();
}
if (_stampatotiva)
stampa_totaliiva();
}
@ -2206,8 +2242,7 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
if (_numcarat == 1)
carica_array_totali132();
else
if (_numcarat == 2)
carica_array_totali198();
carica_array_totali198();
}
if (_tipostampa == 3)
@ -2215,8 +2250,8 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
reset_print();
if (_numcarat == 1)
stampa_totali132_II();
else if (_numcarat == 2)
stampa_totali198_II();
else
stampa_totali198_II();
}
else if (_tipostampa == 2)
{
@ -2224,8 +2259,8 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
if ((_totale_saldo != 0.0) && (_puoi_stampare))
if (_numcarat == 1)
stampa_totali132_II();
else if (_numcarat == 2)
stampa_totali198_II();
else
stampa_totali198_II();
}
else if (_tipostampa == 1)
{
@ -2233,8 +2268,8 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
if (_puoi_stampare)
if (_numcarat == 1)
stampa_totali132_II();
else if (_numcarat == 2)
stampa_totali198_II();
else
stampa_totali198_II();
}
int item_lista = _lista.items();
@ -2273,41 +2308,12 @@ print_action TMastrini_application::postprocess_print(int file, int counter)
{
if (file == LF_SALDI)
{
/* Cazzata tremenda
_msk->reset(F_TIPOCF_INI);
_msk->reset(F_GRUPPOINI);
_msk->reset(F_CONTOINI_CONTO);
_msk->reset(F_CONTOINI_CLIENTE);
_msk->reset(F_CONTOINI_FORN);
_msk->reset(F_SOTTOCINI_CONTO);
_msk->reset(F_SOTTOCINI_CLIENTE);
_msk->reset(F_SOTTOCINI_FORN);
_msk->reset(F_DESCRINI_CONTO);
_msk->reset(F_DESCRINI_CLIENTE);
_msk->reset(F_DESCRINI_FORN);
_msk->reset(F_TIPOCF_FINE);
_msk->reset(F_GRUPPOFINE);
_msk->reset(F_CONTOFINE_CONTO);
_msk->reset(F_CONTOFINE_CLIENTE);
_msk->reset(F_CONTOFINE_FORN);
_msk->reset(F_SOTTOCFINE_CONTO);
_msk->reset(F_SOTTOCFINE_CLIENTE);
_msk->reset(F_SOTTOCFINE_FORN);
_msk->reset(F_DESCRFINE_CONTO);
_msk->reset(F_DESCRFINE_CLIENTE);
_msk->reset(F_DESCRFINE_FORN);
*/
reset_print();
stampa_totali_commessa();
print_one(file);
_msk->reset(-9);
}
}
return NEXT_PAGE;
}
// Stampa dei totali documenti iva se richiesta
@ -2320,10 +2326,11 @@ void TMastrini_application::stampa_totaliiva()
{
_rw = 7;
_ddociva_len++;
TString fmt (format("@%dg", _ddociva_len));
fmt << "%15s";
if (_stampatotiva)
{
TString16 fmt; fmt.format("@%dg", _ddociva_len);
fmt << "%15s";
for (int j = 0; j < _b.items(); j++)
{
TDociva& riga = (TDociva&)_b[j];
@ -2332,14 +2339,13 @@ void TMastrini_application::stampa_totaliiva()
TString string = real2str(totale);
set_row(_rw+j, fmt, (const char*)string);
}
}
_b.destroy();
}
}
// Ricerca della descrizione relativa al codice causale di MOV.dta
// sull'archivio CAUS.dta
void TMastrini_application::descrizione_causale()
{
_caus->setkey(1);
@ -2369,7 +2375,6 @@ void TMastrini_application::documenti_iva()
void TMastrini_application::ricerca_regiva()
{
TString16 dep;
_tabreg->curr().zero();
dep << format("%04d", _annoiva);
dep << format("%3s" , (const char*) _regiva);
@ -2417,65 +2422,64 @@ bool TMastrini_application::preprocess_print(int file, int counter)
bool TMastrini_application::set_print(int)
{
_puoi_stampare = TRUE;
KEY tasto;
// Controlla se esistono impostazioni di stampa in coda
if (sheet2mask())
KEY tasto = K_ENTER;
while (tasto == K_ENTER)
{
// Simula l'immediata pressione del tasto stampa senza nemmeno lanciare la maschera
tasto = K_ENTER;
}
else
{
tasto = _msk->run();
if (tasto == K_ENTER)
{
// Se lo sheet e' vuoto allora usa solo la maschera corrente per la stampa,
// altrimenti estrae il primo elemento sovrascrivendo la maschera corrente.
// Questa figata cerca di correggere gli errori MI6185 e MI3592 in una botta
TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE);
if (sht.items() != 0)
sheet2mask(); // Estrae la prima riga dalla coda di stampa
_puoi_stampare = TRUE;
// Controlla se esistono impostazioni di stampa in coda
if (sheet2mask())
{
// Simula l'immediata pressione del tasto stampa senza nemmeno lanciare la maschera
tasto = K_ENTER;
}
}
else
{
tasto = _msk->run();
if (tasto == K_ENTER)
{
// Se lo sheet e' vuoto allora usa solo la maschera corrente per la stampa,
// altrimenti estrae il primo elemento sovrascrivendo la maschera corrente.
// Questa figata cerca di correggere gli errori MI6185 e MI3592 in una botta
TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE);
if (sht.items() != 0)
sheet2mask(); // Estrae la prima riga dalla coda di stampa
}
}
if (tasto != K_ENTER)
break;
_noseparator = _msk->get_bool(F_SEPARATOR);
if (_noseparator)
_real_picture = "################";
else
_real_picture = "####.###.###.###";
set_real_picture(_real_picture);
set_magic_currency(TRUE);
_noseparator = _msk->get_bool(F_SEPARATOR);
if (_noseparator)
_real_picture = "################";
else
_real_picture = "####.###.###.###";
set_real_picture(_real_picture);
// set_curr_codval(_msk->get(F_VALUTA)); // Commentato in maschera
set_magic_currency(TRUE);
if (tasto == K_ENTER)
{
_codice_ditta = get_firm();
_annomsk = _msk->get_int(F_ANNO);
int gruppoini = _msk->get_int(F_GRUPPOINI);
int contoini = _msk->get_int(F_CONTOINI_CONTO);
long sottocontoini = _msk->get_long(F_SOTTOCINI_CONTO);
int gruppofine = _msk->get_int(F_GRUPPOFINE);
int contofine = _msk->get_int(F_CONTOFINE_CONTO);
long sottocontofine = _msk->get_long(F_SOTTOCFINE_CONTO);
_stampaprogre = _msk->get_bool(F_STAMPAPROGRE);
_stampatotiva = _msk->get_bool(F_STAMPATOTIVA);
_stampanum = _msk->get_int(F_STAMPANUM);
_stampa_mov_prov = _msk->get_bool(F_STAMPAMOVPROV);
_tipostampa = _msk->get_int(F_TIPOSTAMPA);
_numcarat = _msk->get_int(F_NUMCARAT);
_stampa_des_contro = (_numcarat==2) && _msk->get_bool(F_CONTRODES);
_nummast = _msk->get_int(F_NUMMAST);
_data_ini = _msk->get_date(F_DATAINI);
_data_fine = _msk->get_date(F_DATAFINE);
TEsercizi_contabili esc;
if (_annomsk != 0)
_anno_corrente = _annomsk;
else
@ -2484,31 +2488,31 @@ bool TMastrini_application::set_print(int)
_anno_corrente = _anno_ghost;
_inizioes = esc[_anno_ghost].inizio();
}
data_fine_esercizio(_anno_corrente); // Ricalcola _data_inizioese e _data_finese
if (!_data_ini.ok()) _data_ini = _data_inizioese;
if (!_data_fine.ok()) _data_fine = _data_finese;
_anno_precedente = esc.pred(_anno_corrente);
ricerca_dati_ditta();
if (_nummast == 1 || _nummast == 3)
printer().footerlen(4);
else
printer().footerlen(2);
//Crea il cursore su gruppo, conto e sottoconto del file RMOV
reset_files(); //resetta l'albero di stampa
add_file(LF_SALDI);
add_file(LF_RMOV,LF_SALDI);
if (_msk->get_bool(F_SORTDESC))
select_cursor(_cur2);
else
select_cursor(_cur1);
TRectype da(LF_SALDI), a(LF_SALDI);
da.put(SLD_GRUPPO,gruppoini);
da.put(SLD_CONTO,contoini);
@ -2519,7 +2523,7 @@ bool TMastrini_application::set_print(int)
current_cursor()->setregion(da, a);
if (_stampatotiva)
_b.destroy();
//_inizio_stampa = TRUE;
_numero_pag = 1;
if (_nummast == 3)
@ -2531,10 +2535,10 @@ bool TMastrini_application::set_print(int)
_conta_mastrini = 0;
_indice_lista = 0;
_ddociva_len = 0;
_riga.destroy();
_lista.destroy();
switch (_tipostampa)
{
case 1: _totale_saldo = 1.0; break;
@ -2542,14 +2546,33 @@ bool TMastrini_application::set_print(int)
case 3: _totale_saldo = 1.0; break;
default: break;
}
enable_print_menu();
enable_link("Collegamento prima nota: ", 'b');
return TRUE;
if (_msk->get(F_DACDC).not_empty() || _msk->get(F_ACDC).not_empty())
{
TRelation rel("CMS");
TRectype darec(rel.curr()), arec(rel.curr());
darec.put("CODTAB", _msk->get(F_DACDC));
arec.put("CODTAB", _msk->get(F_ACDC));
TCursor cur(&rel, "", 1, &darec, &arec);
const long items = cur.items();
cur.freeze();
_totale_commessa_dare = _totale_commessa_avere = ZERO;
for (cur = 0L; cur.pos() < items; ++cur)
{
_cdc = rel.curr().get("CODTAB");
print();
}
}
else
{
_cdc.cut(0);
print();
}
}
else
return FALSE;
return FALSE;
}
void TMastrini_application::data_fine_esercizio(int anno)
@ -2725,6 +2748,7 @@ void TMastrini_application::crea_intestazione()
TString sep(133),sep1(198);
sep = "";
reset_header();
int np = get_page_number();
@ -2746,9 +2770,6 @@ void TMastrini_application::crea_intestazione()
sep << "Pag. " << _pagina;
sep.right_just(132);
set_header(1,(const char*) sep);
sep ="";
set_header(2,"@1g%s",(const char*) sep);
//set_header(1,"@126gPag. %2d", _numero_pag++);
}
else if (_numcarat == 2)
{
@ -2761,9 +2782,6 @@ void TMastrini_application::crea_intestazione()
sep1 << "Pagina " << _pagina;
sep1.right_just(198);
set_header(1,(const char*) sep1);
sep1 ="";
set_header(2,"@1g%s",(const char*) sep1);
//set_header(1,"@190gPagina %2d", _numero_pag++);
}
if (_nummast != 3)
_pagina++;
@ -2777,18 +2795,26 @@ void TMastrini_application::crea_intestazione()
set_header (1, "@97g%-.5s", (const char*) _capulc);
set_header (1, "@103g%-.18s", (const char*) _com);
set_header (1, "@122g%-.3s", (const char*) _prov);
}
if (_cdc.not_empty())
{
const char* descr = cache().get("CMS", _cdc, "S0");
set_header(2, "@bCommessa %s - %s", (const char*)_cdc, descr);
}
if (_nummast == 3)
set_header (3, "@0g%s@12g@b%3d %3d %6ld", trans("Sottoconto"), _gruppo, _conto, _sottoc);
else
set_header (3, "@0g%s@12g%3d %3d %6ld", trans("Sottoconto"), _gruppo, _conto, _sottoc);
switch(_tmcf)
{
case 'C': _tipo_mask = 1; break;
case 'F': _tipo_mask = 2; break;
default : _tipo_mask = 3; break;
}
if (_tmcf == 'C')
_tipo_mask = 1;
else if (_tmcf == 'F')
_tipo_mask = 2;
else if (_tmcf == '\0')
_tipo_mask = 3;
switch (_tipo_mask)
{
case 1: ricerca_clifo();
@ -3156,39 +3182,40 @@ int TMastrini_application::stampa_progre_riporto(int start_riga)
void TMastrini_application::calcola_progressivi_al(const TDate& data_fin)
{
long record,sottoc,annoes;
int gruppo,conto;
TDate datareg, datacomp;
TLocalisamfile & rmov = current_cursor()->file(LF_RMOV);
char sezione;
real importo;
TDate data;
TLocalisamfile& rmov_file = current_cursor()->file(LF_RMOV);
const TRecnotype record = rmov_file.recno();
_totale_prima_dare = ZERO;
_totale_prima_avere = ZERO;
record = rmov.recno();
TRelation rel(LF_RMOV);
rel.add(LF_MOV, "NUMREG==NUMREG");
TRectype& rmov = rel.curr();
const TRectype& mov = rel.curr(LF_MOV);
TString filter;
if (_cdc.not_empty())
filter << RMV_CODCMS << "==\"" << _cdc << "\"";
rmov.zero();
rmov.put(RMV_GRUPPO, _gruppo);
rmov.put(RMV_CONTO, _conto);
rmov.put(RMV_SOTTOCONTO, _sottoc);
for (rmov.read();!rmov.eof() ;rmov.next())
TCursor cur(&rel, filter, 2, &rmov, &rmov);
const long items = cur.items();
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
{
annoes = rmov.get_int (RMV_ANNOES);
datareg = rmov.get_date(RMV_DATAREG);
sezione = rmov.get (RMV_SEZIONE)[0];
importo = rmov.get_real(RMV_IMPORTO);
const int annoes = rmov.get_int (RMV_ANNOES);
TDate datareg = rmov.get(RMV_DATAREG);
const char sezione = rmov.get_char(RMV_SEZIONE);
const real importo = rmov.get(RMV_IMPORTO);
long numreg = rmov.get_long(RMV_NUMREG);
_mov->setkey(1);
_mov->zero();
_mov->put(MOV_NUMREG,numreg);
_mov->read();
if (_mov->bad())
_mov->zero();
datacomp = _mov->curr().get(MOV_DATACOMP);
const TDate datacomp = mov.get(MOV_DATACOMP);
TDate data;
const TString16 provvis (_mov->curr().get(MOV_PROVVIS));
const TString16 provvis = mov.get(MOV_PROVVIS);
if (_stampa_mov_prov || (!_stampa_mov_prov && provvis.blank()))
{
if (_annomsk == 0)
@ -3202,9 +3229,9 @@ void TMastrini_application::calcola_progressivi_al(const TDate& data_fin)
data = _data_inizioese;
}
gruppo = rmov.get_int(RMV_GRUPPO);
conto = rmov.get_int(RMV_CONTO);
sottoc = rmov.get_long(RMV_SOTTOCONTO);
const int gruppo = rmov.get_int(RMV_GRUPPO);
const int conto = rmov.get_int(RMV_CONTO);
const long sottoc = rmov.get_long(RMV_SOTTOCONTO);
if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc))
break;
else
@ -3218,7 +3245,9 @@ void TMastrini_application::calcola_progressivi_al(const TDate& data_fin)
}
} // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty())))
}
rmov.readat(record);
// Riposiziona rmov
rmov_file.readat(record);
}
void TMastrini_application::calcola_progressivi(bool finali)
@ -3234,81 +3263,84 @@ void TMastrini_application::calcola_progressivi(bool finali)
char salini,salini_attuale,salfine_attuale;
saldo = ZERO; // Saldo iniziale (Guy: Ovvio no?)
// Ricerca sull'archivio saldi dei record con gruppo,conto,sottoconto
// uguali a quelli di rmov per il calcolo dei progressivi precedenti
saldi.setkey(2);
saldi.zero();
saldi.put(SLD_GRUPPO, _gruppo);
saldi.put(SLD_CONTO, _conto);
saldi.put(SLD_SOTTOCONTO, _sottoc);
const TRectype record(saldi.curr());
for (saldi.read(_isgteq); saldi.good() && saldi.curr() == record; saldi.next())
{
if (!saldi.get_bool(SLD_FLSCA))
{
const int annoes_saldi = saldi.curr().get_int(SLD_ANNOES);
//Calcola i progressivi dell'esercizio attuale
if (annoes_saldi == _anno_corrente)
{
progdare_attuale = saldi.get_real(SLD_PDARE);
progavere_attuale = saldi.get_real(SLD_PAVERE);
if (_stampa_mov_prov)
{
progdare_attuale += saldi.get_real(SLD_PDAREPRO);
progavere_attuale += saldi.get_real(SLD_PAVEREPRO);
}
saldo = saldi.get_real(SLD_SALDO);
salini = saldi.get(SLD_FLAGSALINI)[0];
_ultima_data_reg = saldi.get_date(SLD_DATAULMOV);
saldoini_attuale = saldi.get_real(SLD_SALDO);
salini_attuale = saldi.get_char(SLD_FLAGSALINI);
saldofine_attuale = saldi.get_real(SLD_SALDOFIN);
salfine_attuale = saldi.get_char(SLD_FLAGSALFIN);
}
} // if (!saldi.get_bool(SLD_FLSCA))
} // FOR
//Se il saldo dell'esercizio attuale non e' diverso da zero, allora il saldo
// finale dell'esercizio precedente devo calcolarmelo tenendo conto dell'indbil
if (_annomsk != 0 /* && saldo == ZERO */) // Guy: Non capisco perche' sia commentato!
{
if ((_indbil == 1) || (_indbil == 2) || (_indbil == 5))
{
const TRecnotype pos = saldi.recno();
// W96SALDI del 18-07-96 saldofin_esprec usa il flag TRUE xche' deve
// considerare anche il saldo finale
saldo = _sld->saldofin_esprec(_anno_corrente,_gruppo,_conto,_sottoc,TRUE, _stampa_mov_prov);
saldi.readat(pos);
if (saldo > ZERO)
if (_cdc.empty())
{
// Ricerca sull'archivio saldi dei record con gruppo,conto,sottoconto
// uguali a quelli di rmov per il calcolo dei progressivi precedenti
saldi.setkey(2);
saldi.zero();
saldi.put(SLD_GRUPPO, _gruppo);
saldi.put(SLD_CONTO, _conto);
saldi.put(SLD_SOTTOCONTO, _sottoc);
const TRectype record(saldi.curr());
for (saldi.read(_isgteq); saldi.good() && saldi.curr() == record; saldi.next())
{
if (!saldi.get_bool(SLD_FLSCA))
{
progredare_eseprec = saldo;
progdare_prec = saldo;
}
else if (saldo < ZERO)
{
saldo = -saldo;
progreavere_eseprec = saldo;
progavere_prec = saldo;
const int annoes_saldi = saldi.curr().get_int(SLD_ANNOES);
//Calcola i progressivi dell'esercizio attuale
if (annoes_saldi == _anno_corrente)
{
progdare_attuale = saldi.get_real(SLD_PDARE);
progavere_attuale = saldi.get_real(SLD_PAVERE);
if (_stampa_mov_prov)
{
progdare_attuale += saldi.get_real(SLD_PDAREPRO);
progavere_attuale += saldi.get_real(SLD_PAVEREPRO);
}
saldo = saldi.get_real(SLD_SALDO);
salini = saldi.get(SLD_FLAGSALINI)[0];
_ultima_data_reg = saldi.get_date(SLD_DATAULMOV);
saldoini_attuale = saldi.get_real(SLD_SALDO);
salini_attuale = saldi.get_char(SLD_FLAGSALINI);
saldofine_attuale = saldi.get_real(SLD_SALDOFIN);
salfine_attuale = saldi.get_char(SLD_FLAGSALFIN);
}
} // if (!saldi.get_bool(SLD_FLSCA))
} // FOR
//Se il saldo dell'esercizio attuale non e' diverso da zero, allora il saldo
// finale dell'esercizio precedente devo calcolarmelo tenendo conto dell'indbil
if (_annomsk != 0)
{
if ((_indbil == 1) || (_indbil == 2) || (_indbil == 5))
{
const TRecnotype pos = saldi.recno();
// W96SALDI del 18-07-96 saldofin_esprec usa il flag TRUE xche' deve
// considerare anche il saldo finale
saldo = _sld->saldofin_esprec(_anno_corrente,_gruppo,_conto,_sottoc,TRUE, _stampa_mov_prov);
saldi.readat(pos);
if (saldo > ZERO)
{
progredare_eseprec = saldo;
progdare_prec = saldo;
}
else if (saldo < ZERO)
{
saldo = -saldo;
progreavere_eseprec = saldo;
progavere_prec = saldo;
}
}
}
}
if (finali)
{
calcola_progressivi_al(_data_fine);
}
else
{
TDate giorno_prima = _data_ini; --giorno_prima; // CM500429
calcola_progressivi_al(giorno_prima);
}
//Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov
//che hanno la data di registrazione inferiore alla data di inizio stampa,
@ -3490,7 +3522,7 @@ void TMastrini_application::ricerca_clifo()
}
else
set_header(4,"@23g%-50s",(const char*) descriz);
dataini = _data_ini.string();
datafine = _data_fine.string();
@ -3838,6 +3870,12 @@ int TMastrini_application::ricerca_gruppo(int start)
{
set_row (r, "@r%s@23g@b%s", trans("Periodo di competenza"), (const char*) dataini);
set_row (r, "@35g%s@r", (const char*) datafine);
if (_cdc.not_empty())
{
const char* descr = cache().get("CMS", _cdc, "S0");
set_row(++r, "@bCommessa %s - %s", (const char*)_cdc, descr);
}
}
else
{
@ -3986,10 +4024,12 @@ bool TMastrini_application::sheet2mask()
short id = F_ANNO;
for (int pos = _msk->id2pos(id); pos >= 0; pos = _msk->id2pos(++id))
{
const char* val = row.get();
// Scarta i listbox perche azzerano i conti!
// Scarta i listbox perche' azzerano i conti!
if (id != F_TIPOCF_INI && id != F_TIPOCF_FINE)
{
const char* val = row.get();
_msk->fld(pos).set(val);
}
}
rows.destroy(0, TRUE);
@ -4031,6 +4071,9 @@ bool TMastrini_application::user_create()
set_handlers(_msk);
_msk->set_handler(F_MEMORIZZA, memorizza_handler);
if (!has_module(CMAUT))
_msk->hide(-4); // Spegne campi commesse in assenza del modulo relativo
TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE);
sht.set_notify(scelte_notify);
TMask& sm = sht.sheet_mask();
@ -4075,4 +4118,3 @@ int cg3200(int argc, char* argv[])
return 0;
}

View File

@ -36,10 +36,12 @@
#define F_STAMPATOTIVA 114
#define F_TIPOSTAMPA 115
#define F_STAMPAMOVPROV 116
#define F_SEPARATOR 117
#define F_VALUTA 118
#define F_DESVALUTA 119
#define F_SORTDESC 120
#define F_DACDC 117
#define F_ACDC 118
#define F_DACDC_DES 157
#define F_ACDC_DES 158
#define F_SEPARATOR 150
#define F_SORTDESC 151
#define F_MEMORIZZA 500
#define F_NUMCARAT 501
#define F_NUMMAST 502

View File

@ -1,6 +1,6 @@
#include "cg3200.h"
TOOLBAR "" 0 19 0 2
TOOLBAR "" 0 -2 0 2
BUTTON DLG_PRINT 18 2
BEGIN
@ -446,31 +446,61 @@ BEGIN
ITEM "3|Completa"
END
/*
STRING F_VALUTA 3
GROUPBOX DLG_NULL 71 4
BEGIN
PROMPT 4 17 "Valuta di stampa "
FLAGS "U"
USE %VAL
INPUT CODTAB F_VALUTA
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@60" S0
OUTPUT F_VALUTA CODTAB
OUTPUT F_DESVALUTA S0
CHECKTYPE NORMAL
PROMPT 4 17 "@bCentri di costo"
GROUP 4
END
STRING F_DESVALUTA 50 40
STRING F_DACDC 20
BEGIN
PROMPT 32 17 ""
USE %VAL KEY 2
INPUT S0 F_DESVALUTA
DISPLAY "Descrizione@60" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT F_VALUTA
CHECKTYPE NORMAL
PROMPT 5 18 "Da "
FLAGS "UZ"
USE CMS
INPUT CODTAB F_DACDC
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@70" S0
OUTPUT F_DACDC CODTAB
OUTPUT F_DACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_DACDC_DES 70 39
BEGIN
PROMPT 32 18 ""
USE CMS KEY 2
INPUT S0 F_DACDC_DES
DISPLAY "Descrizione@70" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_DACDC
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC 20
BEGIN
PROMPT 5 19 "A "
FLAGS "UZ"
COPY USE F_DACDC
INPUT CODTAB F_ACDC
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
OUTPUT F_ACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC_DES 70 39
BEGIN
PROMPT 32 19 ""
COPY USE F_DACDC_DES
INPUT S0 F_ACDC_DES
COPY DISPLAY F_DACDC_DES
COPY OUTPUT F_ACDC
CHECKTYPE SEARCH
GROUP 4
END
*/
ENDPAGE
@ -519,13 +549,15 @@ BEGIN
ITEM "Totali IVA"
ITEM "Tipo stampa"
ITEM "Provv."
ITEM "Da commessa"
ITEM "A commessa"
END
ENDPAGE
ENDMASK
PAGE "Scelte" -1 -1 68 13
PAGE "Scelte" -1 -1 68 14
NUMBER F_ANNO 4
BEGIN
@ -560,7 +592,7 @@ END
NUMBER F_CONTOINI_CLIENTE 3
BEGIN
PROMPT 50 2 ""
USE LF_PCON SELECT (TMCF=="C") // && (CONTO!="") && (SOTTOCONTO="")
USE LF_PCON SELECT (TMCF="C")
INPUT GRUPPO F_GRUPPOINI
INPUT CONTO F_CONTOINI_CLIENTE
DISPLAY "Gruppo" GRUPPO
@ -580,7 +612,7 @@ END
NUMBER F_CONTOINI_FORN 3
BEGIN
PROMPT 50 2 ""
USE LF_PCON SELECT (TMCF="F") // && (CONTO!="") && (SOTTOCONTO="")
USE LF_PCON SELECT (TMCF="F")
INPUT GRUPPO F_GRUPPOINI
INPUT CONTO F_CONTOINI_FORN
DISPLAY "Gruppo" GRUPPO
@ -599,7 +631,7 @@ END
NUMBER F_CONTOINI_CONTO 3
BEGIN
PROMPT 50 2 ""
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="")
USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO="")&&(TMCF="")
INPUT GRUPPO F_GRUPPOINI
INPUT CONTO F_CONTOINI_CONTO
DISPLAY "Gruppo" GRUPPO
@ -876,7 +908,6 @@ END
STRING F_DESCRFINE_CONTO 50
BEGIN
PROMPT 1 5 "Descrizione "
// FIELD LF_PCON->DESCR
USE LF_PCON KEY 2
INPUT DESCR F_DESCRFINE_CONTO
DISPLAY "Descrizione@50" DESCR
@ -929,6 +960,29 @@ BEGIN
ITEM "3|Completa"
END
STRING F_DACDC 20
BEGIN
PROMPT 1 11 "Da commessa "
FLAGS "UZ"
USE CMS
INPUT CODTAB F_DACDC
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@70" S0
OUTPUT F_DACDC CODTAB
CHECKTYPE SEARCH
END
STRING F_ACDC 20
BEGIN
PROMPT 1 12 "A commessa "
FLAGS "UZ"
COPY USE F_DACDC
INPUT CODTAB F_ACDC
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
CHECKTYPE SEARCH
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
[clienti]
[clifo]
Passo=4
RigheModulo=19
3 "@85g%12s" // partita IVA_dichiarante
3 "@112g%d" // numero di pagina
RigheModulo=22
3 "@85g%12s" // 0 - partita IVA_dichiarante
3 "@112g%d" // numero di pagina
7 "@4g%30s" // cognome |
7 "@41g%20s" // nome |
9 "@4g%2s" // gg_na |
@ -10,18 +10,18 @@ RigheModulo=19
9 "@11g%2s" // aa_na |
9 "@12g%c" // maschio | F I S I C A
9 "@16g%c" // femmina |
9 "@19g%50s" // comune_na |
9 "@56g%5s" // prov_na |
9 "@19g%50s" // comune_na |
9 "@56g%5s" // 10 - prov_na |
11 "@4g%35s" // via e numero civico |
11 "@40g%50s" //_dati_anag.comune_fis); |
11 "@57g%5s" //_dati_anag.prov_fis); |
13 "@4g%12s" //_dati_anag.pa_iva); |
13 "@17g%50s" //_dati_anag.attivita); |
13 "@52g%5s" //_dati_anag.cod_att_prev);
13 "@52g%5s" // _dati_anag.cod_att_prev);
7 "@61g%50s" // _dati_anag.rag_soc); |
7 "@113g%2d" // _dati_anag.nat_giu); |
9 "@61g%45s" // _dati_anag.via_fis); | P E R S O N A
9 "@96g%50s" // _dati_anag.comune_fis); |
9 "@61g%45s" // _dati_anag.via_fis); | P E R S O N A
9 "@96g%50s" // 20 - _dati_anag.comune_fis); |
9 "@114g%5s" // _dati_anag.prov_fis); | G I U R I D I C A
11 "@61g%45s" // _dati_anag.pa_iva); |
11 "@73g%50s" //_dati_anag.attivita); |
@ -29,31 +29,59 @@ RigheModulo=19
15 "@81g%d" //_dati_anag.num_pag numero di pagine stampate
15 "@99g%d" // num_righe numero di clienti fornitori
21 "@6g%d" // numero progressivo di dettaglio
20 "@12%30s" // cognome dettaglio
20 "@12g%30s" // cognome dettaglio
20 "@42g%20s" // nome dettaglio
20 "@67g%26s" // indirizzo dettaglio
20 "@67g%26s" // 30 - indirizzo dettaglio
20 "@94g%18s" // comune dettaglio
20 "@114g%2s" // provincia dettaglio
21 "@12g%16s" // pa IVA dettaglio
21 "@28g%4s" // ESC
21 "@28g%4d" // ESC
21 "@33g%1s" // Segno impesc
21 "@35g%12d" // Impesc
21 "@50g%1s" // Segno ivaesc
21 "@51g%12d" // Ivaesc
21 "@67g%1s" // Segno niesc
21 "@68g%12d" // niesc
21 "@68g%12d" // 40 - niesc
21 "@84g%1s" // Segno e8esc
21 "@85g%12d" // e8esc
21 "@101g%1s" // Segno totale
21 "@102g%12d" // totale
22 "@12%1s" // Casella partita iva
22 "@12g%1s" // Casella partita iva
22 "@28g%4d" // ESP
22 "@33g%1s" // Segno impesp
22 "@35g%12d" // Impesp
22 "@50g%1s" // Segno ivaesp
22 "@51g%12d" // Ivaesp
22 "@51g%12d" // 50 - Ivaesp
22 "@67g%1s" // Segno niesp
22 "@68g%12d" // niesp
22 "@84g%1s" // Segno e8esp
22 "@85g%12d" // e8esp
22 "@101g%1s" // Segno totalep
22 "@102g%12d" // totalep
22 "@102g%12d" // totalep
2 "@28g%4d" // 57 - RECB ESC
2 "@35g%12d" // RECB Impesc
2 "@51g%12d" // RECB Ivaesc
2 "@101g%1s" // RECB Segno totale
2 "@102g%12d" // RECB totale
4 "@28g%12d" // 62 - RIP ESC
4 "@33g%1s" // RIP Segno impesp
4 "@35g%12d" // RIP Impesp
4 "@50g%1s" // RIP Segno ivaesp
4 "@51g%12d" // RIP Ivaesp
4 "@67g%1s" // RIP Segno niesp
4 "@68g%12d" // RIP niesp
4 "@84g%1s" // RIP Segno e8esp
4 "@85g%12d" // 70 - RIP e8esp
4 "@101g%1s" // RIP Segno totalep
4 "@102g%12d" // RIP totalep
6 "@28g%12d" // 73 - TOT ESC
6 "@33g%1s" // TOT Segno impesp
6 "@35g%12d" // TOT Impesp
6 "@50g%1s" // TOT Segno ivaesp
6 "@51g%12d" // TOT Ivaesp
6 "@67g%1s" // TOT Segno niesp
6 "@68g%12d" // TOT niesp
6 "@84g%1s" // 80 - TOT Segno e8esp
6 "@85g%12d" // TOT e8esp
6 "@101g%1s" // TOT Segno totale
6 "@102g%12d" // TOT totale

View File

@ -26,8 +26,7 @@ class Array_desc_campi : public TObject
public:
const desc_campo& campi(int i) { return (const desc_campo&) _campi[i]; }
int riga (int i) { return ((const desc_campo&)_campi[i])._riga; }
const char * formato (int i)
{ return ((desc_campo&)_campi[i])._formato; }
const char* formato (int i) { return ((desc_campo&)_campi[i])._formato; }
void add (int, const char*);
void leggi_modulo (const char *, const char *);
@ -38,26 +37,26 @@ public:
virtual ~Array_desc_campi() {};
};
class Record_B {
class Record_B
{
int esc;
real impesc;
real ivaesc;
real tot;
public:
void compila (TLocalisamfile *);
void compila (const TRectype& all);
void azzera();
void somma();
real tot_real() { return tot; }
int esc_int() { return esc; }
real impesc_real() { return impesc; }
real ivaesc_real() { return ivaesc; }
const real& tot_real() const { return tot; }
int esc_int() const { return esc; }
const real& impesc_real() { return impesc; }
const real& ivaesc_real() const { return ivaesc; }
const char * tot_str() { return tot.string("@@@@@@@@@@@"); }
// const char * esc_str() { return esc.string("@@@@@@@@@@@"); }
const char * impesc_str() { return impesc.string("@@@@@@@@@@@"); }
const char * ivaesc_str() { return ivaesc.string("@@@@@@@@@@@"); }
const char* tot_str() const { return tot.string("@@@@@@@@@@@"); }
const char* impesc_str() const { return impesc.string("@@@@@@@@@@@"); }
const char* ivaesc_str() const { return ivaesc.string("@@@@@@@@@@@"); }
Record_B() : esc(0), impesc(0.00), ivaesc(0.00), tot(0.00) {};
virtual ~Record_B () {};
@ -129,8 +128,8 @@ class SortRecord {
protected:
TRectype& look_com(const char *);
long cerca_codice_all(TString tipo, long codcf) ;
const char * decodifica_desc_att (TString & codatt);
long cerca_codice_all(char tipo, long codcf) ;
const char * decodifica_desc_att (const TString & codatt);
bool corrispettivo (const char * tipodoc);
public:
@ -139,9 +138,9 @@ public:
const char * fill_dati_dettaglio (const char * tipo, long codcf);
const char * Strutt_str() { return (const char *) _all; }
struct alleg_sort * Strutt() { return _all; }
void compila(TLocalisamfile *);
void somma (TLocalisamfile *, stampe);
real importo() { return _all->impesc; }
void compila(const TRectype& alleg);
void somma (const TRectype& rec, stampe);
const real& importo() const { return _all->impesc; }
int RecSize () { return sizeof(struct alleg_sort); }
long codcf_dett() { return _all->codcf_dett; }
const real& Impesc() { return _all->impesc; }
@ -224,7 +223,7 @@ enum posizioni {
MASCHIO,
FEMMINA,
COMUNE_NA,
PROV_NA ,
PROV_NA , // 10
IND_FIS ,
COMUNE_FIS,
PROV_FIS ,
@ -234,7 +233,7 @@ enum posizioni {
RAGSOC_DIC ,
NAT_GIU ,
IND_GIU ,
COMUNE_GIU ,
COMUNE_GIU , // 20
PROV_GIU ,
PAIVA_GIU,
ATT_GIU ,
@ -244,7 +243,7 @@ enum posizioni {
PROG_DETT,
COG_DETT,
NOM_DETT,
VIA_DETT,
VIA_DETT, // 30
COM_DETT,
PRO_DETT,
PAIVA_DETT,
@ -254,7 +253,7 @@ enum posizioni {
SEGNO_IVAESC,
IVAESC_DETT,
SEGNO_NIESC,
NIESC_DETT,
NIESC_DETT, // 40
SEGNO_E8ESC,
E8ESC_DETT,
SEGNO_TOTC,
@ -264,19 +263,19 @@ enum posizioni {
SEGNO_IMPESP,
IMPESP_DETT,
SEGNO_IVAESP,
IVAESP_DETT,
IVAESP_DETT, // 50
SEGNO_NIESP,
NIESP_DETT,
SEGNO_E8ESP,
E8ESP_DETT,
SEGNO_TOTP,
TOTP_DETT,
RECB_ESC,
RECB_IMPESP,
RECB_ESC, // 57
RECB_IMPESC,
RECB_IVAESC,
RECB_SEGNO_TOT,
RECB_SEGNO_TOT, // 60
RECB_TOT,
RIP_ESC,
RIP_ESC, // 62
RIP_SEGNO_IMPESP,
RIP_IMPESP,
RIP_SEGNO_IVAESP,
@ -284,17 +283,17 @@ enum posizioni {
RIP_SEGNO_NIESP,
RIP_NIESP,
RIP_SEGNO_E8ESP,
RIP_E8ESP,
RIP_E8ESP, // 70
RIP_SEGNO_TOTALE,
RIP_TOTALE,
TOT_ESC,
TOT_ESC, // 73
TOT_SEGNO_IMPESP,
TOT_IMPESP,
TOT_SEGNO_IVAESP,
TOT_IVAESP,
TOT_SEGNO_NIESP,
TOT_NIESP,
TOT_SEGNO_E8ESP,
TOT_SEGNO_E8ESP, // 80
TOT_E8ESP,
TOT_SEGNO_TOTALE,
TOT_TOTALE

View File

@ -5,7 +5,7 @@
#include "cg3300b.h"
PAGE "" -1 -1 27 6
PAGE "Anno dichiarazione" -1 -1 27 5
NUMBER F_ANNO_RICALCOLA 4
BEGIN
@ -14,12 +14,12 @@ BEGIN
FLAGS "A"
END
BUTTON DLG_OK 9 3
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 3 ""
END
BUTTON DLG_CANCEL 9 3
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -22 3 ""
END

View File

@ -3,7 +3,6 @@
// classi di supporto per cg3300_application
//
#include <lffiles.h>
#include <isam.h>
#include <tabutil.h>
#include <strings.h>
@ -49,7 +48,7 @@ SortRecord::~SortRecord()
delete _all;
}
long SortRecord::cerca_codice_all(TString tipo, long codcf)
long SortRecord::cerca_codice_all(char tipo, long codcf)
{
TLocalisamfile& clifo = *_clifo;
@ -67,7 +66,7 @@ long SortRecord::cerca_codice_all(TString tipo, long codcf)
return 0L;
}
const char * SortRecord::decodifica_desc_att (TString & codatt)
const char* SortRecord::decodifica_desc_att (const TString& codatt)
{
TTable& attivita = * _attiv;
@ -191,23 +190,23 @@ const char * SortRecord::fill_dati_dettaglio (const char * tipocf, long codcf)
// Incrementa SOLO i totali di riga (che sono nella struttura)
// NON i totali e i riporti in fondo alla pagina
//
void SortRecord::somma (TLocalisamfile * alleg, stampe tipo_stampa)
void SortRecord::somma (const TRectype& alleg, stampe tipo_stampa)
{
switch (tipo_stampa)
{
case fornitori:
case clienti:
_all->impesc += alleg->curr().get_real (ALL_IMPESC);
_all->ivaesc += alleg->curr().get_real (ALL_IVAESC);
_all->niesc += alleg->curr().get_real (ALL_NIESC);
_all->e8esc += alleg->curr().get_real (ALL_E8ESC);
_all->ndocesc += alleg->curr().get_int (ALL_NDOCESC);
_all->impesc += alleg.get_real (ALL_IMPESC);
_all->ivaesc += alleg.get_real (ALL_IVAESC);
_all->niesc += alleg.get_real (ALL_NIESC);
_all->e8esc += alleg.get_real (ALL_E8ESC);
_all->ndocesc += alleg.get_int (ALL_NDOCESC);
_all->impesp += alleg->curr().get_real (ALL_IMPESP);
_all->ivaesp += alleg->curr().get_real (ALL_IVAESP);
_all->niesp += alleg->curr().get_real (ALL_NIESP);
_all->e8esp += alleg->curr().get_real (ALL_E8ESP);
_all->ndocesp += alleg->curr().get_int (ALL_NDOCESP);
_all->impesp += alleg.get_real (ALL_IMPESP);
_all->ivaesp += alleg.get_real (ALL_IVAESP);
_all->niesp += alleg.get_real (ALL_NIESP);
_all->e8esp += alleg.get_real (ALL_E8ESP);
_all->ndocesp += alleg.get_int (ALL_NDOCESP);
// Incremento totali di riga
_all->tot_rigac += _all->impesc + _all->ivaesc + _all->niesc + _all->e8esc;
@ -217,7 +216,7 @@ void SortRecord::somma (TLocalisamfile * alleg, stampe tipo_stampa)
case modulo101:
case modulo102:
_all->prog101102 += alleg->get_real("ALL_PROG101102");
_all->prog101102 += alleg.get_real("ALL_PROG101102");
break;
default:
@ -289,19 +288,19 @@ void SortRecord::azzera_struttura()
// Scarta i record con l'anno diverso da quello specificato
// nella maschera.
//
void SortRecord::compila(TLocalisamfile * _alleg)
void SortRecord::compila(const TRectype& alleg)
{
TString tipoa;
long codcf;
// azzera_struttura();
tipoa = _alleg->curr().get (ALL_TIPOCF);
tipoa = alleg.get (ALL_TIPOCF);
strcpy (_all->tipopers_dett, tipoa);
// strcpy (_all->tipopers_dett, _alleg->curr().get (ALL_TIPOCF));
codcf = _alleg->curr().get_long (ALL_CODCF);
codcf = alleg.get_long (ALL_CODCF);
_all->codcf_dett = codcf;
// _RecordSort->Strutt()->codcf_dett = _alleg->curr().get_long (ALL_CODCF);
@ -311,23 +310,23 @@ void SortRecord::compila(TLocalisamfile * _alleg)
//
// QUI CAMBIA IL CODICE ATTIVITA
//
strcpy (_all->codatt_dett, _alleg->curr().get (ALL_CODATT));
strcpy (_all->codatt_dett, alleg.get (ALL_CODATT));
_all->immesso = _alleg->curr().get_bool (ALL_IMMESSO);
_all->immesso = alleg.get_bool (ALL_IMMESSO);
_all->impesc = _alleg->curr().get_real (ALL_IMPESC);
_all->ivaesc = _alleg->curr().get_real (ALL_IVAESC);
_all->niesc = _alleg->curr().get_real (ALL_NIESC);
_all->e8esc = _alleg->curr().get_real (ALL_E8ESC);
_all->ndocesc = _alleg->curr().get_int (ALL_NDOCESC);
_all->impesc = alleg.get_real (ALL_IMPESC);
_all->ivaesc = alleg.get_real (ALL_IVAESC);
_all->niesc = alleg.get_real (ALL_NIESC);
_all->e8esc = alleg.get_real (ALL_E8ESC);
_all->ndocesc = alleg.get_int (ALL_NDOCESC);
_all->impesp = _alleg->curr().get_real (ALL_IMPESP);
_all->ivaesp = _alleg->curr().get_real (ALL_IVAESP);
_all->niesp = _alleg->curr().get_real (ALL_NIESP);
_all->e8esp = _alleg->curr().get_real (ALL_E8ESP);
_all->ndocesp = _alleg->curr().get_int (ALL_NDOCESP);
_all->impesp = alleg.get_real (ALL_IMPESP);
_all->ivaesp = alleg.get_real (ALL_IVAESP);
_all->niesp = alleg.get_real (ALL_NIESP);
_all->e8esp = alleg.get_real (ALL_E8ESP);
_all->ndocesp = alleg.get_int (ALL_NDOCESP);
_all->prog101102 = _alleg->curr().get_real (ALL_PROG101102);
_all->prog101102 = alleg.get_real (ALL_PROG101102);
fill_dati_dettaglio (tipoa, codcf);
}
@ -523,45 +522,47 @@ void Array_desc_campi::leggi_modulo (const char * file, const char *modulo)
{
TScanner s(file);
s.paragraph (modulo);
s.equal();
_passo = s.integer();
s.equal();
_righe_modulo = s.integer();
int riga;
TString formato;
while (s.ok())
if (s.paragraph(modulo))
{
riga = s.integer();
formato = s.string();
add (riga, formato);
s.equal();
_passo = s.integer();
s.equal();
_righe_modulo = s.integer();
while (s.ok())
{
const int riga = s.integer();
if (riga <= 0) // Ho raggiunto una riga vuota in fondo
break;
const TString& formato = s.string();
add (riga, formato);
}
}
else
error_box("Impossibile trovare la sezione '%s' sul file '%s'", modulo, file);
}
void Array_desc_campi::add(int r, const char * f)
void Array_desc_campi::add(int r, const char* f)
{
desc_campo * descr = new desc_campo;
CHECKD(r > 0, "Bad print row ", r);
desc_campo * descr = new desc_campo;
descr->_riga = r;
descr->_formato = f;
_campi.add (descr);
_campi.add(descr);
}
//
// Record_B
//
void Record_B::compila(TLocalisamfile *all)
void Record_B::compila(const TRectype& all)
{
esc = all->get_int (ALL_NDOCESC);
impesc = all->get_real (ALL_IMPESC);
ivaesc = all->get_real (ALL_IVAESC);
esc = all.get_int (ALL_NDOCESC);
impesc = all.get_real(ALL_IMPESC);
ivaesc = all.get_real(ALL_IVAESC);
tot = impesc + ivaesc;
}

View File

@ -161,7 +161,7 @@ public:
TString _s0, _s1, _s2, _s3, _s4, _s5, _s6;
real _r0, _r1, _r2, _r3, _r4, _r5,
_r6, _r7, _r8, _r9, _r10, _r11, _r12,
_r13, _r14, _r15, _r16, _r17, _r18, _r19;
_r13, _r14, _r15, _r16, _r17, _r18, _r19, _r20;
TArray _arr;
TDate _d0;

View File

@ -3183,16 +3183,14 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
{
// Riporta eventuale credito nella tabella parametri liquidazione dell'anno successivo
const real riporto = credito_utilizzabile - risultato;
if (riporto > ZERO) // Risultato a credito
if (riporto >= ZERO) // Risultato a credito
{
const TString16 yr = _year;
_year.format("%d", atoi(_year) + 1);
if (look_lia(0l, TRUE))
const int anno_prossimo = atoi(_year) + 1;
if (look_lia(0l, TRUE, anno_prossimo))
{
_lia->put("R0", riporto);
_lia->rewrite();
}
_year = yr;
}
}
// ciapa

View File

@ -1041,12 +1041,13 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
_descr_arr.add(t);
}
void TLiquidazione_app::describe_liq(int month, const char* codatts,
_DescrItem* di)
void TLiquidazione_app::describe_liq(int month, const char* codatts, _DescrItem* di)
{
if (!_isprint || !_canprint) return;
if (!_isprint || !_canprint)
return;
if (!look_lim(month)) return;
if (!look_lim(month))
return;
_DescrItem* d = new _DescrItem(THE_END);
@ -1096,6 +1097,13 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts,
// analogamente in Visualizzazione ma solo nel caso dell'annuale.
// In tutti gli altri casi va a cercare la delega
d->_r8 = (_month == 13 || !_is_visliq) ? _lim->get_real("R8") : versamenti_IVA(_month, "1");
if (_month == 13)
{
const int anno_prossimo = atoi(_year)+1;
if (look_lia(0l, FALSE, anno_prossimo))
d->_r20 = _lia->get_real("R0"); // Credito da riportare all'anno prossimo
}
// aggiunge eventuale satellite per rimborso infraannuale
if (di != NULL)
@ -2010,15 +2018,15 @@ void TLiquidazione_app::print_importo(int rw, const char* prompt, real imp, bool
void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
{
real& risultato = d._r0;
real& rimborso = d._r1;
real& cred_cost = d._r2;
real& deb_mens = d._r3;
real& rettifiche = d._r5;
real& detrazioni = d._r6;
real& interessi = d._r7;
real& versamenti = d._r8;
real& vers_int = d._r9;
const real& risultato = d._r0;
const real& rimborso = d._r1;
const real& cred_cost = d._r2;
const real& deb_mens = d._r3;
const real& rettifiche = d._r5;
const real& detrazioni = d._r6;
const real& interessi = d._r7;
const real& versamenti = d._r8;
const real& vers_int = d._r9;
TToken_string tt(d._s0);
real iva_vend(tt.get(0));
real iva_acq(tt.get(1));
@ -2140,17 +2148,9 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
{
if (_isannual)
{
const int year = atoi(_year)+1;
const long ditta = get_firm();
TString16 cod; cod.format("%05ld%04d", ditta, year);
TTable lia("%LIA");
lia.put("CODTAB", cod);
if (lia.read() == NOERR)
{
real credito = lia.get_real("R0");
if (credito > ZERO)
set_row(rw++,"@11gCREDITO RIPORTATO NELL'ANNO SUCCESSIVO@58g%r", &credito);
}
const real& credito = d._r20;
if (credito > ZERO)
set_row(rw++,"@11gCREDITO RIPORTATO NELL'ANNO SUCCESSIVO@58g%r", &credito);
}
if (_is_visliq)
rw++;

View File

@ -130,14 +130,11 @@ bool TParaliq_app::credres_handler(TMask_field& f, KEY k)
{
if (f.to_check(k))
{
const TMask& m = f.mask();
real r(f.get());
TCurrency cur(r, f.mask().get(F_CODVAL));
const int ndec = cur.decimals(); // Decimali di questa valuta per gli importi
// Arrotondamento alle migliaia nel caso il numero
// di decimali della ditta sia zero (come per le lire)
// altrimenti all'unità
r.round(ndec == 0 ? -3 : 0);
const bool euro = is_euro_value(m.get(F_CODVAL));
// Arrotondamento alle migliaia le Lire e rispetto i parametri in Euro
r.round(euro ? m.get_int(F_ROUNDDIC) : -3);
f.set(r.string());
}
@ -159,14 +156,11 @@ bool TParaliq_app::credpreccost_handler(TMask_field& f, KEY k)
{
if (f.to_check(k))
{
const TMask& m = f.mask();
real r(f.get());
TCurrency cur(r, f.mask().get(F_CODVAL));
const int ndec = cur.decimals(); // Decimali di questa valuta per gli importi
// Arrotondamento alle migliaia nel caso il numero
// di decimali della ditta sia zero (come per le lire)
// altrimenti all'unità
r.round(ndec == 0 ? -3 : 0);
const bool euro = is_euro_value(m.get(F_CODVAL));
// Arrotondamento alle migliaia le Lire e rispetto i parametri in Euro
r.round(euro ? m.get_int(F_ROUNDDIC) : -3);
f.set(r.string());
}
return TRUE;

View File

@ -5,8 +5,7 @@
//
/////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <relation.h>
#include <tabutil.h>
#include <utility.h>
#include <xvtility.h>
@ -199,10 +198,8 @@ bool TSaldo::leggi_mov(long nr)
//per bilancio scalare (ovvero a sezioni contrapposte) per data limite
bool TSaldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDate& data_inf,
const TDate& data_sup, int indbil, int stp_prov)
{
TLocalisamfile rmov(LF_RMOV);
const TDate& data_sup, int indbil, int stp_prov, const char* filter)
{
_saldo_iniziale = ZERO;
_saldo = ZERO;
_movimentato = FALSE;
@ -210,45 +207,24 @@ bool TSaldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDat
_rec_presente_ec = FALSE;
_prec = FALSE;
rmov.setkey(2);
TRelation rel(LF_RMOV);
TRectype& rmov = rel.curr();
rmov.zero();
rmov.put(RMV_GRUPPO,g);
rmov.put(RMV_CONTO,c);
rmov.put(RMV_SOTTOCONTO,s);
TCursor cur(&rel, filter, 2, &rmov, &rmov);
const TRecnotype items = cur.items();
cur.freeze();
// Anche se non movimentato vado a vedere il saldo
if (stp_prov != 3)
if (stp_prov != 3 && (filter == NULL || *filter == '\0'))
_saldo = calcola_saldo_iniziale(g,c,s,indbil);
#ifdef DBG
long num_rec = 0;
const clock_t clock_start = clock();
#endif
for (rmov.read(_isgteq); !rmov.eof(); rmov.next())
for (cur = 0L; cur.pos() < items; ++cur)
{
const int gruppo = rmov.get_int(RMV_GRUPPO);
const int conto = rmov.get_int(RMV_CONTO);
const long sottoconto = rmov.get_long(RMV_SOTTOCONTO);
if (gruppo != g || conto != c || sottoconto != s)
break;
#ifdef DBG
num_rec++;
if ((num_rec & 0x7F) == 0)
{
const double sec = (clock() - clock_start) / CLOCKS_PER_SEC;
if (sec > 0.0)
{
TString80 msg;
msg.format("%ld records at %ld rec/sec", num_rec, long(num_rec/sec));
xvt_statbar_set(msg);
do_events();
}
}
#endif
const long num_reg = rmov.get_long(RMV_NUMREG);
const long num_reg = rmov.get_long(RMV_NUMREG);
TDate data_mov;
// Leggo la testata

View File

@ -108,7 +108,7 @@ public:
bool ultima_immissione_bilancio(int anno,int g,int c,long s,int indbil,int prov,bool saldo_chiusura = TRUE);
bool ultima_immissione_verifica(int anno,int g,int c,long s,int indbil,int prov);
bool data_limite_bilancio(int,int,int,long,const TDate&,const TDate&,int,int);
bool data_limite_bilancio(int,int,int,long,const TDate&,const TDate&,int,int, const char* = NULL);
bool ricerca_progr_prec(int, int, int, long);

View File

@ -174,7 +174,7 @@ void TIva_round::set_default_iva_mode(int year, bool declaration, long ditta)
set_default_mode(rm_round, dec);
}
else
set_default_mode(rm_millelire, 3);
set_default_mode(rm_millelire, -3);
}
void TIva_round::round(real& n) const

View File

@ -1461,7 +1461,8 @@ int TTransfer_file::annoes_datacomp(const TString& record, TDate& datacomp)
void TTransfer_file::decimali(TString& campo, int dec)
{
if (dec > 0)
{
{
/*
const int l = campo.len();
if (l >= dec)
{
@ -1469,6 +1470,28 @@ void TTransfer_file::decimali(TString& campo, int dec)
if (p == 0 || campo[p-1] != '.')
campo.insert(".", p);
}
*/
if (campo.find('.') < 0) // Controlla che non ci sia già la virgola!
{
int l = campo.len();
if (campo[0] == '-')
{
while (l-1 <= dec)
{
campo.insert("0", 1); // Aggiunge sù quanti zeri dopo il meno
l++;
}
}
else
{
while (l <= dec)
{
campo.insert("0", 0); // Aggiunge sù quanti zeri in testa
l++;
}
}
campo.insert(".", l-dec);
}
}
}
@ -1529,7 +1552,6 @@ void TTransfer_file::negativo(TString& importo)
// Controlla se la ditta è in euro
static bool ditta_in_euro()
{
// return TCurrency::get_firm_dec() != 0;
return is_euro_value(NULL);
}
@ -1611,7 +1633,7 @@ void TTransfer_file::write_tmp_movPN(TString& record)
negativo(field);
// Cerco di riconoscere gli importi in euro
if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro())
if (dec == 0 && (to-from) >= 8 && record.size()==sizeT && ditta_in_euro())
{
flag = 3;
dec = 2;
@ -1623,8 +1645,8 @@ void TTransfer_file::write_tmp_movPN(TString& record)
if (dec > 0)
decimali(field,dec);
// Non capisco a cosa serva ma mi adeguo: forse toglie gli zeri iniziali
real appoggio = field;
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (logicnum == LF_MOV)
@ -1642,11 +1664,8 @@ void TTransfer_file::write_tmp_movPN(TString& record)
//di un numero va riempito con degli 0. Se si tratta di un alfa va allineato a destra.
if (fname == "CODPAG")
{
TString f = field;
//if (real::is_natural(f))
// field.format("%04s", (const char*) f);
//else
field.format("%-4s", (const char*) f);
const TString8 f = field;
field.format("%-4s", (const char*)f);
}
if (fname == "CODCAUS")
@ -1709,7 +1728,7 @@ void TTransfer_file::write_tmp_movPN(TString& record)
}
if (flag == 2)
{
TString f = converti(field,FALSE);
const TString80 f = converti(field,FALSE);
dep->put(fname,f);
}
}
@ -1930,7 +1949,7 @@ void TTransfer_file::write_tmp_movIVA(TString& record)
negativo(field);
// Cerco di riconoscere gli importi in euro
if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro())
if (dec == 0 && (to-from) >= 8 && record.size()==sizeT && ditta_in_euro())
{
flag = 3;
dec = 2;
@ -1941,9 +1960,8 @@ void TTransfer_file::write_tmp_movIVA(TString& record)
{
if (dec > 0)
decimali(field,dec);
real appoggio (field);
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (logicnum == LF_RMOVIVA)
@ -2133,9 +2151,10 @@ void TTransfer_file::write_tmp_movSC(TString& record)
_prog->addstatus(1);
}
void TTransfer_file::calcola_imposta(TString& field, real& imposta)
/* Guy: Funzione in disuso???
void TTransfer_file::calcola_imposta(const TString& field, real& imposta)
{
TString buffer;
TString256 buffer;
TRecnotype rec = _ttab->recno();
TIsamtempfile& tab = *_ttab;
@ -2161,12 +2180,12 @@ void TTransfer_file::calcola_imposta(TString& field, real& imposta)
if (ditta_in_euro())
app.insert(".", app.len()-2);
real imp (app);
const real imp = app;
imposta += imp;
}
_ttab->readat(rec);
}
*/
bool TTransfer_file::solo_SC(TString& field)
{
@ -2283,7 +2302,7 @@ void TTransfer_file::partita(TString& record)
negativo(field);
// Cerco di riconoscere gli importi in euro
if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro())
if (dec == 0 && (to-from) >= 8 && record.size()==sizeT && ditta_in_euro())
{
flag = 3;
dec = 2;
@ -2294,9 +2313,8 @@ void TTransfer_file::partita(TString& record)
{
if (dec > 0)
decimali(field,dec);
real appoggio (field);
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (fname == "TIPOC")
@ -2478,9 +2496,8 @@ void TTransfer_file::scadenza(TString& record)
{
if (dec > 0)
decimali(field,dec);
real appoggio (field);
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (fname == "IMPORTO")
@ -4259,9 +4276,8 @@ void TTransfer_file::write_testata_movimenti(TString& record)
{
if (dec > 0)
decimali(field,dec);
real appoggio (field);
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (fname == MOV_DESCR)
@ -4477,8 +4493,8 @@ void TTransfer_file::write_righe_contabili(TString& record)
if (dec > 0)
decimali(field,dec);
real appoggio (field);
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (fname == RMV_IMPORTO)
@ -4620,9 +4636,8 @@ void TTransfer_file::write_righe_IVA(TString& record)
{
if (dec > 0)
decimali(field,dec);
real appoggio (field);
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (fname == RMI_NUMRIG)
{
@ -4824,9 +4839,8 @@ void TTransfer_file::write_partite(TString& record)
{
if (dec > 0)
decimali(field,dec);
real appoggio (field);
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (fname == PART_NREG)
@ -4963,9 +4977,8 @@ void TTransfer_file::write_scadenze(TString& record)
{
if (dec > 0)
decimali(field,dec);
real appoggio (field);
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (fname == SCAD_GRUPPO || fname == SCAD_CONTO)
@ -5111,9 +5124,8 @@ void TTransfer_file::write_pagsca(TString& record)
{
if (dec > 0)
decimali(field,dec);
real appoggio (field);
field = appoggio.string();
const real appoggio = field;
field = appoggio.string(0, dec);
}
if (fname == PAGSCA_GRUPPO || fname == PAGSCA_CONTO ||

View File

@ -219,7 +219,7 @@ private:
void partita (TString& record);
void scadenza(TString& record);
void pagsca (TString& record);
void calcola_imposta(TString& numreg, real& imposta);
void calcola_imposta(const TString& numreg, real& imposta);
void calcola_impdocval(long nreg,int nrig,TString& record);
bool solo_SC(TString& numreg);
void calcola_importo(TString& record);

View File

@ -1620,9 +1620,10 @@ TImporto TPartita::importo_pagato_unassigned(bool val, int mode) const
if (in_val && !val) // Gli abbuoni sono sempre in valuta e quindi
{ // devono essere convertiti opportunamente
// abb *= sum.get_real(PART_CAMBIO);
// abb.round();
TCurrency cur(abb, "_FIRM");
cur *= sum.get_real(PART_CAMBIO);
// abb.round();
const TExchange cmb(sum);
TCurrency cur(abb, cmb);
cur.change_to_firm_val();
abb = cur.get_num();
}
totale += TImporto(sez, abb);

View File

@ -142,6 +142,7 @@ class TRiga_esplosione2print : public TRiga_esplosione
real _totordfor;
TDate _dtacons;
TString8 _codmag;
TToken_string _cod_corr;
public:
const TString& mag() const { return _codmag; }
@ -164,20 +165,39 @@ public:
void set_qta2order(const real& r) { _qta2order = r; }
void set_ordfor(const real& r) { _ordfor = r; }
void set_totordfor(const real& r) { _totordfor = r; }
TRiga_esplosione2print() {};
const TString& codici_corrispontenti(char tipo) const;
TRiga_esplosione2print() : _cod_corr(80, '\n') {};
TRiga_esplosione2print(const TDistinta_tree& tree, const char *codmag);
TRiga_esplosione2print(const TRiga_esplosione& re, const char *codmag);
~TRiga_esplosione2print() {};
};
const TString& TRiga_esplosione2print::codici_corrispontenti(char tipo) const
{
TRectype key(LF_CODCORR);
key.put("CODART", articolo());
TRecord_array a(key, "NRIGA");
TToken_string& lista = (TToken_string&)_cod_corr; // Fool the compiler
lista.cut(0);
const int last = a.last_row();
for (int i = a.first_row(); i > 0 && i <= last; i = a.succ_row(i))
{
const TRectype& row = a.row(i);
if (tipo < ' ' || row.get_char("TIPO") == tipo)
lista.add(row.get("CODARTALT"));
}
return lista;
}
TRiga_esplosione2print::TRiga_esplosione2print(const TDistinta_tree& tree, const char *codmag)
: TRiga_esplosione(tree), _codmag(codmag)
: TRiga_esplosione(tree), _codmag(codmag), _cod_corr(80, '\n')
{
}
TRiga_esplosione2print::TRiga_esplosione2print(const TRiga_esplosione& re, const char *codmag)
: TRiga_esplosione(re), _codmag(codmag)
: TRiga_esplosione(re), _codmag(codmag), _cod_corr(80, '\n')
{
}
@ -280,7 +300,8 @@ class TEsplosione_distinta_app : public TSkeleton_application
TCodgiac_livelli *_liv_giac;
// Dati "i/n/m/putati" ma non ancora condannati...
_ParmStruct _parameters;
int _default_code_width;
protected:
static bool sheet_notify(TSheet_field& s, int r, KEY key);
virtual bool create();
@ -763,123 +784,164 @@ bool TExplode_distinta_form::validate(TForm_item &f, TToken_string &t)
TRiga_esplosione2print& re = (TRiga_esplosione2print&) _exploded_tree[_curr_row];
const char tipo = re.tipo();
if (code == "_COD")
{
int liv = re.livello();
if (liv > 0) // Calcola indentazione
{
if (_p->_separate_dist)
{
if (liv > 10) liv = 10;
if (_p->_ordering)
valore.format("%8ld%*s", re.ordinamento(), liv, "");
else
valore.spaces(liv);
}
}
else
valore = "@B"; // Radice in grassetto
valore << re.articolo();
}
else
if (code == "_DES")
if (code[0] != '_')
{
const char tiporiga = t.get()[0];
if (tipo == tiporiga)
{
const TRelation* rel = relation();
switch (tipo)
{
case 'A':
{
valore = _art_cache.get(re.articolo()).get(ANAMAG_DESCR);
valore = _art_cache.get(re.articolo()).get(code);
break;
}
case 'L':
{
const TLavorazione lav(re.articolo());
valore = lav.descr();
valore = lav.get(code);
break;
}
case 'V':
{
TLocalisamfile& dist = rel->lfile();
TLocalisamfile& dist = relation()->lfile();
dist.put("CODDIST", re.articolo());
if (dist.read() == NOERR)
valore = dist.get("DESCR");
valore = dist.get(code);
break;
}
default:
break;
}
if (livelli_giacenza().enabled())
{
TString lv = re.giacenza();
for (int l = livelli_giacenza().last_level(); l > 0 ; l--)
lv.insert(" ",livelli_giacenza().packed_length(l));
valore.insert(lv);
}
}
else
if (code == "_LIV")
{
if (_p->_separate_dist && re.livello() > 0)
valore << re.livello();
}
else
{
if (code == "_COD")
{
int liv = re.livello();
if (liv > 0) // Calcola indentazione
{
if (_p->_separate_dist)
{
if (liv > 10) liv = 10;
if (_p->_ordering)
valore.format("%8ld%*s", re.ordinamento(), liv, "");
else
valore.spaces(liv);
}
}
else
if (code == "_DCO")
valore = "@B"; // Radice in grassetto
valore << re.articolo();
}
else
if (code == "_DES")
{
const TRelation* rel = relation();
switch (tipo)
{
//if (re.articolo() == _d->cod())
valore = re.datacons();
case 'A':
{
valore = _art_cache.get(re.articolo()).get(ANAMAG_DESCR);
break;
}
case 'L':
{
const TLavorazione lav(re.articolo());
valore = lav.descr();
break;
}
case 'V':
{
TLocalisamfile& dist = rel->lfile();
dist.put("CODDIST", re.articolo());
if (dist.read() == NOERR)
valore = dist.get("DESCR");
break;
}
default:
break;
}
if (livelli_giacenza().enabled())
{
TString lv = re.giacenza();
for (int l = livelli_giacenza().last_level(); l > 0 ; l--)
lv.insert(" ",livelli_giacenza().packed_length(l));
valore.insert(lv);
}
}
else
if (code == "_LIV")
{
if (_p->_separate_dist && re.livello() > 0)
valore << re.livello();
}
else
if (code == "_UM")
{
valore = re.um();
}
else
if (code == "_FAB")
if (code == "_DCO")
{
//if (re.articolo() == _d->cod())
valore = re.datacons();
}
else
if (code == "_UM")
{
valore = re.fabbisogno().string();
valore = re.um();
}
else
if (code == "_DIS")
if (code == "_FAB")
{
valore = re.disponibilita().string();
valore = re.fabbisogno().string();
}
else
if (code == "_ORDPROD")
if (code == "_DIS")
{
valore = re.qta2order().string();
valore = re.disponibilita().string();
}
else
if (code == "_RESIDUO")
if (code == "_ORDPROD")
{
valore = re.residuo().string();
valore = re.qta2order().string();
}
else
if (code == "_VALORE")
if (code == "_RESIDUO")
{
valore = re.value().string();
valore = re.residuo().string();
}
else
if (code == "_VALOREUNIT")
if (code == "_VALORE")
{
valore = re.unitary_value().string();
valore = re.value().string();
}
else
if (code == "_ORDFOR")
if (code == "_VALOREUNIT")
{
valore = re.ordfor().string();
valore = re.unitary_value().string();
}
else
if (code == "_TOTORDFOR")
if (code == "_ORDFOR")
{
valore = re.totordfor().string();
valore = re.ordfor().string();
}
else
if (code == "_CODFORN")
{
valore = _art_cache.get(re.articolo()).get(ANAMAG_CODFORN);
if (code == "_TOTORDFOR")
{
valore = re.totordfor().string();
}
else
if (code == "_CODFORN")
{
valore = _art_cache.get(re.articolo()).get(ANAMAG_CODFORN);
}
else
if (code == "_CODCORR")
{
const char tipo = t.get()[0];
valore = re.codici_corrispontenti(tipo);
}
}
f.set(valore);
return TRUE;
}
@ -1259,7 +1321,12 @@ void TExplode_distinta_form::print_explosion_rows()
if (pr.rows_left() <= (h+1))
pr.formfeed();
for (word j = 0; j < h; j++)
pr.print(body.row(j));
{
TPrintrow& r = body.row(j);
const TFixed_string t(r.row());
if (!t.blank())
pr.print(r);
}
}
set_last_page(TRUE);
@ -1434,7 +1501,8 @@ bool TEsplosione_distinta_app::check_articoli(TMask_field& f, KEY k)
bool TEsplosione_distinta_app::create()
{
open_files(LF_TAB, LF_TABCOM, LF_UMART, LF_OCCAS, LF_CLIFO, LF_DIST, 0);
open_files(LF_DOC, LF_RIGHEDOC, LF_INDSP, LF_CFVEN, LF_MAG, LF_STOMAG, 0);
open_files(LF_DOC, LF_RIGHEDOC, LF_INDSP, LF_CFVEN, LF_MAG, LF_STOMAG, LF_CODCORR, 0);
_mask = new TMask("db1100a");
TSheet_field& sa = (TSheet_field&) _mask->field(F_SHEETART);
sa.sheet_mask().set_handler(F_QTA, check_articoli);
@ -1444,8 +1512,6 @@ bool TEsplosione_distinta_app::create()
_mask->set(F_VIRTUALI, "X");
if (!livelli_giacenza().enabled()) //TBI
_mask->hide(F_SEPARATE_GIAC);
rec_cache(LF_TAB).test_file_changes(FALSE);
@ -1460,6 +1526,10 @@ bool TEsplosione_distinta_app::create()
}
_form = new TExplode_distinta_form("db1100a");
TForm_item& fi_cod = _form->find_field('B', odd_page, 1);
_default_code_width = fi_cod.width();
_liv_giac = new TCodgiac_livelli;
_liv_giac->set_sheetcolumn(sa, F_LIV1, 1);
_liv_giac->set_sheetcolumn(sa, F_LIV2, 2);
@ -1676,7 +1746,7 @@ void TEsplosione_distinta_app::print()
// Calcola la larghezza della colonna codice
TForm_item& fi_cod = _form->find_field('B', odd_page, 1);
int c_width = 20;
int c_width = _default_code_width;
if (_parameters._separate_dist)
{
c_width += 10;
@ -1815,4 +1885,4 @@ int db1100(int argc, char* argv[])
a->run(argc, argv, "Stampa esplosione");
delete a;
return 0;
}
}

View File

@ -50,7 +50,7 @@ END //HEADER
SECTION BODY ODD 1 COLUMNWISE
STRING 1 30
STRING 1 20
BEGIN
SPECIAL STRINGA INTESTAZIONE "Codice" "Codice"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"

View File

@ -8,8 +8,8 @@
#define F_ISTIT 104
#define F_DENOM 105
#define F_CAB 106
#define F_CC_INC 107
//#define F_FIDO_INC 108
#define F_CC_INC 107
#define F_CC_CONT_INC 109
#define F_CC_SBF 110
#define F_FIDO_SBF 111
@ -27,4 +27,7 @@
#define F_CONTO_SCN 123
#define F_SOTTOC_SCN 124
#define F_CBI 125
#define F_DESCR_INC 126
#define F_DESCR_SBF 127
#define F_DESCR_SCN 128
#endif//__BATBBNP_H

View File

@ -58,7 +58,6 @@ BEGIN
DISPLAY "CAB@5" CODTAB[6,10]
DISPLAY "Denominazione@50" 100@->S0
OUTPUT F_ABI CODTAB[1,5]
//OUTPUT F_ISTIT %BAN->S0
MESSAGE COPY,F_CODICEABI
MESSAGE CHECK,F_CODICEABI
CHECKTYPE REQUIRED
@ -97,7 +96,7 @@ BEGIN
FLAG "D"
END
GROUPBOX DLG_NULL 78 4
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 4 "Portafoglio Effetti all' incasso"
END
@ -108,15 +107,6 @@ BEGIN
FIELD BNP->S0
END
/*
NUMBER F_FIDO_INC 20 2
BEGIN
PROMPT 45 5 "Fido "
FIELD BNP->R0
PICTURE "###.###.###.###,@@"
END
*/
STRING F_CC_CONT_INC 20
BEGIN
PROMPT 2 6 "C/Contabile "
@ -125,33 +115,25 @@ END
NUMBER F_GRUPPO_INC 3
BEGIN
PROMPT 36 6 "Conto contropartita "
PROMPT 2 7 "Contropartita "
FIELD I0
CHECKTYPE NORMAL
END
NUMBER F_CONTO_INC 3
BEGIN
PROMPT 61 6 ""
PROMPT 21 7 ""
FIELD I1
USE LF_PCON SELECT CONTO!=""
INPUT GRUPPO F_GRUPPO_INC
INPUT CONTO F_CONTO_INC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPO_INC GRUPPO
OUTPUT F_CONTO_INC CONTO
CHECKTYPE NORMAL
END
NUMBER F_SOTTOC_INC 6
BEGIN
PROMPT 68 6 ""
PROMPT 28 7 ""
FIELD I2
USE LF_PCON SELECT SOTTOCONTO!=""
USE LF_PCON KEY 1 SELECT SOTTOCONTO!=""
INPUT GRUPPO F_GRUPPO_INC
INPUT CONTO F_CONTO_INC
INPUT CONTO F_CONTO_INC
INPUT SOTTOCONTO F_SOTTOC_INC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
@ -160,62 +142,68 @@ BEGIN
OUTPUT F_GRUPPO_INC GRUPPO
OUTPUT F_CONTO_INC CONTO
OUTPUT F_SOTTOC_INC SOTTOCONTO
OUTPUT F_DESCR_INC DESCR
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 78 4
STRING F_DESCR_INC 50 38
BEGIN
PROMPT 1 8 "Portafoglio Effetti salvo buon fine"
PROMPT 38 7 ""
USE LF_PCON KEY 2
INPUT DESCR F_DESCR_INC
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT F_SOTTOC_INC
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 9 "Portafoglio Effetti salvo buon fine"
END
STRING F_CC_SBF 20
BEGIN
PROMPT 2 9 "C/C "
PROMPT 2 10 "C/C "
FIELD BNP->S1
END
NUMBER F_FIDO_SBF 20 2
BEGIN
PROMPT 36 9 "Fido "
PROMPT 38 10 "Fido "
FIELD BNP->R1
PICTURE "###.###.###.###,@@"
END
STRING F_CC_CONT_SBF 20
BEGIN
PROMPT 2 10 "C/Contabile "
PROMPT 2 11 "C/Contabile "
FIELD BNP->S4
END
NUMBER F_GRUPPO_SBF 3
BEGIN
PROMPT 36 10 "Conto contropartita "
PROMPT 2 12 "Contropartita "
FIELD I3
CHECKTYPE NORMAL
END
NUMBER F_CONTO_SBF 3
BEGIN
PROMPT 61 10 ""
PROMPT 21 12 ""
FIELD I4
USE LF_PCON SELECT CONTO!=""
INPUT GRUPPO F_GRUPPO_SBF
INPUT CONTO F_CONTO_SBF
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPO_SBF GRUPPO
OUTPUT F_CONTO_SBF CONTO
CHECKTYPE NORMAL
END
NUMBER F_SOTTOC_SBF 6
BEGIN
PROMPT 68 10 ""
PROMPT 28 12 ""
FIELD I5
USE LF_PCON SELECT SOTTOCONTO!=""
USE LF_PCON KEY 1 SELECT SOTTOCONTO!=""
INPUT GRUPPO F_GRUPPO_SBF
INPUT CONTO F_CONTO_SBF
INPUT CONTO F_CONTO_SBF
INPUT SOTTOCONTO F_SOTTOC_SBF
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
@ -224,62 +212,68 @@ BEGIN
OUTPUT F_GRUPPO_SBF GRUPPO
OUTPUT F_CONTO_SBF CONTO
OUTPUT F_SOTTOC_SBF SOTTOCONTO
OUTPUT F_DESCR_SBF DESCR
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 78 4
STRING F_DESCR_SBF 50 38
BEGIN
PROMPT 1 12 "Portafoglio Effetti allo sconto"
PROMPT 38 12 ""
USE LF_PCON KEY 2
INPUT DESCR F_DESCR_SBF
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT F_SOTTOC_SBF
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 14 "Portafoglio Effetti allo sconto"
END
STRING F_CC_SCN 20
BEGIN
PROMPT 2 13 "C/C "
PROMPT 2 15 "C/C "
FIELD BNP->S2
END
NUMBER F_FIDO_SCN 20 2
BEGIN
PROMPT 36 13 "Fido "
PROMPT 38 15 "Fido "
FIELD BNP->R2
PICTURE "###.###.###.###,@@"
END
STRING F_CC_CONT_SCN 20
BEGIN
PROMPT 2 14 "C/Contabile "
PROMPT 2 15 "C/Contabile "
FIELD BNP->S5
END
NUMBER F_GRUPPO_SCN 3
BEGIN
PROMPT 36 14 "Conto contropartita "
PROMPT 2 17 "Contropartita "
FIELD I6
CHECKTYPE NORMAL
END
NUMBER F_CONTO_SCN 3
BEGIN
PROMPT 61 14 ""
PROMPT 21 17 ""
FIELD I7
USE LF_PCON SELECT CONTO!=""
INPUT GRUPPO F_GRUPPO_SCN
INPUT CONTO F_CONTO_SCN
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPO_SCN GRUPPO
OUTPUT F_CONTO_SCN CONTO
CHECKTYPE NORMAL
END
NUMBER F_SOTTOC_SCN 6
BEGIN
PROMPT 68 14 ""
PROMPT 28 17 ""
FIELD I8
USE LF_PCON SELECT SOTTOCONTO!=""
USE LF_PCON KEY 1 SELECT SOTTOCONTO!=""
INPUT GRUPPO F_GRUPPO_SCN
INPUT CONTO F_CONTO_SCN
INPUT CONTO F_CONTO_SCN
INPUT SOTTOCONTO F_SOTTOC_SCN
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
@ -288,12 +282,26 @@ BEGIN
OUTPUT F_GRUPPO_SCN GRUPPO
OUTPUT F_CONTO_SCN CONTO
OUTPUT F_SOTTOC_SCN SOTTOCONTO
OUTPUT F_DESCR_SCN DESCR
CHECKTYPE NORMAL
END
STRING F_DESCR_SCN 50 38
BEGIN
PROMPT 38 17 ""
USE LF_PCON KEY 2
INPUT DESCR F_DESCR_SCN
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT F_SOTTOC_SCN
CHECKTYPE NORMAL
END
BOOLEAN F_CBI
BEGIN
PROMPT 2 16 "Tracciato SETIF"
PROMPT 2 19 "Tracciato SETIF"
FIELD B0
END

View File

@ -30,6 +30,7 @@ protected:
virtual void init_insert_mode(TMask&);
virtual bool get_next_key(TToken_string& key);
virtual void init_modify_mode(TMask&);
static bool datascad_handler(TMask_field& f, KEY k);
static bool handle_sheet(TMask_field& f, KEY);
static bool cambio_handler(TMask_field& f, KEY k);
static bool codval_handler(TMask_field& f, KEY k);
@ -120,15 +121,13 @@ bool TVariazione_effetti::get_next_key(TToken_string& key)
// ritorna un riferimento allo sheet dei cessionari
TSheet_field& TVariazione_effetti::cess_sheet() const
{
TSheet_field& o_sheet = (TSheet_field&)_msk->field(F_SHEET_EFF);
return o_sheet;
return _msk->sfield(F_SHEET_EFF);
}
// ritorna un riferimento allo sheet delle righe
TSheet_field& TVariazione_effetti::righe_sheet() const
{
TSheet_field& r_sheet = (TSheet_field&)_msk->field(F_SHEET_RIGHE);
return r_sheet;
return _msk->sfield(F_SHEET_RIGHE);
}
// metodo che permette di scivere su file i dati inseriti nella maschera;
@ -296,13 +295,14 @@ bool TVariazione_effetti::user_create()
_msk = new TMask("ef0100a") ;
_rel = new TRelation(LF_EFFETTI);
_effetto = new TEffetto;
_msk->set_handler(F_DATASCAD, datascad_handler);
_msk->set_handler(F_CODVAL, codval_handler);
_msk->set_handler(F_CAMBIO, cambio_handler);
_msk->set_handler(F_EFFCONT, contab_handler);
_msk->set_handler(F_SHEET_RIGHE, handle_sheet);
righe_sheet().set_append(TRUE);
righe_sheet().set_notify(impeff_notify);
((TSheet_field &) _msk->field(F_SHEET_RIGHE)).sheet_mask().set_handler(F_NUMFATT, fatt_handler);
_msk->sfield(F_SHEET_RIGHE).sheet_mask().set_handler(F_NUMFATT, fatt_handler);
return TRUE;
}
@ -324,7 +324,7 @@ bool TVariazione_effetti::handle_sheet(TMask_field &f, KEY k)
// se si vuole salvare e si è in uno dei due modi di funzionamento
if ( k == K_ENTER && (mode == MODE_INS || mode == MODE_MOD) )
{ // si controllano le righe del effetto nello sheet
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_RIGHE);
TSheet_field& sf = m.sfield(F_SHEET_RIGHE);
int items = sf.items();
bool found = FALSE;
for (int i = 0; i < items && !found; i++)// scandisco tutte le righe dello sheet
@ -345,19 +345,34 @@ bool TVariazione_effetti::handle_sheet(TMask_field &f, KEY k)
return TRUE;
}
bool TVariazione_effetti::datascad_handler(TMask_field& f, KEY k)
{
if (k == K_ENTER)
{
const TDate datascad = f.get();
TSheet_field& sf = f.mask().sfield(F_SHEET_RIGHE);
FOR_EACH_SHEET_ROW(sf, r, row)
{
TDate datafat = row->get(F_DATAFATT-FIRST_FIELD);
if (datascad < datafat)
return f.error_box("La data fattura della riga %d è successiva alla data di scadenza", r+1);
}
}
return TRUE;
}
// handler che permette il controllo sulla abilitazione dei campi collegati
// al codice valuta
bool TVariazione_effetti::codval_handler(TMask_field& f, KEY k)
{
TMask &m = f.mask();
// if (k == K_TAB && f.to_check(k, FALSE))
if (f.to_check(k, TRUE))
{
const TString & val = f.get();
// se non c'e valuta o se è lire disabilito i campi collegati
TMask& m = f.mask();
const TString& val = f.get();
// se non c'e valuta o se è lire disabilitato i campi collegati
const bool valuta = (val.not_empty() && val != TCurrency::get_firm_val());
m.enable(-1,valuta);
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_RIGHE);
TSheet_field& sf = m.sfield(F_SHEET_RIGHE);
if (!valuta)
{
m.reset(-1);
@ -386,7 +401,7 @@ bool TVariazione_effetti::cambio_handler(TMask_field& f, KEY k)
{
const real cambio = f.get();
const TString& valuta = m.get(F_CODVAL);
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_RIGHE);
TSheet_field& sf = m.sfield(F_SHEET_RIGHE);
int items = sf.items();
real imp, impval;
// scandisco tutte le righe dello sheet e modifico gli importi in lire
@ -454,7 +469,7 @@ bool TVariazione_effetti::contab_handler(TMask_field& f, KEY k)
{
TMask &m = f.mask();
const bool da_contab = f.get().empty();
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_RIGHE);
TSheet_field& sf = m.sfield(F_SHEET_RIGHE);
sf.enable_column(F_ANNO, da_contab);
sf.enable_column(F_NUMPART, da_contab);
sf.force_update();
@ -467,7 +482,7 @@ bool TVariazione_effetti::contab_handler(TMask_field& f, KEY k)
void TVariazione_effetti::calcola_totali()
{
TMask* m = app()._msk;
TSheet_field& sf = (TSheet_field&)m->field(F_SHEET_RIGHE);
TSheet_field& sf = m->sfield(F_SHEET_RIGHE);
int items = sf.items();
real imp, impval, impeff, impeffval;
// scandisco tutte le righe dello sheet e ne prendo gli importi

View File

@ -230,18 +230,26 @@ void TEmissione::conferma()
void TEmissione::floppy()
{
inizializza_cur();
const long codabi = _cur->curr().get_long(EFF_CODABIP);
const char tipocf = _cur->curr().get_char(EFF_TIPOCF);
const char tipopag = _cur->curr().get_char(EFF_TIPOPAG);
*_cur = 0L; // Posizionati all'inizio
const TRectype& eff = _cur->curr();
const long codabi = eff.get_long(EFF_CODABIP);
const char tipocf = eff.get_char(EFF_TIPOCF);
const char tipopag = eff.get_char(EFF_TIPOPAG);
TFilename ribaini;
ribaini.format("r%c%c%05ld.ini",tipocf, tipopag, codabi);// compongo il nome del tracciato
ribaini.format("r%c%c%05ld.ini", tipocf, tipopag, codabi); // compongo il nome del tracciato
if (!ribaini.exist()) // se non esiste
ribaini.overwrite("00000", 3); // Elimino codice banca
if (!ribaini.exist()) // se non esiste
ribaini = "riba.ini"; // utilizzo quello generico
ribaini.overwrite("0", 2); // Elimino tipo pagamaneto
if (!ribaini.exist()) // se non esiste
ribaini = "riba.ini"; // utilizzo quello generico
if (!ribaini.exist()) // se non esiste ancora!
{
error_box("Impossibile leggere il file %s", (const char*)ribaini);
return;
}
_trasfile = new TRiba_file(RIBAFILENAME, ribaini);
TTracciato_record * rb = _trasfile->t_rec("RB");
@ -282,6 +290,9 @@ void TEmissione::floppy()
_trasfile->close();
delete _trasfile;
_trasfile = NULL;
delete _cur;
_cur = NULL;
}
// registro la data ed il numero di emissione dell'effetto corrente
@ -352,6 +363,8 @@ void TEmissione::inizializza_cur()
from.zero();
from.put(EFF_TIPODIST, tipodist);
from.put(EFF_NDIST, ndist);
if (_cur != NULL)
delete _cur;
_cur = new TCursor(_rel,"",4,&from,&from);
_cur->freeze();
}
@ -563,6 +576,8 @@ void TEmissione::print()
nomeform.format("r%c%c%05ld.frm",tipocf, tipopag, codabi);
if (!nomeform.exist()) // se non esiste
nomeform.overwrite("00000", 3); // elimino codice banca
if (!nomeform.exist()) // se non esiste
nomeform.overwrite("0", 2); // elimino tipo pagamento
if (!nomeform.exist()) // se non esiste
nomeform = "rb.frm"; // utilizzo quello generico
_formrb = new TRiba_form(nomeform);
@ -574,6 +589,8 @@ void TEmissione::print()
nomeform.format("d%c%c%05ld.frm",tipocf, tipopag, codabi);// compongo il nome del form
if (!nomeform.exist()) // se non esiste
nomeform.overwrite("00000", 3); // elimino codice banca
if (!nomeform.exist()) // se non esiste
nomeform.overwrite("0", 2); // elimino tipo pagamento
if (!nomeform.exist()) // se non esiste
nomeform = "dse.frm"; // utilizzo quello generico
_formdse = new TDistinta_form(nomeform, _firmrel);
@ -699,6 +716,7 @@ bool TRiba_form::validate(TForm_item &cf, TToken_string &s)
// sintassi: _CLI,<macro>
// dove: <macro> è uno delle macro seguenti:
// "!IND" INDIRIZZO + NR. CIVICO
// "!LOCALITA" LOCALITA
// "!PIAZZA" COMUNE + PROVINCIA
// "!CAP" CAP
// "!RAGSOC" Ragione sociale
@ -714,25 +732,33 @@ bool TRiba_form::validate(TForm_item &cf, TToken_string &s)
if (in=="IND")
{
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_INDCF : IND_INDIR);
in = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_CIVCF : IND_CIV);
if (in.not_empty())
valore << ", " << in;
const TRectype& cli = rel->curr(pick_normal ? LF_CLIFO : LF_INDSP);
valore = cli.get(pick_normal ? CLI_INDCF : IND_INDIR);
const TString& civ = cli.get(pick_normal ? CLI_CIVCF : IND_CIV);
if (civ.not_empty())
valore << ", " << civ;
}
else
if (in=="PIAZZA")
if (in=="PIAZZA" || in=="COMUNE")
{
valore = rel->lfile(pick_normal ? LF_COMUNI : -213).get(COM_DENCOM);
in = rel->lfile(pick_normal ? LF_COMUNI : -213).get(COM_PROVCOM);
if (in.not_empty())
valore << " (" << in << ")";
const TRectype& com = rel->curr(pick_normal ? LF_COMUNI : -213);
valore = com.get(COM_DENCOM);
const TString& prov = com.get(COM_PROVCOM);
if (prov.not_empty())
valore << " (" << prov << ")";
}
else
if (in=="RAGSOC")
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_RAGSOC : IND_RAGSOC);
else
if (in=="CAPCF")
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_CAPCF : IND_CAP);
if (in=="LOCALITA")
{
const TRectype& cli = rel->curr(pick_normal ? LF_CLIFO : LF_INDSP);
valore = cli.get(pick_normal ? CLI_LOCCF : IND_LOCALITA);
}
else
if (in=="RAGSOC")
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_RAGSOC : IND_RAGSOC);
else
if (in=="CAPCF")
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_CAPCF : IND_CAP);
}
cf.put_paragraph(valore);
return (TRUE);
@ -848,18 +874,23 @@ bool TDistinta_form::validate(TForm_item &cf, TToken_string &s)
valore << ", " << in;
}
else
if (in=="PIAZZA")
if (in=="PIAZZA" || in=="COMUNE")
{
valore = rel->lfile(pick_normal ? LF_COMUNI : -213).get(COM_DENCOM);
in = rel->lfile(pick_normal ? LF_COMUNI : -213).get(COM_PROVCOM);
valore = rel->curr(pick_normal ? LF_COMUNI : -213).get(COM_DENCOM);
in = rel->curr(pick_normal ? LF_COMUNI : -213).get(COM_PROVCOM);
if (in.not_empty())
valore << " (" << in << ")";
}
} else
if (in=="LOCALITA")
{
const TRectype& cli = rel->curr(pick_normal ? LF_CLIFO : LF_INDSP);
valore = cli.get(pick_normal ? CLI_LOCCF : IND_LOCALITA);
} else
if (in=="RAGSOC")
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_RAGSOC : IND_RAGSOC);
valore = rel->curr(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_RAGSOC : IND_RAGSOC);
else
if (in=="CAPCF")
valore = rel->lfile(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_CAPCF : IND_CAP);
valore = rel->curr(pick_normal ? LF_CLIFO : LF_INDSP).get(pick_normal ? CLI_CAPCF : IND_CAP);
}
cf.set(valore);
cf.put_paragraph(valore);
@ -1038,8 +1069,7 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
}
else if (in=="INDIRIZZO")
{
valore.cut(0);
valore << clifo_2.get(pick_normal ? CLI_INDCF : IND_INDIR);
valore = clifo_2.get(pick_normal ? CLI_INDCF : IND_INDIR);
valore.trim();
valore << " " << clifo_2.get_int(pick_normal ? CLI_CIVCF : IND_CIV);
valore.trim();
@ -1048,8 +1078,7 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
}
else if (in=="COMUNE")
{
valore.cut(0);
valore << comuni.get("DENCOM");
valore = comuni.get("DENCOM");
valore.trim();
}
else if (in=="PROV")
@ -1057,6 +1086,21 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
valore = comuni.get("PROVCOM");
valore.trim();
}
else if (in=="LOCALITA")
{
valore = clifo_2.get(pick_normal ? CLI_LOCCF : IND_LOCALITA);
valore.trim();
}
else if (in=="LOCALITA+COMUNE")
{
valore = clifo_2.get(pick_normal ? CLI_LOCCF : IND_LOCALITA);
valore.trim();
if (valore.not_empty())
valore << " (" << comuni.get("DENCOM") << ')';
else
valore = comuni.get("DENCOM");
valore.trim();
}
else if (in=="CFPI")
{
valore = clifo_1.get("PAIV");
@ -1152,9 +1196,26 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
CHECK(in[0]=='!',"Macro _IMPORTO senza carattere '!'");
if (in=="!ADD")
{
real importo = cur.curr(LF_EFFETTI).get(EFF_IMPORTO);
if (_codice_moneta == 'E')
importo *= 100.0;
/* GF only
real importo = cur.curr(LF_EFFETTI).get(EFF_IMPORTOVAL);
if (importo.is_zero())
{
importo = cur.curr(LF_EFFETTI).get_real(EFF_IMPORTO);
importo /= 1936.27;
}
importo *= 100.0;
*/
/* Allore only
real importo = cur.curr(LF_EFFETTI).get(EFF_IMPORTOVAL);
if (importo.is_zero())
importo = cur.curr(LF_EFFETTI).get_real(EFF_IMPORTO);
else
importo *= 100.0;
*/
importo.round(0);
add_tot_importi(importo);
valore = importo.string(13,0);
@ -1187,4 +1248,4 @@ int ef0500(int argc, char* argv[])
TEmissione a ;
a.run(argc, argv, "Emissione Effetti e Distinte");
return 0;
}
}

View File

@ -102,12 +102,12 @@ const char* TPrint_effetti_app::look_tab(const char* tabname, const TString& cod
// stampa il totale per data di scadenza
void TPrint_effetti_app::st_tot_scad()
{
_pr.put("___________________________________________",50);
_pr.put("_____________________________________________________",46);
printer().print(_pr);
_pr.reset();
_pr.put("TOTALE",50);
_pr.put(_scad_prec.string(),57);
_pr.put(_tot_data.string(PICTURE_IMPORTO),72);
_pr.put("TOTALE",46); //sky totdata
_pr.put(_scad_prec.string(),53);
_pr.put(_tot_data.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_tot_data = 0.0;
_pr.reset();
@ -116,11 +116,11 @@ void TPrint_effetti_app::st_tot_scad()
// stampa il totale per mese delle data di scadenza
void TPrint_effetti_app::st_tot_mese()
{
_pr.put("TOTALE ",50);
_pr.put("TOTALE",46); //sky totmese
if (_scad_prec.ok())
{
_pr.put(itom(_scad_prec.month()),57);
_pr.put(_tot_mese.string(PICTURE_IMPORTO),72);
_pr.put(itom(_scad_prec.month()),53);
_pr.put(_tot_mese.string(PICTURE_IMPORTO),63);
}
printer().print(_pr);
_tot_mese = 0.0;
@ -205,8 +205,8 @@ void TPrint_effetti_app::preprocess_header()
ditta = ditta.mid(0,30);
ditta.trim();
ditta << " " << s;
set_header(j, "Ditta: %ld %s@125gPag @#", firm, (const char*) ditta);
set_header(j++, "@102gData %s", (const char*) _data_stampa);
set_header(j, "@bDitta: %ld %s@125gPag @#", firm, (const char*) ditta);
set_header(j++, "@b@102gData %s", (const char*) _data_stampa);
switch(_pr_type)
{
@ -231,11 +231,11 @@ void TPrint_effetti_app::preprocess_header()
void TPrint_effetti_app::header_scadenza()
{
int j =2;
set_header(j, "@52gSTAMPA RI.BA. PER SCADENZA"); j++;
set_header(j, "@52g@bSTAMPA RI.BA. PER SCADENZA"); j++;
set_header(j++, (const char *)(TString(_colonne).fill('_')));
TString head = " Scadenza Banca Cliente N.Riba N.Dist Importo Val. N.Rata St.Def. Fattura del. N.";
TString head = "@b Scadenza Banca Cliente N.Riba N.Dist Importo Imp. in valuta Val Rata Data fattura N.";
if (_stampa_bancapp)
head << " ABI CAB Banca d'appoggio";
head << "@b ABI CAB Banca d'appoggio";
set_header(j++, head);
set_header(j, (const char *)(TString(_colonne).fill('_')));
}
@ -244,11 +244,11 @@ void TPrint_effetti_app::header_scadenza()
void TPrint_effetti_app::header_banca()
{
int j = 2;
set_header(j, "@45gSTAMPA RI.BA. PER BANCHE DI PRESENTAZIONE"); j++;
set_header(j, "@45g@bSTAMPA RI.BA. PER BANCHE DI PRESENTAZIONE"); j++;
set_header(j++, (const char *)(TString(_colonne).fill('_')));
TString head = " Banca Scadenza Cliente N.Riba N.Dist Importo Val. N.Rata St.Def. Fattura del. N.";
TString head = "@b Banca Scadenza Cliente N.Riba N.Dist Importo Imp. in valuta Val Rata Data fattura N.";
if (_stampa_bancapp)
head << " ABI CAB Banca d'appoggio";
head << "@b ABI CAB Banca d'appoggio";
set_header(j++, head);
set_header(j, (const char *)(TString(_colonne).fill('_')));
}
@ -257,12 +257,12 @@ void TPrint_effetti_app::header_banca()
void TPrint_effetti_app::header_distinta()
{
int j = 2;
set_header(j, "@55gSTAMPA RI.BA. PER DISTINTE"); j++;
set_header(j, "@55g@bSTAMPA RI.BA. PER DISTINTE"); j++;
set_header(j++, (const char *)(TString(_colonne).fill('_')));
set_header(j++, " Distinta ");
TString head = "@1gTipo Num. N.Riba Scadenza Banca Cliente Importo Val. N.Rata St.Def. Fattura del. N.";
set_header(j++, "@b Distinta ");
TString head = "@bTp. Num. N.Riba Scadenza Banca Cliente Importo Imp. in valuta Val Rata Data fattura N.";
if (_stampa_bancapp)
head << " ABI CAB Banca d'appoggio";
head << "@b ABI CAB Banca d'appoggio";
set_header(j++, head);
set_header(j, (const char *)(TString(_colonne).fill('_')));
}
@ -271,11 +271,11 @@ void TPrint_effetti_app::header_distinta()
void TPrint_effetti_app::header_cliente()
{
int j = 2;
set_header(j, "@52gSTAMPA RI.BA. PER CLIENTE"); j++;
set_header(j, "@52g@bSTAMPA RI.BA. PER CLIENTE"); j++;
set_header(j++, (const char *)(TString(_colonne).fill('_')));
TString head = " Cliente Scadenza Banca N.Riba N.Dist Importo Val N.Rata St.Def. Fattura del. N.";
TString head = "@b Cliente Scadenza Banca N.Riba N.Dist Importo Imp. in valuta Val Rata Data fattura N.";
if (_stampa_bancapp)
head << " ABI CAB Banca d'appoggio";
head << "@b ABI CAB Banca d'appoggio";
set_header(j++, head);
set_header(j, (const char *)(TString(_colonne).fill('_')));
}
@ -291,8 +291,8 @@ print_action TPrint_effetti_app::postprocess_print(int file, int counter)
st_tot_mese();
if (_tot_banca != 0.0)
{
_pr.put("TOTALE",50);
_pr.put(_tot_banca.string(PICTURE_IMPORTO),72);
_pr.put("TOTALE",46);
_pr.put(_tot_banca.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_pr.reset();
s = (look_tab("%BAN",_ban_prec));
@ -305,14 +305,14 @@ print_action TPrint_effetti_app::postprocess_print(int file, int counter)
}
if (_tot_distinta != 0.0 &&_dist_prec != 0)
{
_pr.put("___________________________________________",50);
_pr.put("_____________________________________________________",46);
printer().print(_pr);
_pr.reset();
_pr.put("TOTALE",50);
_pr.put("TOTALE",46);
s = "Distinta ";
s << _dist_prec << " " << _tipo_prec ;
_pr.put(s,57);
_pr.put(_tot_distinta.string(PICTURE_IMPORTO),72);
_pr.put(_tot_distinta.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_tot_distinta = 0.0;
_pr.reset();
@ -321,12 +321,12 @@ print_action TPrint_effetti_app::postprocess_print(int file, int counter)
{
if (_dist_prec == 0)
{
_pr.put("___________________________________________",50);
_pr.put("_____________________________________________________",46);
printer().print(_pr);
_pr.reset();
}
_pr.put("TOTALE",50);
_pr.put(_tot_tip_dist.string(PICTURE_IMPORTO),72);
_pr.put("TOTALE",46);
_pr.put(_tot_tip_dist.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_pr.reset();
s = "Distinte";
@ -353,8 +353,8 @@ print_action TPrint_effetti_app::postprocess_print(int file, int counter)
if (_tot_cliente != 0.0)
{
TString ragsoc;
_pr.put("TOTALE",50);
_pr.put(_tot_cliente.string(PICTURE_IMPORTO),72);
_pr.put("TOTALE",46); //sky totultcli
_pr.put(_tot_cliente.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_pr.reset();
TString80 cli;
@ -366,17 +366,17 @@ print_action TPrint_effetti_app::postprocess_print(int file, int counter)
if (_tot_stampa != 0.0)
{
_pr.reset();
_pr.put("___________________________________________",50);
_pr.put("_____________________________________________________",46);
printer().print(_pr);
_pr.reset();
_pr.put("TOTALE ",50);
_pr.put(_tot_stampa.string(PICTURE_IMPORTO),72);
_pr.put("TOTALE ",46);
_pr.put(_tot_stampa.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_pr.reset();
_pr.put("RI.BA. STAMPATE",52);
printer().print(_pr);
_pr.reset();
_pr.put("___________________________________________",50);
_pr.put("_____________________________________________________",46);
printer().print(_pr);
_pr.reset();
_tot_stampa = 0.0;
@ -433,19 +433,24 @@ void TPrint_effetti_app::write_bancapp()
void TPrint_effetti_app::set_scadenza()
{
set_row(1," ");
set_row(2,"@1g@s@13g#t@26g#t@54g@pn@63g@pn@72g@pn@91g#t@98g@pn@106g@s@114g@s@125g@n",
set_row(2,"@1g@s@13g#t@26g#t@49g@pn@55g@pn@63g@pn@105g@pn@111g@s@125g@n",
FLD(LF_EFFETTI, EFF_DATASCAD),
&_ban,
&_cli,
FLD(LF_EFFETTI, EFF_NPROGTR, "#####@"),
FLD(LF_EFFETTI, EFF_NDIST, "#######@"),
FLD(LF_EFFETTI, EFF_IMPORTO, PICTURE_IMPORTO),
&_val,
FLD(LF_REFFETTI, REFF_NRATA,"##@"),
FLD(LF_EFFETTI, EFF_EFFSTAMP),
FLD(LF_REFFETTI, REFF_DATAFATT),
FLD(LF_REFFETTI, REFF_NFATT));
FLD(LF_REFFETTI, REFF_NFATT,"######"));
const TString8 valuta = current_cursor()->curr().get(EFF_CODVAL);
if (!is_firm_value(valuta)) //effetto in valuta diversa da quella di conto
{
set_row(2,"@81g@pn@100g%s",
FLD(LF_EFFETTI, EFF_IMPORTOVAL, PICTURE_IMPORTO),
(const char *)valuta);
}
write_bancapp();
for(int i = 0; i < _interline; i++) set_row(i+1," ");
}
@ -455,19 +460,24 @@ void TPrint_effetti_app::set_scadenza()
void TPrint_effetti_app::set_banca()
{
set_row(1," ");
set_row(2,"@1g#t@14g@s@26g#t@54g@pn@63g@pn@72g@pn@91g#t@98g@pn@106g@s@114g@s@125g@n",
set_row(2,"@1g#t@14g@s@26g#t@49g@pn@55g@pn@63g@pn@105g@pn@111g@s@125g@pn",
&_ban,
FLD(LF_EFFETTI, EFF_DATASCAD),
&_cli,
FLD(LF_EFFETTI, EFF_NPROGTR, "#####@"),
FLD(LF_EFFETTI, EFF_NDIST, "#######@"),
FLD(LF_EFFETTI, EFF_IMPORTO, PICTURE_IMPORTO),
&_val,
FLD(LF_REFFETTI, REFF_NRATA,"##@"),
FLD(LF_EFFETTI, EFF_EFFSTAMP),
FLD(LF_REFFETTI, REFF_DATAFATT),
FLD(LF_REFFETTI, REFF_NFATT));
FLD(LF_REFFETTI, REFF_NFATT,"######"));
const TString8 valuta = current_cursor()->curr().get(EFF_CODVAL);
if (!is_firm_value(valuta)) //effetto in valuta diversa da quella di conto
{
set_row(2,"@81g@pn@100g%s",
FLD(LF_EFFETTI, EFF_IMPORTOVAL, PICTURE_IMPORTO),
(const char *)valuta);
}
write_bancapp();
for(int i = 0; i < _interline; i++) set_row(i+1,"");
}
@ -476,7 +486,7 @@ void TPrint_effetti_app::set_banca()
void TPrint_effetti_app::set_distinta()
{
set_row(1," ");
set_row(2,"@3g@s@5g@pn@16g@pn@24g@ld@35g#t@48g#-25t@72g@pn@91g#-4t@98g@pn@106g@s@114g@s@128g@n",
set_row(2,"@1g@s@3g@pn@12g@pn@19g@ld@30g#t@42g#-20t@63g@pn@105g@pn@111g@s@125g@pn",
FLD(LF_EFFETTI, EFF_TIPODIST),
FLD(LF_EFFETTI, EFF_NDIST, "#######@"),
FLD(LF_EFFETTI, EFF_NPROGTR, "#####@"),
@ -484,12 +494,17 @@ void TPrint_effetti_app::set_distinta()
&_ban,
&_cli,
FLD(LF_EFFETTI, EFF_IMPORTO, PICTURE_IMPORTO),
&_val,
FLD(LF_REFFETTI, REFF_NRATA,"##@"),
FLD(LF_EFFETTI, EFF_EFFSTAMP),
FLD(LF_REFFETTI, REFF_DATAFATT),
FLD(LF_REFFETTI, REFF_NFATT));
FLD(LF_REFFETTI, REFF_NFATT,"######"));
const TString8 valuta = current_cursor()->curr().get(EFF_CODVAL);
if (!is_firm_value(valuta)) //effetto in valuta diversa da quella di conto
{
set_row(2,"@81g@pn@100g%s",
FLD(LF_EFFETTI, EFF_IMPORTOVAL, PICTURE_IMPORTO),
(const char *)valuta);
}
write_bancapp();
for(int i = 0; i < _interline; i++) set_row(i+1,"");
}
@ -498,19 +513,24 @@ void TPrint_effetti_app::set_distinta()
void TPrint_effetti_app::set_cliente()
{
set_row(1," ");
set_row(2,"@5g@pn@25g@s@37g#t@50g@pn@59g@pn@72g@pn@91g#t@98g@pn@106g@s@114g@s@125g@n",
set_row(2,"@5g@pn@25g@s@37g#t@49g@pn@55g@pn@63g@pn@105g@pn@111g@s@125g@pn",
FLD(LF_EFFETTI, EFF_CODCF,"@@@@@@"),
FLD(LF_EFFETTI, EFF_DATASCAD),
&_ban,
FLD(LF_EFFETTI, EFF_NPROGTR, "#####@"),
FLD(LF_EFFETTI, EFF_NDIST, "#######@"),
FLD(LF_EFFETTI, EFF_IMPORTO, PICTURE_IMPORTO),
&_val,
FLD(LF_REFFETTI, REFF_NRATA,"##@"),
FLD(LF_EFFETTI, EFF_EFFSTAMP),
FLD(LF_REFFETTI, REFF_DATAFATT),
FLD(LF_REFFETTI, REFF_NFATT));
FLD(LF_REFFETTI, REFF_NFATT,"######"));
const TString8 valuta = current_cursor()->curr().get(EFF_CODVAL);
if (!is_firm_value(valuta)) //effetto in valuta diversa da quella di conto
{
set_row(2,"@81g@pn@100g%s",
FLD(LF_EFFETTI, EFF_IMPORTOVAL, PICTURE_IMPORTO),
(const char *)valuta);
}
write_bancapp();
for(int i = 0; i < _interline; i++) set_row(i+1," ");
}
@ -654,8 +674,8 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
if (scad.month() ==_scad_prec.month())
st_tot_mese();
// stampo totale banca
_pr.put("TOTALE",50);
_pr.put(_tot_banca.string(PICTURE_IMPORTO),72);
_pr.put("TOTALE",46);
_pr.put(_tot_banca.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_pr.reset();
s = (look_tab("%BAN",_ban_prec));
@ -694,14 +714,14 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
//il totale per nessuna distinta si fa solo per tipo
if (_dist_prec != 0)
{
_pr.put("___________________________________________",50);
_pr.put("_____________________________________________________",46);
printer().print(_pr);
_pr.reset();
_pr.put("TOTALE",50);
_pr.put("TOTALE",46);
s = "Distinta ";
s << _tipo_prec << " "<< _dist_prec;
_pr.put(s,57);
_pr.put(_tot_distinta.string(PICTURE_IMPORTO),72);
_pr.put(_tot_distinta.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_tot_distinta = 0.0;
_pr.reset();
@ -711,12 +731,12 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
{
if (_dist_prec == 0)
{
_pr.put("___________________________________________",50);
_pr.put("_____________________________________________________",46);
printer().print(_pr);
_pr.reset();
}
_pr.put("TOTALE",50);
_pr.put(_tot_tip_dist.string(PICTURE_IMPORTO),72);
_pr.put("TOTALE",46);
_pr.put(_tot_tip_dist.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_pr.reset();
s = "Distinte";
@ -768,8 +788,8 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
if (scad.month() ==_scad_prec.month())
st_tot_mese();
// stampo totale cliente
_pr.put("TOTALE",50);
_pr.put(_tot_cliente.string(PICTURE_IMPORTO),72);
_pr.put("TOTALE",46); //sky totcli
_pr.put(_tot_cliente.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_pr.reset();
TString80 cli;

View File

@ -23,6 +23,10 @@
#define F_ACLI 118
#define F_DA_DATA4 119
#define F_A_DATA4 120
#define F_BANCA_APP 121
#define F_BANCA_APP 121
#define F_DABAN_DESCR 122
#define F_ABAN_DESCR 123
#define F_DACLI_DESCR 124
#define F_ACLI_DESCR 125
#endif//__EF0600_H

View File

@ -2,27 +2,27 @@
#include "ef0600.h"
PAGE "Stampe di Controllo Effetti" -1 -1 58 15
PAGE "Stampe di Controllo Effetti" -1 -1 78 15
DATE F_DATA_STAMPA
BEGIN
PROMPT 30 1 "Data di stampa "
PROMPT 50 1 "Data di stampa "
FLAGS "A"
END
BOOL F_BANCA_APP
BEGIN
PROMPT 30 3 "Stampa banca appoggio"
PROMPT 50 3 "Stampa banca appoggio"
END
TEXT DLG_NULL
BEGIN
PROMPT 32 4 "(richieste 198 colonne)"
PROMPT 52 4 "(richieste 198 colonne)"
END
RADIOBUTTON RDB_TIPOST 24
RADIOBUTTON RDB_TIPOST 25
BEGIN
PROMPT 2 1 "Stampa per "
PROMPT 1 1 "Stampa per "
ITEM "1|Banca"
MESSAGE SHOW,2@|HIDE,1@|HIDE,3@|HIDE,4@
ITEM "2|Cliente/Fornitore"
@ -33,7 +33,8 @@ BEGIN
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@|HIDE,4@
END
GROUPBOX DLG_NULL 55 3
//---------data----------------------------------------------------------------------------------------------------------//
GROUPBOX DLG_NULL 75 3
BEGIN
PROMPT 1 7 "Stampa effetti per Data di scadenza"
GROUP 1
@ -53,7 +54,8 @@ BEGIN
WARNING "Data limite superiore non valida"
END
GROUPBOX DLG_NULL 55 4
//---------banca----------------------------------------------------------------------------------------------------------//
GROUPBOX DLG_NULL 75 6
BEGIN
PROMPT 1 7 "Stampa effetti per Banca di presentazione"
GROUP 2
@ -67,41 +69,74 @@ BEGIN
USE BNP KEY 1 SELECT CODTAB ?= "??????????"
JOIN %BAN ALIAS 100 INTO CODTAB==CODTAB
INPUT CODTAB F_DABAN
DISPLAY "Codice ABI" CODTAB[1,5]
DISPLAY "Denominazione@50" %BAN->S0
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10]
DISPLAY "Denominazione@50" 100@->S0
OUTPUT F_DABAN CODTAB[1,5]
OUTPUT F_DABAN_DESCR %BAN->S0
CHECKTYPE SEARCH
END
STRING F_DABAN_DESCR 50
BEGIN
PROMPT 23 8 ""
GROUP 2
USE %BAN KEY 2 SELECT (CODTAB?="??????????")&&(200@->CODTAB!="")
JOIN BNP ALIAS 200 INTO CODTAB==CODTAB
INPUT S0 F_DABAN_DESCR
DISPLAY "Denominazione@50" S0
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10]
COPY OUTPUT F_DABAN
CHECKTYPE SEARCH
END
NUMBER F_ABAN 5
BEGIN
PROMPT 30 8 "Alla Banca "
PROMPT 2 9 "Alla Banca "
FLAGS "RZ"
GROUP 2
USE BNP KEY 1 SELECT CODTAB ?= "??????????"
JOIN %BAN ALIAS 100 INTO CODTAB==CODTAB
INPUT CODTAB F_ABAN
DISPLAY "Codice ABI" CODTAB[1,5]
DISPLAY "Denominazione@50" %BAN->S0
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10]
DISPLAY "Denominazione@50" 100@->S0
OUTPUT F_ABAN CODTAB[1,5]
OUTPUT F_ABAN_DESCR %BAN->S0
CHECKTYPE SEARCH
END
STRING F_ABAN_DESCR 50
BEGIN
PROMPT 23 9 ""
GROUP 2
USE %BAN KEY 2 SELECT (CODTAB?="??????????")&&(200@->CODTAB!="")
JOIN BNP ALIAS 200 INTO CODTAB==CODTAB
INPUT S0 F_ABAN_DESCR
DISPLAY "Denominazione@50" S0
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10]
COPY OUTPUT F_ABAN
CHECKTYPE SEARCH
END
DATA F_DA_DATA2
BEGIN
PROMPT 2 9 "Dalla Data "
PROMPT 2 10 "Dalla Data "
GROUP 2
END
DATA F_A_DATA2
BEGIN
PROMPT 30 9 "Alla Data "
PROMPT 30 10 "Alla Data "
GROUP 2
VALIDATE DATE_CMP_FUNC >= F_DA_DATA2
WARNING "Data limite superiore non valida"
END
GROUPBOX DLG_NULL 55 7
//---------distinta-------------------------------------------------------------------------------------------------------//
GROUPBOX DLG_NULL 75 5
BEGIN
PROMPT 1 7 "Stampa effetti per Distinta"
GROUP 3
@ -116,15 +151,9 @@ BEGIN
FLAGS "D"
END
TEXT DLG_NULL
BEGIN
PROMPT 2 8 "Dalla Distinta "
GROUP 3
END
LIST F_DATIPODIST 19
BEGIN
PROMPT 4 9 " "
PROMPT 4 8 " "
KEY 4
GROUP 3
ITEM " |Senza distinta" MESSAGE CLEAR,F_DADIST|CLEAR,F_ADIST
@ -133,9 +162,15 @@ BEGIN
ITEM "S|Allo sconto" MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST
END
TEXT DLG_NULL
BEGIN
PROMPT 2 9 "Dalla Distinta"
GROUP 3
END
NUMBER F_DADIST 5
BEGIN
PROMPT 4 10 " "
PROMPT 18 9 " "
FLAGS "D"
GROUP 3
KEY 4
@ -151,13 +186,13 @@ END
TEXT DLG_NULL
BEGIN
PROMPT 30 8 "Alla Distinta "
PROMPT 30 9 "Alla Distinta"
GROUP 3
END
NUMBER F_ADIST 5
BEGIN
PROMPT 31 10 " "
PROMPT 44 9 " "
FLAGS "D"
KEY 4
GROUP 3
@ -176,31 +211,32 @@ END
TEXT DLG_NULL
BEGIN
PROMPT 2 11 "Dalla Data "
PROMPT 2 10 "Dalla Data "
GROUP 3
END
DATA F_DA_DATA3
BEGIN
PROMPT 4 12 " "
PROMPT 15 10 " "
GROUP 3
END
TEXT DLG_NULL
BEGIN
PROMPT 30 11 "Alla Data "
PROMPT 30 10 "Alla Data "
GROUP 3
END
DATA F_A_DATA3
BEGIN
PROMPT 31 12 " "
PROMPT 41 10 " "
GROUP 3
VALIDATE DATE_CMP_FUNC >= F_DA_DATA3
WARNING "Data limite superiore non valida"
END
GROUPBOX DLG_NULL 55 5
//---------clifo----------------------------------------------------------------------------------------------------------//
GROUPBOX DLG_NULL 75 6
BEGIN
PROMPT 1 7 "Stampa effetti per Cliente/Fornitori"
GROUP 4
@ -208,7 +244,7 @@ END
LIST F_TIPOCF 11
BEGIN
PROMPT 2 8 "Tipo "
PROMPT 2 8 "Tipo "
ITEM "C|Clienti"
ITEM "F|Fornitori"
GROUP 4
@ -216,7 +252,7 @@ END
NUMBER F_DACLI 6
BEGIN
PROMPT 2 9 "Da Codice "
PROMPT 2 9 "Da Codice "
GROUP 4
USE LF_CLIFO
INPUT TIPOCF F_TIPOCF SELECT
@ -224,31 +260,59 @@ BEGIN
DISPLAY "Codice" CODCF
DISPLAY "Ragione sociale@60" RAGSOC
OUTPUT F_DACLI CODCF
CHECKTYPE NORMAL
OUTPUT F_DACLI_DESCR RAGSOC
CHECKTYPE SEARCH
END
STRING F_DACLI_DESCR 50
BEGIN
PROMPT 21 9 " "
GROUP 4
USE LF_CLIFO KEY 2
INPUT TIPOCF F_TIPOCF SELECT
INPUT RAGSOC F_DACLI_DESCR
DISPLAY "Ragione sociale@60" RAGSOC
DISPLAY "Codice" CODCF
OUTPUT F_DACLI_DESCR RAGSOC
OUTPUT F_DACLI CODCF
CHECKTYPE SEARCH
END
NUMBER F_ACLI 6
BEGIN
PROMPT 30 9 "A Codice "
PROMPT 2 10 "A Codice "
GROUP 4
COPY USE F_DACLI
INPUT TIPOCF F_TIPOCF SELECT
INPUT CODCF F_ACLI
COPY DISLAY F_DACLI
DISPLAY "Codice" CODCF
OUTPUT F_ACLI CODCF
CHECKTYPE NORMAL
OUTPUT F_ACLI_DESCR RAGSOC
CHECKTYPE SEARCH
END
STRING F_ACLI_DESCR 50
BEGIN
PROMPT 21 10 " "
GROUP 4
COPY USE F_DACLI_DESCR
INPUT TIPOCF F_TIPOCF SELECT
INPUT RAGSOC F_ACLI_DESCR
COPY DISPLAY F_DACLI_DESCR
OUTPUT F_ACLI_DESCR RAGSOC
OUTPUT F_ACLI CODCF
CHECKTYPE SEARCH
END
DATA F_DA_DATA4
BEGIN
PROMPT 2 10 "Dalla Data "
PROMPT 2 11 "Dalla Data "
GROUP 4
END
DATA F_A_DATA4
BEGIN
PROMPT 30 10 "Alla Data "
PROMPT 30 11 "Alla Data "
GROUP 4
VALIDATE DATE_CMP_FUNC >= F_DA_DATA2
WARNING "Data limite superiore non valida"

View File

@ -29,7 +29,7 @@
*/
#include <applicat.h>
#include <mask.h>
#include <automask.h>
#include <modaut.h>
#include <progind.h>
#include <relation.h>
@ -58,6 +58,17 @@
#define DIST_SBF 'B'
#define DIST_SCONTO 'S'
// TContabilizzazione_mask
class TContabilizzazione_mask : public TAutomask
{
protected:
virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly);
public:
TContabilizzazione_mask();
};
// TContabilizzazione_effetti_app
// Applicazione di contabilizzazione effetti
class TContabilizzazione_effetti_app : public TSkeleton_application
@ -162,12 +173,58 @@ public:
bool good() const { return _error == no_error;}
error_type status() { return _error; }
void set_status(error_type e) { _error = e; }
TArray_sheet& dist_sheet() { return *_dist_sheet; }
TContabilizzazione_effetti_app() : _msk(NULL) {}
virtual ~TContabilizzazione_effetti_app() { }
};
inline TContabilizzazione_effetti_app& app() { return (TContabilizzazione_effetti_app&) main_app(); }
// TContabilizzazione_mask
bool TContabilizzazione_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
{
switch (f.dlg())
{
case F_DATA_OP:
if (e == fe_modify || e == fe_close)
{
const TDate data = f.get();
TEsercizi_contabili esc;
if (esc.date2esc(data) <= 0)
return error_box("La data deve appartenere ad un esercizio valido");
}
break;
case F_RESET:
if (e == fe_button)
{
app().dist_sheet().check(-1, FALSE);
reset(F_DISTINTE);
}
break;
case F_SELECT:
if (e == fe_button)
{
TArray_sheet& sh = app().dist_sheet();
if (sh.run() == K_ENTER)
set(F_DISTINTE,sh.checked());
}
break;
default:
break;
}
return TRUE;
}
TContabilizzazione_mask::TContabilizzazione_mask()
: TAutomask("ef0800a")
{
}
// TContabilizzazione_effetti_app
void TContabilizzazione_effetti_app::build_dist_sheet()
{
TRelation eff_rel(LF_EFFETTI);
@ -290,9 +347,7 @@ bool TContabilizzazione_effetti_app::create()
_caus = NULL;
_error = no_error;
_can_write = TRUE;
_msk = new TMask("ef0800a");
_msk->set_handler(F_SELECT,handle_select);
_msk->set_handler(F_RESET,handle_reset);
_msk = new TContabilizzazione_mask();
_cpg = new TTable("%CPG");
_bnp = new TTable("BNP");
_clifo = new TLocalisamfile(LF_CLIFO);
@ -352,24 +407,9 @@ void TContabilizzazione_effetti_app::main_loop()
continue;
}
_data_op = _msk->get_date(F_DATA_OP);
if (!_data_op.ok()) _data_op = TODAY;
// if (_caus != NULL) delete _caus;
// _caus = new TCausale(_cod_caus,_data_op.year());
// if (!_caus->ok())
// {
// error_box("Causale contabile non valida o non presente in parametri effetti");
// continue;
// }
TEsercizi_contabili esc;
esc.update();
_cod_es = esc.date2esc(_data_op);
if (_cod_es <= 0)
{
error_box("La data operazione non appartiene a nessun esercizio");
continue;
}
TEsercizi_contabili esc;
_cod_es = esc.date2esc(_data_op);
_dett_rate_att = _msk->get_bool(F_DETT_RATE_ATT);
_dett_rate_pas = _msk->get_bool(F_DETT_RATE_PAS);
@ -401,6 +441,11 @@ void TContabilizzazione_effetti_app::display_error()
msg.format("Non e' possibile reperire il conto per le spese\n"
"dalla causale '%s'", _caus->codice());
break;
case datadoc_error:
msg.format("La data distinta %s non appartiene ad un esercizio valido",
(const char*)_distinta->data_dist().string());
break;
default: // Errori generici o non indicati vengono visualizzati nel punto dell'errore
break;
}
@ -739,6 +784,17 @@ void TContabilizzazione_effetti_app::compile_head_mov()
const TString80 codval(_distinta->codval());
const real cambio(_distinta->cambio());
const long ndist = _distinta->ndist();
TEsercizi_contabili esc;
if (esc.date2esc(datadist) <= 0)
{
if (!yesno_box("Attenzione: la data distinta %s non appartiene ad un esercizio valido:\n"
"Si desidera proseguire ugualmente?", (const char*)datadist.string()))
{
_can_write = FALSE;
return;
}
}
TString des;
des = (_distinta->tipocf() == 'F') ? _desc_pag : _desc_inc;
@ -790,26 +846,25 @@ void TContabilizzazione_effetti_app::compile_head_mov()
mov.put(MOV_CAMBIO, cambio);
}
// MOV_TOTDOC e MOV_TOTDOCVAL vengono completati prima della scrittura del movimento
// MOV_TOTDOC e MOV_TOTDOCVAL vengono completati prima della scrittura del movimento
// e solo nel caso di saldaconto abilitato
}
void TContabilizzazione_effetti_app::compile_riga_partita(TRiga_partite& riga, const TEffetto& effetto, const TRectype& riga_effetto, int numrig)
{
TLocalisamfile& head_mov = _movimento->lfile();
const TRectype& head_mov = _movimento->curr();
riga.put(PART_TIPOMOV,_caus->tipomov());
riga.put(PART_TIPOPAG,effetto.get_int(EFF_TIPOPAG));
riga.put(PART_NREG,head_mov.get_long(MOV_NUMREG));
riga.put(PART_TIPOPAG,effetto.get(EFF_TIPOPAG));
riga.put(PART_NREG,head_mov.get(MOV_NUMREG));
riga.put(PART_NUMRIG,numrig);
riga.put(PART_DATAREG,head_mov.get_date(MOV_DATAREG));
riga.put(PART_DATADOC,head_mov.get_date(MOV_DATADOC));
riga.put(PART_DATAPAG,effetto.get_date(EFF_DATASCAD));
riga.put(PART_DATAREG,head_mov.get(MOV_DATAREG));
riga.put(PART_DATADOC,head_mov.get(MOV_DATADOC));
riga.put(PART_DATAPAG,effetto.get(EFF_DATASCAD));
riga.put(PART_CODCAUS,head_mov.get(MOV_CODCAUS));
riga.put(PART_NUMDOC,head_mov.get(MOV_NUMDOC)); // Sarebbe il numero della distinta...
riga.put(PART_DESCR, head_mov.get(MOV_DESCR));
riga.put(PART_SEZ,sezione());
const real imp = riga_effetto.get_real(REFF_IMPORTO);
const real imp_val = riga_effetto.get_real(REFF_IMPORTOVAL);
const real imp = riga_effetto.get(REFF_IMPORTO);
const real imp_val = riga_effetto.get(REFF_IMPORTOVAL);
/* Non scrivo qui gli importi: li sommo quando faccio i pagamenti
riga.put(PART_IMPORTO,imp);
riga.put(PART_IMPORTOVAL,imp_val);
@ -904,6 +959,7 @@ void TContabilizzazione_effetti_app::compile_saldac(const TEffetto& eff,
numdoc_to_search = numpart; // A mali estremi... estremi rimedi
}
}
TPartita * partita = _part_array->exist(_cliente,anno,numpart);
if (partita == NULL) // Se la partita non esiste nell'array la aggiunge
{
@ -1065,59 +1121,65 @@ void TContabilizzazione_effetti_app::aggiorna_saldi()
error_type TContabilizzazione_effetti_app::write_all(bool change_status)
{
TRectype& head = _movimento->lfile().curr();
head.put(MOV_TOTDOC,_total_mov);
head.put(MOV_TOTDOCVAL,_total_mov_val);
long orig_numreg, numreg = head.get_long(MOV_NUMREG);
orig_numreg = numreg;
while (_movimento->write() == _isreinsert)
head.put(MOV_NUMREG,++numreg);
if (_movimento->status() != NOERR)
long numreg = head.get_long(MOV_NUMREG);
if (_movimento->cg_items() >= 2) // Non ha senso un movimento di una riga sola
{
error_box("E' stato rilevato l'errore %d scrivendo il movimento %ld.",_movimento->status(),numreg);
_error = generic_error;
}
if (good()) // nessun errore ?
{
aggiorna_saldi();
TRectype& head = _movimento->lfile().curr();
head.put(MOV_TOTDOC,_total_mov);
head.put(MOV_TOTDOCVAL,_total_mov_val);
if (_sc_enabled) // Debbo scrivere anche le partite ?
const long orig_numreg = numreg;
while (_movimento->write() == _isreinsert)
head.put(MOV_NUMREG,++numreg);
if (_movimento->status() != NOERR)
{
if (numreg > orig_numreg) // Ha effettuato una rinumerazione ?
{
// Allora scorre le partite in _part_array e aggiorna il campo NREG delle righe di ognuna
for (TPartita * p = _part_array->first(); p != NULL; p = _part_array->next())
// Scorre le righe della partita corrente
for (int n = p->last(); n > 0; n = p->pred(n))
{
TRiga_partite& riga = p->riga(n);
if (riga.get_long(PART_NREG) == orig_numreg) // sostituisce il numero registrazione con quello nuovo
riga.put(PART_NREG, numreg);
}
}
if (!_part_array->write()) // L'errore viene gia' segnalato dalla partita
_error = generic_error;
error_box("E' stato rilevato l'errore %d scrivendo il movimento %ld.",_movimento->status(),numreg);
_error = generic_error;
}
if (good() && change_status) // deve anche cambiare lo stato alla distinta ?
if (good()) // nessun errore ?
{
TDistinta& distinta = *_distinta;
const int items = distinta.items();
for (int n = 0; n < items; n++)
aggiorna_saldi();
if (_sc_enabled) // Debbo scrivere anche le partite ?
{
TRectype& eff = distinta[n];
eff.put(EFF_EFFCONT, TRUE);
eff.put(EFF_NUMREG, numreg);
}
int err = distinta.rewrite();
if (err != NOERR)
{
error_box("E' stato rilevato l'errore %d aggiornando lo stato della distinta %c %ld.",err,distinta.tipodist(),distinta.ndist());
_error = generic_error;
if (numreg > orig_numreg) // Ha effettuato una rinumerazione ?
{
// Allora scorre le partite in _part_array e aggiorna il campo NREG delle righe di ognuna
for (TPartita * p = _part_array->first(); p != NULL; p = _part_array->next())
// Scorre le righe della partita corrente
for (int n = p->last(); n > 0; n = p->pred(n))
{
TRiga_partite& riga = p->riga(n);
if (riga.get_long(PART_NREG) == orig_numreg) // sostituisce il numero registrazione con quello nuovo
riga.put(PART_NREG, numreg);
}
}
if (!_part_array->write()) // L'errore viene gia' segnalato dalla partita
_error = generic_error;
}
}
}
if (good() && change_status) // deve anche cambiare lo stato alla distinta ?
{
TDistinta& distinta = *_distinta;
const int items = distinta.items();
for (int n = 0; n < items; n++)
{
TRectype& eff = distinta[n];
eff.put(EFF_EFFCONT, TRUE);
eff.put(EFF_NUMREG, numreg);
}
int err = distinta.rewrite();
if (err != NOERR)
{
error_box("E' stato rilevato l'errore %d aggiornando lo stato della distinta %c %ld.",err,distinta.tipodist(),distinta.ndist());
_error = generic_error;
}
}
return _error;
}
@ -1367,9 +1429,10 @@ void TContabilizzazione_effetti_app::contabilize_bill(const char tipo, const lon
}
} // Ciclo su effetti
if (good() && _can_write && customers.items()) // scrive il movimento residuo ...
{
join_rows(customers, banks, abbuoni_att, abbuoni_pas, differenze_cam, spese);
if (good() && _can_write) // scrive il movimento residuo ...
{
if (customers.items() > 0)
join_rows(customers, banks, abbuoni_att, abbuoni_pas, differenze_cam, spese);
if (good() && write_all() == no_error) // Se la scrittura e' andata ok...
_total_bills++; // incrementa il numero di distinte contabilizzate
}

View File

@ -16,6 +16,7 @@ BEGIN
DISPLAY "Ammontare compl.@18" R0
OUTPUT F_INIZIO1 CODTAB[1,4]
OUTPUT F_INIZIO2 CODTAB[5,6]
CHECKTYPE REQUIRED
FIELD CODTAB[1,4]
GROUP 1
END
@ -37,6 +38,7 @@ BEGIN
COPY DISPLAY F_INIZIO1
OUTPUT F_FINE1 CODTAB[1,4]
OUTPUT F_FINE2 CODTAB[5,6]
CHECKTYPE REQUIRED
FIELD CODTAB[1,4]
GROUP 2
END

View File

@ -10,7 +10,8 @@ Tabella Dati Riassuntivi
[Rows]
1|CODTAB[1,4]|@3g@4,rs
1|CODTAB[5,]|@10g@2,rs
1|CODTAB[5,6]|@10g@2,rs
1|I0|@21g@4,rn
1|I1|@27g@7,rn
1|I2|@36g@7,rn

View File

@ -281,7 +281,10 @@ void TStampaIntra_form::print()
break;
default:
break;
}
}
bool verygood = good();
if (!verygood)
break;
}
}
// Exhausting all the rest:

View File

@ -287,7 +287,6 @@ void TRecord_intra::put(const TRectype& rec, TIntra_context& ic)
}
}
// Scrive su file il record
void TRecord_intra::print_on(ostream& o) const
{
@ -316,6 +315,8 @@ protected:
long calcola_totale(TCursor& cur, real& tot) const;
bool write_record(ofstream& out, const TRecord_intra& rec, TIntra_context& ic);
void proponi_numero();
public:
void genera_dischetto();
@ -323,10 +324,41 @@ public:
TDischetto_mask();
};
void TDischetto_mask::proponi_numero()
{
int a = anno(), p = periodo();
long d = 0;
TTable ird("IRD");
if (ird.last() == NOERR)
{
const TString& str = ird.get("CODTAB");
a = atoi(str.mid(0,4));
p = atoi(str.mid(4,2));
d = ird.get_long("I0");
}
if (anno() > a || periodo() > p)
set(F_NUMERO, d+1);
else
set(F_NUMERO, d == 0 ? 1L : d);
set(F_LAST, d);
}
bool TDischetto_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_ANNO:
if (e == fe_init || e == fe_modify)
proponi_numero();
break;
case F_PERIODO_M:
case F_PERIODO_T:
case F_PERIODO_A:
if (e == fe_modify)
proponi_numero();
break;
case F_RIEPILOGHI:
if (e == fe_button)
::genera_riepiloghi(tipo(), anno(), periodo());
@ -371,7 +403,9 @@ bool TDischetto_mask::write_record(ofstream& out, const TRecord_intra& rec, TInt
out.close();
TFilename name;
name = get(F_DISCO); name.add("scambi.cee");
name = get(F_DISCO);
name.add(get(F_PATH));
name.add("scambi.cee");
message_box("Inserire un nuovo dischetto prima di continuare.");
out.open(name);
@ -388,7 +422,6 @@ bool TDischetto_mask::write_record(ofstream& out, const TRecord_intra& rec, TInt
void TDischetto_mask::genera_dischetto()
{
TTable ird("IRD");
TIntra_context ic;
ic._tipo = tipo();
ic._anno = anno();
@ -397,10 +430,12 @@ void TDischetto_mask::genera_dischetto()
ic._progr = get_long(F_NUMERO);
TString16 codtab; codtab.format("%04d%02d", ic._anno, ic._periodo);
TTable ird("IRD");
ird.put("CODTAB", codtab);
const bool exist = ird.read() == NOERR;
if (exist && !yesno_box("il periodo indicato e' gia' stato generato,\n devo proseguire"))
if (exist && !yesno_box("Il periodo indicato è già stato generato:\nsi desidera proseguire"))
return;
TRelation rel(LF_RIEPRETT);
@ -418,7 +453,9 @@ void TDischetto_mask::genera_dischetto()
ic._righe_rett = calcola_totale(rett, ic._totale_rett);
TFilename name;
name = get(F_DISCO); name.add("scambi.cee");
name = get(F_DISCO);
name.add(get(F_PATH));
name.add("scambi.cee");
if (name.exist())
{
@ -466,7 +503,7 @@ void TDischetto_mask::genera_dischetto()
codtab.format("%04d%02d", ic._anno, ic._periodo);
ird.put("CODTAB", codtab);
ird.put("I0", ic._progr);
ird.put("I0", ic._progr); // Numero progressivo dischetto
// ird.put("I1", ??? );
ird.put("I2", total);
ird.put("R0", ic._totale_riep + ic._totale_rett);

View File

@ -6,4 +6,6 @@
#define F_PERIODO_A 105
#define F_DISCO 106
#define F_NUMERO 107
#define F_LAST 108
#define F_PATH 109

View File

@ -1,6 +1,6 @@
#include "in0200a.h"
PAGE "Generazione Dischetti INTRA" -1 -1 30 8
PAGE "Generazione Dischetti INTRA" -1 -1 40 9
LIST F_TIPO 1 10
BEGIN
@ -11,26 +11,20 @@ END
NUMBER F_ANNO 4
BEGIN
PROMPT 1 2 "Anno "
PROMPT 30 1 "Anno "
FLAGS "AU"
END
NUMBER F_NUMERO 6
BEGIN
PROMPT 15 2 "Numero "
CHECKTYPE REQUIRED
END
LIST F_PERIODO_M 2 17
BEGIN
PROMPT 1 3 "Periodo "
PROMPT 1 2 "Periodo "
FLAGS "AM"
FIELD PERIODO
END
LIST F_PERIODO_T 2 17
BEGIN
PROMPT 1 3 "Periodo "
PROMPT 1 2 "Periodo "
ITEM "01|Gennaio-Marzo"
MESSAGE COPY,F_PERIODO_M
ITEM "02|Aprile-Giugno"
@ -43,17 +37,34 @@ END
LIST F_PERIODO_A 2 17
BEGIN
PROMPT 1 3 "Periodo "
PROMPT 1 2 "Periodo "
ITEM "01|Annuale"
MESSAGE COPY,F_PERIODO_M
END
NUMBER F_NUMERO 6
BEGIN
PROMPT 1 3 "Dischetto "
CHECKTYPE REQUIRED
END
NUMBER F_LAST 6
BEGIN
PROMPT 26 3 "Ultimo "
FLAGS "D"
END
LIST F_DISCO 2
BEGIN
PROMPT 1 4 "Disco destinazione "
ITEM "A:|A:"
ITEM "B:|B:"
ITEM "C:|C:"
PROMPT 1 4 "Disco destinazione "
ITEM "A:|A:" MESSAGE CLEAR,F_PATH
ITEM "B:|B:" MESSAGE CLEAR,F_PATH
ITEM "C:|C:" MESSAGE ENABLE,F_PATH
END
STRING F_PATH 50 29
BEGIN
PROMPT 1 5 "Cartella "
END
BUTTON F_RIEPILOGHI 26 1

View File

@ -31,6 +31,32 @@ public:
virtual ~TImmissione_mask() { }
};
///////////////////////////////////////////////////////////
// Applicazione principale
///////////////////////////////////////////////////////////
class TImmissione_intra : public TRelation_application
{
TRelation* _rel;
TImmissione_mask* _msk;
protected:
virtual bool user_create();
virtual TRelation* get_relation() const { return _rel; }
virtual TMask* get_mask(int) { return _msk; }
virtual bool changing_mask(int mode) { return FALSE; }
virtual bool user_destroy();
virtual bool protected_record(TRectype & rec);
public:
};
TImmissione_intra& app() { return (TImmissione_intra&)main_app(); }
///////////////////////////////////////////////////////////
// TImmissione_mask
///////////////////////////////////////////////////////////
bool TImmissione_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
const short id = o.dlg();
@ -39,28 +65,30 @@ bool TImmissione_mask::on_field_event(TOperable_field& o, TField_event e, long j
case F_NUM_REG:
if (e == fe_modify || e == fe_init)
{
if (main_app().has_module(CGAUT))
if (app().has_module(CGAUT, CHK_DONGLE))
{
const TString& numreg = o.get();
if (numreg.not_empty())
{
const TRectype& mov = cache().get(LF_MOV, numreg);
if (mov.empty())
return error_box("Il movimento contabile %s non esiste", (const char *) numreg);
{
if (e == fe_modify && !app().is_transaction())
warning_box("Il movimento contabile %s non esiste", (const char*)numreg);
}
else
{
set(F_NUM_DOC, mov.get(MOV_NUMDOC));
set(F_DATA_DOC, mov.get(MOV_DATADOC));
const TString16 caus(mov.get(MOV_CODCAUS));
TCausale c(caus);
if (c.intra())
{
set(F_NUM_DOC, mov.get(MOV_NUMDOC));
set(F_DATA_DOC, mov.get(MOV_DATADOC));
}
else
return error_box("La causale del movimento contabile %s non e' intracomunitaria", (const char *) numreg);
const TCausale c(caus);
if (!c.intra())
return error_box("La causale %s del movimento contabile %s non e' intracomunitaria",
(const char*)caus, (const char*)numreg);
const bool gestval = c.valintra();
enable(F_VALUTA, gestval);
enable(F_CAMBIO, gestval);
}
}
}
@ -77,8 +105,6 @@ bool TImmissione_mask::on_field_event(TOperable_field& o, TField_event e, long j
s.enable_column(F_PAESE_ORIG, acq);
s.set_column_header(F_PAESE, acq ? "Paese\nProv." : "Paese\nDest.") ;
s.set_column_header(F_PROV, acq ? "Provincia\nDest." : "Provincia\nOrig.") ;
const CheckType chk1 = acq ? CHECK_REQUIRED : CHECK_NORMAL;
field(F_VALUTA).check_type(chk1);
TString key ; key << main_app().get_firm();
const bool req = frequenza(anno()) == 'M' && !cache().get(LF_NDITTE, key).get_bool("NONOBBSTAT");
@ -94,42 +120,39 @@ bool TImmissione_mask::on_field_event(TOperable_field& o, TField_event e, long j
case F_CLIFO:
if (e == fe_modify)
{
const TRectype& curr = efield(F_CLIFO).browse()->cursor()->curr();
TString16 codval = curr.get("VALINTRA");
if (codval.empty())
codval = curr.get("CODVAL");
set(F_VALUTA, codval, TRUE);
TEdit_field& valu = efield(F_VALUTA);
if (valu.active())
{
const TRectype& curr = efield(F_CLIFO).browse()->cursor()->curr();
TString16 codval = curr.get("VALINTRA");
if (codval.empty())
codval = curr.get("CODVAL");
set(F_VALUTA, codval, TRUE);
}
}
break;
case F_VALUTA:
if (e == fe_modify)
if (e == fe_init || e == fe_modify)
{
TEdit_field& cambio = efield(F_CAMBIO);
if (o.empty())
cambio.reset();
else
{
const TRectype& curr = cache().get("%VAL", o.get());
const TString& s = curr.get("S4");
cambio.set(s);
}
TSheet_field& s = sfield(F_RIGHE);
const bool enable_val = is_true_value(get(F_VALUTA));
const int col = s.cid2index(F_AMM_VALUTA);
s.enable_column(col, enable_val);
const int rows = s.items();
for (int i = 0; i < rows; i++)
{
const int col = s.cid2index(F_AMM_VALUTA);
s.enable_cell(i, col, enable_val);
TToken_string & r = s.row(i);
if (!enable_val)
r.add("", col);
}
@ -161,7 +184,7 @@ bool TImmissione_mask::on_field_event(TOperable_field& o, TField_event e, long j
if (!enable_val)
m.reset(F_AMM_VALUTA);
else
if (m.get_real(F_AMM_VALUTA).is_zero())
if (!o.empty() && m.get_real(F_AMM_VALUTA).is_zero())
{
curr.change_value(get(F_VALUTA), get_real(F_CAMBIO));
m.set(F_AMM_VALUTA, curr, TRUE);
@ -173,7 +196,7 @@ bool TImmissione_mask::on_field_event(TOperable_field& o, TField_event e, long j
if (e == fe_modify)
{
TMask& m = o.mask();
if (m.get_real(F_AMM_LIRE).is_zero())
if (!o.empty() && m.get_real(F_AMM_LIRE).is_zero())
{
TCurrency curr(real(o.get()), get(F_VALUTA), get_real(F_CAMBIO));
curr.change_to_firm_val();
@ -199,11 +222,14 @@ bool TImmissione_mask::on_sheet_event(TSheet_field& s, TField_event e, int row)
{
if (e == se_notify_add)
{
const bool enable_val = is_true_value(get(F_VALUTA));
const int col = s.cid2index(F_AMM_VALUTA);
s.enable_cell(s.selected(), col, enable_val);
s.force_update();
const bool enable_val = is_true_value(get(F_VALUTA));
if (!enable_val)
{
const int col = s.cid2index(F_AMM_VALUTA);
row = s.items()-1;
s.enable_cell(row, col, enable_val);
s.force_update(row);
}
}
else
if (e == se_notify_modify)
@ -234,7 +260,6 @@ bool TImmissione_mask::on_sheet_field_event(TOperable_field& o, TField_event e,
{
TMask& m = o.mask();
TString16 key; key << m.get(F_NOMENCLATURA1) << m.get(F_NOMENCLATURA2) << m.get(F_NOMENCLATURA3);
if (key.empty())
return error_box("La nomenclatura combinata e' obbligatoria");
}
@ -279,22 +304,6 @@ TImmissione_mask::TImmissione_mask()
// Applicazione principale
///////////////////////////////////////////////////////////
class TImmissione_intra : public TRelation_application
{
TRelation* _rel;
TImmissione_mask* _msk;
protected:
virtual bool user_create();
virtual TRelation* get_relation() const { return _rel; }
virtual TMask* get_mask(int) { return _msk; }
virtual bool changing_mask(int mode) { return FALSE; }
virtual bool user_destroy();
virtual bool protected_record(TRectype & rec);
public:
};
bool TImmissione_intra::protected_record(TRectype & rec)
{
const char tipo = rec.get_char("TIPOMOV");

View File

@ -6,7 +6,7 @@ TOOLBAR "Toolbar" 0 -3 0 3
BUTTON R_RIEPILOGHI 28 1
BEGIN
PROMPT -11 0 "~Generazione Riepiloghi"
PROMPT -11 -3 "~Generazione Riepiloghi"
END
ENDPAGE
@ -168,7 +168,7 @@ BEGIN
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_VALUTA CODTAB
CHECKTYPE REQUIRED
CHECKTYPE NORMAL
MESSAGE EMPTY CLEAR,F_CAMBIO
MESSAGE ENABLE,F_CAMBIO
FIELD CODVAL
@ -320,6 +320,7 @@ BEGIN
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CONSEGNA CODTAB
CHECKTYPE NORMAL
FIELD CONSEGNA
END
@ -331,6 +332,7 @@ BEGIN
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_TRASPORTO CODTAB
CHECKTYPE NORMAL
FIELD TRASPORTO
END

View File

@ -13,6 +13,7 @@ NUMBER R_ANNO 4
BEGIN
PROMPT 1 2 "Anno "
FLAGS "AU"
CHECKTYPE REQUIRED
END
LIST R_PERIODO_M 2 17

View File

@ -45,22 +45,29 @@ bool TRiepiloghi_mask::on_field_event(TOperable_field& o, TField_event e, long j
{
TString16 key; key << get(F_NOMENCLATURA1) << get(F_NOMENCLATURA2) << get(F_NOMENCLATURA3);
const TRectype& nom = cache().get("%NOC", key);
key = nom.get("S5");
set(F_UMS, key);
set(F_UMS, nom.get("S5"));
bool req = frequenza(anno()) == 'M';
if (req) // Solo la frequenza mensile puo' obbligare
{
const char obb = nom.get_char("S4");
req = obb == 'E' || obb == tipo();
}
field(F_MASSA_UMS).check_type(req ? CHECK_REQUIRED : CHECK_NORMAL);
}
break;
case F_VALORE_STAT:
if (e == fe_init)
{
TMask& m = o.mask();
TString key ; key << main_app().get_firm();
const bool req = frequenza(anno()) == 'M' && !cache().get(LF_NDITTE, key).get_bool("NONOBBSTAT");
bool req = frequenza(anno()) == 'M';
if (req)
{
TString16 key ; key << main_app().get_firm();
req = !cache().get(LF_NDITTE, key).get_bool("NONOBBSTAT");
}
const CheckType chk = req ? CHECK_REQUIRED : CHECK_NORMAL;
m.field(F_VALORE_STAT).check_type(chk);
m.field(F_CONSEGNA).check_type(chk);
m.field(F_TRASPORTO).check_type(chk);
field(F_VALORE_STAT).check_type(chk);
field(F_CONSEGNA).check_type(chk);
field(F_TRASPORTO).check_type(chk);
}
break;
case F_PARTITA_IVA:
@ -78,7 +85,16 @@ bool TRiepiloghi_mask::on_field_event(TOperable_field& o, TField_event e, long j
case F_NATURA_TRANS:
if (e == fe_modify || e == fe_init)
o.check();
break;
break;
case F_VALUTA:
if (e == fe_modify || e == fe_init)
{
const bool tv = is_true_value(o.get());
if (!tv) o.reset();
TEdit_field& av = efield(F_AMM_VALUTA);
av.check_type(tv ? CHECK_REQUIRED : CHECK_NORMAL);
}
break;
case F_RIEPILOGHI:
if (e == fe_button)
::genera_riepiloghi(tipo(), anno());
@ -114,7 +130,9 @@ protected:
virtual bool get_next_key(TToken_string& k);
virtual void init_query_mode(TMask& m);
virtual void init_insert_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
virtual bool save_and_new() const { return TRUE; };
virtual void check_existent_disk(const TMask& m);
public:
};
@ -158,10 +176,16 @@ bool TRiepiloghi_intra::get_next_key(TToken_string& k)
}
void TRiepiloghi_intra::init_insert_mode(TMask& m)
{
{
check_existent_disk(m);
m.enable(F_VALUTA);
}
void TRiepiloghi_intra::init_modify_mode(TMask& m)
{
check_existent_disk(m);
}
int TRiepiloghi_intra::write(const TMask& m)
{
_rel->curr().put("FREQUENZA", ((TRiepiloghi_mask &) m).frequenza(m.get_int(F_ANNO)));
@ -187,6 +211,28 @@ void TRiepiloghi_intra::init_query_mode(TMask& m)
m.disable(F_VALUTA);
}
void TRiepiloghi_intra::check_existent_disk(const TMask& m)
{
int anno = m.get_int(F_ANNO);
int periodo = 0;
if (m.field(F_PERIODO_M).shown())
periodo = m.get_int(F_PERIODO_M);
else
if (m.field(F_PERIODO_T).shown())
periodo = m.get_int(F_PERIODO_M);
else
if (m.field(F_PERIODO_A).shown())
periodo = m.get_int(F_PERIODO_A);
TString str;
str.format("%4d%02d",anno,periodo);
const TRectype& ird = cache().get("IRD",str);
if (!ird.empty())
warning_box("E' già stato generato il dischetto per il periodo %d dell'anno %d", periodo,anno);
}
int in0600(int argc, char* argv[])
{
TRiepiloghi_intra a;

View File

@ -4,6 +4,11 @@ TOOLBAR "Toolbar" 0 -3 0 3
#include <toolbar.h>
BUTTON F_RIEPILOGHI 28 1
BEGIN
PROMPT -11 -3 "~Generazione Riepiloghi"
END
ENDPAGE
PAGE "Riepiloghi INTRA" -1 -1 78 18
@ -98,11 +103,14 @@ BEGIN
FLAGS "AU"
KEY 1
FIELD ANNO
NUM_EXPR #F_ANNO>=1980
CHECKTYPE REQUIRED
WARNING "Anno non valido"
END
LIST F_TIPO 1 10
BEGIN
PROMPT 49 3 "Tipo riepilogo "
PROMPT 49 3 "Tipo riepilogo "
ITEM "C|Cessioni"
MESSAGE "C",F_TIPO_CF|SHOW,GR_CESSIONI@|HIDE,GR_ACQUISTI@
ITEM "A|Acquisti"
@ -311,7 +319,7 @@ END
STRING F_PAESE 2
BEGIN
PROMPT 22 13 ""
PROMPT 26 13 ""
FLAGS "U"
USE %SCE
INPUT CODTAB F_PAESE
@ -358,6 +366,8 @@ CURRENCY F_AMM_LIRE 18
BEGIN
PROMPT 1 15 "Ammontare "
FIELD AMMLIRE
CHECKTYPE REQUIRED
WARNING "E' necessario inserire l'ammontare"
END
STRING F_VALUTA 3
@ -370,7 +380,7 @@ BEGIN
CHECKTYPE NORMAL
OUTPUT F_VALUTA CODTAB
FIELD CODVAL
FLAGS "UZ"
FLAGS "GUZ"
END
CURRENCY F_AMM_VALUTA 18
@ -378,6 +388,7 @@ BEGIN
PROMPT 59 15 ""
DRIVENBY F_VALUTA
FIELD AMMVALUTA
WARNING "Inserire l'ammontare in valuta"
END
CURRENCY F_VALORE_STAT 18
@ -395,7 +406,7 @@ END
STRING F_UMS 2
BEGIN
PROMPT 41 17 "In unita'supp."
PROMPT 41 17 "Unita' supp. "
FLAGS "DU"
END
@ -404,6 +415,7 @@ BEGIN
PROMPT 59 17 ""
PICTURE ".5"
FIELD MASSAUMS
WARNING "Inserire la massa in unità supplementare"
END
ENDPAGE

View File

@ -1,5 +1,6 @@
#include <relapp.h>
#include <recarray.h>
#include <tabutil.h>
#include "in0.h"
#include "in0700a.h"
@ -14,14 +15,51 @@ class TRettifiche_mask : public TIntra_mask
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
virtual short type_field() const { return F_TIPO; }
void inventa_cambio_intra();
public:
virtual short period_field() const { return F_PERIODO_M; }
virtual int anno() const { return get_int(O_ANNO); }
public:
TRettifiche_mask();
virtual ~TRettifiche_mask() { }
};
};
void TRettifiche_mask::inventa_cambio_intra()
{
const TString& codval = get(F_VALUTA);
if (is_true_value(codval))
{
TTable cam("CAM");
cam.put("CODTAB", codval);
const int err = cam.read(_isgteq);
bool yes = err != NOERR;
if (!yes)
{
TString16 v = cam.get("CODTAB");
v.cut(3).rtrim();
yes = v != codval;
}
if (yes)
{
TCurrency eur; get_currency(F_AMMONTARE, eur);
TCurrency val; get_currency(F_AMM_VALUTA, val);
if (eur.is_zero())
{
val.change_to_firm_val();
set(F_AMMONTARE, val);
}
if (val.is_zero())
{
const real cambio = cache().get("%VAL", codval, "S4");
const TExchange exc(codval, cambio);
eur.change_value(exc);
set(F_AMM_VALUTA, eur);
}
}
}
}
bool TRettifiche_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
@ -67,6 +105,14 @@ bool TRettifiche_mask::on_field_event(TOperable_field& o, TField_event e, long j
}
}
break;
case F_AMMONTARE:
if (e == fe_modify && !o.empty() && field(F_AMM_VALUTA).empty())
inventa_cambio_intra();
break;
case F_AMM_VALUTA:
if (e == fe_modify && !o.empty() && field(F_AMMONTARE).empty())
inventa_cambio_intra();
break;
default:
break;
}
@ -86,7 +132,9 @@ TRettifiche_mask::TRettifiche_mask()
class TRettifiche_intra : public TRelation_application
{
TRelation* _rel;
TMask* _msk;
TRettifiche_mask* _msk;
TToken_string _str; // jolly string
protected:
virtual bool user_create();
@ -94,7 +142,13 @@ protected:
virtual TMask* get_mask(int) { return _msk; }
virtual bool changing_mask(int mode) { return FALSE; }
virtual bool user_destroy();
virtual const char* get_next_key();
virtual void init_query_mode(TMask& m);
virtual void init_insert_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
void init_mask(TMask& m, bool keyon);
public:
};
@ -114,6 +168,57 @@ bool TRettifiche_intra::user_destroy()
return TRUE;
}
void TRettifiche_intra::init_mask(TMask& m, bool keyon)
{
m.enable(O_ANNO, keyon);
m.enable(O_PERIODO_M, keyon);
m.enable(O_PERIODO_T, keyon);
m.enable(O_PERIODO_A, keyon);
m.enable(O_NUM_RIG, keyon);
m.enable(-GR_ORIGINAL, keyon);
}
void TRettifiche_intra::init_query_mode(TMask& m)
{
init_mask(m, FALSE);
}
void TRettifiche_intra::init_insert_mode(TMask& m)
{
init_mask(m, TRUE);
}
void TRettifiche_intra::init_modify_mode(TMask& m)
{
init_mask(m, TRUE);
}
const char* TRettifiche_intra::get_next_key()
{
TRectype& curr = _rel->curr();
curr.put("TIPO", _msk->tipo());
curr.put("ANNO", _msk->anno());
curr.put("PERIODO", _msk->periodo_str());
TCursor cur(_rel, "", 1, &curr, &curr);
const long items = cur.items();
int last_row = 0;
if (items > 0)
{
cur = items-1;
last_row = curr.get_int("NUMRIG");
}
_str.cut(0);
_str.add(F_TIPO);
_str.add(curr.get("TIPO"));
_str.add(F_ANNO);
_str.add(curr.get("ANNO"));
_str.add(F_PERIODO_M);
_str.add(curr.get("PERIODO"));
_str.add(F_NUM_RIG);
_str.add(last_row+1);
return _str;
}
int in0700(int argc, char* argv[])
{
TRettifiche_intra a;

View File

@ -14,7 +14,7 @@
#define O_NATURA_TRANS 121
#define O_NOMENCLATURA1 122
#define O_AMM_LIRE 123
#define O_AMMONTARE 123
#define O_AMM_VALUTA 124
#define O_VALUTA 125
#define O_VALORE_STAT 126
@ -34,7 +34,7 @@
#define F_SEGNO 220
#define F_NATURA_TRANS 221
#define F_NOMENCLATURA1 222
#define F_AMM_LIRE 223
#define F_AMMONTARE 223
#define F_AMM_VALUTA 224
#define F_VALUTA 225
#define F_VALORE_STAT 226

View File

@ -114,7 +114,7 @@ BEGIN
OUTPUT O_NOMENCLATURA1 NOMENCL[1,4]
OUTPUT O_NOMENCLATURA2 NOMENCL[5,6]
OUTPUT O_NOMENCLATURA3 NOMENCL[7,8]
OUTPUT O_AMM_LIRE AMMLIRE
OUTPUT O_AMMONTARE AMMLIRE
OUTPUT O_VALUTA CODVAL
OUTPUT F_VALUTA CODVAL
OUTPUT O_AMM_VALUTA AMMVALUTA
@ -223,9 +223,9 @@ BEGIN
WARNING "Nomenclatura combinata assente"
END
CURRENCY O_AMM_LIRE 18
CURRENCY O_AMMONTARE 18
BEGIN
PROMPT 2 8 "Ammontare in lire "
PROMPT 2 8 "Ammontare "
CHECKTYPE REQUIRED
GROUP GR_ORIGINAL
END
@ -245,10 +245,9 @@ BEGIN
GROUP GR_ORIGINAL
END
NUMBER O_VALORE_STAT 18
CURRENCY O_VALORE_STAT 18
BEGIN
PROMPT 2 9 "Valore statistico "
PICTURE "."
GROUP GR_ORIGINAL
END
@ -403,7 +402,7 @@ BEGIN
OUTPUT F_NOMENCLATURA3 CODTAB[7,8]
VALIDATE REQIF_FUNC 1 F_NOMENCLATURA2
MESSAGE DIRTY,F_NOMENCLATURA3
FIELD NOMENCL
FIELD NOMENCL[1,4]
WARNING "Nomenclatura combinata assente"
END
@ -414,6 +413,7 @@ BEGIN
COPY ALL F_NOMENCLATURA1
VALIDATE REQIF_FUNC 1 F_NOMENCLATURA3
MESSAGE DIRTY,F_NOMENCLATURA3
FIELD NOMENCL[5,6]
WARNING "Nomenclatura combinata assente"
END
@ -423,6 +423,7 @@ BEGIN
FLAGS "Z"
COPY ALL F_NOMENCLATURA1
CHECKTYPE NORMAL
FIELD NOMENCL[7,8]
WARNING "Nomenclatura combinata assente"
END
@ -434,9 +435,9 @@ BEGIN
FIELD SEGNORETT
END
CURRENCY F_AMM_LIRE 18
CURRENCY F_AMMONTARE 18
BEGIN
PROMPT 2 16 "Ammontare in lire "
PROMPT 2 16 "Ammontare "
FIELD AMMLIRE
END

View File

@ -85,7 +85,6 @@ const char* TIntra_mask::periodo_str() const
const char* pe = "01";
if (id != DLG_NULL)
{
// const int anno = get_int(R_ANNO);
switch(frequenza(anno()))
{
case 'M': pe = get(id); break;
@ -191,13 +190,20 @@ void TDati_riepilogo::write(TRectype& rec) const
rec.put("PAESEORIG", paese_orig(str));
rec.put("PROV", provincia(str));
rec.put("AMMLIRE", _ammlire.get_num());
rec.put("AMMVALUTA", _ammvaluta.get_num());
rec.put("CODVAL", _ammvaluta.get_value());
rec.put("AMMLIRE", _ammlire.get_num());
if (_ammvaluta.is_zero())
{
rec.zero("CODVAL"); // Altrimenti genera falsi codici valuta EUR ...
rec.zero("AMMVALUTA"); // ... con importi nulli
}
else
{
rec.put("CODVAL", _ammvaluta.get_value());
rec.put("AMMVALUTA", _ammvaluta.get_num());
}
rec.put("VALSTAT", _valstat);
rec.put("MASSAKG", _massakg);
rec.put("MASSAUMS", _massaums);
}
TDati_riepilogo::TDati_riepilogo(const TDati_riepilogo& r)
@ -209,7 +215,7 @@ TDati_riepilogo::TDati_riepilogo(const TDati_riepilogo& r)
TDati_riepilogo::TDati_riepilogo(const TToken_string& key,
const TRectype& rec,
const TString& codval)
: _key(key), _ammlire(rec.get_real("AMMLIRE"), "_FIRM"),
: _key(key), _ammlire(rec.get_real("AMMLIRE")),
_ammvaluta(rec.get_real("AMMVALUTA"), codval),
_valstat(rec.get_real("VALSTAT")),
_massakg(rec.get_real("MASSAKG")),
@ -240,7 +246,7 @@ void TRiepiloghi::add(const TRectype& rec, const TRectype& mov)
{
TString16 cod;
const char tipocf = mov.get_char("TIPOCF");
cod << tipocf << '|' << mov.get_long("CODCF");
cod << tipocf << '|' << mov.get("CODCF");
const TRectype& clifo = cache().get(LF_CLIFO, cod);
cod = mov.get("CODVAL");
@ -299,7 +305,7 @@ bool TGenerazione_mask::genera_riepiloghi()
int da_mese, a_mese;
const char freq = frequenza(anno_r);
if (is_riepilogo(tipo, anno_r, peri) && !yesno_box("Attenzione esiste gia' il riepilogo\nper il periodo indicato, devo continuare"))
if (is_riepilogo(tipo, anno_r, peri) && !yesno_box("Attenzione esiste gia' il riepilogo\nper il periodo indicato, si desidera continuare"))
return FALSE;
switch (freq)

View File

@ -30,7 +30,7 @@ Item_04 = "Condizioni di consegna", "ba3 -1 %icc", ""
Item_05 = "Modalita' di trasporto", "ba3 -1 %imt", ""
[PRASSIIN_004]
Caption = "Gestione movmenti"
Caption = "Gestione movimenti"
Picture = <ba00.bmp>
Module = 18
Flags = "F"

View File

@ -1,23 +1,26 @@
#ifndef __ALLEG_H
#define __ALLEG_H
#define ALL_ANNO "ANNO"
#define ALL_CODATT "CODATT"
#define ALL_TIPOCF "TIPOCF"
#define ALL_CODCF "CODCF"
#define ALL_IMMESSO "IMMESSO"
#define ALL_IMPESC "IMPESC"
#define ALL_IVAESC "IVAESC"
#define ALL_NIESC "NIESC"
#define ALL_E8ESC "E8ESC"
#define ALL_NDOCESC "NDOCESC"
#define ALL_IMPESP "IMPESP"
#define ALL_IVAESP "IVAESP"
#define ALL_NIESP "NIESP"
#define ALL_E8ESP "E8ESP"
#define ALL_NDOCESP "NDOCESP"
#define ALL_NALLESP "NALLESP"
#define ALL_PROG101102 "PROG101102"
#define ALL_ANNO "ANNO"
#define ALL_CODATT "CODATT"
#define ALL_TIPOCF "TIPOCF"
#define ALL_CODCF "CODCF"
#define ALL_IMMESSO "IMMESSO"
#define ALL_PROG101102 "PROG101102"
#define ALL_IMPESC "IMPESC"
#define ALL_IVAESC "IVAESC"
#define ALL_NIESC "NIESC"
#define ALL_E8ESC "E8ESC"
#define ALL_NDOCESC "NDOCESC"
#define ALL_NALLESC "NALLESC"
#define ALL_IMPESP "IMPESP"
#define ALL_IVAESP "IVAESP"
#define ALL_NIESP "NIESP"
#define ALL_E8ESP "E8ESP"
#define ALL_NDOCESP "NDOCESP"
#define ALL_NALLESP "NALLESP"
#endif

View File

@ -725,9 +725,11 @@ TBaseisamfile::TBaseisamfile(
fatal_box("Non posso creare il file %s : errore n.ro %d", name, err);
}
_lasterr = NOERR;
TFilename filename(name);
TFilename filename(name);
CHECK(filename.not_empty(),"Must define the file to open!");
_logicnum = prefix().get_handle(filename);
_current = new TRectype(this);
_current = new TRectype(this);
}
TBaseisamfile::~TBaseisamfile()
@ -3574,4 +3576,3 @@ TRecnotype TRecfield::ptr() const
r = (r << 8) + *wp;
return n ? -r : r;
}

View File

@ -198,6 +198,8 @@ class TPrint_application : public TApplication
// @cmember:(INTERNAL) Indica se la stampa e' stata interrotta
bool _cancelled;
// @access Protected Member
protected:
// @cmember:(INTERNAL) Setta la stampante
void set_printer()
{ printer().set(); }
@ -228,9 +230,6 @@ class TPrint_application : public TApplication
// @cmember:(INTERNAL) Distrugge la finestra
virtual bool destroy();
// @access Protected Member
protected:
// @cmember Utilizzata per la creazione dei cursori necessari
virtual bool user_create() pure;
// @cmember Utilizzata per la distruzione dei cursori

View File

@ -19,9 +19,7 @@
#define RMV_ROWTYPE "ROWTYPE"
// Centro di costo
#define RMV_CDC "NUMGIO"
// To be removed soon
#define RMV_NUMGIO "NUMGIO"
#define RMV_RCONTR "RCONTR"
#define RMV_CODCMS "CODCMS"
#define RMV_FASCMS "FASCMS"
#endif

View File

@ -21,4 +21,7 @@
#define RMI_TIPOC "TIPOC"
#define RMI_RIGAIMP "RIGAIMP"
#define RMI_RIGAIVA "RIGAIVA"
#define RMI_CODCMS "CODCMS"
#define RMI_FASCMS "FASCMS"
#endif

View File

@ -63,6 +63,37 @@ HIDDEN bool _emptycopy_val(TMask_field& f, KEY)
return TRUE;
}
bool check_pi_estera(const TString& st, const TString& paiva)
{
const char* stpi[] = { "AT09", "BE09", "DE09", "DK08", "EL08", "ES09",
"FI08", "FR11", "GB05", "GB09", "GB12", "IE08",
"LU08", "NL12", "PT09", "SE12", "SM05", NULL };
bool lenok = FALSE;
bool known = FALSE;
for (int g = 0; stpi[g] && !lenok; g++)
{
if (st.compare(stpi[g], 2, TRUE) == 0) // Se lo stato corrisponde
{
known = TRUE;
lenok = paiva.len() == atoi(stpi[g]+2); // Confronto lunghezza
}
else
{
if (known) // Inutile cercare ancora
break;
}
}
if (known)
{
if (st=="AT") // Controllo speciale per l'Austria che comincia per U
lenok &= (paiva[0] == 'U');
}
else
lenok = TRUE; // Gli stati ignoti hanno sempre lunghezza corretta!
return lenok;
}
// @doc EXTERNAL
// @func Controlla se la Partita IVA assume un valore valido
@ -111,22 +142,8 @@ bool pi_check(
}
}
else
{
const char* stpi[] = { "AT09", "BE09", "DE09", "DK08", "EL08", "ES09",
"FI08", "FR11", "GB05", "GB09", "GB12", "IE08",
"IT11", "LU08", "NL12", "PT09", "SE12", NULL };
TString16 test;
test.format("%s%02d", (const char*)stato, pi.len());
ok = FALSE;
for (int g = 0; stpi[g]; g++)
{
ok = (test == stpi[g]);
if (ok)
break;
}
if ((test=="AT09") && (ok))
ok = (pi[0] == 'U');
{
ok = check_pi_estera(stato, pi);
}
return ok;

View File

@ -1075,7 +1075,8 @@ void TArticolo_giacenza::agg_storicoLIFO(const char * annoes, const char * codma
nuovo_storico.sort(sort_storico_rev);
if (giacenza <= ZERO)
giacenza=ZERO;
return;
// giacenza=ZERO;
if (giacenza > rim)
{
qta=giacenza-rim;
@ -1131,8 +1132,6 @@ void TArticolo_giacenza::agg_storicoFIFO(const char * annoes, const char * codma
if (giacenza <= ZERO)
return ;
// if (giacenza <= acq)
// return;
TString nuovoanno;
TEsercizi_contabili ese;

View File

@ -1,3 +1,3 @@
122
0
$agenti|7|8|151|36|Archivio agenti|||
$agenti|0|0|151|0|Archivio agenti|||

View File

@ -48,17 +48,24 @@ bool TFirr_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
}
void TFirr_mask::load_params()
{
{
const bool in_euro = is_euro_value(NULL);
TConfig cfg(CONFIG_STUDIO, "pr");
set(F_PREVID, cfg.get("Previdenza", NULL, -1, "5.75"));
set(F_ASSIST, cfg.get("Assistenza", NULL, -1, "2.00"));
set(F_PREV_MIN, cfg.get("PrevMin", NULL, -1, "120000"));
set(F_PREV_MAX, cfg.get("PrevMax", NULL, -1, "4830000"));
set(F_PREV_MIN, cfg.get("PrevMin", NULL, -1, in_euro ? "248" : "480000"));
set(F_PREV_MAX, cfg.get("PrevMax", NULL, -1, in_euro ? "2494" : "4830000"));
for (int i = 0; i < 3; i++)
{
set(F_FIRR_1+i, cfg.get_int("Firr", NULL, i, i+1));
const char* def = (i == 0) ? "24000000" : "36000000";
const char* def;
if (i == 0)
def = in_euro ? "12395" : "24000000";
else
def = in_euro ? "18592" : "36000000";
set(F_LIMITE_1+i, cfg.get("FirrLimit", NULL, i, def));
}
}

View File

@ -77,18 +77,14 @@ BEGIN
FLAGS "U"
END
NUMBER F_PREV_MIN 15
CURRENCY F_PREV_MIN 15
BEGIN
PROMPT 22 1 "Min."
PICTURE "."
FLAGS "U"
END
NUMBER F_PREV_MAX 15
CURRENCY F_PREV_MAX 15
BEGIN
PROMPT 22 2 "Max."
PICTURE "."
FLAGS "U"
END
GROUPBOX DLG_NULL 42 5
@ -103,11 +99,9 @@ BEGIN
FLAGS "U"
END
NUMBER F_LIMITE_1 15
CURRENCY F_LIMITE_1 15
BEGIN
PROMPT 18 5 "Fino a "
PICTURE "."
FLAGS "U"
END
NUMBER F_FIRR_2 5 2
@ -117,11 +111,9 @@ BEGIN
FLAGS "U"
END
NUMBER F_LIMITE_2 15
CURRENCY F_LIMITE_2 15
BEGIN
PROMPT 18 6 "Fino a "
PICTURE "."
FLAGS "U"
NUM_EXPR #F_LIMITE_2>=#F_LIMITE_1
MESSAGE COPY,F_LIMITE_3
END
@ -133,11 +125,10 @@ BEGIN
FLAGS "U"
END
NUMBER F_LIMITE_3 15
CURRENCY F_LIMITE_3 15
BEGIN
PROMPT 18 7 "Oltre "
PICTURE "."
FLAGS "DU"
FLAGS "D"
END
BUTTON DLG_SAVEREC 10 2

View File

@ -52,7 +52,6 @@ protected:
int find_magic(TString& s, TString& magic1, TString& magic2) const;
void change_magic_body(const TEC_row& o, TString& s);
void change_magic_footer(const THash_object& o, TString& s);
// void modify_picture(TForm_item& fi, TString_array& op, const bool in_valuta);
void print_total(int riga, const THash_object& o);
void stampa_testata(TPrinter& p);
@ -811,42 +810,6 @@ void TEC_form::change_magic_footer(const THash_object& o, TString& s)
}
}
/*
void TEC_form::modify_picture(TForm_item& fi, TString_array& op, const bool in_valuta)
{
TString pic(20);
pic = fi.picture();
op.add(pic);
const int w = fi.width();
if (in_valuta && _in_valuta)
{
if (pic.find(',') > 0)
pic << ".###";
else
pic << ",@@@";
int exceed = w - pic.len();
if (exceed<0 && w>0)
{
exceed=::abs(exceed);
pic = pic.mid(exceed,pic.len()-exceed);
}
}
// oltre a cio' deve correggere la picture, in modo che tutti gli importi del
// footer risultino incolonnati correttamente.
// (nel body cio' e' fatto in TForm_number::put_paragraph())
const int l = pic.len();
if (w>l)
{
int gap = w-l;
TString stmp(gap); // cosi' mette gli spazi necessari davanti alla picture
stmp.fill(' '); // in modo da colmare il vuoto
pic.insert(stmp);
}
fi.set_picture(pic);
}
*/
void TEC_form::print_total(int riga, const THash_object& o)
{
const short MAXID = 4;
@ -1359,18 +1322,16 @@ long TStampaEC_application::find_agents_games(TAssoc_array& agents)
const TString& toage = mask().get(F_TO_AGENT);
TRelation rel(LF_SCADENZE);
TRectype& curr = rel.curr();
curr.put(SCAD_TIPOCF, mask().get(SC_CLIFO));
TString filter;
filter << "(CODAG!=\"\")";
if (!mask().get_bool(F_STAMPCHIU))
filter << "&&(PAGATA==\"\")";
if (fromage.not_empty())
filter << "&&(CODAG>=\"" << fromage << "\")";
if (toage.not_empty())
filter << "&&(CODAG<=\"" << toage << "\")";
rel.add(LF_PAGSCA, "TIPOC==TIPOC|GRUPPO==GRUPPO|CONTO==CONTO|SOTTOCONTO==SOTTOCONTO|"
"ANNO==ANNO|NUMPART==NUMPART|NRIGA==NRIGA|NRATA==NRATA");
TRectype& curr = rel.curr();
const TRectype& pagsca = rel.curr(LF_PAGSCA);
curr.put(SCAD_TIPOCF, mask().get(SC_CLIFO));
TString filter;
if (!mask().get_bool(F_STAMPCHIU))
filter << "(PAGATA==\"\")";
TCursor cur(&rel, filter, 1, &curr, &curr);
const long items = cur.items();
cur.freeze();
@ -1382,7 +1343,18 @@ long TStampaEC_application::find_agents_games(TAssoc_array& agents)
if (pi.iscancelled())
break;
const TString& codag = curr.get(SCAD_CODAG);
const char* codag = pagsca.get(PAGSCA_CODAG);
if (*codag == '\0')
{
codag = curr.get(SCAD_CODAG);
if (*codag == '\0')
continue;
}
if (fromage.not_empty() && fromage > codag)
continue;
if (toage.not_empty() && toage < codag)
continue;
TEC_Game_list* games = (TEC_Game_list*)agents.objptr(codag);
if (games == NULL)
{

View File

@ -33,7 +33,7 @@ struct _LinearTotal : public TObject // Oggetto base per gli elementi di tlg, t
};
enum tipo_st {nessuno=0, tutti=1, clienti=2, fornitori=3, altri=4};
enum tipo_pe {daily, monthly, period, single};
enum tipo_pe {daily, monthly, period, single, bank};
const char * tipi_tab[10] = {"Altro","Rimesse dirette","Tratte","Ricevute bancarie","Cessioni","Paghero'",
"Lettere di acc.","Tratte accettate","Rapp. interb. dir.","Bonifici"} ;
@ -67,13 +67,16 @@ class TStampaScadenzario : public TPrintapp
_ordcod, // VERO=ordine per codice, FALSO=ordine per ragione sociale
_striepilogo, // VERO=stampa il riepilogo mensile per pagamento
_stvaluta, // Vero se abilitata la stampa in valuta;
_group_ban; // Vero se abilitato il raggruppamento per banca
_group_ban, // Vero se abilitato il raggruppamento per banca
_totbank_printed; // vero se é stato stampato il totale per banca
// Se _tipost=tutti non e' possibile impostare l'ordine primario per
// ragione sociale o descrizione. L'unico tipo stampa possibile e' quello
// in ordine di data scadenza
// Se _tipost=altri scorre il piano dei conti.
// Se _tipost=clienti || fornitori scorre clifo.
TString16 _codag; // codice agente selezionato
int _tipopag; // tipo pagamento selezionato
TRecnotype _last_bank_rec; // ultimo record con banca stampato
real _w_imp_pag, _w_imp_res; // Qui dentro memorizza i valori calcolati in calcola_pagamenti,
// rispettivamente l'importo pagato e l'importo residuo, relativo alla rata.
TAssoc_array _tm, _tp; // Dentro a codesti array vi sono i totali per la stampa prospetti:
@ -120,6 +123,9 @@ public:
//ended indica il raggiungimento di fine periodo.
// La seguente funzione serve per il riepilogo dei totali nel caso l'ordinamento principale non sia per data.
void print_totali_c(int &nriga, bool ended); // ended indica di stampare anche il riepilogo del periodo
void print_totali_bank(int &nriga);
// Funzioni per calcolo dei pagamenti e di aggiornamento totali
void check_add_key_to_tp(int t, char u); // controlla e aggiunge i valori relativi alla chiave k ai totali del prospetto
void check_add_key_to_tl(tipo_pe p, int t); // controlla e aggiunge i valori elaborati all'assoc array indicato dal periodo (_tlxxx)
@ -134,6 +140,8 @@ public:
void calcola_pagamenti(real& imp_scad, int riga, int rata, TBill& bill); // calcola i pagamenti effettuati per questa rata e il residuo eventuale
TLocalisamfile& pagamenti() const { return *_pagsca; }
void print_intestazione_banca(int &nriga);
TStampaScadenzario();
};
@ -144,7 +152,7 @@ inline TStampaScadenzario& app() {return (TStampaScadenzario&)main_app();}
class TScadenza_rec : public TRectype
{
TString16 _codice;
TString _codice;
protected:
virtual const TString& get_str(const char* fieldname) const;
@ -155,7 +163,8 @@ public:
const TString& TScadenza_rec::get_str(const char* fieldname) const
{
if (strcmp(fieldname, SCAD_CODABIPR) == 0 || strcmp(fieldname, SCAD_CODCABPR) == 0)
if (strcmp(fieldname, SCAD_CODABIPR) == 0 || strcmp(fieldname, SCAD_CODCABPR) == 0 ||
strcmp(fieldname, SCAD_CODAG) == 0)
{
TRectype rec(LF_PAGSCA);
rec.put(PAGSCA_TIPOC, TRectype::get_str(SCAD_TIPOCF));
@ -175,16 +184,18 @@ const TString& TScadenza_rec::get_str(const char* fieldname) const
curpag = rec;
const int err = pagamenti.read(_isgteq);
found = (err == NOERR) && (curpag.compare_key(rec,1,1) == 0);
}
}
long cod = atol(TRectype::get_str(fieldname)); // Valore di default sulla scadenza
TString& cod = ((TScadenza_rec*)this)->_codice; // Fool the compiler
cod = TRectype::get_str(fieldname); // Valore di default sulla scadenza
if (found)
{
const long val = curpag.get_long(fieldname);
if (val > 0)
const TString& val = curpag.get(fieldname);
if (val.not_empty())
cod = val; // Valore presente sul pagamento effettivo
}
((TScadenza_rec*)this)->_codice.format("%05ld", cod);
}
if (strcmp(fieldname, SCAD_CODABIPR) == 0 || strcmp(fieldname, SCAD_CODCABPR) == 0)
cod.format("%05ld", atol(_codice)); // riformatta codice banca
return _codice;
}
return TRectype::get_str(fieldname);
@ -236,6 +247,20 @@ bool TStampaScadenzario::filter_func(const TRelation *r)
}
}
}
if (app()._codag.not_empty())
{
const TRectype& rec = r->curr();
const TString16 codag = rec.get(SCAD_CODAG);
if (app()._codag != codag)
return FALSE;
}
if (app()._tipopag != 0)
{
const TRectype& rec = r->curr();
const int tipopag = rec.get_int(SCAD_TIPOPAG);
if (app()._tipopag != tipopag)
return FALSE;
}
return TRUE;
}
@ -254,6 +279,9 @@ void TStampaScadenzario::check_add_key_to_tl(tipo_pe p, int t)
case period:
index = 2;
break;
case bank:
index = 3;
break;
default: // Se p == daily e' gia settato di default (vedi sopra)
break;
}
@ -650,11 +678,19 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
TAssoc_array& tlm = (TAssoc_array&) _tl[1];
tlm.destroy();
}
if (_group_ban && _totbank_printed)
{
TAssoc_array& tlb = (TAssoc_array&) _tl[3];
tlb.destroy();
_totbank_printed = FALSE;
}
}
// Tiene aggiornati tutti i totali mese/giorno/periodo (Totali lineari per valuta)
check_add_key_to_tl(daily, tipo_pag);
check_add_key_to_tl(monthly, tipo_pag);
check_add_key_to_tl(period, tipo_pag);
if (_group_ban)
check_add_key_to_tl(bank, tipo_pag); // totali per banca
// Tiene aggiornati tutti i totali mese/periodo (Totali dei prospetti
check_add_key_to_tp(tipo_pag, ult_cla);
_cur_data = datascad;
@ -702,6 +738,14 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
_cur_codcf_s = "";
changed = FALSE;
}
if (_group_ban && _totbank_printed)
{
TAssoc_array& tlb = (TAssoc_array&) _tl[3];
tlb.destroy();
_totbank_printed = FALSE;
}
if (changed)
{
_cur_gr_s.format("%3d",gruppo);
@ -714,7 +758,9 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
// Tiene aggiornati i totali per cli/fo/conto e periodo (Totali lineari per valuta)
check_add_key_to_tl(single, tipo_pag);
check_add_key_to_tl(period, tipo_pag);
// Tiene aggiornati i totali per cli/fo/conto e periodo (Totali per i prospetti)
if (_group_ban)
check_add_key_to_tl(bank, tipo_pag); // totali per banca
// Tiene aggiornati i totali per cli/fo/conto e periodo (Totali per i prospetti)
check_add_key_to_tp(tipo_pag, ult_cla);
}
// Qui stampa il totale generale e lo schema riepilogativo.
@ -729,7 +775,7 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
// per tutti e' obbligatorio l'ordinamento principale per data.
print_totali_c(n,TRUE);
}
return TRUE;
}
@ -803,7 +849,7 @@ bool TStampaScadenzario::user_create()
_ragsoc = new TParagraph_string("",17);
_des_conto = new TParagraph_string("",17);
_tl.add(new TAssoc_array);_tl.add(new TAssoc_array);_tl.add(new TAssoc_array);
_tl.add(new TAssoc_array);_tl.add(new TAssoc_array);_tl.add(new TAssoc_array);_tl.add(new TAssoc_array);
_uns_cache.add(new TAssoc_array); // Pagamenti
_uns_cache.add(new TAssoc_array); // Note di credito
_uns_cache.add(new TAssoc_array); // Insoluti
@ -855,10 +901,15 @@ bool TStampaScadenzario::user_destroy()
bool TStampaScadenzario::set_print(int)
{
_m->reset(F_SORTBAN);
_m->reset(F_CODAG);
_m->reset(F_TIPOPAG);
const bool ok = _m->run() == K_ENTER;
if (ok)
{
{
_last_bank_rec = 0;
_end_printed = FALSE;
_totbank_printed = FALSE;
reset_files();
reset_print();
// Inizializza i membri necessari al calcolo totali nel caso sia stato scelto l'ordine
@ -868,6 +919,8 @@ bool TStampaScadenzario::set_print(int)
else _tipost = fornitori;
_ordcod = _m->get_key() == 1; // Stampa ordinata per codice?
_group_ban = _m->get_bool(F_SORTBAN); // Raggruppamento per banca di presentazione
_codag = _m->get(F_CODAG); // codice agente selezionato
_tipopag = _m->get_int(F_TIPOPAG); // tipo pagamento selezionato
_cur_data = botime;
_tm.destroy(); _tp.destroy(); // Totali per i prospetti
for (int it=0; it < _tl.items(); it++)
@ -1080,9 +1133,15 @@ void TStampaScadenzario::print_header()
s1 =""; s2 = "";
}
set_header (soh++,"@64gPer il periodo dal %s al %s",(const char*)datai,(const char*)dataf);
if (_group_ban)
set_header(soh++, "@bBANCA DI PRESENTAZIONE %s@r", (const char*)_desc_ban);
if (_codag.not_empty())
set_header (soh++,"@bAgente: %s %s@r",(const char*)_codag,(const char*)_m->get(F_CODAG_D));
if (_tipopag != 0)
{
TList_field& fld_tipopag = (TList_field&) _m->field(F_TIPOPAG);
TToken_string& pagam = (TToken_string) fld_tipopag.get_values();
set_header (soh++,"@bTipo pagamento: %d %s@r",_tipopag, (const char*)pagam.get(_tipopag));
}
rw.fill('_');
set_header(soh++, (const char *) rw);
@ -1101,6 +1160,16 @@ void TStampaScadenzario::print_header()
firm, (const char *)s, (const char *)data);
set_header(soh++,"@79g** SCADENZARIO **");
set_header (soh++,"@66gPer il periodo dal %s al %s",(const char*)datai,(const char*)dataf);
if (_codag.not_empty())
set_header (soh++,"@bAgente: %s %s@r",(const char*)_codag,(const char*)_m->get(F_CODAG_D));
if (_tipopag != 0)
{
TList_field& fld_tipopag = (TList_field&) _m->field(F_TIPOPAG);
TToken_string& pagam = (TToken_string) fld_tipopag.get_values();
set_header (soh++,"@bTipo pagamento: %d %s@r",_tipopag, (const char*)pagam.get(_tipopag));
}
rw.fill('_');
set_header(soh++, (const char *) rw);
set_header(soh++,"@33gRif.@43gData@53gData@82gCd/Tp");
@ -1122,6 +1191,8 @@ void TStampaScadenzario::print_header()
void TStampaScadenzario::set_page_clifo(int nriga)
// Setta le righe per stampare le scadenze clienti/fornitori
{
if (_group_ban)
print_intestazione_banca(nriga);
set_row(nriga++,"");
set_row(nriga,"@b#6t@r",&_cur_codcf_s);
set_row(nriga,"@b@9g#a@r",_ragsoc);
@ -1148,6 +1219,8 @@ void TStampaScadenzario::set_page_clifo(int nriga)
void TStampaScadenzario::set_page_pcon(int nriga)
// Setta le righe per stampare le scadenze degli altri conti.
{
if (_group_ban)
print_intestazione_banca(nriga);
set_row(nriga++,"");
set_row(nriga,"@b#3t@5g#3t@9g#6t@r",&_cur_gr_s,&_cur_co_s,&_cur_codcf_s);
set_row(nriga,"@b@16g#a@r",_des_conto);
@ -1167,30 +1240,6 @@ void TStampaScadenzario::set_page_pcon(int nriga)
void TStampaScadenzario::set_page(int file, int counter)
{
// Prepara descrizione banca
if (file == LF_SCADENZE && _group_ban)
{
const TRectype &rc = current_cursor()->curr(LF_SCADENZE);
const TString8 abi = rc.get(SCAD_CODABIPR);
const TString8 cab = rc.get(SCAD_CODCABPR);
TString16 curr_ban; curr_ban << abi << cab;
if (curr_ban != _last_ban)
{
_last_ban = curr_ban;
if (abi != "00000")
{
_desc_ban.cut(0) << abi << ' ' << cab;
_desc_ban << ' ' << cache().get("%BAN", abi, "S0");
if (cab > 0)
_desc_ban << " - " << cache().get("%BAN", _last_ban, "S0");
}
else
_desc_ban = "NON INDICATA";
if (printer().current_row() > 1)
printer().formfeed();
}
}
print_header();
switch (_tipost)
@ -1202,7 +1251,7 @@ void TStampaScadenzario::set_page(int file, int counter)
break;
case altri:
if (file == LF_PCON)
set_page_pcon(1);
set_page_pcon(1);
break;
default:
break;
@ -1318,6 +1367,9 @@ void TStampaScadenzario::print_rows_totali(int &nriga, tipo_pe p)
case period:
index = 2;
break;
case bank:
index = 3;
break;
default:
break;
}
@ -1370,9 +1422,6 @@ void TStampaScadenzario::print_totali(int &nriga, bool month_changed, bool ended
// Setta le righe per stampare i totali (giorno e mese) delle scadenze clienti/fornitori
// Ordinamento primario per data!
{
if (_group_ban)
return;
set_row(nriga,"@36g** TOTALI DEL @51g%s",_cur_data.string(brief));
print_rows_totali(nriga, daily);
if (month_changed)
@ -1383,6 +1432,11 @@ void TStampaScadenzario::print_totali(int &nriga, bool month_changed, bool ended
}
if (ended)
{
if (_group_ban)
{
print_totali_bank(nriga);
set_row(nriga++,"");
}
set_row(nriga++,"");
set_row(nriga,"@36g** TOTALI PERIODO");
print_rows_totali(nriga, period);
@ -1396,9 +1450,6 @@ void TStampaScadenzario::print_totali_c(int &nriga, bool ended)
// Setta le righe per stampare i totali delle scadenze clienti/fornitori/conti
// Ordinamento primario per codice o ragione sociale!
{
if (_group_ban)
return;
if (_tipost==clienti)
set_row(nriga,"@70g** TOTALE CLIENTE");
else
@ -1410,6 +1461,11 @@ void TStampaScadenzario::print_totali_c(int &nriga, bool ended)
if (_striepilogo) print_riepilogo(nriga,FALSE);
if (ended)
{
if (_group_ban)
{
print_totali_bank(nriga);
set_row(nriga++,"");set_row(nriga++,"");
}
set_row(nriga,"@70g** TOTALE GENERALE");
print_rows_totali(nriga, period);
if (_striepilogo) print_riepilogo(nriga,TRUE);
@ -1418,6 +1474,59 @@ void TStampaScadenzario::print_totali_c(int &nriga, bool ended)
}
}
void TStampaScadenzario::print_totali_bank(int &nriga)
// Setta le righe per stampare i totali della banca
// Ordinamento primario per codice o ragione sociale!
{
set_row(nriga++, "");
if (_ordata)
set_row(nriga,"@36g** TOTALI BANCA");
else
set_row(nriga,"@70g** TOTALE BANCA");
print_rows_totali(nriga, bank);
_totbank_printed = TRUE;
}
void TStampaScadenzario::print_intestazione_banca(int &nriga)
{
const TRectype &rc = current_cursor()->curr(LF_SCADENZE);
const TString8 abi = rc.get(SCAD_CODABIPR);
const TString8 cab = rc.get(SCAD_CODCABPR);
TString16 curr_ban; curr_ban << abi << cab;
bool print_bank = FALSE;
if (curr_ban != _last_ban)
{
_last_ban = curr_ban;
if (abi != "00000")
{
_desc_ban.cut(0) << abi << ' ' << cab;
_desc_ban << ' ' << cache().get("%BAN", abi, "S0");
if (cab > 0)
_desc_ban << " - " << cache().get("%BAN", _last_ban, "S0");
}
else
_desc_ban = "NON INDICATA";
_last_bank_rec = current_cursor()->pos();
print_bank = TRUE;
}
else
{
print_bank = current_cursor()->pos() == _last_bank_rec;
}
if (print_bank)
{
// stampa totali banca precedente
if (_last_bank_rec != 0)
print_totali_bank(nriga);
set_row(nriga++, "");
set_row(nriga++, "@bBANCA DI PRESENTAZIONE %s@r", (const char*)_desc_ban);
set_row(nriga++, "");
}
}
TStampaScadenzario::TStampaScadenzario()
{
_rel1=_rel2=_rel3=NULL;

View File

@ -16,3 +16,6 @@
#define F_TOABI 114
#define F_TOCAB 115
#define F_TOBAN 116
#define F_CODAG 117
#define F_CODAG_D 118
#define F_TIPOPAG 119

View File

@ -209,8 +209,8 @@ END
BOOLEAN F_SORTBAN
BEGIN
PROMPT 2 16 "Raggruppamento per banca di presentazione"
MESSAGE FALSE HIDE,7@
MESSAGE TRUE SHOW,7@
MESSAGE FALSE HIDE,7@|RESET,7@
MESSAGE TRUE SHOW,7@|RESET,7@
END
NUMBER F_FROMABI 5
@ -289,5 +289,47 @@ BEGIN
GROUP 7
END
STRING F_CODAG 5
BEGIN
PROMPT 2 19 "Agente "
FLAGS "ZU"
USE LF_AGENTI
INPUT CODAGE F_CODAG
DISPLAY "Codice agente" CODAGE
DISPLAY "Ragione Sociale@50" RAGSOC
OUTPUT F_CODAG CODAGE
OUTPUT F_CODAG_D RAGSOC
CHECKTYPE NORMAL
END
STRING F_CODAG_D 50
BEGIN
PROMPT 18 19 ""
USE LF_AGENTI KEY 2
INPUT RAGSOC F_CODAG_D
DISPLAY "Ragione Sociale@50" RAGSOC
DISPLAY "Codice agente" CODAGE
COPY OUTPUT F_CODAG
CHECKTYPE NORMAL
END
LIST F_TIPOPAG 1 33
BEGIN
PROMPT 2 20 "Tipo pagamento "
ITEM "0|Tutti"
ITEM "1|Rimessa Diretta"
ITEM "2|Tratta"
ITEM "3|Ricevuta Bancaria"
ITEM "4|Cessione"
ITEM "5|Paghero'"
ITEM "6|Lettera di credito"
ITEM "7|Tratta accettata"
ITEM "8|Rapporti interbancari diretti"
ITEM "9|Bonifico"
END
ENDPAGE
ENDMASK

View File

@ -117,16 +117,15 @@ int TStampaSol_application::print_sol()
const TDate data_limite_soll(f.data_limite_operazione());
const TDate data_limite_scad(f.data_limite_scaduto());
if (sel_tot_saldo)
if (sel_tot_saldo && sel_importo > ZERO)
{
real saldo;
for (int err = partite.read(_isgteq);
err == NOERR && partite.curr() == filter;
err = partite.read(_isgreat))
{
TPartita game(partite.curr());
saldo += game.calcola_scaduto_al(FALSE, data_limite_scad);
saldo += game.calcola_scaduto_al(FALSE, data_limite_soll); // Era data_limite_scad!
partite.put(PART_NRIGA, 9999);
}
if (saldo < sel_importo)

View File

@ -14,9 +14,10 @@
#include "sc2500.h"
#include <clifo.h>
#include <rmov.h>
#include <nditte.h>
#include <partite.h>
#include <pconti.h>
#include <rmov.h>
///////////////////////////////////////////////////////////
// Maschera principale
@ -201,7 +202,22 @@ void TConfronta_mask::fill_browse()
TBrowsefile_field& b = (TBrowsefile_field&)field(F_PREVIEW);
TViswin& w = b.vis_win();
w.destroy_lines();
b.add_line("@b STAMPA CONTROLLO SALDI");
//crea la nuova intestazione
TString intestazione;
TString ragsoc(50);
TLocalisamfile nditte(LF_NDITTE);
nditte.zero();
nditte.put(NDT_CODDITTA, main_app().get_firm());
if (nditte.read() == NOERR)
ragsoc = nditte.get(NDT_RAGSOC);
intestazione << "@bDitta " << main_app().get_firm();
intestazione << " " << ragsoc;
intestazione.rpad(97);
TDate oggi(TODAY);
intestazione << oggi;
b.add_line(intestazione);
b.add_line("@bSTAMPA CONTROLLO SALDI");
b.add_line("@b_________________________________________________________________________________________________________");
b.add_line("");
b.add_line("@bGrp Cnt Sottoc Descrizione Saldo Contabile Saldo Partite Sbilancio");
@ -321,12 +337,18 @@ bool TConfronta_mask::on_field_event(TOperable_field& f, TField_event e, long jo
{
case DLG_ELABORA:
if (e == fe_button)
{
disable(-4);
{
// disabilito campi di selezione e bottone elabora
disable(-4);
field(DLG_PRINT).set_focus();
// sostituisco elabora con annulla
hide(DLG_ELABORA); show(F_CANCEL);
fill_browse();
// elaborazione
fill_browse();
// sostituisco annulla con elabora
hide(F_CANCEL); show(DLG_ELABORA);
enable(-4);
// abilito bottone stampa
enable(-6);
}
break;
case F_CANCEL:
@ -342,6 +364,20 @@ bool TConfronta_mask::on_field_event(TOperable_field& f, TField_event e, long jo
f.print();
}
break;
case F_AZZERA:
if (e == fe_button)
{
// azzero il campo risultato della stampa
TBrowsefile_field& b = (TBrowsefile_field&)field(F_PREVIEW);
TViswin& w = b.vis_win();
w.destroy_lines();
w.goto_top();
// disabilito bottone stampa
disable(-6);
// abilito campi di selezione e bottone elabora
enable(-4);
}
break;
default:
break;
}
@ -370,9 +406,10 @@ void TConfronta_saldi::main_loop()
while (m.run() != K_QUIT);
}
int sc2500(int argc, char** argv)
int sc2500(int argc, char** argv)
{
TConfronta_saldi app;
app.run(argc, argv, "Controllo saldi");
app.run(argc, argv, "Stampa controllo saldi");
return 0;
}

View File

@ -6,7 +6,7 @@ BUTTON DLG_ELABORA 10 2
BEGIN
PROMPT -13 -11 "~Elabora"
PICTURE BMP_ELABORA
GROUP 4
GROUP 4
END
BUTTON F_CANCEL 10 2
@ -21,18 +21,17 @@ BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -23 -11 ""
FLAGS "D"
GROUP 4
GROUP 6
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -33 -11 ""
GROUP 4
END
ENDPAGE
PAGE "Confronto saldi" -1 -1 78 20
PAGE "Controllo saldi" -1 -1 78 20
GROUPBOX DLG_NULL 78 4
BEGIN
@ -42,36 +41,45 @@ END
LIST F_TIPOC 1 10
BEGIN
PROMPT 2 1 "Tipo conto "
ITEM " |Conto"
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@|COPY,F_ATIPOC
ITEM "C|Cliente"
MESSAGE SHOW,2@|HIDE,1@|HIDE,3@|COPY,F_ATIPOC
ITEM "F|Fornitore"
MESSAGE SHOW,3@|HIDE,1@|HIDE,2@|COPY,F_ATIPOC
ITEM " |Conto"
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@|COPY,F_ATIPOC
GROUP 4
GROUP 4 5
END
NUMBER F_GRUPPO 3
BEGIN
PROMPT 30 1 "Gruppo "
USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO=="")
USE LF_PCON SELECT (CONTO=="")&&(SOTTOCONTO=="")
INPUT GRUPPO F_GRUPPO
INPUT CONTO F_CONTO
//INPUT CONTO F_CONTO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Tipo" TMCF
//DISPLAY "Conto" CONTO
//DISPLAY "Tipo" TMCF
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPO GRUPPO
OUTPUT F_CONTO CONTO
OUTPUT F_TIPOC TMCF
//OUTPUT F_CONTO CONTO
//OUTPUT F_TIPOC TMCF
CHECKTYPE SEARCH
GROUP 4 5
GROUP 4 5
END
NUMBER F_CONTO 3
BEGIN
PROMPT 46 1 "Conto "
COPY ALL F_GRUPPO
USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO=="")
INPUT GRUPPO F_GRUPPO
INPUT CONTO F_CONTO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Tipo" TMCF
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPO GRUPPO
OUTPUT F_CONTO CONTO
OUTPUT F_TIPOC TMCF
CHECKTYPE SEARCH
GROUP 4 5
END
@ -86,7 +94,8 @@ BEGIN
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Descrizione@50" DESCR
COPY OUTPUT F_CONTO
OUTPUT F_GRUPPO GRUPPO
OUTPUT F_CONTO CONTO
OUTPUT F_SOTTOCONTO SOTTOCONTO
OUTPUT F_CON_DESCR DESCR
CHECKTYPE SEARCH
@ -128,7 +137,7 @@ BEGIN
USE LF_CLIFO KEY 2
INPUT TIPOCF "C"
INPUT RAGSOC F_CLI_DESCR
DISPLAY "Ragione Sociale@50" RAGSOC
DISPLAY "Ragione Sociale@60" RAGSOC
DISPLAY "Codice" CODCF
COPY OUTPUT F_CLIENTE
CHECKTYPE SEARCH
@ -181,10 +190,10 @@ BEGIN
PROMPT 30 5 "Gruppo "
COPY USE F_GRUPPO
INPUT GRUPPO F_AGRUPPO
INPUT CONTO F_ACONTO
//INPUT CONTO F_ACONTO
COPY DISPLAY F_GRUPPO
OUTPUT F_AGRUPPO GRUPPO
OUTPUT F_ACONTO CONTO
//OUTPUT F_ACONTO CONTO
CHECKTYPE SEARCH
GROUP 1 4 5
END
@ -192,7 +201,12 @@ END
NUMBER F_ACONTO 3
BEGIN
PROMPT 46 5 "Conto "
COPY ALL F_AGRUPPO
COPY USE F_CONTO
INPUT GRUPPO F_AGRUPPO
INPUT CONTO F_ACONTO
COPY DISPLAY F_CONTO
OUTPUT F_AGRUPPO GRUPPO
OUTPUT F_ACONTO CONTO
CHECKTYPE SEARCH
GROUP 1 4 5
END
@ -201,9 +215,11 @@ NUMBER F_ASOTTOCONTO 6
BEGIN
PROMPT 2 6 "Sottoconto "
COPY USE F_SOTTOCONTO
COPY INPUT F_ACONTO
INPUT SOTTOCONTO F_ASOTTOCONTO
COPY DISPLAY F_SOTTOCONTO
COPY OUTPUT F_ACONTO
OUTPUT F_AGRUPPO GRUPPO
OUTPUT F_ACONTO CONTO
OUTPUT F_ASOTTOCONTO SOTTOCONTO
OUTPUT F_ACON_DESCR DESCR
CHECKTYPE SEARCH
@ -282,12 +298,13 @@ END
BUTTON F_AZZERA 17 1
BEGIN
PROMPT 60 8 "~Azzera selezioni"
MESSAGE RESET,5@
MESSAGE RESET,5@
END
BROWSEFILE F_PREVIEW 0 -1
BEGIN
PROMPT 0 9 ""
PROMPT 0 9 ""
GROUP 5
END
ENDPAGE

View File

@ -168,6 +168,7 @@ BEGIN
ITEM "NUMERO|Numero"
ITEM "DATA|Data"
ITEM "LISTA|Lista"
ITEM "VALUTA|Valuta"
ITEM "GRUPPO|Gruppo"
ITEM "LINEA|Linea"
ITEM "BOX|Box"

View File

@ -15,6 +15,6 @@ Caption = "Servizio"
Picture = <sc01.bmp>
Module = 13
Flags = ""
Item_01 = "Stampa di controllo saldi", "sc2 -4", ""
Item_01 = "Stampa controllo saldi", "sc2 -4", ""
Item_02 = "Creazione saldaconto da saldi", "sc1 -1", ""

View File

@ -650,8 +650,8 @@ bool TStampa_schede::fill_rdoc(TRectype& tab, const TRiga_documento& rdoc, const
tab.put("S1", descr);
const bool is_nota_credito = doc.tipo().nota_credito();
real ins = rdoc.importo(TRUE, FALSE, 0);
real ils = rdoc.importo(TRUE, TRUE, 0);
real ins = rdoc.importo(TRUE, FALSE);
real ils = rdoc.importo(TRUE, TRUE);
if (is_nota_credito)
{

View File

@ -1286,7 +1286,8 @@ int TStampa_stat::handle_levchange(int row, const int level)
set_filled_row('R',++row,'_',POS_PRIMACOL,_largcol * _numcol );
partkey_name(rec_grp1.get(SVS_LEVCODE), numlevels() - _last_lev_grp - 1, _wrk_row);
_wrk_row.insert("@Totale ", 0);
_wrk_row.insert("@bTotale ", 0);
_wrk_row << ' ' << rec_grp1.get(SVS_CODICE).mid(lencode);
_wrk_row << ' ' << rec_grp1.get(SVS_DESCR).left(23);
//_wrk_row.cut(LARG_COLCODICE); there are also @ chars!
@ -1955,7 +1956,7 @@ void TStampa_stat::genera_file(const char *outfn)
const int yearfin = datafin.year();
const int periofin = _stats.date2period(datafin);
TProgind statusbar(date2long(datafin,_stats.frequency())-start_status,
TProgind statusbar(period2long(datafin.year(), periofin,_stats.frequency())-start_status,
"Creazione del file di output", FALSE, TRUE, 60);
int err = riep.read(_isgteq);
@ -2019,7 +2020,7 @@ void TStampa_stat::genera_file(const char *outfn)
}
} // filtro
} // ciclo
statusbar.setstatus(date2long(m.get_date(F_DATAFIN),_stats.frequency())-start_status);
statusbar.setstatus(period2long(datafin.year(), periofin, _stats.frequency())-start_status);
_svcache->flush();
delete _svcache;
}
@ -2739,4 +2740,4 @@ int sv1200(int argc, char* argv[])
TStampa_stat mainapp;
mainapp.run(argc, argv, "Stampa statistiche");
return 0;
}
}

View File

@ -227,9 +227,6 @@ const TDate & period2date(const int anno, int periodo, TFrequenza_statistiche f)
}
return d;
}
const TDate& floor(TDate& data, TFrequenza_statistiche freq)
{
@ -237,11 +234,14 @@ const TDate& floor(TDate& data, TFrequenza_statistiche freq)
{
case fs_settimanale:
{
/*
const TDate primo(1, 1, data.year());
int settimana = int((data - primo) / 7);
if (settimana > 51) settimana = 51;
data = primo;
data += settimana * 7;
*/
data -= data.wday()-1;
}
break;
case fs_quindicinale:
@ -281,10 +281,10 @@ const TDate& ceil(TDate& data, TFrequenza_statistiche freq)
switch (freq)
{
case fs_settimanale:
data += 6;
if (data.month() == 12 && data.day() >= 29)
data.set_end_month();
break;
data += 6;
if (data.month() == 12 && data.day() >= 29)
data.set_end_month();
break;
case fs_quindicinale:
if (data.day() == 1)
data.set_day(15);

Some files were not shown because too many files have changed in this diff Show More