Patch level : 2.2 23

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Riportate le modifiche dalla versione 2.1 222

Si puo cominciare a fare il primo CD


git-svn-id: svn://10.65.10.50/trunk@12708 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2005-02-17 18:13:12 +00:00
parent 4131bbd5b1
commit eb2b326a11
158 changed files with 7677 additions and 1380 deletions

View File

@ -242,7 +242,7 @@ public:
virtual bool destroy();
void mask2parms(const TMask & m);
void ini2parms(const char * filename);
void calculate_clifo(const TString & tipo, const int gruppo, const int conto, const int indbil, const bool saldi_attuali, const TString & codcom);
void calculate_clifo(const char tipo, const int gruppo, const int conto, const int indbil, const bool saldi_attuali, const TString & codcom);
void calculate();
void transform();
void get_code(const TRectype & rec, bool cee, bool reverse, TString & code);
@ -421,7 +421,7 @@ void TRicl_saldi::ini2parms(const char * filename)
write_log("");
#endif
}
void TRicl_saldi::calculate_clifo(const TString & tipo, const int gruppo, const int conto, const int indbil, const bool saldi_attuali, const TString & codcom)
void TRicl_saldi::calculate_clifo(const char tipo, const int gruppo, const int conto, const int indbil, const bool saldi_attuali, const TString & codcom)
{
TRelation relcf(LF_CLIFO);
TRectype & clifo = relcf.curr();
@ -434,7 +434,10 @@ void TRicl_saldi::calculate_clifo(const TString & tipo, const int gruppo, const
cur.freeze();
TProgind p(items, tipo == "C" ? TR("Ricalcolo saldi Clienti") : TR("Ricalcolo saldi Fornitori"), FALSE);
TString prompt = tipo == 'C' ? TR("Ricalcolo saldi Clienti") : TR("Ricalcolo saldi Fornitori");
prompt << ' ' << gruppo << ' ' << conto;
TProgind p(items, prompt, FALSE);
for (cur = 0L; !p.iscancelled() && cur.pos() < items; ++cur)
{
sottoconto = clifo.get_long(CLI_CODCF);
@ -463,10 +466,7 @@ void TRicl_saldi::calculate()
{
TRelation relpcon(LF_PCON);
const TRectype & pcon = relpcon.curr();
TCursor cur(&relpcon, "CONTO!=0");
int gruppo;
int conto;
long sottoconto;
TCursor cur(&relpcon, "CONTO!=0"); // Escludi i gruppi
int indbil = 0;
TSaldo sal;
TRiga_calcolo r;
@ -483,18 +483,18 @@ void TRicl_saldi::calculate()
TProgind p(items, TR("Ricalcolo saldi"), FALSE);
for (cur = 0L; !p.iscancelled() && cur.pos() < items; ++cur)
{
gruppo = pcon.get_int(PCN_GRUPPO);
conto = pcon.get_int(PCN_CONTO);
sottoconto = pcon.get_long(PCN_SOTTOCONTO);
if (sottoconto == 0L)
{
const int gruppo = pcon.get_int(PCN_GRUPPO);
const int conto = pcon.get_int(PCN_CONTO);
const long sottoconto = pcon.get_long(PCN_SOTTOCONTO);
if (sottoconto == 0L) // E' un conto
{
indbil = pcon.get_int(PCN_INDBIL);
const TString & tmcf = pcon.get(PCN_TMCF);
if (tmcf != ' ')
const char tmcf = pcon.get_char(PCN_TMCF);
if (tmcf > ' ')
calculate_clifo(tmcf, gruppo, conto, indbil, saldi_attuali, _codcms);
}
else
{
{
if (saldi_attuali)
sal.ultima_immissione_bilancio(_codes, gruppo, conto, sottoconto, indbil, _provv ? 2 :1, FALSE);
else

View File

@ -300,9 +300,10 @@ TSubmenu& TMenu::get_submenu(const char* name)
void TMenu::import(const char* filename, TString& first)
{
TSubmenu* sub = NULL;
TScanner scan(filename);
TFilename fname(filename); fname.custom_path();
TScanner scan(fname);
first.cut(0);
TSubmenu* sub = NULL;
while (scan.good())
{
TString& line = scan.line();
@ -340,7 +341,7 @@ void TMenu::import(const char* filename, TString& first)
{
const int endbracket = line.find('>', bracket);
TFilename name = line.sub(bracket+1, endbracket);
if (name.exist())
if (name.custom_path())
{
import(name, name);
TMenu_item& child = sub->add_child(line);

View File

@ -1282,7 +1282,7 @@ bool TInstaller_mask::on_key(KEY key)
TInstaller_mask::TInstaller_mask()
: TArray_sheet(0, 0, 0, 0, TR("Installazione"),
HR("@1|Modulo@30|Cod.@3|Versione da\ninstallare@11|Liv.\nPatch@6|Data\nRilascio@10|Versione\nInstallata@10|Liv.\nPatch@6|Data\nInstallazione@13|Aggiornamento|Patch Base"),
HR("@1|Modulo@32|Cod.@3|Versione da\ninstallare@11|Liv.\nPatch@6|Data\nRilascio@10|Versione\nInstallata@10|Liv.\nPatch@6|Data\nInstallazione@13|Aggiornamento|Patch Base"),
0x18, 3)
{
_curr_mask = this;

View File

@ -810,6 +810,7 @@ TMask_field* TReport_mask::parse_field(TScanner& scanner)
return TAutomask::parse_field(scanner);
}
/*
bool TReport_mask::select_report()
{
TFilename path;
@ -821,6 +822,7 @@ bool TReport_mask::select_report()
}
return ok;
}
*/
bool TReport_mask::select_query()
{
@ -1222,11 +1224,6 @@ bool TReport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
load_report();
}
}
if (e == fe_button)
{
if (select_report())
e = fe_modify;
}
if (e == fe_modify)
{
save_if_needed();

View File

@ -46,7 +46,7 @@ PAGE "@bReport" -1 -1 78 23
STRING F_CODICE 128 24
BEGIN
PROMPT 1 0 ""
FLAGS "B"
RSELECT ""
WARNING "E' necessario specificare il codice"
CHECKTYPE REQUIRED
END

View File

@ -19,6 +19,7 @@
#endif
#include <causali.h>
#include <clifo.h>
#include <mov.h>
#include <rmov.h>
#include <saldi.h>
@ -26,7 +27,7 @@
#include "..\cg\cglib02.h"
#define usage "Errore - uso : bacnv [1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20] ditta"
#define usage "Errore - uso : bacnv [1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21] ditta"
///////////////////////////////////////////////////////////////////////////////////////////////////////
// Applicazione di conversione archivi XBase, valida per tutti e 4 i tipi di DLL
@ -193,6 +194,7 @@ public:
void convert_ca7() const;
void change_ca7(TRectype& rec) const;
void convert_quadst() const;
void convert_clifo_privati();
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
@ -201,36 +203,29 @@ public:
bool TConversione_archivi::create()
{
TApplication::create();
const int args = argc();
if (argc() < 3)
_nconv = atoi(argv(1));
if (_nconv > 1)
{
_error = 101;
TMessage msg("ba1100", 0, format("%d", _error));
msg.send();
return FALSE;
}
else
{
_nconv = atoi(argv(1));
if (_nconv > 1)
_oldditta = get_firm();
if (args > 2)
_codditta = atol(argv(args - 1));
else
_codditta = -1;
if (_codditta >= 0 && _codditta != _oldditta)
{
_oldditta = get_firm();
_codditta = atol(argv(argc() - 1));
if (_codditta != _oldditta)
{
if (_codditta == 0) prefix().set("com");
else set_firm(_codditta);
}
if (_codditta == 0) prefix().set("com");
else set_firm(_codditta);
}
dispatch_e_menu(MENU_ITEM(1));
return TRUE;
}
dispatch_e_menu(MENU_ITEM(1));
return TRUE;
}
bool TConversione_archivi::destroy()
{
if (_nconv > 1 && _codditta != _oldditta)
if (_codditta >= 0 && _nconv > 1 && _codditta != _oldditta)
{
if (_oldditta == 0) prefix().set("com");
else set_firm(_oldditta);
@ -358,6 +353,8 @@ bool TConversione_archivi::menu(MENU_TAG)
convert_quadst();
}
break;
case 21:
convert_clifo_privati();
default:
break;
}
@ -1814,6 +1811,55 @@ void TConversione_archivi::convert_quadst() const
}
}
////////////////////////////////////////////////////////////////
// Effettua conversione campo ALLEG a 6 se il cliente non ha partita IVA
////////////////////////////////////////////////////////////////
void TConversione_archivi::convert_clifo_privati()
{
long firm = get_firm();
TString pref;
if (firm == 0)
pref = prefix().name();
TLocalisamfile ditte(LF_NDITTE);
for (ditte.first(); !ditte.eof(); ditte.next())
{
const long codditta = ditte.get_long("CODDITTA");
if (prefix().exist(codditta))
{
set_firm(codditta);
{
TRelation rel(LF_CLIFO);
TRectype& curr = rel.curr();
curr.put(CLI_TIPOCF, "C");
TCursor cursore(&rel, "(PAIV=='')&&(ALLEG!='6')", 1, &curr, &curr);
const long items = cursore.items();
cursore.freeze();
TProgind pi(items, "Conversione clienti privati..", FALSE, TRUE);
for (cursore=0; cursore.pos()<items; ++cursore)
{
pi.addstatus(1);
curr.put(CLI_ALLEG, 6);
rel.rewrite();
}
}
}
}
if (firm > 0)
set_firm(firm);
else
prefix().set(pref);
}
///////////////////////////////////////////////////////////
// Programma di conversione archivi speciale
///////////////////////////////////////////////////////////
@ -1822,7 +1868,7 @@ int main(int argc,char** argv)
{
const int r = (argc > 1) ? abs(atoi(argv[1])) : 0;
if (r < 0 || r > 20)
if (r < 0 || r > 21)
{
error_box(usage);
return 100;

View File

@ -35,8 +35,8 @@ Tabella codici IVA
1|I0|@67g@2n
1|S2|@73g@3s
1|S9|@79g@3s
1|S10|@85g@3s
1|S11|@90g@3s
1|S10|@85g@4s
1|S11|@90g@4s
1|B3|@97g@f
1|S3|@105g@1s
1|S4|@111g@1s

View File

@ -239,7 +239,8 @@ BEGIN
ITEM "CD22|Operazioni non imponibili"
ITEM "CD23|Operazioni esenti"
ITEM "CD24|Acquisti intracomunitari di beni"
ITEM "CD3|Importazioni di oro industriale ed argento puro senza pagamento dell'IVA in dogana"
ITEM "CD31|Importazioni di oro industriale ed argento puro senza pagamento dell'IVA in dogana"
ITEM "CD33|Rottami e altri materiali di recupero"
OUTPUT FLD_TABIVA_S11
END

View File

@ -1,3 +1,3 @@
3
1
%tabgen|0|0|985|0|Tabelle di studio|50||
%tabgen|0|0|1009|0|Tabelle di studio|50||

View File

@ -1,5 +1,5 @@
3
70
77
COD|1|3|0|
CODTAB|1|25|0|
S0|1|70|0|
@ -54,6 +54,7 @@ R21|4|18|5|
R22|4|18|5|
R23|4|18|5|
R24|4|18|5|
R25|4|18|5|
D0|5|8|0|
D1|5|8|0|
D2|5|8|0|
@ -69,6 +70,12 @@ B6|8|1|0|
B7|8|1|0|
B8|8|1|0|
B9|8|1|0|
B10|8|1|0|
B11|8|1|0|
B12|8|1|0|
B13|8|1|0|
B14|8|1|0|
B15|8|1|0|
FPC|8|1|0|
2
COD+CODTAB|

View File

@ -1,3 +1,3 @@
4
1
%tabcom|0|0|985|0|Tabelle comuni|1500||
%tabcom|0|0|1009|0|Tabelle comuni|1500||

View File

@ -1,5 +1,5 @@
4
70
77
COD|1|3|0|
CODTAB|1|25|0|
S0|1|70|0|
@ -54,6 +54,7 @@ R21|4|18|5|
R22|4|18|5|
R23|4|18|5|
R24|4|18|5|
R25|4|18|5|
D0|5|8|0|
D1|5|8|0|
D2|5|8|0|
@ -69,6 +70,12 @@ B6|8|1|0|
B7|8|1|0|
B8|8|1|0|
B9|8|1|0|
B10|8|1|0|
B11|8|1|0|
B12|8|1|0|
B13|8|1|0|
B14|8|1|0|
B15|8|1|0|
FPC|8|1|0|
2
COD+CODTAB|

View File

@ -1,3 +1,3 @@
5
0
$tab|0|0|985|0|Tabelle ditta|400||
$tab|0|0|1009|0|Tabelle ditta|400||

View File

@ -1,5 +1,5 @@
5
70
77
COD|1|3|0|
CODTAB|1|25|0|
S0|1|70|0|
@ -54,6 +54,7 @@ R21|4|18|5|
R22|4|18|5|
R23|4|18|5|
R24|4|18|5|
R25|4|18|5|
D0|5|8|0|
D1|5|8|0|
D2|5|8|0|
@ -69,6 +70,12 @@ B6|8|1|0|
B7|8|1|0|
B8|8|1|0|
B9|8|1|0|
B10|8|1|0|
B11|8|1|0|
B12|8|1|0|
B13|8|1|0|
B14|8|1|0|
B15|8|1|0|
FPC|8|1|0|
2
COD+CODTAB|

View File

@ -7,7 +7,7 @@ int main(int argc,char** argv)
const int r = (argc > 1) ? (argv[1][1]-'0') : 0;
switch (r)
{
case 3: ce0400(argc,argv); break; // Parametri ditta
case 3: ce0400(argc,argv); break; // Parametri cespiti
case 4: ce0500(argc,argv); break; // Anagrafica cespiti
case 8: ce0900(argc,argv); break; // Conversione cespiti
default: ce0100(argc,argv); break; // Tabelle cespiti

View File

@ -1,15 +1,139 @@
#include <automask.h>
#include <confapp.h>
#include <lffiles.h>
#include <prefix.h>
#include <sheet.h>
class TCespi_config_app : public TConfig_application
#include "ce0400a.h"
//------------------------------------------------------
// Maschera di configurazione
//------------------------------------------------------
class TConfig_mask : public TAutomask
{
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TConfig_mask() : TAutomask("ce0400a") { }
};
bool TConfig_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
{
switch (f.dlg())
{
case F_NAME_USER:
if (e == fe_button)
{
//crea lo sheet con i campi del .trr
TArray_sheet sht(-1,-1,-4,-4,TR("Parametri campi"),HR("Nome@10R|Tipo|Lunghezza|Decimali"));
const RecDes& rd = prefix().get_recdes(LF_CESPI);
for (int i = 0; i < rd.NFields; i++)
{
const RecFieldDes& rfd = rd.Fd[i];
TToken_string row;
//deve aggiungere solo i campi il cui nome comincia per "_"
if (rfd.Name[0] == '_')
{
row.add(rfd.Name); //nome campo
row.add(rfd.TypeF); //tipo
row.add(rfd.Len);//lunghezza
row.add(rfd.Dec);//decimali
sht.add(row);
}
}
if (sht.items() > 0)
{
if (sht.run() == K_ENTER)
f.set(sht.row(-1).get(0));
}
else
return error_box(TR("Non ci sono campi personalizzati"));
}
if (e == fe_init || e == fe_modify)
{
}
break;
default: break;
}
return true;
}
//------------------------------------------------------
// Applicazione
//------------------------------------------------------
class TCespi_config_app : public TConfig_application
{
TConfig_mask* _mask;
protected:
virtual const char* get_mask_name() const { return "ce0400a"; }
public:
TMask* create_mask(const TFilename& f);
virtual TMask* get_mask();
public:
virtual void load_mask();
virtual void save_mask(bool tosave);
TCespi_config_app();
};
TCespi_config_app::TCespi_config_app() : TConfig_application(CONFIG_DITTA)
TMask* TCespi_config_app::create_mask(const TFilename& f)
{
if (_mask == NULL)
_mask = new TConfig_mask;
return _mask;
}
TMask* TCespi_config_app::get_mask()
{
if (_mask == NULL)
{
const TFilename name = get_mask_name();
create_mask(name);
}
return _mask;
}
//carica i valori dal ditta.ini nello sheet della maschera
void TCespi_config_app::load_mask()
{
TConfig_application::load_mask(); //chiama la load_mask() standard dei TConfig per caricare i campi != sheet
TConfig& config = *get_config(); //si carica il config della load_mask
TSheet_field& sf = get_mask()->sfield(F_USER);
for (int i = 0; config.exist("USER", i); i++)
sf.row(i) = config.get("USER", NULL, i);
}
//registra i valori dello sheet nel ditta.ini
void TCespi_config_app::save_mask(bool tosave)
{
TConfig* config = get_config();
if (config == NULL)
return;
TConfig_application::save_mask(tosave);
//svuota il paragrafo sul .ini prima di ricompilarlo (se non si facesse
//non si riuscirebbero ad ammazzare le righe sul .ini
for (int i = 0; config->exist("USER", i); i++)
config->remove("USER", i);
TSheet_field& sf = get_mask()->sfield(F_USER);
FOR_EACH_SHEET_ROW (sf, j, row)
{
config->set("USER", *row, "ce", true, j);
}
}
TCespi_config_app::TCespi_config_app() : TConfig_application(CONFIG_DITTA), _mask(NULL)
{ }
int ce0400 (int argc, char* argv[])

View File

@ -13,9 +13,8 @@
#define F_DATACONS 110
#define F_ANNOTUIR 111
#define F_AMMPROP 112
#define F_COLLCOGE 113
#define F_SHOWCOLL 200
#define F_COLLCOGE 200
#define F_PLUSMINUS 201
#define F_TIPOSCRIT 202
@ -54,3 +53,11 @@
#define F_VEND_CESP_CO 241
#define F_VEND_CESP_SO 242
#define F_VEND_CESP_D 243
//sheet elenco files personalizzati e relative righe
#define F_USER 300
#define F_NAME_USER 101
#define F_PROMPT_USER 102
#define F_PICTURE_USER 103
#define F_SEARCH_USER 104

View File

@ -135,24 +135,42 @@ BEGIN
FIELD AMMPROP
END
BOOLEAN F_COLLCOGE
ENDPAGE
//-----------------------------------------------------------------------------------------------//
PAGE "Campi personalizzati" -1 -1 78 10
SPREADSHEET F_USER
BEGIN
PROMPT 1 10 "Attiva collegamento a contabilita'"
FIELD COLLCOGE
MESSAGE FALSE 11100,DLG_PAGE
MESSAGE TRUE 11101,DLG_PAGE
PROMPT 0 1 "Parametri campi personalizzati"
ITEM "Nome@10"
ITEM "Prompt@20"
ITEM "Picture@50"
ITEM "Ricerca"
END
ENDPAGE
//-----------------------------------------------------------------------------------------------//
PAGE "Collegamento Contabilità" -1 -1 78 10
BOOLEAN F_COLLCOGE
BEGIN
PROMPT 2 0 "Attiva collegamento a contabilita'"
FIELD COLLCOGE
MESSAGE FALSE DISABLE,9@
MESSAGE TRUE ENABLE,9@
END
BOOLEAN F_PLUSMINUS
BEGIN
PROMPT 2 1 "Genera anche movimenti plus/minusvalenza"
MESSAGE TRUE ENABLE,F_RIL_PLUS|ENABLE,F_D_RIL_PLUS|ENABLE,F_RIL_MIN|ENABLE,F_D_RIL_MIN|ENABLE,F_TIPOSCRIT|"",F_TIPOSCRIT|ENABLE,F_PLUSVAL_GR|ENABLE,F_PLUSVAL_CO|ENABLE,F_PLUSVAL_SO|ENABLE,F_PLUSVAL_D|REQUIRED,F_PLUSVAL_SO|ENABLE,F_MINUSVAL_GR|ENABLE,F_MINUSVAL_CO|ENABLE,F_MINUSVAL_SO|ENABLE,F_MINUSVAL_D|REQUIRED,F_MINUSVAL_SO
MESSAGE FALSE CLEAR,F_RIL_PLUS|CLEAR,F_D_RIL_PLUS|CLEAR,F_RIL_MIN|CLEAR,F_D_RIL_MIN|DISABLE,F_TIPOSCRIT|"X",F_TIPOSCRIT|CLEAR,F_PLUSVAL_GR|CLEAR,F_PLUSVAL_CO|CLEAR,F_PLUSVAL_SO|CLEAR,F_PLUSVAL_D|CLEAR,F_MINUSVAL_GR|CLEAR,F_MINUSVAL_CO|CLEAR,F_MINUSVAL_SO|CLEAR,F_MINUSVAL_D
FIELD COPLMN
GROUP 9
END
RADIOBUTTON F_TIPOSCRIT 1 60
@ -163,6 +181,7 @@ BEGIN
ITEM "X|Su Conto Cespite"
MESSAGE CLEAR,F_VEND_CESP_GR|CLEAR,F_VEND_CESP_CO|CLEAR,F_VEND_CESP_SO|CLEAR,F_VEND_CESP_D
FIELD COR5PM
GROUP 9
END
GROUPBOX DLG_NULL 78 7
@ -183,6 +202,7 @@ BEGIN
OUTPUT F_D_ELIMCESP DESCR
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_D_ELIMCESP 50 35
@ -195,6 +215,7 @@ BEGIN
COPY OUTPUT F_ELIMCESP
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_RIL_DIFF 3
@ -209,6 +230,7 @@ BEGIN
OUTPUT F_D_RIL_DIFF DESCR
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_D_RIL_DIFF 50 35
@ -221,6 +243,7 @@ BEGIN
COPY OUTPUT F_RIL_DIFF
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_RIL_QUOT 3
@ -235,6 +258,7 @@ BEGIN
OUTPUT F_D_RIL_QUOT DESCR
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_D_RIL_QUOT 50 35
@ -247,6 +271,7 @@ BEGIN
COPY OUTPUT F_RIL_QUOT
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_RIL_PLUS 3
@ -261,6 +286,7 @@ BEGIN
OUTPUT F_D_RIL_PLUS DESCR
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_D_RIL_PLUS 50 35
@ -273,6 +299,7 @@ BEGIN
COPY OUTPUT F_RIL_PLUS
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_RIL_MIN 3
@ -287,6 +314,7 @@ BEGIN
OUTPUT F_D_RIL_MIN DESCR
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_D_RIL_MIN 50 35
@ -299,6 +327,7 @@ BEGIN
COPY OUTPUT F_RIL_MIN
ADD RUN CG0 -4
CHECKTYPE REQUIRED
GROUP 9
END
GROUPBOX DLG_NULL 78 8
@ -319,6 +348,7 @@ BEGIN
OUTPUT F_SOPR_PAS_GR GRUPPO
ADD RUN CG0 -0
CHECKTYPE REQUIRED
GROUP 9
END
NUMBER F_SOPR_PAS_CO 3
@ -338,6 +368,7 @@ BEGIN
CHECKTYPE REQUIRED
VALIDATE REQIF_FUNC 1 F_SOPR_PAS_SO
WARNING "Manca il conto"
GROUP 9
END
NUMBER F_SOPR_PAS_SO 6
@ -359,6 +390,7 @@ BEGIN
OUTPUT F_SOPR_PAS_D DESCR
ADD RUN CG0 -0
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_SOPR_PAS_D 50 29
@ -375,6 +407,7 @@ BEGIN
ADD RUN CG0 -0
CHECKTYPE REQUIRED
WARNING "Manca la descrizione"
GROUP 9
END
NUMBER F_DIFF_QUO_GR 3
@ -389,6 +422,7 @@ BEGIN
OUTPUT F_DIFF_QUO_GR GRUPPO
ADD RUN CG0 -0
CHECKTYPE REQUIRED
GROUP 9
END
NUMBER F_DIFF_QUO_CO 3
@ -408,6 +442,7 @@ BEGIN
CHECKTYPE REQUIRED
VALIDATE REQIF_FUNC 1 F_DIFF_QUO_SO
WARNING "Manca il conto"
GROUP 9
END
NUMBER F_DIFF_QUO_SO 6
@ -429,6 +464,7 @@ BEGIN
OUTPUT F_DIFF_QUO_D DESCR
ADD RUN CG0 -0
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_DIFF_QUO_D 50 29
@ -445,6 +481,7 @@ BEGIN
ADD RUN CG0 -0
CHECKTYPE REQUIRED
WARNING "Manca la descrizione"
GROUP 9
END
NUMBER F_DIFF_FON_GR 3
@ -459,6 +496,7 @@ BEGIN
OUTPUT F_DIFF_FON_GR GRUPPO
ADD RUN CG0 -0
CHECKTYPE REQUIRED
GROUP 9
END
NUMBER F_DIFF_FON_CO 3
@ -478,6 +516,7 @@ BEGIN
CHECKTYPE REQUIRED
VALIDATE REQIF_FUNC 1 F_DIFF_FON_SO
WARNING "Manca il conto"
GROUP 9
END
NUMBER F_DIFF_FON_SO 6
@ -499,6 +538,7 @@ BEGIN
OUTPUT F_DIFF_FON_D DESCR
ADD RUN CG0 -0
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_DIFF_FON_D 50 29
@ -515,6 +555,7 @@ BEGIN
ADD RUN CG0 -0
CHECKTYPE REQUIRED
WARNING "Manca la descrizione"
GROUP 9
END
NUMBER F_PLUSVAL_GR 3
@ -529,6 +570,7 @@ BEGIN
OUTPUT F_PLUSVAL_GR GRUPPO
ADD RUN CG0 -0
CHECKTYPE NORMAL
GROUP 9
END
NUMBER F_PLUSVAL_CO 3
@ -548,6 +590,7 @@ BEGIN
CHECKTYPE NORMAL
VALIDATE REQIF_FUNC 1 F_PLUSVAL_SO
WARNING "Manca il conto"
GROUP 9
END
NUMBER F_PLUSVAL_SO 6
@ -570,6 +613,7 @@ BEGIN
OUTPUT F_PLUSVAL_D DESCR
ADD RUN CG0 -0
CHECKTYPE NORMAL
GROUP 9
END
STRING F_PLUSVAL_D 50 29
@ -586,6 +630,7 @@ BEGIN
ADD RUN CG0 -0
CHECKTYPE NORMAL
WARNING "Manca la descrizione"
GROUP 9
END
NUMBER F_MINUSVAL_GR 3
@ -600,6 +645,7 @@ BEGIN
OUTPUT F_MINUSVAL_GR GRUPPO
ADD RUN CG0 -0
CHECKTYPE NORMAL
GROUP 9
END
NUMBER F_MINUSVAL_CO 3
@ -619,6 +665,7 @@ BEGIN
CHECKTYPE NORMAL
VALIDATE REQIF_FUNC 1 F_MINUSVAL_SO
WARNING "Manca il conto"
GROUP 9
END
NUMBER F_MINUSVAL_SO 6
@ -641,6 +688,7 @@ BEGIN
OUTPUT F_MINUSVAL_D DESCR
ADD RUN CG0 -0
CHECKTYPE NORMAL
GROUP 9
END
STRING F_MINUSVAL_D 50 29
@ -657,6 +705,7 @@ BEGIN
ADD RUN CG0 -0
CHECKTYPE NORMAL
WARNING "Manca la descrizione"
GROUP 9
END
NUMBER F_VEND_CESP_GR 3
@ -671,6 +720,7 @@ BEGIN
OUTPUT F_VEND_CESP_GR GRUPPO
ADD RUN CG0 -0
CHECKTYPE REQUIRED
GROUP 9
END
NUMBER F_VEND_CESP_CO 3
@ -690,6 +740,7 @@ BEGIN
CHECKTYPE REQUIRED
VALIDATE REQIF_FUNC 1 F_VEND_CESP_SO
WARNING "Manca il conto"
GROUP 9
END
NUMBER F_VEND_CESP_SO 6
@ -711,6 +762,7 @@ BEGIN
OUTPUT F_VEND_CESP_D DESCR
ADD RUN CG0 -0
CHECKTYPE REQUIRED
GROUP 9
END
STRING F_VEND_CESP_D 50 29
@ -727,6 +779,58 @@ BEGIN
ADD RUN CG0 -0
CHECKTYPE REQUIRED
WARNING "Manca la descrizione"
GROUP 9
END
ENDPAGE
ENDMASK
//------------------------------------------------------------------------------------------------
//-----------Pagina di riga dello sheet----------------------//
PAGE "File personalizzato" -1 -1 66 10
STRING F_NAME_USER 10
BEGIN
PROMPT 1 1 "Nome "
FIELD USER_NAME
FLAGS "BU"
CHECKTYPE REQUIRED
END
STRING F_PROMPT_USER 20
BEGIN
PROMPT 1 2 "Prompt "
FIELD USER_PROMPT
END
STRING F_PICTURE_USER 50
BEGIN
PROMPT 1 3 "Picture "
FIELD USER_PICTURE
FLAGS "U"
END
BOOLEAN F_SEARCH_USER
BEGIN
PROMPT 1 4 "Campo di ricerca"
FIELD USER_SEARCH
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE

View File

@ -16,25 +16,140 @@
#include "salce.h"
#include "ammce.h"
class TQuery_mask : public TAutomask
//-------------------------------------------------------------------
// MASCHERA VIRTUALE
//-------------------------------------------------------------------
class TBasic_cespi_mask : public TAutomask
{
protected:
int create_fields(int x, int y, short key_id, const int page);
TBasic_cespi_mask(const char* name) : TAutomask(name) {}
};
int TBasic_cespi_mask::create_fields(int x, int y, short key_id, const int page)
{
TRectype rec_cespi(LF_CESPI);
//cicla sui campi user (se ci sono) nel ditta.ini facendoli apparire sulla pagine Personalizz.
TConfig config (CONFIG_DITTA, "ce");
int i = 0;
int maxprompt = 0;
for (i = 0; config.exist("USER", i); i++)
{
TToken_string riga = config.get("USER", NULL, i);
const TString80 prompt = riga.get(1);
const int len = prompt.len();
if (len > maxprompt)
maxprompt = len;
}
maxprompt++;
for (i = 0; config.exist("USER", i); i++)
{
TToken_string riga = config.get("USER", NULL, i);
const bool search = riga.get_char(3) == 'X';
//se e' in pagina di ricerca ed il campo non e' di ricerca lo salta!
if (page == 0 && !search)
continue;
//tutto il resto lo fa comunque,settandondolo nella page corretta
const short kid = key_id+i; //numero del campo come definito nel .h della maschera
const TString16 name = riga.get(0); //nome campo
TString80 prompt = riga.get(1); prompt.left_just(maxprompt); //prompt sulla maschera
const TString80 picture = riga.get(2); //picture del campo(se c'e')
//se la lunghezza del campo non e' definita nella picture la prende dal tracciato
const int len = picture.blank() ? rec_cespi.length(name) : picture.len();
//chiede al record di che tipo e' il campo chiamato name...
const TFieldtypes tipo_campo = rec_cespi.type(name);
//..quanto e' lungo...(maniaca!)
const int length_campo = rec_cespi.length(name);
//...e quanti decimali ha nel caso sia un real
int ndec_campo = 0;
if (tipo_campo == _realfld)
ndec_campo = rec_cespi.ndec(name);
const bool btn = search && page == 0;
//crea finalmente i nuovi campi sulla pagina 1 (Personalizzazioni)
switch(tipo_campo)
{
case _wordfld: add_number (kid, page, prompt, x, i+y, len, btn ? "BU" : "U"); break;
case _intfld :
case _longfld: add_number (kid, page, prompt, x, i+y, len, btn ? "B" : ""); break;
case _intzerofld:
case _longzerofld: add_number (kid, page, prompt, x, i+y, len, btn ? "BZ" : "Z"); break;
case _realfld: add_number (kid, page, prompt, x, i+y, len, "", ndec_campo); break;
case _datefld: add_date (kid, page, prompt, x, i+y, btn ? "B" : ""); break;
case _memofld: add_zoom(kid, page, prompt, x, i+y, 50); break;
default : add_string (kid, page, prompt, x, i+y, len, btn ? "BU" : ""); break;
}
//deve poter salvare il contenuto nei campi!! (e' il FIELD delle maschere)
TEdit_field& efld = efield(kid);
efld.set_field(name); //la set_field lo fa
}
//deve accendere gli handler di questa maschera perche' funzionino
set_handlers();
return i;
}
//-------------------------------------------------------------------
// MASCHERA RICERCA (ce0500a)
//-------------------------------------------------------------------
class TQuery_mask : public TBasic_cespi_mask
{
int _staat;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
void on_search_event(TOperable_field& o);
void on_user_search(TOperable_field& o);
virtual void on_firm_change();
int calcola_stato_attivita();
bool cespite_ok() const;
void set_cespi_filter();
public:
int stato_attivita() const { return _staat; }
TQuery_mask();
};
void TQuery_mask::on_user_search(TOperable_field& o)
{
TToken_string order, header;
const TFieldref* campo = o.field();
const TString nome_campo = campo->name();
//ordinare per campo personalizzato/idcespite/descrizione
order.add(nome_campo);
TString prompt = o.prompt();
prompt << "@" << o.size(); //lunghezza del prompt del campo
header.add(prompt);
order.add(CESPI_IDCESPITE); header.add(TR("Cespite@10"));
order.add(CESPI_DESC); header.add(FR("Descrizione cespite@50"));
TRelation rel(LF_CESPI);
TSorted_cursor cur(&rel, order);
TCursor_sheet sht(&cur, order, TR("Cespiti"), header, 0, 1);
if (sht.run() == K_ENTER)
{
TToken_string& row = sht.row();
set(F_IDCESPITE, row.get(1), TRUE);
stop_run(K_AUTO_ENTER);
}
}
void TQuery_mask::on_search_event(TOperable_field& o)
{
TToken_string order, fields, header;
@ -207,6 +322,15 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
return yesno_box(TR("Non esistono saldi per l'anno selezionato:\nSi desidera continuare ugualmente?"));
}
break;
case F_USER:
case F_USER+1:
case F_USER+2:
case F_USER+3:
case F_USER+4:
case F_USER+5:
if (e == fe_button)
on_user_search(o);
break;
default:
break;
}
@ -219,12 +343,17 @@ void TQuery_mask::on_firm_change()
ditta_cespiti().init_mask(*this);
}
TQuery_mask::TQuery_mask() : TAutomask("ce0500a")
TQuery_mask::TQuery_mask() : TBasic_cespi_mask("ce0500a")
{
first_focus(F_IDCESPITE);
create_fields(2, 13, F_USER, 0);
}
class TEdit_mask : public TAutomask
//-------------------------------------------------------------------
// MASCHERA DI MODIFICA (ca0500b)
//-------------------------------------------------------------------
class TEdit_mask : public TBasic_cespi_mask
{
TTipo_cespite _tipo;
int _staat;
@ -248,7 +377,7 @@ public:
void protect_page(int page, TToken_string& enabling);
TEdit_mask() : TAutomask("ce0500b") { }
TEdit_mask();
};
bool TEdit_mask::one_compiled(const short* f) const
@ -426,7 +555,7 @@ bool TEdit_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
break;
case F_ANNIAMM:
if (e == fe_init || e == fe_modify)
enable_page(2, !o.empty());
enable_page(3, !o.empty());
break;
case F_NORMALE:
if (e == fe_close)
@ -647,6 +776,13 @@ bool TEdit_mask::on_key(KEY k)
return TAutomask::on_key(k);
}
TEdit_mask::TEdit_mask() : TBasic_cespi_mask("ce0500b")
{
create_fields(1, 1, F_USER, 1);
}
//--------------------------------------------------------------
// APPLICAZIONE
//--------------------------------------------------------------
class TAnacespi : public TRelation_application
{
TRelation* _cespiti;

View File

@ -38,6 +38,8 @@
#define F_DESC_USOPROM 154
#define F_ANNIRIC 155
#define F_USER 160
#define F_ELEMENTI 202
#define F_COSTO 203
#define F_VNONAMM 204

View File

@ -186,24 +186,24 @@ BEGIN
KEY 2
END
GROUPBOX DLG_NULL 78 4
GROUPBOX DLG_NULL 78 13
BEGIN
PROMPT 1 15 "@bRicerce alternative"
PROMPT 1 9 "@bRicerce alternative e personalizzate"
END
BUTTON F_SEARCH1 22 2
BEGIN
PROMPT 2 16 "Per categoria"
PROMPT 2 10 "Per categoria"
END
BUTTON F_SEARCH2 22 2
BEGIN
PROMPT 28 16 "Per impianto"
PROMPT 28 10 "Per impianto"
END
BUTTON F_SEARCH3 22 2
BEGIN
PROMPT 54 16 "Per stabilimento"
PROMPT 54 10 "Per stabilimento"
END
ENDPAGE

View File

@ -296,6 +296,10 @@ END
ENDPAGE
PAGE "Personalizzazioni" -1 -1 78 18
ENDPAGE
PAGE "Saldi" -1 -1 78 18
GROUPBOX DLG_NULL 78 5

View File

@ -22,10 +22,10 @@
#include "movce.h"
#include "salce.h"
///////////////////////////////////////////////////////////
// Maschera di selezione
///////////////////////////////////////////////////////////
//--------------------------------------------------
// DICHIARAZIONE APPLICAZIONE
//--------------------------------------------------
class TMov_qmask;
class TMov_emask;
@ -70,10 +70,9 @@ public:
TMovicespi& app() { return (TMovicespi&)main_app(); }
///////////////////////////////////////////////////////////
// Maschera di selezione
///////////////////////////////////////////////////////////
//---------------------------------------------------------
// MASCHERA DI RICERCA (ce1500a)
//---------------------------------------------------------
class TMov_qmask : public TAutomask
{
int _staat;
@ -81,14 +80,53 @@ class TMov_qmask : public TAutomask
protected:
virtual bool can_be_closed() const;
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
void on_user_search(TOperable_field& o);
virtual void on_firm_change();
int calcola_stato_attivita();
int create_fields(int x, int y, short key_id);
public:
int stato_attivita() const { return _staat; }
TMov_qmask();
};
void TMov_qmask::on_user_search(TOperable_field& o)
{
TToken_string order, fields, header;
const TFieldref* campo = o.field();
//ordinare per campo personalizzato/idcespite/descrizione
order.format("%d->%s", LF_CESPI, (const char*)campo->name());
TString prompt = o.prompt();
prompt << "@" << o.size(); //lunghezza del prompt del campo
header.add(prompt);
order.add(MOVCE_IDMOV);
header.add(TR("Movimento@11"));
fields = order;
fields.add(MOVCE_DESC);
header.add(FR("Descrizione@50"));
fields.add(MOVCE_IDCESPITE);
header.add(TR("Cespite@10"));
TString desc_cesp;
desc_cesp.format("%d->%s", LF_CESPI, "DESC");
fields.add(desc_cesp);
header.add(FR("Descrizione cespite@50"));
TRelation rel(LF_MOVCE);
rel.add(LF_CESPI, "IDCESPITE==IDCESPITE");
TSorted_cursor cur(&rel, order);
TCursor_sheet sht(&cur, fields, TR("Movimenti"), header, 0, 1);
if (sht.run() == K_ENTER)
{
TToken_string& row = sht.row();
set(F_IDMOV, row.get(1), TRUE);
stop_run(K_AUTO_ENTER);
}
}
int TMov_qmask::calcola_stato_attivita()
{
const int ese = get_int(F_ESERCIZIO);
@ -171,7 +209,16 @@ bool TMov_qmask::on_field_event(TOperable_field& o, TField_event e, long jolly)
return yesno_box(TR("Attenzione: la registrazione contabile non è ancora del tutto evasa:\n"
"Si desidera uscire ugualmente?"));
}
break;
break;
case F_USER:
case F_USER+1:
case F_USER+2:
case F_USER+3:
case F_USER+4:
case F_USER+5:
if (e == fe_button)
on_user_search(o);
break;
default:
break;
}
@ -193,12 +240,88 @@ void TMov_qmask::on_firm_change()
TMov_qmask::TMov_qmask() : TAutomask("ce1500a")
{
first_focus(F_IDMOV);
create_fields(1, 14, F_USER);
}
///////////////////////////////////////////////////////////
// Applicazione principale
///////////////////////////////////////////////////////////
//metodo per la generazione dei campi di ricerca personalizzati
int TMov_qmask::create_fields(int x, int y, short key_id)
{
TRectype rec_cespi(LF_CESPI);
//cicla sui campi user (se ci sono) nel ditta.ini facendoli apparire sulla pagine Personalizz.
TConfig config (CONFIG_DITTA, "ce");
int i = 0;
//valuta il valore massimo in orizzontale per il prompt, in modo da allineare i campi in verticale
int maxprompt = 0;
for (i = 0; config.exist("USER", i); i++)
{
TToken_string riga = config.get("USER", NULL, i);
const TString80 prompt = riga.get(1);
const int len = prompt.len();
if (len > maxprompt)
maxprompt = len;
}
maxprompt++;
for (i = 0; config.exist("USER", i); i++)
{
TToken_string riga = config.get("USER", NULL, i);
//siamo in pagina di ricerca! se il campo non e' di ricerca lo salta!
const bool search = riga.get_char(3) == 'X';
if (!search)
continue;
//tutto il resto lo fa comunque,settandondolo nella page corretta
const short kid = key_id+i; //numero del campo come definito nel .h della maschera
const TString16 name = riga.get(0); //nome campo
TString80 prompt = riga.get(1); prompt.left_just(maxprompt); //prompt sulla maschera
const TString80 picture = riga.get(2); //picture del campo(se c'e')
//se la lunghezza del campo non e' definita nella picture la prende dal tracciato
const int len = picture.blank() ? rec_cespi.length(name) : picture.len();
//chiede al record di che tipo e' il campo chiamato name...
const TFieldtypes tipo_campo = rec_cespi.type(name);
//..quanto e' lungo...(maniaca!)
const int length_campo = rec_cespi.length(name);
//...e quanti decimali ha nel caso sia un real
int ndec_campo = 0;
if (tipo_campo == _realfld)
ndec_campo = rec_cespi.ndec(name);
//crea finalmente i nuovi campi sulla pagina 1 (Personalizzazioni)
switch(tipo_campo)
{
case _wordfld: add_number (kid, 0, prompt, x, i+y, len, search ? "BU" : "U"); break;
case _intfld :
case _longfld: add_number (kid, 0, prompt, x, i+y, len, search ? "B" : ""); break;
case _intzerofld:
case _longzerofld: add_number (kid, 0, prompt, x, i+y, len, search ? "BZ" : "Z"); break;
case _realfld: add_number (kid, 0, prompt, x, i+y, len, "", ndec_campo); break;
case _datefld: add_date (kid, 0, prompt, x, i+y, search ? "B" : ""); break;
case _memofld: add_zoom(kid, 0, prompt, x, i+y, 50); break;
default : add_string (kid, 0, prompt, x, i+y, len, search ? "BU" : ""); break;
}
//deve poter salvare il contenuto nei campi!! (e' il FIELD delle maschere)
TEdit_field& efld = efield(kid);
efld.set_field(name); //la set_field lo fa
}
//deve accendere gli handler di questa maschera perche' funzionino
set_handlers();
return i;
}
//---------------------------------------------------------
// MASCHERA DI MODIFICA (ce1500b)
//---------------------------------------------------------
class TMov_emask : public TAutomask
{
int _staat;

View File

@ -67,6 +67,10 @@
#define F_IDMOVAM3 255
#define F_IDCESAM3 256
//campi personalizzati
#define F_USER 300
//fine campi personalizzati
#define F_NORMALE 301
#define F_ACCELERATO 302
#define F_ANTICIPATO 303

View File

@ -230,6 +230,10 @@ BEGIN
GROUP 8
END
GROUPBOX DLG_NULL 78 10
BEGIN
PROMPT 0 13 "@bRicerce personalizzate"
END
ENDPAGE

View File

@ -2,8 +2,10 @@
#include <automask.h>
#include <form.h>
#include <printer.h>
#include <progind.h>
#include <recarray.h>
#include "celib.h"
#include "../ve/velib.h"
#include "ce4200a.h"
@ -38,6 +40,7 @@ bool TCalc_cesp_cms_mask::on_field_event(TOperable_field& o, TField_event e, lon
//form
class TCalc_cesp_cms_form : public TForm
{
TDitta_cespiti _ditta;
protected:
bool validate(TForm_item &cf, TToken_string &s);
@ -57,14 +60,12 @@ TCalc_cesp_cms_form::~TCalc_cesp_cms_form()
bool TCalc_cesp_cms_form::validate(TForm_item &cf, TToken_string &s)
{
if (s == "_DESCRCESPITE")
if (s == "_DESCRCAT")
{
TString16 str;
str.format("%010ld",cursor()->curr().get_long(DOC_NDOC));
const TString& descr = cache().get(LF_CESPI, str, CESPI_DESC);
cf.set(descr);
const int codcat = cursor()->curr().get_int(DOC_NDOC);
const TRectype& cat =_ditta.categoria(0, "", codcat);
cf.set(cat.get("S0"));
return true; //ricava la descrizione del cespite e la manda in stampa
}
return TForm::validate(cf,s);
@ -78,6 +79,7 @@ class TCalc_cesp_cms : public TSkeleton_application
{
TCalc_cesp_cms_mask* _mask;
TCalc_cesp_cms_form* _form;
bool _soloperc;
protected:
virtual void main_loop();
@ -87,68 +89,124 @@ protected:
public:
void utilizzo_per_cms(const TRectype& ammce_rec);
real calc_perc_util_cesp(const TRectype& salcecms_rec, const TDate& dtinices, const TDate& dtfineces);
void delete_cespi_docs();
TRiga_documento& cerca_riga(TDocumento& doc_cesp, const TString& idcesp, const TString& codcms) const;
void elabora_docs();
void stampa_docs();
};
//Calcolo % utilizzo del cespite nella commessa
//---------------------------------------------
// percutil = a quella dei saldi per commessa (SALCECMS_PERCUTIL)
// percutil = percutil/100 normalizzazione
// Se si devono considerare le date...
// stabilisce l'intervallo di date di riferimento per calcolare il numero dei giorni di utilizzo
// del cespite nella commessa delta_cms = (dtfine-dtini+1)/(dtfineces-dtinices+1)
// dove:
// dtinices e dtfineces sono le date di inizio e fine cespite
// dtini e dtfine sono le date di inizio e fine UTILIZZO del cespite nella commessa
// quindi la percentuale di utilizzo del cespite nella commessa risultera' come:
// percutil = percutil * delta_cms
// fine Se
//
real TCalc_cesp_cms::calc_perc_util_cesp(const TRectype& salcecms_rec, const TDate& dtinices, const TDate& dtfineces)
{
//prende il codice commessa del record..
TString80 codcms = salcecms_rec.get(SALCECMS_CODCMS);
//..ed accede cosi' alla tabella delle commesse
const TRectype& cms = cache().get("CMS", codcms);
//prende le date di inizio e fine commessa dalla tabella per poterle confrontare con le date limite
//del cespite nell'esercizio
TDate dtfine = dtfineces;
const TDate dtfinecms = cms.get_date("D1");
if ((dtfinecms.ok()) && (dtfinecms < dtfineces))
dtfine = dtfinecms;
TDate dtini = dtinices;
const TDate dtinicms = cms.get_date("D0");
if ((dtinicms.ok()) && (dtinicms > dtinices))
dtini = dtinicms;
//intervallo giorni di utilizzo cespite nella commessa
const real delta_cms = real(dtfine - dtini + 1) / real(dtfineces - dtinices + 1);
//adeesso prende la percentuale di utilizzo del cespite nella commessa..
real percutil = salcecms_rec.get_real(SALCECMS_PERCUTIL);
//normalizza la percentuale...
percutil = percutil / CENTO;
if (!_soloperc)
{
//prende il codice commessa del record..
TString80 codcms = salcecms_rec.get(SALCECMS_CODCMS);
//..ed accede cosi' alla tabella delle commesse
const TRectype& cms = cache().get("CMS", codcms);
//prende le date di inizio e fine commessa dalla tabella per poterle confrontare con le date limite
//del cespite nell'esercizio
TDate dtfine = dtfineces;
//se esiste una data di proroga (D2) -> la data fine commessa e' la data proroga,altrimenti e'
//la normale data fine commessa (D1)
TDate dtfinecms = cms.get_date("D2");
if (!dtfinecms.ok())
dtfinecms = cms.get_date("D1");
if (dtfinecms.ok() && (dtfinecms < dtfineces))
dtfine = dtfinecms;
TDate dtini = dtinices;
const TDate dtinicms = cms.get_date("D0");
if ((dtinicms.ok()) && (dtinicms > dtinices))
dtini = dtinicms;
//intervallo giorni di utilizzo cespite nella commessa
const real delta_cms = real(dtfine - dtini + 1) / real(dtfineces - dtinices + 1);
//...e la porta in giorni rispetto al totale di utilizzo dei giorni del cespite nell'esercizio
//(il 100% sono i giorni di utilizzo del cespite in tutte le commesse dell'esercizio)
percutil *= delta_cms;
percutil *= delta_cms;
}
return percutil;
}
TRiga_documento& TCalc_cesp_cms::cerca_riga(TDocumento& doc_cesp, const TString& idcesp, const TString& codcms) const
{
//deve raggruppare per commessa?
const bool groupcms = _mask->get_bool(F_CMSGROUP);
//se c'e' il flag di raggruppamento per commessa...
if (groupcms)
{
for (int i =1; i < doc_cesp.rows(); i++)
{
TRiga_documento& rigadoc = doc_cesp[i];
if (rigadoc.get(RDOC_CODCMS) == codcms)
return rigadoc; //se esiste gia' una riga con codice cespite e codice commessa correnti
}
}
const TString4 tiporiga = _mask->get(F_TIPORIGA);
TRiga_documento& rigadoc = doc_cesp.new_row(tiporiga);
rigadoc.put(RDOC_CODCMS, codcms);
if (groupcms) //se raggruppa per cms tanto vale mettere la descrizione della commessa
rigadoc.put(RDOC_DESCR, cache().get("CMS", codcms, "S0"));
else //se non raggruppa puo' usare anche il codice cespite, che scrive in codart
{
rigadoc.put(RDOC_CODART, idcesp);
rigadoc.put(RDOC_DESCR, cache().get(LF_CESPI, idcesp, CESPI_DESC));
}
rigadoc.put(RDOC_QTA, 1);
rigadoc.put(RDOC_DATACONS, TDate(TODAY)); //data di elaborazione
rigadoc.put(RDOC_CODIVA, _mask->get(F_CODIVA)); //codice IVA obbligatorio
return rigadoc;
}
void TCalc_cesp_cms::utilizzo_per_cms(const TRectype& ammce_rec)
{
const bool groupcms = _mask->get_bool(F_CMSGROUP);
//totale quote del cespite in esame per l'esercizio corrente (per tutte le commesse)
real qtot = ammce_rec.get_real(AMMCE_QNOR);
qtot += ammce_rec.get_real(AMMCE_QACC);
qtot += ammce_rec.get_real(AMMCE_QANT);
//controllo su date inizio e fine del periodo di utilizzo del cespite nell'esercizio selezionato
if (qtot != ZERO)
{
//controllo su date inizio e fine del periodo di utilizzo del cespite nell'esercizio selezionato
const TString16 idcesp = ammce_rec.get(CESPI_IDCESPITE);
const TRectype& cespi = cache().get(LF_CESPI, idcesp);
const int codcat = cespi.get_int(CESPI_CODCAT);
const TString80 cmsgen(_mask->get(F_CMSGEN));
const TDate dtinies = _mask->get_date(F_INIZIO_ES);
const TDate dtfines = _mask->get_date(F_FINE_ES);
TDate dtfine = dtfines;
const TDate dtalien = cespi.get_date(CESPI_DTALIEN);
if ((dtalien.ok()) && (dtalien < dtfines))
if (dtalien.ok() && (dtalien < dtfines))
dtfine = dtalien;
TDate dtini = dtinies;
const TDate dtfunz = cespi.get_date(CESPI_DTFUNZ);
if ((dtfunz.ok()) && (dtfunz > dtinies))
if (dtfunz.ok() && (dtfunz > dtinies))
dtini = dtfunz;
//..a questo punto dtini e dtfine rappresentano il periodo di utilizzo del cespite
//nell'esercizio selezionato
@ -161,25 +219,36 @@ void TCalc_cesp_cms::utilizzo_per_cms(const TRectype& ammce_rec)
//crea un record array dove memorizzare i record del file salcecms riguardanti il cespite e
//l'esercizio selezionati
//dalla 2.2 sara' possibile sostituire le 5 righe seguenti con le 4 commentate
//TToken_string key;
//key.add(idcesp);
//key.add(current_ese);
//TRecord_array salcecms(key, LF_SALCECMS);
TRecord_array salcecms(LF_SALCECMS, "NRIGA");
TRectype* key = new TRectype(LF_SALCECMS);
key->put("IDCESPITE",idcesp);
key->put("CODES",current_ese);
salcecms.read(key);
const TString4 codnum = _mask->get(F_CODNUM);
const TString4 tiporiga = _mask->get(F_TIPORIGA);
//documento con la categoria del cespite in oggetto, la numerazione indicata sulla maschera,
//l'anno dell'esercizio selezionato; se esiste gia' non lo deve creare ma aggiungervi solo le righe
TDocumento doc_cesp('D', current_ese, codnum, codcat);
const bool doc_exist = doc_cesp.rows() > 0;
if (!doc_exist)
{
doc_cesp.put(DOC_TIPODOC, _mask->get(F_TIPODOC));
doc_cesp.put(DOC_DATADOC, TDate(TODAY));
}
//ciclo su SALCECMS data una chiave idcespite + esercizio (si fa solo se salcecms non e' vuoto,
//e' inutile perdere tempo..)
if (salcecms.rows() > 0)
{
//crea documento relativo al cespite in questione (nell'esercizio);ogni riga del documento
//sara' relativa ad una commessa
const TString4 codnum = _mask->get(F_CODNUM);
const TString4 tipodoc = _mask->get(F_TIPODOC);
const TString4 tiporiga = _mask->get(F_TIPORIGA);
TDocumento doc_cesp('D', current_ese, codnum, atol(idcesp));
doc_cesp.put(DOC_TIPODOC, tipodoc);
doc_cesp.put(DOC_DATADOC, TDate(TODAY));
doc_cesp.body(LF_RIGHEDOC).destroy_rows();
TGeneric_distrib distrib(qtot, TCurrency::get_firm_dec());
int i;
@ -191,38 +260,93 @@ void TCalc_cesp_cms::utilizzo_per_cms(const TRectype& ammce_rec)
//e riempiamo 'sta riga!
for (i=1; i<=salcecms.last_row(); i++ )
{
TRiga_documento& rigadoc = doc_cesp.new_row(tiporiga);
TString80 codcms = salcecms[i].get(SALCECMS_CODCMS);
rigadoc.put(RDOC_CODCMS, codcms); //codice commessa
rigadoc.put(RDOC_QTA, 1);
const real quota = distrib.get();
const TRectype& cms = cache().get("CMS", codcms);
TString80 descr = cms.get("S0"); //descrizione commessa cosi' tanto x mettercela
rigadoc.put(RDOC_DESCR, descr);
rigadoc.put(RDOC_PREZZO, quota); //ammortamento cespite per la commessa
const real perc_cms = salcecms[i].get_real(SALCECMS_PERCUTIL);
rigadoc.put(RDOC_QTAGG1, perc_cms); //% utilizzo cespite nella commessa
rigadoc.put(RDOC_QTAGG2, dtfine - dtini); //giorni di utilizzo cespite nella commessa
rigadoc.put(RDOC_QTAGG3, delta_cesp); //giorni di utilizzo cespite nell'esercizio
real perc = quota * CENTO / qtot; perc.round(2); //percentuale della quota
rigadoc.put(RDOC_QTAGG4, perc);
rigadoc.put(RDOC_DATACONS, TDate(TODAY)); //data di elaborazione
rigadoc.put(RDOC_CODIVA, _mask->get(F_CODIVA)); //codice IVA obbligatorio
//per prima cosa deve sapere se e' da creare o da modificare...
const TString & codcms = salcecms[i].get(SALCECMS_CODCMS); //codice commessa
TRiga_documento& rigadoc = cerca_riga(doc_cesp, idcesp, codcms);
//se c'e' il flag di raggruppamento per commessa...
const real quota = distrib.get();
if (groupcms)
{
real somma = rigadoc.get(RDOC_PREZZO);
somma += quota;
rigadoc.put(RDOC_PREZZO, somma); //ammortamento cespite per la commessa
}
else
{
rigadoc.put(RDOC_PREZZO, quota); //ammortamento cespite per la commessa
const real perc_cms = salcecms[i].get_real(SALCECMS_PERCUTIL);
rigadoc.put(RDOC_QTAGG1, perc_cms); //% utilizzo cespite nella commessa
rigadoc.put(RDOC_QTAGG2, dtfine - dtini); //giorni di utilizzo cespite nella commessa
rigadoc.put(RDOC_QTAGG3, delta_cesp); //giorni di utilizzo cespite nell'esercizio
real perc = quota * CENTO / qtot; perc.round(2); //percentuale della quota
rigadoc.put(RDOC_QTAGG4, perc);
}
}
//scrittura del documento sul file
doc_cesp.write();
doc_cesp.write();
}//fine if (salcecms.rows()>0)
else
{
if (cmsgen.not_empty())
{
TRiga_documento& rigadoc = cerca_riga(doc_cesp, idcesp, cmsgen);
//se c'e' il flag di raggruppamento per commessa...
if (groupcms)
{
real somma = rigadoc.get(RDOC_PREZZO);
somma += qtot;
rigadoc.put(RDOC_PREZZO, somma); //ammortamento cespite per la commessa
}
else
rigadoc.put(RDOC_PREZZO, qtot); //ammortamento cespite per la commessa
doc_cesp.write();
}
}
}//fine if(qtot!=0)
}
void TCalc_cesp_cms::delete_cespi_docs()
{
const int anno = _mask->get_int(F_ESERCIZIO);
const TString& codnum = _mask->get(F_CODNUM);
TRelation rel_doc(LF_DOC);
TRectype& rec = rel_doc.curr();
rec.put(DOC_PROVV, "D");
rec.put(DOC_ANNO, anno);
rec.put(DOC_CODNUM, codnum);
TCursor cur_doc (&rel_doc, "", 1, &rec, &rec);
const long items = cur_doc.items();
cur_doc.freeze();
TProgind progind(items, "Eliminazione vecchi documenti in corso...", false, true);
for (cur_doc=0; cur_doc.pos()<items; ++cur_doc)
{
progind.addstatus(1);
TDocumento doc(rec);
doc.remove();
}
}
void TCalc_cesp_cms::elabora_docs()
{
//deve accoppare tutti i documenti con ANNO e NUM che trova nella maschera
delete_cespi_docs();
TRectype darec(LF_AMMCE),arec(LF_AMMCE);
const int esercizio = _mask->get_int(F_ESERCIZIO);
darec.put(AMMCE_IDCESPITE, _mask->get(F_DA_IDCESPITE));
arec.put(AMMCE_IDCESPITE, _mask->get(F_A_IDCESPITE));
const TString80 da_cespite(_mask->get(F_DA_IDCESPITE));
const TString80 a_cespite(_mask->get(F_A_IDCESPITE));
if (!da_cespite.empty())
darec.put(AMMCE_IDCESPITE, da_cespite);
if (!a_cespite.empty())
arec.put(AMMCE_IDCESPITE, a_cespite);
TString filtro;
filtro.format("(CODES==%d)&&(TPSALDO==2)&&(TPAMM==1)",esercizio);
@ -230,10 +354,11 @@ void TCalc_cesp_cms::elabora_docs()
TCursor cur(&rel, filtro, 1, &darec, &arec);
const long items = cur.items();
cur.freeze();
TProgind progind(items, "Elaborazione documenti in corso...", false, true);
//ciclo sui cespiti di AMMCE nel codes selezionato
for (cur=0; cur.pos()<items; ++cur)
{
progind.addstatus(1);
utilizzo_per_cms(cur.curr());
}
}
@ -273,6 +398,7 @@ bool TCalc_cesp_cms::create()
_mask->set(F_TIPODOC, config_doc.get("TIPODOC"));
_mask->set(F_TIPORIGA, config_doc.get("TIPORIGA"));
_mask->set(F_CODIVA, config_doc.get("CODIVA"));
_mask->set(F_CMSGEN, config_doc.get("CMSGEN"));
return TSkeleton_application::create();
}
@ -290,6 +416,7 @@ void TCalc_cesp_cms::main_loop()
while (k != K_QUIT)
{
k = _mask->run();
_soloperc = _mask->get_bool(F_SOLOPERC);
switch (k)
{
@ -314,4 +441,3 @@ int ce4200(int argc, char* argv[])
a.run(argc,argv,TR("Calcolo e stampa cespiti per commessa"));
return 0;
}

View File

@ -5,11 +5,12 @@
#define FR_DATAINIZIO 14
#define FR_DATAFINE 15
#define FR_B_IDCESPITE 16
#define FR_B_DESCRCESPITE 17
#define FR_B_CATEGORIA 16
#define FR_B_DESCRCAT 17
#define FR_B_CODCMS 18
#define FR_B_DESC 19
#define FR_B_PERC 20
#define FR_B_VALAMM 21
#define FR_B_TOTVALAMM 22
#define FR_B_TOTPERC 23
#define FR_B_IDCESP 19
#define FR_B_DESC 20
#define FR_B_PERC 21
#define FR_B_VALAMM 22
#define FR_B_TOTVALAMM 23
#define FR_B_TOTPERC 24

View File

@ -7,12 +7,12 @@ END
//-----------------------parte grafica con le righe di separazione-------------------
SECTION GRAPHICS ODD
LINEA -1 80 1
LINEA -1 120 1
BEGIN
PROMPT 1 4 "@b"
PROMPT 1 4 ""
END
LINEA -1 80 1
LINEA -1 120 1
BEGIN
PROMPT 1 7 "@b"
END
@ -61,8 +61,8 @@ SECTION HEADER ODD 8
STRINGA -1
BEGIN
KEY "codice cespite"
PROMPT 1 5 "@bCespite"
KEY "codice categoria"
PROMPT 1 5 "@bCategoria"
END
STRINGA -1
@ -71,16 +71,28 @@ SECTION HEADER ODD 8
PROMPT 5 6 "@bCommessa"
END
STRINGA -1
BEGIN
KEY "codice cespite"
PROMPT 26 6 "@bCespite"
END
STRINGA -1
BEGIN
KEY "descrizione cespite"
PROMPT 37 6 ""
END
STRINGA -1
BEGIN
KEY "percentuale ammortizzata"
PROMPT 59 6 "@bPerc."
PROMPT 89 6 "@bPerc."
END
STRINGA -1
BEGIN
KEY "valore ammortizzato"
PROMPT 75 6 "@bQuota"
PROMPT 114 6 "@bQuota"
END
END
@ -91,23 +103,23 @@ END
//-----------------------riga tipo uno---------------------------------------------------//
SECTION BODY ODD 3
NUMERO FR_B_IDCESPITE 10
NUMERO FR_B_CATEGORIA 2
BEGIN
KEY "idcespite"
KEY "codice categoria"
PROMPT 1 1 ""
PICTURE "@@@@@@@@@@"
MESSAGE RESET,FR_B_TOTVALAMM|RESET,FR_B_TOTPERC
PICTURE "@@"
MESSAGE RESET,FR_B_TOTVALAMM //|RESET,FR_B_TOTPERC
FIELD NDOC
END
STRINGA FR_B_DESCRCESPITE 50
STRINGA FR_B_DESCRCAT 50
BEGIN
KEY "descrizione cespite"
KEY "descrizione categoria"
PROMPT 12 1 ""
MESSAGE _DESCRCESPITE
MESSAGE _DESCRCAT
END
SECTION TOTALE_CESPITE 2 1 1 FILE LF_RIGHEDOC GROUP LF_RIGHEDOC->NDOC
SECTION TOTALE_CATEGORIA 2 1 1 FILE LF_RIGHEDOC GROUP LF_RIGHEDOC->NDOC
STRINGA FR_B_CODCMS 20
BEGIN
@ -116,30 +128,37 @@ SECTION BODY ODD 3
FIELD LF_RIGHEDOC->CODCMS
END
STRINGA FR_B_IDCESP 10
BEGIN
KEY "idcespite"
PROMPT 26 1 ""
FIELD LF_RIGHEDOC->CODART
END
STRINGA FR_B_DESC 30
BEGIN
KEY "descrizione commessa"
PROMPT 26 1 ""
KEY "descrizione cespite"
PROMPT 37 1 ""
FIELD LF_RIGHEDOC->DESCR
END
NUMERO FR_B_PERC 6 2
BEGIN
KEY "percentuale"
PROMPT 58 1 ""
PROMPT 88 1 ""
FIELD LF_RIGHEDOC->QTAGG4
MESSAGE ADD,FR_B_TOTPERC
// MESSAGE ADD,FR_B_TOTPERC
END
VALUTA FR_B_VALAMM 15
BEGIN
KEY "valamm"
PROMPT 66 1 ""
PROMPT 104 1 ""
FIELD LF_RIGHEDOC->PREZZO
MESSAGE ADD,FR_B_TOTVALAMM
END
END //end section totale_cespite
END //end section totale_categoria
STRINGA -1
BEGIN
@ -147,16 +166,16 @@ SECTION BODY ODD 3
PROMPT 26 2 "@bTotali"
END
NUMERO FR_B_TOTPERC 6 2
BEGIN
KEY "totale percentuale"
PROMPT 58 2 "@b"
END
/* NUMERO FR_B_TOTPERC 6 2
BEGIN
KEY "totale percentuale"
PROMPT 88 2 "@b"
END*/
VALUTA FR_B_TOTVALAMM 15
BEGIN
KEY "totale valamm"
PROMPT 66 2 "@b"
PROMPT 104 2 "@b"
END
END
@ -165,10 +184,9 @@ END
//-------------------------pie' di pagina------------------------------------------------//
SECTION FOOTER ODD 3
STRINGA -1
BEGIN
KEY "separatore"
PROMPT 1 1 "______________________________________________________________________________"
LINEA -1 120 1
BEGIN
PROMPT 1 1 ""
END
DATA -1

View File

@ -17,5 +17,7 @@
#define F_DESTIPORIGA 216
#define F_CODIVA 217
#define F_DESIVA 218
#define F_SOLOPERC 219
#define F_CMSGEN 220
#define F_DESCMSGEN 221
#define F_CMSGROUP 222

View File

@ -1,6 +1,7 @@
[Main]
CODNUM =
TIPODOC =
TIPORIGA =
CODIVA =
CODNUM=
TIPODOC=
TIPORIGA=
CODIVA=
CMSGEN=

View File

@ -192,6 +192,48 @@ BEGIN
FLAGS "D"
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 0 14 "@bCommessa spese generali"
END
STRING F_CMSGEN 20
BEGIN
PROMPT 1 15 "Codice Commessa "
FLAGS "DUZ"
KEY 1
USE CMS
INPUT CODTAB F_CMSGEN
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CMSGEN CODTAB
OUTPUT F_DESCMSGEN S0
CHECKTYPE NORMAL
END
STRING F_DESCMSGEN 50
BEGIN
PROMPT 1 16 "Descrizione "
FLAGS "D"
KEY 2
USE CMS KEY 2
INPUT S0 F_DESCMSGEN
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_CMSGEN
CHECKTYPE NORMAL
END
BOOLEAN F_SOLOPERC
BEGIN
PROMPT 1 18 "Utilizza solo le percentuali nel calcolo"
END
BOOLEAN F_CMSGROUP
BEGIN
PROMPT 1 19 "Raggruppamento per commessa"
END
ENDPAGE
ENDMASK

View File

@ -58,7 +58,7 @@ Caption = "Tabelle ditta"
Picture = <ce00>
Module = 11
Flags = ""
Item_01 = "Parametri ditta", "ce0 -3 p", ""
Item_01 = "Parametri ditta", "ce0 -3", ""
Item_02 = "Localizzazioni", "ce0 -0 loc", ""
Item_03 = "Impianti", "ce0 -0 cim" , ""
Item_04 = "Esercizi", "ce0 -0 cce", "F"

View File

@ -337,39 +337,42 @@ bool TClifo_application::rsoc_handler(TMask_field& f, KEY k)
HIDDEN bool alleg_handler(TMask_field& f, KEY key)
{
if (f.to_check(key))
{
TMask& m = f.mask();
const int tipoall = atoi(f.get());
if (key == K_ENTER)
{
TMask& m = f.mask();
const int tipoall = atoi(f.get());
if (tipoall == 0 || tipoall == 1 || tipoall == 4)
m.enable(F_CODALLEG);
else
{
m.disable(F_CODALLEG);
m.reset(F_CODALLEG);
m.reset(F_RAGSOCALLEG);
}
m.set(F_OCCASIONALE, (tipoall == 2) ? "X" : " ");
m.field(F_COFI).set_dirty(TRUE);
m.field(F_PAIV).set_dirty(TRUE);
}
return TRUE;
}
if (m.get_bool(F_OCCASIONALE))
{
if (tipoall != 2 && tipoall != 6)
return f.error_box("Tipo allegato %d errato per gli occasionali", tipoall);
}
else
{
if (tipoall == 2)
return f.error_box("Tipo allegato %d errato per i non occasionali", tipoall);
}
}
else
if (f.to_check(key, TRUE))
{
TMask& m = f.mask();
const int tipoall = atoi(f.get());
HIDDEN bool occas_handler(TMask_field& f, KEY key)
{
if (f.to_check(key))
{
const bool occas = f.get().not_empty();
TMask& m = f.mask();
if (occas)
m.set(F_ALLEG, "2");
else
if (m.get_int(F_ALLEG) == 2)
m.reset(F_ALLEG);
}
m.field(F_COMCF).check_type(tipoall == 6 ? CHECK_REQUIRED : CHECK_NORMAL);
if (tipoall == 0 || tipoall == 1 || tipoall == 4 || tipoall == 6)
m.enable(F_CODALLEG);
else
{
m.disable(F_CODALLEG);
m.reset(F_CODALLEG);
m.reset(F_RAGSOCALLEG);
}
if (tipoall < 6)
m.set(F_OCCASIONALE, (tipoall == 2) ? "X" : " ");
m.field(F_COFI).set_dirty(TRUE);
m.field(F_PAIV).set_dirty(TRUE);
}
return TRUE;
}
@ -829,7 +832,6 @@ bool TClifo_application::user_create() // initvar e arrmask
_msk = new TMask("cg0200a") ;
_msk->set_handler(F_TIPOCF, tipocf_handler);
_msk->set_handler(F_OCCASIONALE, occas_handler);
_msk->set_handler(F_COFI, cofi_handler);
_msk->set_handler(F_PAIV, paiv_handler);
_msk->set_handler(F_CODANAGPER, percip_handler);

View File

@ -305,6 +305,7 @@ ITEM "2|Cliente/Fornitore occasionale"
ITEM "3|Documenti riepilogativi"
ITEM "4|Clienti/Fornitori con codici fiscali gia' inseriti"
ITEM "5|Cliente/Fornitore estero"
ITEM "6|Cliente/Fornitore privato"
OUTPUT F_ALLEG
END
@ -335,7 +336,6 @@ BEGIN
PROMPT 2 17 "Occasionale "
FIELD OCCAS
HELP "Indicare se si tratta di un C/F occasionale"
MESSAGE TRUE "2",F_ALLEG
END
BOOLEAN F_SOSPESO

View File

@ -2174,20 +2174,20 @@ void TStampa_IVdirettiva::stampa_risultato_prima_delle_imposte()
// _totale_economico += _sale; // Guy was here 18/02/2004: Altrimenti ignora la prima imposta
// Guy was here 05/03/2004: La prima imposta e' gia' stata sommata
// const real te = _totale_economico -_sale;
const real te = _totale_economico -_sale;
// Guy was here 08/06/2004: Nuova moda non capibile
const real te = _totale_economico;
//const real te = _totale_economico;
set_row (_i,"@4g%s@81g%r", TR("Risultato prima delle imposte"), &te);
if (raff)
{
// Guy was here 10/03/2004: La prima imposta e' gia' stata sommata anche qui
// const real te = _totale_economico_raf -_salerafr;
const real te = _totale_economico_raf -_salerafr;
// Guy was here 08/06/2004: Nuova moda non capibile
const real te = _totale_economico_raf;
//const real te = _totale_economico_raf;
set_row (_i,"@111g%r", &te);
}

View File

@ -641,7 +641,7 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
TCurrency euro(imptot.valore(), codval);
TString msg(255);
if (codval.not_empty())
if (is_true_value(codval))
msg << TR("Il totale documento in valuta") << ' ' << codval;
else
msg << TR("Il totale documento inserito");
@ -692,7 +692,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
const long numreg = m.insert_mode() ? NUMREG_PROVVISORIO : m.get_long(F_NUMREG);
const bool in_valuta = m.get(SK_VALUTA).not_empty();
const bool in_valuta = is_true_value(m.get(SK_VALUTA));
TImporto saldaconto, saldaconto_val;
TSheet_field& cg = a.cgs();

View File

@ -597,6 +597,7 @@ public:
const char* i, int tipodet = 0, bool create = FALSE);
bool look_pum(int m, const char* a, bool create = FALSE);
bool look_pam(int m, const char* a, bool create = FALSE);
bool look_pem(TTable & pem, int codreg);
bool look_pom(int m, const char* a, bool create = FALSE);
bool look_plm(int m, const char* a, bool create = FALSE);
bool look_pia(int m, const char* a, const char* cod1, const char* cod2, bool create = FALSE);

View File

@ -18,6 +18,9 @@
#include <rmoviva.h>
#include <pconti.h>
#include <utility.h>
#include <clifo.h>
#include <occas.h>
#include <comuni.h>
// -------------------- QUI comincia l'avventura --------------------------
// Datemi un punto di appoggio ******************
@ -577,8 +580,13 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
real acquisti_cd2_4 = 0.0; // intra
real oroargento_cd3_1 = 0.0; // imponibile acquisto oro e argento
real oroargento_cd3_2 = 0.0; // imposta acquisto oro e argento
real rottami_cd3_3 = ZERO; // imponibile acquisto rottami
real rottami_cd3_4 = ZERO; // imposta acquisto rottami
real esni_rimb = 0.0; // ci sommo tutti esenti e ni validi per rimborso
real vt_imponibile[23];
real vt_imposta[23];
real esni_rimb = 0.0; // ci sommo tutti esenti e ni validi per rimborso
real corr_CEE = 0.0;
real corr_noCEE = 0.0;
real acq_CEE = 0.0;
@ -616,7 +624,13 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
real agr_imp = 0.0;
real agr_iva = 0.0;
// Nel seguente assoc, vengono memorizzati gli acquisti iva registrati quest'anno
for (int j = 0; j < 23; j++)
{
vt_imponibile[j] = ZERO;
vt_imposta[j] = ZERO;
}
// Nel seguente assoc, vengono memorizzati gli acquisti iva registrati quest'anno
// ma con anno documento precedente. Di conseguenza per un corretto calcolo prorata
// e' necessario distinguire gli importi, appunto, per anno.
// Questo nuovo calcolo prorata, vale solo per gli anni oltre il 1998.
@ -834,48 +848,95 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
if (month == 13 && !fattrit)
{
const TString& iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11");
if (tipomov == vendita)
{
const long codcf = _mov->get_long(MOV_CODCF);
if (tipoiva.empty() && codcf != 0)
{
TString8 key(_mov->get(MOV_TIPO)); key << "|" << codcf;
const TRectype & clifo = cache().get(LF_CLIFO, key);
int codreg = 0; // codice regione x privati 22 == partite iva 0 == senza codice
const int tipoalleg = clifo.get_int(CLI_ALLEG);
if (tipoalleg == 6) // privato
{
if (clifo.get_bool(CLI_OCCAS))
{
const TString80 key_occ(_mov->get(MOV_OCFPI));
const TRectype & occas = cache().get(LF_OCCAS, key_occ);
key = occas.get(OCC_STATO);
key << "|" << occas.get(OCC_COM);
}
else
{
key = clifo.get(CLI_STATOCF);
key << "|" << clifo.get(CLI_COMCF);
}
const TRectype & comune = cache().get(LF_COMUNI, key);
codreg = comune.get_int(COM_CODREG) + 1;
}
vt_imponibile[codreg] += imponibile;
vt_imposta[codreg] += imposta;
}
}
if (iva_vpn.not_empty())
{
switch (tipomov)
{
case vendita: // CD1 - 1 2 3 4
if (!corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) &&
sosp_imp != normale && sosp_imp != liquidazione)
{
cessioni_cd1_1 += imponibile;
if (!cau_intra)
{
if (iva_vpn == "CD12")
cessioni_cd1_2 += imponibile; else
if (iva_vpn == "CD13")
cessioni_cd1_3 += imponibile;
}
else
{
if (iva_vpn == "CD14")
cessioni_cd1_4 += imponibile;
}
}
{
if (!corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) &&
sosp_imp != normale && sosp_imp != liquidazione)
{
cessioni_cd1_1 += imponibile;
if (!cau_intra)
{
if (iva_vpn == "CD12")
cessioni_cd1_2 += imponibile; else
if (iva_vpn == "CD13")
cessioni_cd1_3 += imponibile;
}
else
{
if (iva_vpn == "CD14")
cessioni_cd1_4 += imponibile;
}
}
}
break;
case acquisto: // CD2 - 1 2 3 4
acquisti_cd2_1 += imponibile;
if (!cau_intra)
{
if (iva_vpn == "CD22")
acquisti_cd2_2 += imponibile; else
if (iva_vpn == "CD23")
acquisti_cd2_3 += imponibile;
}
else
{
if (iva_vpn == "CD24")
acquisti_cd2_4 += imponibile;
}
if (iva_vpn == "CD3")
{
oroargento_cd3_1 += imponibile;
oroargento_cd3_2 += imposta;
}
{
acquisti_cd2_1 += imponibile;
if (!cau_intra)
{
if (iva_vpn == "CD22")
acquisti_cd2_2 += imponibile; else
if (iva_vpn == "CD23")
acquisti_cd2_3 += imponibile;
}
else
{
if (iva_vpn == "CD24")
acquisti_cd2_4 += imponibile;
}
if (iva_vpn == "CD31")
{
oroargento_cd3_1 += imponibile;
oroargento_cd3_2 += imposta;
}
if (iva_vpn == "CD33")
{
rottami_cd3_3 += imponibile;
rottami_cd3_4 += imposta;
}
}
break;
default:
break;
@ -1808,6 +1869,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
_pum->put("R21", acquisti_cd2_4);
_pum->put("R22", oroargento_cd3_1);
_pum->put("R23", oroargento_cd3_2);
_pum->put("R24", rottami_cd3_3);
_pum->put("R25", rottami_cd3_4);
_pam->put("R0", acquisti);
_pam->put("R1", vendite);
_pam->put("R6", assp_imp);
@ -1825,6 +1888,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
_pam->rewrite();
_pum->rewrite();
_pom->rewrite();
TTable pem("PEM");
for (int reg = 0; reg < 23; reg++)
{
look_pem(pem, reg);
pem.put("R0", vt_imponibile[reg]);
pem.put("R1", vt_imposta[reg]);
pem.rewrite();
}
}
}

View File

@ -433,6 +433,22 @@ bool TLiquidazione_app::look_pum(int m, const char* a, bool create)
return ok;
}
bool TLiquidazione_app::look_pem(TTable & pem, int codreg)
{
TString8 key;
key.format("%04d%02d", atoi((const char *) _year), codreg);
pem.put("CODTAB", key);
pem.read();
if (!pem.good())
{
pem.zero();
pem.put("CODTAB", key);
pem.write();
}
return ok;
}
bool TLiquidazione_app::look_pom(int m, const char* a, bool create)
{
bool ok = FALSE;

View File

@ -22,6 +22,8 @@ int main(int argc,char** argv)
cg5600(argc,argv); break; // Ripristino liquidazione
case 7:
cg5700(argc,argv); break; // Dichiarazione periodica
case 8:
cg5800(argc,argv); break; // Quadro VT
default:
cg5000(argc,argv); break; // Parametri Studio
}

View File

@ -6,3 +6,4 @@ int cg5400 (int argc, char* argv[]);
int cg5500 (int argc, char* argv[]);
int cg5600 (int argc, char* argv[]);
int cg5700 (int argc, char* argv[]);
int cg5800 (int argc, char* argv[]);

View File

@ -301,6 +301,8 @@ void TDich_periodica_iva_mask::read_iva_data()
real cd2_4 = ZERO;
real cd3_1 = ZERO;
real cd3_2 = ZERO;
real cd3_3 = ZERO;
real cd3_4 = ZERO;
TRelation relpum("PUM");
TRectype & pum = relpum.curr();
@ -331,13 +333,15 @@ void TDich_periodica_iva_mask::read_iva_data()
cd2_4 += pum.get_real("R21");
cd3_1 += pum.get_real("R22");
cd3_2 += pum.get_real("R23");
cd3_3 += pum.get_real("R24");
cd3_4 += pum.get_real("R25");
}
}
// Arrotondare tutto all'Euro
cd1_1.round(); cd1_2.round(); cd1_3.round(); cd1_4.round();
cd2_1.round(); cd2_2.round(); cd2_3.round(); cd2_4.round();
cd3_1.round(); cd3_2.round();
cd3_1.round(); cd3_2.round(); cd3_3.round(); cd3_3.round();
const real rettifica = lim.get_real("R5"); // Rettifiche
@ -345,7 +349,6 @@ void TDich_periodica_iva_mask::read_iva_data()
if (rettifica > ZERO)
cd4 += rettifica;
cd4 += cd3_2; // Sommo anche imposta su oro, argento e birra
cd4.round();
real cd5 = lam.get_real("R1"); // Iva che si detrae per il periodo
@ -362,7 +365,7 @@ void TDich_periodica_iva_mask::read_iva_data()
set(F_CD1_1, cd1_1); set(F_CD1_2, cd1_2); set(F_CD1_3, cd1_3); set(F_CD1_4, cd1_4);
set(F_CD2_1, cd2_1); set(F_CD2_2, cd2_2); set(F_CD2_3, cd2_3); set(F_CD2_4, cd2_4);
set(F_CD3_1, cd3_1); set(F_CD3_2, cd3_2);
set(F_CD3_1, cd3_1); set(F_CD3_2, cd3_2); set(F_CD3_3, cd3_3); set(F_CD3_4, cd3_4);
set(F_CD4, cd4); set(F_CD5, cd5);
set(F_CD6_1, cd6_1); set(F_CD6_2, cd6_2);
}
@ -391,6 +394,9 @@ void TDich_periodica_iva_mask::print_prospect()
frm.find_field('B', odd_page, FF_CD3_1).set(get(F_CD3_1));
frm.find_field('B', odd_page, FF_CD3_2).set(get(F_CD3_2));
frm.find_field('B', odd_page, FF_CD3_3).set(get(F_CD3_3));
frm.find_field('B', odd_page, FF_CD3_4).set(get(F_CD3_3));
frm.find_field('B', odd_page, FF_CD4).set(get(F_CD4));
frm.find_field('B', odd_page, FF_CD5).set(get(F_CD5));
@ -489,6 +495,6 @@ void TDich_periodica_iva_app::main_loop()
int cg5700(int argc, char* argv[])
{
TDich_periodica_iva_app a;
a.run(argc, argv, TR("Comunicazione annuale IVA"));
a.run(argc, argv, TR("Comunicazione annuale dati IVA"));
return 0;
}

View File

@ -12,10 +12,12 @@
#define F_CD2_4 112
#define F_CD3_1 113
#define F_CD3_2 114
#define F_CD4 115
#define F_CD5 116
#define F_CD6_1 117
#define F_CD6_2 118
#define F_CD3_3 115
#define F_CD3_4 116
#define F_CD4 117
#define F_CD5 118
#define F_CD6_1 119
#define F_CD6_2 120
#define FF_YEAR 101
#define FF_CODDITTA 102
@ -30,7 +32,9 @@
#define FF_CD2_4 112
#define FF_CD3_1 113
#define FF_CD3_2 114
#define FF_CD4 115
#define FF_CD5 116
#define FF_CD6_1 117
#define FF_CD6_2 118
#define FF_CD3_3 115
#define FF_CD3_4 116
#define FF_CD4 117
#define FF_CD5 118
#define FF_CD6_1 119
#define FF_CD6_2 120

View File

@ -258,60 +258,88 @@ END
STRINGA -1
BEGIN
PROMPT 2 31 "______________________________________________________________________________"
KEY "CD3 - Descrizione"
PROMPT 2 31 "@b-Rottami e altri materiali di recupero-"
END
STRINGA -1
BEGIN
PROMPT 2 32 "@bCD3@r Imponibile"
END
VALUTA FF_CD3_3 18
BEGIN
KEY "CD3_1 - Imponibile"
PROMPT 20 33 "@b"
END
STRINGA -1
BEGIN
PROMPT 50 32 "@rImposta"
END
VALUTA FF_CD3_4 18
BEGIN
KEY "CD3_2 - Imposta "
PROMPT 60 33 "@b"
END
STRINGA -1
BEGIN
PROMPT 2 34 "______________________________________________________________________________"
END
STRINGA -1
BEGIN
KEY "IVA esigibile"
PROMPT 2 32 "@bCD4@r IVA esigibile"
PROMPT 2 35 "@bCD4@r IVA esigibile"
END
VALUTA FF_CD4 18
BEGIN
KEY "IVA esigibile"
PROMPT 20 32 "@b"
PROMPT 20 35 "@b"
END
STRINGA -1
BEGIN
KEY "IVA esigibile"
PROMPT 2 34 "@bCD5@r IVA detratta"
PROMPT 2 37 "@bCD5@r IVA detratta"
END
VALUTA FF_CD5 18
BEGIN
KEY "CD5 - IVA detratta"
PROMPT 60 34 "@b"
PROMPT 60 37 "@b"
END
STRINGA -1
BEGIN
KEY "CD6_1 - IVA dovuta"
PROMPT 2 36 "@bCD6@r IVA dovuta"
PROMPT 2 39 "@bCD6@r IVA dovuta"
END
VALUTA FF_CD6_1 18
BEGIN
KEY "CD6_1 - IVA dovuta"
PROMPT 20 36 "@b"
PROMPT 20 39 "@b"
END
STRINGA -1
BEGIN
KEY "CD6_2 - IVA a credito"
PROMPT 50 36 "@ro a credito"
PROMPT 49 39 "@ro a credito"
END
VALUTA FF_CD6_2 18
BEGIN
KEY "CD6_2 - IVA a credito"
PROMPT 60 36 "@b"
PROMPT 60 39 "@b"
END
STRINGA -1
BEGIN
PROMPT 2 37 "______________________________________________________________________________"
PROMPT 2 40 "______________________________________________________________________________"
END
END

View File

@ -1,6 +1,6 @@
#include "cg5700.h"
PAGE "Dichiarazione periodica" -1 -1 72 8
PAGE "Comunicazione Annuale dati IVA" -1 -1 72 8
NUMBER F_YEAR 4
BEGIN

View File

@ -15,7 +15,7 @@ END
ENDPAGE
PAGE "Pag.1" -1 -1 78 20
PAGE "Comunicazione annuale dati IVA" -1 -1 78 20
GROUPBOX DLG_NULL 79 4
BEGIN
@ -105,27 +105,44 @@ BEGIN
FLAGS "D"
END
TEXT -1
BEGIN
PROMPT 1 16 "@bRottami e altri materiali di recupero "
END
CURRENCY F_CD3_3 18
BEGIN
PROMPT 1 17 "CD3 Imponibile "
FLAGS "D"
END
CURRENCY F_CD3_4 18
BEGIN
PROMPT 52 17 "Imposta "
FLAGS "D"
END
CURRENCY F_CD4 18
BEGIN
PROMPT 1 17 "CD4 Iva esigibile "
PROMPT 1 19 "CD4 Iva esigibile "
FLAGS "D"
END
CURRENCY F_CD5 18
BEGIN
PROMPT 1 18 "CD5 Iva detraibile "
PROMPT 1 20 "CD5 Iva detraibile "
FLAGS "D"
END
CURRENCY F_CD6_1 18
BEGIN
PROMPT 1 19 "CD6 IVA dovuta "
PROMPT 1 21 "CD6 IVA dovuta "
FLAGS "D"
END
CURRENCY F_CD6_2 18
BEGIN
PROMPT 48 19 "o a credito "
PROMPT 48 21 "o a credito "
FLAGS "D"
END

354
cg/cg5800.cpp Executable file
View File

@ -0,0 +1,354 @@
// Programma per la gestione e la stampa della dichiarazione periodica IVA
#include <applicat.h>
#include <automask.h>
#include <currency.h>
#include <form.h>
#include <prefix.h>
#include <recarray.h>
#include <sheet.h>
#include <tabutil.h>
#include <nditte.h>
#include "cg5800.h"
#include "cglib03.h"
class TQuadro_VT_selfirm_mask : public TAutomask
{
TArray_sheet * _ditte;
TString_array _nomiditte;
int _year;
protected:
bool select_button();
void build_nomiditte();
void build_ditte_sheet();
public:
const int get_year() const { return _year; }
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
TQuadro_VT_selfirm_mask();
virtual ~TQuadro_VT_selfirm_mask();
};
TQuadro_VT_selfirm_mask::TQuadro_VT_selfirm_mask() : TAutomask("cg5800a")
{
_ditte = new TArray_sheet(-1, -1, -4, -4, TR("Selezione Ditte"),
HR("Cod.@5|Ragione Sociale@50"));
TDate oggi(TODAY);
_year = oggi.year();
build_nomiditte();
build_ditte_sheet();
}
TQuadro_VT_selfirm_mask::~TQuadro_VT_selfirm_mask()
{
delete _ditte;
}
void TQuadro_VT_selfirm_mask::build_nomiditte()
{
TString cod;
TRelation relditte(LF_NDITTE);
TRectype & ditta = relditte.lfile().curr();
TCursor cur(&relditte);
const TRecnotype items = cur.items();
cur.freeze();
_nomiditte.destroy();
for (cur = 0L; cur.pos() < items; ++cur)
{
const long codditta = ditta.get_long("CODDITTA");
bool good = prefix().exist(codditta);
if (good)
{
TToken_string* d = new TToken_string(64);
d->add(codditta);
d->add(ditta.get("RAGSOC"));
_nomiditte.add(d);
}
}
}
void TQuadro_VT_selfirm_mask::build_ditte_sheet()
{
_ditte->destroy();
long prima = -1;
for (int i = 0; i < _nomiditte.items(); i++)
{
TToken_string* d = new TToken_string(_nomiditte.row(i));
const long pos = _ditte->add(d);
const char vers = d->get_char(2);
const bool selectable = vers != '?';
_ditte->enable_row(pos, selectable);
if (selectable && prima < 0)
_ditte->select(prima = pos);
}
}
bool TQuadro_VT_selfirm_mask::select_button()
{
if (_ditte->run() == K_ENTER)
{
TToken_string& row = _ditte->row(_ditte->selected());
set(F_CODDITTA, row.get(0));
set(F_RAGSOC, row.get(1));
return TRUE;
}
return FALSE;
}
bool TQuadro_VT_selfirm_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_CODDITTA:
if (e == fe_button)
return select_button();
if (e == fe_modify)
{
bool found = FALSE;
TString16 ditta = o.get();
for (int i = 0; i < _ditte->items(); i++)
{
TToken_string& row = _ditte->row(i);
if (ditta == row.get(0))
{
if (_ditte->row_enabled(i))
{
set(F_CODDITTA, row.get(0));
set(F_RAGSOC, row.get(1));
found = TRUE;
}
else
{
warning_box(FR("Non sono definiti i parametri liquidazione per la ditta %ld"),
atol(ditta));
o.reset();
}
break;
}
}
if (!found)
o.reset();
return found;
}
break;
case F_RAGSOC:
if (e == fe_button)
return select_button();
if (e == fe_modify)
{
bool found = FALSE;
TString16 ditta = o.get();
for (int i = 0; i < _ditte->items(); i++)
{
TToken_string& row = _ditte->row(i);
TString ts(row.get(1));
if (ts.find(ditta) != -1)
{
if (_ditte->row_enabled(i))
{
set(F_CODDITTA, row.get(0));
set(F_RAGSOC, row.get(1));
found = TRUE;
break;
}
}
}
if (!found) o.reset();
return found;
}
break;
case F_YEAR:
if (e == fe_modify)
{
_year = atoi(o.get());
build_nomiditte();
build_ditte_sheet();
set(F_CODDITTA, "");
set(F_RAGSOC, "");
}
break;
default:
break;
}
return TRUE;
}
class TQuadro_VT_iva_form : public TForm
{
public:
TQuadro_VT_iva_form() : TForm("cg5800a") {};
virtual ~TQuadro_VT_iva_form() {};
};
class TQuadro_VT_iva_mask : public TAutomask
{
TQuadro_VT_selfirm_mask * _sf;
protected:
void read_iva_data();
public:
void set_prospect();
void print_prospect();
virtual bool on_key(KEY k) { return TAutomask::on_key(k);}
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly) { return TRUE;}
TQuadro_VT_iva_mask(TQuadro_VT_selfirm_mask *m) : TAutomask("cg5800b") {_sf = m;}
virtual ~TQuadro_VT_iva_mask() {};
};
void TQuadro_VT_iva_mask::read_iva_data()
{
TTable pem("PEM");
real tprimp, tpriva, timp, tiva;
TString16 key;
key.format("%04d00", _sf->get_year());
pem.put("CODTAB", key);
int err = pem.read();
if (err == NOERR)
{
set(F_TOTIVIMP, pem.get("R0"));
set(F_TOTIVIVA, pem.get("R1"));
timp += pem.get_real("R0");
tiva += pem.get_real("R1");
for (int codreg = 1;codreg < 23; codreg++)
{
key.format("%04d%02d", _sf->get_year(), codreg);
pem.put("CODTAB", key);
err = pem.read();
if (err == NOERR)
{
set(F_REGIMP(codreg - 1), pem.get("R0"));
set(F_REGIVA(codreg - 1), pem.get("R1"));
tprimp += pem.get_real("R0");
tpriva += pem.get_real("R1");
timp += pem.get_real("R0");
tiva += pem.get_real("R1");
}
}
set(F_TOTIMP, timp);
set(F_TOTIVA, tiva);
set(F_TOTPRIMP, tprimp);
set(F_TOTPRIVA, tpriva);
}
else
error_box("Risultati liquidazione non presenti o da ricalcolare per l'anno %d.", _sf->get_year());
}
void TQuadro_VT_iva_mask::print_prospect()
{
const int anno = _sf->get_int(F_YEAR);
TQuadro_VT_iva_form frm;
frm.find_field('B', odd_page, FF_YEAR).set(get(F_YEAR));
frm.find_field('B', odd_page, FF_TOTIMP).set(get(F_TOTIMP));
frm.find_field('B', odd_page, FF_TOTIVA).set(get(F_TOTIVA));
frm.find_field('B', odd_page, FF_TOTPRIMP).set(get(F_TOTPRIMP));
frm.find_field('B', odd_page, FF_TOTPRIVA).set(get(F_TOTPRIVA));
frm.find_field('B', odd_page, FF_TOTIVIMP).set(get(F_TOTIVIMP));
frm.find_field('B', odd_page, FF_TOTIVIVA).set(get(F_TOTIVIVA));
for (int reg = 0; reg < 22; reg++)
{
frm.find_field('B', odd_page, FF_REGIMP(reg)).set(get(F_REGIMP(reg)));
frm.find_field('B', odd_page, FF_REGIVA(reg)).set(get(F_REGIVA(reg)));
}
TRectype f(LF_NDITTE);
f.put(NDT_CODDITTA, get(F_CODDITTA));
frm.cursor()->setregion(f,f);
frm.print();
}
void TQuadro_VT_iva_mask::set_prospect()
{
CHECK(_sf, "Invalid mask");
const int anno = _sf->get_year();
const long ditta = _sf->get_long(F_CODDITTA);
set(F_YEAR, anno);
set(F_CODDITTA, ditta);
set(F_RAGSOC, _sf->get(F_RAGSOC));
TFirm frm(ditta);
TIva_round ir;
ir.set_default_iva_mode(anno, FALSE, ditta);
read_iva_data();
}
class TQuadro_VT_iva_app : public TSkeleton_application
{
protected:
virtual bool create();
virtual bool destroy();
virtual void main_loop();
public:
virtual bool firm_change_enabled() const { return FALSE; }
TQuadro_VT_iva_app () {};
virtual ~TQuadro_VT_iva_app () {};
};
bool TQuadro_VT_iva_app::create()
{
open_files(LF_TAB, LF_TABCOM, LF_NDITTE, 0);
return TSkeleton_application::create();
}
bool TQuadro_VT_iva_app::destroy()
{
return TSkeleton_application::destroy();
}
void TQuadro_VT_iva_app::main_loop()
{
const long ditta = get_firm();
TQuadro_VT_selfirm_mask* m1 = new TQuadro_VT_selfirm_mask();
while (m1->run() != K_QUIT)
{
if (m1->get(F_CODDITTA).empty() || m1->get(F_RAGSOC).empty())
{
error_box(TR("Selezionare una ditta"));
continue;
}
set_firm(m1->get_long(F_CODDITTA));
TQuadro_VT_iva_mask* m2 = new TQuadro_VT_iva_mask(m1);
m2->reset();
m2->enable_default();
m2->set_prospect();
if (m2->run() == K_ENTER)
m2->print_prospect();
delete m2;
}
delete m1;
set_firm(ditta);
}
int cg5800(int argc, char* argv[])
{
TQuadro_VT_iva_app a;
a.run(argc, argv, TR("Quadro VT"));
return 0;
}

33
cg/cg5800.h Executable file
View File

@ -0,0 +1,33 @@
#define F_YEAR 101
#define F_CODDITTA 102
#define F_RAGSOC 103
#define F_TOTIMP 105
#define F_TOTIVA 106
#define F_TOTPRIMP 107
#define F_TOTPRIVA 108
#define F_TOTIVIMP 109
#define F_TOTIVIVA 110
#define F_REGIMP(reg) (200 + reg)
#define F_REGIVA(reg) (300 + reg)
#define FM_REGIMP(reg) 2 ## reg
#define FM_REGIVA(reg) 3 ## reg
#define FF_YEAR 101
#define FF_CODDITTA 102
#define FF_TOTIMP 105
#define FF_TOTIVA 106
#define FF_TOTPRIMP 107
#define FF_TOTPRIVA 108
#define FF_TOTIVIMP 109
#define FF_TOTIVIVA 110
#define FF_REGIMP(reg) (200 + reg)
#define FF_REGIVA(reg) (300 + reg)
#define FFR_REGIMP(reg) 2 ## reg
#define FFR_REGIVA(reg) 3 ## reg

631
cg/cg5800a.frm Executable file
View File

@ -0,0 +1,631 @@
#include "cg5800.h"
USE LF_NDITTE
JOIN LF_ANAG TO LF_NDITTE INTO TIPOA=TIPOA CODANAGR=CODANAGR
JOIN LF_ANAGFIS TO LF_ANAG ALIAS 18 INTO CODANAGR=CODANAGR
JOIN LF_ANAGGIU TO LF_ANAG INTO CODANAGR=CODANAGR
END
DESCRIPTION
BEGIN
9->* "Ditte"
6->* "Anagrafica persone fisiche e giuridiche"
8->* "Anagrafica persone fisiche"
7->* "Anagrafica persone giuridiche"
END
GENERAL
BEGIN
OFFSET 0 0
END
SECTION BODY ODD 50
STRINGA -1
BEGIN
PROMPT 2 1 "@bAGENZIA DELLE ENTRATE"
END
STRINGA -1
BEGIN
PROMPT 2 2 "[]\ //\ "
END
STRINGA -1
BEGIN
PROMPT 2 3 "[]\\ // \\"
END
STRINGA -1
BEGIN
PROMPT 2 4 "[] \\//___\\"
END
STRINGA -1
BEGIN
PROMPT 2 5 "[] \/-----\\"
END
STRINGA -1
BEGIN
PROMPT 2 6 "@bQUADRO VT"
END
STRINGA -1
BEGIN
PROMPT 26 3 "DENOMINAZIONE, RAGIONE SOCIALE ovvero COGNOME E NOME"
END
STRINGA -1 50
BEGIN
KEY "Ragione sociale"
PROMPT 26 4 "@b"
FIELD LF_NDITTE->RAGSOC
END
STRINGA -1
BEGIN
KEY "Codice fiscale"
PROMPT 26 6 "@rCODICE FISCALE"
END
STRINGA -1
BEGIN
KEY "Codice fiscale"
PROMPT 26 7 "@b"
FIELD LF_ANAG->COFI
END
STRINGA -1
BEGIN
PROMPT 2 8 "______________________________________________________________________________"
END
NUMERO FF_YEAR
BEGIN
KEY "Anno"
PROMPT 2 9 "Anno di Imposte @b"
END
STRINGA -1
BEGIN
PROMPT 2 11 "@b- CONTRIBUENTE -"
END
STRINGA -1
BEGIN
KEY "Partita IVA"
PROMPT 2 12 "Partita IVA @b"
FIELD LF_ANAG->PAIV
END
STRINGA -1
BEGIN
KEY "Codice attività"
PROMPT 58 12 "@rCodice attività @b"
FIELD LF_NDITTE->CODATTPREV
END
STRINGA -1
BEGIN
PROMPT 2 16 "______________________________________________________________________________"
END
STRINGA -1
BEGIN
PROMPT 2 17 "@b- RIPARTIZIONE OPERAZIONI IMPONIBILI -"
END
STRINGA -1
BEGIN
PROMPT 1 19 "Totale Operazioni Imponibili"
END
VALUTA FF_TOTIMP 18
BEGIN
PROMPT 29 19 ""
END
STRINGA -1
BEGIN
PROMPT 54 19 "Imposte"
END
VALUTA FF_TOTIVA 18
BEGIN
PROMPT 62 19 ""
END
STRINGA -1
BEGIN
PROMPT 1 20 "Totale Op.verso cons.finali "
END
VALUTA FF_TOTPRIMP 18
BEGIN
PROMPT 29 20 ""
END
STRINGA -1
BEGIN
PROMPT 54 20 "Imposte"
END
VALUTA FF_TOTPRIVA 18
BEGIN
PROMPT 62 20 ""
END
STRINGA -1
BEGIN
PROMPT 1 21 "Totale op.verso soggetti IVA "
END
VALUTA FF_TOTIVIMP 18
BEGIN
PROMPT 29 21 ""
END
STRINGA -1
BEGIN
PROMPT 54 21 "Imposte"
END
VALUTA FF_TOTIVIVA 18
BEGIN
PROMPT 62 21 ""
END
STRINGA -1
BEGIN
PROMPT 2 22 "______________________________________________________________________________"
END
STRINGA -1
BEGIN
PROMPT 1 23 " Non assegnati Op.Imponibili "
END
VALUTA FFR_REGIMP(00) 18
BEGIN
PROMPT 29 23 ""
END
STRINGA -1
BEGIN
PROMPT 54 23 "Imposte"
END
VALUTA FFR_REGIVA(00) 18
BEGIN
PROMPT 62 23 ""
END
STRINGA -1
BEGIN
PROMPT 1 24 " VT2 Abruzzo Op.Imponibili "
END
VALUTA FFR_REGIMP(01) 18
BEGIN
PROMPT 29 24 ""
END
STRINGA -1
BEGIN
PROMPT 54 24 "Imposte"
END
VALUTA FFR_REGIVA(01) 18
BEGIN
PROMPT 51 24 ""
END
STRINGA -1
BEGIN
PROMPT 1 25 "VT3 Basilicata Op.Imponibili "
END
VALUTA FFR_REGIMP(02) 18
BEGIN
PROMPT 29 25 ""
END
STRINGA -1
BEGIN
PROMPT 54 25 "Imposte"
END
VALUTA FFR_REGIVA(02) 18
BEGIN
PROMPT 62 25 ""
END
STRINGA -1
BEGIN
PROMPT 1 26 " VT4 Bolzano Op.Imponibili "
END
VALUTA FFR_REGIMP(03) 18
BEGIN
PROMPT 29 26 ""
END
STRINGA -1
BEGIN
PROMPT 54 26 "Imposte"
END
VALUTA FFR_REGIVA(03) 18
BEGIN
PROMPT 62 26 ""
END
STRINGA -1
BEGIN
PROMPT 1 27 " VT5 Calabria Op.Imponibili "
END
VALUTA FFR_REGIMP(04) 18
BEGIN
PROMPT 29 27 ""
END
STRINGA -1
BEGIN
PROMPT 54 27 "Imposte"
END
VALUTA FFR_REGIVA(04) 18
BEGIN
PROMPT 62 27 ""
END
STRINGA -1
BEGIN
PROMPT 1 28 " VT6 Campania Op.Imponibili "
END
VALUTA FFR_REGIMP(05) 18
BEGIN
PROMPT 29 28 ""
END
STRINGA -1
BEGIN
PROMPT 54 28 "Imposte"
END
VALUTA FFR_REGIVA(05) 18
BEGIN
PROMPT 62 28 ""
END
STRINGA -1
BEGIN
PROMPT 1 29 "VT7 Emilia Rom.Op.Imponibili "
END
VALUTA FFR_REGIMP(06) 18
BEGIN
PROMPT 29 29 ""
END
STRINGA -1
BEGIN
PROMPT 54 29 "Imposte"
END
VALUTA FFR_REGIVA(06) 18
BEGIN
PROMPT 62 29 ""
END
STRINGA -1
BEGIN
PROMPT 1 30 " VT8 Friuli Op.Imponibili "
END
VALUTA FFR_REGIMP(07) 18
BEGIN
PROMPT 29 30 ""
END
STRINGA -1
BEGIN
PROMPT 54 30 "Imposte"
END
VALUTA FFR_REGIVA(07) 18
BEGIN
PROMPT 62 30 ""
END
STRINGA -1
BEGIN
PROMPT 1 31 " VT9 Lazio Op.Imponibili "
END
VALUTA FFR_REGIMP(08) 18
BEGIN
PROMPT 29 31 ""
END
STRINGA -1
BEGIN
PROMPT 54 31 "Imposte"
END
VALUTA FFR_REGIVA(08) 18
BEGIN
PROMPT 62 31 ""
END
STRINGA -1
BEGIN
PROMPT 1 32 " VT10 Liguria Op.Imponibili "
END
VALUTA FFR_REGIMP(09) 18
BEGIN
PROMPT 29 32 ""
END
STRINGA -1
BEGIN
PROMPT 54 32 "Imposte"
END
VALUTA FFR_REGIVA(09) 18
BEGIN
PROMPT 62 32 ""
END
STRINGA -1
BEGIN
PROMPT 1 33 "VT11 Lombardia Op.Imponibili "
END
VALUTA FFR_REGIMP(10) 18
BEGIN
PROMPT 29 33 ""
END
STRINGA -1
BEGIN
PROMPT 54 33 "Imposte"
END
VALUTA FFR_REGIVA(10) 18
BEGIN
PROMPT 62 33 ""
END
STRINGA -1
BEGIN
PROMPT 1 34 " VT12 Marche Op.Imponibili "
END
VALUTA FFR_REGIMP(11) 18
BEGIN
PROMPT 1 34 ""
END
STRINGA -1
BEGIN
PROMPT 54 34 "Imposte"
END
VALUTA FFR_REGIVA(11) 18
BEGIN
PROMPT 62 34 ""
END
STRINGA -1
BEGIN
PROMPT 1 35 " VT13 Molise Op.Imponibili "
END
VALUTA FFR_REGIMP(12) 18
BEGIN
PROMPT 29 35 ""
END
STRINGA -1
BEGIN
PROMPT 54 35 "Imposte"
END
VALUTA FFR_REGIVA(12) 18
BEGIN
PROMPT 62 35 ""
END
STRINGA -1
BEGIN
PROMPT 1 36 " VT14 Piemonte Op.Imponibili "
END
VALUTA FFR_REGIMP(13) 18
BEGIN
PROMPT 1 36 ""
END
STRINGA -1
BEGIN
PROMPT 54 36 "Imposte"
END
VALUTA FFR_REGIVA(13) 18
BEGIN
PROMPT 62 36 ""
END
STRINGA -1
BEGIN
PROMPT 1 37 " VT15 Puglia Op.Imponibili "
END
VALUTA FFR_REGIMP(14) 18
BEGIN
PROMPT 29 37 ""
END
STRINGA -1
BEGIN
PROMPT 54 37 "Imposte"
END
VALUTA FFR_REGIVA(14) 18
BEGIN
PROMPT 62 37 ""
END
STRINGA -1
BEGIN
PROMPT 1 38 " VT16 Sardegna Op.Imponibili "
END
VALUTA FFR_REGIMP(15) 18
BEGIN
PROMPT 29 38 ""
END
STRINGA -1
BEGIN
PROMPT 54 38 "Imposte"
END
VALUTA FFR_REGIVA(15) 18
BEGIN
PROMPT 62 38 ""
END
STRINGA -1
BEGIN
PROMPT 1 39 " VT17 Sicilia Op.Imponibili "
END
VALUTA FFR_REGIMP(16) 18
BEGIN
PROMPT 29 39 ""
END
STRINGA -1
BEGIN
PROMPT 54 39 "Imposte"
END
VALUTA FFR_REGIVA(16) 18
BEGIN
PROMPT 62 39 ""
END
STRINGA -1
BEGIN
PROMPT 1 40 " VT18 Toscana Op.Imponibili "
END
VALUTA FFR_REGIMP(17) 18
BEGIN
PROMPT 29 40 ""
END
STRINGA -1
BEGIN
PROMPT 54 40 "Imposte"
END
VALUTA FFR_REGIVA(17) 18
BEGIN
PROMPT 62 40 ""
END
STRINGA -1
BEGIN
PROMPT 1 41 " VT19 Trento Op.Imponibili "
END
VALUTA FFR_REGIMP(18) 18
BEGIN
PROMPT 29 41 ""
END
STRINGA -1
BEGIN
PROMPT 54 41 "Imposte"
END
VALUTA FFR_REGIVA(18) 18
BEGIN
PROMPT 62 41 ""
END
STRINGA -1
BEGIN
PROMPT 1 42 " VT20 Umbria Op.Imponibili "
END
VALUTA FFR_REGIMP(19) 18
BEGIN
PROMPT 29 42 ""
END
STRINGA -1
BEGIN
PROMPT 54 42 "Imposte"
END
VALUTA FFR_REGIVA(19) 18
BEGIN
PROMPT 62 42 ""
END
STRINGA -1
BEGIN
PROMPT 1 43 "VT21 Valle d'Aosta op.impon. "
END
VALUTA FFR_REGIMP(20) 18
BEGIN
PROMPT 29 43 ""
END
STRINGA -1
BEGIN
PROMPT 54 43 "Imposte"
END
VALUTA FFR_REGIVA(20) 18
BEGIN
PROMPT 62 43 ""
END
STRINGA -1
BEGIN
PROMPT 1 44 " VT22 Veneto Op.Imponibili "
END
VALUTA FFR_REGIMP(21) 18
BEGIN
PROMPT 29 44 ""
END
STRINGA -1
BEGIN
PROMPT 54 44 "Imposte"
END
VALUTA FFR_REGIVA(21) 18
BEGIN
PROMPT 62 44 ""
END
STRINGA -1
BEGIN
PROMPT 2 46 "______________________________________________________________________________"
END
END
END

34
cg/cg5800a.uml Executable file
View File

@ -0,0 +1,34 @@
#include "cg5700.h"
PAGE "Quadro VT" -1 -1 72 8
NUMBER F_YEAR 4
BEGIN
PROMPT 1 1 "Anno liquidazione "
FLAGS "AR"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 1 3 "Codice ditta "
FLAGS "B"
END
STRING F_RAGSOC 50 30
BEGIN
PROMPT 28 3 "Rag.soc. "
FLAGS "B"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

436
cg/cg5800b.uml Executable file
View File

@ -0,0 +1,436 @@
#include "cg5800.h"
TOOLBAR "" 0 -3 0 3
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -11 ""
MESSAGE EXIT, K_ENTER
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -11 ""
END
ENDPAGE
PAGE "Quadro IVA VT Pag.1" -1 -1 78 20
GROUPBOX DLG_NULL 79 4
BEGIN
PROMPT 0 0 "Ditta corrente"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 2 1 "Codice "
FLAGS "DG"
MESSAGE COPY,1@
END
STRING F_RAGSOC 50
BEGIN
PROMPT 16 1 "Rag. Soc. "
FLAGS "DG"
MESSAGE COPY,2@
END
NUMBER F_YEAR 4
BEGIN
PROMPT 2 2 "Anno "
FLAGS "DG"
MESSAGE COPY,3@
END
CURRENCY F_TOTIMP 18
BEGIN
PROMPT 1 4 "Totale Operazioni Imponibili "
FLAGS "DG"
MESSAGE COPY,4@
END
CURRENCY F_TOTIVA 18
BEGIN
PROMPT 51 4 "Totale Imposte "
FLAGS "DG"
MESSAGE COPY,5@
END
CURRENCY F_TOTPRIMP 18
BEGIN
PROMPT 1 5 " Totale Op.verso cons.finali "
MESSAGE COPY,6@
FLAGS "DG"
END
CURRENCY F_TOTPRIVA 18
BEGIN
PROMPT 51 5 "Imposte "
MESSAGE COPY,7@
FLAGS "DG"
END
CURRENCY F_TOTIVIMP 18
BEGIN
PROMPT 1 6 "Totale op.verso soggetti IVA "
MESSAGE COPY,8@
FLAGS "DG"
END
CURRENCY F_TOTIVIVA 18
BEGIN
PROMPT 51 6 "Imposte "
MESSAGE COPY,9@
FLAGS "DG"
END
TEXT DLG_NULL
BEGIN
PROMPT 2 7 "______________________________________________________________________________"
END
CURRENCY FM_REGIMP(00) 18
BEGIN
PROMPT 1 8 "Non assegnati Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(00) 18
BEGIN
PROMPT 51 8 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(01) 18
BEGIN
PROMPT 1 9 "VT2 Abruzzo Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(01) 18
BEGIN
PROMPT 51 9 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(02) 18
BEGIN
PROMPT 1 10 "VT3 Basilicata Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(02) 18
BEGIN
PROMPT 51 10 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(03) 18
BEGIN
PROMPT 1 11 "VT4 Bolzano Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(03) 18
BEGIN
PROMPT 51 11 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(04) 18
BEGIN
PROMPT 1 12 "VT5 Calabria Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(04) 18
BEGIN
PROMPT 51 12 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(05) 18
BEGIN
PROMPT 1 13 "VT6 Campania Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(05) 18
BEGIN
PROMPT 51 13 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(06) 18
BEGIN
PROMPT 1 14 "VT7 Emilia Rom.Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(06) 18
BEGIN
PROMPT 51 14 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(07) 18
BEGIN
PROMPT 1 15 "VT8 Friuli Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(07) 18
BEGIN
PROMPT 51 15 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(08) 18
BEGIN
PROMPT 1 16 "VT9 Lazio Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(08) 18
BEGIN
PROMPT 51 16 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(09) 18
BEGIN
PROMPT 1 17 "VT10 Liguria Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(09) 18
BEGIN
PROMPT 51 17 "Imposte "
FLAGS "D"
END
ENDPAGE
PAGE "Quadro IVA VT Pag.2" -1 -1 78 20
GROUPBOX DLG_NULL 79 4
BEGIN
PROMPT 0 0 "Ditta corrente"
END
NUMBER DLG_NULL 5
BEGIN
PROMPT 2 1 "Codice "
FLAGS "D"
GROUP 1
END
STRING DLG_NULL 50
BEGIN
PROMPT 16 1 "Rag. Soc. "
FLAGS "D"
GROUP 2
END
NUMBER DLG_NULL 4
BEGIN
PROMPT 2 2 "Anno "
FLAGS "D"
GROUP 3
END
CURRENCY DLG_NULL 18
BEGIN
PROMPT 1 4 "Totale operazioni imponibili "
FLAGS "D"
GROUP 4
END
CURRENCY DLG_NULL 18
BEGIN
PROMPT 51 4 "Totale Imposte "
FLAGS "D"
GROUP 5
END
CURRENCY DLG_NULL 18
BEGIN
PROMPT 1 5 " Totale op.verso cons.finali "
FLAGS "D"
GROUP 6
END
CURRENCY DLG_NULL 18
BEGIN
PROMPT 51 5 "Imposte "
FLAGS "D"
GROUP 7
END
CURRENCY DLG_NULL 18
BEGIN
PROMPT 1 6 "Totale op.verso soggetti IVA "
FLAGS "D"
GROUP 8
END
CURRENCY DLG_NULL 18
BEGIN
PROMPT 51 6 "Imposte "
FLAGS "D"
GROUP 9
END
TEXT DLG_NULL
BEGIN
PROMPT 2 7 "______________________________________________________________________________"
END
CURRENCY FM_REGIMP(10) 18
BEGIN
PROMPT 1 8 "VT11 Lombardia Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(10) 18
BEGIN
PROMPT 51 8 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(11) 18
BEGIN
PROMPT 1 9 "VT12 Marche Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(11) 18
BEGIN
PROMPT 51 9 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(12) 18
BEGIN
PROMPT 1 10 "VT13 Molise Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(12) 18
BEGIN
PROMPT 51 10 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(13) 18
BEGIN
PROMPT 1 11 "VT14 Piemonte Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(13) 18
BEGIN
PROMPT 51 11 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(14) 18
BEGIN
PROMPT 1 12 "VT15 Puglia Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(14) 18
BEGIN
PROMPT 51 12 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(15) 18
BEGIN
PROMPT 1 13 "VT16 Sardegna Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(15) 18
BEGIN
PROMPT 51 13 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(16) 18
BEGIN
PROMPT 1 14 "VT17 Sicilia Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(16) 18
BEGIN
PROMPT 14 36 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(17) 18
BEGIN
PROMPT 1 15 "VT18 Toscana Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(17) 18
BEGIN
PROMPT 51 15 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(18) 18
BEGIN
PROMPT 1 16 "VT19 Trento Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(18) 18
BEGIN
PROMPT 51 16 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(19) 18
BEGIN
PROMPT 1 17 "VT20 Umbria Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(19) 18
BEGIN
PROMPT 51 17 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(20) 18
BEGIN
PROMPT 1 18 "VT21 Valle d'Aosta op.impon. "
FLAGS "D"
END
CURRENCY FM_REGIVA(20) 18
BEGIN
PROMPT 51 18 "Imposte "
FLAGS "D"
END
CURRENCY FM_REGIMP(21) 18
BEGIN
PROMPT 1 19 "VT21 Veneto Op.Imponibili "
FLAGS "D"
END
CURRENCY FM_REGIVA(21) 18
BEGIN
PROMPT 51 19 "Imposte "
FLAGS "D"
END
ENDPAGE
ENDMASK

View File

@ -4,14 +4,12 @@
int main(int argc, char** argv)
{
int rt = -1;
const int r = (argc > 1) ? argv[1][1]-'0' : -1;
switch (r)
const int op = argc < 2 ? 0 : argv[1][1]-'0';
switch (op)
{
case 1:
default:
cg7100(argc, argv); break; // invio ad altra procedura
case 1: cg7100(argc,argv); break; // Invio ad altra procedura (zucchetti)
case 2: cg7200(argc,argv); break; // Invio ad altra procedura (proforma)
default: cg7100(argc,argv); break;
}
exit(0);
return 0;
@ -19,22 +17,5 @@ int main(int argc, char** argv)

View File

@ -2,6 +2,7 @@
#define __CG7_H
int cg7100(int argc, char** argv);
int cg7200(int argc, char** argv);
#endif // __CG7_H

353
cg/cg7200.cpp Executable file
View File

@ -0,0 +1,353 @@
#include <applicat.h>
#include <assoc.h>
#include <automask.h>
#include <currency.h>
#include <filetext.h>
#include <msksheet.h>
#include <printer.h>
#include <recarray.h>
#include <relation.h>
#include <sort.h>
#include <utility.h>
#include "cg7.h"
#include "cg7200a.h"
#include <mov.h>
#include <rmov.h>
#include <rmoviva.h>
#define ALIAS_REG 100
class TInvioP_file: public TFile_text
{
protected:
virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str);
public:
TInvioP_file(const TString& file_name, const TString& config_name);
virtual ~TInvioP_file() { }
};
TInvioP_file::TInvioP_file(const TString& file_name, const TString& config_name)
: TFile_text(file_name, config_name)
{
}
class TInvioP_mask : public TAutomask
{
protected:
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TInvioP_mask();
virtual ~TInvioP_mask(){};
};
TInvioP_mask::TInvioP_mask() :TAutomask ("cg7200a")
{
}
bool TInvioP_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_CODDITTA:
if (e==fe_init && o.empty())
{
set(F_CODDITTA, main_app().get_firm());
((TEdit_field&) o).check();
disable(F_CODDITTA);
}
break;
default:
break;
}
return TRUE;
}
class TInvioP : public TSkeleton_application
{
TCursor* _cur;
TInvioP_mask* _msk;
TInvioP_file* _trasfile;
TDate _dataini, _datafin;
char _decsep;
protected:
virtual bool create(void);
virtual bool destroy(void);
virtual void main_loop() ;
void invio_proforma();
bool i_proforma_movimenti();
bool i_proforma_righe();
bool i_proforma_clifor(char tipocf = 'C');
bool i_proforma_conti();
bool i_proforma_pagamenti();
public:
TInvioP() {};
virtual ~TInvioP() {};
const char get_decsep() { return _decsep;};
};
// restituisce un riferimento all' applicazione
inline TInvioP& app() { return (TInvioP&) main_app();}
// gestione dei messaggi estesi nei campi
void TInvioP_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TString& str)
{
const TString code(s.get(0));
TString valore;
if (code == "_FISSO")
{
// gestione dei campi fissi per i record delle riba
// sintassi: _FISSO,!<valore>
// dove: <valore> è la stringa fissa da emettere
TString in(s.get());
CHECK(in[0]=='!',"Macro _FISSO senza carattere '!'");
in.ltrim(1);
in.trim();
valore = in;
}
else if (code == "_IMPORTO")
{
valore = str;
valore.replace('.', app().get_decsep()); //!?!?! consento decsep diversi per isam e text ?
}
else NFCHECK("Macro non definita: %s", (const char *)code);
str = valore;
}
bool TInvioP::create()
{
open_files(LF_CAUSALI, LF_CLIFO, LF_PCON, LF_MOV, LF_RMOV, LF_RMOVIVA, 0);
_msk = new TInvioP_mask();
_trasfile = NULL;
return TSkeleton_application::create();
}
bool TInvioP::destroy()
{
if (_trasfile)
delete _trasfile;
delete _msk;
return TSkeleton_application::destroy();
}
void TInvioP::main_loop()
{
TFilename configname = "cg7200a.ini";
TConfig configfile(configname);
_msk->set(F_DATAINI, configfile.get("DATA","OPZIONI"));
_msk->set(F_DESTINAZIONE, configfile.get("PERCORSO","OPZIONI"));
while (_msk->run()!=K_QUIT)
{
configfile.set("DATA", _msk->get_date(F_DATAFIN),"OPZIONI");
configfile.set("PERCORSO", _msk->get(F_DESTINAZIONE),"OPZIONI");
_dataini = _msk->get_date(F_DATAINI);
_datafin = _msk->get_date(F_DATAFIN);
const char tipoinvio = _msk->get(F_TIPOINVIO)[0];
if (tipoinvio == 'P')
invio_proforma();
}
}
void TInvioP::invio_proforma()
{
if (_msk->get_bool(F_MOVIMENTI))
{
i_proforma_movimenti();
i_proforma_righe();
}
if (_msk->get_bool(F_CLIENTI))
i_proforma_clifor();
if (_msk->get_bool(F_FORNITORI))
i_proforma_clifor('F');
if (_msk->get_bool(F_CONTI))
i_proforma_conti();
}
bool TInvioP::i_proforma_conti()
{
TFilename configname = "proforma.ini";
TConfig configfile(configname);
TFilename filename = _msk->get(F_DESTINAZIONE);
filename.add("PIANOCON.TXT");
if (fexist(filename))
remove(filename);
_trasfile = new TInvioP_file(filename, configname);
_trasfile->open(filename,'w');
_decsep = configfile.get_char("DECSEP","MAIN");
TRelation rel(LF_PCON);
TCursor cur(&rel);
const long cur_items = cur.items();
if (cur_items != 0)
{
cur.freeze();
TRectype& cur_rec = cur.curr();
for (cur = 0; cur.pos() < cur_items; ++(cur))
{
TRecord_text rec;
rec.set_type("P");
_trasfile->autoload(rec, cur);
_trasfile->write(rec);
}
}
_trasfile->close();
delete _trasfile;
_trasfile = NULL;
return TRUE;
}
bool TInvioP::i_proforma_movimenti()
{
TFilename configname = "proforma.ini";
TConfig configfile(configname);
TFilename filename = _msk->get(F_DESTINAZIONE);
filename.add("REGISTRA.TXT");
if (fexist(filename))
remove(filename);
_trasfile = new TInvioP_file(filename, configname);
_trasfile->open(filename,'w');
_decsep = configfile.get_char("DECSEP","MAIN");
TRectype da(LF_MOV);
TRectype a(LF_MOV);
da.put(MOV_DATAREG, _dataini);
a.put(MOV_DATAREG, _datafin);
TRelation rel(LF_MOV);
rel.add(LF_CAUSALI, "CODCAUS==CODCAUS", 1);
TCursor cur(&rel, "", 2, &da, &a);
const long cur_items = cur.items();
if (cur_items != 0)
{
cur.freeze();
TRectype& cur_rec = cur.curr();
for (cur = 0; cur.pos() < cur_items; ++(cur))
{
TRecord_text rec;
rec.set_type("T");
_trasfile->autoload(rec, cur);
_trasfile->write(rec);
}
}
_trasfile->close();
delete _trasfile;
_trasfile = NULL;
return TRUE;
}
bool TInvioP::i_proforma_righe()
{
TFilename configname = "proforma.ini";
TConfig configfile(configname);
TFilename filename = _msk->get(F_DESTINAZIONE);
filename.add("RIGHE.TXT");
if (fexist(filename))
remove(filename);
_trasfile = new TInvioP_file(filename, configname);
_trasfile->open(filename,'w');
_decsep = configfile.get_char("DECSEP","MAIN");
TRectype da(LF_MOV);
TRectype a(LF_MOV);
da.put(MOV_DATAREG, _dataini);
a.put(MOV_DATAREG, _datafin);
TRelation rel(LF_MOV);
rel.add(LF_RMOVIVA, "NUMREG==NUMREG", 1);
rel.add(LF_RMOV, "NUMREG==NUMREG", 1);
//rel.add("REG", "CODTAB[1,4]==ANNOIVA|CODTAB[5,7]==REG", 1);
//TString filtro = "(23->PROTIVA != \"\") && ";
//filtro << "(REG->I0 == 1) || (REG->I0 == 2)";
TCursor cur(&rel, "", 2, &da, &a);
//cur.setfilter(filtro, TRUE);
const long cur_items = cur.items();
if (cur_items != 0)
{
cur.freeze();
TRectype& cur_rec = cur.curr();
for (cur = 0; cur.pos() < cur_items; ++(cur))
{
const long numreg = cur.curr().get_long(MOV_NUMREG);
bool continua = TRUE;
while (continua)
{
const long numregrig = cur.curr(LF_RMOVIVA).get_long(RMI_NUMREG);
if (numreg == numregrig)
{
TRectype& cur_rec_righe = cur.curr(LF_RMOVIVA);
TRecord_text recrighe;
recrighe.set_type("I");
_trasfile->autoload(recrighe, cur);
_trasfile->write(recrighe);
}
continua = cur.next_match(LF_RMOVIVA, "NUMREG");
}
continua = TRUE;
while (continua)
{
const long numregrig = cur.curr(LF_RMOV).get_long(RMV_NUMREG);
if (numreg == numregrig)
{
TRectype& cur_rec_righe = cur.curr(LF_RMOV);
TRecord_text recrighe;
recrighe.set_type("R");
_trasfile->autoload(recrighe, cur);
_trasfile->write(recrighe);
}
continua = cur.next_match(LF_RMOV, "NUMREG");
}
}
}
_trasfile->close();
delete _trasfile;
_trasfile = NULL;
return TRUE;
}
bool TInvioP::i_proforma_clifor(char tipocf)
{
TFilename configname = "proforma.ini";
TConfig configfile(configname);
TFilename filename = _msk->get(F_DESTINAZIONE);
if (tipocf == 'C')
filename.add("CLIENTI.TXT");
else
filename.add("FORNIT.TXT");
if (fexist(filename))
remove(filename);
_trasfile = new TInvioP_file(filename, configname);
_trasfile->open(filename,'w');
_decsep = configfile.get_char("DECSEP","MAIN");
TString80 filtro = "";
filtro.format("TIPOCF == \"%c\"", tipocf);
TRelation rel(LF_CLIFO);
TCursor cur(&rel, filtro);
const long cur_items = cur.items();
if (cur_items != 0)
{
cur.freeze();
TRectype& cur_rec = cur.curr();
for (cur = 0; cur.pos() < cur_items; ++(cur))
{
TRecord_text rec;
rec.set_type("C");
_trasfile->autoload(rec, cur);
_trasfile->write(rec);
}
}
_trasfile->close();
delete _trasfile;
_trasfile = NULL;
return TRUE;
}
int cg7200(int argc, char **argv)
{
TInvioP a;
a.run(argc, argv, "Invio dati contabilità");
return 0;
}

15
cg/cg7200a.h Executable file
View File

@ -0,0 +1,15 @@
// invio dati ad altra procedura (Proforma)
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_MOVIMENTI 103
#define F_CLIENTI 104
#define F_FORNITORI 105
#define F_CONTI 106
#define F_PAGAMENTI 107
#define F_TIPOINVIO 108
#define F_DESTINAZIONE 109
#define F_DATAINI 110
#define F_DATAFIN 111
#define F_RIPRISTINA 112
#define F_DATARIPRISTINO 113

102
cg/cg7200a.uml Executable file
View File

@ -0,0 +1,102 @@
#include "cg7200a.h"
PAGE "Invio dati contabilita'" -1 -1 78 20
GROUPBOX DLG_NULL 76 3
BEGIN
PROMPT 2 1 "@bDitta corrente"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 3 2 "Codice "
FLAGS "FD"
USE LF_NDITTE
INPUT CODDITTA F_CODDITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE REQUIRED
END
STRING F_RAGSOC 50
BEGIN
PROMPT 23 2 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 76 6
BEGIN
PROMPT 2 4 "Dati da inviare"
END
BOOLEAN F_MOVIMENTI
BEGIN
PROMPT 3 5 "Movimenti contabili"
MESSAGE TRUE,ENABLE F_DATAFIN
END
BOOLEAN F_CLIENTI
BEGIN
PROMPT 3 6 "Clienti"
END
BOOLEAN F_FORNITORI
BEGIN
PROMPT 3 7 "Fornitori"
END
BOOLEAN F_CONTI
BEGIN
PROMPT 3 8 "Piano dei conti"
END
BOOLEAN F_PAGAMENTI
BEGIN
PROMPT 40 5 "Pagamenti"
END
LISTBOX F_TIPOINVIO 20
BEGIN
PROMPT 2 10 "Invio a "
ITEM "P|Proforma"
END
STRING F_DESTINAZIONE 20
BEGIN
PROMPT 2 11 "Destinazione "
END
DATE F_DATAINI
BEGIN
PROMPT 2 12 "Data iniziale "
END
DATE F_DATAFIN
BEGIN
PROMPT 40 12 "Data finale "
END
BUTTON F_RIPRISTINA 20
BEGIN
PROMPT 2 14 "Annulla invio"
MESSAGE SHOW,F_DATARIPRISTINO|ENABLE,F_DATARIPRISTINO
END
DATE F_DATARIPRISTINO
BEGIN
PROMPT 25 14 "Annulla invio fino al "
FLAGS "HD"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -454,47 +454,45 @@ bool TSaldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil
}
const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const TDate& al,
int indbil, bool provv, const TString & codcomm)
int indbil, bool provv, const TString& codcomm)
{
_saldo_iniziale = ZERO;
_saldo = ZERO;
_prg_dare = ZERO;
_prg_avere = ZERO;
_movimentato = FALSE;
_rec_presente_ep = FALSE;
_rec_presente_ec = FALSE;
_prec = FALSE;
_movimentato = false;
_rec_presente_ep = false;
_rec_presente_ec = false;
_prec = false;
TEsercizi_contabili es;
const int codes = es.date2esc(dal);
const TDate inizio = es.esercizio(codes).inizio();
const bool is_commessa = codcomm.not_empty();
_annoes = codes;
if( !is_commessa)
{
TString key(20);
key.format("%04d| |%d|%d|%ld", _annoes, g, c, s);
const TRectype & saldo = cache().get(LF_SALDI, key);
if( !is_commessa)
{
TString80 key; key.format("%04d| |%d|%d|%ld", _annoes, g, c, s);
const TRectype& saldo = cache().get(LF_SALDI, key);
_saldo_iniziale = saldo.get_real(SLD_SALDO);
_prec = _saldo_iniziale == ZERO;
_prec = _saldo_iniziale.is_zero() && (indbil == 1 || indbil == 2 || indbil == 5);
if (_prec)
{
_saldo_iniziale = saldofin_esprec(codes,g,c,s);
}
else
{
if (saldo.get_char(SLD_FLAGSALINI) == 'A')
_saldo_iniziale = -_saldo_iniziale;
}
}
TRelation relrmov(LF_RMOV);
TRectype & rmov = relrmov.curr();
TRectype& rmov = relrmov.curr();
rmov.put(RMV_GRUPPO,g);
rmov.put(RMV_CONTO,c);
rmov.put(RMV_SOTTOCONTO,s);
@ -502,54 +500,61 @@ const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const
TCursor cur(&relrmov, "", 2, &rmov, &rmov);
const TRecnotype items = cur.items();
cur.freeze();
TString prompt(30);
if (items > 0)
{
cur.freeze();
prompt.format(FR("Calcolo saldo conto %d-%d-%ld"), g, c, s);
TProgind* p = NULL;
if (items > 100) // E' proprio utile la progind?
{
TString80 prompt;
prompt.format(FR("Calcolo saldo del conto %d.%d.%ld"), g, c, s);
p = new TProgind(items, prompt, FALSE);
}
TProgind p(items, prompt, FALSE);
for (cur = 0L; cur.pos() < items; ++cur)
{
if (p != NULL)
p->addstatus(1L);
const long num_reg = rmov.get_long(RMV_NUMREG);
const real importo = rmov.get_real(RMV_IMPORTO);
for (cur = 0L; cur.pos() < items && !p.iscancelled(); ++cur)
{
p.addstatus(1L);
const long num_reg = rmov.get_long(RMV_NUMREG);
const real importo = rmov.get_real(RMV_IMPORTO);
if ((!is_commessa || codcomm == rmov.get(RMV_CODCMS)) &&
importo != ZERO)
{
const char sezione = rmov.get_char(RMV_SEZIONE);
// "Se la causale del movimento e' di chiusura,
// o di apertura il movimento non va considerato"
leggi_mov(num_reg);
const TString& movap = _causali_apertura.decode(_codcaus);
if ((!is_commessa || codcomm == rmov.get(RMV_CODCMS)) &&
importo != ZERO)
{
const char sezione = rmov.get_char(RMV_SEZIONE);
// "Se la causale del movimento e' di chiusura,
// o di apertura il movimento non va considerato"
const TString& movap = _causali_apertura.decode(_codcaus);
leggi_mov(num_reg);
if ((provv || _provv.empty()) && movap.blank())
{
if (_datacomp >= dal && _datacomp <= al)
{
_movimentato = true;
if ((provv || _provv.empty()) && movap.blank())
{
if (_datacomp >= dal && _datacomp <= al)
{
_movimentato = TRUE;
if (sezione == 'D')
_prg_dare += importo;
else
_prg_avere += importo;
}
else
if ((!is_commessa) && _datacomp >= inizio && _datacomp < dal)
{
if (sezione == 'D')
_saldo_iniziale += importo;
else
_saldo_iniziale -= importo;
}
}
}
if (sezione == 'D')
_prg_dare += importo;
else
_prg_avere += importo;
}
else
if ((!is_commessa) && _datacomp >= inizio && _datacomp < dal)
{
if (sezione == 'D')
_saldo_iniziale += importo;
else
_saldo_iniziale -= importo;
}
}
}
}
if (p != NULL)
delete p;
}
_saldo = _saldo_iniziale + _prg_dare - _prg_avere;
return _saldo;
}

View File

@ -105,12 +105,13 @@ Item_01 = "Parametri liquidazione", "cg5 -3", "F"
Item_02 = "Liquidazione", "cg4 -2", "F"
Item_03 = "Visualizzazione liquidazione", "cg5 -5", "F"
Item_04 = "Comunicazione annuale dati IVA", "cg5 -7", "F"
Item_05 = "Riepilogo progressivi", "cg0 -3", "F"
Item_06 = "Stampa registri", "cg4 -3", "F"
Item_07 = "Liste fatture", [CGMENU_026]
Item_08 = "Gestione acconti IVA", [CGMENU_027]
Item_09 = "Gestione versamenti IVA", [CGMENU_022]
Item_10 = "Gestione autotrasportatori", "cg4 -9", "F"
Item_05 = "Quadro VT", "cg5 -8", "F"
Item_06 = "Riepilogo progressivi", "cg0 -3", "F"
Item_07 = "Stampa registri", "cg4 -3", "F"
Item_08 = "Liste fatture", [CGMENU_026]
Item_09 = "Gestione acconti IVA", [CGMENU_027]
Item_10 = "Gestione versamenti IVA", [CGMENU_022]
Item_11 = "Gestione autotrasportatori", "cg4 -9", "F"
[CGMENU_011]
Caption = "Tabelle ministeriali"

406
cg/proforma.ini Executable file
View File

@ -0,0 +1,406 @@
[MAIN]
DECSEP = ,
FIELDSEP =
RECORDSEP = \n
RECORDSIZE =
SKIPLINES = 0
TYPEFIELD = -1
TYPELEN = -1
TYPEPOS = -1
[TYPE STRINGA]
ALIGN = L
DATA = S
DECIMAL = 0
FILLER = ' '
LENGTH = 0
PICTURE =
[TYPE NUMERO]
ALIGN = R
DATA = N
DECIMAL = 0
FILLER = '0'
LENGTH = 0
PICTURE =
[TYPE DATA]
ALIGN =
DATA = D
DECIMAL = 0
FILLER = '0'
LENGTH = 8
PICTURE = 1444
[TYPE IMPORTO]
ALIGN = R
DATA = N
DECIMAL = 2
FILLER = '0'
LENGTH = 0
[RECORD T]
NAME(0) = ID REGISTRAZIONE
TYPE(0) = NUMERO
POSITION(0) = 0
LENGTH(0) = 10
FIELD(0) = 23->NUMREG
NAME(1) = DATA REGISTRAZIONE
TYPE(1) = DATA
POSITION(1) = 10
LENGTH(1) = 8
FIELD(1) = 23->DATAREG
NAME(2) = CODICE CAUSALE
TYPE(2) = STRINGA
POSITION(2) = 18
LENGTH(2) = 3
FIELD(2) = 23->CODCAUS
NAME(3) = DESCRIZIONE CAUSALE
TYPE(3) = STRINGA
POSITION(3) = 21
LENGTH(3) = 40
FIELD(3) = 26->DESCR[1,40]
NAME(4) = DESCRIZIONE TESTATA
TYPE(4) = STRINGA
POSITION(4) = 61
LENGTH(4) = 40
FIELD(4) = 23->DESCR[1,40]
NAME(5) = DATA DOCUMENTO
TYPE(5) = DATA
POSITION(5) = 101
LENGTH(5) = 8
FIELD(5) = 23->DATADOC
NAME(6) = NUMERO DOCUMENTO
TYPE(6) = STRINGA
POSITION(6) = 109
LENGTH(6) = 6
FIELD(6) = 23->NUMDOC
NAME(7) = TIPO DOCUMENTO
TYPE(7) = STRINGA
POSITION(7) = 115
LENGTH(7) = 30
NAME(8) = CODICE CLIFOR
TYPE(8) = STRINGA
POSITION(8) = 145
LENGTH(8) = 10
FIELD(8) = 23->CODCF
NAME(9) = TOTALE IMPONIBILE
TYPE(9) = IMPORTO
POSITION(9) = 155
LENGTH(9) = 14
DECIMAL(9) = 2
MESSAGE(9) = _IMPORTO
NAME(10) = TOTALE IVA
TYPE(10) = IMPORTO
POSITION(10) = 169
LENGTH(10) = 14
DECIMAL(10) = 2
MESSAGE(10) = _IMPORTO
NAME(11) = TOTALE DOCUMENTO
TYPE(11) = IMPORTO
POSITION(11) = 183
LENGTH(11) = 14
DECIMAL(11) = 2
FIELD(11) = 23->TOTDOC
MESSAGE(11) = _IMPORTO
NAME(12) = DATA PAGAMENTO
TYPE(12) = DATA
POSITION(12) = 197
LENGTH(12) = 8
NAME(13) = TIPO PAGAMENTO
TYPE(13) = STRINGA
POSITION(13) = 205
LENGTH(13) = 20
FIELD(13) = 23->CODPAG
NAME(14) = DATA COMPETENZA
TYPE(14) = DATA
POSITION(14) = 225
LENGTH(14) = 8
FIELD(14) = 23->DATACOMP
NAME(15) = NUMERO PROTOCOLLO
TYPE(15) = STRINGA
POSITION(15) = 235
LENGTH(15) = 10
FIELD(15) = 23->PROTIVA
NAME(16) = VALUTA
TYPE(16) = STRINGA
POSITION(16) = 243
LENGTH(16) = 1
MESSAGE(16)=_FISSO,!1
[RECORD R]
NAME(0) = ID REGISTRAZIONE
TYPE(0) = STRINGA
POSITION(0) = 0
LENGTH(0) = 10
FIELD(0) = 24->NUMREG
NAME(1) = FLAG RIGA IVA
TYPE(1) = STRINGA
POSITION(1) = 10
LENGTH(1) = 1
MESSAGE(1) = _FISSO,!N
NAME(2) = FLAG DARE/AVERE
TYPE(2) = STRINGA
POSITION(2) = 11
LENGTH(2) = 1
FIELD(2) = 24->SEZIONE
NAME(3) = CODICE MASTRO
TYPE(3) = STRINGA
POSITION(3) = 12
LENGTH(3) = 5
FIELD(3) = 24->GRUPPO
NAME(4) = CODICE CONTO
TYPE(4) = STRINGA
POSITION(4) = 17
LENGTH(4) = 5
FIELD(4) = 24->CONTO
NAME(5) = CODICE SOTTOCONTO
TYPE(5) = STRINGA
POSITION(5) = 22
LENGTH(5) = 5
FIELD(5) = 24->SOTTOCONTO
NAME(6) = FLAG CLIFOR
TYPE(6) = STRINGA
POSITION(6) = 27
LENGTH(6) = 1
FIELD(6) = 24->TIPOC
NAME(7) = CODICE CLIFOR
TYPE(7) = STRINGA
POSITION(7) = 28
LENGTH(7) = 10
FIELD(7) = 24->SOTTOCONTO
NAME(8) = DESCRIZIONE RIGA
TYPE(8) = STRINGA
POSITION(8) = 38
LENGTH(8) = 40
FIELD(8) = 24->DESCR[1,40]
NAME(9) = IMPORTO SOTTOCONTO
TYPE(9) = IMPORTO
POSITION(9) = 78
LENGTH(9) = 14
DECIMAL(9) = 2
FIELD(9) = 24->IMPORTO
MESSAGE(9) = _IMPORTO
NAME(10) = IMPONIBILE
TYPE(10) = IMPORTO
POSITION(10) = 92
LENGTH(10) = 14
DECIMAL(10) = 2
MESSAGE(10) = _IMPORTO
NAME(11) = CODICE IVA
TYPE(11) = STRINGA
POSITION(11) = 106
LENGTH(11) = 4
NAME(12) = CP INDED
TYPE(12) = STRINGA
POSITION(12) = 110
LENGTH(12) = 15
NAME(13) = COMMESSA
TYPE(13) = STRINGA
POSITION(13) = 125
LENGTH(13) = 20
FIELD(13) = 24->CODCMS
NAME(14) = VOCE DI SPESA
TYPE(14) = STRINGA
POSITION(14) = 145
LENGTH(14) = 10
FIELD(14) = 24->FASCMS
[RECORD I]
NAME(0) = ID REGISTRAZIONE
TYPE(0) = STRINGA
POSITION(0) = 0
LENGTH(0) = 10
FIELD(0) = 25->NUMREG
NAME(1) = FLAG RIGA IVA
TYPE(1) = STRINGA
POSITION(1) = 10
LENGTH(1) = 1
MESSAGE(1) = _FISSO,!S
NAME(3) = CODICE MASTRO
TYPE(3) = STRINGA
POSITION(3) = 12
LENGTH(3) = 5
FIELD(3) = 25->GRUPPO
NAME(4) = CODICE CONTO
TYPE(4) = STRINGA
POSITION(4) = 17
LENGTH(4) = 5
FIELD(4) = 25->CONTO
NAME(5) = CODICE SOTTOCONTO
TYPE(5) = STRINGA
POSITION(5) = 22
LENGTH(5) = 5
FIELD(5) = 25->SOTTOCONTO
NAME(6) = FLAG CLIFOR
TYPE(6) = STRINGA
POSITION(6) = 27
LENGTH(6) = 1
FIELD(6) = 25->TIPOC
NAME(7) = CODICE CLIFOR
TYPE(7) = STRINGA
POSITION(7) = 28
LENGTH(7) = 10
FIELD(7) = 25->SOTTOCONTO
NAME(8) = DESCRIZIONE RIGA
TYPE(8) = STRINGA
POSITION(8) = 38
LENGTH(8) = 40
NAME(9) = IMPORTO SOTTOCONTO
TYPE(9) = IMPORTO
POSITION(9) = 78
LENGTH(9) = 14
DECIMAL(9) = 2
MESSAGE(9) = _IMPORTO
NAME(10) = IMPONIBILE
TYPE(10) = IMPORTO
POSITION(10) = 92
LENGTH(10) = 14
DECIMAL(10) = 2
FIELD(10) = 25->IMPONIBILE
MESSAGE(10) = _IMPORTO
NAME(11) = CODICE IVA
TYPE(11) = STRINGA
POSITION(11) = 106
LENGTH(11) = 4
FIELD(11) = 25->CODIVA
NAME(12) = CP INDED
TYPE(12) = STRINGA
POSITION(12) = 110
LENGTH(12) = 15
NAME(13) = COMMESSA
TYPE(13) = STRINGA
POSITION(13) = 125
LENGTH(13) = 20
FIELD(13) = 25->CODCMS
NAME(14) = VOCE DI SPESA
TYPE(14) = STRINGA
POSITION(14) = 145
LENGTH(14) = 10
FIELD(14) = 25->FASCMS
[RECORD C]
NAME(0) = CODICE
TYPE(0) = STRINGA
POSITION(0) = 0
LENGTH(0) = 10
FIELD(0) = 20->CODCF
NAME(1) = RAGIONE SOCIALE
TYPE(1) = STRINGA
POSITION(1) = 11
LENGTH(1) = 40
FIELD(1) = 20->RAGSOC[1,40]
NAME(2) = PARTITA IVA
TYPE(2) = STRINGA
POSITION(2) = 50
LENGTH(2) = 12
FIELD(2)=20->PAIV
NAME(3) = CODICE FISCALE
TYPE(3) = STRINGA
POSITION(3) = 62
LENGTH(3) = 16
FIELD(3) = 20->COFI
NAME(4) = INDIRIZZO
TYPE(4) = STRINGA
POSITION(4) = 78
LENGTH(4) = 40
FIELD(4) = 20->INDCF
NAME(5) = CAP DI RESIDENZA
TYPE(5) = STRINGA
POSITION(5) = 40
LENGTH(5) = 5
FIELD(5)=20->CAPCF
NAME(6) = COMUNE DI RESIDENZA
TYPE(6) = STRINGA
POSITION(6) = 45
LENGTH(6) = 23
NAME(7) = PROVINCIA DI RESIDENZA
TYPE(7) = STRINGA
POSITION(7) = 68
LENGTH(7) = 2
[RECORD P]
NAME(0) = CODICE MASTRO
TYPE(0) = STRINGA
POSITION(0) = 0
LENGTH(0) = 5
FIELD(0)=19->GRUPPO
NAME(1) = CODICE MCONTO
TYPE(1) = STRINGA
POSITION(1) = 5
B LENGTH(1) = 5
FIELD(1)=19->CONTO
NAME(2) = CODICE SOTTOCONTO
TYPE(2) = STRINGA
POSITION(2) = 10
LENGTH(2) = 5
FIELD(2)=19->SOTTOCONTO
NAME(3) = DESCRIZIONE
TYPE(3) = STRINGA
POSITION(3) = 15
LENGTH(3) = 80
FIELD(3)=19->DESCR
[OPZIONI]
PERCORSO = C:\TEMP\

View File

@ -33,6 +33,7 @@
#define F_SHEET 530
#define F_UNITA 531
#define F_PARAMS 532
#define F_NOTE 533
// settaggio variabili globali
#define F_VAR_IMPIANTO 550

View File

@ -54,12 +54,12 @@ PAGE "Distinta" -1 -1 80 20
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 1 "Distinta"
PROMPT 1 0 "Distinta"
END
STRING F_CODICE 20
BEGIN
PROMPT 2 2 "Codice "
PROMPT 2 1 "Codice "
FLAGS "GUD"
KEY 1
FIELD CODDIST
@ -68,7 +68,7 @@ END
LIST F_TIPO 1 12
BEGIN
PROMPT 54 2 "Tipo "
PROMPT 54 1 "Tipo "
ITEM "A|Articolo"
MESSAGE "",F_VIRTUALE|ENABLE,F_MASTER|ENABLE,F_ARTACQ|ENABLE,F_ARTPROD
ITEM "L|Lavorazione"
@ -87,19 +87,25 @@ BEGIN
FIELD VIRTUALE
END
GROUPBOX DLG_NULL 78 6
GROUPBOX DLG_NULL 78 7
BEGIN
PROMPT 1 3 ""
PROMPT 1 2 ""
END
STRING F_DESCR 50
BEGIN
PROMPT 2 4 "Descrizione "
PROMPT 2 3 "Descrizione "
FIELD DESCR
GROUP 1
FLAGS "D"
END
ZOOM F_NOTE 50
BEGIN
PROMPT 2 4 "Annotazioni "
FIELD NOTE
END
BOOLEAN F_ARTPROD
BEGIN
PROMPT 2 5 "Articolo di produzione"

View File

@ -1,3 +1,3 @@
112
0
$dist|0|0|133|0|Distinte|||
$dist|0|0|143|0|Distinte|||

View File

@ -1,10 +1,11 @@
112
13
14
CODDIST|1|20|0|Codice distinta
VIRTUALE|8|1|0|Distinta virtuale (non e' un articolo)
ARTPROD|8|1|0|Articolo di produzione
ARTACQ|8|1|0|Articolo di acquisto
DESCR|1|50|0|Descrizione
NOTE|11|10|0|Annotazioni
UMP|1|3|0|Unita' di misura del peso
PESO|4|15|5|Peso
UM|1|3|0|Unita' di misura

View File

@ -1405,7 +1405,7 @@ void TContabilizzazione_effetti_app::contabilize_bill(const char tipo, const lon
const TRectype& riga = sorted[n];
build_eff_key(riga, curr_key, 0);
if (n == 1 || (dettaglio_rate && curr_key != last_key))
if (n == 1 || (dettaglio_rate && curr_key != last_key) || customers.items() == 0)
{
add_cg_row(eff, riga, customers, banks, FALSE);
last_key = curr_key;

View File

@ -64,7 +64,7 @@ public:
void TRecord_intra::put(const char* str, int pos, int dim, const char* flags)
{
CHECKD(pos > 0 && pos < size(), "Invalid field position:", pos);
CHECKD(dim > 0 && dim <= 50, "Invalid field dimension:", dim);
CHECKD(dim > 0 && dim <= 200, "Invalid field dimension:", dim);
TString256 val(str);
if (val.len() < dim)
{
@ -153,7 +153,9 @@ void TRecord_intra::genera_testata(const TIntra_context& ic)
put(ic._tipo, 29); // Tipo riepilogo
put(ic._anno % 100, 30, 2);
put(ic._freq, 32);
put(ic._periodo, 33, 2);
const int periodo = ic._freq == 'A' ? 0 : ic._periodo;
put(periodo, 33, 2);
TString16 cod = mid(5, 11); // Ricopia la parita iva della ditta
put(cod, 35, 11);
@ -561,11 +563,12 @@ void TDischetto_mask::genera_dischetto(char tip, int mode)
ird.put("R0", ic._totale_riep);
ird.put("R1", ic._totale_rett);
if (exist)
ird.rewrite();
else
ird.write();
set(F_NUMERO, ic._progr + 1);
}
TDischetto_mask::TDischetto_mask()

View File

@ -34,7 +34,7 @@ BEGIN
FLAGS "D"
END
NUMBER F_NUM_REG 5
NUMBER F_NUM_REG 7
BEGIN
PROMPT 1 3 "Numero registrazione "
USE LF_INTRA
@ -53,7 +53,7 @@ END
DATA F_DATA_DOC
BEGIN
PROMPT 32 3 "Documento: numero "
PROMPT 34 3 "Documento numero "
FLAGS "D"
END

View File

@ -21,7 +21,7 @@ enum AVM_opcode
avm_nop,
avm_add, avm_and,
avm_begin,
avm_call_word, avm_cold,
avm_call_word, avm_cold, avm_cr,
avm_cmp_eq, avm_cmp_gt, avm_cmp_gteq, avm_cmp_lt, avm_cmp_lteq, avm_cmp_noteq,
avm_cmp_emptyeq, avm_cmp_nulleq, avm_cmp_zeroeq,
avm_div, avm_divide, avm_do, avm_dot, avm_drop, avm_dup,
@ -49,7 +49,7 @@ const char* AVM_TOKENS[avm_zzz+1] =
"$NOP$",
"+", "AND",
"BEGIN",
"$CALL_WORD$", "COLD",
"$CALL_WORD$", "COLD", "CR",
"=", ">", ">=", "<", "<=", "<>",
"EMPTY=", "NULL=", "0=",
"DIV", "/", "DO", ".", "DROP", "DUP",
@ -765,6 +765,7 @@ void TAVM::execute(const TAVM_op& op)
case avm_begin: break;
case avm_call_word: do_call(op.var().as_string()); break;
case avm_cold: do_restart(true); _bc = NULL; break;
case avm_cr: _stack.push("\n"); break;
case avm_cmp_eq : _stack.push(compare_tos_nos() == 0); break;
case avm_cmp_gt : _stack.push(compare_tos_nos() > 0); break;
case avm_cmp_gteq : _stack.push(compare_tos_nos() >= 0); break;

View File

@ -20,6 +20,7 @@
#define COM_UFFESCOM "UFFESCOM"
#define COM_ALIQICI "ALIQICI"
#define COM_TERRMON "TERRMON"
#define COM_CODREG "CODREG"
#endif

View File

@ -96,6 +96,8 @@ protected:
// anche queste funzioni vanno derivata quando viene derivata la precedente; faranno uso di un puntatore a maschera diverso
virtual TMask* get_mask() { return _m; }
virtual void destroy_mask() { delete _m; }
// metodo che ritorna il config
virtual TConfig* get_config() {return _cnf; }
// @access Public Member
public:

View File

@ -2395,5 +2395,5 @@ TListbox_control::TListbox_control(WINDOW win, short cid,
TListbox_control::~TListbox_control()
{
delete _ddl;
delete _ddl; _ddl = NULL;
}

View File

@ -303,7 +303,7 @@ void TExpression::setvar(const char* varname, const char* val)
void TExpression::setvar(int varnum, const char* val)
{
if (strcmp(_var.getstring(varnum), val) != 0)
if (_var.getstring(varnum) != val)
{
_var.set(varnum, val);
_dirty = TRUE;
@ -597,7 +597,7 @@ void TExpression::eval()
break;
case _len:
{
TString& s1 = evalstack.pop_string();
const TString& s1 = evalstack.pop_string();
evalstack.push(s1.len());
}
break;

View File

@ -2579,7 +2579,7 @@ TForm_editor& TForm::editor() const
{ return (TForm_editor&)main_app(); }
//
bool TForm::parse_use(TScanner& scanner)
bool TForm::parse_use(TScanner& scanner, TString & filter)
{
const int logicnum = scanner.integer();
const char* tab = NULL;
@ -2598,26 +2598,21 @@ bool TForm::parse_use(TScanner& scanner)
else
scanner.push();
if (scanner.popkey() == "BY" || scanner.key() == "FI") // file sorted or filtered
{
if (scanner.key() == "BY" ) { // "sort BY": user-defined sort
TToken_string ordexpr(parse_sortexpr(scanner));
_cursor = new TSorted_cursor(_relation, ordexpr,"", key);
} else {
TToken_string filter(parse_filter(scanner));
_cursor = new TCursor(_relation,filter, key);
}
} else {
if (scanner.popkey() == "FI" || scanner.key() == "SE") // "Filter" : sorted defined by the user
filter = parse_filter(scanner);
else
scanner.push();
_cursor = new TCursor(_relation,"", key);
}
if (scanner.popkey() == "FI") // "FIlter" : sorted defined by the user
if (scanner.popkey() == "BY") // "sort BY": user-defined sort
{
TToken_string filter(parse_filter(scanner));
_cursor->setfilter(filter);
} else {
TToken_string ordexpr(parse_sortexpr(scanner));
_cursor = new TSorted_cursor(_relation, ordexpr, "", key);
}
else
{
scanner.push();
_cursor = new TCursor(_relation, "", key);
}
return TRUE;
@ -4571,7 +4566,9 @@ void TForm::read(
bool ok = TRUE;
if (scanner.popkey() == "US") // Parse relation
{
ok = parse_use(scanner);
TString filter(80);
ok = parse_use(scanner, filter);
while (ok && scanner.popkey() == "JO" || scanner.key() == "SO")
{
if (scanner.key() == "JO")
@ -4581,7 +4578,8 @@ void TForm::read(
ok= parse_sortedjoin(scanner);
}
}
if (!filter.empty())
_cursor->setfilter(filter);
parse_description(scanner); // Parse description
}
else scanner.push();

View File

@ -195,7 +195,7 @@ protected:
virtual void print_on(ostream& out) const;
// @cmember Legge una use e setta la relazione (ritorna sempre TRUE)
bool parse_use(TScanner&);
bool parse_use(TScanner&, TString &);
// @cmember Legge una join e setta la relazione (ritorna sempre TRUE)
bool parse_join(TScanner& scanner);
// @cmember Legge una join e setta la relazione (ritorna sempre TRUE)

View File

@ -162,6 +162,9 @@
#define LF_RRIP 150
#define LF_SALDANA 151
#define LF_RILPROD 152
#define LF_EXTERNAL 1000 // Files with id >= are considered to be externals
@ -176,4 +179,3 @@

View File

@ -1395,8 +1395,8 @@ TEditable_field* TMask::get_key_field(
bool TMask::key_valid(word key) const
{
const int max = fields();
for (short f = 0; f < max; f++)
const int maxflds = fields();
for (int f = 0; f < maxflds; f++)
{
TMask_field& c = fld(f);
if (c.is_editable() && c.shown())
@ -1405,11 +1405,11 @@ bool TMask::key_valid(word key) const
if (e.required() && e.in_key(key))
{
if (e.empty())
return FALSE;
return false;
}
}
}
return TRUE;
return true;
}
// @doc EXTERNAL

View File

@ -9,6 +9,7 @@
#include <msksheet.h>
#include <prefix.h>
#include <recarray.h>
#include <recset.h>
#include <relapp.h>
#include <relation.h>
#include <sheet.h>
@ -2870,6 +2871,50 @@ bool TProfile_select::check(CheckTime ct)
return TRUE;
}
///////////////////////////////////////////////////////////
// TReport_select
///////////////////////////////////////////////////////////
TReport_select::TReport_select(TEdit_field* ef, const char* library)
: TBrowse_button(ef), _library(library)
{ }
void TReport_select::parse_input(TScanner& scanner)
{
scanner.pop();
}
void TReport_select::parse_output(TScanner& scanner)
{
scanner.pop();
}
KEY TReport_select::run()
{
TFilename path;
if (select_custom_file(path, "rep", _library))
{
path = path.name();
path.ext("");
field().set(path);
}
return path.not_empty() ? K_ENTER : K_ESC;
}
bool TReport_select::check(CheckTime ct)
{
TFilename name = field().get();
if (ct != STARTING_CHECK && name.empty() &&
field().check_type() == CHECK_REQUIRED)
return false;
bool ok = true;
if (field().roman()) // Must exist
ok = name.custom_path();
return ok;
}
///////////////////////////////////////////////////////////
// TEdit_field
///////////////////////////////////////////////////////////
@ -3092,6 +3137,17 @@ bool TEdit_field::parse_item(TScanner& scanner)
return TRUE;
}
if (scanner.key() == "RS") // RSELECT
{
#ifdef DBG
if (_browse)
NFCHECK("RSELECT duplicato nel campo %d", _ctl_data._dlg);
#endif
_browse = new TReport_select(this, scanner.string());
_check_enabled = TRUE;
return TRUE;
}
if (scanner.key() == "IT") // ITEM
{
#ifdef DBG
@ -4642,6 +4698,19 @@ void TRadio_field::current(int n)
_str.trim();
}
bool TRadio_field::select_by_initial(char c)
{
for (int i = _values.items()-1; i >= 0; i--)
{
const char* tok = _values.get(i);
if (toupper(*tok) == toupper(c) && _str != _codes.get(i))
{
current(i);
return true;
}
}
return false;
}
///////////////////////////////////////////////////////////
// TMemo_field

View File

@ -989,6 +989,29 @@ public:
virtual ~TFile_select() { }
};
class TReport_select : public TBrowse_button
{
TString _library;
public:
// @cmember Controlla la sintassi della input del campo e ne setta i membri
virtual void parse_input(TScanner& scanner);
// @cmember Controlla la sintassi della output del campo e ne setta i membri
virtual void parse_output(TScanner& scanner);
virtual KEY run();
// @cmember Controlla la validita' del campo
virtual bool check(CheckTime = RUNNING_CHECK);
virtual bool is_filesel() const { return TRUE; }
TReport_select(TEdit_field* ef, const char* library);
virtual ~TReport_select() { }
};
class TProfile_select : public TBrowse_button
{
protected:
@ -1076,6 +1099,9 @@ public:
{ return _browse != NULL || _flags.button; }
// @cmember Imposta la ricerca del campo
virtual void set_query_button(TBrowse_button* ) ;
// @cmember Legge un item del controllo dal file <p scanner>
virtual bool parse_item(TScanner& scanner);
// @cmember Ritorna TRUE se il campo e' di tipo edit
virtual bool is_edit() const { return TRUE; }
@ -1384,7 +1410,7 @@ public:
virtual bool is_kind_of(word cid) const;
// @cmember Seleziona sulla base dell'iniziale
bool select_by_initial(char c);
virtual bool select_by_initial(char c);
// @cmember Seleziona il prossimo se possibile (no wrap)
bool select_next() { return select_by_ofs(1); }
@ -1420,6 +1446,8 @@ protected:
// @cmember Ritorna la voce corrente
virtual int current() const;
virtual bool select_by_initial(char c);
// @access Public Member
public:
// @cmember Costruttore

View File

@ -40,12 +40,16 @@ class TRow_property : public TObject
{
TBit_array _disabled;
COLOR _back, _fore;
int _height;
TArray * _cell_prop;
public:
void set(int col, COLOR back, COLOR fore);
void get(int col, COLOR & back, COLOR & fore) const;
void set_height(int h) { _height = h; }
int height() const { return _height; }
TBit_array & disabled() { return _disabled;}
const TBit_array & disabled() const { return _disabled;}
TRow_property();
@ -54,7 +58,7 @@ public:
TRow_property::TRow_property()
// : _back(NORMAL_BACK_COLOR), _fore(NORMAL_COLOR), _cell_prop(NULL)
: _back(0), _fore(0), _cell_prop(NULL)
: _back(0), _fore(0), _height(-1), _cell_prop(NULL)
{
}
@ -304,6 +308,8 @@ public:
const char* get_column_header(const int col) const;
// @cmember Setta l'allineamento di una colonna
void set_column_justify(int col, bool right);
// @cmember Setta l'altezza della riga
void set_row_height(const int row, const int height);
// @cmember Permette di abilitare/disabilitare una singola cella
void enable_cell(int row, int column, bool on = TRUE);
// @cmember Controlla se una cella e' disabilitata
@ -746,6 +752,10 @@ int TSpreadsheet::find_enabled_column(int rec, int colonna, int direction) const
{
CHECKD(direction == +1 || direction == -1, "Bad column search direction", direction);
const TRow_property* prop = ((TSpreadsheet*)this)->get_property(rec);
if (prop != NULL && prop->height() == 0)
return 0;
int num;
XI_OBJ** column = xi_get_member_list(_obj, &num);
if (colonna <= 0 || colonna >= num)
@ -1031,26 +1041,39 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
long n = items() * (long)xiev->v.rec_request.percent / 100L;
if (n < 0L) n = 0L;
xiev->v.rec_request.data_rec = n;
const TRow_property* prop = get_property(0);
if (prop != NULL && prop->height() >= 0)
xiev->v.rec_request.row_height = prop->height();
}
else
refused = TRUE;
break;
case XIE_GET_LAST:
xiev->v.rec_request.data_rec = items()-1;
{
xiev->v.rec_request.data_rec = items()-1;
const TRow_property* prop = get_property(xiev->v.rec_request.data_rec);
if (prop != NULL && prop->height() >= 0)
xiev->v.rec_request.row_height = prop->height();
}
break;
case XIE_GET_PREV:
case XIE_GET_NEXT:
{
const long n = xiev->v.rec_request.spec_rec + (xiev->type == XIE_GET_NEXT ? +1 : -1) ;
if (n < 0 || n >= items())
refused = TRUE;
else
xiev->v.rec_request.data_rec = n;
}
{
const long n = xiev->v.rec_request.spec_rec + (xiev->type == XIE_GET_NEXT ? +1 : -1) ;
if (n < 0 || n >= items())
refused = TRUE;
else
{
xiev->v.rec_request.data_rec = n;
const TRow_property* prop = get_property(n);
if (prop != NULL && prop->height() >= 0)
xiev->v.rec_request.row_height = prop->height();
}
}
break;
case XIE_CELL_REQUEST:
{
const int rec = (int)xiev->v.cell_request.rec;
const long rec = xiev->v.cell_request.rec;
const int maxlen = xiev->v.cell_request.len;
char numrig[8];
const char* src = NULL;
@ -1138,7 +1161,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
else
{
sprintf(numrig, "%d", rec+1);
src = numrig;
src = numrig;
}
char* dst = xiev->v.cell_request.s;
@ -2146,6 +2169,12 @@ void TSpreadsheet::set_column_justify(int col, bool right)
}
}
void TSpreadsheet::set_row_height(const int row, const int height)
{
TRow_property* prop = get_property(row, true);
prop->set_height(height);
}
TRow_property* TSpreadsheet::get_property(int row, bool create)
{
TRow_property* p = (TRow_property*)_property.objptr(row);
@ -2298,14 +2327,15 @@ void TSpreadsheet::set_columns_order(TToken_string* order)
bool TSpreadsheet::cell_disabled(int row, int column) const
{
const TRow_property* prop = ((TSpreadsheet*)this)->get_property(row);
bool d;
bool d = false;
if (column < 0)
d = (prop == NULL) ? FALSE : (prop->disabled().ones() >= columns()-1);
d = (prop == NULL) ? false : (prop->disabled().ones() >= columns()-1);
else
{
d = _column_disabled[column]; // Controlla la colonna
if (d == FALSE && prop != NULL) // Se la colonna e' disabilitata e' inutile proseguire
d = prop->disabled()[column]; // Controlla la cella
if (d == false && prop != NULL) // Se la colonna e' disabilitata e' inutile proseguire
d = prop->disabled()[column]; // Controlla la cella
}
return d;
}
@ -2828,6 +2858,12 @@ void TSheet_field::set_column_justify(int col, bool right)
s->set_column_justify(col, right);
}
void TSheet_field::set_row_height( const int row, const int height )
{
TSpreadsheet* s = (TSpreadsheet*)_ctl;
s->set_row_height(row, height);
}
TMask& TSheet_field::sheet_mask() const
{
TSpreadsheet* s = (TSpreadsheet*)_ctl;

View File

@ -241,6 +241,8 @@ public:
const char* get_column_header(const int col) const;
// @cmember Setta l'allineamento della colonna
void set_column_justify(int col, bool right);
// @cmember Setta l'altezza della riga
void set_row_height( const int row, const int height );
// @cmember Setta il colore dello sfondo e del testo di una o tutte le righe
void set_back_and_fore_color(COLOR back, COLOR fore, int row, int col = -1);
// @cmember Memorizza la disposizione delle colonne

View File

@ -1,7 +1,8 @@
#include "../xvaga/incstr.h"
#include <diction.h>
#include <applicat.h>
#include <extcdecl.h>
#include <modaut.h>
#include <progind.h>
#include <recset.h>
#include <relation.h>
@ -10,7 +11,6 @@
#include <statbar.h>
///////////////////////////////////////////////////////////
// TTable name converter
///////////////////////////////////////////////////////////
@ -60,8 +60,10 @@ void TTable_names::fill()
}
}
int TTable_names::logic_num(const TString& name)
int TTable_names::logic_num(const TString& n)
{
// Non cambiare: n puo' essere temporaneo e pieno di spazi!
TString80 name = n; name.trim();
if (isdigit(name[0]))
{
int num = atoi(name);
@ -76,9 +78,8 @@ int TTable_names::logic_num(const TString& name)
TString* str = (TString*)_names.objptr(name);
if (str == NULL)
{
const TString16 savename = name; // Preserve temporary!
fill();
str = (TString*)_names.objptr(savename);
str = (TString*)_names.objptr(name);
}
if (str == NULL && name.len() == 3)
@ -232,6 +233,15 @@ bool TRecordset::save_as_silk(const char* path)
ofstream out(path);
out << "ID;PWXL;N;E" << endl;
// Larghezza colonne
for (unsigned int h = 0; h < columns(); h++)
{
const TRecordset_column_info& ci = column_info(h);
const int w = max(ci._width, ci._name.len());
out << "F;W" << (h+1) << ' ' << (h+1) << ' ' << w << endl;
}
// Intestazioni colonne
for (unsigned int c = 0; c < columns(); c++)
{
const TRecordset_column_info& ci = column_info(c);
@ -247,7 +257,11 @@ bool TRecordset::save_as_silk(const char* path)
break;
for (unsigned int c = 0; c < columns(); c++)
{
out << "C;Y" << (n+2) << ";X" << (c+1) << ";K\"";
const TRecordset_column_info& ci = column_info(c);
const bool is_alpha = ci._type == _alfafld || ci._type == _charfld || ci._type == _memofld;
out << "C;Y" << (n+2) << ";X" << (c+1) << ";K";
if (is_alpha) out << '"';
get(c).as_string(val);
if (!val.blank())
{
@ -255,7 +269,8 @@ bool TRecordset::save_as_silk(const char* path)
val.replace('"', '\'');
out << val;
}
out << '"' << endl;
if (is_alpha) out << '"';
out << endl;
}
}
out << "E" << endl;
@ -408,6 +423,9 @@ const TVariant& TRecordset::get(const char* column_name) const
const TVariant& TRecordset::get_var(const char* name) const
{
if (_parentset != NULL && strncmp(name, "#PARENT.", 8) == 0)
return _parentset->get(name+8);
const TVariant* var = (const TVariant*)_var.objptr(name);
return var != NULL ? *var : NULL_VARIANT;
}
@ -430,6 +448,8 @@ bool TRecordset::set_var(const char* name, const TVariant& var, bool create)
ok = true;
}
}
if (ok)
requery();
return ok;
}
@ -455,7 +475,7 @@ void TRecordset::find_and_reset_vars()
if (is_var_separator(sql[diesis-1])) // Controllo che ci sia un separatore prima del #
{
int i = diesis+1;
for ( ; sql[i] && (isalnum(sql[i]) || sql[i] == '_'); i++);
for ( ; sql[i] && (isalnum(sql[i]) || sql[i] == '_' || sql[i] == '.'); i++);
if (i > diesis+1)
{
const TString& name = sql.sub(diesis, i);
@ -537,7 +557,6 @@ bool TRecordset::ask_variables(bool all)
ask_variable(*name, var);
if (var.is_null())
var.set(""); // Mi serve assolutamente un valore!
set_var(*name, var);
}
}
@ -545,54 +564,97 @@ bool TRecordset::ask_variables(bool all)
return ok;
}
TRecordset::TRecordset() : _parentset(NULL)
{ }
///////////////////////////////////////////////////////////
// Utility
///////////////////////////////////////////////////////////
bool select_custom_file(TFilename& path, const char* ext)
static void sort_files(TString_array& files)
{
TFilename custom = firm2dir(-1);
custom.add("custom");
if (!custom.exist())
xvt_fsys_mkdir(custom);
TFilename path;
path = custom;
path.add("*");
path.ext(ext);
// Trasforma i path completi in nomi senza estensione
FOR_EACH_ARRAY_ROW(files, i, row)
{
path = *row;
path = path.name();
path.ext("");
*row = path;
}
files.sort(); // Ordina alfabeticamente
// Rimuove i files doppi proveninenti da Campo e Custom
for (int j = files.last(); j > 0; j--)
{
if (files.row(j) == files.row(j-1))
files.destroy(j);
}
}
bool select_custom_file(TFilename& path, const char* ext, const char* library)
{
TString_array files;
list_files(path, files);
TArray_sheet sheet(-1, -1, 78, 20, TR("Selezione"), HR("Nome@20|Descrizione@50"));
// Leggo i files in custom
if (main_app().has_module(RSAUT))
{
TFilename custom = firm2dir(-1);
custom.add("custom");
if (!custom.exist())
xvt_fsys_mkdir(custom);
path = custom;
path.add("*");
path.ext(ext);
list_files(path, files);
}
path = "*."; path.ext(ext); // Leggo i files in campo
list_files(path, files);
sort_files(files); // Ordino i files e rimuovo i doppioni
TArray_sheet sheet(-1, -1, 78, 20, TR("Selezione"), HR("Nome@20|Descrizione@50|Librerie@20"));
TString str;
FOR_EACH_ARRAY_ROW(files, i, row)
{
TXmlItem item;
if (item.Load(*row))
path = *row; path.ext(ext);
if (path.custom_path())
{
TToken_string* riga = new TToken_string;
path = *row;
path = path.name();
path.ext("");
riga->add(path);
TXmlItem item;
bool ok = item.Load(path);
if (ok && library != NULL && *library)
{
const TString& include = item.GetAttr("libraries");
ok = include.find(library) >= 0;
}
if (ok)
{
TToken_string* riga = new TToken_string;
riga->add(*row);
const TXmlItem* desc = item.FindFirst("description");
str = *row;
if (desc != NULL)
desc->GetEnclosedText(str);
riga->add(str);
const TXmlItem* desc = item.FindFirst("description");
str = *row;
if (desc != NULL)
desc->GetEnclosedText(str);
riga->add(str);
riga->add(item.GetAttr("libraries"));
sheet.add(riga);
sheet.add(riga);
}
}
}
const bool ok = sheet.run() == K_ENTER;
bool ok = sheet.run() == K_ENTER;
if (ok)
{
path = custom;
path.add(sheet.row(-1).get(0));
path = sheet.row(-1).get(0);
path.ext(ext);
ok = path.custom_path();
}
return ok;
}
@ -1005,15 +1067,10 @@ static int query_get_items(void* jolly, int argc, char** values, char** columns)
return q->on_get_items(argc, values, columns);
}
bool TSQL_recordset::set_var(const char* name, const TVariant& var, bool create)
void TSQL_recordset::requery()
{
const bool ok = TRecordset::set_var(name, var, create);
if (ok)
{
_items = 0;
_page.destroy();
}
return ok;
_items = 0;
_page.destroy();
}
TRecnotype TSQL_recordset::items() const
@ -1463,28 +1520,25 @@ TCursor_parser::TCursor_parser(istream& instr, TArray& col)
push();
pop();
if (tok.starts_with("BY")) // "sort BY": user-defined sort
{
TToken_string ordexpr(256);
parse_sortexpr(ordexpr);
_cursor = new TSorted_cursor(_relation, ordexpr,"", key);
}
TToken_string filter;
if (tok.starts_with("FI") || tok.starts_with("SE"))
parse_filter(filter);
else
push();
pop();
if (tok.starts_with("FI") || tok.starts_with("SE"))
{
TToken_string filter;
parse_filter(filter);
if (_cursor == NULL)
_cursor = new TCursor(_relation, filter, key);
else
_cursor->setfilter(filter);
if (tok.starts_with("BY")) // "sort BY": user-defined sort
{
TToken_string ordexpr(256);
parse_sortexpr(ordexpr);
_cursor = new TSorted_cursor(_relation, ordexpr, "", key);
}
else
push();
if (_cursor == NULL)
_cursor = new TCursor(_relation, "", key);
@ -1509,7 +1563,8 @@ TCursor_parser::TCursor_parser(istream& instr, TArray& col)
if (!rec_start.empty() || !rec_stop.empty())
_cursor->setregion(rec_start, rec_stop, 0x2);
if (!filter.empty())
_cursor->setfilter(filter);
if (_relation->items() == 0) // Non ci sono anche tabelle collegate
{
FOR_EACH_ARRAY_ITEM(_column, i, obj)
@ -1735,12 +1790,13 @@ void TISAM_recordset::reset()
}
}
bool TISAM_recordset::set_var(const char* name, const TVariant& var, bool create)
void TISAM_recordset::requery()
{
const bool ok = TRecordset::set_var(name, var, create);
if (ok)
reset();
return ok;
if (_cursor != NULL)
{
delete _cursor;
_cursor = NULL;
}
}
void TISAM_recordset::set(const char* use)

View File

@ -30,6 +30,7 @@ class TRecordset : public TObject
{
TAssoc_array _var;
TString_array _varnames;
const TRecordset* _parentset;
protected:
bool save_as_html(const char* path);
@ -44,6 +45,7 @@ public: // Absolutely needed methods
virtual TRecnotype items() const pure;
virtual bool move_to(TRecnotype pos) pure;
virtual TRecnotype current_row() const pure;
virtual void requery() pure;
virtual bool move_first() { return move_to(0); }
virtual bool move_prev() { return move_to(current_row()-1); }
@ -67,6 +69,9 @@ public: // Absolutely needed methods
virtual const TToken_string& sheet_head() const;
virtual bool save_as(const char* path, TRecordsetExportFormat fmt = fmt_unknown);
void set_parent(const TRecordset* rs) { _parentset = rs; }
TRecordset();
virtual ~TRecordset() { }
};
@ -83,17 +88,17 @@ class TSQL_recordset : public TRecordset
TArray _page;
protected:
void reset();
virtual void reset();
void parsed_sql_text(TString& sql) const;
public: // TRecordset
virtual void requery();
virtual TRecnotype items() const;
virtual bool move_to(TRecnotype pos);
virtual TRecnotype current_row() const { return _current_row; }
virtual unsigned int columns() const;
virtual const TRecordset_column_info& column_info(unsigned int c) const;
virtual const TVariant& get(unsigned int column) const;
virtual bool set_var(const char* name, const TVariant& var, bool create = false);
const TString& query_text() const { return _sql; }
public:
@ -124,12 +129,13 @@ protected:
TCursor* cursor() const;
TRelation* relation() const;
void reset();
virtual void reset();
TVariant& get_tmp_var() const;
virtual const TVariant& get(int logic, const char* field) const;
public:
void set(const char* use);
virtual void requery();
virtual TRecnotype items() const;
virtual bool move_to(TRecnotype pos);
virtual TRecnotype current_row() const;
@ -137,7 +143,6 @@ public:
virtual const TRecordset_column_info& column_info(unsigned int c) const;
virtual const TVariant& get(unsigned int column) const;
virtual const TVariant& get(const char* column_name) const;
virtual bool set_var(const char* name, const TVariant& var, bool create = false);
virtual const TString& query_text() const { return _use; }
TISAM_recordset(const char* use);
@ -164,7 +169,7 @@ public:
// Utility
///////////////////////////////////////////////////////////
bool select_custom_file(TFilename& path, const char* ext);
bool select_custom_file(TFilename& path, const char* ext, const char* library = NULL);
const TString& logic2table(int logic_num);
int table2logic(const TString& name);

View File

@ -182,7 +182,7 @@ protected:
// @cmember Cancella il record corrente
virtual bool remove();
// @cmember Richiede una stringa nella forma CAMPO1<pipe>VALORE1<pipe>CAMPO2<pipe>VALORE2<pipe>...
// @cmember Deve ritornare una stringa nella forma CAMPO1<pipe>VALORE1<pipe>CAMPO2<pipe>VALORE2<pipe>...
// <pipe>CAMPOn<pipe>VALOREn contenente le coppie NUMERO_CAMPO_MASCHERA - VALORE_DA_ASSEGNARE
// che descrivono il prossimo codice libero da utilizzare per la autonumerazione.
// <nl>Nel caso di banale numerazione progressiva potrebbe essere implementata come

View File

@ -1052,6 +1052,8 @@ TRecnotype TCursor::buildcursor(TRecnotype rp)
const bool filtered = has_filter();
const bool simple_filter = filtered && has_simple_filter();
while (!DB_index_eof(fhnd))
{
@ -1109,7 +1111,9 @@ TRecnotype TCursor::buildcursor(TRecnotype rp)
bool TCursor::filtercursor(TRecnotype recno)
{
file().readat(recno);
if (update_relation())
if (update_relation())
{
// memorizzo la chiave prima di eventuali spostamenti
const TString s0(DB_index_getkey(file().handle()));
@ -1371,6 +1375,15 @@ void TCursor::filter(
if (vn[0] != '#')
{
TFieldref f(vn, 0);
const TString & id = f.id();
if (!id.empty())
{
_filter_update = true;
const int file_id = _if->name2ind(id);
if (_filter_limit < file_id)
_filter_limit = file_id;
}
_frefs.add(new TRecfield(_if->curr(f.file()), f.name(), f.from(), f.to()), i);
}
else
@ -1791,9 +1804,18 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
s.rtrim(1);
TFieldref f(s,0);
// Il controllo del file e' automatico in f.len()
const int n = f.file();
const TRectype& r = relation()->curr(n);
const TString & id = f.id();
const TRectype& r = relation()->lfile(id).curr();
const int flen = f.len(r);
if (!id.empty())
{
_sort_update = true;
const int file_id = relation()->name2ind(id);
if (filter_limit() < file_id)
set_filter_limit(file_id);
}
sort.addsortkey(abspos,flen,versus);
CHECKS(flen!=0,"Field can not have null length: ",(const char *) s);
@ -1823,7 +1845,7 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
oldrecno=recno;
// Attenzione: la filtercursor non si silita a filtrare ma avanza anche il cursore!!!!
// Attenzione: la filtercursor non si si limita a filtrare ma avanza anche il cursore!!!!
const bool to_be_added = filtercursor(recno);
if (to_be_added)
{
@ -1995,7 +2017,8 @@ TRecnotype TSorted_cursor::read(TIsamop op, TReclock lockop)
}
void TSorted_cursor::change_order(const char* order_expr)
{
{
_sort_update = false;
if (order_expr && *order_expr && _order_expr != order_expr)
{
TString s;

View File

@ -23,6 +23,8 @@ class TRelation : public TObject
friend class TRelation_description;
// @cfriend TCursor
friend class TCursor;
// @cfriend TSorted_cursor
friend class TSorted_cursor;
// @access:(INTERNAL) Private Member
@ -302,10 +304,11 @@ protected:
void filter(const char* filter, const TRectype* from = NULL, const TRectype* to = NULL, int tilde = 0x0);
// @cmember Indica se e' possibile fare l'update sulla relazione (se e' possibile
// sia sull'espressione-filtro che sulla funzione-filtro)
bool update_relation() const
virtual bool update_relation() const
{ return (_filter_update || _filterfunction_update); }
int filter_limit() const { return _filter_limit; }
void set_filter_limit(int l) { _filter_limit = l; }
// @access Public Member
public:
@ -377,7 +380,7 @@ public:
{ return _frozen; }
// @cmember Permette di modificare l'espressione-filtro
void setfilter(const char* filter_expr, bool update=FALSE, int limit = 0)
{ filter(filter_expr); _filter_update = update; _filter_limit = limit; }
{ _filter_update = update; _filter_limit = limit; filter(filter_expr); }
// @cmember Setta la regione-filtro dal record <p from> al record <p to>
void setregion(const TRectype& from, const TRectype& to, int tilde = 0x0)
{ filter(NULL,&from, &to, tilde); }
@ -473,6 +476,7 @@ class TSorted_cursor : public TCursor
bool _is_changed_expr;
// @cmember:(INTERNAL) Indica se l'espressione e' valida
bool _is_valid_expr;
bool _sort_update;
// @access Protected Member
protected:
@ -503,6 +507,8 @@ public:
// @cmember Restituisce se il è sorted (default = FALSE)
virtual bool is_sorted() const { return TRUE; }
virtual bool update_relation() const { return _sort_update || TCursor::update_relation();}
// @cmember Costruttore
TSorted_cursor(TRelation *f,const char * order_expr, const char * filter = "", int key = 1, const TRectype* from = NULL, const TRectype* to = NULL);
// @cmember Distruttore
@ -567,6 +573,9 @@ public:
// @cmember Ritorna il nome del campo
const TString& name() const
{ return _name; }
// @cmember Ritorna l'identificatore del file
const TString& id() const
{ return _id; }
// @cmember Setta il nome del campo
void set_name(const char* n)
{ _name = n; }

View File

@ -11,7 +11,7 @@
;
: REP_GET_SIZE.X ( f1 -- n1 )
GET_POS DROP
GET_SIZE DROP
;
: REP_GET_SIZE.Y ( f1 -- n1 )
@ -62,6 +62,20 @@
REP_OFFSET_FIELD_POS.Y \ Aggiorna posizione del campo corrente
;
: REP_MESSAGE_ALIGN_UNDER ( f1 -- )
REP_GET_BOTTOM \ Calcola fondo di f1
#THIS REP_GET_POS.Y \ Calcola inizio del campo corrente
- \ Calcola offset come differenza dei due
REP_OFFSET_FIELD_POS.Y \ Incrementa posizione y del campo corrente
;
: REP_COPY_HEIGHT ( f1 -- )
REP_GET_SIZE.Y \ Altezza campo origine
#THIS REP_GET_SIZE.X \ Larghezza campo destinazione
SWAP \ Scambia parametri per set_size
#THIS SET_SIZE \ Aggiorna dimensioni
;
: REP_FIELD_NOT_NULL ( f1 -- f1 b1 )
SP
;
@ -97,6 +111,22 @@
THEN
;
: MESSAGE_APPEND_CR ( f1 -- )
#THIS @ \ Leggo il valore del campo corrente
DUP EMPTY= \ Controlla se e' vuoto
IF
DROP \ Scarta il valore nullo
DROP \ Scarta f1
ELSE
CR \ Inserisco un "a capo"
SWAP
+ \ Sommo un "a capo" all'inizio della stringa
SWAP \ Riporto in primo piano f1
+! \ Incrementa f1 col contenuto della stringa
THEN
;
: MESSAGE_COPY ( f1 ... fn -- )
BEGIN \ Ciclo sui prametri
REP_FIELD_NOT_NULL

View File

@ -654,6 +654,9 @@ void TReport_section::save(TXmlItem& root) const
item.AddChild("condition") << condition();
if (grouped_by().not_empty())
item.AddChild("groupby") << grouped_by();
if (_recordset != NULL)
item.AddChild("sql") << _recordset->query_text();
if (has_font())
_font->save(item);
_prescript.save(item, "prescript");
@ -664,6 +667,22 @@ void TReport_section::save(TXmlItem& root) const
const TReport_field& rf = field(i);
rf.save(item);
}
if (type() == 'B' && level() > 0) // Save subsections
{
for (int s = 1; s <= 9; s++)
{
const int l = level()*10+s;
if (_report.find_section('B', l))
{
_report.section('H', l).save(root);
_report.section('B', l).save(root);
_report.section('F', l).save(root);
}
else
break;
}
}
}
void TReport_section::load(const TXmlItem& sec)
@ -693,22 +712,30 @@ void TReport_section::load(const TXmlItem& sec)
if (level() > 0)
{
TString str;
const TXmlItem* cnd = sec.FindFirstChild("condition");
if (cnd != NULL)
{
TString str;
cnd->GetEnclosedText(str);
set_condition(str);
}
}
if (level() > 1)
{
const TXmlItem* gb = sec.FindFirstChild("groupby");
if (gb != NULL)
if (level() > 1)
{
TString str;
gb->GetEnclosedText(str);
group_by(str);
const TXmlItem* gb = sec.FindFirstChild("groupby");
if (gb != NULL)
{
gb->GetEnclosedText(str);
group_by(str);
}
if (level() > 10)
{
const TXmlItem* sql = sec.FindFirstChild("sql");
if (sql != NULL)
{
sql->GetEnclosedText(str);
set_recordset(str);
}
}
}
}
@ -729,13 +756,84 @@ void TReport_section::load(const TXmlItem& sec)
_postscript.load(sec, "postscript");
}
void TReport_section::update_recordset_parent()
{
if (type() == 'B' && level() > 0)
{
// Update my recordset
if (_recordset != NULL)
{
if (level() > 100)
{
const int father = level()/10;
_recordset->set_parent(_report.section('B', father).recordset());
}
else
_recordset->set_parent(_report.recordset());
}
// Update my children's recordset
for (int i = 1; i <= 9; i++)
{
const int child = level()*10+i;
TReport_section* rs = _report.find_section('B', child);
if (rs != NULL)
rs->update_recordset_parent();
else
break;
}
}
}
bool TReport_section::set_recordset(TRecordset* rs)
{
if (type() == 'B')
{
if (_recordset != NULL)
delete _recordset;
_recordset = rs;
update_recordset_parent();
}
return _recordset != NULL;
}
bool TReport_section::set_recordset(const TString& sql)
{
bool ok = !sql.blank();
if (ok)
{
if (sql.compare("SELECT ", 7, true) == 0)
ok = set_recordset(new TSQL_recordset(sql));
else
ok = set_recordset(new TISAM_recordset(sql));
}
else
set_recordset(NULL);
return ok;
}
bool TReport_section::get_record_field(const char* name, TVariant& var) const
{
if (_recordset != NULL)
{
var = _recordset->get(name);
if (!var.is_null())
return true;
if (level() > 100)
{
const TReport_section* sec = _report.find_section('B', level()/10);
if (sec != NULL) // Should ALWAYS exist
return sec->get_record_field(name, var);
}
}
return false;
}
TReport_section::TReport_section(TReport& r, char t, int l)
: _report(r), _type(t), _level(l), _pos(0,0),
_size(0,0), _page_break(false), _hidden_if_needed(false),
_can_break(false), _keep_with_next(false),
_repeat(false), _hidden(false), _deactivated(false),
_font(NULL), _print_font(NULL),
_font(NULL), _print_font(NULL), _recordset(NULL),
_bgcolor(COLOR_WHITE), _fgcolor(COLOR_BLACK), _pattern(PAT_HOLLOW),
_border(0), _radius(0)
{ }
@ -998,11 +1096,9 @@ const TRectangle& TReport_field::get_draw_rect() const
TRectangle& rct = ((TReport_field*)this)->_draw_rct;
if (dynamic_height())
{
int h = 100;
TParagraph_string str(formatted_text(), rct.width()/100);
str.rtrim();
h = str.items() * 100;
int h = str.items() * 110; h -= h%100; // Sto un po' abbondante
if (h <= 0)
h = 100;
if (h > _rct.height())
@ -1675,21 +1771,48 @@ void TReport::build_section_key(char type, int level, TString& key) const
TReport_section* TReport::find_section(char type, int level) const
{
TString4 key; build_section_key(type, level, key);
TString8 key; build_section_key(type, level, key);
TReport_section* sec = (TReport_section*)_sections.objptr(key);
return sec;
}
bool TReport::kill_section(char type, int level)
{
TString4 key; build_section_key(type, level, key);
TString8 key; build_section_key(type, level, key);
const bool ok = _sections.remove(key);
if (ok && level > 1 && type != 'B')
if (ok)
{
// Cancello anche testa/coda corrispondente
build_section_key(type == 'H' ? 'F' : 'H', level, key);
_sections.remove(key);
char kill_also[4]; memset(kill_also, 0, sizeof(kill_also));
if (level > 10) // Sottosezione
{
switch (type)
{
case 'H': kill_also[0] = 'F'; break;
case 'F': kill_also[0] = 'H'; break;
default : kill_also[0] = 'H'; kill_also[1] = 'F'; break;
}
}
else
{
if (level > 1)
{
switch (type)
{
case 'H': kill_also[0] = 'F'; break;
case 'F': kill_also[0] = 'H'; break;
default : break;
}
}
}
for (int i = 0; kill_also[i] > ' '; i++)
{
build_section_key(kill_also[i], level, key);
_sections.remove(key);
}
}
return ok;
}
@ -1706,7 +1829,7 @@ int TReport::find_max_level(char type) const
FOR_EACH_ASSOC_OBJECT(ass, h, k, o) if (k[0] == type1 || k[0] == type2)
{
const int l = atoi(k+1);
if (l > lev)
if (l > lev && l <= 9)
lev = l;
}
return lev;
@ -1750,25 +1873,36 @@ void TReport::load_printer_font()
}
}
void TReport::update_recordset_parent()
{
if (_recordset != NULL)
_recordset->set_parent(NULL);
for (int i = find_max_level('B'); i > 0; i--)
section('B', i).update_recordset_parent();
}
bool TReport::set_recordset(TRecordset* rs)
{
if (_recordset != NULL)
{
delete _recordset;
_recordset = NULL;
}
_recordset = rs;
update_recordset_parent();
return _recordset != NULL;
}
bool TReport::set_recordset(const TString& sql)
{
bool ok = false;
if (sql.compare("SELECT ", 7, true) == 0)
ok = set_recordset(new TSQL_recordset(sql));
bool ok = !sql.blank();
if (ok)
{
if (sql.compare("SELECT ", 7, true) == 0)
ok = set_recordset(new TSQL_recordset(sql));
else
ok = set_recordset(new TISAM_recordset(sql));
}
else
ok = set_recordset(new TISAM_recordset(sql));
set_recordset(NULL);
return ok;
}
@ -1778,7 +1912,7 @@ TReport_section& TReport::section(char type, int level)
if (sec == NULL)
{
sec = new TReport_section(*this, type, level);
TString4 key; build_section_key(type, level, key);
TString8 key; build_section_key(type, level, key);
_sections.add(key, sec);
}
return *sec;
@ -1880,10 +2014,12 @@ bool TReport::evaluate(const char* expr, TVariant& var, TFieldtypes force_type)
if (var.is_string())
e.setvar(i, var.as_string());
else
{
if (var.is_date())
e.setvar(i, var.as_date().string());
else
e.setvar(i, var.as_real());
}
}
const TFieldtypes ft = force_type != _nullfld ? force_type : var.type();
@ -1896,11 +2032,7 @@ void TReport::destroy()
{
_sections.destroy();
_description.cut(0);
if (_recordset != NULL)
{
delete _recordset;
_recordset = NULL;
}
set_recordset(NULL);
}
void TReport::load_sections(const TXmlItem& xml)
@ -1935,17 +2067,17 @@ bool TReport::load(const char* fname)
if (desc != NULL)
desc->GetEnclosedText(_description);
if (xml.FindFirstChild("section") != NULL)
load_sections(xml);
// Carico la query principale PRIMA delle sezioni che potrebbero collegarvicisi
const TXmlItem* sql = xml.FindFirstChild("sql");
if (sql != NULL)
{
TString str;
sql->GetEnclosedText(str);
TString str; sql->GetEnclosedText(str);
set_recordset(str);
}
if (xml.FindFirstChild("section") != NULL)
load_sections(xml);
_include = xml.GetAttr("libraries");
include_libraries();
@ -2137,15 +2269,20 @@ bool TReport::get_record_field(const TString& name, TVariant& var) const
{
const char* str = name;
if (name.starts_with("#RECORD."))
{
str += 8;
found = true;
}
var = _recordset->get(str);
if (!var.is_null())
found = true;
}
str += 8; // Elimino prefisso
// Cerco il campo nel recordset della eventuale sottosezione di appartenenza
if (_curr_field != NULL)
found = _curr_field->section().get_record_field(str, var);
// Se non lo trovo, allora lo cerco nel recordset principale
if (!found)
{
var = _recordset->get(str);
if (!var.is_null())
found = true;
}
}
return found;
}
@ -2576,13 +2713,16 @@ void TReport::include_libraries(bool reload)
TAlex_virtual_machine::include_libraries(reload);
if (reload || !defined("MESSAGE_ALIGN"))
include("report.alx");
FOR_EACH_TOKEN(_include, lib)
if (!_include.blank())
{
TFilename libname = lib;
libname.trim();
if (libname.find('.') < 0)
libname.ext("alx");
include(libname);
FOR_EACH_TOKEN(_include, lib)
{
TFilename libname = lib;
libname.trim();
if (libname.find('.') < 0)
libname.ext("alx");
include(libname);
}
}
}

View File

@ -156,6 +156,7 @@ class TReport_section : public TArray
TReport_script _prescript, _postscript;
TReport_font *_font, *_print_font;
TRecordset* _recordset;
protected:
virtual const char* class_name() const { return "ReportSection"; }
@ -226,6 +227,12 @@ public:
const TString& postscript() const;
void set_postscript(const char* src);
void update_recordset_parent(); // Internal use only
bool set_recordset(TRecordset* rs);
bool set_recordset(const TString& sql);
TRecordset* recordset() const { return _recordset; }
bool get_record_field(const char* name, TVariant& var) const;
bool has_font() const { return _font != NULL; }
const TReport_font& font() const;
const TReport_font& print_font() const;
@ -462,6 +469,7 @@ protected:
void load_sections(const TXmlItem& xml);
void save_section(const TReport_section& rs, TXmlItem& item) const;
void update_recordset_parent(); // Internal use only
bool get_report_field(const TString& name, TVariant& var) const;
bool get_record_field(const TString& name, TVariant& var) const;

View File

@ -76,36 +76,50 @@ void advanced_draw_text(TWindow& win, const char* text, const RCT& r,
default : y -= descent; break;
}
xvt_dwin_set_clip(win.win(), (RCT*)&r);
RCT orig;
xvt_dwin_get_clip(win.win(), &orig);
const bool restore_clip = !xvt_rect_is_empty(&orig);
if (restore_clip)
{
RCT clipper;
xvt_rect_intersect(&clipper, &orig, (RCT*)&r);
xvt_dwin_set_clip(win.win(), (RCT*)&clipper);
}
else
xvt_dwin_set_clip(win.win(), (RCT*)&r);
if (halign == 'J')
advanced_draw_justified_text(win, text, x, y, dx);
else
xvt_dwin_draw_text(win.win(), x, y, text, -1);
xvt_dwin_set_clip(win.win(), NULL);
if (restore_clip)
xvt_dwin_set_clip(win.win(), &orig);
else
xvt_dwin_set_clip(win.win(), NULL);
}
void advanced_draw_paragraph(TWindow& win, TString& para, const RCT& rct,
char halign, char valign, int default_row_height)
char halign, char valign, int default_10row_height)
{
const bool acapo = para.find('\n') >= 0;
int leading, ascent, descent;
xvt_dwin_get_font_metrics(win.win(), &leading, &ascent, &descent);
int ky = leading + ascent + descent;
int ky10 = (leading + ascent + descent) * 10;
// Aggiusta l'altezza di una riga standard, se necessario
if (ky < default_row_height && ky > 80*default_row_height/100)
ky = default_row_height;
if (ky10 < default_10row_height && ky10 > 80*default_10row_height/100)
ky10 = default_10row_height;
const int rct_height = rct.bottom - rct.top;
int rows = rct_height / ky;
int rows = (rct_height * 11) / ky10; // Sto abbondante del 10% (*11/10) altrimenti risulta spesso 0
if (acapo || rows > 1) // Devo scrivere piu' righe?
{
const int kx = xvt_dwin_get_text_width(win.win(), "ABCDEFGH", 8) / 8;
const unsigned columns = (rct.right - rct.left) / kx;
const int kx10 = xvt_dwin_get_text_width(win.win(), "MMMMMMMMMM", 10);
const unsigned columns = (rct.right - rct.left) * 10 / kx10;
TParagraph_string str(para, columns);
if (str.items() < rows)
@ -114,16 +128,16 @@ void advanced_draw_paragraph(TWindow& win, TString& para, const RCT& rct,
int ybase = rct.top;
switch (valign)
{
case 'C': ybase += (rct_height - rows*ky) / 2; break;
case 'B': ybase += rct_height - rows*ky; break;
case 'C': ybase += (rct_height - (rows * ky10) / 10) / 2; break;
case 'B': ybase += rct_height - (rows * ky10) / 10; break;
default : break;
}
for (int row = 0; row < rows; row++)
{
RCT rctline = rct;
rctline.top = ybase + ky*row;
rctline.bottom = rctline.top + ky;
rctline.top = ybase + (ky10 * row) / 10;
rctline.bottom = rctline.top + ky10 / 10;
const char* line = str.get();
if (halign == 'J' && (row == rows-1 || strlen(line) < columns/2))
halign = 'L';
@ -956,9 +970,9 @@ bool TBook::print_page(TWindow& win, size_t page)
TString stringona; // Testo completo di un campo
// Calcolo altezza riga standard
const TRectangle rect_riga(0,0,1000,100);
const TRectangle rect_riga(0,0,1000,1000);
RCT rct_riga; win.log2dev(rect_riga, rct_riga);
const int default_row_height = rct_riga.bottom - rct_riga.top;
const int default_10row_height = rct_riga.bottom - rct_riga.top;
const streampos pos = _index.get_long(page);
ifstream ifs(_file);
@ -1136,7 +1150,7 @@ bool TBook::print_page(TWindow& win, size_t page)
}
advanced_draw_paragraph(win, stringona, rct,
_horizontal_alignment, _vertical_alignment,
default_row_height);
default_10row_height);
continue;
}
if (str.starts_with("<text_align "))
@ -1655,6 +1669,33 @@ bool TReport_book::init(TReport& rep)
return true;
}
void TReport_book::print_subsections(int father)
{
for (int i = 1; i <= 9; i++)
{
const int level = father*10+i;
TReport_section* rs = _report->find_section('B', level);
if (rs == NULL)
break;
TRecordset* rex = rs->recordset();
if (rex != NULL)
{
rex->requery();
if (rex->items() > 0)
{
_delta.y += print_section('H', level);
for (bool ok = rex->move_to(0); ok && !_print_aborted; ok = rex->move_next())
{
_delta.y += print_section('B', level);
print_subsections(level);
}
_delta.y += print_section('F', level);
}
}
}
}
bool TReport_book::add(TReport& rep, bool progind)
{
if (!init(rep))
@ -1664,7 +1705,11 @@ bool TReport_book::add(TReport& rep, bool progind)
return false;
TRecordset* rex = _report->recordset();
if (rex == NULL || rex->items() <= 0)
if (rex == NULL)
return true;
rex->requery();
if (rex->items() <= 0)
return true;
TString msg = TR("Elaborazione report");
@ -1746,7 +1791,9 @@ bool TReport_book::add(TReport& rep, bool progind)
_delta.x = 0;
_delta.y += dy;
last_body_height = 0; // Non servirebbe strettamente
}
}
print_subsections(b);
}
if (pi != NULL)

View File

@ -92,6 +92,7 @@ protected:
void reprint_group_headers();
long print_section(TReport_section& rs);
long print_section(char type, int level);
void print_subsections(int father);
public:
bool add(TReport& report, bool progind = true);

View File

@ -1,18 +1,10 @@
#ifndef __SMARTCARD_H
#define __SMARTCARD_H
#ifndef __ISAM_H
#include <isam.h>
#endif
#ifndef __MASK_H
#include <mask.h>
#endif
#ifndef __STRINGS_H
#include <strings.h>
#endif
#define MAX_SM_FIELDS 16
typedef enum {no_smartcard, ase_smartcard} smartcard_type;

View File

@ -508,18 +508,19 @@ HIDDEN bool _mtcheck_val(TMask_field& f, KEY)
HIDDEN bool _reqif_val(TMask_field& f, KEY k)
{
if (k == K_ENTER)
if (k == K_ENTER && f.empty())
{
if (f.get().not_empty()) return TRUE;
const TMask& m = f.mask();
const int nparms = get_val_param_num();
for (int i = 0 ; i < nparms; i++)
{
const short id = atoi(get_val_param(i));
if (id > 0 && f.mask().get(id).not_empty())
return FALSE;
const TMask_field& fld = m.field(id);
if (id > 0 && !fld.empty())
return false;
}
}
return TRUE;
return true;
}

View File

@ -27,7 +27,6 @@ class TMask_tabmag : public TMask
static bool codlivart_handler(TMask_field &, KEY); // handler del numero formato articoli
static bool codlivgiac_handler(TMask_field &, KEY); // handler del numero formato giacenze
static bool codgrp_handler(TMask_field &, KEY); // handler del numero formato
static bool numlivart_handler(TMask_field &, KEY); // handler del numero formato
public:
@ -75,7 +74,6 @@ TMask_tabmag::TMask_tabmag(const char * _maskname,const TString16 &tabname):
else if (tabname == "GCA") // GRUPPI CODICE ARTICOLI
{
cod_liv=new TCodart_livelli;
set_handler(F_CODLIV, numlivart_handler);
set_handler(F_CODGROUP, codgrp_handler);
}
else if (tabname == "FCG") // FORMATO CODICE GIACENZE
@ -286,24 +284,6 @@ bool TMask_tabmag::codlivgiac_handler(TMask_field& f, KEY k)
return TRUE;
}
// gestisce l'introduzione del codice del livello articoli
bool TMask_tabmag::numlivart_handler(TMask_field& f, KEY k)
{
if ((k == K_TAB && f.focusdirty())||k == K_ENTER )
{
TMask_tabmag & mask=((TMask_tabmag &)f.mask());
if (mask.get_int(F_CODLIV)==mask.cod_liv->last_level())
// non esiste un seguente
{
f.error_box(TR("Non è possibile definire gruppi per l'ultimo livello di codice articolo"));
return FALSE;
}
}
return TRUE;
}
// HANDLER DEL CODICE LIVELLO giacenza
// HANDLER DEL CODICE LIVELLO anagrafica
bool TMask_tabmag::codgrp_handler(TMask_field& f, KEY k)

View File

@ -651,37 +651,41 @@ real TMask_movmag::proposed_price(const char *codart,
real quant, const char *causrig)
{
real rv;
TCausale_magazzino cau(causrig && *causrig ? causrig : (const char *) get(F_CODCAUS));
TLocalisamfile anamag(LF_ANAMAG);
anamag.put("CODART",codart);
anamag.read();
switch (cau.tipoprz())
const TCausale_magazzino cau(causrig && *causrig ? causrig : (const char *)get(F_CODCAUS));
const char tipoprz = cau.tipoprz();
if (tipoprz == 'P' || tipoprz == 'C') // Se e' Libero non devo far nulla
{
TLocalisamfile anamag(LF_ANAMAG);
anamag.put("CODART",codart);
anamag.read();
TConfig cfgditta(CONFIG_DITTA);
TLocalisamfile umart(LF_UMART);
TCondizione_vendita cv(&cfgditta,&anamag,&umart);
cv.put_listino(get(F_CODLIST),get(F_CATVEN));
switch (tipoprz)
{
// prezzo
case 'P':
{
TLocalisamfile umart(LF_UMART);
TConfig cfgditta(CONFIG_DITTA);
TCondizione_vendita cv(&cfgditta,&anamag,&umart);
cv.put_listino(get(F_CODLIST),get(F_CATVEN));
cv.ricerca(codart,quant);
cv.ricerca(codart,quant,false); // Considera UMART
rv=cv.get_prezzo();
}
break;
// costo
break;
// costo
case 'C':
{
TLocalisamfile umart(LF_UMART);
TConfig cfgditta(CONFIG_DITTA);
TCondizione_vendita cv(&cfgditta,&anamag,&umart);
cv.put_listino(get(F_CODLIST),get(F_CATVEN));
cv.ricerca(codart,quant);
rv=cv.get_prezzo();
if (rv == ZERO)
rv=anamag.get_real("ULTCOS1");
}
break;
cv.ricerca(codart,quant,true); // Ignora UMART
rv=cv.get_prezzo();
if (rv.is_zero())
rv=anamag.get_real("ULTCOS1");
break;
default:
break;
}
}
return rv;
}

View File

@ -621,8 +621,8 @@ class TCondizione_vendita : public TObject
TConfig * _config_ditta;
bool _load_mask;
bool _ivarid;
bool cerca(int tiporicerca,const char * cod, const real & qta, const char *um=NULL);
bool cerca(int tiporicerca,const char * cod, const real & qta, const char *um=NULL, bool ignore_umart = false);
protected:
@ -647,7 +647,7 @@ public:
void put_contratto(const char * codcontr,const char *tipocf,const char *codcf);
void put_offerta(const char * codoff);
// ricerca il codice
bool ricerca(const char * cod, const real& qta = ZERO) ;
bool ricerca(const char * cod, const real& qta = ZERO, bool ignore_umart = false) ;
TCondizione_vendita(TConfig * _ditta = NULL, TLocalisamfile * anamag = NULL, TLocalisamfile * umart = NULL);
virtual ~TCondizione_vendita() {}

View File

@ -1731,7 +1731,7 @@ TCausale_magazzino::TCausale_magazzino(const TRectype &r):
CHECK(r.num() == LF_TABCOM, "Tipo record errato sulla causale di magazzino");
}
bool TCondizione_vendita::ricerca(const char * codice, const real & qta)
bool TCondizione_vendita::ricerca(const char * codice, const real & qta, bool ignore_umart)
{
int tiporic;
switch (_condv.get_char("TIPO"))
@ -1749,11 +1749,11 @@ bool TCondizione_vendita::ricerca(const char * codice, const real & qta)
tiporic = ' ';
break;
}
return cerca(tiporic,codice, qta);
return cerca(tiporic,codice, qta, NULL, ignore_umart);
}
bool TCondizione_vendita::cerca( int tiporicerca, const char * codriga , const real & qta, const char * um)
bool TCondizione_vendita::cerca( int tiporicerca, const char * codriga , const real & qta, const char * um, bool ignore_umart)
{
// if (_condv.get("COD").empty())
// return FALSE;
@ -1865,7 +1865,7 @@ bool TCondizione_vendita::cerca( int tiporicerca, const char * codriga , const r
}
}
if (!found)
if (!found && !ignore_umart)
{
const TRectype& um = cache().get(LF_UMART, cod);
_prezzo = um.get_real("PREZZO");

3
mr/f152.dir Executable file
View File

@ -0,0 +1,3 @@
152
0
$rilprod|1|1|116|0|Rilevazione produzione|||

29
mr/f152.trr Executable file
View File

@ -0,0 +1,29 @@
152
20
CODART|1|20|0|Codice articolo
DATAPROD|5|8|0|Data di inizio produzione
PROG|2|3|0|Progressivo del giorno
CODNUM|1|4|0|Codice numerazione ordine di produzione
ANNO|2|4|0|Anno ordine di produzione
PROVV|1|1|0|Tipo numerazione <P>rovvisorio <D>efinitivo ordine di produzione
NDOC|3|7|0|Numero documento ordine di produzione
IMPIANTO|1|5|0|Codice impianto
LINEA|1|5|0|Codice linea
NRIGA|2|3|0|Numero riga ordine di produzione
ORAPROD|1|6|0|Ora di inizio produzione
DATAFINE|5|8|0|Data fine produzione
ORAFINE|1|6|0|Ora fine produzione
QTA|4|15|5|Quantità prodotta
CHIUSO|8|1|0|Lotto chiuso
CODNUMP|1|4|0|Codice numerazione bolla di produzione
ANNOP|2|4|0|Anno bolla di produzione
PROVVP|1|1|0|Tipo numerazione <P>rovvisorio <D>efinitivo bolla di produzione
NDOCP|3|7|0|Numero documento bolla di produzione
NRIGAP|2|3|0|Numero riga bolla di produzione
6
CODART+DATAPROD+PROG|
IMPIANTO+LINEA+CODART+DATAPROD|X
DATAPROD+IMPIANTO+LINEA+CODART|X
PROVV+ANNO+CODNUM+NDOC+NRIGA|X
PROVVP+ANNOP+CODNUMP+NDOCP+NRIGAP|X
CODNUM+ANNO+PROVV+NDOC+CODART+DATAPROD|X

View File

@ -9,6 +9,8 @@ int main(int argc, char** argv)
{
case 3:
mr0400(argc,argv); break; // parametri ditta
case 4:
mr0500(argc,argv); break; // rilevazione produzione
case 0:
default:
mr0100(argc, argv);

View File

@ -2,7 +2,10 @@
#define __MR0_H
int mr0100(int argc, char* argv[]);
//int mr0200(int argc, char* argv[]);
//int mr0300(int argc, char* argv[]);
int mr0400(int argc, char* argv[]);
int mr0500(int argc, char* argv[]);
#endif // __PR0_H
#endif

View File

@ -53,9 +53,11 @@ class TConf_MRP_application : public TConfig_application
protected:
virtual TMask* get_mask() { return _mask; }
virtual TMask* create_mask(const TFilename& f) { if (_mask == NULL) _mask = new TConf_MRP_mask(f); return _mask;}
virtual void destroy_mask() { delete _mask; _mask = NULL; }
public:
virtual void destroy_mask() { delete _mask; _mask = NULL; }
virtual void load_mask();
virtual void save_mask(bool tosave);
public:
virtual bool preprocess_config (TMask& mask, TConfig& config);
virtual bool postprocess_config (TMask& mask, TConfig& config);
virtual bool user_create();
@ -65,6 +67,78 @@ public:
virtual ~TConf_MRP_application() {}
};
void TConf_MRP_application::load_mask()
{
TMask* mask = get_mask();
if (mask==NULL)
return;
TConfig* config_ditta = get_config();
TConfig_application::load_mask();
TToken_string workstring = config_ditta->get("NumOrdProd");
TSheet_field& sf_num = mask->sfield(F_TIPONUM);
sf_num.destroy();
FOR_EACH_TOKEN(workstring, tok)
{
sf_num.row(-1) = tok;
sf_num.check_row(sf_num.items()-1);
}
TSheet_field& sf_tip = mask->sfield(F_TIPOTIP);
sf_tip.destroy();
for (int k = 0; config_ditta->exist("TipOrdProd", k); k++)
{
workstring= config_ditta->get("TipOrdProd", NULL, k);
TToken_string& row = sf_tip.row(-1);
row.add(workstring.get(0), 0);
row.add(workstring.get(1), 2);
row.add(workstring.get(2), 3);
sf_tip.check_row(sf_tip.items()-1);
}
}
void TConf_MRP_application::save_mask(bool tosave)
{
TMask* mask = get_mask();
if (mask==NULL)
return;
bool ask_save = mask->dirty() && !tosave;
if (ask_save)
tosave = yesno_box("Modifiche non registrate. Salvare?");
if (tosave)
{
TConfig* config_ditta = get_config();
TConfig_application::save_mask(tosave);
//salva sul file di configurazione della ditta una tokenstring con lo sheet delle numerazioni..
TToken_string workstring;
TSheet_field& sf_num = mask->sfield(F_TIPONUM);
FOR_EACH_SHEET_ROW(sf_num, i, row)
{
workstring.add(row->get(0));
}
config_ditta->set("NumOrdProd",workstring);
//...e poi anche con i tipi dello sheet
//per prima cosa va svuotato il paragrafo dalle precedenti "TipOrdProd"
for (int k = 0; config_ditta->exist("TipOrdProd", k); k++)
config_ditta->remove("TipOrdProd", k);
TSheet_field& sf_tip = mask->sfield(F_TIPOTIP);
int c = 0;
FOR_EACH_SHEET_ROW(sf_tip, j, line)
{
workstring.cut(0);
workstring.add(line->get(0));
if (!workstring.blank())
{
workstring.add(line->get(2));
workstring.add(line->get(3));
config_ditta->set("TipOrdProd", workstring, NULL, true, c++);
}
}
}
}
bool TConf_MRP_application::preprocess_config (TMask& mask, TConfig& c)
{
TMRP_config& config=(TMRP_config&)c;
@ -104,6 +178,7 @@ bool TConf_MRP_application::postprocess_config (TMask& mask, TConfig& c)
config.set_paragraph(""); // Akkrokkio per salvare il calendario...
((const TCalendar_mask&)mask).calendar().write();
config.set_paragraph(paragraph); // re-read
return TRUE;
}

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