Patch level : aga 2.0 413

Files correlati      :
Ricompilazione Demo : [ ]
Commento          :
Riportata la versione aga 1.7 patch 413


git-svn-id: svn://10.65.10.50/trunk@10856 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2003-02-25 14:39:02 +00:00
parent 1ec6b14b60
commit 724a33cfb4
75 changed files with 1940 additions and 1486 deletions

View File

@ -112,10 +112,7 @@ int TInformazione_moduli::get_module_by_order(int index)
// Calcola il produttore ufficiale di module
TDongleType TInformazione_moduli::get_owner(int module) const
{
if (module >= 40 && module <= 46)
return _procom_dongle;
{
const int aut[] = { CMAUT, ATAUT, POAUT, AFAUT, TCAUT, TMAUT,
VEAUT, MGAUT, ORAUT, EFAUT, DBAUT, PRAUT, SVAUT, -1 };
for (int a = 0; aut[a] >= 0; a++)

View File

@ -214,28 +214,32 @@ END
STRING FLD_TABIVA_S10 4
BEGIN
PROMPT 3 12 "Riga vendite prospetto IVA periodica "
PROMPT 3 12 "Operazioni attive in comunicazione annuale dati IVA "
FIELD S10
FLAGS "U"
SHEET "Riga|Descrizione@60"
INPUT FLD_TABIVA_S10
ITEM "|Nessuno"
ITEM "VP1|Operazioni attive"
ITEM "VP1A|Operazioni attive ed anche cessioni intracomunitarie"
ITEM "|Nessuna"
ITEM "CD11|Totale operazioni attive (al netto dell'IVA)"
ITEM "CD12|Operazioni non imponibili"
ITEM "CD13|Operazioni esenti"
ITEM "CD14|Cessioni intracomunitarie di beni"
OUTPUT FLD_TABIVA_S10
END
STRING FLD_TABIVA_S11 4
BEGIN
PROMPT 3 13 "Riga acquisti prospetto IVA periodica "
PROMPT 3 13 "Operazioni passive in comunicazione annuale dati IVA "
FIELD S11
FLAGS "U"
SHEET "Riga|Descrizione@60"
INPUT FLD_TABIVA_S11
ITEM "|Nessuno"
ITEM "VP2|Operazioni passive"
ITEM "VP2A|Operazioni passive ed anche acquisti intracomunitari"
ITEM "VP3|Importazioni di oro e argento"
ITEM "|Nessuna"
ITEM "CD21|Totale operazioni passive (al netto dell'IVA)"
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"
OUTPUT FLD_TABIVA_S11
END

View File

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

View File

@ -1,5 +1,5 @@
3
65
70
COD|1|3|0|
CODTAB|1|25|0|
S0|1|70|0|
@ -49,6 +49,11 @@ R16|4|18|5|
R17|4|18|5|
R18|4|18|5|
R19|4|18|5|
R20|4|18|5|
R21|4|18|5|
R22|4|18|5|
R23|4|18|5|
R24|4|18|5|
D0|5|8|0|
D1|5|8|0|
D2|5|8|0|

View File

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

View File

@ -1,5 +1,5 @@
4
65
70
COD|1|3|0|
CODTAB|1|25|0|
S0|1|70|0|
@ -49,6 +49,11 @@ R16|4|18|5|
R17|4|18|5|
R18|4|18|5|
R19|4|18|5|
R20|4|18|5|
R21|4|18|5|
R22|4|18|5|
R23|4|18|5|
R24|4|18|5|
D0|5|8|0|
D1|5|8|0|
D2|5|8|0|

View File

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

View File

@ -1,5 +1,5 @@
5
65
70
COD|1|3|0|
CODTAB|1|25|0|
S0|1|70|0|
@ -49,6 +49,11 @@ R16|4|18|5|
R17|4|18|5|
R18|4|18|5|
R19|4|18|5|
R20|4|18|5|
R21|4|18|5|
R22|4|18|5|
R23|4|18|5|
R24|4|18|5|
D0|5|8|0|
D1|5|8|0|
D2|5|8|0|

View File

@ -152,7 +152,7 @@ BEGIN
USE LF_CESPI
INPUT IDCESPITE F_IDCESPITE
DISPLAY "Codice@10" IDCESPITE
DISPLAY "Desc@50" DESC
DISPLAY "Descrizione@50" DESC
DISPLAY "Cat." CODCAT
DISPLAY "Impianto@10" CODIMP
DISPLAY "Stabilimento@30" STABILIM
@ -170,9 +170,9 @@ END
STRING F_DESC 60 50
BEGIN
PROMPT 24 8 ""
USE LF_CESPI KEY 2
USE LF_CESPI KEY 3
INPUT DESC F_DESC
DISPLAY "Desc@50" DESC
DISPLAY "Descrizione@50" DESC
DISPLAY "Codice@10" IDCESPITE
DISPLAY "Cat." CODCAT
DISPLAY "Impianto@10" CODIMP

View File

@ -66,7 +66,7 @@ BEGIN
KEY 1
END
STRING F_DESC 50
STRING F_DESC 60 50
BEGIN
PROMPT 26 5 ""
FLAGS "G"
@ -346,7 +346,7 @@ BEGIN
FIELD LF_SALCE->IDCESPITE
END
STRING DLG_NULL 50
STRING DLG_NULL 60 50
BEGIN
PROMPT 26 4 ""
FLAGS "DZ"
@ -514,7 +514,7 @@ BEGIN
GROUP 5
END
STRING DLG_NULL 50
STRING DLG_NULL 60 50
BEGIN
PROMPT 26 4 ""
FLAGS "DZ"

View File

@ -18,3 +18,4 @@ int main(int argc,char** argv)
}
return 0;
}

View File

@ -46,8 +46,8 @@ BEGIN
JOIN ESC ALIAS 105 INTO CODTAB==CODTAB
INPUT CODTAB F_ESERCIZIO
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Data inizio" 105@->D0
DISPLAY "Data fine@10" 105@->D1
DISPLAY "Data inizio@12" 105@->D0
DISPLAY "Data fine@12" 105@->D1
OUTPUT F_ESERCIZIO CODTAB
OUTPUT F_DATAINIZIO 105@->D0
OUTPUT F_DATAFINE 105@->D1

View File

@ -20,7 +20,7 @@
class TLC_form : public TCespi_list_form
{
TCursor* _cur;
int _tiposit, _order;
int _tiposit, _order, _suborder;
TString _str; // Jolly string
protected:
@ -151,7 +151,7 @@ bool TLC_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
class TLC_app : public TSkeleton_application
{
int _tipo_sit, _order;
int _tipo_sit, _order, _suborder;
TLC_form* _form;
protected:
@ -196,6 +196,7 @@ void TLC_app::main_loop()
_form = &form;
_tipo_sit = m.get_int(F_SITUAZIONE);
_order = m.get_int(F_ORDINAMENTO);
_suborder = m.get_int(F_SUBORDINAMENTO);
TRelation rel(LF_CESPI);
TString expr;
@ -239,7 +240,16 @@ void TLC_app::main_loop()
}
}
const char* orderby = _order == 1 ? "CODCAT|DTCOMP|IDCESPITE" : "CODIMP|DTCOMP|IDCESPITE";
TString orderby;
if (_order == 1)
orderby = "CODCAT";
else
orderby = "CODIMP";
if (_suborder == 1)
orderby << "|DTCOMP|IDCESPITE";
else
orderby << "|IDCESPITE";
TSorted_cursor cur(&rel, orderby, filter);
form.set_cursor(cur);

View File

@ -22,5 +22,5 @@
#define F_SITUAZIONE 120
#define F_ORDINAMENTO 121
#define F_SALDINI 122
#define F_SUBORDINAMENTO 123

View File

@ -46,8 +46,8 @@ BEGIN
JOIN ESC ALIAS 105 INTO CODTAB==CODTAB
INPUT CODTAB F_ESERCIZIO
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Data inizio" 105@->D0
DISPLAY "Data fine@10" 105@->D1
DISPLAY "Inizio esercizio" 105@->D0
DISPLAY "Fine esercizio" 105@->D1
OUTPUT F_ESERCIZIO CODTAB
OUTPUT F_DATAINIZIO 105@->D0
OUTPUT F_DATAFINE 105@->D1
@ -124,7 +124,7 @@ BEGIN
PROMPT 2 11 "Mostra anche i valori dei saldi iniziali"
END
RADIOBUTTON F_ORDINAMENTO 78
RADIOBUTTON F_ORDINAMENTO 38
BEGIN
PROMPT 1 12 "@bOrdinamento"
ITEM "1|Per categoria"
@ -133,6 +133,13 @@ BEGIN
MESSAGE HIDE,1@|SHOW,2@
END
RADIOBUTTON F_SUBORDINAMENTO 38
BEGIN
PROMPT 41 12 "@bSotto ordinamento"
ITEM "1|Data acquisizione"
ITEM "2|Codice cespite"
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 16 "@bSelezione categoria"

View File

@ -214,12 +214,12 @@ void TECFE_app::main_loop()
if (!fi.blank())
{
if (filter.not_empty()) filter << "&&";
filter << '(' << CESPI_CODIMP << ">=" << fi << ')';
filter << '(' << CESPI_CODIMP << ">=\"" << fi << "\")";
}
if (!fi.blank())
{
if (filter.not_empty()) filter << "&&";
filter << '(' << CESPI_CODIMP << "<=" << ti << ')';
filter << '(' << CESPI_CODIMP << "<=\"" << ti << "\")";
}
}

View File

@ -33,6 +33,7 @@ STABILIM|1|30|0|Stabilimento
REPARTO|1|30|0|Reparto
IDIMP|3|5|0|Codice impianto
PERCIMP|4|7|3|% di assegnazione all'impianto
2
3
IDCESPITE|
CODCGRA+CODSPA+CODCAT+DTCOMP+IDCESPITE|
DESC|X

View File

@ -24,7 +24,7 @@
#define FLD_CM1_NUMRIVDOPP 115
#define FLD_CM1_NUMIVDOPP 116
#define FLD_CM1_DTIPOSPRIC 117
#define FLD_CM1_SEZIVDH 119
//#define FLD_CM1_SEZIVDH 119
#define FLD_CM1_LETTIVDH 120
#define FLD_CM1_NUMRIVDH 121
#define FLD_CM1_NUMIVDH 122

View File

@ -62,6 +62,7 @@ public:
virtual int remove();
const TRecord_array& cg_rows() const { return _cg; }
const TRecord_array& iva_rows() const { return _iva; }
TRectype& cg(int i);
TRectype& iva(int i);
int cg_items() const { return _cg.rows(); }

View File

@ -1067,8 +1067,16 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
TBill conto; a.causale().bill(k, conto);
const TString desc(a.causale().desc_agg(k));
const char sez = a.causale().sezione(k);
const real imp(cg.mask().get(K_RESIDUO));
const real imp = cg.mask().get(K_RESIDUO);
TImporto importo(sez, imp); importo.normalize();
if (tipo == 'G')
{
const char sezbanca = a.causale().sezione(2);
if (sezbanca == sez)
importo.swap_section();
}
a.set_cgs_row(r, importo, conto, desc, tipo);
if (tipo == 'K')

View File

@ -5,7 +5,8 @@
int main(int argc,char** argv)
{
const int n = argc > 1 ? argv[1][1]-'0' : 0;
const int n = argc > 1 ? argv[1][1]-'0' : 0;
n+1;
switch (n)
{
case 1:

View File

@ -565,12 +565,19 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
real esenti_c3_bam = 0.0; // Beni ammorizzabili esenti c3
real esenti_c1a_bam = 0.0; // Beni ammorizzabili esenti c1a
real esenti_b14 = 0.0;
real vendite_vp1 = 0.0;
real vendite_vp1a = 0.0;
real acquisti_vp2 = 0.0;
real acquisti_vp2a = 0.0;
real acquisti_vp3 = 0.0;
real imposta_vp3 = 0.0;
// Comunicazione dati iva annuale (dal 2003)
real cessioni_cd1_1 = 0.0; // Totale operazioni attive
real cessioni_cd1_2 = 0.0; // non imponibili
real cessioni_cd1_3 = 0.0; // esenti
real cessioni_cd1_4 = 0.0; // intra
real acquisti_cd2_1 = 0.0; // Totale operazioni passive
real acquisti_cd2_2 = 0.0; // non imponibili
real acquisti_cd2_3 = 0.0; // esenti
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 esni_rimb = 0.0; // ci sommo tutti esenti e ni validi per rimborso
real corr_CEE = 0.0;
real corr_noCEE = 0.0;
@ -826,30 +833,40 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
// Cumula l'ammontare delle operazioni attive/passive
// per la dichiarazione periodica
if (iva_vpn.not_empty() && !fattrit)
{
switch (tipomov)
{
case vendita: // VP1, VP1A
case vendita: // CD1 - 1 2 3 4
if (!corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) &&
sosp_imp != normale && sosp_imp != liquidazione)
{
vendite_vp1 += imponibile;
if (cau_valintra && iva_vpn == "VP1A")
vendite_vp1a += imponibile;
cessioni_cd1_1 += imponibile;
if (iva_vpn == "CD12")
cessioni_cd1_2 += imponibile;
if (iva_vpn == "CD13")
cessioni_cd1_3 += imponibile;
if (cau_valintra && iva_vpn == "CD14")
cessioni_cd1_4 += imponibile;
}
break;
case acquisto: // VP2, VP2A, VP3
acquisti_vp2 += imponibile;
if (cau_intra && iva_vpn == "VP2A")
acquisti_vp2a += imponibile;
if (iva_vpn == "VP3")
case acquisto: // CD2 - 1 2 3 4
acquisti_cd2_1 += imponibile;
if (iva_vpn == "CD22")
acquisti_cd2_2 += imponibile;
if (iva_vpn == "CD23")
acquisti_cd2_3 += imponibile;
if (cau_intra && iva_vpn == "CD24")
acquisti_cd2_4 += imponibile;
if (iva_vpn == "CD3")
{
acquisti_vp3 += imponibile;
imposta_vp3 += imposta;
oroargento_cd3_1 += imponibile;
oroargento_cd3_2 += imposta;
}
break;
default:
break;
}
}
if (noninc) // non incassati: non devono entrare in nessun altro calcolo
{
@ -1766,12 +1783,16 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
_pum->put("S5", esenti_c1a_bam);
_pum->put("R7", esenti_b14);
_pum->put("R12", esni_rimb);
_pum->put("R14", vendite_vp1);
_pum->put("R15", vendite_vp1a);
_pum->put("R16", acquisti_vp2);
_pum->put("R17", acquisti_vp2a);
_pum->put("R18", acquisti_vp3);
_pum->put("R19", imposta_vp3);
_pum->put("R14", cessioni_cd1_1);
_pum->put("R15", cessioni_cd1_2);
_pum->put("R16", cessioni_cd1_3);
_pum->put("R17", cessioni_cd1_4);
_pum->put("R18", acquisti_cd2_1);
_pum->put("R19", acquisti_cd2_2);
_pum->put("R20", acquisti_cd2_3);
_pum->put("R21", acquisti_cd2_4);
_pum->put("R22", oroargento_cd3_1);
_pum->put("R23", oroargento_cd3_2);
_pam->put("R0", acquisti);
_pam->put("R1", vendite);
_pam->put("R6", assp_imp);

View File

@ -97,14 +97,14 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt)
vaf += imponibile;
_pam->put("R1", vaf);
_pam->rewrite();
// Aggiorna il totale IVA periodica VP1
// Aggiorna il totale IVA periodica CD1_1
if (look_iva(ci->_codiva))
{
if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP1A lo consideriamo in VP1
if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi...
{
real vp1 = _pum->get_real("R14");
vp1 += imponibile;
_pum->put("R14", vp1);
real cd1_1 = _pum->get_real("R14");
cd1_1 += imponibile;
_pum->put("R14", cd1_1);
_pum->rewrite();
}
}
@ -338,14 +338,14 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
_pam->put("R1", vaf);
_pam->rewrite();
// Aggiorna il totale IVA periodica VP1
// Aggiorna il totale IVA periodica CD1_1
if (look_iva(vv->_codiva))
{
if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP1A lo consideriamo in VP1
if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi
{
real vp1 = _pum->get_real("R14");
vp1 += imponibile;
_pum->put("R14", vp1);
real cd1_1 = _pum->get_real("R14");
cd1_1 += imponibile;
_pum->put("R14", cd1_1);
_pum->rewrite();
}
}

View File

@ -2552,6 +2552,7 @@ int TStampa_registri_app::stampa_intestazione()
set_header (r++, riga);
riga.format("");
if (_tipo_stampa == prova)
{
riga.format("REGISTRO DI PROVA Data %s", TDate(TODAY).string());
@ -3099,6 +3100,7 @@ bool TStampa_registri_app::setta_mask(long i)
if (tasto != K_ENTER) return FALSE;
//MI3213
_pagine_stampate = mb.get_long(U_PAGINA);
_numini = _pagine_stampate;
}
return TRUE;
}

View File

@ -5,7 +5,7 @@
int main(int argc,char** argv)
{
const int n = (argc > 1) ? argv[1][1]-'0' : 0;
switch (n)
{
case 1:

View File

@ -17,18 +17,15 @@ class TDich_periodica_selfirm_mask : public TAutomask
{
TArray_sheet * _ditte;
TString_array _nomiditte;
char _freq;
int _year;
protected:
bool select_button();
void build_nomiditte();
void build_ditte_sheet();
void set_mask_freq();
public:
const char get_freq() const { return _freq; }
const int get_year() const { return _year; }
const int get_period() const { return atoi(get(_freq == 'M' ? F_MONTHS : F_TRIMS)); }
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
TDich_periodica_selfirm_mask();
virtual ~TDich_periodica_selfirm_mask();
@ -37,13 +34,10 @@ public:
TDich_periodica_selfirm_mask::TDich_periodica_selfirm_mask() : TAutomask("cg5700a")
{
_ditte = new TArray_sheet(-1, -1, -4, -4, "Selezione Ditte",
"Cod.@5|Ragione Sociale@50|Vers.");
"Cod.@5|Ragione Sociale@50");
TDate oggi(TODAY);
_year = oggi.year();
_freq = 'M';
set_mask_freq();
build_nomiditte();
build_ditte_sheet();
@ -56,9 +50,8 @@ TDich_periodica_selfirm_mask::~TDich_periodica_selfirm_mask()
void TDich_periodica_selfirm_mask::build_nomiditte()
{
TString fr, cod;
TString cod;
TLocalisamfile dt(LF_NDITTE);
TTable lia("%LIA");
_nomiditte.destroy();
@ -66,25 +59,11 @@ void TDich_periodica_selfirm_mask::build_nomiditte()
{
const long codditta = dt.get_long("CODDITTA");
bool good = prefix().exist(codditta);
if (good)
{
cod.format("%05ld%d", codditta, _year);
lia.put("CODTAB", cod);
if (lia.read() != NOERR)
{
fr = "??";
good = FALSE;
}
else
fr = lia.get("S7");
TToken_string* d = new TToken_string(64);
d->add(codditta);
d->add(dt.get("RAGSOC"));
d->add(fr);
_nomiditte.add(d);
}
}
@ -107,20 +86,6 @@ void TDich_periodica_selfirm_mask::build_ditte_sheet()
}
}
void TDich_periodica_selfirm_mask::set_mask_freq()
{
if (_freq == 'M')
{
show(F_MONTHS);
hide(F_TRIMS);
}
else
{
hide(F_MONTHS);
show(F_TRIMS);
}
}
bool TDich_periodica_selfirm_mask::select_button()
{
if (_ditte->run() == K_ENTER)
@ -128,8 +93,6 @@ bool TDich_periodica_selfirm_mask::select_button()
TToken_string& row = _ditte->row(_ditte->selected());
set(F_CODDITTA, row.get(0));
set(F_RAGSOC, row.get(1));
_freq = row.get_char(2);
set_mask_freq();
return TRUE;
}
return FALSE;
@ -156,8 +119,6 @@ bool TDich_periodica_selfirm_mask::on_field_event(TOperable_field& o, TField_eve
{
set(F_CODDITTA, row.get(0));
set(F_RAGSOC, row.get(1));
_freq = row.get_char(2);
set_mask_freq();
found = TRUE;
}
else
@ -191,8 +152,6 @@ bool TDich_periodica_selfirm_mask::on_field_event(TOperable_field& o, TField_eve
{
set(F_CODDITTA, row.get(0));
set(F_RAGSOC, row.get(1));
_freq = row.get_char(2);
set_mask_freq();
found = TRUE;
break;
}
@ -279,8 +238,6 @@ class TDich_periodica_iva_mask : public TAutomask
bool _dirty_versament, // Sporco versamento...
_is_euro; // importi in euro
protected:
void search_versament();
void write_versament();
void read_iva_data();
public:
@ -311,57 +268,13 @@ TDich_periodica_iva_mask::TDich_periodica_iva_mask(TDich_periodica_selfirm_mask
}
}
void TDich_periodica_iva_mask::search_versament()
{
TTable del("%DEL");
TString key;
key.format("%05ld%4d%02d1", _sf->get_long(F_CODDITTA), _sf->get_year(), _sf->get_period());
del.put("CODTAB", key);
// Se esiste il versamento la visualizza, mantenendola disabilitata (eventuale SHIFT+F12)
if (del.read() == NOERR)
{
set(F_VP17_IMPORTO, del.get_real("R0"));
set(F_VP17_DATA, del.get_date("D0"));
set(F_VP17_ABI, del.get("S7"));
set(F_VP17_CAB, del.get("S8"));
set(F_VP17_CONCESSIONE, del.get("S9"));
set(F_VP17_STAMPATO, del.get_bool("B0"));
}
else
enable(-G_VP12);
}
void TDich_periodica_iva_mask::write_versament()
{
TTable del("%DEL");
TString key;
key.format("%05ld%4d%02d1", _sf->get_long(F_CODDITTA), _sf->get_year(), _sf->get_period());
del.put("CODTAB", key);
const bool good = del.read() == NOERR;
del.put("R0", get(F_VP17_IMPORTO));
del.put("D0", get(F_VP17_DATA));
del.put("S7", get(F_VP17_ABI));
del.put("S8", get(F_VP17_CAB));
del.put("S9", get(F_VP17_CONCESSIONE));
del.put("B0", TRUE);
if (good)
del.rewrite();
else
del.write();
}
void TDich_periodica_iva_mask::read_iva_data()
{
TTable lim("LIM");
TTable lam("LAM");
TString16 key;
key.format("%4d%02d", _sf->get_year(), _sf->get_period());
key.format("%4d13", _sf->get_year());
lim.put("CODTAB", key);
lam.put("CODTAB", key);
@ -376,99 +289,64 @@ void TDich_periodica_iva_mask::read_iva_data()
descrizione << lim.get("S1");
const bool exclude_sign = descrizione.find("$$") >= 0 || descrizione.find(">>") >= 0;
real vp1 = ZERO;
real vp1a = ZERO;
real vp2 = ZERO;
real vp2a = ZERO;
real vp3 = ZERO;
real vp3i = ZERO;
real cd1_1 = ZERO;
real cd1_2 = ZERO;
real cd1_3 = ZERO;
real cd1_4 = ZERO;
real cd2_1 = ZERO;
real cd2_2 = ZERO;
real cd2_3 = ZERO;
real cd2_4 = ZERO;
real cd3_1 = ZERO;
real cd3_2 = ZERO;
TTable pum("PUM");
key.format("%4d",_sf->get_year());
key.format("%04d",_sf->get_year());
pum.put("CODTAB", key);
const char f = _sf->get_freq();
const int p = _sf->get_period();
for (int err = pum.read(_isgteq); err == NOERR; err = pum.next())
{
key = pum.get("CODTAB");
const int anno = atoi(key.mid(0,4));
const int perd = atoi(key.mid(10,2));
for (int err = pum.read(_isgteq); err == NOERR; err= pum.next())
{
const TString16 codtab = pum.get("CODTAB");
if (anno != _sf->get_year())
const TString& anno = codtab.left(4);
if (anno != key)
break;
if (f == 'M')
{
if (perd != p)
continue;
}
else
{
if (perd < p-2 || perd > p)
continue;
}
vp1 += pum.get_real("R14");
vp1a += pum.get_real("R15");
vp2 += pum.get_real("R16");
vp2a += pum.get_real("R17");
vp3 += pum.get_real("R18");
vp3i += pum.get_real("R19");
if (codtab.right(2) != "13") // Solo annuale
continue;
cd1_1 += pum.get_real("R14");
cd1_2 += pum.get_real("R15");
cd1_3 += pum.get_real("R16");
cd1_4 += pum.get_real("R17");
cd2_1 += pum.get_real("R18");
cd2_2 += pum.get_real("R19");
cd2_3 += pum.get_real("R20");
cd2_4 += pum.get_real("R21");
cd3_1 += pum.get_real("R22");
cd3_2 += pum.get_real("R23");
}
// Se espressi in lire o una valuta con 0 decimali, arrotonda alle 1000
TIva_round ir;
ir.round(vp1); ir.round(vp1a);
ir.round(vp2); ir.round(vp2a);
ir.round(vp3); ir.round(vp3i);
real rettifica = lim.get_real("R5"); // Rettifiche
const real rettifica = lim.get_real("R5"); // Rettifiche
real vp5 = lam.get_real("R0"); // Iva esigibile per il periodo
real cd4 = lam.get_real("R0"); // Iva esigibile per il periodo
if (rettifica > ZERO)
vp5 += rettifica;
cd4 += rettifica;
real vp6 = lam.get_real("R1"); // Iva che si detrae per il periodo
real cd5 = lam.get_real("R1"); // Iva che si detrae per il periodo
if (rettifica < ZERO && !exclude_sign)
vp6 += abs(rettifica);
cd5 += abs(rettifica);
real vp7 = vp5 - vp6; // IVA a debito o credito per il periodo
real vp8 = lim.get("R17"); // Variazioni d'imposta periodi precedenti
real vp9 = lim.get("R18"); // IVA non versata da dichiarazioni precedenti
real vp10 = lam.get_real("R3") - lam.get_real("R2") + lim.get_real("R1"); // Debito o credito precedente
real vp11 = lim.get("R15"); // Credito IVA compensabile
real vp12 = lim.get_real("R0") + lim.get_real("R19") + lim.get_real("R11") + lim.get_real("R9");
real vp13 = lim.get("R19"); // Crediti speciali
real vp14 = lim.get("R14"); // Interessi dovuti per liquidazione trimestrale
real vp15 = ZERO;
if (p == 12) // Gli acconti ci sono solo a Dicembre
{
if (f == 'T')
{
// Chiave delle deleghe: DITTA|ANNO|MESE=12|TIPO=7
key.format("%05ld%04d127", _sf->get_long(F_CODDITTA), _sf->get_year());
const TRectype& delega = cache().get("%DEL", key);
if (delega.get_bool("B0")) // Se delega acconto stampata
vp15 = delega.get_real("R0");
}
else
vp15 = lim.get_real("R11"); // Acconto versato
}
real vp16;
if (f == 'M' || p < 12) // Escludere quarto trimestre ditte trimestrali
{
vp16 = lim.get_real("R0") + lim.get_real("R14"); // Importo da versare
if (vp16 < ZERO) vp16 = ZERO;
}
const real cd6 = cd4 - cd5; // IVA a debito o credito per il periodo
real cd6_1, cd6_2;
if (cd6 >= ZERO)
cd6_1 = cd6;
else
cd6_2 = -cd6;
set(F_VP1, vp1); set(F_VP1A, vp1a); set(F_VP2, vp2); set(F_VP2A, vp2a);
set(F_VP3, vp3); set(F_VP3I, vp3i);
set(F_VP5, vp5); set(F_VP6, vp6); set(F_VP7, vp7);
set(F_VP8, vp8); set(F_VP9, vp9); set(F_VP10, vp10); set(F_VP11, vp11);
set(F_VP12, vp12); set(F_VP13, vp13); set(F_VP14, vp14); set(F_VP15, vp15); set(F_VP16, vp16);
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_CD4, cd4); set(F_CD5, cd5);
set(F_CD6_1, cd6_1); set(F_CD6_2, cd6_2);
}
else
error_box("Risultati liquidazione non presenti o da ricalcolare per il periodo richiesto.");
@ -476,57 +354,30 @@ void TDich_periodica_iva_mask::read_iva_data()
void TDich_periodica_iva_mask::print_prospect()
{
if (_dirty_versament)
write_versament();
const int anno = _sf->get_int(F_YEAR);
TDich_periodica_iva_form frm(anno);
frm.find_field('B', odd_page, FF_CODVAL).set(get(F_CODVAL));
frm.find_field('B', odd_page, FF_YEAR).set(get(F_YEAR));
const bool mens = _sf->get_freq() == 'M';
frm.find_field('B', odd_page, FF_CD1_1).set(get(F_CD1_1));
frm.find_field('B', odd_page, FF_CD1_2).set(get(F_CD1_2));
frm.find_field('B', odd_page, FF_CD1_3).set(get(F_CD1_3));
frm.find_field('B', odd_page, FF_CD1_4).set(get(F_CD1_4));
frm.find_field('B', odd_page, FF_CD2_1).set(get(F_CD2_1));
frm.find_field('B', odd_page, FF_CD2_2).set(get(F_CD2_2));
frm.find_field('B', odd_page, FF_CD2_3).set(get(F_CD2_3));
frm.find_field('B', odd_page, FF_CD2_4).set(get(F_CD2_4));
TForm_item& sf1 = frm.find_field('B', odd_page, FF_MONTHS);
TForm_item& sf2 = frm.find_field('B', odd_page, FF_TRIMS);
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_CD4).set(get(F_CD4));
frm.find_field('B', odd_page, FF_CD5).set(get(F_CD5));
frm.find_field('B', odd_page, FF_CD6_1).set(get(F_CD6_1));
frm.find_field('B', odd_page, FF_CD6_2).set(get(F_CD6_2));
sf1.set(get(F_MONTHS));
sf2.set(get(F_TRIMS));
sf1.show(mens);
sf2.show(!mens);
frm.find_field('B', odd_page, FF_VP1).set(get(F_VP1));
frm.find_field('B', odd_page, FF_VP1A).set(get(F_VP1A));
frm.find_field('B', odd_page, FF_VP2).set(get(F_VP2));
frm.find_field('B', odd_page, FF_VP2A).set(get(F_VP2A));
frm.find_field('B', odd_page, FF_VP3).set(get(F_VP3));
frm.find_field('B', odd_page, FF_VP3I).set(get(F_VP3I));
frm.find_field('B', odd_page, FF_VP5).set(get(F_VP5));
frm.find_field('B', odd_page, FF_VP6).set(get(F_VP6));
frm.find_field('B', odd_page, FF_VP7).set(get(F_VP7));
frm.find_field('B', odd_page, FF_VP8).set(get(F_VP8));
frm.find_field('B', odd_page, FF_VP9).set(get(F_VP9));
frm.find_field('B', odd_page, FF_VP10).set(get(F_VP10));
frm.find_field('B', odd_page, FF_VP11).set(get(F_VP11));
frm.find_field('B', odd_page, FF_VP12).set(get(F_VP12));
frm.find_field('B', odd_page, FF_VP13).set(get(F_VP13));
frm.find_field('B', odd_page, FF_VP14).set(get(F_VP14));
frm.find_field('B', odd_page, FF_VP15).set(get(F_VP15));
frm.find_field('B', odd_page, FF_VP16).set(get(F_VP16));
// Se è stato creato il versamento ora o se è stato già stampato
// allora lo stampa, altrimenti lo nasconde.
const bool b = _dirty_versament || get_bool(F_VP17_STAMPATO);
frm.find_field('B', odd_page, FF_VP17_STAMPATO).set(b ? "X" : " "); //Mostra nasconde il gruppo 17
if (b)
{
frm.find_field('B', odd_page, FF_VP17_IMPORTO).set(get(F_VP17_IMPORTO));
frm.find_field('B', odd_page, FF_VP17_DATA).set(get(F_VP17_DATA));
frm.find_field('B', odd_page, FF_VP17_CONCESSIONE).set(get(F_VP17_CONCESSIONE));
frm.find_field('B', odd_page, FF_VP17_ABI).set(get(F_VP17_ABI));
frm.find_field('B', odd_page, FF_VP17_CAB).set(get(F_VP17_CAB));
}
TRectype f(LF_NDITTE);
f.put(NDT_CODDITTA, get(F_CODDITTA));
TRectype t(f);
@ -548,64 +399,26 @@ void TDich_periodica_iva_mask::set_prospect()
set(F_CODDITTA, ditta);
set(F_RAGSOC, _sf->get(F_RAGSOC));
const char f = _sf->get_freq();
show(F_MONTHS, f == 'M');
show(F_TRIMS, f == 'T');
set(F_MONTHS, _sf->get(F_MONTHS));
set(F_TRIMS, _sf->get(F_TRIMS));
TFirm frm(ditta);
const TString& cv = frm.codice_valuta();
_is_euro = cv == TCurrency::get_euro_val();
set(F_CODVAL, cv);
TIva_round ir;
ir.set_default_iva_mode(anno, FALSE, ditta);
search_versament();
read_iva_data();
}
bool TDich_periodica_iva_mask::on_key(KEY k)
{
if (k == K_SHIFT + K_F12) // Abilita i campi relativi al versamento
enable(-G_VP12);
return TAutomask::on_key(k);
}
bool TDich_periodica_iva_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_VP17_DATA:
case F_VP17_CONCESSIONE:
case F_VP17_ABI:
case F_VP17_CAB:
if (e == fe_modify)
_dirty_versament = TRUE;
break;
case F_VP17_IMPORTO:
if (e == fe_modify)
{
_dirty_versament = TRUE;
real r(o.get());
TIva_round ir; ir.round(r);
o.set(r.string());
}
break;
default:
break;
}
return TRUE;
}
class TDich_periodica_iva_app : public TSkeleton_application
{
TDich_periodica_selfirm_mask * _m1;
protected:
virtual bool create();
virtual bool destroy();
@ -619,44 +432,45 @@ public:
bool TDich_periodica_iva_app::create()
{
open_files(LF_TAB, LF_TABCOM, LF_NDITTE, 0);
_m1 = new TDich_periodica_selfirm_mask();
return TSkeleton_application::create();
}
bool TDich_periodica_iva_app::destroy()
{
delete _m1;
return TSkeleton_application::destroy();
}
void TDich_periodica_iva_app::main_loop()
{
long ditta = get_firm();
while (_m1->run() != K_QUIT)
const long ditta = get_firm();
TDich_periodica_selfirm_mask* m1 = new TDich_periodica_selfirm_mask();
while (m1->run() != K_QUIT)
{
if (_m1->get(F_CODDITTA).empty() || _m1->get(F_RAGSOC).empty())
if (m1->get(F_CODDITTA).empty() || m1->get(F_RAGSOC).empty())
{
beep();
error_box("Selezionare una ditta");
continue;
}
set_firm(_m1->get_long(F_CODDITTA));
set_firm(m1->get_long(F_CODDITTA));
TDich_periodica_iva_mask* m2 = new TDich_periodica_iva_mask(_m1);
TDich_periodica_iva_mask* m2 = new TDich_periodica_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 cg5700 (int argc, char* argv[])
int cg5700(int argc, char* argv[])
{
TDich_periodica_iva_app a;
a.run(argc, argv, "Dichiarazione periodica");
a.run(argc, argv, "Comunicazione annuale IVA");
return 0;
}

View File

@ -1,70 +1,36 @@
#define F_YEAR 101
#define F_CODDITTA 102
#define F_RAGSOC 103
#define F_MONTHS 104
#define F_TRIMS 105
#define F_CODVAL 106
#define F_VP1 107
#define F_VP1A 108
#define F_VP2 109
#define F_VP2A 110
#define F_VP3 111
#define F_VP3I 112
#define F_VP5 121
#define F_VP6 122
#define F_VP7 123
#define F_VP8 124
#define F_VP9 125
#define F_VP10 126
#define F_VP11 127
#define F_VP12 128
#define F_VP13 129
#define F_VP14 130
#define F_VP15 131
#define F_VP16 132
#define F_VP17_DATA 140
#define F_VP17_IMPORTO 141
#define F_VP17_ABI 142
#define F_VP17_CAB 143
#define F_VP17_CONCESSIONE 144
#define F_VP17_STAMPATO 145
#define G_VP12 1
#define F_CD1_1 105
#define F_CD1_2 106
#define F_CD1_3 107
#define F_CD1_4 108
#define F_CD2_1 109
#define F_CD2_2 110
#define F_CD2_3 111
#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 FF_YEAR 101
#define FF_CODDITTA 102
#define FF_RAGSOC 103
#define FF_MONTHS 104
#define FF_TRIMS 105
#define FF_CODVAL 106
#define FF_VP1 107
#define FF_VP1A 108
#define FF_VP2 109
#define FF_VP2A 110
#define FF_VP3 111
#define FF_VP3I 112
#define FF_VP5 113
#define FF_VP6 114
#define FF_VP7 115
#define FF_VP8 116
#define FF_VP9 117
#define FF_VP10 118
#define FF_VP11 119
#define FF_VP12 120
#define FF_VP13 121
#define FF_VP14 122
#define FF_VP15 123
#define FF_VP16 124
#define FF_VP17_DATA 140
#define FF_VP17_IMPORTO 141
#define FF_VP17_ABI 142
#define FF_VP17_CAB 143
#define FF_VP17_CONCESSIONE 144
#define FF_VP17_STAMPATO 145
#define FF_COFI 130
#define FF_PAIVA 131
#define GF_VP12 1
#define FF_CD1_1 105
#define FF_CD1_2 106
#define FF_CD1_3 107
#define FF_CD1_4 108
#define FF_CD2_1 109
#define FF_CD2_2 110
#define FF_CD2_3 111
#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

View File

@ -21,386 +21,299 @@ END
SECTION BODY ODD 50
STRINGA 1 40
STRINGA -1
BEGIN
KEY "Titolo"
PROMPT 30 1 "@BDICHIARAZIONE IVA PERIODICA"
PROMPT 2 1 "@bAGENZIA DELLE ENTRATE"
END
STRINGA 2 10
STRINGA -1
BEGIN
KEY "Data"
PROMPT 65 1 "Data "
MESSAGE _TODAY
PROMPT 2 2 "[]\ //\ "
END
NUMERO FF_CODDITTA 6
STRINGA -1
BEGIN
KEY "Codice ditta"
PROMPT 2 3 "Ditta "
FIELD LF_NDITTE->CODDITTA
//PICTURE "@@@@@"
PROMPT 2 3 "[]\\ // \\"
END
STRINGA FF_RAGSOC 50
STRINGA -1
BEGIN
PROMPT 2 4 "[] \\//___\\"
END
STRINGA -1
BEGIN
PROMPT 2 5 "[] \/-----\\"
END
STRINGA -1
BEGIN
PROMPT 2 6 "@bCOMUNICAZIONE"
END
STRINGA -1
BEGIN
PROMPT 2 7 "@bANNUALE DATI IVA"
END
STRINGA -1
BEGIN
PROMPT 26 3 "DENOMINAZIONE, RAGIONE SOCIALE ovvero COGNOME E NOME"
END
STRINGA -1 50
BEGIN
KEY "Ragione sociale"
PROMPT 18 3 ""
PROMPT 26 4 "@b"
FIELD LF_NDITTE->RAGSOC
END
STRINGA 3
STRINGA -1
BEGIN
KEY "Codice fiscale - descrizione"
PROMPT 2 4 "Codice fiscale:"
KEY "Codice fiscale"
PROMPT 26 6 "@rCODICE FISCALE"
END
STRINGA FF_COFI
STRINGA -1
BEGIN
KEY "Codice fiscale - valore"
PROMPT 18 4 ""
KEY "Codice fiscale"
PROMPT 26 7 "@b"
FIELD LF_ANAG->COFI
END
STRINGA 4
STRINGA -1
BEGIN
KEY "Partita IVA - descrizione"
PROMPT 2 5 "Partita IVA: "
PROMPT 2 8 "______________________________________________________________________________"
END
STRINGA FF_PAIVA
NUMERO FF_YEAR
BEGIN
KEY "Partita IVA - valore"
PROMPT 18 5 ""
KEY "Anno"
PROMPT 2 9 "Anno di imposta @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
NUMERO FF_YEAR 6
STRINGA -1
BEGIN
KEY "Anno"
PROMPT 2 6 "Anno: "
KEY "Codice attività"
PROMPT 58 12 "@rCodice attività @b"
FIELD LF_NDITTE->CODATTPREV
END
LISTA FF_MONTHS 15
STRINGA -1
BEGIN
KEY "Mesi"
PROMPT 18 6 "Periodo: "
ITEM "1|Gennaio"
ITEM "2|Febbraio"
ITEM "3|Marzo"
ITEM "4|Aprile"
ITEM "5|Maggio"
ITEM "6|Giugno"
ITEM "7|Luglio"
ITEM "8|Agosto"
ITEM "9|Settembre"
ITEM "10|Ottobre"
ITEM "11|Novembre"
ITEM "12|Dicembre"
PROMPT 2 16 "______________________________________________________________________________"
END
LISTA FF_TRIMS 15
STRINGA -1
BEGIN
KEY "Trimestri"
PROMPT 18 6 "Periodo: "
ITEM "3|1° Trimestre"
ITEM "6|2° Trimestre"
ITEM "9|3° Trimestre"
ITEM "12|4° Trimestre"
PROMPT 2 17 "@b- OPERAZIONI ATTIVE -"
END
STRING FF_CODVAL 3
STRINGA -1
BEGIN
KEY "Codice valuta"
PROMPT 60 4 ""
FLAGS "H"
KEY "CD1_1 - Descrizione"
PROMPT 2 18 "@bCD1@r Totale operazioni attive"
END
STRINGA 5
VALUTA FF_CD1_1 18
BEGIN
KEY "VP1 - Descrizione"
PROMPT 2 10 "VP1 - Operazioni attive (al netto dell'IVA)"
KEY "CD1_1 - Valore"
PROMPT 40 18 "@b"
END
VALUTA FF_VP1 18
STRINGA -1
BEGIN
KEY "VP1 - Valore"
PROMPT 60 10 ""
DRIVENBY FF_CODVAL
KEY "CD1_2 - Descrizione"
PROMPT 6 19 "di cui: operazioni non imponibili"
END
STRINGA 6
VALUTA FF_CD1_2 18
BEGIN
KEY "VP1A - Descrizione"
PROMPT 2 11 "VP1A - di cui cessioni intracomunitarie"
KEY "CD1_2 - Valore"
PROMPT 60 19 "@b"
END
VALUTA FF_VP1A 18
STRINGA -1
BEGIN
KEY "VP1A - Valore"
PROMPT 60 11 ""
DRIVENBY FF_CODVAL
KEY "CD1_3 - Descrizione"
PROMPT 6 20 " operazioni esenti"
END
STRINGA 7
VALUTA FF_CD1_3 18
BEGIN
KEY "VP2 - Descrizione"
PROMPT 2 12 "VP2 - Operazioni passive (al netto dell'IVA)"
KEY "CD1_3 - Valore"
PROMPT 60 20 "@b"
END
VALUTA FF_VP2 18
STRINGA -1
BEGIN
KEY "VP2 - Valore"
PROMPT 60 12 ""
DRIVENBY FF_CODVAL
KEY "CD1_4 - Descrizione"
PROMPT 6 21 " cessioni intracomunitarie di beni"
END
STRINGA 8
VALUTA FF_CD1_4 18
BEGIN
KEY "VP2A - Descrizione"
PROMPT 2 13 "VP2A - di cui acquisti intracomunitari"
KEY "CD1_4 - Valore"
PROMPT 60 21 "@b"
END
VALUTA FF_VP2A 18
STRINGA -1
BEGIN
KEY "VP2A - Valore"
PROMPT 60 13 ""
DRIVENBY FF_CODVAL
PROMPT 2 22 "______________________________________________________________________________"
END
STRINGA 8
STRINGA -1
BEGIN
KEY "VP3 - Descrizione"
PROMPT 2 14 "VP3 - Importazioni di oro e argento senza IVA alla dogana"
PROMPT 2 23 "@b- OPERAZIONI PASSIVE -"
END
VALUTA FF_VP3 18
STRINGA -1
BEGIN
KEY "VP3 - Valore"
PROMPT 60 14 ""
DRIVENBY FF_CODVAL
KEY "CD2_1 - Descrizione"
PROMPT 2 24 "@bCD2@r Totale operazioni passive"
END
STRINGA 8
VALUTA FF_CD2_1 18
BEGIN
KEY "VP3I - Descrizione"
PROMPT 2 15 " Imposta"
KEY "CD2_1 - Valore"
PROMPT 40 24 "@b"
END
VALUTA FF_VP3I 18
STRINGA -1
BEGIN
KEY "VP3 - Imposta"
PROMPT 60 15 ""
DRIVENBY FF_CODVAL
KEY "CD2_2 - Descrizione"
PROMPT 6 25 "di cui: operazioni non imponibili"
END
STRINGA 9
VALUTA FF_CD2_2 18
BEGIN
KEY "VP5 - Descrizione"
PROMPT 2 16 "VP5 - IVA esigibile per il periodo "
KEY "CD2_2 - Valore"
PROMPT 60 25 "@b"
END
VALUTA FF_VP5 18
STRINGA -1
BEGIN
KEY "VP5 - Valore"
PROMPT 60 16 ""
DRIVENBY FF_CODVAL
KEY "CD2_3 - Descrizione"
PROMPT 6 26 " operazioni esenti"
END
STRINGA 10
VALUTA FF_CD2_3 18
BEGIN
KEY "VP6 - Descrizione"
PROMPT 2 17 "VP6 - IVA che si detrae per il periodo"
KEY "CD2_3 - Valore"
PROMPT 60 26 "@b"
END
VALUTA FF_VP6 18
STRINGA -1
BEGIN
KEY "VP6 - Valore"
PROMPT 60 17 ""
DRIVENBY FF_CODVAL
KEY "CD2_4 - Descrizione"
PROMPT 6 27 " acquisti intracomunitari di beni"
END
STRINGA 11
VALUTA FF_CD2_4 18
BEGIN
KEY "VP7 - Descrizione"
PROMPT 2 18 "VP7 - IVA a debito o credito per il periodo"
KEY "CD2_4 - Valore"
PROMPT 60 27 "@b"
END
VALUTA FF_VP7 18
STRINGA -1
BEGIN
KEY "VP7 - Valore"
PROMPT 60 18 ""
DRIVENBY FF_CODVAL
KEY "CD3 - Descrizione"
PROMPT 2 29 "@b-Importazioni d'oro industriale e argento puro senza pagamento IVA in dogana-"
END
STRINGA 12
STRINGA -1
BEGIN
KEY "VP8 - Descrizione"
PROMPT 2 19 "VP8 - Variazioni d'imposta periodi precedenti"
PROMPT 2 30 "@bCD3@r Imponibile"
END
VALUTA FF_VP8 18
VALUTA FF_CD3_1 18
BEGIN
KEY "VP8 - Valore"
PROMPT 60 19 ""
DRIVENBY FF_CODVAL
KEY "CD3_1 - Imponibile"
PROMPT 20 30 "@b"
END
STRINGA 13
STRINGA -1
BEGIN
KEY "VP9 - Descrizione"
PROMPT 2 20 "VP9 - Iva non versata da dichiarazioni precedenti"
PROMPT 50 30 "@rImposta"
END
VALUTA FF_VP9 18
VALUTA FF_CD3_2 18
BEGIN
KEY "VP9 - Valore"
PROMPT 60 20 ""
DRIVENBY FF_CODVAL
KEY "CD3_2 - Imposta "
PROMPT 60 30 "@b"
END
STRINGA 14
STRINGA -1
BEGIN
KEY "VP10 - Descrizione"
PROMPT 2 21 "VP10 - Debito o credito dal periodo precedente"
PROMPT 2 31 "______________________________________________________________________________"
END
VALUTA FF_VP10 18
STRINGA -1
BEGIN
KEY "VP10 - Valore"
PROMPT 60 21 ""
DRIVENBY FF_CODVAL
KEY "IVA esigibile"
PROMPT 2 32 "@bCD4@r IVA esigibile"
END
STRINGA 15
VALUTA FF_CD4 18
BEGIN
KEY "VP11 - Descrizione"
PROMPT 2 22 "VP11 - Credito IVA compensabile"
KEY "IVA esigibile"
PROMPT 20 32 "@b"
END
VALUTA FF_VP11 18
STRINGA -1
BEGIN
KEY "VP11 - Valore"
PROMPT 60 22 ""
DRIVENBY FF_CODVAL
KEY "IVA esigibile"
PROMPT 2 34 "@bCD5@r IVA detratta"
END
STRINGA 15
VALUTA FF_CD5 18
BEGIN
KEY "VP12 - Descrizione"
PROMPT 2 23 "VP12 - IVA dovuta o a credito per il periodo"
KEY "CD5 - IVA detratta"
PROMPT 60 34 "@b"
END
VALUTA FF_VP12 18
STRINGA -1
BEGIN
KEY "VP12 - Valore"
PROMPT 60 23 ""
DRIVENBY FF_CODVAL
KEY "CD6_1 - IVA dovuta"
PROMPT 2 36 "@bCD6@r IVA dovuta"
END
STRINGA 15
VALUTA FF_CD6_1 18
BEGIN
KEY "VP13 - Descrizione"
PROMPT 2 24 "VP13 - Crediti speciali d'imposta detratti"
KEY "CD6_1 - IVA dovuta"
PROMPT 20 36 "@b"
END
VALUTA FF_VP13 18
STRINGA -1
BEGIN
KEY "VP13 - Valore"
PROMPT 60 24 ""
DRIVENBY FF_CODVAL
KEY "CD6_2 - IVA a credito"
PROMPT 50 36 "@ro a credito"
END
STRINGA 15
VALUTA FF_CD6_2 18
BEGIN
KEY "VP14 - Descrizione"
PROMPT 2 25 "VP14 - Interessi dovuti per liquidazioni trimestrali"
KEY "CD6_2 - IVA a credito"
PROMPT 60 36 "@b"
END
VALUTA FF_VP14 18
STRINGA -1
BEGIN
KEY "VP14 - Valore"
PROMPT 60 25 ""
DRIVENBY FF_CODVAL
END
STRINGA 15
BEGIN
KEY "VP15 - Descrizione"
PROMPT 2 26 "VP15 - Acconto versato"
END
VALUTA FF_VP15 18
BEGIN
KEY "VP15 - Valore"
PROMPT 60 26 ""
DRIVENBY FF_CODVAL
END
STRINGA 15
BEGIN
KEY "VP16 - Descrizione"
PROMPT 2 27 "VP16 - Importo da versare"
END
VALUTA FF_VP16 18
BEGIN
KEY "VP16 - Valore"
PROMPT 60 27 ""
DRIVENBY FF_CODVAL
END
STRINGA 30
BEGIN
KEY "VP17 - Descrizione"
PROMPT 2 29 "VP17 - Estremi del versamento"
END
LISTA FF_VP17_STAMPATO
BEGIN
KEY "Stampato"
PROMPT 0 0 ""
FLAGS "H"
ITEM " | " MESSAGE HIDE,GF_VP12@
ITEM "X| " MESSAGE SHOW,GF_VP12@
END
VALUTA FF_VP17_IMPORTO 18
BEGIN
KEY "Importo"
PROMPT 2 30 "Importo versato "
DRIVENBY FF_CODVAL
GROUP GF_VP17
END
DATA FF_VP17_DATA
BEGIN
KEY "Data versamento"
PROMPT 40 30 "Data versamento "
GROUP GF_VP17
END
STRINGA FF_VP17_CONCESSIONE 17
BEGIN
KEY "Cod. Concessione"
PROMPT 2 31 "Cod. Concessione "
GROUP GF_VP17
END
STRINGA FF_VP17_ABI 10
BEGIN
KEY "Cod. ABI"
PROMPT 40 31 "Cod. ABI "
GROUP GF_VP17
END
STRINGA FF_VP17_CAB 10
BEGIN
KEY "Cod. CAB"
PROMPT 40 32 "Cod. CAB "
GROUP GF_VP17
END
PROMPT 2 37 "______________________________________________________________________________"
END
END
END

View File

@ -20,33 +20,6 @@ BEGIN
FLAGS "B"
END
LIST F_MONTHS 30
BEGIN
PROMPT 1 5 "Iva periodica di "
ITEM "1|Gennaio"
ITEM "2|Febbraio"
ITEM "3|Marzo"
ITEM "4|Aprile"
ITEM "5|Maggio"
ITEM "6|Giugno"
ITEM "7|Luglio"
ITEM "8|Agosto"
ITEM "9|Settembre"
ITEM "10|Ottobre"
ITEM "11|Novembre"
ITEM "12|Dicembre"
END
LIST F_TRIMS 30
BEGIN
PROMPT 1 5 "Iva periodica del "
ITEM "3|1° Trimestre"
ITEM "6|2° Trimestre"
ITEM "9|3° Trimestre"
ITEM "12|4° Trimestre"
FLAGS "H"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""

View File

@ -39,238 +39,96 @@ BEGIN
PROMPT 2 2 "Anno "
FLAGS "D"
END
LIST F_MONTHS 30
BEGIN
PROMPT 16 2 "Periodo "
ITEM "1|Gennaio"
ITEM "2|Febbraio"
ITEM "3|Marzo"
ITEM "4|Aprile"
ITEM "5|Maggio"
ITEM "6|Giugno"
ITEM "7|Luglio"
ITEM "8|Agosto"
ITEM "9|Settembre"
ITEM "10|Ottobre"
ITEM "11|Novembre"
ITEM "12|Dicembre"
CURRENCY F_CD1_1 18
BEGIN
PROMPT 1 4 "@bCD1 Operazioni attive "
FLAGS "D"
END
LIST F_TRIMS 30
CURRENCY F_CD1_2 18
BEGIN
PROMPT 16 2 "Periodo "
ITEM "3|1° Trimestre"
ITEM "6|2° Trimestre"
ITEM "9|3° Trimestre"
ITEM "12|4° Trimestre"
FLAGS "DH"
END
STRING F_CODVAL 3
BEGIN
PROMPT 0 0 ""
FLAGS "H"
END
CURRENCY F_VP1 18
BEGIN
PROMPT 1 4 "VP1 - Operazioni attive (al netto dell'IVA) "
DRIVENBY F_CODVAL
PROMPT 1 5 " di cui: operazioni non imponibili "
FLAGS "D"
END
CURRENCY F_VP1A 18
CURRENCY F_CD1_3 18
BEGIN
PROMPT 1 5 "VP1A - di cui cessioni intracomunitarie "
DRIVENBY F_CODVAL
PROMPT 1 6 " operazioni esenti "
FLAGS "D"
END
CURRENCY F_VP2 18
CURRENCY F_CD1_4 18
BEGIN
PROMPT 1 6 "VP2 - Operazioni passive (al netto dell'IVA) "
DRIVENBY F_CODVAL
PROMPT 1 7 " cessioni intracomunitarie di beni "
FLAGS "D"
END
CURRENCY F_VP2A 18
CURRENCY F_CD2_1 18
BEGIN
PROMPT 1 7 "VP2A - di cui acquisti intracomunitari "
DRIVENBY F_CODVAL
PROMPT 1 9 "@bCD2 Operazioni passive "
FLAGS "D"
END
CURRENCY F_VP3 18
CURRENCY F_CD2_2 18
BEGIN
PROMPT 1 8 "VP3 - Importazioni di oro e argento senza IVA alla dogana "
DRIVENBY F_CODVAL
PROMPT 1 10 " di cui: operazioni non imponibili "
FLAGS "D"
END
CURRENCY F_VP3I 18
CURRENCY F_CD2_3 18
BEGIN
PROMPT 1 9 " Imposta "
DRIVENBY F_CODVAL
PROMPT 1 11 " operazioni esenti "
FLAGS "D"
END
CURRENCY F_VP5 18
CURRENCY F_CD2_4 18
BEGIN
PROMPT 1 10 "VP5 - Iva esigibile per il periodo "
DRIVENBY F_CODVAL
PROMPT 1 12 " acquisti intracomunitari di beni "
FLAGS "D"
END
CURRENCY F_VP6 18
TEXT -1
BEGIN
PROMPT 1 11 "VP6 - Iva che si detrae per il periodo "
DRIVENBY F_CODVAL
PROMPT 1 14 "@bImportazioni di oro industriale e argento puro senza IVA alla dogana "
END
CURRENCY F_CD3_1 18
BEGIN
PROMPT 1 15 "CD3 Imponibile "
FLAGS "D"
END
CURRENCY F_VP7 18
CURRENCY F_CD3_2 18
BEGIN
PROMPT 1 12 "VP7 - Iva a debito o credito per il periodo "
DRIVENBY F_CODVAL
PROMPT 52 15 "Imposta "
FLAGS "D"
END
CURRENCY F_VP8 18
CURRENCY F_CD4 18
BEGIN
PROMPT 1 14 "VP8 - Variazioni d'imposta periodi precedenti "
DRIVENBY F_CODVAL
PROMPT 1 17 "CD4 Iva esigibile "
FLAGS "D"
END
CURRENCY F_VP9 18
CURRENCY F_CD5 18
BEGIN
PROMPT 1 15 "VP9 - Iva non versata da dichiarazioni precedenti "
DRIVENBY F_CODVAL
PROMPT 1 18 "CD5 Iva detraibile "
FLAGS "D"
END
CURRENCY F_VP10 18
CURRENCY F_CD6_1 18
BEGIN
PROMPT 1 16 "VP10 - Debito o credito dal periodo precedente "
DRIVENBY F_CODVAL
PROMPT 1 19 "CD6 IVA dovuta "
FLAGS "D"
END
CURRENCY F_VP11 18
CURRENCY F_CD6_2 18
BEGIN
PROMPT 1 17 "VP11 - Credito IVA compensabile "
DRIVENBY F_CODVAL
FLAGS "D"
END
CURRENCY F_VP12 18
BEGIN
PROMPT 1 18 "VP12 - IVA dovuta o a credito del periodo "
DRIVENBY F_CODVAL
PROMPT 48 19 "o a credito "
FLAGS "D"
END
ENDPAGE
PAGE "Pag.2" -1 -1 78 20
CURRENCY F_VP13 18
BEGIN
PROMPT 1 1 "VP13 - Crediti speciali d'imposta detratti "
DRIVENBY F_CODVAL
FLAGS "D"
END
CURRENCY F_VP14 18
BEGIN
PROMPT 1 2 "VP14 - Interessi dovuti per liquidazione trimestrale "
DRIVENBY F_CODVAL
FLAGS "D"
END
CURRENCY F_VP15 18
BEGIN
PROMPT 1 3 "VP15 - Acconto versato "
DRIVENBY F_CODVAL
FLAGS "D"
END
CURRENCY F_VP16 18
BEGIN
PROMPT 1 4 "VP16 - Importo da versare "
DRIVENBY F_CODVAL
FLAGS "D"
END
GROUPBOX DLG_NULL 79 5
BEGIN
PROMPT 0 16 "@bVP17 - Estremi del versamento"
END
DATE F_VP17_DATA
BEGIN
PROMPT 1 17 "Data "
FLAGS "D"
GROUP G_VP17
END
CURRENCY F_VP17_IMPORTO 18
BEGIN
PROMPT 38 17 "Importo versato "
FLAGS "DR"
DRIVENBY F_CODVAL
GROUP G_VP17
END
NUMBER F_VP17_ABI 5
BEGIN
PROMPT 1 18 "Codice ABI "
FIELD S7
FLAGS "DRZ"
USE %BAN
INPUT CODTAB[1,5] F_VP17_ABI
INPUT CODTAB[6,10] F_VP17_CAB
DISPLAY "Codice ABI" CODTAB[1,5]
DISPLAY "Codice CAB" CODTAB[6,10]
DISPLAY "Descrizione @50" S0
OUTPUT F_VP17_ABI CODTAB[1,5]
OUTPUT F_VP17_CAB CODTAB[6,10]
CHECKTYPE NORMAL
WARNING "Banca assente"
GROUP G_VP17
END
NUMBER F_VP17_CAB 5
BEGIN
PROMPT 38 18 "Codice CAB "
FLAGS "DRZ"
COPY ALL F_VP17_ABI
CHECKTYPE NORMAL
WARNING "Banca assente"
GROUP G_VP17
END
NUMBER F_VP17_CONCESSIONE 3
BEGIN
PROMPT 1 19 "Concessione "
FLAGS "DRZ"
USE %UCC
INPUT CODTAB F_VP17_CONCESSIONE
DISPLAY "Concessione " CODTAB[1,5]
DISPLAY "Descrizione @50" S0
OUTPUT F_VP17_CONCESSIONE CODTAB
CHECKTYPE NORMAL
WARNING "Concessione assente"
GROUP G_VP17
END
BOOLEAN F_VP17_STAMPATO
BEGIN
PROMPT 38 19 "Stampato"
FLAGS "D"
END
ENDPAGE
ENDMASK

View File

@ -88,7 +88,7 @@ _scelta(toupper(ric_trasfer)), _ric_auto(toupper(ric_auto))
bool TRic_archivi::create()
{
//_tab_tra = new TTable ("%TRA");
open_files(LF_TABCOM, 0);
_tras_file = new TTransfer_file(_scelta);
_caus = new TLocalisamfile (LF_CAUSALI);
@ -102,7 +102,6 @@ bool TRic_archivi::create()
_part = new TLocalisamfile (LF_PARTITE);
_scad = new TLocalisamfile (LF_SCADENZE);
_pagsca = new TLocalisamfile (LF_PAGSCA);
//_tab = new TLocalisamfile (LF_TAB);
_numdisk = 1;
_prima_volta = TRUE;
@ -115,7 +114,6 @@ bool TRic_archivi::create()
bool TRic_archivi::destroy()
{
//delete _tab_tra;
delete _tras_file;
delete _caus;
@ -129,20 +127,15 @@ bool TRic_archivi::destroy()
delete _part;
delete _scad;
delete _pagsca;
//delete _tab;
return TApplication::destroy();
}
void TRic_archivi::componi_path(TMask* msk)
{
TString path,drive;
int pos;
TFilename path = msk->get(F_PATHNAME);
path = msk->get(F_PATHNAME);
drive = msk->get(F_DRIVE);
pos = path.find(':');
const TString8 drive = msk->get(F_DRIVE);
// Inizio cazzata - da sostituire con _disketto = ::os_is_removable_drive(drive)
if (drive == "A:" || drive == "B:")
_disketto = TRUE;
@ -150,6 +143,7 @@ void TRic_archivi::componi_path(TMask* msk)
_disketto = FALSE;
// Fine cazzata
const int pos = path.find(':');
if (pos)
path = path.mid(pos+1);
@ -171,8 +165,6 @@ void TRic_archivi::componi_path(TMask* msk)
bool TRic_archivi::leggi_marker()
{
TString16 tmp;
if (!fexist(_marker))
{
if (_disketto)
@ -220,7 +212,8 @@ bool TRic_archivi::leggi_marker()
_dittainv = atol(buffer.sub(10,14));
_totrectras = atol(buffer.sub(23,29));
_numinv = atoi(buffer.sub(14,17));
tmp = buffer.sub(17,23);
TString16 tmp = buffer.sub(17,23);
_datatras = converti(tmp,FALSE);
if (_numdisk > 1) //Va fatto solo dal disco 2 in poi
@ -657,9 +650,7 @@ bool TRic_archivi::baipassa(TMask& m,KEY k)
{
if ( (k == K_SHIFT+K_F7) && (app()._stato_ripartenza == 0) )
app()._baipassa = TRUE;
// else // Modifica del 05-06-96 xche' con le nuove maschere non
// app()._baipassa = FALSE; // funziona piu', in quanto passa dall' handler anche quando
// faccio il conferma.
return TRUE;
}
@ -690,14 +681,6 @@ void TRic_archivi::trasfer2tempfile()
void TRic_archivi::ditta_ricevente()
{
/*
TLocalisamfile nditte (LF_NDITTE);
nditte.setkey(1);
nditte.zero();
nditte.put(NDT_CODDITTA, _dittaric);
if (nditte.read() == NOERR)
_ragsoc_dittar = nditte.get(NDT_RAGSOC);
*/
_ragsoc_dittar = cache().get(LF_NDITTE, _dittaric).get(NDT_RAGSOC);
}

View File

@ -1469,7 +1469,7 @@ void TInv_cont::primanota_inviata(long numreg)
void TInv_cont::scrivi_righePN(long numreg)
{
int size = 1024;
// int size = 1024;
_tras_file.open(_header);
@ -1547,9 +1547,9 @@ void TInv_cont::movPN2tempfile(TString& key, TMask& m)
}
leggi_record_controllo();
TString chiave;
TString8 chiave;
chiave.format("%07ld", nreg);
TString sigla;
TString4 sigla;
sigla.format("%c", 'Z');
_control_rec.overwrite(sigla,240);
_control_rec.overwrite(chiave,241);
@ -1920,18 +1920,19 @@ void TInv_cont::scrivi_righePAGSCA(char tipocf,int gruppo,int conto,long sottoc,
_pagsca->put(PAGSCA_ANNO, anno);
_pagsca->put(PAGSCA_NUMPART, numpart);
TRectype pagsca (_pagsca->curr());
const TRectype pagsca = _pagsca->curr();
const TString16 rec = pagsca.get(PAGSCA_NUMPART);
for (_pagsca->read(_isgteq); !_pagsca->eof(); _pagsca->next())
{
int nrigp = _pagsca->get_int(PAGSCA_NRIGP);
TString rec = pagsca.get(PAGSCA_NUMPART);
TString file = _pagsca->get(PAGSCA_NUMPART);
const TString16 file = _pagsca->get(PAGSCA_NUMPART);
if (_pagsca->curr() != pagsca || file != rec) break;
if (_pagsca->curr() != pagsca || file != rec)
break;
if (nriga != nrigp) continue;
const int nrigp = _pagsca->get_int(PAGSCA_NRIGP);
if (nriga != nrigp)
continue;
_tpagsca->curr() = _pagsca->curr();

View File

@ -891,10 +891,11 @@ void TInv_cont::invio_occasionali(TString& record, TString& ocfpi)
record.overwrite(str,469);
}
}
// Invio a PC delle righe contabili
void TInv_cont::invio_righe_contabili()
{
int size = 1024;
const int size = 1024;
TString record(size);
_tras_file.open(_trasf,TRUE);
@ -917,11 +918,11 @@ void TInv_cont::invio_righe_contabili()
str.format("%03d", nrig);
record.overwrite(str,9);
TString sezione = _trmov->get(RMV_SEZIONE);
TString4 sezione = _trmov->get(RMV_SEZIONE);
record.overwrite(sezione,60);
TString datareg = _trmov->get(RMV_DATAREG);
TString app = riconverti(datareg,TRUE);
TString16 datareg = _trmov->get(RMV_DATAREG);
TString16 app = riconverti(datareg,TRUE);
str.format("%08s", (const char*) app);
record.overwrite(str,61); //Data di registrazione
@ -937,7 +938,7 @@ void TInv_cont::invio_righe_contabili()
str.format("%06ld", sottoc);
record.overwrite(str,75); //Sottoconto di partita
TString descr = _trmov->get(RMV_DESCR);
TString80 descr = _trmov->get(RMV_DESCR);
str.format("%-50s", (const char*) descr);
record.overwrite(str,81); //Descrizione riga di movimento
@ -964,8 +965,11 @@ void TInv_cont::invio_righe_contabili()
str.format("%014s", (const char*) importo.string());
record.overwrite(str,144); //Importo riga di movimento
TString rowtype = _trmov->get(RMV_ROWTYPE);
TString4 rowtype = _trmov->get(RMV_ROWTYPE);
record.overwrite(rowtype,158);
record.overwrite(_trmov->get(RMV_CODCMS),159);
record.overwrite(_trmov->get(RMV_FASCMS),179);
_tras_file.write_control_rec(record,size);
_numrec_pn++;
@ -990,9 +994,10 @@ void TInv_cont::tipodocumento(long nreg, TString& tipodoc)
_tmov->readat(rec);
}
// Invio a PC delle righe IVA
void TInv_cont::invio_righe_IVA()
{
int size = 1024;
const int size = 1024;
TString record(size);
long nreg_p = -1;
@ -1096,6 +1101,9 @@ void TInv_cont::invio_righe_IVA()
str.format("%03d", rigaiva);
record.overwrite(str,113);
record.overwrite(_triva->get(RMI_CODCMS),118);
record.overwrite(_triva->get(RMI_FASCMS),138);
_tmov->setkey(1);
_tmov->put(MOV_NUMREG, nreg);
if (_tmov->read() == NOERR)

View File

@ -282,9 +282,6 @@ TipoIVA TRegistro::iva() const
bool TRegistro::read_att()
{
if (!_att.empty())
return TRUE;
TString16 chiave;
chiave << prefix().get_codditta() << '|' << attivita();
@ -298,7 +295,6 @@ bool TRegistro::read_att()
_prorata.destroy();
const TRectype & pla = cache().get("%PLA", chiave);
if (!pla.empty())
{
chiave.format("%d", year());
@ -328,20 +324,24 @@ real* TRegistro::read_prorata(int anno) const
chiave.format("%05ld", prefix().get_codditta());
chiave << anno << attivita() << "1";
real* prorata = NULL;
/*
TTable pla("%PLA");
pla.put("CODTAB", chiave);
real* prorata = NULL;
const int err = pla.read();
if (err == NOERR)
prorata = new real(pla.get("R8"));
*/
const TRectype& pla = cache().get("%PLA", chiave);
if (!pla.empty())
prorata = new real(pla.get("R8"));
return prorata;
}
real TRegistro::prorata(int annodoc)
{
const int annoiva = year();
// const int annopro = (annoiva < 1998 || annodoc < 1900) ? annoiva : annodoc;
if (annodoc <= 1900) annodoc = annoiva; // Test per anno documento non specificato
const int annopro = annoiva >= 1998 && annodoc < annoiva ? annodoc+1 : annoiva;
@ -365,8 +365,10 @@ real TRegistro::prorata(int annodoc)
void TRegistro::set_prorata(int annodoc, const real& pro)
{
int annoiva = year();
int annopro = (annoiva < 1998 || annodoc <= 0) ? annoiva : annodoc;
const int annoiva = year();
if (annodoc <= 1900) annodoc = annoiva; // Test per anno documento non specificato
const int annopro = annoiva >= 1998 && annodoc < annoiva ? annodoc+1 : annoiva;
TString16 chiave; chiave << annopro;
_prorata.add(chiave, pro, TRUE);
}
@ -935,4 +937,4 @@ bool TBill::default_cdc(TString& cdc, TString& fas) const
}
}
return ok && cdc.not_empty();
}
}

View File

@ -4573,7 +4573,7 @@ void TTransfer_file::write_righe_contabili(TString& record)
// Scrive righe iva per ricezione PC
void TTransfer_file::write_righe_IVA(TString& record)
{
TString sigla,key;
TString8 sigla,key;
int numfield = 1;
TMappa_trc& trc = mappa();
int gruppo;
@ -4625,7 +4625,7 @@ void TTransfer_file::write_righe_IVA(TString& record)
field = importo;
// Cerco di riconoscere gli importi in euro
if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro())
if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro())
{
flag = 3;
dec = 2;

View File

@ -181,6 +181,8 @@ Z2|10|135|137|24|CONTOC|||
Z2|11|138|143|24|SOTTOCONTC|||
Z2|12|145|158|24|IMPORTO|||
Z2|13|159|159|24|ROWTYPE|||
Z2|14|160|179|24|CODCMS|||
Z2|15|180|189|24|FASCMS|||
U1|1|3|9|25|NUMREG|||
U1|2|10|12|25|NUMRIG|||
U1|3|61|64|25|CODIVA|||
@ -196,6 +198,8 @@ U1|12|105|110|25|SOTTOCONTO|||
U1|13|111|113|25|RIGAIMP|||
U1|14|114|116|25|RIGAIVA|||
U1|15|117|118|24|MESELIQ|||
U1|16|119|138|25|CODCMS|||
U1|17|139|148|25|FASCMS|||
B1|1|3|3|28|TIPOC|||
B1|2|4|6|28|GRUPPO|||
B1|3|7|9|28|CONTO|||

View File

@ -487,23 +487,33 @@ int TFile_text::read(TRecord_text& rec)
if (!ok_r()) return 1; //non ritorna errore se fine file ed il record e' completo!
}
else
{
//legge carattere per carattere fino a quando non si trova il separatore di record
char c = _read_file->get();
if (c == EOF)
return EOF;
while (c != _recordsep[0])
{
buffer << c;
{
if (_recordsep == "\r\n" || _recordsep == "\n\r")
{
const int maxsize = 1024*16;
char* buf = buffer.get_buffer(maxsize);
_read_file->get(buf, maxsize, _recordsep[0]);
if (buffer.empty())
return EOF;
char c = _read_file->get();
c = _read_file->get();
if (!ok_r())
return EOF; //non ritorna errore se fine file ed il record e' completo!
}
// prendo il resto del separatore
int l = _recordsep.len()-1;
for (int j = 0; j < l;c = _read_file-> get (), j++);
}
else
{
//legge carattere per carattere fino a quando non si trova il separatore di record
char c = _read_file->get();
if (c == EOF)
return EOF;
while (c != _recordsep[0])
{
buffer << c;
c = _read_file->get();
if (!ok_r())
return EOF; //non ritorna errore se fine file ed il record e' completo!
}
for (int j = _recordsep.len()-1; j > 0; j--)
c = _read_file->get();
}
}
if (_fieldsep > ' ')
@ -667,11 +677,10 @@ bool TFile_text::_autoload(TRecord_text& rec, TCursor& cur , TTracciato_record&
for (int i = 0; i < items; i++)
{
TTracciato_campo& tc = tr.get(i);
TFieldref field = tc.field();
if (field.file()==0)
field.set_file(rel.lfile().num());
if (!field.name().empty())
const TFieldref& field = tc.field();
if (field.name().empty())
campo = field.read(rel);
const TString& message = tc.message();
if (!message.empty())
{
@ -721,11 +730,11 @@ int TFile_text::_autosave(TRelation& rel, const TRecord_text& rec, TTracciato_re
for (int i = 0; i < items; i++)
{
const TTracciato_campo& tc = tr.get(i);
TFieldref field(tc.field());
if (field.name().not_empty())
if (tc.field().name().not_empty())
{
if (field.file()==0)
field.set_file(rel.lfile().num());
const TFieldref& field = tc.field();
// if (field.file()==0)
// field.set_file(rel.lfile().num());
valore = rec.row(i);
// formatta il campo del file di testo secondo le specifiche del campo su file isam
preformat_field(field,valore,rel,tr.type());

View File

@ -1,4 +1,6 @@
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include <checks.h>
@ -318,7 +320,7 @@ bool http_get(const char* server,
{
TSocketClient client;
if (!client.IsOk())
return error_box("Impossibile inizializzare il client HTTP");
return error_box("Impossibile inizializzare il client HTTP");
CONNID connection = client.QueryConnection("80", server);
bool ok = connection != 0;
@ -326,6 +328,7 @@ bool http_get(const char* server,
{
ok = client.HttpGetFile(connection, remote_file, local_file) != 0;
client.RemoveConnection(connection);
}
return ok;
@ -335,7 +338,7 @@ bool http_dir(const char* server, const char* remote_dir, TString_array& list)
{
TSocketClient client;
if (!client.IsOk())
return error_box("Impossibile inizializzare il client HTTP");
return error_box("Impossibile inizializzare il client HTTP");
unsigned long connection = client.QueryConnection("80", server);
bool ok = connection != 0;
@ -343,7 +346,45 @@ bool http_dir(const char* server, const char* remote_dir, TString_array& list)
{
ok = client.HttpGetDir(connection, remote_dir, list) != 0;
client.RemoveConnection(connection);
}
return ok;
}
bool http_post(const char* server, const char* remote_file,
const char* local_file, const char* authorization)
{
TSocketClient client;
if (!client.IsOk())
return error_box("Impossibile inizializzare il client HTTP");
TString srv = server;
TString port = "80";
const int colon = srv.rfind(':');
if (colon > 0 && isdigit(srv[colon+1]))
{
port = srv.mid(colon+1);
srv.cut(colon);
}
unsigned long connection = client.QueryConnection(port, srv);
bool ok = connection != 0;
if (ok)
{
ok = client.HttpPostFile(remote_file, local_file, authorization) != 0;
client.RemoveConnection(connection);
if (!ok)
{
DWORD dwSize;
const char* err = (const char*)client.GetBuffer(dwSize);
error_box("Impossibile spedire il file %s al server %s:\n%s",
local_file, server, err);
client.ReleaseBuffer();
}
}
else
return error_box("Impossibile connettersi al server %s", server);
return ok;
}

View File

@ -9,8 +9,8 @@
#include <real.h>
#endif
bool rpc_Call(const char* cmd);
char* rpc_Request(const char* cmd, unsigned long& size, real& time);
bool rpc_Call(const char* cmd);
char* rpc_Request(const char* cmd, unsigned long& size, real& time);
bool rpc_DongleHasModule(word af);
bool rpc_DongleModules(TBit_array& ba);
@ -26,5 +26,7 @@ bool rpc_Stop();
bool http_get(const char* server, const char* remote_file, const char* local_file);
bool http_dir(const char* server, const char* remote_dir, TString_array & list);
bool http_post(const char* server, const char* remote_file,
const char* local_file, const char* authorization = NULL);
#endif
#endif

View File

@ -23,6 +23,7 @@
// [JCW 96-Jan-01] removed UDP capabilities from skstream
#include <fstream.h>
#include "winsock.h"
//
@ -219,31 +220,33 @@ void skstream::open( const char *addr, const service port, const role side )
if( side == skstream::client )
{
// 3(cli). Connect
SOCKADDR_IN sa ;
SOCKADDR_IN sa ; memset(&sa,0,sizeof(sa));
sa.sin_family = AF_INET ;
hostent *he = NULL;
unsigned long indirizzo = 0xFFFFFFFF;
int ip[4];
//e' un indirizzo numerico?
//si...
if (sscanf( addr, "%d.%d.%d.%d", &ip[0], &ip[1], &ip[2], &ip[3]) == 4)
{
char ipaddr[4];
for (int i = 0; i < 4; i++)
ipaddr[i] = (char)ip[i];
he = ::gethostbyaddr( ipaddr, 4, PF_INET );
}
else
he = ::gethostbyname( addr );
if( NULL == he )
{
// Cannot resolve remote server ip
close() ;
return ;
indirizzo = ::inet_addr(addr);
}
sa.sin_addr.S_un.S_addr = *(unsigned long *)( he->h_addr_list[ 0 ] ) ;
//no...
else
{
hostent* he = ::gethostbyname( addr );
if( NULL != he )
indirizzo = *(unsigned long *)( he->h_addr_list[ 0 ] );
}
if (indirizzo == 0 || indirizzo == 0xFFFFFFFF)
{
close();
return;
}
sa.sin_addr.S_un.S_addr = indirizzo;
sa.sin_port = ::htons( port ) ;
if( SOCKET_ERROR == ::connect( _socket, (sockaddr *)&sa, sizeof( sa ) ) )
@ -608,6 +611,7 @@ TConnection* TSocketClient::OnQueryConnection(const char* service, const char* s
delete pConnection;
pConnection = NULL;
}
return pConnection;
}
@ -654,6 +658,7 @@ bool TSocketClient::WriteLine(CONNID id, const char* str)
return FALSE;
}
bool TSocketClient::ReadLine(CONNID id, TString& str)
{
TSocket_connection* conn = (TSocket_connection*)GetConnection(id);
@ -680,6 +685,7 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
buf << "GET " << remote << " HTTP/1.0\r\n\r\n";
if (WriteLine(id, buf))
{
const clock_t start = clock();
@ -689,7 +695,7 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
ReadLine(id, buf);
if (buf.blank())
break;
if (r == 0 && buf.find("404") > 0)
if (r == 0 && (buf.find("400") > 0 || buf.find("404")))
return FALSE; // File not found
if (buf.compare("Content-length:", 15, TRUE) == 0)
{
@ -846,3 +852,51 @@ bool TSocketClient::HttpSoap(CONNID id, const char* cmd)
}
return ok;
}
BOOL TSocketClient::HttpPostFile(CONNID id, const char* remote, const char* local, const char* authorization)
{
bool ok = false;
TSocket_connection* conn = (TSocket_connection*)GetConnection(id);
if (conn == NULL)
return ok;
TString buf(4096);
buf << "POST " << remote << " HTTP/1.0\r\n"
<< "User-Agent: Campo/1.7\r\n"
<< "Content-Type: text/plain\r\n"
<< "Content-Length: " << fsize(local) << "\r\n";
if (authorization && *authorization)
buf << "Authorization: " << authorization << "\r\n";
buf << "\r\n";
BOOL ok = conn->WriteLine(buf);
if (ok)
{
ifstream input(local, ios::nocreate | ios::binary);
while (!input.eof())
{
input.read(buf.get_buffer(), buf.size());
const size_t count = input.gcount();
if (count > 0)
{
skstream* cur_socket = conn->GetSocket();
cur_socket->sync();
cur_socket->write(buf, count);
cur_socket->flush();
}
else
break;
}
conn->ReadLine(buf);
ok = buf.find("200 OK") >= 0;
ReleaseBuffer();
m_dwSize = buf.len()+1;
m_pData = new BYTE[m_dwSize];
memcpy(m_pData, buf, (size_t)m_dwSize);
}
return ok;
}

View File

@ -50,10 +50,10 @@ public:
bool HttpGetFile(CONNID id, const char* remote, const char* local);
bool HttpGetDir(CONNID id, const char* remote, TString_array& list);
bool HttpSoap(CONNID id, const char* query);
bool HttpPostFile(CONNID id, const char* remote, const char* local, const char* authorization = NULL);
TSocketClient();
virtual ~TSocketClient();
};
#endif

View File

@ -9,7 +9,7 @@
#define TEXT_TMP_SIZE 1024
static TString _TEXT_TMP(TEXT_TMP_SIZE);
static char* TEXT_TMP = _TEXT_TMP.get_buffer();
static char* TEXT_TMP = (char*)(const char*)_TEXT_TMP;
class _HotSpot : public TObject
{
@ -431,9 +431,13 @@ const char *TTextfile::line(
if (_cur_line != j)
read_line (j);
*TEXT_TMP = '\0';
/*
_line.restart ();
for (int i = 0; i < _line.items (); i++)
strcat (TEXT_TMP, (const char *) _line.get ());
*/
FOR_EACH_TOKEN(_line, l)
strcat (TEXT_TMP, l);
if (howmuch != -1)
{
if (((unsigned int)pos+howmuch) < strlen(TEXT_TMP))

View File

@ -315,6 +315,7 @@ WINDOW cur_win()
}
///////////////////////////////////////////////////////////
// TWindow
///////////////////////////////////////////////////////////
@ -1095,4 +1096,3 @@ bool TScroll_window::on_key(KEY key)
return TWindow::on_key(key);
}

View File

@ -36,7 +36,7 @@ END
NUMBER F_ANNOES 4
BEGIN
FLAGS "D"
FLAGS "DZ"
PROMPT 2 4 "Esercizio di competenza "
FIELD ANNOES
END

View File

@ -15,23 +15,24 @@ ENDPAGE
PAGE "Ricostruzione movimenti" 11 50 10
DATE F_DATA
BEGIN
DATE F_DATA
BEGIN
FLAGS "HDA"
PROMPT 1 1 "Anno attuale"
MESSAGE "0",F_ANNOES
END
NUMBER F_ANNOES 4
BEGIN
BEGIN
PROMPT 2 3 "Codice esercizio "
USE ESC
INPUT CODTAB F_ANNOES
DISPLAY "Esercizio@20" CODTAB
DISPLAY "Dal@20" D0
DISPLAY "Al@20" D1
OUTPUT F_ANNOES CODTAB
OUTPUT F_ANNOES CODTAB
CHECKTYPE REQUIRED
FLAGS "Z"
END
ENDPAGE

View File

@ -97,7 +97,7 @@ END
NUMBER F_ANNOES 4
BEGIN
FLAGS "A"
FLAGS "AZ"
PROMPT 2 4 "Codice es. "
USE ESC
INPUT CODTAB F_ANNOES

View File

@ -4,38 +4,38 @@ PAGE "Stampa disponibilit
LISTBOX F_ORDINE 10
BEGIN
PROMPT 2 1 "Ordinamento "
ITEM "A|articoli"
ITEM "A|articoli"
MESSAGE ENABLE,F_ORDINEART|HIDE,F_TOTALIDEPOSITI|"X",F_DETTAGLIODEP
MESSAGE SHOW,F_TOTALIMAGAZZINI|SHOW,F_DETTAGLIOMAG
ITEM "M|magazzini"
MESSAGE "C",F_ORDINEART|K_SPACE,F_ORDINEART|DISABLE,F_ORDINEART|SHOW,G_CODART@|HIDE,G_DESART@
MESSAGE SHOW,F_TOTALIMAGAZZINI|SHOW,F_DETTAGLIOMAG
ITEM "M|magazzini"
MESSAGE "C",F_ORDINEART|K_SPACE,F_ORDINEART|DISABLE,F_ORDINEART|SHOW,G_CODART@|HIDE,G_DESART@
MESSAGE SHOW,F_TOTALIDEPOSITI|"X",F_DETTAGLIODEP
MESSAGE HIDE,F_TOTALIMAGAZZINI|HIDE,F_DETTAGLIOMAG
MESSAGE HIDE,F_TOTALIMAGAZZINI|HIDE,F_DETTAGLIOMAG
END
LISTBOX F_ORDINEART 20
BEGIN
FLAGS "G"
FLAGS "G"
PROMPT 34 1 "sotto-ordinamento "
ITEM "C|codice"
ITEM "C|codice"
MESSAGE HIDE,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@|ENABLE,F_RAGGCODICE
ITEM "D|descrizione"
ITEM "D|descrizione"
MESSAGE HIDE,G_CATMER@|DISABLE,G_CODART@|SHOW,G_DESART@|DISABLE,F_RAGGCODICE
ITEM "M|gruppo merc./codice"
ITEM "M|gruppo merc./codice"
MESSAGE SHOW,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@|DISABLE,F_RAGGCODICE
END
NUMBER F_ANNOES 4
BEGIN
FLAGS "A"
FLAGS "AZ"
PROMPT 2 2 "Codice es. "
USE ESC
INPUT CODTAB F_ANNOES
DISPLAY "Esercizio" CODTAB
DISPLAY "Dal@12" D0
USE ESC
INPUT CODTAB F_ANNOES
DISPLAY "Esercizio" CODTAB
DISPLAY "Dal@12" D0
DISPLAY "Al@12" D1
OUTPUT F_ANNOES CODTAB
OUTPUT F_ANNOES CODTAB
CHECKTYPE NORMAL
ADD NONE
END
@ -43,96 +43,96 @@ END
STRING F_DAART 20
BEGIN
PROMPT 2 4 "Dall'articolo "
FLAGS "U"
USE LF_ANAMAG
INPUT CODART F_DAART
FLAGS "U"
USE LF_ANAMAG
INPUT CODART F_DAART
DISPLAY "Codice@20" CODART
DISPLAY "Descr@50" DESCR
OUTPUT F_DAART CODART
OUTPUT F_DADES DESCR
GROUP G_CODART
DISPLAY "Descr@50" DESCR
OUTPUT F_DAART CODART
OUTPUT F_DADES DESCR
GROUP G_CODART
END
STRING F_AART 20
BEGIN
PROMPT 2 5 " all'articolo "
FLAGS "U"
COPY USE F_DAART
INPUT CODART F_AART
COPY DISPLAY F_DAART
OUTPUT F_AART CODART
OUTPUT F_ADES DESCR
GROUP G_CODART
FLAGS "U"
COPY USE F_DAART
INPUT CODART F_AART
COPY DISPLAY F_DAART
OUTPUT F_AART CODART
OUTPUT F_ADES DESCR
GROUP G_CODART
END
STRING F_DADES 50
BEGIN
PROMPT 2 4 "Dall'articolo "
FLAGS "U"
USE LF_ANAMAG KEY 2
INPUT DESCR F_DADES
DISPLAY "Descr@50" DESCR
FLAGS "U"
USE LF_ANAMAG KEY 2
INPUT DESCR F_DADES
DISPLAY "Descr@50" DESCR
DISPLAY "Codice@20" CODART
OUTPUT F_DADES DESCR
OUTPUT F_DAART CODART
GROUP G_DESART
OUTPUT F_DADES DESCR
OUTPUT F_DAART CODART
GROUP G_DESART
END
STRING F_ADES 50
BEGIN
PROMPT 2 5 " all'articolo "
FLAGS "U"
COPY USE F_DADES
INPUT DESCR F_ADES
COPY DISPLAY F_DADES
OUTPUT F_ADES DESCR
OUTPUT F_AART CODART
GROUP G_DESART
FLAGS "U"
COPY USE F_DADES
INPUT DESCR F_ADES
COPY DISPLAY F_DADES
OUTPUT F_ADES DESCR
OUTPUT F_AART CODART
GROUP G_DESART
END
STRING F_DAMAG 3
BEGIN
PROMPT 2 7 "Dal magazzino "
FLAGS "U"
FLAGS "U"
USE MAG SELECT CODTAB[4,5]==""
INPUT CODTAB F_DAMAG
DISPLAY "Codice" CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_DAMAG CODTAB
INPUT CODTAB F_DAMAG
DISPLAY "Codice" CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_DAMAG CODTAB
END
STRING F_AMAG 3
BEGIN
PROMPT 2 8 " al magazzino "
FLAGS "U"
COPY USE F_DAMAG
INPUT CODTAB F_AMAG
COPY DISPLAY F_DAMAG
OUTPUT F_AMAG CODTAB
FLAGS "U"
COPY USE F_DAMAG
INPUT CODTAB F_AMAG
COPY DISPLAY F_DAMAG
OUTPUT F_AMAG CODTAB
END
STRING F_DACATMER 3
BEGIN
PROMPT 2 10 "Dal gruppo "
FLAGS "U"
USE GMC SELECT CODTAB[4,5]==""
INPUT CODTAB F_DACATMER
DISPLAY "Codice" CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_DACATMER CODTAB[1,3]
GROUP G_CATMER
FLAGS "U"
USE GMC SELECT CODTAB[4,5]==""
INPUT CODTAB F_DACATMER
DISPLAY "Codice" CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_DACATMER CODTAB[1,3]
GROUP G_CATMER
END
STRING F_ACATMER 3
BEGIN
PROMPT 2 11 " al gruppo "
FLAGS "U"
COPY USE F_DACATMER
INPUT CODTAB F_ACATMER
COPY DISPLAY F_DACATMER
OUTPUT F_ACATMER CODTAB[1,3]
GROUP G_CATMER
FLAGS "U"
COPY USE F_DACATMER
INPUT CODTAB F_ACATMER
COPY DISPLAY F_DACATMER
OUTPUT F_ACATMER CODTAB[1,3]
GROUP G_CATMER
END
BOOL F_TOTALIDEPOSITI
@ -147,84 +147,84 @@ BEGIN
FLAGS "DH"
PROMPT 42 12 "Dettaglio i depositi"
MESSAGE TRUE ENABLE,F_RAGGLIVGIAC|ENABLE,F_RAGGCODICE
MESSAGE FALSE CLEAR,F_RAGGLIVGIAC|K_SPACE,F_RAGGLIVGIAC|CLEAR,F_RAGGCODICE|K_SPACE,F_RAGGCODICE
MESSAGE FALSE CLEAR,F_RAGGLIVGIAC|K_SPACE,F_RAGGLIVGIAC|CLEAR,F_RAGGCODICE|K_SPACE,F_RAGGCODICE
END
BOOLEAN F_RAGGCODICE
BEGIN
PROMPT 2 13 "Stampa totali livelli di codice"
MESSAGE FALSE CLEAR,F_FROMLIVELLOART|CLEAR,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
MESSAGE TRUE ENABLE,F_FROMLIVELLOART|ENABLE,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
MESSAGE FALSE CLEAR,F_FROMLIVELLOART|CLEAR,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
MESSAGE TRUE ENABLE,F_FROMLIVELLOART|ENABLE,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
END
NUMBER F_FROMLIVELLOART 1
BEGIN
FLAGS "G"
FLAGS "G"
PROMPT 42 13 "da "
USE FCA
INPUT CODTAB F_FROMLIVELLOART
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_FROMLIVELLOART CODTAB
NUM_EXPR ((#F_FROMLIVELLOART<=#F_TOLIVELLOART)||(#F_TOLIVELLOART=0))&&((#F_FROMLIVELLOGIAC*#F_FROMLIVELLOART)=0)
CHECKTYPE NORMAL
WARNING "Livello iniziale non ammissibile"
USE FCA
INPUT CODTAB F_FROMLIVELLOART
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_FROMLIVELLOART CODTAB
NUM_EXPR ((#F_FROMLIVELLOART<=#F_TOLIVELLOART)||(#F_TOLIVELLOART=0))&&((#F_FROMLIVELLOGIAC*#F_FROMLIVELLOART)=0)
CHECKTYPE NORMAL
WARNING "Livello iniziale non ammissibile"
END
NUMBER F_TOLIVELLOART 1
BEGIN
PROMPT 52 13 "a "
USE FCA
INPUT CODTAB F_TOLIVELLOART
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_TOLIVELLOART CODTAB
CHECKTYPE NORMAL
NUM_EXPR ((#F_FROMLIVELLOART<=#F_TOLIVELLOART)||(#F_TOLIVELLOART=0))&&(((#F_TOLIVELLOGIAC+#F_FROMLIVELLOGIAC)*#F_TOLIVELLOART)=0)
WARNING "Livello finale non ammissibile"
USE FCA
INPUT CODTAB F_TOLIVELLOART
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_TOLIVELLOART CODTAB
CHECKTYPE NORMAL
NUM_EXPR ((#F_FROMLIVELLOART<=#F_TOLIVELLOART)||(#F_TOLIVELLOART=0))&&(((#F_TOLIVELLOGIAC+#F_FROMLIVELLOGIAC)*#F_TOLIVELLOART)=0)
WARNING "Livello finale non ammissibile"
END
BOOL F_RAGGLIVGIAC
BEGIN
PROMPT 2 14 "Stampa totali livelli di giacenza"
MESSAGE FALSE CLEAR,F_FROMLIVELLOGIAC|CLEAR,F_TOLIVELLOGIAC|CHECK,F_TOLIVELLOGIAC
MESSAGE TRUE ENABLE,F_FROMLIVELLOGIAC|ENABLE,F_TOLIVELLOGIAC
MESSAGE FALSE CLEAR,F_FROMLIVELLOGIAC|CLEAR,F_TOLIVELLOGIAC|CHECK,F_TOLIVELLOGIAC
MESSAGE TRUE ENABLE,F_FROMLIVELLOGIAC|ENABLE,F_TOLIVELLOGIAC
END
NUMBER F_FROMLIVELLOGIAC 1
BEGIN
FLAG "D"
FLAG "D"
PROMPT 42 14 "da "
USE FCG
INPUT CODTAB F_FROMLIVELLOGIAC
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_FROMLIVELLOGIAC CODTAB
CHECKTYPE NORMAL
NUM_EXPR ((#F_FROMLIVELLOGIAC*(#F_FROMLIVELLOART+#F_TOLIVELLOART))=0)&&((#F_FROMLIVELLOGIAC<=#F_TOLIVELLOGIAC)||(#F_TOLIVELLOGIAC=0))
USE FCG
INPUT CODTAB F_FROMLIVELLOGIAC
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_FROMLIVELLOGIAC CODTAB
CHECKTYPE NORMAL
NUM_EXPR ((#F_FROMLIVELLOGIAC*(#F_FROMLIVELLOART+#F_TOLIVELLOART))=0)&&((#F_FROMLIVELLOGIAC<=#F_TOLIVELLOGIAC)||(#F_TOLIVELLOGIAC=0))
WARNING "Livello iniziale non ammissibile"
WARNING "Livello iniziale non ammissibile"
END
NUMBER F_TOLIVELLOGIAC 1
BEGIN
FLAG "D"
FLAG "D"
PROMPT 52 14 "a "
USE FCG
INPUT CODTAB F_TOLIVELLOGIAC
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_TOLIVELLOGIAC CODTAB
NUM_EXPR ((#F_FROMLIVELLOGIAC*#F_FROMLIVELLOART)=0)&&((#F_FROMLIVELLOGIAC<=#F_TOLIVELLOGIAC)||(#F_TOLIVELLOGIAC=0))&&((#F_TOLIVELLOGIAC*#F_TOLIVELLOART)=0)
WARNING "Livello finale non ammissibile"
CHECKTYPE NORMAL
USE FCG
INPUT CODTAB F_TOLIVELLOGIAC
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_TOLIVELLOGIAC CODTAB
NUM_EXPR ((#F_FROMLIVELLOGIAC*#F_FROMLIVELLOART)=0)&&((#F_FROMLIVELLOGIAC<=#F_TOLIVELLOGIAC)||(#F_TOLIVELLOGIAC=0))&&((#F_TOLIVELLOGIAC*#F_TOLIVELLOART)=0)
WARNING "Livello finale non ammissibile"
CHECKTYPE NORMAL
END
BOOL F_TOTALIMAGAZZINI
BEGIN
PROMPT 2 15 "Stampo i totali di magazzino"
MESSAGE TRUE ENABLE,F_DETTAGLIOMAG
MESSAGE FALSE CLEAR,F_DETTAGLIOMAG|K_SPACE,F_DETTAGLIOMAG
MESSAGE TRUE ENABLE,F_DETTAGLIOMAG
MESSAGE FALSE CLEAR,F_DETTAGLIOMAG|K_SPACE,F_DETTAGLIOMAG
END
BOOL F_DETTAGLIOMAG

View File

@ -42,7 +42,7 @@ END
NUMBER F_ANNOES 4
BEGIN
FLAGS "A"
FLAGS "AZ"
PROMPT 2 3 "Codice es. "
USE ESC
INPUT CODTAB F_ANNOES

View File

@ -4,119 +4,119 @@ PAGE "Stampa giacenze e prezzi" -1 -1 78 20
LISTBOX F_ORDINE 10
BEGIN
PROMPT 2 1 "Ordinamento "
ITEM "A|articoli"
MESSAGE ENABLE,F_ORDINEART
ITEM "M|magazzini"
MESSAGE "C",F_ORDINEART|K_SPACE,F_ORDINEART|DISABLE,F_ORDINEART|SHOW,G_CODART@|HIDE,G_DESART@
ITEM "A|articoli"
MESSAGE ENABLE,F_ORDINEART
ITEM "M|magazzini"
MESSAGE "C",F_ORDINEART|K_SPACE,F_ORDINEART|DISABLE,F_ORDINEART|SHOW,G_CODART@|HIDE,G_DESART@
END
LISTBOX F_ORDINEART 20
BEGIN
FLAGS "G"
FLAGS "G"
PROMPT 34 1 "sotto-ordinamento "
ITEM "C|codice"
MESSAGE HIDE,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@
ITEM "D|descrizione"
MESSAGE HIDE,G_CATMER@|DISABLE,G_CODART@|SHOW,G_DESART@
ITEM "M|gruppo merc./codice"
MESSAGE SHOW,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@
ITEM "C|codice"
MESSAGE HIDE,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@
ITEM "D|descrizione"
MESSAGE HIDE,G_CATMER@|DISABLE,G_CODART@|SHOW,G_DESART@
ITEM "M|gruppo merc./codice"
MESSAGE SHOW,G_CATMER@|ENABLE,G_CODART@|HIDE,G_DESART@
END
NUMBER F_ANNOES 4
BEGIN
FLAGS "A"
FLAGS "AZ"
PROMPT 2 2 "Codice es. "
END
STRING F_DAART 20
BEGIN
PROMPT 2 4 "Dall'articolo "
FLAGS "U"
USE LF_ANAMAG
INPUT CODART F_DAART
FLAGS "U"
USE LF_ANAMAG
INPUT CODART F_DAART
DISPLAY "Codice@20" CODART
DISPLAY "Descr@50" DESCR
OUTPUT F_DAART CODART
GROUP G_CODART
DISPLAY "Descr@50" DESCR
OUTPUT F_DAART CODART
GROUP G_CODART
END
STRING F_AART 20
BEGIN
PROMPT 2 5 " all'articolo "
FLAGS "U"
COPY USE F_DAART
INPUT CODART F_AART
COPY DISPLAY F_DAART
OUTPUT F_AART CODART
GROUP G_CODART
FLAGS "U"
COPY USE F_DAART
INPUT CODART F_AART
COPY DISPLAY F_DAART
OUTPUT F_AART CODART
GROUP G_CODART
END
STRING F_DADES 50
BEGIN
PROMPT 2 4 "Dall'articolo "
FLAGS "U"
USE LF_ANAMAG KEY 2
INPUT DESCR F_DADES
DISPLAY "Descr@50" DESCR
FLAGS "U"
USE LF_ANAMAG KEY 2
INPUT DESCR F_DADES
DISPLAY "Descr@50" DESCR
DISPLAY "Codice@20" CODART
OUTPUT F_DADES DESCR
GROUP G_DESART
OUTPUT F_DADES DESCR
GROUP G_DESART
END
STRING F_ADES 50
BEGIN
PROMPT 2 5 " all'articolo "
FLAGS "U"
COPY USE F_DADES
INPUT DESCR F_ADES
COPY DISPLAY F_DADES
OUTPUT F_ADES DESCR
GROUP G_DESART
FLAGS "U"
COPY USE F_DADES
INPUT DESCR F_ADES
COPY DISPLAY F_DADES
OUTPUT F_ADES DESCR
GROUP G_DESART
END
STRING F_DAMAG 3
BEGIN
PROMPT 2 7 "Dal magazzino "
FLAGS "U"
USE MAG SELECT CODTAB[4,5]=="" && CODTAB[1,3]!=""
INPUT CODTAB F_DAMAG
FLAGS "U"
USE MAG SELECT CODTAB[4,5]=="" && CODTAB[1,3]!=""
INPUT CODTAB F_DAMAG
DISPLAY "Codice@20" CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_DAMAG CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_DAMAG CODTAB
END
STRING F_AMAG 3
BEGIN
PROMPT 2 8 " al magazzino "
FLAGS "U"
COPY USE F_DAMAG
INPUT CODTAB F_AMAG
COPY DISPLAY F_DAMAG
OUTPUT F_AMAG CODTAB
FLAGS "U"
COPY USE F_DAMAG
INPUT CODTAB F_AMAG
COPY DISPLAY F_DAMAG
OUTPUT F_AMAG CODTAB
END
STRING F_DACATMER 3
BEGIN
PROMPT 2 10 "Dal gruppo "
FLAGS "U"
USE GMC SELECT CODTAB[4,5]==""
INPUT CODTAB F_DACATMER
FLAGS "U"
USE GMC SELECT CODTAB[4,5]==""
INPUT CODTAB F_DACATMER
DISPLAY "Codice" CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_DACATMER CODTAB[1,3]
GROUP G_CATMER
DISPLAY "Descr@50" S0
OUTPUT F_DACATMER CODTAB[1,3]
GROUP G_CATMER
END
STRING F_ACATMER 3
BEGIN
PROMPT 2 11 " al gruppo "
FLAGS "U"
COPY USE F_DACATMER
INPUT CODTAB F_ACATMER
COPY DISPLAY F_DACATMER
OUTPUT F_ACATMER CODTAB[1,3]
GROUP G_CATMER
FLAGS "U"
COPY USE F_DACATMER
INPUT CODTAB F_ACATMER
COPY DISPLAY F_DACATMER
OUTPUT F_ACATMER CODTAB[1,3]
GROUP G_CATMER
END
BOOL F_DIM_E_NOTE
@ -128,93 +128,93 @@ END
BOOLEAN F_RAGGCODICE
BEGIN
PROMPT 2 14 "Raggruppo gli articoli"
MESSAGE FALSE CLEAR,F_FROMLIVELLOART|CLEAR,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
MESSAGE TRUE ENABLE,F_FROMLIVELLOART|ENABLE,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
MESSAGE FALSE CLEAR,F_FROMLIVELLOART|CLEAR,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
MESSAGE TRUE ENABLE,F_FROMLIVELLOART|ENABLE,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
END
NUMBER F_FROMLIVELLOART 1
BEGIN
FLAGS "G"
FLAGS "G"
PROMPT 42 14 "da "
USE FCA
INPUT CODTAB F_FROMLIVELLOART
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_FROMLIVELLOART CODTAB
NUM_EXPR ((#F_FROMLIVELLOART<=#F_TOLIVELLOART)||(#F_TOLIVELLOART=0))&&((#F_FROMLIVELLOGIAC*#F_FROMLIVELLOART)=0)
CHECKTYPE NORMAL
WARNING "Livello iniziale non ammissibile"
USE FCA
INPUT CODTAB F_FROMLIVELLOART
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_FROMLIVELLOART CODTAB
NUM_EXPR ((#F_FROMLIVELLOART<=#F_TOLIVELLOART)||(#F_TOLIVELLOART=0))&&((#F_FROMLIVELLOGIAC*#F_FROMLIVELLOART)=0)
CHECKTYPE NORMAL
WARNING "Livello iniziale non ammissibile"
END
NUMBER F_TOLIVELLOART 1
BEGIN
PROMPT 52 14 "a "
USE FCA
INPUT CODTAB F_TOLIVELLOART
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_TOLIVELLOART CODTAB
CHECKTYPE NORMAL
NUM_EXPR ((#F_FROMLIVELLOART<=#F_TOLIVELLOART)||(#F_TOLIVELLOART=0))&&(((#F_TOLIVELLOGIAC+#F_FROMLIVELLOGIAC)*#F_TOLIVELLOART)=0)
WARNING "Livello finale non ammissibile"
USE FCA
INPUT CODTAB F_TOLIVELLOART
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_TOLIVELLOART CODTAB
CHECKTYPE NORMAL
NUM_EXPR ((#F_FROMLIVELLOART<=#F_TOLIVELLOART)||(#F_TOLIVELLOART=0))&&(((#F_TOLIVELLOGIAC+#F_FROMLIVELLOGIAC)*#F_TOLIVELLOART)=0)
WARNING "Livello finale non ammissibile"
END
BOOL F_RAGGLIVGIAC
BEGIN
PROMPT 2 15 "Raggruppo le giacenze"
MESSAGE FALSE CLEAR,F_FROMLIVELLOGIAC|CLEAR,F_TOLIVELLOGIAC|CHECK,F_TOLIVELLOGIAC
MESSAGE TRUE ENABLE,F_FROMLIVELLOGIAC|ENABLE,F_TOLIVELLOGIAC
MESSAGE FALSE CLEAR,F_FROMLIVELLOGIAC|CLEAR,F_TOLIVELLOGIAC|CHECK,F_TOLIVELLOGIAC
MESSAGE TRUE ENABLE,F_FROMLIVELLOGIAC|ENABLE,F_TOLIVELLOGIAC
END
NUMBER F_FROMLIVELLOGIAC 1
BEGIN
FLAG "D"
FLAG "D"
PROMPT 42 15 "da "
USE FCG
INPUT CODTAB F_FROMLIVELLOGIAC
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_FROMLIVELLOGIAC CODTAB
CHECKTYPE NORMAL
NUM_EXPR ((#F_FROMLIVELLOGIAC*(#F_FROMLIVELLOART+#F_TOLIVELLOART))=0)&&((#F_FROMLIVELLOGIAC<=#F_TOLIVELLOGIAC)||(#F_TOLIVELLOGIAC=0))
USE FCG
INPUT CODTAB F_FROMLIVELLOGIAC
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_FROMLIVELLOGIAC CODTAB
CHECKTYPE NORMAL
NUM_EXPR ((#F_FROMLIVELLOGIAC*(#F_FROMLIVELLOART+#F_TOLIVELLOART))=0)&&((#F_FROMLIVELLOGIAC<=#F_TOLIVELLOGIAC)||(#F_TOLIVELLOGIAC=0))
WARNING "Livello iniziale non ammissibile"
WARNING "Livello iniziale non ammissibile"
END
NUMBER F_TOLIVELLOGIAC 1
BEGIN
FLAG "D"
FLAG "D"
PROMPT 52 15 "a "
USE FCG
INPUT CODTAB F_TOLIVELLOGIAC
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_TOLIVELLOGIAC CODTAB
NUM_EXPR ((#F_FROMLIVELLOGIAC*#F_FROMLIVELLOART)=0)&&((#F_FROMLIVELLOGIAC<=#F_TOLIVELLOGIAC)||(#F_TOLIVELLOGIAC=0))&&((#F_TOLIVELLOGIAC*#F_TOLIVELLOART)=0)
WARNING "Livello finale non ammissibile"
CHECKTYPE NORMAL
USE FCG
INPUT CODTAB F_TOLIVELLOGIAC
DISPLAY "Num." CODTAB
DISPLAY "Descr@50" S0
OUTPUT F_TOLIVELLOGIAC CODTAB
NUM_EXPR ((#F_FROMLIVELLOGIAC*#F_FROMLIVELLOART)=0)&&((#F_FROMLIVELLOGIAC<=#F_TOLIVELLOGIAC)||(#F_TOLIVELLOGIAC=0))&&((#F_TOLIVELLOGIAC*#F_TOLIVELLOART)=0)
WARNING "Livello finale non ammissibile"
CHECKTYPE NORMAL
END
BOOL F_TOTALIMAGAZZINI
BEGIN
PROMPT 2 16 "Stampo i totali di magazzino"
MESSAGE TRUE ENABLE,F_DETTAGLIOMAG
MESSAGE FALSE CLEAR,F_DETTAGLIOMAG|K_SPACE,F_DETTAGLIOMAG
MESSAGE TRUE ENABLE,F_DETTAGLIOMAG
MESSAGE FALSE CLEAR,F_DETTAGLIOMAG|K_SPACE,F_DETTAGLIOMAG
END
BOOL F_DETTAGLIOMAG
BEGIN
PROMPT 42 16 "Stampa il dettaglio magazzini"
MESSAGE TRUE ENABLE,F_TOTALIDEPOSITI
MESSAGE FALSE CLEAR,F_TOTALIDEPOSITI|K_SPACE,F_TOTALIDEPOSITI
MESSAGE TRUE ENABLE,F_TOTALIDEPOSITI
MESSAGE FALSE CLEAR,F_TOTALIDEPOSITI|K_SPACE,F_TOTALIDEPOSITI
END
BOOL F_TOTALIDEPOSITI
BEGIN
PROMPT 2 17 "Stampo i totali di deposito"
MESSAGE TRUE ENABLE,F_DETTAGLIODEP
MESSAGE FALSE CLEAR,F_DETTAGLIODEP|K_SPACE,F_DETTAGLIODEP
MESSAGE TRUE ENABLE,F_DETTAGLIODEP
MESSAGE FALSE CLEAR,F_DETTAGLIODEP|K_SPACE,F_DETTAGLIODEP
END
BOOL F_DETTAGLIODEP

View File

@ -3,7 +3,7 @@ PAGE "Stampa lista movimenti" -1 -1 80 20
NUMBER F_ANNOES 4
BEGIN
FLAGS "A"
FLAGS "AZ"
PROMPT 2 1 "Codice esercizio "
USE ESC
INPUT CODTAB F_ANNOES

View File

@ -51,7 +51,7 @@ END
NUMBER F_ANNOES 4
BEGIN
FLAGS "A"
FLAGS "AZ"
PROMPT 59 2 "Codice es. "
USE ESC
INPUT CODTAB F_ANNOES

View File

@ -24,7 +24,7 @@ END
NUMBER F_ANNOES 4
BEGIN
PROMPT 2 1 "Anno "
FLAGS "A"
FLAGS "AZ"
CHECKTYPE REQUIRED
END

View File

@ -29,8 +29,9 @@ public:
TTimed_skipbox:: TTimed_skipbox(const char * message,int seconds,int x,int y)
: TTimed_breakbox(message,seconds,x,y)
{
hide(DLG_OK);
hide(DLG_CANCEL);
add_button(DLG_CANCEL, 0, "Ignora", -22, -1, 12, 2,"",0);
add_button(DLG_OK, 0, "Continua", -11, -1, 12, 2,"",0);
}
TTimed_skipbox::~TTimed_skipbox()
@ -244,38 +245,39 @@ bool TArticolo::lock_and_prompt(const char * cod)
TString mess;
int err;
do
if (cod && *cod)
err = read(cod,_isequal,_testandlock);
else
err = _iskeyerr;
if (err != NOERR)
{
if (cod && *cod)
err = read(cod,_isequal,_testandlock);
else
err = _iskeyerr;
switch (err)
if (err == _islocked)
{
case NOERR:
return TRUE;
case _iskeyerr:
mess << "Il codice articolo ''" << cod << "'' non e' valido";
break;
case _islocked:
mess.cut(0);
mess << "Il record di anagrafica\ndell'articolo ''" << cod << "'' e' gia' usato da un altro programma. Scegliere se ritentare la lettura o ignorare l'articolo.";
break;
case _iskeynotfound:
mess.cut(0);
mess << "Il record di anagrafica\ndell'articolo ''"<< cod << "'' non esiste.";
//error_box(mess);
//return FALSE;
break;
default:
mess.cut(0);
mess << "Non riesco ad accedere al\nrecord di anagrafica dell'articolo ''"<< cod << "'' - errore " << err << ".";
mess << "Il record di anagrafica\ndell'articolo ''" << cod << "'' e' gia' usato da un altro programma.";
TTimed_skipbox bbox((const char *)mess,10);
while (err == _islocked)
{
bbox.run();
err = read(cod,_isequal,_testandlock);
}
}
TTimed_skipbox bbox((const char *)mess,10);
if (bbox.run()==K_ESC)
else
{
if (err == _iskeyerr)
mess << "Il codice articolo ''" << cod << "'' non e' valido";
else
if (err == _iskeynotfound)
mess << "Il record di anagrafica\ndell'articolo ''"<< cod << "'' non esiste.";
else
mess << "Non riesco ad accedere al\nrecord di anagrafica dell'articolo ''"<< cod << "'' - errore " << err << ".";
TTimed_skipbox bbox((const char *)mess,10);
bbox.run();
return FALSE;
} while (TRUE);
return FALSE;
}
}
return TRUE;
}
real TArticolo::convert_to_um(const real& v, const char * to_um, const char * from_um)

View File

@ -553,8 +553,6 @@ int TMov_mag::update_balances()
}
curr_art.unlock();
}
else
updated_bal=FALSE;
curr_key=(TToken_string *)keys_to_add.succ_item();
}
// togli i saldi vecchi
@ -573,8 +571,6 @@ int TMov_mag::update_balances()
}
curr_art.unlock();
}
else
updated_bal=FALSE;
curr_key=(TToken_string *)keys_to_remove.succ_item();
}
mark_current_lines();
@ -760,8 +756,6 @@ bool rebuild_balances(const TString& annoes,
articolo.riporta_saldi(pred_es, annoes, tipo_valorizz, catven, codlis);
articolo.unlock();
}
else
ok=FALSE;
}
}

View File

@ -3233,7 +3233,7 @@ void TMatResPlanning::main_loop()
open_files(LF_TABCOM, LF_TAB, LF_DOC, LF_RIGHEDOC, 0);
open_files(LF_CLIFO, LF_CFVEN, LF_OCCAS, LF_INDSP,LF_CONDV, 0);
open_files(LF_ANAMAG, LF_DIST, LF_RDIST, 0);
open_files(LF_MAG, 0);
open_files(LF_MAG, LF_STOMAG, LF_DESLIN, LF_CODCORR, 0);
_mask = new TMatResMask;
TConfig prassid(CONFIG_DITTA, "ve"); // apre il file di configurazione della ditta corrente

9
ve/batbmre.h Executable file
View File

@ -0,0 +1,9 @@
#define F_GRUPPO 101
#define F_CONTO 102
#define F_SOTTO 103
#define F_DESCRCONTO 104
#define F_TIPOC 105
#define F_GRUPPOC 106
#define F_CONTOC 107
#define F_SOTTOC 108
#define F_DESCRCONTOC 109

158
ve/batbmre.uml Executable file
View File

@ -0,0 +1,158 @@
#include "batbmre.h"
TOOLBAR "" 0 20 60 2
#include <toolbar.h>
ENDPAGE
PAGE "Corrispondenza per fatture da emettere/ricevere" 11 60 14
GROUPBOX DLG_NULL 75 7
BEGIN
PROMPT 1 0 ""
FLAGS "R"
END
STRING F_GRUPPO 3
BEGIN
PROMPT 2 3 "Conto origine "
FIELD CODTAB[1,3]
USE MRE
JOIN LF_PCON INTO GRUPPO==CODTAB[1,3] CONTO==CODTAB[4,6] SOTTOCONTO==CODTAB[7,12]
INPUT CODTAB[1,3] F_GRUPPO
INPUT CODTAB[4,6] F_CONTO
INPUT CODTAB[7,12] F_SOTTO
DISPLAY "Gruppo" CODTAB[1,3]
DISPLAY "Conto" CODTAB[4,6]
DISPLAY "Sottoconto" CODTAB[7,12]
DISPLAY "Descrizione@50" LF_PCON->DESCR
OUTPUT F_GRUPPO CODTAB[1,3]
OUTPUT F_CONTO CODTAB[4,6]
OUTPUT F_SOTTO CODTAB[7,12]
OUTPUT F_DESCRCONTO LF_PCON->DESCR
FLAGS "R_"
CHECKTYPE REQUIRED
KEY 1
END
STRING F_CONTO 3
BEGIN
PROMPT 25 3 ""
FIELD CODTAB[4,6]
USE LF_PCON
INPUT GRUPPO F_GRUPPO
INPUT CONTO F_CONTO
INPUT SOTTOCONTO F_SOTTO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPO GRUPPO
OUTPUT F_CONTO CONTO
OUTPUT F_SOTTO SOTTOCONTO
OUTPUT F_DESCRCONTO DESCR
KEY 1
CHECKTYPE SEARCH
FLAGS "R_"
ADD RUN CG0 -0
END
STRING F_SOTTO 6
BEGIN
PROMPT 35 3 ""
FIELD CODTAB[7,12]
COPY ALL F_CONTO
KEY 1
CHECKTYPE SEARCH
FLAGS "R_"
ADD RUN CG0 -0
END
STRING F_DESCRCONTO 50
BEGIN
PROMPT 17 5 ""
FLAG "U"
USE LF_PCON KEY 2
INPUT DESCR F_DESCRCONTO
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT F_CONTO
WARNING "Conto assente"
KEY 1
ADD RUN CG0 -0
END
LIST F_TIPOC 1 13
BEGIN
PROMPT 1 9 "Tipo conto "
FIELD S6
GROUP 1 3
HELP "Tipo dei sottoconti (Normale o clienti/fornitori)"
ITEM " |Normali" MESSAGE ENABLE,F_SOTTOC
ITEM "C|Clienti" MESSAGE CLEAR,F_SOTTOC
ITEM "F|Fornitori" MESSAGE CLEAR,F_SOTTOC
END
NUMBER F_GRUPPOC 3
BEGIN
PROMPT 2 11 "Conto destinaz."
FIELD I0
USE LF_PCON SELECT (CONTO=="") && (SOTTOCONTO=="")
INPUT GRUPPO F_GRUPPOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPOC GRUPPO
CHECKTYPE SEARCH
WARNING "Gruppo assente"
ADD RUN CG0 -0
END
NUMBER F_CONTOC 3
BEGIN
PROMPT 25 11 ""
FIELD I1
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO=="")
COPY INPUT F_GRUPPOC
INPUT CONTO F_CONTOC
COPY DISPLAY F_CONTO
COPY OUTPUT F_GRUPPOC
OUTPUT F_CONTOC CONTO
OUTPUT F_TIPOC TMCF
OUTPUT F_DESCRCONTOC DESCR
CHECKTYPE SEARCH
WARNING "Conto assente"
ADD RUN CG0 -0
END
NUMBER F_SOTTOC 6
BEGIN
PROMPT 35 11 ""
FIELD I2
USE LF_PCON
COPY INPUT F_CONTOC
INPUT SOTTOCONTO F_SOTTOC
COPY DISPLAY F_CONTOC
COPY OUTPUT F_GRUPPOC
OUTPUT F_CONTOC CONTO
OUTPUT F_SOTTOC SOTTOCONTO
OUTPUT F_DESCRCONTOC DESCR
CHECKTYPE NORMAL
WARNING "Sottoconto assente"
ADD RUN CG0 -0
END
STRING F_DESCRCONTOC 50
BEGIN
PROMPT 17 13 ""
FLAG "U"
USE LF_PCON KEY 2
JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
INPUT DESCR F_DESCRCONTOC
COPY DISPLAY F_DESCRCONTO
COPY OUTPUT F_SOTTOC
WARNING "Conto assente"
ADD RUN CG0 -0
END
ENDMASK

View File

@ -32,3 +32,4 @@
#define F_NUMPROVV 230
#define F_NUMAUTO 231
#define F_ULTDATAPROV 232
#define F_EMRI 233

View File

@ -89,9 +89,13 @@ PAGE "Tipi documento validi" -1 -1 60 14
PROMPT 2 2 "Tipo dei documenti "
FIELD I1
ITEM "|Altro"
MESSAGE CLEAR,F_EMRI
ITEM "1|Bolla"
MESSAGE CLEAR,F_EMRI
ITEM "2|Fattura"
MESSAGE ENABLE,F_EMRI
ITEM "3|Ordine"
MESSAGE CLEAR,F_EMRI
END
STRING F_TIPODOC1 4
@ -364,4 +368,10 @@ PAGE "Tipi documento validi" -1 -1 60 14
CHECKTYPE NORMAL
END
BOOLEAN F_EMRI
BEGIN
PROMPT 2 17 "Fatture da emettere/ricevere"
FIELD B3
END
ENDMASK

View File

@ -25,6 +25,8 @@
#define F_NOTACREDDEB 125
#define F_LORDO 126
#define F_FATCOM 127
#define F_PSTAMPA2 130
#define F_NCOPIE2 131
#define F_STATOF_INS 150
#define F_STATOF_ST 151

View File

@ -8,7 +8,7 @@ ENDPAGE
PAGE "Tipi documento" -1 -1 60 14
GROUPBOX DLG_NULL 75 4
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 0 ""
FLAG "R"
@ -16,7 +16,7 @@ END
STRING F_CODTAB 4
BEGIN
PROMPT 2 1 "Codice "
PROMPT 2 1 "Codice "
FIELD CODTAB
USE %TIP
CHECKTYPE REQUIRED
@ -31,7 +31,7 @@ END
STRING F_DESNUM 50
BEGIN
PROMPT 2 2 "Descrizione "
PROMPT 23 1 ""
FIELD S0
HELP "Descrizione tipo documento"
USE %TIP KEY 2
@ -45,36 +45,14 @@ END
STRING F_RIFERIMENTO 50
BEGIN
PROMPT 2 4 "Riferimento "
PROMPT 2 3 "Riferimento "
FIELD S1
CHECKTYPE NORMAL
END
STRING F_PROFILO 8
BEGIN
PROMPT 2 5 "Profilo documento "
FIELD S4
CHECKTYPE REQUIRED
END
STRING F_PSTAMPA 8
BEGIN
PROMPT 44 5 "Profilo stampa documento "
FIELD S5
CHECKTYPE REQUIRED
END
NUMBER F_NCOPIE 3
BEGIN
PROMPT 2 6 "Numero di copie "
FIELD I0
NUM_EXPR {(#THIS_FIELD >= 0)}
WARNING "Il numero di copie deve essere positivo"
END
LIST F_TIPO 24
BEGIN
PROMPT 32 6 "Tipo del documento "
PROMPT 2 4 "Tipo documento "
FIELD I1
ITEM "0|Altro" MESSAGE ENABLE,2@
ITEM "1|Bolla" MESSAGE CLEAR,2@
@ -82,9 +60,50 @@ BEGIN
ITEM "3|Ordine" MESSAGE CLEAR,2@
END
STRING F_PROFILO 8
BEGIN
PROMPT 2 5 "Profilo documento "
FIELD S4
CHECKTYPE REQUIRED
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 6 "@bProfili di stampa"
END
STRING F_PSTAMPA 8
BEGIN
PROMPT 2 7 "Profilo stampa principale "
FIELD S5[1,8]
CHECKTYPE REQUIRED
END
NUMBER F_NCOPIE 3
BEGIN
PROMPT 42 7 "Numero di copie "
FIELD I0
FLAGS "U"
WARNING "Il numero di copie deve essere positivo"
END
STRING F_PSTAMPA2 8
BEGIN
PROMPT 2 8 "Profilo stampa aggiuntivo "
FIELD S5[9,16]
END
NUMBER F_NCOPIE2 3
BEGIN
PROMPT 42 8 "Numero di copie "
FIELD I2
FLAGS "U"
WARNING "Il numero di copie deve essere positivo"
END
STRING F_CODCAUS 3
BEGIN
PROMPT 2 7 "Codice causale contabile "
PROMPT 2 10 "Causale contabile "
FIELD S6
USE LF_CAUSALI
INPUT CODCAUS F_CODCAUS
@ -99,7 +118,7 @@ END
STRING F_DESCAUS 50
BEGIN
PROMPT 2 8 "Descrizione "
PROMPT 26 10 ""
USE LF_CAUSALI KEY 2
INPUT DESCR F_DESCAUS
DISPLAY "Descrizione@50" DESCR
@ -112,7 +131,7 @@ END
STRING F_CODCAUSANT 3
BEGIN
PROMPT 2 9 "Codice causale anticipo "
PROMPT 2 11 "Causale anticipo "
FIELD S10
USE LF_CAUSALI SELECT REG ==""
INPUT CODCAUS F_CODCAUSANT
@ -127,7 +146,7 @@ END
STRING F_DESCAUSANT 50
BEGIN
PROMPT 2 10 "Descrizione "
PROMPT 26 11 ""
USE LF_CAUSALI KEY 2
INPUT DESCR F_DESCAUSANT
DISPLAY "Descrizione@50" DESCR
@ -140,13 +159,13 @@ END
BOOLEAN F_NOTACREDDEB
BEGIN
PROMPT 2 11 "Nota di credito/debito"
PROMPT 2 12 "Nota di credito/debito"
FIELD B7
END
BOOLEAN F_LORDO
BEGIN
PROMPT 40 11 "Calcolo importi al lordo"
PROMPT 40 12 "Calcolo importi al lordo"
FIELD B8
MESSAGE TRUE CLEAR,F_FATCOM
MESSAGE FALSE ENABLE,F_FATCOM
@ -154,19 +173,19 @@ END
BOOLEAN F_SPESEAUT
BEGIN
PROMPT 2 12 "Addebito automatico spese cliente"
PROMPT 2 13 "Addebito automatico spese cliente"
FIELD B0
END
BOOLEAN F_FATCOM
BEGIN
PROMPT 40 12 "Calcolo fattura commerciale"
PROMPT 40 13 "Calcolo fattura commerciale"
FIELD B9
END
BOOLEAN F_MOVMAG
BEGIN
PROMPT 2 13 "Mov. di mag. a partire dallo stato "
PROMPT 2 14 "Mov. mag. a partire dallo stato "
FIELD B1
MESSAGE FALSE CLEAR,1@
MESSAGE TRUE ENABLE,1@
@ -176,7 +195,7 @@ END
STRING F_STATO_MOV_I 1
BEGIN
PROMPT 40 13 ""
PROMPT 38 14 ""
FIELD S7
USE %STD
INPUT CODTAB F_STATO_MOV_I
@ -191,7 +210,7 @@ END
STRING F_STATO_MOV_F 1
BEGIN
PROMPT 42 13 "allo stato "
PROMPT 42 14 "allo stato "
FIELD S8
COPY USE F_STATO_MOV_I
INPUT CODTAB F_STATO_MOV_F
@ -206,14 +225,14 @@ END
BOOLEAN F_SCARES
BEGIN
PROMPT 58 13 "Scarica il residuo"
PROMPT 58 14 "Scarica il residuo"
FIELD B4
GROUP 1
END
STRING F_CAUS_MAG 5
BEGIN
PROMPT 2 14 "Codice causale magazzino "
PROMPT 2 15 "Causale magazzino "
FIELD S9
USE %CAU
INPUT CODTAB F_CAUS_MAG
@ -227,9 +246,9 @@ BEGIN
GROUP 1
END
STRING F_DESCAUS_MAG 50
STRING F_DESCAUS_MAG 50 48
BEGIN
PROMPT 2 15 "Descrizione "
PROMPT 28 15 ""
USE %CAU KEY 2
INPUT S0 F_DESCAUS_MAG
DISPLAY "Descrizione@50" S0
@ -1176,4 +1195,3 @@ END
ENDPAGE
ENDMASK

View File

@ -284,7 +284,7 @@ void TMotore_application::on_firm_change()
bool TMotore_application::user_create( )
{
open_files(LF_DOC, LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, LF_SCONTI, LF_UMART, LF_DESLIN, LF_CODCORR,
LF_TAB, LF_TABCOM, LF_CLIFO, LF_CFVEN, LF_INDSP, LF_OCCAS, LF_PCON, LF_MOV,
LF_TAB, LF_TABCOM, LF_CLIFO, LF_CFVEN, LF_INDSP, LF_OCCAS, LF_PCON, LF_MOV, LF_STOMAG,
LF_MOVMAG, LF_RMOVMAG, LF_MAG, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_ATTIV, LF_CAUSALI, 0);
@ -470,7 +470,7 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
f.insert(-1, FALSE);
// Aggiunge la riga allo sheet
const bool checked = rec.get_bool(RDOC_CHECKED);
rec.autoload(f);
f.check_row(f.items()-1, 0x2);

View File

@ -134,31 +134,32 @@ public:
void print_documento();
bool valid() { return _valid; }
bool doc_arrange();
int ncopie() { return _doc->tipo().ncopie(); }
const TString &get_module_code() { return _module; } // ritorna il codice del modulo di carta
TString_array & exclude_list_t() { return _exclude_array_t; }
TString_array & exclude_list_a() { return _exclude_array_a; }
int ncopie() const { return _doc->tipo().ncopie(); }
const TString &get_module_code() const { return _module; } // ritorna il codice del modulo di carta
TString_array& exclude_list_t() { return _exclude_array_t; }
TString_array& exclude_list_a() { return _exclude_array_a; }
TDocumentoEsteso& doc() { return *_doc; }
TDocumento_form(TRectype&/*TDocumentoEsteso **/ doc, TRelation& rel, const bool definitiva, const bool interattivo);
TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, bool interattivo, bool aggiuntivo);
TDocumento_form(const char* form, TRelation& rel);
virtual ~TDocumento_form();
};
TDocumento_form* TDocumento_form::_form = NULL;
TDocumento_form::TDocumento_form(TRectype&/*TDocumentoEsteso**/ doc, TRelation& rel, const bool definitiva, const bool interattivo): TForm(), _firmrel(rel), _valid(FALSE), _sorted_cur(NULL)
TDocumento_form::TDocumento_form(TRectype& doc, TRelation& rel, bool definitiva, bool interattivo, bool aggiuntivo)
: _firmrel(rel), _valid(FALSE), _sorted_cur(NULL)
{
_form = this;
TString codnum(doc.get(DOC_CODNUM));
TString numdoc(doc.get(DOC_NDOC));
TString tipodoc(doc.get(DOC_TIPODOC));
//const TString codnum(doc.get(DOC_CODNUM));
//const TString numdoc(doc.get(DOC_NDOC));
const TString8 tipodoc(doc.get(DOC_TIPODOC));
TString nomeform;
const TRectype rec = cache().get("%TIP", tipodoc);
if (!rec.empty())
{ // se non ci sono errori procede con la stampa
nomeform= rec.get("S5"); // legge il nome del form di stampa
nomeform= aggiuntivo ? rec.get("S5").mid(8) : rec.get("S5").left(8); // legge il nome del form di stampa
TFilename test(nomeform); test.ext("frm");
if (!test.exist())
{
@ -316,8 +317,8 @@ void TDocumento_form::print_documento()
_rdocfile->set_row(r);
cursor()->next_match(LF_RIGHEDOC);
if (!print_on_body(r)) continue;
if (!print_on_body(r))
continue;
if (sect)
{
sect->update();
@ -541,7 +542,8 @@ bool TDocumento_form::print_on_body(int r)
void TDocumento_form::extended_parse_general(TScanner &scanner)
{
// se viene riconosciuto il token per l'impostazione del modulo legge il codice...
if (scanner.key() == "MO") _module= scanner.string();
if (scanner.key() == "MO")
_module= scanner.string();
// Legge i decimali necessari per gli arrotondamenti (il primo per gli importi in lire, l'altro per quelli in valuta)
// if (scanner.key() == "PR")
@ -1176,7 +1178,6 @@ class TStampaDoc_application: public TSkeleton_application
bool _is_lista; // flga che indica se e' stata selezionata la lista documenti
bool _definitiva; // flag che indica se la stampa è definitiva o no
TRelation *_firmrel; // puntatore alla relazione che gestisce i dati della ditta corrente
TDocumento_form *_form; // puntatore al form di stampa
TMask * _selection_mask;
TRelation* _clifo_rel;
@ -1192,7 +1193,7 @@ protected:
virtual void on_firm_change(void);
virtual behaviour on_module_change(const TString &, TString &); // funzione chiamata ad ogni cambio modulo durante la stampa
virtual bool query_final_print(void); // funzione chiamata all'inizializzazione per sapere se la stampa è definitiva
void set_filter();
void set_filter(TDocumento_form& frm);
static bool date2num_handler(TMask_field& f, KEY key);
static bool range_handler(TMask_field& f, KEY key);
static bool tipocf_handler (TMask_field& f, KEY k);
@ -1208,8 +1209,7 @@ protected:
void build_clifo_list(const char c='C');
public:
TDocumento_form& form() { return *_form; }
void print_documento();
void print_documento(TDocumento_form& frm);
void print_selected();
TStampaDoc_application() : _key(BY_NUM_KEY) {};
virtual ~TStampaDoc_application() {};
@ -1293,15 +1293,17 @@ void TStampaDoc_application::print_selected()
cur = i; // Posiziona il documento
if (_definitiva && !((TDocumento &) cur.curr()).stampabile())
continue;
_form = new TDocumento_form(cur.curr()/*documento*/, *_firmrel, _definitiva, _interattivo); // Istanzia il form
if (!_form->valid()) break; // interrompe la stampa se il doc corrente non e' tra i tipi validi
const TString &modulo= _form->get_module_code(); // legge dal form il codice del modulo di carta per la stampa
// Istanzia il form principale
TDocumento_form* mainform = new TDocumento_form(cur.curr(), *_firmrel, _definitiva, _interattivo, FALSE);
if (!mainform->valid()) break; // interrompe la stampa se il doc corrente non e' tra i tipi validi
const TString &modulo= mainform->get_module_code(); // legge dal form il codice del modulo di carta per la stampa
if (modulo_prec.empty()) modulo_prec = modulo; // se siamo al primo passaggio la variabile di modulo precedente viene riempita
else first_inst = FALSE;
const bool module_changed = modulo != modulo_prec;
if (first_inst || module_changed)
if (!_form->doc_arrange()) // Setta l'offset o posiziona manualmente
if (!mainform->doc_arrange()) // Setta l'offset o posiziona manualmente
break; // Se vi sono errori interrompe la stampa
if (module_changed) whattodo = on_module_change(modulo, modulo_prec); // se il modulo è cambiato dalla stampa precedente interroga la funzione per sapere che comportamento tenere
if (whattodo==cancel) break; // se non si può procedere la stampa viene interrotta
@ -1310,20 +1312,36 @@ void TStampaDoc_application::print_selected()
// altrimenti prosegue
// Carica il numero di copie da stampare per questo form
int ncopie = _ncopie <= 0 ? _form->ncopie() : _ncopie; // Numero di copie da stampare per questo documento
int ncopie = _ncopie <= 0 ? mainform->ncopie() : _ncopie; // Numero di copie da stampare per questo documento
if (ncopie <= 0) ncopie = 1;
for (int n=0; n < ncopie; n++)
{
print_documento();
_form->doc().summary_reset();
_form->doc().scadenze_reset();
TDocumentoEsteso& extdoc = mainform->doc();
print_documento(*mainform);
extdoc.summary_reset();
extdoc.scadenze_reset();
// Stampa eventuali documenti allegati
TFilename formagg = extdoc.tipo().get("S5").mid(8);
const int ncopie2 = extdoc.tipo().get_int("I2");
if (formagg.not_empty() && ncopie2 > 0) // Se esiste un tipo documento da accodare
{
TDocumento_form* secform = new TDocumento_form(cur.curr(), *_firmrel, _definitiva, _interattivo, TRUE);
for (int i = 0; i < ncopie2; i++)
{
print_documento(*secform);
extdoc.summary_reset();
extdoc.scadenze_reset();
}
delete secform;
}
}
// se la stampa è definitiva viene lanciata la procedura di rinumerazione
if (_definitiva && _interattivo)
{
if (numerazione_definitiva(_form->doc()) != NOERR)
if (numerazione_definitiva(mainform->doc()) != NOERR)
{
error_box("Non è possibile completare la procedura di numerazione definitiva dei documenti. Errore %d", doc.status());
break;
@ -1331,22 +1349,22 @@ void TStampaDoc_application::print_selected()
}
// Totalizza gli importi per eventuale stampa su FAKETOTFLD
totdocumenti += _form->doc().totale_doc();
if (i == items - 1 && _form->is_faketotfld())
totdocumenti += mainform->doc().totale_doc();
if (i == items - 1 && mainform->is_faketotfld())
{
_form->hide_sections();
TForm_item& fk = _form->find_field('F', last_page, FAKETOTFLD);
mainform->hide_sections();
TForm_item& fk = mainform->find_field('F', last_page, FAKETOTFLD);
fk.show();
fk.set(totdocumenti.string());
print_documento();
print_documento(*mainform);
}
delete _form;
delete mainform;
}
}
else // Lista documenti
{
_form = new TDocumento_form(LISTADOC,*_firmrel);
TDocumento_form* mainform = new TDocumento_form(LISTADOC,*_firmrel);
const int hh = 6;
const int fl = printer().formlen();
int rows[4];
@ -1354,32 +1372,30 @@ void TStampaDoc_application::print_selected()
rows[1] = hh;
rows[2] = fl;
rows[3] = 0;
_form->cursor()->setkey(_key);
mainform->cursor()->setkey(_key);
darec.put(DOC_DATADOC, _dadata);
darec.put(DOC_PROVV, _provv);
darec.put(DOC_ANNO, _anno);
arec = darec;
arec.put(DOC_DATADOC, _adata);
_form->cursor()->setregion(darec,arec);
mainform->cursor()->setregion(darec,arec);
const bool dettaglio = _selection_mask->get_bool(F_DETTAGLIO);
_form->find_field('B', odd_page, "H_RIGHE").enable(dettaglio); // Visualizza i dettagli righe se richiesto
_form->find_field('B', odd_page, "RIGHE").enable(dettaglio);
mainform->find_field('B', odd_page, "H_RIGHE").enable(dettaglio); // Visualizza i dettagli righe se richiesto
mainform->find_field('B', odd_page, "RIGHE").enable(dettaglio);
set_filter();
if (_form->cursor()->items())
_form->print();
delete _form;
set_filter(*mainform);
if (mainform->cursor()->items())
mainform->print();
delete mainform;
}
if (pi != NULL) delete pi;
printer().close();
}
void TStampaDoc_application::print_documento()
void TStampaDoc_application::print_documento(TDocumento_form& f)
{
CHECK(_form,"Nessun form istanziato!");
TDocumento_form& f = form();
TLocalisamfile& doc = f.cursor()->file();
const bool is_vis = printer().printtype() == screenvis;
if (!is_vis)
@ -1429,9 +1445,9 @@ bool TStampaDoc_application::query_final_print()
} else return _definitiva; // altrimenti ritorna il valore letto dalla linea di comando
}
void TStampaDoc_application::set_filter()
void TStampaDoc_application::set_filter(TDocumento_form& frm)
{
TCursor* cur = _form->cursor();
TCursor* cur = frm.cursor();
TString filtro,e1,e2,sw;
// Compone la lista dei clienti/forntitori selezionati
@ -1451,12 +1467,12 @@ void TStampaDoc_application::set_filter()
const TString16 val = _selection_mask->get(F_VALUTA);
const int ndec = TCurrency::get_firm_dec();
_form->edit_picture(_form->find_field('F',last_page, 6), ndec); // pictures per totali finali
_form->edit_picture(_form->find_field('F',last_page, 8), ndec);
_form->edit_picture(_form->find_field('F',last_page, 10), ndec);
_form->edit_picture(_form->find_field('F',last_page, 12), ndec);
_form->edit_picture(_form->find_field('F',last_page, 16), ndec);
_form->edit_picture(_form->find_field('F',last_page, 17), ndec);
frm.edit_picture(frm.find_field('F',last_page, 6), ndec); // pictures per totali finali
frm.edit_picture(frm.find_field('F',last_page, 8), ndec);
frm.edit_picture(frm.find_field('F',last_page, 10), ndec);
frm.edit_picture(frm.find_field('F',last_page, 12), ndec);
frm.edit_picture(frm.find_field('F',last_page, 16), ndec);
frm.edit_picture(frm.find_field('F',last_page, 17), ndec);
if (selval == 1) //In Lire
{
const TString16 firm_val(TCurrency::get_firm_val());
@ -1473,7 +1489,7 @@ void TStampaDoc_application::set_filter()
if (selval == 2) // nella valuta specificata
filtro << "&&(CODVAL==\"" << val << "\")";
else
_form->find_field('B',odd_page,35).set("1"); // Cosi' effettua i totali generali in lire ?????
frm.find_field('B',odd_page,35).set("1"); // Cosi' effettua i totali generali in lire ?????
// Compone l'espressione filtro...
// prende tutte le righe dello spreasheet che non sono totalmente vuote:

View File

@ -1133,7 +1133,7 @@ END
STRING F_ANNO 4
BEGIN
PROMPT 2 4 "Seleziona l'esercizio "
FLAGS "UP"
FLAGS "UPZ"
USE ESC
INPUT CODTAB F_ANNO
DISPLAY "Codice@10" CODTAB
@ -1147,7 +1147,7 @@ END
STRING F_ANNORIF 4 // anno usato per il write dell'annata precedente
BEGIN
PROMPT 36 4 "Giacenze dell'esercizio "
FLAGS "DP"
FLAGS "DPZ"
END
STRING F_UMPRINCIPALE 2
@ -1235,7 +1235,8 @@ END
STRING F_STOANNO 4
BEGIN
PROMPT 2 4 "Seleziona l'esercizio "
FLAGS "U"
FLAGS "UZ"
USE ESC
INPUT CODTAB F_STOANNO
DISPLAY "Codice@10" CODTAB
@ -1249,7 +1250,7 @@ END
STRING F_STOANNORIF 4 // anno usato per il write dell'annata precedente
BEGIN
PROMPT 2 6 "Composizione rimanenze iniziali del "
FLAGS "DP"
FLAGS "DPZ"
END
STRING F_UMPRINCIPALE2 2
@ -1348,4 +1349,3 @@ ENDMASK
#include "ve2400d.uml"
#include "ve2400e.uml"

View File

@ -59,7 +59,7 @@ BEGIN
DISPLAY "D. Fine@15" D1
OUTPUT F_STOANNOES CODTAB
CHECKTYPE REQUIRED
PICTURE "9999"
PICTURE "ZZZZ"
ADD RUN cg0 -5 ESC
END

View File

@ -196,7 +196,7 @@ void TDeletedoc_app::backup_delete_doc(int op, int who, bool pack_rows)
const char provv = id.get_char();
const int anno = id.get_int();
const TString16 codnum = id.get();
const long numdoc = id.get_int();
const long numdoc = id.get_long();
documento.read(provv,anno,codnum,numdoc);
documento.TMultiple_rectype::remove(doc);
pi.addstatus(1);
@ -211,7 +211,7 @@ void TDeletedoc_app::backup_delete_doc(int op, int who, bool pack_rows)
const char provv = id.get_char();
const int anno = id.get_int();
const TString16 codnum = id.get();
const long numdoc = id.get_int();
const long numdoc = id.get_long();
documento.read(provv,anno,codnum,numdoc);
const int rows = documento.physical_rows();
// Memorizza le righe del documento sui file temporanei
@ -222,6 +222,7 @@ void TDeletedoc_app::backup_delete_doc(int op, int who, bool pack_rows)
pi1.addstatus(1);
}
}
}
}
}
@ -359,4 +360,3 @@ int ve5100(int argc, char* argv[])
a.run(argc, argv, "Eliminazione documenti");
return 0;
}

View File

@ -62,7 +62,8 @@ void TStatus_change::main_loop()
rel.lfile().set_curr(doc);
cur.freeze();
for (cur = 0; cur.pos() < total && !pi.iscancelled(); ++cur)
{
{
const real t = doc->totale_doc();
pi.addstatus(1);
doc->put(DOC_STATO, finale);
doc->rewrite();

View File

@ -156,7 +156,9 @@ bool TCopydoc_mask::on_field_event(TOperable_field& o, TField_event e, long joll
///////////////////////////////////////////////////////////
class TCopydoc_app : public TSkeleton_application
{
{
bool _preserve_num;
protected:
bool replace(TRectype& rec, const char* field, const TString& oldstr, const TString& newstr) const;
@ -203,7 +205,8 @@ void TCopydoc_app::main_loop()
rec_from.put(DOC_ANNO, m.get(F_FROM_ANNO));
rec_from.put(DOC_CODNUM, m.get(F_FROM_NUM));
rec_from.put(DOC_PROVV, m.get(F_FROM_PROVV));
rec_from.put(DOC_NDOC, m.get(F_FROM_FRNDOC));
rec_from.put(DOC_NDOC, m.get(F_FROM_FRNDOC));
_preserve_num = m.get_bool(F_PRESERVE_NUM);
TRectype rec_to(rec_from);
rec_to.put(DOC_NDOC, m.get(F_FROM_TONDOC));
@ -250,8 +253,14 @@ void TCopydoc_app::main_loop()
// Rinumera documento principale
newdoc.put(DOC_PROVV, provv);
newdoc.put(DOC_ANNO, anno);
newdoc.put(DOC_CODNUM, codnum);
newdoc.put(DOC_NDOC, ndoc++);
newdoc.put(DOC_CODNUM, codnum);
if (_preserve_num)
{
const long ndoc_src = olddoc.get_long(DOC_NDOC);
newdoc.put(DOC_NDOC, ndoc_src);
}
else
newdoc.put(DOC_NDOC, ndoc++);
newdoc.copy_contents(olddoc);
newdoc.put(DOC_DATADOC, data);

View File

@ -1,20 +1,21 @@
#define F_FROM_ANNO 201
#define F_FROM_NUM 202
#define F_FROM_PROVV 203
#define F_FROM_DES 204
#define F_TIPI_DOC 205
#define F_FROM_FRNDOC 206
#define F_FROM_TONDOC 207
#define F_OLD_STR 208
#define F_NEW_STR 209
#define F_PERC 210
#define F_FROM_ANNO 201
#define F_FROM_NUM 202
#define F_FROM_PROVV 203
#define F_FROM_DES 204
#define F_TIPI_DOC 205
#define F_FROM_FRNDOC 206
#define F_FROM_TONDOC 207
#define F_OLD_STR 208
#define F_NEW_STR 209
#define F_PERC 210
#define F_PRESERVE_NUM 211
#define F_TO_DATA 301
#define F_TO_NUM 302
#define F_TO_PROVV 303
#define F_TO_DES 304
#define F_TO_NDOC 305
#define F_TO_DATA 301
#define F_TO_NUM 302
#define F_TO_PROVV 303
#define F_TO_DES 304
#define F_TO_NDOC 305
#define F_TIPO_SEL 101
#define F_TIPO_DOC 102
#define F_TIPO_DES 103
#define F_TIPO_SEL 101
#define F_TIPO_DOC 102
#define F_TIPO_DES 103

View File

@ -153,6 +153,11 @@ BEGIN
PROMPT 2 10 "Percentuale di aumento dei prezzi "
END
BOOLEAN F_PRESERVE_NUM
BEGIN
PROMPT 47 10 "Conserva numero originale"
END
SPREADSHEET F_TIPI_DOC 76
BEGIN
PROMPT 1 12 ""

View File

@ -355,6 +355,7 @@ public:
const bool num_provv() const { return get_bool("B0"); }
const bool auto_num() const { return get_bool("B1"); }
const bool dont_test_datadoc() const { return get_bool("B2"); }
const bool fattura_emettere_ricevere() const { return get_bool("B3"); }
const TString & tipo_doc(int i) const { CHECK(i < MAX_TIPI_DOC, "Impossibbile tipo documento"); return ((TString& ) get("S2").mid(i << 2, 4)).trim();}
int ntipi_doc() const {const int l = get("S2").len(); return l ? (((l - 1) >> 2) + 1) : 0;}
@ -684,6 +685,7 @@ public:
bool tipo_valido() const { return get("TIPODOC").not_empty(); }
static const TTipo_documento& tipo(const char * tipodoc);
const TTipo_documento& tipo() const;
static const TCodice_numerazione& codice_numerazione(const char * numerazione);
const TCodice_numerazione& codice_numerazione() const;
void set_tipo(const char * tipo) { head().put("TIPODOC", tipo);}
bool provvisorio() const { return get_char("PROVV") == 'P'; }
@ -796,6 +798,7 @@ protected:
static bool codcont_handler( TMask_field& f, KEY key );
static bool codcamp_handler( TMask_field& f, KEY key );
// static bool controeuro_handler( TMask_field& f, KEY key );
static bool datacambio_handler( TMask_field& f, KEY key );
static bool codval_handler( TMask_field& f, KEY key );
void user_set_handler( int fieldid, int index);
@ -1047,6 +1050,7 @@ enum error_type {
ultprot_error,
datadoc_error,
caus_error,
causre_error,
cauval_error,
ivasto_error,
register_error,
@ -1135,10 +1139,12 @@ protected:
error_type get_next_reg_num(long &);
// Compila la testata del movimento
error_type compile_head_mov(TDocumento&);
// Compila la testata del movimento per le fatture da emettere / ricevere;
error_type compile_head_mov_re(TDocumento&);
// Funzione per ricercare il conto di costo/ricavo
error_type search_costo_ricavo(TBill&, const TRiga_documento&);
// Funzione per aggiungere la riga iva al TAssoc_array _righe_iva
// error_type add_iva_row(const TBill&, const TRiga_documento&, const int ndec, const real p = 1.0);
// error_type add_iva_row(const TBill&, const TRiga_documento&, const int ndec, const real p = 1.0);
// Funzione atomica per aggiungere le righe di spese d'incasso e bolli al TAssoc_array _righe_iva
void calculate_spese(real&, real&, int, bool, bool, const TString &, const TDocumento & );
// Funzione per aggiungere le righe di spese d'incasso e bolli al TAssoc_array _righe_iva (chiama calculate_spese())
@ -1153,10 +1159,14 @@ protected:
error_type create_total_doc_row(TDocumento&);
// Compila le righe del movimento
error_type compile_rows_mov(TDocumento&);
// Compila le righe del movimento per le fatture da emettere / ricevere
error_type compile_rows_mov_re(TDocumento&);
// scrive le scadenze
error_type write_scadenze(TDocumento&);
// scrive il movimento e le scadenze
virtual error_type write_all(TDocumento& doc, TMovimentoPN_VE & movimento);
// scrive il movimento e le scadenze per le fatture da emettere / ricevere
virtual error_type write_all_re(TDocumento& doc, TMovimentoPN_VE & movimento);
// restituisce la sezione per sto cliente
char sezione() const;
// Cerca il conto cliente per il movimento d'anticipo

View File

@ -882,7 +882,8 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
b.pack();
const TDate d(get("DATADOC"));
mov.put(MOVMAG_ANNOES, mov.codice_esercizio(d));
TString8 codes; codes.format("%04d", mov.codice_esercizio(d));
mov.put(MOVMAG_ANNOES, codes);
mov.put(MOVMAG_DATAREG, d);
mov.put(MOVMAG_DATACOMP, d);
mov.put(MOVMAG_DOCPROVV, get("PROVV"));
@ -1428,18 +1429,22 @@ const TTipo_documento& TDocumento::tipo() const
return tipo(tipodoc);
}
const TCodice_numerazione& TDocumento::codice_numerazione() const
const TCodice_numerazione& TDocumento::codice_numerazione(const char * numerazione)
{
const TString16 key(numerazione());
TCodice_numerazione* o = (TCodice_numerazione*)_numerazioni.objptr(key);
TCodice_numerazione* o = (TCodice_numerazione*)_numerazioni.objptr(numerazione);
if (o == NULL)
{
o = new TCodice_numerazione(key);
_numerazioni.add(key, o);
o = new TCodice_numerazione(numerazione);
_numerazioni.add(numerazione, o);
}
return *o;
}
const TCodice_numerazione& TDocumento::codice_numerazione() const
{
return codice_numerazione(numerazione());
}
bool TDocumento::raggruppabile(const TDocumento& doc, TToken_string& campi) const
{
bool ok = raggruppabile() && doc.raggruppabile();
@ -1466,7 +1471,7 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
for (const TFormula_documento* f = tipo_doc.first_formula(); f; f = tipo_doc.succ_formula())
{
TExpr_documento * exp = f->expr();
if (f->name() == tot_doc)
if (tot_doc == f->name())
{
TString16 tot_doc_netto(tot_doc);
tot_doc_netto.insert("_");
@ -1489,24 +1494,11 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
}
}
else
if (f->name() == tot_provv)
{
TString16 tot_provv_netto(tot_provv);
tot_provv_netto.insert("_");
const TFixed_string netto_def(exp->string());
TExpr_documento netto_exp(netto_def, _numexpr, this);
add_field(new TDocumento_variable_field(tot_provv_netto, netto_exp));
TExpr_documento tot_exp("TOTPROVV()", _numexpr, this);
add_field(new TDocumento_variable_field(tot_provv, ""));
if (exp)
{
exp->set_doc(this);
add_field(new TDocumento_variable_field(f->name(), *exp));
}
else
if (exp)
{
exp->set_doc(this);
add_field(new TDocumento_variable_field(f->name(), *exp));
}
}
}
}
@ -2384,4 +2376,4 @@ const TRiga_documento* TDocumento::get_row_id(long id) const
return &row;
}
return NULL;
}
}

View File

@ -79,8 +79,7 @@ const TString& TTipo_documento::riferimento(const TDocumento & doc, TString& rif
TString16 key(doc.get(DOC_TIPOCF));
key << "|" << doc.get(DOC_CODCF);
const TRectype rec = cache().get(field.file(), key);
const TRectype& rec = cache().get(field.file(), key);
rif.insert(field.read(rec), p);
}
@ -232,6 +231,9 @@ void TTipo_documento::read_formule()
add_formula_if_needed(prof, _totale, "TOTALE", "IMPONIBILI()+IMPOSTE()");
if (_totale == "TOTALE")
_totale = "TOTDOC";
_totale_netto = "_"; _totale_netto << _totale;
add_formula_if_needed(prof, _basesconto, "BASESCONTO", "SOMMA(\"IMPONIBILE()\", \"(TIPO()!='S') && (TIPO()!='C')\")");
@ -239,8 +241,25 @@ void TTipo_documento::read_formule()
add_formula_if_needed(prof, _totvalres, "TOTVALRES", "VALDOC(0)");
add_formula_if_needed(prof, _totvalore, "TOTVALORE", "VALDOC(1)");
if (provvigioni())
add_formula_if_needed(prof, _totprovv, "TOTPROVV", "SOMMA(\"PROVV()\")");
if (provvigioni())
{
TString80 campo(prof.get("TOTPROVV"));
if (campo.empty())
campo = "TOTPROVV";
const TRectype& frd = cache().get("%FRD", campo);
_totprovv = "_";
_totprovv << campo;
TString80 expr(frd.get("S1"));
if (expr.empty())
expr = "SOMMA(\"PROVV()\")";
_formule_documento.add(_totprovv, new TFormula_documento(_documento, _totprovv, expr, TRUE));
if (_formule.find(campo) < 0)
_formule.add(campo);
_formule.add(_totprovv);
_formule_documento.add(campo, new TFormula_documento(_documento, campo, "TOTPROVV()"), TRUE);
}
_totale_cont = prof.get("TOTALECONT");
_cnt_prezzi = prof.get_bool("CONTROLLO_PREZZI");

View File

@ -6,6 +6,7 @@
#include <progind.h>
#include <printer.h>
#include <viswin.h>
#include <utility.h>
#include <mov.h>
#include <rmov.h>
@ -54,6 +55,8 @@ protected:
// trasforma un real in TImporto, in base al tipo riga
TImporto real2imp(const real& r, char row_type);
// setta il record delle righe di contabilita'
int insert_cg_rec(int n, const TImporto& imp, TBill& conto, const char * codcms, const char * fascms, const char* desc, char tipo);
// setta il record delle righe di contabilita'
int set_cg_rec(int n, const TImporto& imp, TBill& conto, const char * codcms, const char * fascms, const char* desc, char tipo);
// aggiunge l'importo indicato alla n-esima riga di contabilita'
bool add_cg_rec(int n, const TImporto& imp);
@ -66,12 +69,25 @@ protected:
public:
// ricalcola le righe di contabilita' dalle righe iva presenti
// e verifica la quadratura del movimento. Ritorna TRUE se il movimento e' scrivibile
void set_caus(TCausale * c) { _caus = c;}
bool movement_ok() ;
void add_row_re(int i);
bool add_row_cp_re(int i);
void map_conto_re(TBill & c);
void destroy_iva_row(int i = -1);
int recalc_cg_rows(const TString & descr_cr, TCausale & caus);
TMovimentoPN_VE(bool valuta) : _valuta(valuta), _caus(NULL) {};
virtual ~TMovimentoPN_VE() {}
};
void TMovimentoPN_VE::destroy_iva_row(int i)
{
if (i < 0)
((TRecord_array&)iva_rows()).destroy_rows();
else
((TRecord_array&)iva_rows()).destroy_row(i+1, TRUE);
}
TImporto TMovimentoPN_VE::real2imp(const real& r, char row_type)
{
CHECK(_caus,"Orgggssbb..._caus pointer is NULL!");
@ -89,7 +105,7 @@ TImporto TMovimentoPN_VE::real2imp(const real& r, char row_type)
else
{
dare = _caus->sezione_clifo() == 'D';
if (row_type != 'T' && row_type != 'F')
if (row_type != 'T' && row_type != 'F' && row_type != 'P')
dare = !dare;
}
}
@ -210,48 +226,71 @@ int TMovimentoPN_VE::set_cg_rec(int n, const TImporto& imp, TBill& conto, const
rec.put(RMV_FASCMS,fascms);
}
rec.put(RMV_DESCR, desc);
if (tipo == 'T') // Calcolo contropartita
if (tipo != ' ')
{
TRectype& irec = iva(0);
const char t = irec.get_char(RMI_TIPOC);
const int gr = irec.get_int(RMI_GRUPPO);
const int co = irec.get_int(RMI_CONTO);
const long so = irec.get_long(RMI_SOTTOCONTO);
rec.put(RMV_TIPOCC,t);
rec.put(RMV_GRUPPOC,gr);
rec.put(RMV_CONTOC,co);
rec.put(RMV_SOTTOCONTOC,so);
}
else
{
int pos = -1;
if (tipo == 'F')
if (tipo == 'T') // Calcolo contropartita
{
pos = type2pos('D');
if (pos == -1)
pos = type2pos('N');
}
else
pos = type2pos('T');
if (pos >= 0)
{
TRectype& crec = cg(pos);
const char t = crec.get_char(RMV_TIPOC);
const int gr = crec.get_int(RMV_GRUPPO);
const int co = crec.get_int(RMV_CONTO);
const long so = crec.get_long(RMV_SOTTOCONTO);
TRectype& irec = iva(0);
const char t = irec.get_char(RMI_TIPOC);
const int gr = irec.get_int(RMI_GRUPPO);
const int co = irec.get_int(RMI_CONTO);
const long so = irec.get_long(RMI_SOTTOCONTO);
rec.put(RMV_TIPOCC,t);
rec.put(RMV_GRUPPOC,gr);
rec.put(RMV_CONTOC,co);
rec.put(RMV_SOTTOCONTOC,so);
}
else
{
int pos = -1;
if (tipo == 'F')
{
pos = type2pos('D');
if (pos == -1)
pos = type2pos('N');
}
else
pos = type2pos('T');
if (pos >= 0)
{
TRectype& crec = cg(pos);
const char t = crec.get_char(RMV_TIPOC);
const int gr = crec.get_int(RMV_GRUPPO);
const int co = crec.get_int(RMV_CONTO);
const long so = crec.get_long(RMV_SOTTOCONTO);
rec.put(RMV_TIPOCC,t);
rec.put(RMV_GRUPPOC,gr);
rec.put(RMV_CONTOC,co);
rec.put(RMV_SOTTOCONTOC,so);
}
}
}
rec.put(RMV_ROWTYPE,tipo);
return n;
}
int TMovimentoPN_VE::insert_cg_rec(int n, const TImporto& imp, TBill& conto, const char * codcms, const char * fascms,
const char* desc, char tipo)
{
if (n >= 0 && n < cg_items())
{
TRectype * row = new TRectype(LF_RMOV);
TRectype& head = lfile().curr();
const int annoes = head.get_int(MOV_ANNOES);
const long numreg = head.get_long(MOV_NUMREG);
TDate datareg(head.get_date(MOV_DATAREG));
row->put(RMV_NUMREG,numreg);
row->put(RMV_NUMRIG, n + 1);
row->put(RMV_ANNOES,annoes);
row->put(RMV_DATAREG,datareg);
((TRecord_array &) cg_rows()).insert_row(row);
}
return set_cg_rec(n, imp, conto, codcms, fascms, desc, tipo);
}
void TMovimentoPN_VE::create_row(int i, const TString & descr_cr)
{
CHECK(_caus,"Orgggssbb..._caus pointer is NULL!");
@ -290,7 +329,7 @@ void TMovimentoPN_VE::create_row(int i, const TString & descr_cr)
const int co = cur.get_int(RMI_CONTO);
const long so = cur.get_long(RMI_SOTTOCONTO);
const TString80 codcms = cur.get(RMI_CODCMS);
const TString16 fascms = cur.get(RMI_FASCMS);
const TString80 fascms = cur.get(RMI_FASCMS);
oldconto.set(gr,co,so);
if (oldconto.ok())
{
@ -323,7 +362,7 @@ void TMovimentoPN_VE::enter_row(int i, const TString & descr_cr)
const int co = cur.get_int(RMI_CONTO);
const long so = cur.get_long(RMI_SOTTOCONTO);
const TString80 codcms = cur.get(RMI_CODCMS);
const TString16 fascms = cur.get(RMI_FASCMS);
const TString80 fascms = cur.get(RMI_FASCMS);
conto.set(gr,co,so,t);
int newpos = bill2pos(conto, codcms, fascms, 'I'); // Riga in cui andra' l'imponibile
@ -378,6 +417,110 @@ void TMovimentoPN_VE::enter_row(int i, const TString & descr_cr)
}
}
void TMovimentoPN_VE::add_row_re(int i)
{
TRectype& cur = iva(i);
real oldimp = cur.get_real(RMI_IMPONIBILE);
real oldiva = cur.get_real(RMI_IMPOSTA);
const TString80 codcms = cur.get(RMI_CODCMS);
const TString80 fascms = cur.get(RMI_FASCMS);
const char tipod = detraibile(cur) ? 'D' : 'N';
TBill c;
if (tipod == 'N' && !oldiva.is_zero())
{
_caus->bill(RIGA_IVA_NON_DETRAIBILE, c);
if (c.ok())
{
int ivapos = bill2pos(c, codcms, fascms, 'I');
if (ivapos < 0)
ivapos= set_cg_rec(-1, real2imp(ZERO, 'I'), c, codcms, fascms, "", 'I');
const TImporto val(real2imp(oldiva, 'I'));
add_cg_rec(ivapos, val);
}
else
oldimp += oldiva;
}
const int gr = cur.get_int(RMI_GRUPPO);
const int co = cur.get_int(RMI_CONTO);
const long so = cur.get_long(RMI_SOTTOCONTO);
c.set(gr,co,so);
if (c.ok())
{
int poscg = bill2pos(c, codcms, fascms, ' ');
if (poscg < 0)
poscg = set_cg_rec(-1, real2imp(ZERO, 'I'), c, codcms, fascms, _caus->desc_agg(2), ' ');
TImporto val(real2imp(oldimp, 'I'));
add_cg_rec(poscg, val);
}
}
bool TMovimentoPN_VE::add_row_cp_re(int i)
{
TRectype& cur = cg(i);
bool inserted_row = FALSE;
TBill c;
const int gr = cur.get_int(RMV_GRUPPO);
const int co = cur.get_int(RMV_CONTO);
const long so = cur.get_long(RMV_SOTTOCONTO);
c.set(gr,co,so);
TBill cp;
map_conto_re(c);
if (c.ok())
{
int poscg = bill2pos(c, "", "", ' ');
if (poscg < 0)
{
poscg = insert_cg_rec(0, real2imp(ZERO, 'P'), c, "", "", _caus->desc_agg(1), ' ');
inserted_row = TRUE;
}
TImporto val(real2imp(cur.get_real(RMV_IMPORTO), 'P'));
add_cg_rec(poscg, val);
}
return inserted_row;
}
void TMovimentoPN_VE::map_conto_re(TBill& c)
{
TString key;
key.format("%3d%3d%6ld",c.gruppo(), c.conto(), c.sottoconto());
TRectype & rs = (TRectype &) cache().get("MRE", key);
if (rs.empty())
{
key.cut(6);
rs = cache().get("MRE", key);
if (rs.empty())
{
key.cut(3);
rs = cache().get("MRE", key);
}
}
if (rs.empty())
_caus->bill(1, c);
else
{
const int gr = rs.get_int("I0");
const int co = rs.get_int("I1");
const long so = rs.get_int("I2");
const char tipo = rs.get_char("S6");
c.set(gr, co, so, tipo);
}
if (c.tipo() > ' ')
c.set(c.gruppo(), c.conto(), curr().get_long(MOV_CODCF), c.tipo());
}
bool TMovimentoPN_VE::movement_ok()
{
TImporto tot_imp;
@ -423,7 +566,7 @@ int TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale & caus)
const int righe = iva_items();
TRectype& head = lfile().curr();
_caus = &caus;
set_caus(&caus);
for (int i=0; i<righe; i++)
{
create_row(i, descr_cr);
@ -574,10 +717,11 @@ error_type TIVA_array::add(const TRiga_documento & r, const TBill& conto, const
TString80 key;
const TCodiceIVA& tiva = r.iva();
TString16 cod(tiva.codice());
const char tipo = conto.tipo();
const int gr = conto.gruppo();
const int co = conto.conto();
const long so = conto.sottoconto();
TBill c(conto);
char tipo = c.tipo();
int gr = c.gruppo();
int co = c.conto();
long so = c.sottoconto();
int ord = 0;
TString80 codcms;
TString16 fascms;
@ -586,6 +730,56 @@ error_type TIVA_array::add(const TRiga_documento & r, const TBill& conto, const
real impon;
const bool sconto_lordo = t.tipo() != RIGA_SCONTI && _contsclor && _sco_perc_bill.ok();
const TRectype * rdoc = r.find_original_rdoc();
if (rdoc != NULL && rdoc->get(RDOC_PROVV).not_empty())
{
TString80 key(rdoc->get(RDOC_CODNUM ));
const TCodice_numerazione & num = TDocumento::codice_numerazione(key);
if (num.fattura_emettere_ricevere())
{
key.format("%3d%3d%6ld", gr, co, so);
TRectype & rs = (TRectype &) cache().get("MRE", key);
if (rs.empty())
{
key.cut(6);
rs = cache().get("MRE", key);
if (rs.empty())
{
key.cut(3);
rs = cache().get("MRE", key);
}
}
if (rs.empty())
{
key = rdoc->get(RDOC_PROVV);
key << '|' << rdoc->get(RDOC_ANNO);
key << '|' << rdoc->get(RDOC_CODNUM);
key << '|' << rdoc->get(RDOC_NDOC);
const TRectype & doc = cache().get(LF_DOC, key);
const TTipo_documento & td = TDocumento::tipo(doc.get(DOC_TIPODOC));
const TString16 codcau(td.causale());
TCausale caus(codcau);
caus.bill(1, c);
gr = c.gruppo();
co = c.conto();
so = c.sottoconto();
}
else
{
gr = rs.get_int("I0");
co = rs.get_int("I1");
so = rs.get_int("I2");
tipo = rs.get_char("S6");
c.set(gr, co, so, tipo);
}
if (c.tipo() > ' ')
c.set(c.gruppo(), c.conto(), _movimento->curr().get_long(MOV_CODCF), c.tipo());
}
}
if (!sconto_lordo) // Al netto dello sconto
impon = r.imponibile();
else
@ -628,7 +822,7 @@ error_type TIVA_array::add(const TRiga_documento & r, const TBill& conto, const
codcms = r.codice_commessa();
fascms = r.fase_commessa();
}
if (_caus->iva() == iva_acquisti)
if (_caus->iva() == iva_acquisti || _caus->iva() == nessuna_iva)
{
detr = t.detraibilita();
pind = t.perc_indetraibilita();
@ -667,12 +861,12 @@ error_type TIVA_array::add(const TRiga_documento & r, const TBill& conto, const
{
iva = new TRectype(LF_RMOVIVA);
iva->put(RMI_CODIVA,cod);
iva->put(RMI_TIPOCR,conto.tipo_cr());
iva->put(RMI_TIPOCR,c.tipo_cr());
iva->put(RMI_INTRA, _caus->intra());
iva->put(RMI_TIPOC, conto.tipo());
iva->put(RMI_GRUPPO, conto.gruppo());
iva->put(RMI_CONTO, conto.conto());
iva->put(RMI_SOTTOCONTO, conto.sottoconto());
iva->put(RMI_TIPOC, c.tipo());
iva->put(RMI_GRUPPO, c.gruppo());
iva->put(RMI_CONTO, c.conto());
iva->put(RMI_SOTTOCONTO, c.sottoconto());
iva->put(RMI_CODCMS, codcms);
iva->put(RMI_FASCMS, fascms);
TAssoc_array::add(key, iva, TRUE);
@ -695,12 +889,12 @@ error_type TIVA_array::add(const TRiga_documento & r, const TBill& conto, const
{
iva = new TRectype(LF_RMOVIVA);
iva->put(RMI_CODIVA,cod);
iva->put(RMI_TIPOCR,conto.tipo_cr());
iva->put(RMI_TIPOCR,c.tipo_cr());
iva->put(RMI_INTRA, _caus->intra());
iva->put(RMI_TIPOC, conto.tipo());
iva->put(RMI_GRUPPO, conto.gruppo());
iva->put(RMI_CONTO, conto.conto());
iva->put(RMI_SOTTOCONTO, conto.sottoconto());
iva->put(RMI_TIPOC, c.tipo());
iva->put(RMI_GRUPPO, c.gruppo());
iva->put(RMI_CONTO, c.conto());
iva->put(RMI_SOTTOCONTO, c.sottoconto());
iva->put(RMI_CODCMS, codcms);
iva->put(RMI_FASCMS, fascms);
iva->put(RMI_TIPODET, detr);
@ -1292,6 +1486,181 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
else
mov_rec.put(MOV_TOTDOC,totdocval.get_num());
mov_rec.put(MOV_CODCF,codcf);
// Memorizza il movimento contabile di destinazione!
doc.put(DOC_NUMREG, numreg);
// Scrive sulla testata del movimento il numero di documento originale
mov_rec.put(MOV_DPROVV, doc.get(DOC_PROVV));
mov_rec.put(MOV_DANNO, doc.get(DOC_ANNO));
mov_rec.put(MOV_DCODNUM, doc.get(DOC_CODNUM));
mov_rec.put(MOV_DNDOC, doc.get(DOC_NDOC));
return _error;
}
error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
// Compila la testata
{
TRectype& mov_rec = _movimento->curr();
const bool acquisto = doc.get_char(DOC_TIPOCF) == 'F';
// Reperisce la data documento
const TDate datadoc(doc.data());
if (!datadoc.ok())
{
_error = datadoc_error;
return _error;
}
// reperisce la data di registrazione, che e' anche la data di competenza ed
// eventualmente la data74ter se nel registro della causale vi e' scritta l'informazione
// sulle agenzie di viaggio.
// se si e' specificata la data automatica prende invece la data del documento
const TDate data_reg(_auto_data ? datadoc : _data_reg);
// reperisce il codice anno esercizio,
const int cod_es = _esc.date2esc(data_reg);
if (cod_es <= 0)
{
_error = nr_es_error;
return _error;
}
// reperisce l'ultimo numero di registrazione disponibile
long numreg = doc_contabilized(doc, FALSE);
const bool recontabilizing = numreg > 0;
if (recontabilizing)
{
const TRectype& mov = cache().get(LF_MOV, numreg);
TString msg; msg.format("*** Il movimento %ld è già stato ", numreg);
if (mov.get_bool(MOV_REGST))
{
msg << "stampato su bollato";
_viswin->add_line(msg);
return no_error;
}
if (mov.get_bool(MOV_STAMPATO))
{
msg << "stampato sul giornale";
_viswin->add_line(msg);
return no_error;
}
if (mov.get_bool(MOV_INVIATO))
{
msg << "inviato ad altra contabilità";
_viswin->add_line(msg);
return no_error;
}
msg.format("--- Il documento verrà ricontabilizzato nel movimento %ld", numreg);
_viswin->add_line(msg);
}
else
{
_error = get_next_reg_num(numreg);
if (_error != no_error)
return _error;
}
const TCodice_numerazione cod_num(doc.numerazione());
// calcola il numero documento aggiungendo l'eventuale prefisso/postfisso.
TString numdoc;
cod_num.complete_num(doc.numero(), numdoc);
if (acquisto)
{
TString16 numdocrif(doc.get(DOC_NUMDOCRIF));
if (numdocrif.not_empty())
numdoc = numdocrif;
}
if (numdoc.empty() || !cod_num.ok())
{
_error = nr_doc_error;
return _error;
}
numdoc.upper(); // Il numero documento e' uppercase!
// Istanzia la causale del documento corrente...
const TTipo_documento& tipo = doc.tipo();
const TString16 codcaus(tipo.causale());
_caus = new TCausale(codcaus, data_reg.year());
_righe_iva->set_caus(_caus);
_movimento->set_caus(_caus);
if (!_caus->ok() || _caus->iva() != nessuna_iva)
{
_error = causre_error;
return _error;
}
// per reperire il tipo documento ed il tipo movimento
// reperisce la descrizione dal tipo documento e la completa con la data documento ed il
// numero documento
TString descr; doc.riferimento(descr);
if (descr.empty()) descr = tipo.descrizione();
const TString16 rif = doc.get(DOC_NUMDOCRIF);
const bool use_rif = _caus->iva() == iva_acquisti && rif.not_empty();
if (use_rif)
{
descr << " n. " << rif;
const TString & data_rif = doc.get(DOC_DATADOCRIF);
descr << " del " << data_rif;
}
else
{
descr << " n. " << doc.numero();
descr << " del " << datadoc.string();
}
// Dati del cliente...
TString16 tipocf(doc.get(DOC_TIPOCF));
long codcf = doc.get_long(DOC_CODCF);
TString80 occas;
{
TLocalisamfile& cli_file = _clifo->lfile();
cli_file.put(CLI_TIPOCF,tipocf); cli_file.put(CLI_CODCF,codcf);
if (_clifo->read(_isequal) == NOERR) // posiziona il cliente una volta per tutte
{
if (cli_file.get_bool(CLI_OCCAS))
{
occas = doc.get(DOC_OCFPI);
TLocalisamfile ocf(LF_OCCAS);
ocf.put(OCC_CFPI,occas);
if (ocf.read() != NOERR)
{
_error = clifo_error;
return _error;
}
}
}
else
{
_error = clifo_error;
return _error;
}
}
// Mo' riempie il record della incornata (testata)
mov_rec.zero();
mov_rec.put(MOV_ANNOES,cod_es); mov_rec.put(MOV_NUMREG,numreg);
mov_rec.put(MOV_DATAREG,data_reg); mov_rec.put(MOV_DATACOMP,data_reg);
if (use_rif)
{
mov_rec.put(MOV_NUMDOC, rif);
const TString & data_rif = doc.get(DOC_DATADOCRIF);
mov_rec.put(MOV_DATADOC,data_rif);
}
else
{
mov_rec.put(MOV_DATADOC,datadoc);
mov_rec.put(MOV_NUMDOC,numdoc);
}
mov_rec.put(MOV_CODCAUS,_caus->codice());
mov_rec.put(MOV_TIPODOC,_caus->tipo_doc());
mov_rec.put(MOV_DESCR,descr);
mov_rec.put(MOV_CODCF,codcf);
// Memorizza il movimento contabile di destinazione!
doc.put(DOC_NUMREG, numreg);
// Scrive sulla testata del movimento il numero di documento originale
@ -1897,6 +2266,7 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
else
_righe_iva->add(r, conto, ALL_DECIMALS, perc);
}
r.put(RDOC_CODIVA, codiva2); //Restore
}
@ -2001,6 +2371,67 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
return _error;
}
error_type TContabilizzazione::compile_rows_mov_re(TDocumento& doc)
// Compila le righe
{
TString16 tiporiga, codiva1, codiva2;
const int rows = doc.rows();
const int ndec = doc.decimals();
_righe_iva->destroy(); // resetta l'assoc_array delle righe di iva
for (int i=1; good() && i<=rows; i++) // browse all this fucked document rows
{
TRiga_documento & r = doc[i];
tiporiga = r.get(RDOC_TIPORIGA);
_tri->put("CODTAB",tiporiga);
if (_tri->read() == NOERR) // controlla l'esistenza della riga
{
TBill conto;
const char tipo = r.tipo().tipo();
// Le righe omaggio senza addebito IVA vanno saltate
const bool riga_omaggio = r.get_bool(RDOC_ADDIVA) && tipo == 'O';
if ((tipo != 'D' && tipo != 'C') && !riga_omaggio)
{
search_costo_ricavo(conto,r); // l'errore eventuale viene settato qui dentro
if (good())
_righe_iva->add(r, conto);
}
}
else
_error = row_type_error;
}
if (good() && _righe_iva->items() == 0)
_error = no_rows_error;
// Crea le righe per le spese d'incasso e bolli
if (good())
add_spese_inbo(doc,ndec);
// Crea le righe di IVA
if (good())
create_iva_rows(doc);
// Aggiorna le righe di sconto (sconto ad importo o percentuale)
if (good())
adjust_sconto_rows(doc);
// Crea la riga di totale documento
if (good())
{
int righe = _movimento->iva_items();
for (int i=0; i<righe; i++)
_movimento->add_row_re(i);
righe = _movimento->cg_items();
int row_to_add = righe - 1;
for (int j = row_to_add; j >= 0; j--)
if (!_movimento->add_row_cp_re(row_to_add))
row_to_add--;
}
_movimento->destroy_iva_row();
return _error;
}
error_type TContabilizzazione::change_doc_status(TDocumento& doc)
// Cambia lo stato del documento
{
@ -2409,6 +2840,51 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi
return no_error;
}
error_type TContabilizzazione::write_all_re(TDocumento& doc, TMovimentoPN_VE & movimento)
// Scrive il movimento e le scadenze, gestendo la rinumerazione se il movimento e' gia presente
{
// N.B: _error non viene settato, per non stampare il messaggio di errore 2 volte.
// basta solo ritornare qualcosa di != da no_error, per evitare le operazioni successive
// a write_all
TRectype& head = movimento.curr();
long numreg = head.get_long(MOV_NUMREG);
TSaldo_agg saldo;
int err = NOERR;
const long old_numreg = doc_contabilized(doc, FALSE);
if (old_numreg > 0)
{
TMovimentoPN oldmov;
oldmov.curr().put(MOV_NUMREG, old_numreg);
if (oldmov.read() == NOERR)
aggiorna_saldi(saldo, oldmov, FALSE); // Leggo i vecchi saldi
err = movimento.rewrite();
}
else
err = movimento.write();
if (err != NOERR)
{
error_box("Errore %d scrivendo il movimento %ld.", err, numreg);
return generic_error;
}
// Aggiorno subito i saldi
aggiorna_saldi(saldo, movimento, TRUE);
if (good())
{
_total_docs++;
change_doc_status(doc);
TString msg("Generazione Movimento ");
msg << "$[b,w]" << _movimento->curr().get(MOV_NUMREG) << "$[n,w]";
msg << " del " << _movimento->curr().get(MOV_DATAREG);
_viswin->add_line(msg);
}
return no_error;
}
error_type TContabilizzazione::compile_head_anticipo(TDocumento& doc)
{
TString descr;
@ -2986,10 +3462,16 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
void TContabilizzazione::aggiorna_saldi(TSaldo_agg& saldo, TMovimentoPN& mv, bool save)
{
const TRectype& mov = mv.curr();
const TDate datareg(mov.get_date(MOV_DATAREG));
const TDate datareg = mov.get(MOV_DATAREG);
const TString8 codcaus = mov.get(MOV_CODCAUS);
tiposal tsal = normale;
if (_caus->read(mov.get(MOV_CODCAUS),datareg.year()))
if (codcaus != _caus->codice()) // Should never happen, but ...
{
const TCausale caus(codcaus, datareg.year());
tsal = caus.apertura() ? apertura : (caus.chiusura() ? chiusura : normale);
}
else
tsal = _caus->apertura() ? apertura : (_caus->chiusura() ? chiusura : normale);
if (save)
@ -3064,6 +3546,11 @@ void TContabilizzazione::display_error(TDocumento& doc)
"Verificare l'esistenza del codice causale '%s' e del relativo registro.",
(const char*)numerazione,numero,(const char*)causale);
break;
case causre_error:
msg.format("Rilevato un errore caricando la causale relativamente al documento %s/%ld."
"Non deve essere una causale IVA",
(const char*)numerazione,numero,(const char*)causale);
break;
case cauval_error:
msg.format("Il documento %s/%ld risulta essere in valuta mentre la causale non la supporta."
"Verificare la correttezza della causale '%s'.",(const char*)numerazione,numero,(const char*)causale);
@ -3291,21 +3778,37 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& /*
xvt_statbar_set(msg);
do_events();
_movimento = new TMovimentoPN_VE(doc.in_valuta());
_movimento = new TMovimentoPN_VE(doc.in_valuta());
if (_can_write && _check_prev_cont && !prev_contabilized(doc))
_error = cont_seq_error;
if (good())
const TCodice_numerazione num(doc.numerazione());
const bool ft_em_ric = num.fattura_emettere_ricevere();
if (good())
{
compile_head_mov(doc);
if (good())
compile_rows_mov(doc);
if (ft_em_ric)
{
compile_head_mov_re(doc);
if (good())
compile_rows_mov_re(doc);
if (good() && _can_write)
write_all_re(doc, *_movimento); // Se la scrittura e' andata ok...
}
else
{
compile_head_mov(doc);
if (good())
compile_rows_mov(doc);
if (good() && _can_write)
write_all(doc, *_movimento); // Se la scrittura e' andata ok...
}
}
if (good() && _can_write)
write_all(doc, *_movimento); // Se la scrittura e' andata ok...
if (!good())

View File

@ -85,6 +85,7 @@ TDocumento_mask::TDocumento_mask(const char* td)
set_handler( F_CODCAMP, codcamp_handler );
set_handler( F_CODVAL, codval_handler );
set_handler( F_CODVAL1, codval_handler );
set_handler( F_DATACAMBIO1, datacambio_handler );
set_handler( F_NUMDOCRIF, datadocrif_handler);
set_handler( F_DATADOCRIF, datadocrif_handler);
set_handler( DLG_ELABORA, elabora_handler );
@ -361,7 +362,6 @@ bool TDocumento_mask::on_key(KEY key)
(const char*)user());
return TRUE;
}
return TVariable_mask::on_key(key);
}
@ -1559,6 +1559,8 @@ class TElabora_mask : public TAutomask
TDocumento_mask* _main;
TLista_elaborazioni _elab;
TDocument_tree _tree;
TElaborazione* _last_elab;
// @access Protected Member
protected:
@ -1622,8 +1624,9 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
break;
case F_ELAB:
case F_ANNO_ELAB:
if (e == fe_modify)
update_ndoc_filter(TRUE);
update_ndoc_filter();
break;
case F_NUMDOCRIF_ELAB:
if (e == fe_button)
@ -1911,27 +1914,43 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
// Ora è nella maschera
// filter.format("(TIPOCF==\"%s\")&&(CODCF==\"%s\")&&", (const char *)get(F_TIPOCF_ELAB), (const char *)get(F_CODCF_ELAB));
add_valuta_filter(filter);
const TString16 tipo(get(F_TIPODOC_ELAB));
TElaborazione * e = curr_elab();
const bool to_elab = get_bool(F_TYPE);
if (!field(F_CODNUM_ELAB).empty())
{
TString80 cn; cn.format("&&(CODNUM==\"%s\")", (const char*)get(F_CODNUM_ELAB));
filter << cn;
}
enable(-1, to_elab /*&& e != NULL*/);
TElaborazione * e = curr_elab();
const bool elab_changed = e != _last_elab;
_last_elab = e;
if (!to_elab && is_tipo_elaborazione )
const bool aggiungi_doc_att = get_bool(F_TYPE);
enable(-1, aggiungi_doc_att /*&& e != NULL*/);
if (!aggiungi_doc_att && is_tipo_elaborazione )
reset(-1);
if (e != NULL)
{
if (to_elab)
if (aggiungi_doc_att)
{
const TString8 num_in = e->codice_numerazione_iniziale();
if (tipo.not_empty())
{
const TString8 num_in = e->codice_numerazione_iniziale();
if (elab_changed)
{
const TString16 tipo_in(e->tipo_iniziale(0));
const char stato_in = e->stato_iniziale(0);
set(F_CODNUM_ELAB, num_in);
field(F_CODNUM_ELAB).check();
set(F_TIPODOC_ELAB , tipo_in);
field(F_TIPODOC_ELAB).check();
TString8 si; si << stato_in;
set(F_STATODOC_ELAB, si);
field(F_STATODOC_ELAB).check();
// Azzero anno di elaaborazione quando ho a che fare con degli ordini
const TTipo_documento& tipodocin = _main->doc().tipo(tipo_in);
if (tipodocin.is_ordine())
reset(F_ANNO_ELAB);
}
if (!field(F_TIPODOC_ELAB).empty())
{
const TString16 tipo(get(F_TIPODOC_ELAB));
TString80 td; td.format("&&(TIPODOC==\"%s\")", (const char *)tipo);
filter << td;
const TString& stato = get(F_STATODOC_ELAB);
@ -1958,21 +1977,6 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
filter << "(STATO==\"" << stato_in << "\")";
}
if (i==0)
{
set(F_CODNUM_ELAB, num_in);
field(F_CODNUM_ELAB).check();
set(F_TIPODOC_ELAB , tipo_in);
field(F_TIPODOC_ELAB).check();
TString8 si; si << stato_in;
set(F_STATODOC_ELAB, si);
field(F_STATODOC_ELAB).check();
// Azzero anno di elaaborazione quando ho a che fare con degli ordini
const TTipo_documento& tipodocin = _main->doc().tipo(tipo_in);
if (tipodocin.is_ordine())
reset(F_ANNO_ELAB);
}
}
if (almost_one)
filter << ')';
@ -1985,7 +1989,6 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
for (int i = 0; i < TElaborazione::_max_tipi_doc_elab; i++)
{
const TString16 tipo_in(e->tipo_iniziale(i));
if (tipo_in.not_empty())
{
if (almost_one)
@ -1999,21 +2002,6 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
if (stato_in[0] > '0')
filter << "&&(STATO==\"" << stato_in << "\")";
filter << ')';
if (i==0)
{
set(F_CODNUM_ELAB, num_in);
field(F_CODNUM_ELAB).check();
set(F_TIPODOC_ELAB , tipo_in);
field(F_TIPODOC_ELAB).check();
set(F_STATODOC_ELAB, stato_in);
field(F_STATODOC_ELAB).check();
// Azzero anno di elaaborazione quando ho a che fare con degli ordini
const TTipo_documento& tipodocin = _main->doc().tipo(tipo_in);
if (tipodocin.is_ordine())
reset(F_ANNO_ELAB);
}
}
}
if (almost_one)
filter << ')';
@ -2044,8 +2032,12 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
}
}
}
else
reset(-1);
if (!field(F_CODNUM_ELAB).empty())
{
TString80 cn; cn.format("&&(CODNUM==\"%s\")", (const char*)get(F_CODNUM_ELAB));
filter << cn;
}
TBrowse& brew = *efield(F_NDOC_ELAB).browse();
brew.set_filter(filter);
@ -2053,13 +2045,13 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
_art_filter = get(F_CODART);
TCursor* cursor = brew.cursor();
if (_art_filter.not_empty() && to_elab)
if (_art_filter.not_empty() && aggiungi_doc_att)
cursor->set_filterfunction(article_filter);
else
cursor->set_filterfunction(NULL);
TTree_field& tf = tfield(F_ROWS);
if (tipo.not_empty() && e != NULL)
if (!field(F_TIPODOC_ELAB).empty() && e != NULL)
{
tf.set_tree(&_tree);
TToken_string header(256, '\n');
@ -2071,7 +2063,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
header << " Quantità";
tf.set_header(header);
if (_art_filter.not_empty() && to_elab)
if (aggiungi_doc_att && _art_filter.not_empty())
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter, article_filter);
else
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter);
@ -2136,7 +2128,7 @@ void TElabora_mask::docrif_search()
}
TElabora_mask::TElabora_mask(TDocumento_mask& main_mask)
: TAutomask("ve0100b"), _main(&main_mask)
: TAutomask("ve0100b"), _main(&main_mask), _last_elab(NULL)
{
_myself = this;
@ -2357,9 +2349,20 @@ bool TDocumento_mask::controeuro_handler( TMask_field& f, KEY key )
return TRUE;
}
*/
bool TDocumento_mask::datacambio_handler( TMask_field& f, KEY key )
{
if (key == K_TAB && f.mask().get(F_CAMBIO).empty())
{
const TRectype & rec = cache().get("%VAL", f.mask().get(F_CODVAL1));
real c = rec.get_real("S4");
f.mask().set(F_CAMBIO, c);
}
return TRUE;
}
bool TDocumento_mask::codval_handler( TMask_field& f, KEY key )
{
if (key == K_TAB && f.focusdirty())
{